diff --git a/src/app/asset-calculator/asset-calculator.component.html b/src/app/asset-calculator/asset-calculator.component.html index 29248fa..60cced5 100644 --- a/src/app/asset-calculator/asset-calculator.component.html +++ b/src/app/asset-calculator/asset-calculator.component.html @@ -6,16 +6,19 @@ background-color: #f8f9fa; /* Tło formularza */ } .frame2 { - border: 2px solid rgb(225, 228, 86); /* Kolor ramki */ + border: 2px solid rgb(197, 195, 231); /* Kolor ramki */ border-radius: 8px; /* Zaokrąglenie krawędzi */ padding: 20px; /* Odstęp wewnętrzny */ background-color: #f8f9fa; /* Tło formularza */ } +
-

Kalkulator amortyzacyjny

+
Kalkulator amortyzacyjny
+
+
@@ -87,8 +90,11 @@
-
- + +
Plan amortyzacji
+
+
+
@@ -100,19 +106,28 @@ @for (position of positions.positions; track $index) { - - - + @if( 12 == position.when.month || $index == positions.positions.length-1){ + + + + + } } -
Lp
{{$index+1}} {{ position.when.year }} {{ position.when.month }} {{ position.calculatedDepreciation | number:'1.2-2' }} {{ position.sum | number:'1.2-2' }}
+ +
+
Łącznie w roku {{position.when.year}} odpis : {{ position.sumThisYear| number:'1.2-2' }}
+
+
+ +
- + diff --git a/src/app/asset-calculator/asset-calculator.component.ts b/src/app/asset-calculator/asset-calculator.component.ts index 2577bd2..1c9d03c 100644 --- a/src/app/asset-calculator/asset-calculator.component.ts +++ b/src/app/asset-calculator/asset-calculator.component.ts @@ -67,10 +67,19 @@ export class AssetCalculatorComponent implements OnInit{ calculateToValues() { let sum :number = 0; + let sumThisYear: number = 0; for(let position of this.positions.positions ){ position.calculatedDepreciation = position.calculatedDepreciation *0.01; + sum += position.calculatedDepreciation; position.sum = sum; + + if( 1 == position.when.month ){ + sumThisYear = position.calculatedDepreciation; + }else{ + sumThisYear += position.calculatedDepreciation + } + position.sumThisYear = sumThisYear } } diff --git a/src/app/asset-calculator/assets/asset.ts b/src/app/asset-calculator/assets/asset.ts index dfe6c09..9e9c758 100644 --- a/src/app/asset-calculator/assets/asset.ts +++ b/src/app/asset-calculator/assets/asset.ts @@ -38,6 +38,7 @@ export class AssetPlanPosition{ when : YearMonth = new YearMonth(); calculatedDepreciation : number = 0; sum:number = 0; + sumThisYear:number = 0; }