REPORTFORM;GL5.frf
TITLE;รายงานบัญชีแยกประเภท
SQL;drop table if exists _gltr&
SQL;create table _gltr
SQL;select
SQL;gltr.glid, glmst.GLDESC ,gltype,
SQL;curdate() as datedoc,
SQL;space(30) as docno,
SQL;space(60) as xremline,
SQL;0000000000.00 as debit,
SQL;0000000000.00 as credit,
SQL;sum(debit) as debitbeg,
SQL;sum(credit) as creditbeg,0 as line
SQL;from gltr left join gltrhd on gltr.DOCNO = gltrhd.DOCNO
SQL;inner join glmst on gltr.GLID = glmst.GLID
SQL;where gltr.datedoc < :m11 
SQL;and gltr.glid >= :m21 and gltr.glid <= :m22
SQL;group by 1,2,3&
SQL;
SQL;alter table _gltr add index docno (docno)& 
SQL;alter table _gltr add index glid (glid)&
SQL;
SQL;
SQL;update _gltr set docno = 'ยอดยกมา'&
SQL;update _gltr set datedoc = :m11&
SQL;
SQL;insert into _gltr
SQL;select
SQL;gltr.glid, glmst.GLDESC ,gltype,
SQL;gltr.datedoc,
SQL;gltr.docno,
SQL;gltrhd.xremline,
SQL;debit,
SQL;credit,
SQL;0 as debitbeg,
SQL;0 as creditbeg,
SQL;1 as line
SQL;from gltr inner join gltrhd on gltr.DOCNO = gltrhd.DOCNO
SQL;inner join glmst on gltr.GLID = glmst.GLID
SQL;where gltr.datedoc >=  :m11 and gltr.datedoc <= :m12
SQL;and gltr.glid >= :m21 and gltr.glid <= :m22&
SQL;
SQL;
SQL;select * from _gltr 
SQL;order by glid,line,datedoc,docno
CONDITION;ตั้งแต่วันที่~GLTR.DATEDOC~Date~2~~
CONDITION;ตั้งแต่รหัสผังบัญชี~GLTR.GLID~Chr~2~SELECT GLID FROM GLMST~GL
EXCELSQL;drop table if exists _gltr&
EXCELSQL;create table _gltr
EXCELSQL;select
EXCELSQL;gltr.glid, glmst.GLDESC ,gltype,
EXCELSQL;curdate() as datedoc,
EXCELSQL;space(30) as docno,
EXCELSQL;space(60) as xremline,
EXCELSQL;0000000000.00 as debit,
EXCELSQL;0000000000.00 as credit,
EXCELSQL;sum(debit) as debitbeg,
EXCELSQL;sum(credit) as creditbeg,0 as line
EXCELSQL;from gltr left join gltrhd on gltr.DOCNO = gltrhd.DOCNO
EXCELSQL;inner join glmst on gltr.GLID = glmst.GLID
EXCELSQL;where gltr.datedoc < :m11 
EXCELSQL;and gltr.glid >= :m21 and gltr.glid <= :m22
EXCELSQL;group by 1,2,3&
EXCELSQL;
EXCELSQL;alter table _gltr add index docno (docno)& 
EXCELSQL;alter table _gltr add index glid (glid)&
EXCELSQL;
EXCELSQL;
EXCELSQL;update _gltr set docno = 'ยอดยกมา'&
EXCELSQL;update _gltr set datedoc = :m11&
EXCELSQL;
EXCELSQL;insert into _gltr
EXCELSQL;select
EXCELSQL;gltr.glid, glmst.GLDESC ,gltype,
EXCELSQL;gltr.datedoc,
EXCELSQL;gltr.docno,
EXCELSQL;gltrhd.xremline,
EXCELSQL;debit,
EXCELSQL;credit,
EXCELSQL;0 as debitbeg,
EXCELSQL;0 as creditbeg,
EXCELSQL;1 as line
EXCELSQL;from gltr inner join gltrhd on gltr.DOCNO = gltrhd.DOCNO
EXCELSQL;inner join glmst on gltr.GLID = glmst.GLID
EXCELSQL;where gltr.datedoc >=  :m11 and gltr.datedoc <= :m12
EXCELSQL;and gltr.glid >= :m21 and gltr.glid <= :m22&
EXCELSQL;
EXCELSQL;
EXCELSQL;select * from _gltr 
EXCELSQL;order by glid,line,datedoc,docno
USECROSSTAB;N
CROSSTABFRF;N
CROSSTABHEAD;
CROSSTABFIELD;
