Applying payment to an invoice

Graeme Slogrove ( (no email) )
Mon, 29 Dec 1997 18:18:00 +0200

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 ?

Regards, Graeme

---Graeme Slogrove, BSc (Eng) Elec (Wits)FastLight Data Distribution cchttp://www.fdd.netTel: +27-(0)11-706-0212   Fax: +27-(0)11-706-0812