REPORTFORM;cashflow.frf
TITLE;รายงานประมาณการเงินสด ( Cashflow )
SQL;DROP TABLE IF EXISTS _CASHFLOW&
SQL;
SQL;create table  _cashflow
SQL;SELECT arcard.DUEDATE as date, arcard.DOCNO, armst.XCOMP as xdesc, arcard.NBAL as din,
SQL;0000000000.00 as dout, 0000000000.00 as bin , 0000000000.00 as bout, 0000000000.00 as bal, 1 as line,
SQL;0000000000.00  as xbeg
SQL;from arcard left join armst on arcard.ACCID = armst.ACCID
SQL;where left(arcard.TRTYPE,2) = "AR" AND arcard.NBAL > 0
SQL;and duedate >= :m21 and duedate <= :m22&
SQL;
SQL;insert into _cashflow
SQL;SELECT apcard.DUEDATE as date, apcard.DOCNO, aPmst.XCOMP as xdesc, 0 as din,apcard.NBAL as dout,
SQL;0 as bin , 0 as bout, 0 as bal, 1 as line,0000000000.00  as xbeg
SQL;from apcard left join aPmst on apcard.ACCID = aPmst.ACCID
SQL;where left(apcard.TRTYPE,2) = "AP" AND apcard.NBAL > 0
SQL;and duedate >= :m21 and duedate <= :m22&
SQL;
SQL;insert into _cashflow
SQL;SELECT bktr.datechk as date, bktr.chkno, aPmst.XCOMP as xdesc, 0 as din,0 as dout,
SQL;0 as bin , amt_out as bout, 0 as bal, 2 as line,0000000000.00  as xbeg
SQL;from bktr left join aPmst on bktr.apACCID = aPmst.ACCID
SQL;where (left(bktr.paytype,2) = "02" or left(bktr.paytype,2) = "06") and amt_out > 0
SQL;and datechk >= :m21 and datechk <= :m22 AND CLRCHK = 0&
SQL;
SQL;insert into _cashflow
SQL;SELECT bktr.datechk as date, bktr.chkno, armst.XCOMP as xdesc, 0 as din,0 as dout,
SQL;amt_in as bin , 0 as bout, 0 as bal, 2 as line,0000000000.00  as xbeg
SQL;from bktr left join armst on bktr.ARACCID = armst.ACCID
SQL;where (left(bktr.paytype,2) = "02" or left(bktr.paytype,2) = "06") and amt_IN > 0
SQL;and datechk >= :m21 and datechk <= :m22 AND CLRCHK = 0&
SQL;
SQL;insert into _cashflow
SQL;(DATE, DOCNO, BAL,LINE) VALUES
SQL;( :m21 ,"ยอดยกมา", :m11 ,0)&
SQL;
SQL;select * from _cashflow order by date,line,docno
CONDITION;ยอดเงินยกมา~ARCARD.REPBAL~Chr~1~select 0.00 from config~
CONDITION;ตั้งแต่วันที่~ARCARD.DATEDOC~Date~2~~
EXCELSQL;DROP TABLE IF EXISTS _CASHFLOW&
EXCELSQL;
EXCELSQL;create table  _cashflow
EXCELSQL;SELECT arcard.DUEDATE as date, arcard.DOCNO, armst.XCOMP as xdesc, arcard.NBAL as din,
EXCELSQL;0000000000.00 as dout, 0000000000.00 as bin , 0000000000.00 as bout, 0000000000.00 as bal, 1 as line,
EXCELSQL;0000000000.00  as xbeg
EXCELSQL;from arcard left join armst on arcard.ACCID = armst.ACCID
EXCELSQL;where left(arcard.TRTYPE,2) = "AR" AND arcard.NBAL > 0
EXCELSQL;and duedate >= :m21 and duedate <= :m22&
EXCELSQL;
EXCELSQL;insert into _cashflow
EXCELSQL;SELECT apcard.DUEDATE as date, apcard.DOCNO, aPmst.XCOMP as xdesc, 0 as din,apcard.NBAL as dout,
EXCELSQL;0 as bin , 0 as bout, 0 as bal, 1 as line,0000000000.00  as xbeg
EXCELSQL;from apcard left join aPmst on apcard.ACCID = aPmst.ACCID
EXCELSQL;where left(apcard.TRTYPE,2) = "AP" AND apcard.NBAL > 0
EXCELSQL;and duedate >= :m21 and duedate <= :m22&
EXCELSQL;
EXCELSQL;insert into _cashflow
EXCELSQL;SELECT bktr.datechk as date, bktr.chkno, aPmst.XCOMP as xdesc, 0 as din,0 as dout,
EXCELSQL;0 as bin , amt_out as bout, 0 as bal, 2 as line,0000000000.00  as xbeg
EXCELSQL;from bktr left join aPmst on bktr.apACCID = aPmst.ACCID
EXCELSQL;where (left(bktr.paytype,2) = "02" or left(bktr.paytype,2) = "06") and amt_out > 0
EXCELSQL;and datechk >= :m21 and datechk <= :m22 AND CLRCHK = 0&
EXCELSQL;
EXCELSQL;insert into _cashflow
EXCELSQL;SELECT bktr.datechk as date, bktr.chkno, armst.XCOMP as xdesc, 0 as din,0 as dout,
EXCELSQL;amt_in as bin , 0 as bout, 0 as bal, 2 as line,0000000000.00  as xbeg
EXCELSQL;from bktr left join armst on bktr.ARACCID = armst.ACCID
EXCELSQL;where (left(bktr.paytype,2) = "02" or left(bktr.paytype,2) = "06") and amt_IN > 0
EXCELSQL;and datechk >= :m21 and datechk <= :m22 AND CLRCHK = 0&
EXCELSQL;
EXCELSQL;insert into _cashflow
EXCELSQL;(DATE, DOCNO, BAL,LINE) VALUES
EXCELSQL;( :m21 ,"ยอดยกมา", :m11 ,0)&
EXCELSQL;
EXCELSQL;select * from _cashflow order by date,line,docno
USECROSSTAB;N
CROSSTABFRF;N
CROSSTABHEAD;
CROSSTABFIELD;
