📄 sbp_psagacct_all.pas
字号:
//各行各业的统一计息过程
//所有行业的计算过程,最好写成dll文件,这样以后的程序就可以共用,但时间紧没有写成dll
unit sbp_psagacct_all;
interface
uses
SysUtils, Classes, DB, DBTables;
procedure psagacct_all(ai_psseno ,ai_year :integer;Db:Tdatabase);
implementation
uses sbp_psagacct_minhang, sbp_psagacct_jinrong, sbp_psagacct_jinrong2,
sbp_psagacct_shiyou_wujin, sbp_psagacct_shiyou, sbp_psagacct_dianli,
sbp_psagacct_jiaotong, sbp_psagacct_youdian, sbp_psagacct_tielao,
sbp_psagacct_huban, sbp_psagacct_tielu, sbp_psagacct_leibo,
sbp_psagacct_shangtieshi, sbp_psagacct_hangji;
procedure psagacct_all(ai_psseno,ai_year:integer;Db:Tdatabase);
var
Query1,Query2,temp:TQuery;
begin
//////////////////////////////
//db.ReadOnly :=false;
Query1:=TQuery.Create(nil);
Query1.DatabaseName :=Db.DatabaseName ;
Query1.SQL.Add('select cpseno from sbdb_psarch where psseno=:param');
{cursor cur_psseno(an_psseno number) is
select cpseno from sbdb_psarch where psseno=an_psseno; }
Query2:=TQuery.Create(nil);
Query2.DatabaseName :=Db.DatabaseName ;
Query2.SQL.Add('select industry,cmcpseno from sbdb_cparch where cpseno=:param');
{cursor cur_industry(an_cpseno number) is
select industry,cmcpseno from sbdb_cparch where cpseno=an_cpseno; }
temp:=TQuery.Create(nil);
temp.DatabaseName :=Db.DatabaseName ;
if ai_year>0 then
begin
temp.Close ;
temp.SQL.Clear ;
temp.SQL.Add('delete from sbda_psagacct where psseno='+inttostr(ai_psseno)+' and yearno>='+inttostr(ai_year)+' and yearno<2002');
{主系统删除大于某一年的所有记录,现在删除当年的一条记录}
//temp.SQL.Add('delete from sbda_psagacct where psseno='+inttostr(ai_psseno)+' and yearno='+inttostr(ai_year));
//delete from sbda_psagacct where psseno=ai_psseno and yearno>=ai_year;
//commit;
temp.ExecSQL ;
end ;
Query1.ParamByName('param').AsInteger :=ai_psseno;
Query1.Prepare ;
Query1.Open ;
while not Query1.Eof do
begin
Query2.Close ;
Query2.ParamByName('param').AsInteger :=Query1.fieldbyname('cpseno').AsInteger ;
Query2.Prepare ;
Query2.Open ;
while not Query2.Eof do
begin
if trim(Query2.FieldByName('industry').AsString)='01' then
psagacct_minhang(ai_psseno,ai_year,Db);
if trim(Query2.fieldbyname('industry').AsString)='02' then
if Query2.FieldByName('cmcpseno').AsInteger =3101 then
psagacct_jinrong(ai_psseno,ai_year,db)
else psagacct_jinrong2(ai_psseno,ai_year,db);
if trim(Query2.FieldByName('industry').AsString)='03' then
psagacct_jinrong2(ai_psseno,ai_year,db);
if trim(Query2.FieldByName('industry').AsString)='05' then
if Query2.FieldByName('cmcpseno').AsInteger =518 then
psagacct_shiyou_wujin(ai_psseno,ai_year,db)
else psagacct_shiyou(ai_psseno,ai_year,db);
if trim(Query2.FieldByName('industry').AsString)='06' then
psagacct_dianli(ai_psseno,ai_year,db);
if trim(Query2.FieldByName('industry').AsString)='09' then
psagacct_jiaotong(ai_psseno,ai_year,db);
if trim(Query2.FieldByName('industry').AsString)='10' then
psagacct_youdian(ai_psseno,ai_year,db);
if trim(Query2.FieldByName('industry').AsString)='12' then
if Query2.FieldByName('cmcpseno').AsInteger =4080 then
psagacct_tielao(ai_psseno,ai_year,db)
else if Query2.FieldByName('cmcpseno').AsInteger =8103 then
psagacct_huban(ai_psseno,ai_year,db)
else if Query2.FieldByName('cmcpseno').AsInteger =1025 then
psagacct_shangtieshi(ai_psseno,ai_year,db)
else psagacct_tielu(ai_psseno,ai_year,db);
if (trim(Query2.FieldByName('industry').AsString)='13') or (trim(Query2.FieldByName('industry').AsString)='14') then
psagacct_hangji(ai_psseno,ai_year,db);
if trim(Query2.FieldByName('industry').AsString)='15' then
psagacct_leibo(ai_psseno,ai_year,db);
//sbp_cpints_new(2002,ai_psseno,db);
Query2.Next ;
end;
Query1.Next ; ;
end;
{for c_psseno in cur_psseno(ai_psseno) loop
for c_industry in cur_industry(c_psseno.cpseno) loop
if c_industry.industry='01' then
sbp_psagacct_minhang(ai_psseno,ai_year);
end if;
if c_industry.industry='02' then
if c_industry.cmcpseno=3101 then
sbp_psagacct_jinrong(ai_psseno,ai_year);
else
sbp_psagacct_jinrong2(ai_psseno,ai_year);
end if;
end if;
if c_industry.industry='03' then
sbp_psagacct_jinrong2(ai_psseno,ai_year);
end if;
if c_industry.industry='05' then
if c_industry.cmcpseno=518 then
sbp_psagacct_shiyou_wujin(ai_psseno,ai_year);
else
sbp_psagacct_shiyou(ai_psseno,ai_year);
end if;
end if;
if c_industry.industry='06' then
sbp_psagacct_dianli(ai_psseno,ai_year);
end if;
if c_industry.industry='09' then
sbp_psagacct_jiaotong(ai_psseno,ai_year);
end if;
if c_industry.industry='10' then
sbp_psagacct_youdian(ai_psseno,ai_year);
end if;
if c_industry.industry='12' then
if c_industry.cmcpseno='4080' then
sbp_psagacct_tielao(ai_psseno,ai_year);
elsif c_industry.cmcpseno=8103 then
--if c_industry.cmcpseno=8103 then
sbp_psagacct_huban(ai_psseno,ai_year);
elsif c_industry.cmcpseno=1025 then
sbp_psagacct_shangtieshi(ai_psseno,ai_year);
else
sbp_psagacct_tielu(ai_psseno,ai_year);
end if;
end if;
if c_industry.industry='13' or c_industry.industry='14' then
sbp_psagacct_hangji(ai_psseno,ai_year);
end if;
if c_industry.industry='15' then
--sbp_psagacct_youdian(ai_psseno,ai_year);
sbp_psagacct_leibo(ai_psseno,ai_year);
end if;
sbk_doints.sbp_cpints_new(2002,ai_psseno);
end loop;
end loop;
}
////////////////////////////////
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -