Re: Applying payment to an invoice

Dale E. Reed Jr. ( (no email) )
Mon, 29 Dec 1997 12:42:38 -0800

Graeme Slogrove wrote:
>
> Hi,
>
> I'm writing a script to apply payments via the Web - this is what I
> have
>
> ---
> SQL = "SELECT CustomerId FROM Invoices WHERE InvoiceId = " &
> 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.  (daler@iea.com)_________________________________________________________________       IEA Software, Inc.      |  RadiusNT, Emerald, and NT FAQs Internet Solutions for Today  |   http://www.iea-software.com