Removing wrapper AssetDeprecations
This commit is contained in:
parent
b863cdff91
commit
8893499650
|
|
@ -130,7 +130,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@for (position of amortizations.positions; track $index) {
|
@for (position of amortizations; track $index) {
|
||||||
<tr [class]="clazz(position)" class="text-center">
|
<tr [class]="clazz(position)" class="text-center">
|
||||||
<th scope="row" >{{$index+1}}</th>
|
<th scope="row" >{{$index+1}}</th>
|
||||||
<td>{{ position.when.year }}</td>
|
<td>{{ position.when.year }}</td>
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
<td>{{ position.calculatedDepreciation | number:'1.2-2' }}</td>
|
<td>{{ position.calculatedDepreciation | number:'1.2-2' }}</td>
|
||||||
<td>{{ position.sum | number:'1.2-2' }}</td>
|
<td>{{ position.sum | number:'1.2-2' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if( 12 === position.when.month || $index === amortizations.positions.length-1){
|
@if( 12 === position.when.month || $index === amortizations.length-1){
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { ReactiveFormsModule, FormGroup, Validators, FormControl, FormBuilder, AbstractControl } from '@angular/forms';
|
import { ReactiveFormsModule, FormGroup, Validators, FormControl, FormBuilder, AbstractControl } from '@angular/forms';
|
||||||
import { DecimalPipe } from '@angular/common';
|
import { DecimalPipe } from '@angular/common';
|
||||||
|
|
||||||
import {Asset, Positions, AssetPlanPosition, TypeDepreciation, YearMonth, AssetLifeChange, AssetDepreciationMethod, YearMonthUtil } from '../assets/asset';
|
import {Asset, AssetPlanPosition, TypeDepreciation, YearMonth, AssetLifeChange, AssetDepreciationMethod, YearMonthUtil } from '../assets/asset';
|
||||||
import {AssetService} from '../assets/service/asset.service'
|
import {AssetService} from '../assets/service/asset.service'
|
||||||
import {TranslateModule} from "@ngx-translate/core";
|
import {TranslateModule} from "@ngx-translate/core";
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ export class AssetCalculatorComponent implements OnInit, OnDestroy{
|
||||||
|
|
||||||
lifeFormArray ;
|
lifeFormArray ;
|
||||||
assetsDepreciationFormGroup : FormGroup;
|
assetsDepreciationFormGroup : FormGroup;
|
||||||
amortizations = new Positions();
|
amortizations : AssetPlanPosition[]=[];
|
||||||
|
|
||||||
constructor(private fb: FormBuilder,
|
constructor(private fb: FormBuilder,
|
||||||
private assetService : AssetService){
|
private assetService : AssetService){
|
||||||
|
|
@ -130,10 +130,10 @@ export class AssetCalculatorComponent implements OnInit, OnDestroy{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateToValues( positions:Positions ) {
|
calculateToValues( positions:AssetPlanPosition[] ) {
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
let sumThisYear = 0;
|
let sumThisYear = 0;
|
||||||
positions.positions.forEach(position => {
|
positions.forEach(position => {
|
||||||
position.calculatedDepreciation *= 0.01;
|
position.calculatedDepreciation *= 0.01;
|
||||||
sum += position.calculatedDepreciation;
|
sum += position.calculatedDepreciation;
|
||||||
position.sum = sum;
|
position.sum = sum;
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,5 @@ export class AssetPlanPosition{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Positions {
|
|
||||||
positions : AssetPlanPosition[]=[];
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { HttpClient} from '@angular/common/http';
|
import { HttpClient} from '@angular/common/http';
|
||||||
import { Asset, Positions } from '../asset';
|
import { Asset, AssetPlanPosition } from '../asset';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,8 +20,8 @@ export class AssetService {
|
||||||
|
|
||||||
constructor(private http: HttpClient) { }
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
calculate(asset: Asset) : Observable<Positions>{
|
calculate(asset: Asset) : Observable<AssetPlanPosition[]>{
|
||||||
return this.http.post<Positions>(this.assetUrl, asset) ;
|
return this.http.post<AssetPlanPosition[]>(this.assetUrl, asset) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue