T
thehikingfool
I'm not sure of the best approach to this. I need a column that will show the
current balance of an invoice. Sometimes the customer will make several
payments so I need to see a current balance on each record line.
Here is what I have so far...
SELECT PAYMENT.PAYMENTID, PAYMENTLINK.INVOICEID, PAYMENT.BUYSELL,
INVOICE.INVOICENUMBER, PAYMENT.CREATEDATE, INVOICE.TOTALPRICE,
PAYMENTLINK.CASHDISCOUNT, PAYMENTLINK.MISCDISCOUNT, PAYMENTLINK.AMOUNTPAID
FROM INVOICE INNER JOIN (PAYMENTLINK INNER JOIN PAYMENT ON
PAYMENTLINK.PAYMENTID = PAYMENT.PAYMENTID) ON INVOICE.INVOICEID =
PAYMENTLINK.INVOICEID
GROUP BY PAYMENT.PAYMENTID, PAYMENTLINK.INVOICEID, PAYMENT.BUYSELL,
INVOICE.INVOICENUMBER, PAYMENT.CREATEDATE, INVOICE.TOTALPRICE,
PAYMENTLINK.CASHDISCOUNT, PAYMENTLINK.MISCDISCOUNT, PAYMENTLINK.AMOUNTPAID
HAVING (((PAYMENT.BUYSELL)="Y"))
ORDER BY PAYMENTLINK.INVOICEID, PAYMENT.CREATEDATE;
current balance of an invoice. Sometimes the customer will make several
payments so I need to see a current balance on each record line.
Here is what I have so far...
SELECT PAYMENT.PAYMENTID, PAYMENTLINK.INVOICEID, PAYMENT.BUYSELL,
INVOICE.INVOICENUMBER, PAYMENT.CREATEDATE, INVOICE.TOTALPRICE,
PAYMENTLINK.CASHDISCOUNT, PAYMENTLINK.MISCDISCOUNT, PAYMENTLINK.AMOUNTPAID
FROM INVOICE INNER JOIN (PAYMENTLINK INNER JOIN PAYMENT ON
PAYMENTLINK.PAYMENTID = PAYMENT.PAYMENTID) ON INVOICE.INVOICEID =
PAYMENTLINK.INVOICEID
GROUP BY PAYMENT.PAYMENTID, PAYMENTLINK.INVOICEID, PAYMENT.BUYSELL,
INVOICE.INVOICENUMBER, PAYMENT.CREATEDATE, INVOICE.TOTALPRICE,
PAYMENTLINK.CASHDISCOUNT, PAYMENTLINK.MISCDISCOUNT, PAYMENTLINK.AMOUNTPAID
HAVING (((PAYMENT.BUYSELL)="Y"))
ORDER BY PAYMENTLINK.INVOICEID, PAYMENT.CREATEDATE;