แฮะ แฮะ ไม่เข้าใจครับ
ไม่ทราบว่าเพิ่มตรงไหนครับ
begin
d1 :=GetSQLDateData('select min(vstdate) from ovst');
d2 :=GetSQLDateData('select max(vstdate) from ovst');
ds1 := formatdatetime('yyyy-mm-dd',d1);
ds2 := formatdatetime('yyyy-mm-dd',d2);
fyear := GetPickupList('select distinct(year(vstdate)) + 543 as cc ,vstdate from ovst'+
' where vstdate between "'+ds1+'" and "'+ds2+'"'+
' group by cc'+
' order by cc desc' );
year := fyear;
fyear := inttostr(strtoint(fyear) - 543) ;
fyear := inttostr(strtoint(fyear) - 1) ;
m10 := fyear+'-10-01" and "'+ fyear+'-10-31';
m11 := fyear+'-11-01" and "'+ fyear+'-11-30';
m12 := fyear+'-12-01" and "'+ fyear+'-12-31';
fyear := inttostr(strtoint(fyear) + 1) ;
m1 := fyear+'-01-01" and "'+ fyear+'-01-31';
m2 := GetSQLStringData('select Date_Add("'+ fyear+'-01-31",interval 1 month) as d');
m2 := fyear+'-02-01" and "'+ m2 ;
m3 := fyear+'-03-01" and "'+ fyear+'-03-31';
m4 := fyear+'-04-01" and "'+ fyear+'-04-30';
m5 := fyear+'-05-01" and "'+ fyear+'-05-31';
m6 := fyear+'-06-01" and "'+ fyear+'-06-30';
m7 := fyear+'-07-01" and "'+ fyear+'-07-31';
m8 := fyear+'-08-01" and "'+ fyear+'-08-31';
m9 := fyear+'-09-01" and "'+ fyear+'-09-30';
end;