REPORTFORM;INVSERIAL1.frf
TITLE;ÊÃØ»ÊÔ¹¤éÒ¤§àËÅ×Í µÒÁ LOT/SERIAL
SQL;drop table if exists _invserial&
SQL;create table _invserial
SQL;select sin.ID, invmst.XDESC, sin.LOCID, loca.LOCDESC, sin.SERIAL, invmst.UNIT, 0000000000.00 as QTY
SQL;from sin inner join invmst on sin.ID = invmst.ID
SQL;inner join loca on sin.LOCID = loca.LOCID
SQL;where SIN.ID >= :M11 AND SIN.ID <= :M12
SQL;AND SIN.DATEDOC <= :M21
SQL;group by sin.SERIAL&
SQL;
SQL;drop table if exists _invserial2&
SQL;create table _invserial2
SQL;select id, serial, locid, sum(if(left(trtype,2) = '00',sin.QUANIN,0)) as BEG, sum(if(left(trtype,2) <> '00',sin.REPBAL,0)) as QTY
SQL;from sin
SQL;where SIN.ID >= :M11 AND SIN.ID <= :M12 AND SIN.DATEDOC <= :M21
SQL;group by sin.SERIAL&
SQL;
SQL;update _invserial inner join _invserial2 on _invserial.ID = _invserial2.id and _invserial.SERIAL = _invserial2.serial and _invserial.LOCID = _invserial2.locid
SQL;set _invserial.QTY = _invserial2.BEG + _invserial2.QTY&
SQL;
SQL;select * from _invserial 
CONDITION;µÑé§áµèÃËÑÊÊÔ¹¤éÒ~SIN.ID~Chr~2~SELECT ID FROM SIN~INV
CONDITION;ÊÔé¹ÊØ´ ³ ÇÑ¹·Õè~SIN.DATEDOC~Date~1~~
EXCELSQL;drop table if exists _invserial&
EXCELSQL;create table _invserial
EXCELSQL;select sin.ID, invmst.XDESC, sin.LOCID, loca.LOCDESC, sin.SERIAL, invmst.UNIT, 0000000000.00 as QTY
EXCELSQL;from sin inner join invmst on sin.ID = invmst.ID
EXCELSQL;inner join loca on sin.LOCID = loca.LOCID
EXCELSQL;group by sin.SERIAL&
EXCELSQL;
EXCELSQL;drop table if exists _invserial2&
EXCELSQL;create table _invserial2
EXCELSQL;select id, serial, locid, sum(if(left(trtype,2) = '00',sin.QUANIN,0)) as BEG, sum(if(left(trtype,2) <> '00',sin.REPBAL,0)) as QTY
EXCELSQL;from sin
EXCELSQL;group by sin.SERIAL&
EXCELSQL;
EXCELSQL;update _invserial inner join _invserial2 on _invserial.ID = _invserial2.id and _invserial.SERIAL = _invserial2.serial and _invserial.LOCID = _invserial2.locid
EXCELSQL;set _invserial.QTY = _invserial2.BEG + _invserial2.QTY&
EXCELSQL;
EXCELSQL;select * from _invserial
USECROSSTAB;N
CROSSTABFRF;N
CROSSTABHEAD;
CROSSTABFIELD;
