REPORTFORM;AO1.frf
TITLE;รายละเอียดการจ่ายเงินมัดจำ
SQL;select downpay.DOCNO, downpay.DATEDOC,
SQL;downpay.ACCID, apmst.XCOMP,
SQL;downpay.AMOUNT_D,
SQL;SUM(if(left(bktr.PAYTYPE,2) = '01',bktr.AMT_OUT,0)) AS CASHAMT,
SQL;SUM(if(left(bktr.PAYTYPE,2) = '02',bktr.AMT_OUT,0)) AS CHKAMT,
SQL;SUM(if(left(bktr.PAYTYPE,2) = '05',bktr.AMT_OUT,0)) AS TAXAMT,
SQL;bktr.CHKNO, bktr.DATECHK, downpay.NBAL
SQL;from downpay 
SQL;left join bktr on downpay.DOCNO = bktr.DOCNO
SQL;left join apmst on downpay.ACCID = apmst.ACCID
SQL;group by downpay.DOCNO
SQL;order by downpay.DOCNO, downpay.DATEDOC, downpay.ACCID
CONDITION;ตั้งแต่เลขที่เอกสาร~DOWNPAY.DOCNO~Chr~2~SELECT DOCNO FROM DOWNPAY~
CONDITION;ตั้งแต่วันที่เอกสาร~DOWNPAY.DATEDOC~Date~2~~
