|
unit MKCXCYWXX;
interface
uses
Business.System, Business.Model, Business.Data;
const
STRCONN = 'DATABASEURL=Biz:TRJTJTSJK.DATABASE';
//生产累计
SqlStr_SCLJ='select mz,hc,jj,yk,xs,hclj=sum(hc) ,jjlj=sum(jj),yklj=sum(yk),hjlj=sum(hc+jj+yk),xslj=sum(xs),kclj=sum(hc+jj+yk-xs),bz from MKRBMXB ';
//销售累计
SqlStr_XSLJ='';
type
TMKCXCYWXX = class(TInfo)
DataSetTB_Z: TSQLDataSet;
DataSetTB_C_SC: TSQLDataSet;
DataSetTB_C_XS: TSQLDataSet;
FIELD_TB_C_SC_DRZCL: TExprCalcField;
FIELD_TB_C_SC_DRKC: TExprCalcField;
FIELD_TB_C_XS_YSK: TExprCalcField;
FIELD_TB_C_SC_DRHCHJ: TAggField;
FIELD_TB_C_SC_DRJJHJ: TAggField;
FIELD_TB_C_SC_DRYKHJ: TAggField;
FIELD_TB_C_SC_DRXSHJ: TAggField;
FIELD_TB_C_SC_DRZCLHJ: TAggField;
FIELD_TB_C_SC_DRKCHJ: TAggField;
FIELD_TB_C_XS_DRXSLHJ: TAggField;
FIELD_TB_C_XS_DRYSKHJ: TAggField;
FIELD_TB_C_XS_DRSJSKHJ: TAggField;
DataSetLJ_ZDY: TUserDataSet;
FIELD_LJ_ZDY_MZ: TUserDataField;
FIELD_LJ_ZDY_HC: TUserDataField;
FIELD_LJ_ZDY_HCLJ: TUserDataField;
FIELD_LJ_ZDY_JJ: TUserDataField;
FIELD_LJ_ZDY_JJLJ: TUserDataField;
FIELD_LJ_ZDY_YK: TUserDataField;
FIELD_LJ_ZDY_YKLJ: TUserDataField;
FIELD_LJ_ZDY_HJ: TUserDataField;
FIELD_LJ_ZDY_HJLJ: TUserDataField;
FIELD_LJ_ZDY_XS: TUserDataField;
FIELD_LJ_ZDY_XSLJ: TUserDataField;
FIELD_LJ_ZDY_KC: TUserDataField;
FIELD_LJ_ZDY_KCLJ: TUserDataField;
FIELD_LJ_ZDY_BZ: TUserDataField;
private
{private declarations}
public
//生产累计 三个参数,1、开始时间 2、结束时间 3、单位
procedure Sum_SCLj(ADate:String;BDate:String;Cdw:String);
//销售累计 三个参数,1、开始时间 2、结束时间 3、单位
// procedure SumbyXSLJ(ADate:String;BDate:String;Cdw:String);
end;
implementation
procedure TMKCXCYWXX.Sum_SCLj(ADate:String;BDate:String;Cdw:String);
var Sql_SCLJ:TQuery;
Sql_SCLJ_Str:string;
begin
if not DataSetLJ_ZDY.Active then
DataSetLJ_ZDY.Open ;
DataSetLJ_ZDY.EmptyDataSet ;
Sql_SCLj:=TQuery.Create (nil);
try
Sql_SCLj.ConnectionString:=STRConn;
Sql_SCLJ_Str:= SqlStr_SCLJ;
Sql_SCLJ_Str:=Sql_SCLJ_Str
+ 'where ZBGUID in (Select guid from mkrbb where TBRQ>= '''+Adate+''' and TBRQ <= '''+BDate+''
+'''and TBDW= '''+Cdw+''')'
+'group by mz,hc,jj,yk,xs,bz';
Sql_SCLj.CommandText:=Sql_sclj_str;
Sql_sclj.open;
finally
Sql_SCLJ.Free ;
end;
end;
end.
编译可以通过..但是执行时出错..
好像是不能打开数据集.
|
-
-
1.jpg
43.32 KB, 下载次数: 178
|