Re: Applying payment to an invoice
Dale E. Reed Jr. ( (no email) )
Mon, 29 Dec 1997 12:42:38 -0800
Graeme Slogrove wrote:
> I'm writing a script to apply payments via the Web - this is what I
> SQL = "SELECT CustomerId FROM Invoices WHERE InvoiceId = " &
> SQL_1 = "INSERT INTO Payments (CustomerId, Amount, Date, PayInfo)
> VALUES " SQL_2 = "(" & iCustomerId & "," & Amount & ",'" & dPayDate
> & "','" & sPayInfo & "')"
> SQL = "SELECT LastId=@@IDENTITY from Payments"
> iPaymentId = rstSecond("LastId")
> SQL = "UPDATE InvoiceItems SET PaymentId = " & iPaymentId & " WHERE
> InvoiceId = " & InvoiceId
> SQL = "UPDATE MasterAccounts SET BALANCE = BALANCE - " & Amount
> Am I missing anything, or is this correct ?
That all looks good except its balannce = balcen + amount. A negative
amount means they owe, a positive amount means they have a credit.
-- Dale E. Reed Jr. (email@example.com)_________________________________________________________________ IEA Software, Inc. | RadiusNT, Emerald, and NT FAQs Internet Solutions for Today | http://www.iea-software.com