REPORTFORM;PR6.frf
TITLE;รายงานแสดงรายละเอียดใบเสนอซื้อตามรหัสเหตุ วันที่
SQL;SELECT prhead.DOCNO,prhead.DATEDOC, pr.DATEAUTHORIZE,
SQL; prhead.REASONID, reason.REASON, 
SQL;prhead.DPTID, depart.DDESC, pr.XSTATUS, pr.LINE, 
SQL;pr.ID, pr.XDESC, pr.XQ, pr.QUAN, pr.UNIT_SAL,
SQL;pr.PRICE, pr.DISCL, pr.AMOUNT_L,
SQL;pr.ACCID, apmst.XCOMP
SQL;FROM pr
SQL;LEFT  JOIN prhead ON pr.DOCNO = prhead.DOCNO
SQL;LEFT JOIN reason ON prhead.REASONID = reason.REASONID
SQL;LEFT JOIN depart ON prhead.DPTID = depart.DID
SQL;LEFT JOIN apmst ON pr.ACCID = apmst.ACCID
SQL;ORDER BY  prhead.REASONID, prhead.DOCNO, prhead.DATEDOC,  prhead.DPTID, pr.LINE
CONDITION;ตั้งแต่รหัสเหตุผล~PRHEAD.REASONID~Chr~2~SELECT REASONID FROM REASON~REA
CONDITION;ตั้งแต่วันที่~PR.DATEDOC~Date~2~~
CONDITION;เงื่อนไข~PR.XSTATUS~TextFile~~PRCHK.TXT~
EXCELSQL;SELECT prhead.DOCNO AS "เลขที่เอกสาร", prhead.DATEDOC AS "วันที่เอกสาร", pr.DATEAUTHORIZE AS "วันที่อนุมัติ",
EXCELSQL;prhead.REASONID AS "รหัสเหตุผล", reason.REASON AS "เหตุผล", 
EXCELSQL;prhead.DPTID AS "รหัสแผนก", depart.DDESC AS "ชื่อ/รายละเอียดแผนก", pr.XSTATUS AS "สถานะ", 
EXCELSQL;pr.ID AS "รหัสสินค้า", pr.XDESC AS "ชื่อ/รายละเอียดสินค้า", 
EXCELSQL;pr.XQ AS "จำนวนขออนุมัติ", pr.QUAN AS "จำนวนอนุมัติ", pr.UNIT_SAL AS "หน่วย",
EXCELSQL;pr.PRICE AS "ราคา", pr.DISCL AS "ส่วนลด", pr.AMOUNT_L AS "ยอดเงิน",
EXCELSQL;pr.ACCID AS "รหัสลูกค้า", apmst.XCOMP AS "ชื่อลูกค้า"
EXCELSQL;FROM pr
EXCELSQL;LEFT  JOIN prhead ON pr.DOCNO = prhead.DOCNO
EXCELSQL;LEFT JOIN reason ON prhead.REASONID = reason.REASONID
EXCELSQL;LEFT JOIN depart ON prhead.DPTID = depart.DID
EXCELSQL;LEFT JOIN apmst ON pr.ACCID = apmst.ACCID
EXCELSQL;ORDER BY  prhead.REASONID, prhead.DOCNO, prhead.DATEDOC,  prhead.DPTID, pr.LINE
