I wrote the statement below. Basically I trying to sum all transaction for the dates involved. Postr keeps the transaction status etc... Selll keeps the items sold, quantity and discount and payli keeps the amount recieved. I'm trying to check that the totals for selll match the totals for payli, as they should do but sometimes I fear they don't
THANKS!!!!!!
Fromdate = CTOD("01/10/2003"
Todate = CTOD("06/11/2003"
set default to "C:\3100"
SELECT POSTR.POSID , ;
POSTR.TRANS , ;
SUM(payli.amount) as Amount, ;
SUM((SellL.OpenDeptSP * SellL.Quantity)- SellL.Discount) AS StockAm ;
FROM POSTR ;
` INNER JOIN selll ;
ON PADL(Postr.POSId,2,"0" + PADL(Postr.TRANS,10,"0" = ;
PADL(Selll.POSId,2,"0" + PADL(Selll.TRANS,10,"0" ;
LEFT OUTER JOIN Payli ;
ON PADL(Selll.POSId,2,"0" + PADL(Selll.TRANS,10,"0" = ;
PADL(Payli.POSId,2,"0" + PADL(Payli.TRANS,10,"0" ;
INTO CURSOR TEMP ;
Where POSTR.STATUS = 0 ;
AND BETWEEN(POSTR.Date, Fromdate, Todate) ;
GROUP BY 1,2
THANKS!!!!!!
Fromdate = CTOD("01/10/2003"
Todate = CTOD("06/11/2003"
set default to "C:\3100"
SELECT POSTR.POSID , ;
POSTR.TRANS , ;
SUM(payli.amount) as Amount, ;
SUM((SellL.OpenDeptSP * SellL.Quantity)- SellL.Discount) AS StockAm ;
FROM POSTR ;
` INNER JOIN selll ;
ON PADL(Postr.POSId,2,"0" + PADL(Postr.TRANS,10,"0" = ;
PADL(Selll.POSId,2,"0" + PADL(Selll.TRANS,10,"0" ;
LEFT OUTER JOIN Payli ;
ON PADL(Selll.POSId,2,"0" + PADL(Selll.TRANS,10,"0" = ;
PADL(Payli.POSId,2,"0" + PADL(Payli.TRANS,10,"0" ;
INTO CURSOR TEMP ;
Where POSTR.STATUS = 0 ;
AND BETWEEN(POSTR.Date, Fromdate, Todate) ;
GROUP BY 1,2