I'm using Laravel 5.7
& VueJs 2.5.*
...
I want to display GrandTotal
on my view table, but i don't know what i'm doing wrong.
Where i'm displaying GrandTotal
:
<tr v-for="ctInvoice in ctInvoices" :key="ctInvoice.id">
<td>{{ formatPrice(ctInvoice.ct_invoice_grand_total) }}</td>
</tr>
My VueJs
data()
:
data() {
return {
ctInvoices: {},
customers: null,
form: new Form({
id: "",
customer_id: "",
ct_invoice_no: "",
ct_invoice_date: "",
ct_invoice_fares_total: 0,
ct_invoice_taxes_grand_total: 0,
ct_invoice_grand_total: 0,
ctInvoiceItems: [{
id: "",
ct_invoice_id: "",
ct_passenger_name: "",
ct_fares: 0,
ct_total_tax_breakup: 0,
ct_sub_total: 0
}]
})
};
Format Amount with this method()
:
formatPrice(value) {
let val = (value / 1).toFixed().replace(".", ".");
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); //75.674,00
},
Image For Better Understanding:
One item output from ctInvoices
array
ctInvoices:Array[20] 0:Object created_at:"2018-10-27 15:13:06" ct_Invoice_date:"2018-10-31" ct_Invoice_fares_total:"600.00" ct_Invoice_grand_total:"1000.00" ct_Invoice_grand_total_words:null ct_Invoice_taxes_grand_total:"400.00" ct_Invoice_terms:null ct_invoice_items:Array1 ct_invoice_no:"111-222-333" customer:Object customer_id:3 id:22 updated_at:"2018-10-27 15:13:06"