REPORTFORM;DB5.frf
TITLE;รายงานสรุปหนี้เพื่อวางบิล
SQL;SELECT ARCARD.ACCID, ARMST.XCOMP, SUM(IF(LEFT(TRTYPE,2)="AR",ARCARD.REPBAL,0)) AS XDEBT,
SQL;SUM(IF(LEFT(TRTYPE,2)="DR",ARCARD.REPBAL,0)) AS XDISC
SQL;FROM ARCARD INNER JOIN ARMST ON ARCARD.ACCID = ARMST.ACCID
SQL;WHERE (LEFT(TRTYPE,2) =  'AR'  OR LEFT(TRTYPE,2) = 'DR')
SQL;GROUP BY 1,2
SQL; 
CONDITION;ตั้งแต่รหัสลูกหนี้~ARCARD.ACCID~Chr~2~SELECT ACCID FROM ARMST~AR
CONDITION;ตั้งแต่วันที่~ARCARD.DATEDOC~Date~2~~
EXCELSQL;SELECT ARCARD.ACCID, ARMST.XCOMP, SUM(IF(LEFT(TRTYPE,2)="AR",ARCARD.REPBAL,0)) AS XDEBT,
EXCELSQL;SUM(IF(LEFT(TRTYPE,2)="DR",ARCARD.REPBAL,0)) AS XDISC
EXCELSQL;FROM ARCARD INNER JOIN ARMST ON ARCARD.ACCID = ARMST.ACCID
EXCELSQL;WHERE (LEFT(TRTYPE,2) =  'AR'  OR LEFT(TRTYPE,2) = 'DR')
EXCELSQL;GROUP BY 1,2
EXCELSQL; 
