REPORTFORM;AP-4_E.frf
TITLE;DEBT INFORMATION BY DUE DATE
SQL;select apcard.DOCNO, apcard.DATEDOC, apcard.TERM, apcard.DUEDATE,
SQL;apcard.ACCID, apmst.XCOMP, apcard.AMOUNT_D, 
SQL;apcard.CUS_PO, apcard.TAXNO, apcard.DPTID, depart.DDESC
SQL;from apcard 
SQL;left join apmst on apcard.ACCID = apmst.ACCID
SQL;left join depart on apcard.DPTID = depart.DID
SQL;where left(apcard.TRTYPE,2) = "AP"
SQL;order by apcard.DUEDATE, apcard.DATEDOC, apcard.DOCNO
CONDITION;FROM DUEDATE~APCARD.DUEDATE~Date~2~~
CONDITION;FROM VENDOR CODE~APCARD.ACCID~Chr~2~SELECT ACCID FROM APMST ~AP
EXCELSQL;select apcard.DOCNO AS "เลขที่เอกสาร", apcard.DATEDOC AS "วันที่เอกสาร", apcard.DUEDATE AS "วันครบกำหนดชำระ",
EXCELSQL;apcard.ACCID AS "รหัสเจ้าหนี้", apmst.XCOMP AS "ชื่อบริษัท", apcard.AMOUNT_D AS "ยอดตั้งหนี้", 
EXCELSQL;apcard.CUS_PO AS "เลขที่ใบสั่งซื้อ",apcard.TAXNO AS "เลขที่ใบกำกับภาษี",apcard.RECAMT AS "ยอดชำระ", apcard.NBAL AS "ยอดคงเหลือ"
EXCELSQL;from apcard 
EXCELSQL;left join apmst on apcard.ACCID = apmst.ACCID
EXCELSQL;where left(apcard.TRTYPE,2) = "AP" and apcard.nbal  <> 0
EXCELSQL;order by apcard.DOCNO, apcard.DATEDOC
EXCELSQL;select apcard.DOCNO AS "เลขที่เอกสาร", apcard.DATEDOC AS "วันที่เอกสาร", apcard.DUEDATE AS "วันครบกำหนดชำระ",
EXCELSQL;apcard.ACCID AS "รหัสเจ้าหนี้", apmst.XCOMP AS "ชื่อบริษัท", apcard.AMOUNT_D AS "ยอดตั้งหนี้", 
EXCELSQL;apcard.CUS_PO AS "เลขที่ใบสั่งซื้อ",apcard.TAXNO AS "เลขที่ใบกำกับภาษี",apcard.RECAMT AS "ยอดชำระ", apcard.NBAL AS "ยอดคงเหลือ"
EXCELSQL;from apcard 
EXCELSQL;left join apmst on apcard.ACCID = apmst.ACCID
EXCELSQL;where left(apcard.TRTYPE,2) = "AP" and apcard.nbal  <> 0
EXCELSQL;order by apcard.DOCNO, apcard.DATEDOC
