📄 jgsearchdkdshz.pas
字号:
unit JGSearchDkDsHz;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ImgList, ToolWin, Grids;
type
TJGSearchDkDsHzGL = class(TForm)
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ImageList1: TImageList;
ImageList2: TImageList;
StatusBar1: TStatusBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
SGDsSj: TStringGrid;
procedure ToolButton6Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
aDsbm:array of string;
aDsmc:array of string;
aDsDb:array of string;
dDate:tDate;
iType:smallint;
cServer:string;
procedure RefreshDsSj(const cDs,cMc:string);
procedure CalcDsSj(ads,aDb:array of string);
end;
var
JGSearchDkDsHzGL: TJGSearchDkDsHzGL;
implementation
{$R *.dfm}
uses UserFace, DataModule,JGSearchDkGr;
procedure TJGSearchDkDsHzGL.ToolButton6Click(Sender: TObject);
begin
close;
end;
procedure TJGSearchDkDsHzGl.RefreshDsSj(const cDs,cMc:string);
var
i:smallint;
l:integer;
d: double;
c: string;
begin
i:=SGDsSj.RowCount-1;
DM.Sp_DkDs.First;
While not Dm.Sp_DkDs.Eof do
begin
SGDsSj.Cells[0,i]:=cDs;
SGDsSj.Cells[1,i]:=cMc;
l:= DM.Sp_DkDs.FieldByName('zgrs').AsInteger ;
Str(l:6,c);
SGDsSj.Cells[2,i]:= c;
d:= DM.Sp_DkDs.FieldByName('dkje').AsFloat;
Str(d:15:2,c);
SGDsSj.Cells[3,i]:= c;
l:= DM.Sp_DkDs.FieldByName('hqrs').AsInteger ;
Str(l:6,c);
SGDsSj.Cells[4,i]:= c;
d:= DM.Sp_DkDs.FieldByName('yhje').AsFloat;
Str(d:15:2,c);
SGDsSj.Cells[5,i]:= c;
d:= DM.Sp_DkDs.FieldByName('dkye').AsFloat;
Str(d:15:2,c);
SGDsSj.Cells[6,i]:= c;
l:= DM.Sp_DkDs.FieldByName('yqbs').AsInteger ;
Str(l:6,c);
SGDsSj.Cells[7,i]:= c;
d:= DM.Sp_DkDs.FieldByName('yqje').AsFloat;
Str(d:15:2,c);
SGDsSj.Cells[8,i]:= c;
inc(i);
SGDsSj.RowCount:= SGDsSj.RowCount+1;
DM.Sp_DkDs.Next;
end;
end;
procedure TJGSearchDkDsHzGL.FormCreate(Sender: TObject);
begin
SGDsSj.Cells[0,0]:= '编码';
SGDsSj.Cells[1,0]:= '地市名称';
SGDsSj.Cells[2,0]:= '放贷人数';
SGDsSj.Cells[3,0]:= '放贷金额';
SGDsSj.Cells[4,0]:= '还清人数';
SGDsSj.Cells[5,0]:= '偿还金额';
SGDsSj.Cells[6,0]:= '贷款余额';
SGDsSj.Cells[7,0]:= '逾期笔数';
SGDsSj.Cells[8,0]:= '逾期贷款金额';
end;
procedure TJGSearchDkDsHzGL.ToolButton4Click(Sender: TObject);
var
DkGr: tJGSearchDkGrGL;
i:smallint;
begin
if SGDsSj.Cells[0,SGDsSj.Row]='合计' then
exit;
wait;
try
i:=SGDsSj.Row-1;
if aDsDb[i]='' then
begin
waitclear;
application.MessageBox('无法连接数据库',MsgCaption,48);
exit;
end;
Dm.Conn_Gjj.DefaultDatabase := aDsDb[i];
Dm.P_DkSearchGr(dDate);
except
waitclear;
application.MessageBox('无法连接数据库',MsgCaption,48);
exit;
end;
// Dm.P_DkSearchGr(dDate);
DkGr:=tJGSearchDkGrGL.Create(application);
DkGr.dDate :=dDate;
DkGr.StatusBar1.Panels[0].Text := StatusBar1.Panels[0].Text;
waitclear;
DkGr.ShowModal;
DkGr.Free;
end;
procedure TJGSearchDkDsHzGL.CalcDsSj(ads,aDb:array of string);
var
i,j,l:smallint;
i1,i2,i3:integer;
d1,d2,d3,d4:double;
c:string;
begin
l:=high(aDs)+1;
setlength(aDsBm,l);
setlength(aDsMc,l);
setlength(aDsDb,l);
dec(l);
for i:=0 to l do
begin
aDsBm[i]:=copy(ads[i],1,4);
aDsMc[i]:=trim(copy(ads[i],9,30));
j:=strtoint(aDsBm[i])-1;
aDsDb[i]:=aDb[j];
end;
SGDsSj.RowCount := 2;
for i:=0 to l do
begin
if aDsDb[i]='' then
begin
SGDsSj.Cells[0,SgDsSj.RowCount-1]:=aDsBm[i];
SGDsSj.Cells[1,SgDsSj.RowCount-1]:=aDsMc[i];
SGDsSj.Cells[3,SGDsSj.RowCount-1]:='未设置数据库';
SGDsSj.RowCount := SGDsSj.RowCount +1;
continue;
end;
try
Dm.Conn_Gjj.DefaultDatabase := aDsDb[i];
DM.P_DkSearchDs(dDate);
RefreshDsSj(aDsBm[i],aDsMc[i]);
except
SGDsSj.Cells[0,SgDsSj.RowCount-1]:=aDsBm[i];
SGDsSj.Cells[1,SgDsSj.RowCount-1]:=aDsMc[i];
SGDsSj.Cells[3,SGDsSj.RowCount-1]:='无法连接数据库';
SGDsSj.RowCount := SGDsSj.RowCount +1;
end;
end;
i1:=0;
i2:=0;
i3:=0;
d1:=0;
d2:=0;
d3:=0;
d4:=0;
for i:=1 to SGDsSj.RowCount-2 do
begin
i1:=i1+strtoint(SGDsSj.Cells[2,i]);
i2:=i2+strtoint(SGDsSj.Cells[4,i]);
i3:=i3+strtoint(SGDsSj.Cells[7,i]);
d1:=d1+strtofloat(SGDsSj.Cells[3,i]);
d2:=d2+strtofloat(SGDsSj.Cells[5,i]);
d3:=d3+strtofloat(SGDsSj.Cells[6,i]);
d4:=d4+strtofloat(SGDsSj.Cells[8,i]);
end;
SGDsSj.Cells[0,SgDsSj.RowCount-1]:='合计';
SGDsSj.Cells[1,SgDsSj.RowCount-1]:=inttostr(SGDsSj.RowCount-2)+'个地市';
Str(i1:6,c);
SGDsSj.Cells[2,SgDsSj.RowCount-1]:=c;
Str(i2:6,c);
SGDsSj.Cells[4,SgDsSj.RowCount-1]:=c;
Str(i3:6,c);
SGDsSj.Cells[7,SgDsSj.RowCount-1]:=c;
Str(d1:14:2,c);
SGDsSj.Cells[3,SgDsSj.RowCount-1]:=c;
Str(d2:14:2,c);
SGDsSj.Cells[5,SgDsSj.RowCount-1]:=c;
Str(d3:14:2,c);
SGDsSj.Cells[6,SgDsSj.RowCount-1]:=c;
Str(d4:14:2,c);
SGDsSj.Cells[8,SgDsSj.RowCount-1]:=c;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -