Some changes with row life of asset
This commit is contained in:
parent
aaa358d3b7
commit
1509538afb
|
|
@ -71,20 +71,28 @@ interface FormValues {
|
||||||
factorValue : asset.factorValue,
|
factorValue : asset.factorValue,
|
||||||
})
|
})
|
||||||
for( let i = 1; i < asset.life.length; i++ ){
|
for( let i = 1; i < asset.life.length; i++ ){
|
||||||
|
|
||||||
this.addChangeValue();
|
this.addChangeValue();
|
||||||
// /this.lifeFormArray.controls[ i -1 ]..patchValue( asset.life[i].initial );
|
|
||||||
|
const row = this.lifeFormArray.controls[ i -1 ] as FormGroup;
|
||||||
|
row.get( 'initialValueAsset' )?.setValue(asset.life[i].initial);
|
||||||
|
// row.get( 'year_month' )?.setValue( asset.life[i].when.toFormValue());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private controlsToAsset() : Asset {
|
private controlsToAsset() : Asset {
|
||||||
|
|
||||||
const formValues = this.assetsDepreciationFormGroup.value as FormValues;
|
const formValues = this.assetsDepreciationFormGroup.value as FormValues;
|
||||||
const when = new YearMonth( formValues.year_month );
|
const when = new YearMonth( formValues.year_month );
|
||||||
const asset = new Asset( formValues.depreciationRate, when, formValues.typeDepreciation, formValues.factorValue );
|
const asset = new Asset( formValues.depreciationRate, when, formValues.typeDepreciation, formValues.factorValue );
|
||||||
const creationlifeChange = new AssetLifeChange(when, formValues.initialValueAsset , 0, 0);
|
const creationlifeChange = new AssetLifeChange(when, formValues.initialValueAsset , 0, 0);
|
||||||
asset.addChange( creationlifeChange );
|
asset.addChange( creationlifeChange );
|
||||||
for (let changeControlGroup of this.lifeFormArray.controls) {
|
|
||||||
|
for( let changeControlGroup of this.lifeFormArray.controls ) {
|
||||||
const initialValueAsset = changeControlGroup.get('initialValueAsset')?.value;
|
const initialValueAsset = changeControlGroup.get('initialValueAsset')?.value;
|
||||||
const year_month = changeControlGroup.get('year_month')?.value;
|
const year_month = changeControlGroup.get('year_month')?.value;
|
||||||
asset.addChange(new AssetLifeChange(new YearMonth(year_month), initialValueAsset, 0, 0));
|
asset.addChange(new AssetLifeChange(new YearMonth(year_month), initialValueAsset, 0, 0));
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ export class YearMonth{
|
||||||
this.month =month;
|
this.month =month;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
toFormValue(){
|
||||||
|
return this.year + "-" + this.month;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue