I have following tables in mysql:
salesinvoices (with invoice number, ledgerid and date)
salesinvoiceitems (with invoice number)
payments( with invoice number, ledgerid and date)
Now i need to calculate the total amount from salesinvoiceitems table against a specific invoiceNumber for a particular ledgerid by using the calculations of taxations etc (columns included in table).
Then i have a payments table that maintains the records of all the payments made against specific invoices date wise. This table also contains invoice number and ledger id.
I need to generate a report for a specific ledger id showing the end balance. I am clueless for such query. Please shed some light.