小于等于当日的当月记录和 小于等于当日的当年记录 当月的我知道,如下: SQl.Add('select sum(cashincome) as cashincome from cashturnover where cashitem=:fcashitem and year(cashdate)=:fcashyear and month(cashdate)=:fcashmonth and day(cashdate)<=:fcashday'); Parameters.ParamByName('fcashitem').Value:='其他收入'; Parameters.ParamByName('fcashyear').Value:=strtoint(FormatDateTime('yyyy',Datetimepicker1.Date)); Parameters.ParamByName('fcashmonth').Value:=strtoint(FormatDateTime('mm',Datetimepicker1.Date)); Parameters.ParamByName('fcashday').Value:=strtoint(FormatDateTime('dd',Datetimepicker1.Date)); 当年的如何写??
cashdate肯定是日期型吧? SQl.Add('select sum(cashincome) as cashincome from cashturnover where cashitem=:fcashitem and year(cashdate)=:fcashyear and cashdate<=:fcashday'); Parameters.ParamByName('fcashitem').Value:='其他收入'; Parameters.ParamByName('fcashyear').Value:=strtoint(FormatDateTime('yyyy',Datetimepicker1.Date)); Parameters.ParamByName('fcashday').Value:=FormatDateTime('yyyy-mm-dd',Datetimepicker1.Date));
小于等于当日的当年记录
当月的我知道,如下:
SQl.Add('select sum(cashincome) as cashincome from cashturnover where cashitem=:fcashitem and year(cashdate)=:fcashyear and month(cashdate)=:fcashmonth and day(cashdate)<=:fcashday');
Parameters.ParamByName('fcashitem').Value:='其他收入';
Parameters.ParamByName('fcashyear').Value:=strtoint(FormatDateTime('yyyy',Datetimepicker1.Date));
Parameters.ParamByName('fcashmonth').Value:=strtoint(FormatDateTime('mm',Datetimepicker1.Date));
Parameters.ParamByName('fcashday').Value:=strtoint(FormatDateTime('dd',Datetimepicker1.Date));
当年的如何写??
到了查固定時間的記錄時候用流水號標識。相當準確,呵呵
SQl.Add('select sum(cashincome) as cashincome from cashturnover where cashitem=:fcashitem and year(cashdate)=:fcashyear and cashdate<=:fcashday');
Parameters.ParamByName('fcashitem').Value:='其他收入';
Parameters.ParamByName('fcashyear').Value:=strtoint(FormatDateTime('yyyy',Datetimepicker1.Date));
Parameters.ParamByName('fcashday').Value:=FormatDateTime('yyyy-mm-dd',Datetimepicker1.Date));