REPORTFORM;SC9.frf
TITLE;วิเคราะห์ต้นทุนขาย แสดง Job
SQL;select invcard.DOCNO, invcard.DATEDOC, invcard.ACCID, armst.XCOMP,
SQL;sum(invcard.SALEPURAMT) as SALEPURAMT, SUM(invcard.COSTAMT) AS COSTAMT, jobmst.JDESC, arcard.JOBNO
SQL;from invcard
SQL;left join armst on invcard.ACCID = armst.ACCID
SQL;left join arcard on invcard.docno = arcard.docno
SQL;left join jobmst on arcard.JOBNO = jobmst.JOBNO
SQL;where (left(invcard.DOCNO,2) = "IV" or left(invcard.DOCNO,2) = "RI")
SQL;group by invcard.DOCNO, invcard.DATEDOC, invcard.ACCID, armst.XCOMP,
SQL;jobmst.JDESC, arcard.JOBNO
SQL;order by invcard.JOBNO, invcard.DOCNO
CONDITION;ตั้งแต่วันที่~INVCARD.DATEDOC~Date~2~~
CONDITION;ตั้งแต่ Job #~ARCARD.JOBNO~Chr~2~SELECT JOBNO FROM JOBMST ~JOB
EXCELSQL;select invcard.DOCNO, invcard.DATEDOC, invcard.ACCID, armst.XCOMP,
EXCELSQL;sum(invcard.SALEPURAMT) as SALEPURAMT, SUM(invcard.COSTAMT) AS COSTAMT, jobmst.JDESC, arcard.JOBNO
EXCELSQL;from invcard
EXCELSQL;left join armst on invcard.ACCID = armst.ACCID
EXCELSQL;left join arcard on invcard.docno = arcard.docno
EXCELSQL;left join jobmst on arcard.JOBNO = jobmst.JOBNO
EXCELSQL;where (left(invcard.DOCNO,2) = "IV" or left(invcard.DOCNO,2) = "RI")
EXCELSQL;group by invcard.DOCNO, invcard.DATEDOC, invcard.ACCID, armst.XCOMP,
EXCELSQL;jobmst.JDESC, arcard.JOBNO
EXCELSQL;order by invcard.JOBNO, invcard.DOCNO
USECROSSTAB;N
CROSSTABFRF;N
CROSSTABHEAD;
CROSSTABFIELD;
