REPORTFORM;ISRFIV.frf
TITLE;รายละเอียด เบิก/รับสินค้า/ส่งสินค้า ตามรหัส Job
SQL;drop table if exists _ISRF&
SQL;
SQL;create table _ISRF
SQL;select invcard.DOCNO, invcard.DATEDOC,
SQL;invcard.ID, invmst.XDESC, invcard.QUAN AS ISQUAN, invcard.UNIT, 1 as line,
SQL;000000000.00 as rfqty, 000000000.00 as ivqty,jobno, space(60) as jdesc,space(20) as xindex
SQL;from
SQL;invcard inner join invmst on invcard.ID = invmst.ID
SQL;where left(docno,2) = 'IS' 
SQL;and jobno >= :m21 and jobno <= :m22 
SQL;and datedoc >= :m11 and datedoc <= :m12 &
SQL;
SQL;insert into _ISRF
SQL;select invcard.DOCNO, invcard.DATEDOC,
SQL;invcard.ID, invmst.XDESC, invcard.QUAN * -1 AS ISQUAN, invcard.UNIT, 1 as line,
SQL;000000000.00 as rfqty, 000000000.00 as ivqty,jobno, space(60) as jdesc,space(20) as xindex
SQL;from
SQL;invcard inner join invmst on invcard.ID = invmst.ID
SQL;where left(docno,2) = 'RS' 
SQL;and jobno >= :m21 and jobno <= :m22 
SQL;and datedoc >= :m11 and datedoc <= :m12 &
SQL;
SQL;insert into _ISRF
SQL;select invcard.DOCNO, invcard.DATEDOC,
SQL;invcard.ID, invmst.XDESC, 0, invcard.UNIT, 2 as line,
SQL;invcard.quan as rfqty, 000000000.00 as ivqty,jobno, space(60) as jdesc,space(20) as xindex
SQL;from
SQL;invcard inner join invmst on invcard.ID = invmst.ID
SQL;where left(docno,2) = 'RF' 
SQL;and jobno >= :m21 and jobno <= :m22 
SQL;and datedoc >= :m11 and datedoc <= :m12 &
SQL;
SQL;
SQL;insert into _ISRF
SQL;select invcard.DOCNO, invcard.DATEDOC,
SQL;invcard.ID, invmst.XDESC, 0, invcard.UNIT, 3 as line,
SQL;000000000.00 as rfqty, invcard.quan as ivqty,jobno, space(60) as jdesc,space(20) as xindex
SQL;from
SQL;invcard inner join invmst on invcard.ID = invmst.ID
SQL;where left(docno,2) = 'IV' 
SQL;and jobno >= :m21 and jobno <= :m22 
SQL;and datedoc >= :m11 and datedoc <= :m12 &
SQL;
SQL;update _ISRF inner join jobmst on _ISRF.jobno = jobmst.JOBNO
SQL;set _ISRF.jdesc = jobmst.JDESC&
SQL;
SQL;select 
SQL;_ISRF.* from _ISRF order by jobno, line,datedoc,docno
CONDITION;ตั้งแต่วันที่~INVCARD.DATEDOC~Date~2~~
CONDITION;ตั้งแต่รหัส Job~INVCARD.JOBNO~Chr~2~SELECT JOBNO FROM JOBMST~JOB
EXCELSQL;drop table if exists _ISRF&
EXCELSQL;
EXCELSQL;create table _ISRF
EXCELSQL;select invcard.DOCNO, invcard.DATEDOC,
EXCELSQL;invcard.ID, invmst.XDESC, invcard.QUAN AS ISQUAN, invcard.UNIT, 1 as line,
EXCELSQL;000000000.00 as rfqty, 000000000.00 as ivqty,jobno, space(60) as jdesc,space(20) as xindex
EXCELSQL;from
EXCELSQL;invcard inner join invmst on invcard.ID = invmst.ID
EXCELSQL;where left(docno,2) = 'IS' 
EXCELSQL;and jobno >= :m21 and jobno <= :m22 
EXCELSQL;and datedoc >= :m11 and datedoc <= :m12 &
EXCELSQL;
EXCELSQL;insert into _ISRF
EXCELSQL;select invcard.DOCNO, invcard.DATEDOC,
EXCELSQL;invcard.ID, invmst.XDESC, invcard.QUAN * -1 AS ISQUAN, invcard.UNIT, 1 as line,
EXCELSQL;000000000.00 as rfqty, 000000000.00 as ivqty,jobno, space(60) as jdesc,space(20) as xindex
EXCELSQL;from
EXCELSQL;invcard inner join invmst on invcard.ID = invmst.ID
EXCELSQL;where left(docno,2) = 'RS' 
EXCELSQL;and jobno >= :m21 and jobno <= :m22 
EXCELSQL;and datedoc >= :m11 and datedoc <= :m12 &
EXCELSQL;
EXCELSQL;insert into _ISRF
EXCELSQL;select invcard.DOCNO, invcard.DATEDOC,
EXCELSQL;invcard.ID, invmst.XDESC, 0, invcard.UNIT, 2 as line,
EXCELSQL;invcard.quan as rfqty, 000000000.00 as ivqty,jobno, space(60) as jdesc,space(20) as xindex
EXCELSQL;from
EXCELSQL;invcard inner join invmst on invcard.ID = invmst.ID
EXCELSQL;where left(docno,2) = 'RF' 
EXCELSQL;and jobno >= :m21 and jobno <= :m22 
EXCELSQL;and datedoc >= :m11 and datedoc <= :m12 &
EXCELSQL;
EXCELSQL;
EXCELSQL;insert into _ISRF
EXCELSQL;select invcard.DOCNO, invcard.DATEDOC,
EXCELSQL;invcard.ID, invmst.XDESC, 0, invcard.UNIT, 3 as line,
EXCELSQL;000000000.00 as rfqty, invcard.quan as ivqty,jobno, space(60) as jdesc,space(20) as xindex
EXCELSQL;from
EXCELSQL;invcard inner join invmst on invcard.ID = invmst.ID
EXCELSQL;where left(docno,2) = 'IV' 
EXCELSQL;and jobno >= :m21 and jobno <= :m22 
EXCELSQL;and datedoc >= :m11 and datedoc <= :m12 &
EXCELSQL;
EXCELSQL;update _ISRF inner join jobmst on _ISRF.jobno = jobmst.JOBNO
EXCELSQL;set _ISRF.jdesc = jobmst.JDESC&
EXCELSQL;
EXCELSQL;select 
EXCELSQL;_ISRF.* from _ISRF order by jobno, line,datedoc,docno
USECROSSTAB;N
CROSSTABFRF;N
CROSSTABHEAD;
CROSSTABFIELD;
