Added total price calculator
This commit is contained in:
parent
2055c1f27b
commit
12fa5ade5c
@ -57,7 +57,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td style="width: 10%">
|
<td style="width: 10%">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="Cost" [value]="cost() | currency" [readonly]="true">
|
<input matInput placeholder="Total Cost" [value]="cost() | currency" [readonly]="true">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -49,12 +49,13 @@ export class FormulaManagerComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cost() {
|
cost() {
|
||||||
console.log(
|
if (!this.formula || this.formula.components.filter(row => typeof row.component.get == 'function').length > 0)
|
||||||
this.componentCosts.reduce((acc, row) => {
|
return 0;
|
||||||
//acc + Number(new RegExp(/\$(\d+\.\d+)/).exec(row.nativeElement.innerHtml)[1])
|
let cost = 0;
|
||||||
return acc;
|
this.formula.components.forEach(
|
||||||
}, 0)
|
row => (cost += (((row.quantity / this.formula.total) * this._newTotal) / 1000) * row.component.cost)
|
||||||
);
|
);
|
||||||
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt() {
|
prompt() {
|
||||||
|
Loading…
Reference in New Issue
Block a user