REPORTFORM;MOVEMENT_5.frf
TITLE;รายงานความเคลื่อนไหวสินค้า ตามSERIAL/LOT#
SQL;DROP TABLE IF EXISTS _SLOT&
SQL;
SQL;CREATE TABLE _SLOT
SQL;SELECT SIN.DOCNO,SIN.DATEDOC,SIN.ID,INVMST.XDESC,SIN.QUANIN, SIN.QUANOUT,SIN.SERIAL,
SQL;SIN.TRTYPE, CONCAT(SIN.APACCID,"    ",APMST.XCOMP) AS APACCID,
SQL;CONCAT(SIN.ARACCID,"    ",ARMST.XCOMP) AS ARACCID, space(100) AS XREMARK
SQL;FROM SIN LEFT JOIN INVMST ON SIN.ID = INVMST.ID
SQL;LEFT JOIN APMST ON SIN.APACCID = APMST.ACCID
SQL;LEFT JOIN ARMST ON SIN.ARACCID = ARMST.ACCID
SQL;WHERE SIN.SERIAL >= :m11 and SIN.SERIAL <= :m12
SQL;and SIN.ID >= :m21 and SIN.ID <= :m22
SQL;and SIN.DATEDOC >= :m31 and SIN.DATEDOC <= :m32
SQL;and SIN.TRTYPE <> "02"
SQL;and not (INVMST.XGROUP = "03" OR INVMST.XGROUP = "04")
SQL;ORDER BY SIN.ID, SIN.SERIAL, SIN.DATEDOC&
SQL;
SQL;
SQL;UPDATE _SLOT
SQL;SET XREMARK = APACCID WHERE (LEFT(DOCNO,2)="RC") OR (LEFT(DOCNO,2)="RO")&
SQL; 
SQL;
SQL;UPDATE _SLOT
SQL;SET XREMARK = ARACCID WHERE (LEFT(DOCNO,2)="IV") OR (LEFT(DOCNO,2)="RI")&
SQL;
SQL;UPDATE _SLOT
SQL;SET XREMARK = "รับสินค้าจากการผลิต" WHERE LEFT(DOCNO,2)="RF" &
SQL;  
SQL;UPDATE _SLOT 
SQL;SET XREMARK = "รายการปรับปรุงเพิ่ม" WHERE LEFT(DOCNO,2) = "AJ"&
SQL;
SQL;SELECT ID,XDESC,SERIAL,DATEDOC,DOCNO,XREMARK,QUANIN,QUANOUT
SQL;from _SLOT order by id,serial,datedoc
CONDITION;รหัส LOT~SIN.SERIAL~Chr~2~SELECT SERIAL FROM SIN~
CONDITION;ตั้งแต่รหัสสินค้า~SIN.ID~Chr~2~SELECT ID FROM INVMST~INV
CONDITION;ตั้งแต่วันที่~SIN.DATEDOC~Date~2~~
EXCELSQL;DROP TABLE IF EXISTS _SLOT&
EXCELSQL;
EXCELSQL;CREATE TABLE _SLOT
EXCELSQL;SELECT SIN.DOCNO,SIN.DATEDOC,SIN.ID,INVMST.XDESC,SIN.QUANIN, SIN.QUANOUT,SIN.SERIAL,
EXCELSQL;SIN.TRTYPE, CONCAT(SIN.APACCID,"    ",APMST.XCOMP) AS APACCID,
EXCELSQL;CONCAT(SIN.ARACCID,"    ",ARMST.XCOMP) AS ARACCID, space(100) AS XREMARK
EXCELSQL;FROM SIN LEFT JOIN INVMST ON SIN.ID = INVMST.ID
EXCELSQL;LEFT JOIN APMST ON SIN.APACCID = APMST.ACCID
EXCELSQL;LEFT JOIN ARMST ON SIN.ARACCID = ARMST.ACCID
EXCELSQL;WHERE SIN.SERIAL >= :m11 and SIN.SERIAL <= :m12
EXCELSQL;and SIN.ID >= :m21 and SIN.ID <= :m22
EXCELSQL;and SIN.DATEDOC >= :m31 and SIN.DATEDOC <= :m32
EXCELSQL;and SIN.TRTYPE <> "02"
EXCELSQL;and not (INVMST.XGROUP = "03" OR INVMST.XGROUP = "04")
EXCELSQL;ORDER BY SIN.ID, SIN.SERIAL, SIN.DATEDOC&
EXCELSQL;
EXCELSQL;
EXCELSQL;UPDATE _SLOT
EXCELSQL;SET XREMARK = APACCID WHERE (LEFT(DOCNO,2)="RC") OR (LEFT(DOCNO,2)="RO")&
EXCELSQL; 
EXCELSQL;
EXCELSQL;UPDATE _SLOT
EXCELSQL;SET XREMARK = ARACCID WHERE (LEFT(DOCNO,2)="IV") OR (LEFT(DOCNO,2)="RI")&
EXCELSQL;
EXCELSQL;UPDATE _SLOT
EXCELSQL;SET XREMARK = "รับสินค้าจากการผลิต" WHERE LEFT(DOCNO,2)="RF" &
EXCELSQL;  
EXCELSQL;UPDATE _SLOT 
EXCELSQL;SET XREMARK = "รายการปรับปรุงเพิ่ม" WHERE LEFT(DOCNO,2) = "AJ"&
EXCELSQL;
EXCELSQL;SELECT ID,XDESC,SERIAL,DATEDOC,DOCNO,XREMARK,QUANIN,QUANOUT
EXCELSQL;from _SLOT order by id,serial,datedoc
USECROSSTAB;N
CROSSTABFRF;N
CROSSTABHEAD;
CROSSTABFIELD;
