Disable Fixed Asset.
This commit is contained in:
parent
fb175d66ff
commit
7f683639c6
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
| <a class="navbar-brand" href="/about-me">O mnie</a>
|
| <a class="navbar-brand" href="/about-me">O mnie</a>
|
||||||
| <a class="navbar-brand" href="/asset-calculator">Kalkulator amortyzacyjny</a>
|
| <a class="navbar-brand" href="/asset-calculator">Kalkulator amortyzacyjny</a>
|
||||||
| <a class="navbar-brand" href="/fixed-asset">Środki trwałe</a>
|
<!-- | <a class="navbar-brand" href="/fixed-asset">Środki trwałe</a> -->
|
||||||
| <a class="navbar-brand" href="/quotes">Kursy</a>
|
| <a class="navbar-brand" href="/quotes">Kursy</a>
|
||||||
<!-- <a class="navbar-brand" href="/jobfinder">Oferty</a> -->
|
<!-- <a class="navbar-brand" href="/jobfinder">Oferty</a> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,16 @@ export class AssetCalculatorComponent implements OnInit, OnDestroy{
|
||||||
|
|
||||||
lifeFormArray = new FormArray<FormGroup>([]);
|
lifeFormArray = new FormArray<FormGroup>([]);
|
||||||
|
|
||||||
assetsDepreciationFormGroup = new FormGroup( {
|
assetsDepreciationFormGroup = new FormGroup({
|
||||||
initialValueAsset : new FormControl( 5000, [ Validators.required, this.currencyValidator ]),
|
initialValueAsset : new FormControl<number>( 5000, [ Validators.required, this.currencyValidator ]),
|
||||||
rate : new FormControl( 20 ) ,
|
rate : new FormControl<number>( 20 ) ,
|
||||||
year_month : new FormControl( "2024-10" ),
|
year_month : new FormControl<string>( "2024-10" ),
|
||||||
typeDepreciation : new FormControl( TypeDepreciation.linear ),
|
typeDepreciation : new FormControl<TypeDepreciation>( TypeDepreciation.linear ),
|
||||||
factor : new FormControl( 2/*, [Validators.required,Validators.max(2)]*/ ),
|
factor : new FormControl<number>( 2/*, [Validators.required,Validators.max(2)]*/ ),
|
||||||
|
|
||||||
} );
|
} as {
|
||||||
|
[key in keyof FormValues]: FormControl<FormValues[key]>
|
||||||
|
});
|
||||||
|
|
||||||
constructor(private assetService : AssetService ){
|
constructor(private assetService : AssetService ){
|
||||||
this.assetsDepreciationFormGroup.valueChanges.subscribe( (value) => this.calculate() );
|
this.assetsDepreciationFormGroup.valueChanges.subscribe( (value) => this.calculate() );
|
||||||
|
|
@ -79,7 +81,7 @@ export class AssetCalculatorComponent implements OnInit, OnDestroy{
|
||||||
|
|
||||||
private controlsToAsset() : Asset {
|
private controlsToAsset() : Asset {
|
||||||
|
|
||||||
const formValues = this.assetsDepreciationFormGroup.value as FormValues;
|
const formValues = this.assetsDepreciationFormGroup.getRawValue();
|
||||||
|
|
||||||
const when = new YearMonth( formValues.year_month );
|
const when = new YearMonth( formValues.year_month );
|
||||||
const asset = new Asset( when );
|
const asset = new Asset( when );
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export class YearMonthUtil{
|
||||||
return ym.year + '-' + ym.month ;
|
return ym.year + '-' + ym.month ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static toToday( ):YearMonth{
|
static today( ):YearMonth{
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
return new YearMonth( today.getFullYear() + '-' +today.getMonth()+1 );
|
return new YearMonth( today.getFullYear() + '-' +today.getMonth()+1 );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ export class FixedAssetComponent {
|
||||||
|
|
||||||
const nrInv = control.get('nrInv')?.value;
|
const nrInv = control.get('nrInv')?.value;
|
||||||
const initialValue = control.get('initialValue')?.value;
|
const initialValue = control.get('initialValue')?.value;
|
||||||
const yearMonth = YearMonthUtil.toToday();
|
const yearMonth = YearMonthUtil.today();
|
||||||
const asset = new Asset( yearMonth );
|
const asset = new Asset( yearMonth );
|
||||||
const assetLifeChange = new AssetLifeChange( yearMonth, initialValue, 0, 0 );
|
const assetLifeChange = new AssetLifeChange( yearMonth, initialValue, 0, 0 );
|
||||||
asset.addChange( assetLifeChange );
|
asset.addChange( assetLifeChange );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue