// invoices
REDEFINE xBROWSE oLbxB1 ;
RECORDSET oRsInv ;
COLUMNS "REPAIR NUMBER", ;
"TRANSACTION TYPE", ;
"INVOICED DATE", ;
"TOTAL", ;
"BALANCE" ;
COLSIZES 70,80,80,70,70 ;
HEADERS "Invoice #", ;
"Type", ;
"Date", ;
"Total", ;
"Balance" ;
ID 139 of oCust2 ;
AUTOCOLS LINES CELL
oLbxB1:nMarqueeStyle := MARQSTYLE_HIGHLROW
// trap double click on Invoice line
oLbxB1:bLDblClick := { |nRow,nCol | _PayUpDt( oRsInv, oRsPay, oLbxB2) }
// payments
REDEFINE xBROWSE oLbxB2 ;
RECORDSET oRsPay ;
COLUMNS "INVOICE NUMBER", ;
"DATE COLLECTED", ;
"PAYMENT METHOD", ;
"PAYMENT AMOUNT" ;
COLSIZES 80,80,80,80 ;
HEADERS "Invoice", ;
"Date", ;
"Pymt Meth", ;
"Amount" ;
ID 140 of oCust2 ;
AUTOCOLS LINES CELL
oLbxB2:nMarqueeStyle := MARQSTYLE_HIGHLROW
...
...
...
//-----------------------
Static Func _PayUpDt( oRsInv, oRsPay, oLbxB2)
Local cSql,oErr,nRepairNumber
nRepairNumber := oRsInv:Fields("Repair Number"):Value
oRsPay:Close()
*oLbxB2:bKeyCount := { || 0 } // kills off the listbox
*oLbxB2:bKeyNo := { || 0 } // do not use
// payments
cSql := "SELECT "
cSql += "p.[Payment Number] AS pn, "
cSql += "d.Counter, "
cSql += "d.[Payment Method], "
cSql += "d.[Payment Amount], "
cSql += "d.Reference, "
cSql += "d.[Customer ID], "
cSql += "d.[Date Collected], "
cSql += "d.[Card Number], "
cSql += "d.[Card Name], "
cSql += "d.[Check Number], "
cSql += "d.Deposit, "
cSql += "d.Depositted, "
cSql += "d.User, "
cSql += "d.Computer, "
cSql += "d.Void, "
cSql += "p.[Invoice Number], "
cSql += "p.Amount "
cSql += "FROM [Payment Details] AS p "
cSql += "LEFT JOIN Payments AS d ON p.[Payment Number] = d.Counter "
cSql += "Where p.[Invoice Number] = "+ltrim(str(nRepairNumber))
// do not have to re-create the recordset .. just re-use
*oRsPay := TOleAuto():New( "ADODB.Recordset" )
*oRsPay:CursorType := 1 // opendkeyset
*oRsPay:CursorLocation := 3 // local cache
*oRsPay:LockType := 3 // lockoportunistic
TRY
oRsPay:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening PAYMENTS table" )
RETURN(.t.)
END TRY
oLbxB2:ReFresh()
Return(nil)