如何在角度4的TableList / Grid中获取GrandTotal?

时间:2018-12-30 08:07:51

标签: angular

我只是想在总交易中添加方法以获得表列表/网格中的列表。

billing.component.ts

// Calculate sale billing Grand Amount
calculateGrandAmount(salesBillingForm: any) {
    debugger
    let totalAmt = this.calculateAmount();
    let calcGrandTot = salesBillingForm.GrandAmount.setValue((totalAmt - (salesBillingForm.Discount.value)) + ((totalAmt - (salesBillingForm.Discount.value)) * 0.13));
    return ((calcGrandTot)).toFixed(2);
}

billing.component.html

<tbody *ngFor="let row of SalesBilling">
<tr style="background:#eceaea">
    <td align="right">{{row.NetAmount.toFixed(2)}}</td>
    <td align="right">{{row.VATAmount.toFixed(2)}}</td>
    <td align="right">{{row.GrandAmount.toFixed(2)}}</td>
    <!-- <td align="right">{{calculateGrandAmount(salesBillingForm).toFixed(2)}}</td>--> </tr>
</tbody>

1 个答案:

答案 0 :(得分:0)

您可以使用row从HTML传递<td>{{functionName(row)}}并在ts函数中计算值:

functionName(row){
    //Calculate and return some value
}