REPORTFORM;xpu.frf
TITLE;รายงานรายละเอียดซื้อ/ขาย แยกตามชนิดทองคำ แบบที่ 2
SQL;SELECT TRCARD.DOCNO, TRCARD.DATEDOC, TRCARD.ACCID, CONCAT(ARMST.FNAME,'  ',ARMST.LNAME),
SQL;TRCARD.BRANCH, BRANCH.BRANCHDESC, 
SQL;TRCARD.REPAMTBAL,TRCARD.XID,TRCARD.PRICE1,TRCARD.QTY,TRCARD.AMOUNT_D,
SQL;TRCARD.XMUSER, TRCARD.REFNO, TRCARD.XREMARK,XTIMENOW,TRTYPE
SQL;FROM TRCARD
SQL;LEFT JOIN ARMST ON TRCARD.ACCID = ARMST.ACCID
SQL;LEFT JOIN BRANCH ON TRCARD.BRANCH = BRANCH.BRANCH
SQL;WHERE (TRCARD.TRTYPE = "01" OR TRCARD.TRTYPE = "02")
SQL;ORDER BY TRCARD.XID,TRCARD.DOCNO,TRCARD.DATEDOC
CONDITION;ตั้งแต่วันที่~TRCARD.DATEDOC~Date~2~~
CONDITION;ตั้งแต่รหัสสาขา~TRCARD.BRANCH~Chr~2~SELECT BRANCH FROM BRANCH ~BRANCH
CONDITION;ชนิดทองคำ~~TextFile~~SA.TXT~
EXCELSQL;SELECT TRCARD.DOCNO AS "เลขที่เอกสาร", TRCARD.DATEDOC AS"วันที่เอกสาร", 
EXCELSQL;TRCARD.ACCID AS "รหัสลูกค้า", CONCAT(ARMST.FNAME,'  ',ARMST.LNAME) AS "ชื่อ-สกุลลูกค้า",
EXCELSQL;TRCARD.BRANCH AS "รหัสสาขา", BRANCH.BRANCHDESC AS "ชื่อสาขา", 
EXCELSQL;TRCARD.XID AS "ชนิดทอง",TRCARD.PRICE1 AS "ราคา",TRCARD.QTY AS "จำนวน",TRCARD.AMOUNT_D AS "รวม",
EXCELSQL;TRCARD.XMUSER AS "trade", TRCARD.REFNO AS "ใบจอง", TRCARD.XREMARK AS "note",XTIMENOW AS "เวลา"
EXCELSQL;FROM TRCARD
EXCELSQL;LEFT JOIN ARMST ON TRCARD.ACCID = ARMST.ACCID
EXCELSQL;LEFT JOIN BRANCH ON TRCARD.BRANCH = BRANCH.BRANCH
EXCELSQL;WHERE (TRCARD.TRTYPE = "01" OR TRCARD.TRTYPE = "02")
EXCELSQL;ORDER BY TRCARD.XID,TRCARD.DOCNO,TRCARD.DATEDOC
