TITLE;แสดงค่าใช้จ่ายทั้งปี แสดงต่อเดือน
SQL;drop table if exists _saleyear&
SQL;
SQL;create table _saleyear
SQL;select datedoc,year(datedoc) as xyear,sum(debit-credit) as exp
SQL;from gltr inner join glmst on gltr.glid = glmst.glid
SQL;where left(gltype,1) = 'E'
SQL;group by 2,1
SQL;order by 2,1&
SQL;
SQL;delete from _saleyear where xyear <> :m11&
SQL;
SQL;drop table if exists _saleyear1&
SQL;
SQL;create table _saleyear1
SQL;select month(datedoc) as mth,space(20) as fullmth,sum(exp) as exp
SQL;from _saleyear
SQL;group by 1,2&
SQL;
SQL;update _saleyear1 set fullmth = 'JAN' where Mth = 1&
SQL;update _saleyear1 set fullmth = 'FEB' where Mth = 2&
SQL;update _saleyear1 set fullmth = 'MAR' where Mth = 3&
SQL;update _saleyear1 set fullmth = 'APR' where Mth = 4&
SQL;update _saleyear1 set fullmth = 'MAY' where Mth = 5&
SQL;update _saleyear1 set fullmth = 'JUN' where Mth = 6&
SQL;update _saleyear1 set fullmth = 'JUL' where Mth = 7&
SQL;update _saleyear1 set fullmth = 'AUG' where Mth = 8&
SQL;update _saleyear1 set fullmth = 'SEP' where Mth = 9&
SQL;update _saleyear1 set fullmth = 'OCT' where Mth = 10&
SQL;update _saleyear1 set fullmth = 'NOV' where Mth = 11&
SQL;update _saleyear1 set fullmth = 'DEC' where Mth = 12&
SQL;
SQL;select * from _saleyear1 order by Mth
SQL;
CONDITION;เลือกข้อมูลปี~YEAR~Chr~1~SELECT YEAR(CURDATE()) FROM CONFIG~
SERIES;1~FULLMTH~EXP~ค่าใช้จ่าย
