|
str:='';
strq:='';
byje:='';
str:='YW_XJFYB,XJFYMXB,KMXX';
p_year := DateUtils.YearOf(sysutils.Now);
p_month:= DateUtils.MonthOf(sysutils.Now);
year1 := ' Year(YW_XJFYB_LRSJ)=:p_year ';
month1 := 'Month(YW_XJFYB_LRSJ)=p_month ';
strq := 'YW_XJFYB_DDBH = XJFYMXB_DJBH';
byje := 'select sum(XJFYMXB_JE) from XJFYMXB where ('+year1+') and ('+month1+') and '+strq ;
if(byje='')
then
begin
jsDialogs.ShowMsg('^_^ 没有你所要找的信息','出错了!');
self.Close;
end
else
begin
code:= 'select KMXX.KMXX_KMBH as ''科目编号'',KMXX.KMXX_KMQM as 总帐科目,( '+byje+') as 本月发生额,sum(XJFYMXB.XJFYMXB_JE) as 累计金额';
try
Query1.Active := false;
Query1.ConnectionString := 'DATABASEURL=Biz:JXC_GJP_SJK.Database';
Query1.CommandText := code+' FROM '+str+' WHERE '+strq;
Finally
Query1.Active := true;
end;
end;
|
|