📄 jgyhsjcx1.pas
字号:
unit JGYhSjCx1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls, ExtCtrls, ImgList, ToolWin, StdCtrls,
CheckLst, DB, uConstUtils, ADODB,dateutils, Types;
type
//T2DArray = array of array of double;
TFormYhSjCx1 = class(TForm)
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ImageList1: TImageList;
StatusBar1: TStatusBar;
ToolButton1: TToolButton;
ToolButton3: TToolButton;
ToolButton8: TToolButton;
ImageList2: TImageList;
Panel1: TPanel;
Panel2: TPanel;
Splitter1: TSplitter;
Panel3: TPanel;
Label1: TLabel;
Label3: TLabel;
Label7: TLabel;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
ComboBox1: TComboBox;
CheckListBox1: TCheckListBox;
CheckListBox2: TCheckListBox;
Label2: TLabel;
ComboBox2: TComboBox;
Panel4: TPanel;
Label4: TLabel;
Label5: TLabel;
procedure ToolButton3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure CheckListBox1Click(Sender: TObject);
procedure CheckListBox2Click(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
aCity: TString2Array;
public
{ Public declarations }
end;
var
FormYhSjCx1: TFormYhSjCx1;
implementation
{$R *.dfm}
//uses JGYhZjLxFx;
uses uDMFunc, JGYhZjLxFx, uUserFunc, uSystemIni, uVarUtils;
procedure TFormYhSjCx1.ToolButton3Click(Sender: TObject);
begin
close;
end;
procedure TFormYhSjCx1.FormCreate(Sender: TObject);
var
// aCity: TString2Array;
i: integer;
aDpt: TStringDynArray;
begin
DateTimePicker1.Date := StartOfTheMonth(Date());
DateTimePicker2.Date := EndOfTheMonth(date());
combobox2.ItemIndex:= 2;
DsInfo(aCity);
for i:=0 to high(aCity) do
begin
CheckListBox1.Items.Add(aCity[i,0]+' '+ aCity[i,1]);
if copy(pubLoginSsds,i+1,1)='1' then
CheckListBox1.ItemEnabled[i] := true
else
CheckListBox1.ItemEnabled[i] := False;
end;
BankDptInfo(2,aDpt); //高度关注;
for i:=0 to high(aDpt) do
CheckListBox2.Items.Add(aDpt[i]);
end;
procedure TFormYhSjCx1.ToolButton1Click(Sender: TObject);
var
JGYhLx: TFormJGYhZjLxFx;
i,j,l,k: smallint;
dD1,dD2:TDate;
sTxSrv, sTxDB: String;
nTxType: smallint;
begin
ReadDBMSInfo(pCommunicationSystem,sTxSrv,sTxDB,nTxType);
JGYhLx := TFormJGYhZjLxFx.Create(application);
JGYhLx.sCommDB := sTxDB;
JGYhLx.iItem := Combobox1.ItemIndex ;
j:=0;
for i:=0 to CheckListBox1.Count-1 do
begin
if CheckListBox1.Checked[i] then
begin
inc(j);
setlength(JGYhLx.aDs,j);
setlength(JGYhLx.aMc,j);
JGYhLx.aDs[j-1]:= trim(aCity[i,0]); //CheckListBox1.Items.Strings[i];
JGYhLx.aMc[j-1]:= trim(aCity[i,1]);
end;
end;
dD1 := DateTimePicker1.Date;
dD2 := DateTimePicker2.Date;
if dD1>dD2 then
begin
dD1 := DateTimePicker2.Date;
dD2 := DateTimePicker1.Date;
end;
j := 0;
repeat
inc(j);
SetLength(JGYhLx.aYd,j);
JGYhLx.aYd[j-1] := DToS(dD1,6);
dD1:=IncMonth(dD1,1);
until dD1>dD2;
j:=0;
for i:=0 to CheckListBox2.Count-1 do
begin
if CheckListBox2.Checked[i] then
begin
inc(j);
setlength(JGYhLx.aDw,j);
JGYhLx.aDw[j-1]:= trim(CheckListBox2.Items.Strings[i]);
end;
end;
with JGYhLx do
begin
case Combobox1.ItemIndex of
0: begin
if high(aDs)<0 then
begin
Free;
application.MessageBox('请先选择地市信息!',PMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
if high(aDw)<0 then
begin
Free;
application.MessageBox('请选择单位信息!',PMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
{ SetLength(aData,high(aYd)+1,high(aDw)+1);
YhZjLLTj0(aDs,aDw,aYd,aData);
}
StatBankroolFlow(sTxDB,iItem,aDs,aDw,aYd,aData);
if (high(aDw)+1)*(high(aYd)+1)>=1 then
SgYe.RowCount := (high(aDw)+1)*(high(aYd)+1)+1;
SgYe.Cells[0,0] := '地市编号';
SgYe.Cells[1,0] := '地市';
SgYe.Cells[2,0] := '月度';
SgYe.Cells[3,0] := '业务单位';
SgYe.Cells[4,0] := '汇总金额';
for i:=0 to high(aYd) do
for j:=0 to high(aDw) do
begin
l:=i*(high(aDw)+1)+j;
SgYe.Cells[0,l+1] := aDs[0];
SgYe.Cells[1,l+1] := aMc[0];
SgYe.Cells[2,l+1] := aYd[i];
SgYe.Cells[3,l+1] := aDw[j];
SgYe.Cells[4,l+1] := FToS(aData[i,j],16,2);
end;
StatusBar1.Panels[0].Text := '所选地市各月份的余额表';
end;
1: begin
if high(aDs)<0 then
begin
Free;
application.MessageBox('请先选择地市信息!',pMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
if high(aDw)<0 then
begin
Free;
application.MessageBox('请选择单位信息!',pMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
{ SetLength(aData,high(aYd)+1,high(aDs)+1);
YhZjLLTj1(aDs,aDw,aYd,aData);
}
StatBankroolFlow(sTxDB,iItem,aDs,aDw,aYd,aData);
if (high(aDw)+1)*(high(aYd)+1)>=1 then
SgYe.RowCount := (high(aDs)+1)*(high(aYd)+1)+1;
SgYe.Cells[0,0] := '业务单位';
SgYe.Cells[1,0] := '月度';
SgYe.Cells[2,0] := '地市编号';
SgYe.Cells[3,0] := '地市';
SgYe.Cells[4,0] := '汇总金额';
for i:=0 to high(aYd) do
for j:=0 to high(aDs) do
begin
l:=i*(high(aDs)+1)+j;
// showmessage(inttostr(l));
SgYe.Cells[0,l+1] := aDw[0];
SgYe.Cells[1,l+1] := aYd[i];
SgYe.Cells[2,l+1] := aDs[j];
SgYe.Cells[3,l+1] := aMc[j];
SgYe.Cells[4,l+1] := FToS(aData[i,j],16,2);
end;
StatusBar1.Panels[0].Text := '所选地市各月份的余额表';
end;
2: begin
if high(aDs)<0 then
begin
Free;
application.MessageBox('请先选择地市信息!',pMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
if high(aDw)<0 then
begin
Free;
application.MessageBox('请选择单位信息!',pMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
{ SetLength(aData,high(aDs)+1,high(aDw)+1);
YhZjLLTj2(aDs,aDw,aYd,aData);
}
StatBankroolFlow(sTxDB,iItem,aDs,aDw,aYd,aData);
if (high(aDw)+1)*(high(aDs)+1)>=1 then
SgYe.RowCount := (high(aDw)+1)*(high(aDs)+1)+1;
SgYe.Cells[0,0] := '月度';
SgYe.Cells[1,0] := '地市编号';
SgYe.Cells[2,0] := '地市';
SgYe.Cells[3,0] := '业务单位';
SgYe.Cells[4,0] := '汇总金额';
k:= high(aYd);
for i:=0 to high(aDs) do
for j:=0 to high(aDw) do
begin
l:=i*(high(aDw)+1)+j;
SgYe.Cells[0,l+1] := aYd[0]+' - '+aYd[k];
SgYe.Cells[1,l+1] := aDs[i];
SgYe.Cells[2,l+1] := aMc[i];
SgYe.Cells[3,l+1] := aDw[j];
SgYe.Cells[4,l+1] := FToS(aData[i,j],16,2);
end;
StatusBar1.Panels[0].Text := '所选地市各月份的余额表';
end;
3: begin
if high(aDs)<0 then
begin
Free;
application.MessageBox('请先选择地市信息!',pMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
if high(aDw)<0 then
begin
Free;
application.MessageBox('请选择单位信息!',pMsgCaption,48);
CheckListBox1.SetFocus;
exit;
end;
{ SetLength(aData,high(aDs)+1,high(aDw)+1);
YhZjLLTj3(aDs,aDw,aYd,aData);
}
StatBankroolFlow(sTxDB,iItem,aDs,aDw,aYd,aData);
if (high(aDw)+1)*(high(aDs)+1)>=1 then
SgYe.RowCount := (high(aDw)+1)*(high(aDs)+1)+1;
SgYe.Cells[0,0] := '月度';
SgYe.Cells[1,0] := '地市编号';
SgYe.Cells[2,0] := '地市';
SgYe.Cells[3,0] := '业务单位';
SgYe.Cells[4,0] := '汇总金额';
k:= high(aYd);
for i:=0 to high(aDs) do
for j:=0 to high(aDw) do
begin
l:=i*(high(aDw)+1)+j;
// showmessage(inttostr(l));
SgYe.Cells[0,l+1] := aYd[0]+' - '+aYd[k];
SgYe.Cells[1,l+1] := aDs[i];
SgYe.Cells[2,l+1] := aMc[i];
SgYe.Cells[3,l+1] := aDw[j];
SgYe.Cells[4,l+1] := FToS(aData[i,j],16,2);
end;
StatusBar1.Panels[0].Text := '所选地市各月份的余额表';
end;
end;
end;
hide;
JGYhLx.ShowModal;
JGYhLx.Free;
show;
end;
procedure TFormYhSjCx1.CheckListBox1Click(Sender: TObject);
var
i:smallint;
begin
if Combobox1.ItemIndex=0 then
begin
if CheckListBox1.Count > 0 then
for i:=0 to CheckListBox1.Count-1 do
CheckListBox1.Checked[i] := False;
CheckListBox1.Checked[CheckListBox1.ItemIndex]:=True;
end;
end;
procedure TFormYhSjCx1.CheckListBox2Click(Sender: TObject);
var
i:smallint;
begin
if Combobox1.ItemIndex = 1 then
begin
if CheckListBox2.Count > 0 then
for i:=0 to CheckListBox2.Count-1 do
CheckListBox2.Checked[i] := False;
CheckListBox2.Checked[CheckListBox2.ItemIndex]:=True;
end;
end;
procedure TFormYhSjCx1.ComboBox2Change(Sender: TObject);
var
i: integer;
aDpt: TStringDynArray;
begin
CheckListBox2.Clear;
BankDptInfo(Combobox2.ItemIndex,aDpt); //高度关注;
for i:=0 to high(aDpt) do
CheckListBox2.Items.Add(aDpt[i]);
end;
procedure TFormYhSjCx1.ComboBox1Change(Sender: TObject);
var
i:smallint;
begin
if Combobox1.ItemIndex=0 then
begin
if CheckListBox1.Count > 0 then
for i:=0 to CheckListBox1.Count-1 do
CheckListBox1.Checked[i] := False;
end;
if Combobox1.ItemIndex = 1 then
begin
if CheckListBox2.Count > 0 then
for i:=0 to CheckListBox2.Count-1 do
CheckListBox2.Checked[i] := False;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -