I am creating an invoicing system and as you can imagine there will be a couple calculations which would need to be done, namely;
- Cost of items (cost of one unit + number of units), Cost of labour (cost per hour + number of hours).
- Total (Cost of Items), Total (Cost of Labour).
- VAT added ((Total items + Total Labour) x 15%).
- Grand Total (Total items + Total Labour + VAT)
I thought the best way to break it up would be to have an “Invoice” database with a relation to a “Items” & “Labour” databases. In the “Items” & “Labour” data base there is a column for “Cost per unit” (DataType: Money), a column for “Number of Units” (DataType: Int), also a column called “TotalCost” (DataType: Money).
- How do I get the “Cost per unit” + “Number of Units” to automaticly calculate in “TotalCost” column?
In my Front end I would like to make it as user friendly as posible, so I have two input areas where the User can add “Items” & “Labour” sepretly and it be shown in two seperate data tables.
How can I add the “Total Cost” of all the rows in the table, and show the Total amount in a text field below the table?
I would then like to add the two Totals of the “Items” & “Labour” together and show in a text field, I would imagine this would be the same logic as Point 2?
I would like to then save the total of Point 3 to the “Invoice” database, which i will then use to calculate VAT and the Grand Total (Total + VAT), would this be the best way to calcualte this or is there a simplre way?
How can you set a currency in the money in the DataType: Money?