From 5f8407ae4c60922057e2f88f65178773786bddb4 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 16 Oct 2022 12:46:41 +0530 Subject: calculating currency/other floating point values with currency.js --- src/views/invoice/new.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/views/invoice') diff --git a/src/views/invoice/new.js b/src/views/invoice/new.js index 429808f..be180cf 100644 --- a/src/views/invoice/new.js +++ b/src/views/invoice/new.js @@ -21,7 +21,7 @@ import ItemTable from '../../components/tables/invoice-item-table'; import InvoiceSummary from '../../components/tables/invoice-summary'; import { InvoiceClient } from '../../classes/client'; -import { calcSum } from '../../classes/item'; +import { calcSum, currency } from '../../classes/item'; import { useState, useEffect } from 'react'; @@ -31,7 +31,13 @@ const NewInvoicePage = () => { const [items, setItems] = useState([]); //const [isInterstate, setIsInterstate] = useState(false); const isInterstate = false; // temporary - const [sum, setSum] = useState({}); + const [sum, setSum] = useState({ + GST: currency(0), + Discount: currency(0), + UnitPrice: currency(0), + Amount: currency(0), + Quantity: currency(0) + }); useEffect(() => setShippingAddressId(-1), [client]); -- cgit v1.2.3