REPORTFORM;CH6.frf
TITLE;รายงานเช็คจ่ายเรียงตามเลขที่เช็ค
SQL;drop table if exists _chkpay&
SQL;
SQL;create table _chkpay
SQL;select bktr.CHKNO, bktr.DOCNO, bktr.APACCID,bktr.DATEDOC,bktr.DOCGL,
SQL;apmst.XCOMP, bktr.BANKID, bank.BANKNAME,
SQL;bktr.AMT_OUT, if(bktr.CLRCHK=0,bktr.AMT_OUT,0) as XNONCLR,
SQL; if(bktr.CLRCHK=1,bktr.AMT_OUT,0) as XCLR,
SQL;bktr.DATEPASS, bktr.DOCGL as DOCGL_1, bktr.DATECHK
SQL;from bktr
SQL;left join apmst on bktr.APACCID = apmst.ACCID
SQL;left join bank on bktr.BANKID = bank.BANKID
SQL;where bktr.TRTYPE = "AP" AND left(bktr.PAYTYPE,2) = '02'
SQL;and BKTR.DATECHK >= :m11 and BKTR.DATECHK <= :m12
SQL;and BKTR.CHKNO >= :m21 and BKTR.CHKNO <= :m22
SQL;order by bktr.BANKID, bktr.CHKNO&
SQL;
SQL;update _chkpay inner join cashpay on _chkpay.docno = cashpay.docno
SQL;set _chkpay.xcomp = cashpay.xremark&
SQL;
SQL;select * from _chkpay order by BANKID, CHKNO
CONDITION;ตั้งแต่วันที่เช็ค~BKTR.DATECHK~Date~2~~
CONDITION;ตั้งแต่เลขที่เช็ค~BKTR.CHKNO~Chr~2~SELECT CHKNO FROM BKTR WHERE LEFT(PAYTYPE,2)="02"~
EXCELSQL;drop table if exists _chkpay&
EXCELSQL;
EXCELSQL;create table _chkpay
EXCELSQL;select bktr.CHKNO, bktr.DOCNO, bktr.APACCID,bktr.DATEDOC,bktr.DOCGL,
EXCELSQL;apmst.XCOMP, bktr.BANKID, bank.BANKNAME,
EXCELSQL;bktr.AMT_OUT, if(bktr.CLRCHK=0,bktr.AMT_OUT,0) as XNONCLR,
EXCELSQL; if(bktr.CLRCHK=1,bktr.AMT_OUT,0) as XCLR,
EXCELSQL;bktr.DATEPASS, bktr.DOCGL as DOCGL_1, bktr.DATECHK
EXCELSQL;from bktr
EXCELSQL;left join apmst on bktr.APACCID = apmst.ACCID
EXCELSQL;left join bank on bktr.BANKID = bank.BANKID
EXCELSQL;where bktr.TRTYPE = "AP" AND left(bktr.PAYTYPE,2) = '02'
EXCELSQL;and BKTR.DATECHK >= :m11 and BKTR.DATECHK <= :m12
EXCELSQL;and BKTR.CHKNO >= :m21 and BKTR.CHKNO <= :m22
EXCELSQL;order by bktr.BANKID, bktr.CHKNO&
EXCELSQL;
EXCELSQL;update _chkpay inner join cashpay on _chkpay.docno = cashpay.docno
EXCELSQL;set _chkpay.xcomp = cashpay.xremark&
EXCELSQL;
EXCELSQL;select * from _chkpay order by BANKID, CHKNO
USECROSSTAB;N
CROSSTABFRF;N
CROSSTABHEAD;
CROSSTABFIELD;
