⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guideline.pas

📁 ProviceSystem-公积金监管系统中心端
💻 PAS
字号:
unit GuideLine;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, frmMapChild, StdCtrls, CheckLst, ComCtrls, ImgList, ExtCtrls,
  ToolWin, Spin;

type
  TfrmGuideLine = class(TmapChild)
    Panel4: TPanel;
    ToolBar2: TToolBar;
    tBtnGuideSelectAll: TToolButton;
    tBtnGuideClearAll: TToolButton;
    clbZb: TCheckListBox;
    clbCity: TCheckListBox;
    ToolBar3: TToolBar;
    tBtnCitySelectAll: TToolButton;
    tBtnCityClearAll: TToolButton;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    ToolButton4: TToolButton;
    ToolButton5: TToolButton;
    ToolButton6: TToolButton;
    ToolButton10: TToolButton;
    ToolButton7: TToolButton;
    ToolButton11: TToolButton;
    ToolButton8: TToolButton;
    ToolButton12: TToolButton;
    StatusBar1: TStatusBar;
    Panel5: TPanel;
    LblRQ: TLabel;
    LblRq1: TLabel;
    LblZb: TLabel;
    DT: TDateTimePicker;
    CboZb: TComboBox;
    DT1: TDateTimePicker;
    Panel6: TPanel;
    Label17: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    Label20: TLabel;
    LblZb1: TLabel;
    SEYear1: TSpinEdit;
    SEYear2: TSpinEdit;
    CboMonth1: TComboBox;
    CboMonth2: TComboBox;
    CboZb1: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton7Click(Sender: TObject);
    procedure ToolButton8Click(Sender: TObject);
    procedure SEYear1Change(Sender: TObject);
    procedure SEYear2Change(Sender: TObject);
    procedure CboMonth1Change(Sender: TObject);
    procedure CboMonth2Change(Sender: TObject);
    procedure tBtnCitySelectAllClick(Sender: TObject);
    procedure tBtnCityClearAllClick(Sender: TObject);
    procedure tBtnGuideSelectAllClick(Sender: TObject);
    procedure tBtnGuideClearAllClick(Sender: TObject);
  private
    { Private declarations }
    procedure LabelClick(Sender: TObject);
    procedure TjOneZb;
    procedure TjOneCity;
    procedure TjOneMonth;
    procedure TjTQOneZb;
    procedure TjTQOneCity;
    procedure TjSjZb;
  public
    { Public declarations }
  end;

var
  frmGuideLine: TfrmGuideLine;

implementation

{$R *.dfm}
uses uUserFunc, DateUtils, Types, uDMFunc, uConstUtils, JGSearchFxTx{JGYHZjLxFxTx};

procedure TfrmGuideLine.FormCreate(Sender: TObject);
var
  i: smallint;
begin
  inherited;
  dt.Date := date();
  dt1.Date := date();
  seYear1.Value := YearOf(date());
  seYear2.Value := YearOf(date());
  CboMonth1.ItemIndex := MonthOf(date())-1;
  CboMonth2.ItemIndex := MonthOf(date())-1;
  for i:=0 to high(aNode) do
  begin
    aNode[i].OnClick := LabelClick;
    clbCity.Items.Add(aNode[i].Caption);
    clbCity.ItemEnabled[i] := aNode[i].Enabled;
  end;
end;

procedure TfrmGuideLine.LabelClick(Sender: TObject);
begin
  inherited;
  if ToolButton1.Down then
    TjSjZb
  else
  if ToolButton2.Down or Toolbutton4.Down or ToolButton5.Down then
    clbCity.Checked[iNode] := not clbCity.Checked[iNode]
  else
  if ToolButton3.Down then
    TjOneCity
  else
  if ToolButton6.Down then
    TjTQOneCity;
end;

procedure TfrmGuideLine.TjOneCity;
var
  aZB:TStringDynArray;
  i,j,iR,iC :smallint;
  aYd:TStringDynArray;
  aData: TArray2D;
  dtDate1,dtDate2: TDate;
  aZbData: TDoubleDynArray;
  sCity: String;
  CwFx : TJGSearchFxTxGL;
begin
  sCity := aNode[iNode].Number;
  j:=0;
  for i:=0 to ClbZb.Count-1 do
  begin
    if ClbZb.Checked[i] then
    begin
      inc(j);
      setlength(aZb,j);
      aZb[j-1]:= ClbZb.Items.Strings[i];
    end;
  end;
  if j=0 then
  begin
    Application.MessageBox('请选择分析的指标',pMsgCaption,64);
    exit;
  end;
  dtDate1 := StartOfTheMonth(Dt.Date);
  dtDate2 := StartOfTheMonth(Dt1.Date);
  if dtDate1>dtDate2 then
  begin
    dtDate1 := Dt1.Date;
    dtDate2 := Dt.Date;
  end;
  j := 0;
  repeat
    inc(j);
    SetLength(aYd,j);
    aYd[j-1] := Dtos(dtDate1,6);
    dtDate1 := IncMonth(dtDate1);
  until dtDate1>dtDate2;
  iC:=high(aZb)+1;
  iR:=high(aYd)+1;
  setlength(aData,iR,iC);
  for j:=0 to iR-1 do
  begin
    CalcFinanceGuideLine(sCity,aYd[j],aZbData);
    for i:=0 to iC-1 do
      aData[j,i] := aZbData[ConvertZbN(aZb[i])];
  end;
  CwFx:=TJGSearchFxTxGL.Create(application);
  CwFx.StatusBar1.Panels[0].Text := aNode[iNode].Caption;
  CwFx.SetGraph(aZb,aYd,aData);
  CwFx.ShowModal;
  CwFx.Free;
end;

procedure TfrmGuideLine.TjOneMonth;
var
  //财务分析
  aDs,aDs1:TStringDynArray;
  i,j,iR,iC :smallint;
  aZb:TStringDynArray;
  aData: TArray2D;
  aZbData: TDoubleDynArray;
  sYd: String;
  CwFx : TJGSearchFxTxGL;
begin
  j:=0;
  for i:=0 to clbCity.Count-1 do
  begin
    if clbCity.Checked[i] then
    begin
      inc(j);
      setlength(aDs,j);
      setlength(aDs1,j);
      aDs[j-1]:= aNode[i].Number ; //ClbDs.Items.Strings[i];
      aDs1[j-1]:=aNode[i].Caption //copy(ClbDs.Items.Strings[i],9,30);
    end;
  end;
  if j=0 then
  begin
    Application.MessageBox('请选择分析的地市',PMsgCaption,64);
    exit;
  end;
  j:=0;
  for i:=0 to ClbZb.Count-1 do
  begin
    if ClbZb.Checked[i] then
    begin
      inc(j);
      setlength(aZb,j);
      aZb[j-1]:= ClbZb.Items.Strings[i];
    end;
  end;
  if j=0 then
  begin
    Application.MessageBox('请选择分析的指标',pMsgCaption,64);
    exit;
  end;
  sYd := DtoS(Dt.Date,6);
  iC:=high(aDs)+1;
  iR:=high(aZb)+1;
  setlength(aData,iR,iC);
  for i:=0 to iC-1 do
  begin
    CalcFinanceGuideLine(aDs[i],sYd,aZbData);
    for j:=0 to iR-1 do
      aData[j,i]:=aZbData[j];
  end;
  CwFx:=TJGSearchFxTxGL.Create(application);
  CwFx.StatusBar1.Panels[0].Text := sYd;
  CwFx.SetGraph(aDs1,aZb,aData);
  CwFx.ShowModal;
  CwFx.Free;
end;

procedure TfrmGuideLine.TjOneZb;
var
  //财务分析
  aDs,aDs1:TStringDynArray;
  i,j,iLx,iR,iC :smallint;
  aYd: TStringDynArray;
  aData: TArray2D;
  aZbData: TDoubleDynArray;
  dtDate1,dtDate2: TDate;
  CwFx : TJGSearchFxTxGL;
begin
  j:=0;
  for i:=0 to ClbCity.Count-1 do
  begin
    if ClbCity.Checked[i] then
    begin
      inc(j);
      setlength(aDs,j);
      setlength(aDs1,j);
      aDs[j-1]:= aNode[i].Number; //ClbDs.Items.Strings[i];
      aDs1[j-1]:=aNode[i].Caption; //copy(ClbDs.Items.Strings[i],9,30);
    end;
  end;
  if j=0 then
  begin
    Application.MessageBox('请选择分析的地市',pMsgCaption,64);
    exit;
  end;
  dtDate1 := StartOfTheMonth(Dt.Date);
  dtDate2 := StartOfTheMonth(Dt1.Date);
  if dtDate1>dtDate2 then
  begin
    dtDate1 := Dt1.Date;
    dtDate2 := Dt.Date;
  end;
  j := 0;
  repeat
    inc(j);
    SetLength(aYd,j);
    aYd[j-1] := Dtos(dtDate1,6);
    dtDate1 := IncMonth(dtDate1);
  until dtDate1>dtDate2;

  iLx := CboZb.ItemIndex ;
  iC:=high(aDs)+1;
  iR:=high(aYd)+1;
  setlength(aData,iR,iC);

  for i:=0 to iC-1 do
  begin
    for j:=0 to iR-1 do
    begin
      CalcFinanceGuideLine(aDs[i],aYd[j],aZbData);
      aData[j,i]:=aZbData[iLx];
    end;
  end;
  CwFx:=TJGSearchFxTxGL.Create(application);
  CwFx.StatusBar1.Panels[0].Text := ConvertZbC(iLx);
  CwFx.SetGraph(aDs1,aYd,aData);
  CwFx.ShowModal;
  CwFx.Free;
end;

procedure TfrmGuideLine.TjSjZb;
//var
//  CwFx: TFormBbCwFx;
begin
{  CwFx:=TFormBbCwFx.Create(application);
  CwFx.DT.Date := Dt.Date;
  CwFx.cDsbh := cCityNum;
  CwFx.Cell1.DoCalculateAll;
  CwFx.ShowModal;
  Dt.Date := CwFx.DT.Date;
  CwFx.Free;
}
end;

procedure TfrmGuideLine.TjTQOneCity;
var
  //财务分析
  CwFx: TJGSearchFxTxGL;
  aZB: TStringDynArray;
  i,j,l,iR,iC :smallint;
  aYd: TStringDynArray;
  aData: TArray2D;
  aZbData: TDoubleDynArray;
  y0,y,y1,m0,m,m1: integer;
//  day:tDate;
  sCity: String;
begin
  sCity := aNode[iNode].Number;
  j:=0;
  for i:=0 to ClbZb.Count-1 do
  begin
    if ClbZb.Checked[i] then
    begin
      inc(j);
      setlength(aZb,j);
      aZb[j-1]:= ClbZb.Items.Strings[i];
    end;
  end;
  if j=0 then
  begin
    Application.MessageBox('请选择分析的指标',PMsgCaption,64);
    exit;
  end;
  y := SEYear1.Value ;
  y1 := SEYear2.Value;
  m := CboMonth1.ItemIndex;
  m1 := CboMonth2.ItemIndex;

  l:=(y1-y+1)*(m1-m+1);
  setlength(aYd,l);
  for i:=0 to y1-y do
  begin
    y0 := y+i;
    for j:=0 to m1-m do
    begin
      m0 := m+j+1;
      aYd[i*(m1-m+1)+j]:=Padl(inttostr(y0),4,'0')+padl(inttostr(m0),2,'0');
    end;
  end;
  iC:=high(aZb)+1;
  iR:=high(aYd)+1;
  setlength(aData,iR,iC);

  for j:=0 to iR-1 do
  begin
    CalcFinanceGuideLine(sCity,aYd[j],aZbData);
    for i:=0 to iC-1 do
    begin
      aData[j,i]:=aZbData[ConvertZbN(aZb[i])];
    end;
  end;
  CwFx:=TJGSearchFxTxGL.Create(application);
  CwFx.StatusBar1.Panels[0].Text := aNode[iNode].Caption;
  CwFx.SetGraph(aZb,aYd,aData);
  CwFx.ShowModal;
  CwFx.Free;
end;

procedure TfrmGuideLine.TjTQOneZb;
var
  //财务分析
  CwFx: TJGSearchFxTxGL;
  aDs,aDs1: TStringDynArray;
  i,j,l,iLx,iR,iC :smallint;
  aYd:TStringDynArray;
  aData: TArray2D;
  aZbData: TDoubleDynArray;
  y,y0,y1,m,m0,m1:integer;
//  day:tDate;
begin
  j:=0;
  for i:=0 to ClbCity.Count-1 do
  begin
    if ClbCity.Checked[i] then
    begin
      inc(j);
      setlength(aDs,j);
      setlength(aDs1,j);
      aDs[j-1]:= aNode[i].Number; //ClbDs.Items.Strings[i];
      aDs1[j-1]:=aNode[i].Caption; //copy(ClbDs.Items.Strings[i],9,30);
    end;
  end;
  if j=0 then
  begin
    Application.MessageBox('请选择分析的地市',PMsgCaption,64);
    exit;
  end;
  y := SEYear1.Value ;
  y1 := SEYear2.Value;
  m := CboMonth1.ItemIndex;
  m1 := CboMonth2.ItemIndex;

  l:=(y1-y+1)*(m1-m+1);
  setlength(aYd,l);
  for i:=0 to y1-y do
  begin
    y0 := y+i;
    for j:=0 to m1-m do
    begin
      m0 := m+j+1;
      aYd[i*(m1-m+1)+j]:=Padl(inttostr(y0),4,'0')+padl(inttostr(m0),2,'0');
    end;
  end;
  iLx := CboZb1.ItemIndex ;
  iC:=high(aDs)+1;
  iR:=high(aYd)+1;
  setlength(aData,iR,iC);

  for i:=0 to iC-1 do
  begin
    for j:=0 to iR-1 do
    begin
      CalcFinanceGuideLine(aDs[i],aYd[j],aZbData);
      aData[j,i]:=aZbData[iLx];
    end;
  end;
  CwFx:=TJGSearchFxTxGL.Create(application);
  CwFx.StatusBar1.Panels[0].Text := ConvertZbC(iLx);
  CwFx.SetGraph(aDs1,aYd,aData);
  CwFx.ShowModal;
  CwFx.Free;
end;

procedure TfrmGuideLine.ToolButton1Click(Sender: TObject);
begin
  StatusBar1.Panels[1].Text := (Sender as TToolButton).Hint;
  if Sender=ToolButton1 then
  begin
    Panel1.Visible := false;
    Panel2.Visible := false;
    panel4.Visible := false;
    LblRq1.Visible := False;
    LblZb.Visible := False;
    Dt1.Visible := False;
    CboZb.Visible := False;
    Toolbutton7.visible := False;
    Panel6.Visible := False;
    Panel5.Visible := True;
  end
  else
  if Sender=ToolButton2 then
  begin
    Panel1.Visible := true;
    Panel2.Visible := FALSE;
    panel4.Visible := false;
    LblRq1.Visible := true;
    Dt1.Visible := true;
    LblZb.Visible := true;
    CboZb.Visible := true;
    Toolbutton7.visible := true;
    Panel6.Visible := False;
    Panel5.Visible := True;
  end
  else
  if Sender=ToolButton3 then
  begin
    panel4.Visible := true;
    Panel1.Visible := FALSE;
    Panel2.Visible := FALSE;
    LblRq1.Visible := true;
    Dt1.Visible := true;
    LblZb.Visible := False;
    CboZb.Visible := False;
    Toolbutton7.visible := False;
    Panel6.Visible := False;
    Panel5.Visible := True;
  end
  else
  if Sender=ToolButton4 then
  begin
    panel4.Visible := true;
    Panel1.Visible := true;
    Panel2.Visible := FALSE;
    LblRq1.Visible := false;
    LblZb.Visible := false;
    Dt1.Visible := false;
    CboZb.Visible := false;
    Toolbutton7.visible := true;
    Panel6.Visible := False;
    Panel5.Visible := True;
  end
  else
  if Sender=ToolButton5 then
  begin
    Panel1.Visible := true;
    Panel2.Visible := FALSE;
    panel4.Visible := false;
    Toolbutton7.visible := true;
    Panel6.Visible := True;
    Panel5.Visible := False;
    LblZb1.Visible := True;
    CboZb1.Visible := True;
  end
  else
  if Sender=ToolButton6 then
  begin
    panel4.Visible := true;
    Panel1.Visible := FALSE;
    Panel2.Visible := FALSE;
    Toolbutton7.visible := False;
    Panel6.Visible := True;
    Panel5.Visible := False;
    LblZb1.Visible := False;
    CboZb1.Visible := False;
  end
end;

procedure TfrmGuideLine.ToolButton7Click(Sender: TObject);
begin
  if ToolButton2.Down then
  begin
    TjOneZb;
  end
  else
  if ToolButton4.Down then
  begin
    TjOneMonth;
  end
  else
  if ToolButton5.Down then
  begin
    TjTQOneZb;
  end;
end;

procedure TfrmGuideLine.ToolButton8Click(Sender: TObject);
begin
  inherited;
  Close;
end;

procedure TfrmGuideLine.SEYear1Change(Sender: TObject);
begin
  inherited;
  if SEYear2.Value <= SEYear1.Value then
    SEYear2.Value := SEYear1.Value +1;
end;

procedure TfrmGuideLine.SEYear2Change(Sender: TObject);
begin
  inherited;
  if SEYear2.Value <= SEYear1.Value then
    SEYear1.Value := SEYear2.Value -1;

end;

procedure TfrmGuideLine.CboMonth1Change(Sender: TObject);
begin
  inherited;
  if CboMonth2.ItemIndex < CboMonth1.ItemIndex then
    CboMonth2.ItemIndex := CboMonth1.ItemIndex;

end;

procedure TfrmGuideLine.CboMonth2Change(Sender: TObject);
begin
  inherited;
  if CboMonth2.ItemIndex < CboMonth1.ItemIndex then
    CboMonth1.ItemIndex := CboMonth2.ItemIndex;
end;

procedure TfrmGuideLine.tBtnCitySelectAllClick(Sender: TObject);
var
  i : smallint;
begin
  for i:=0 to CLBCity.Count-1 do
  begin
    CLBCity.Checked[i]:= True;
  end;

end;

procedure TfrmGuideLine.tBtnCityClearAllClick(Sender: TObject);
var
  i : smallint;
begin
  for i:=0 to CLBCity.Count-1 do
  begin
    CLBCity.Checked[i]:= False;
  end;
end;

procedure TfrmGuideLine.tBtnGuideSelectAllClick(Sender: TObject);
var
  i : smallint;
begin
  for i:=0 to CLBZb.Count-1 do
  begin
    CLBZb.Checked[i]:= True;
  end;
end;

procedure TfrmGuideLine.tBtnGuideClearAllClick(Sender: TObject);
var
  i : smallint;
begin
  for i:=0 to CLBZb.Count-1 do
  begin
    CLBZb.Checked[i]:= False;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -