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

📄 frmpjgsetll.pas

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

interface

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

type
  TJGSetLl = class(TForm)
    CoolBar1: TCoolBar;
    ToolBar1: TToolBar;
    ImageList1: TImageList;
    ImageList2: TImageList;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    Panel1: TPanel;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    Label1: TLabel;
    edtDq: TEdit;
    Label2: TLabel;
    edtHq: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    seQx: TSpinEdit;
    Label6: TLabel;
    edtDk: TEdit;
    Label7: TLabel;
    Button1: TButton;
    Button2: TButton;
    Label8: TLabel;
    SpinEdit2: TSpinEdit;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Edit4: TEdit;
    Edit5: TEdit;
    YhGrid: TStringGrid;
    Button3: TButton;
    Button4: TButton;
    CkllGrid: TStringGrid;
    LlGrid: TStringGrid;
    Button5: TButton;
    Button6: TButton;
    edtFx: TEdit;
    Label13: TLabel;
    dtZxrq: TDateTimePicker;
    Label3: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Image1: TImage;
    GroupBox1: TGroupBox;
    procedure ToolButton3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure SaveItem(const iPage: smallint=0);
  public
    { Public declarations }
    procedure RefreshItem(const iPage: smallint=0);
  end;

var
  JGSetLl: TJGSetLl;

implementation

{$R *.dfm}
//uses UserFace,DataModule;
uses uConstUtils, uDMFunc, uUserFunc, DateUtils;

procedure TJGSetLl.ToolButton3Click(Sender: TObject);
begin
  close;
end;

procedure TJGSetLl.Button1Click(Sender: TObject);
var
  i,j: smallint;
  c,c1,c2: string;
begin
  c:= trim(inttostr(seQx.Value));
  c1:= edtDk.Text;
  c2:= edtFx.Text;
  i:=1;
  while i<=LlGrid.RowCount-2 do
  begin
    if strtoint(LLGrid.Cells[0,i]) = seQx.Value then
    begin
      application.MessageBox(pchar('年限为'+c+'的利率已经存在!'),pMsgCaption,64);
      seQx.SetFocus;
      exit;
    end
    else
    if strtoint(LLGrid.Cells[0,i]) > seQx.Value then
    begin
      for j:= LlGrid.RowCount-1 downto i+1 do
      begin
        LlGrid.Cells[0,j]:=LlGrid.Cells[0,j-1];
        LlGrid.Cells[1,j]:=LlGrid.Cells[1,j-1];
        LlGrid.Cells[2,j]:=LlGrid.Cells[2,j-1];
      end;
      break;
    end;
    inc(i);
  end;
  LlGrid.Cells[0,i]:= c;
  LlGrid.Cells[1,i]:= c1;
  LlGrid.Cells[2,i]:= c2;
  LlGrid.RowCount := LlGrid.RowCount+1;
end;

procedure TJGSetLl.Button2Click(Sender: TObject);
var
  i: smallint;
begin
  if (LlGrid.Row <=0) or (LlGrid.Row>= LlGrid.RowCount-1) then exit;
  for i := LlGrid.Row to LlGrid.RowCount-1 do
  begin
    LlGrid.Cells[0,i]:=  LlGrid.Cells[0,i+1];
    LlGrid.Cells[1,i]:=  LlGrid.Cells[1,i+1];
    LlGrid.Cells[2,i]:=  LlGrid.Cells[2,i+1];
  end;
  if LlGrid.RowCount >2 then
    LlGrid.RowCount := LlGrid.RowCount -1;
end;

procedure TJGSetLl.Button3Click(Sender: TObject);
var
  i,j: smallint;
begin
  if (trim(Edit4.Text) ='') or (trim(Edit5.Text) ='') then
  begin
    application.MessageBox('银行编号及名称不能为空。',pMsgCaption,64);
    exit;
  end;
  i:=1;
  while i<=YhGrid.RowCount-2 do
  begin
    if YhGrid.Cells[0,i] = Edit4.Text then
    begin
      application.MessageBox(pchar('编号为'+Edit4.Text+'的银行已经存在!'),pMsgCaption,64);
      exit;
    end
    else
    if YhGrid.Cells[0,i] > Edit4.Text then
    begin
      for j:= YhGrid.RowCount-1 downto i+1 do
      begin
        YhGrid.Cells[0,j]:=YhGrid.Cells[0,j-1];
        YhGrid.Cells[1,j]:=YhGrid.Cells[1,j-1];
      end;
      break;
    end;
    inc(i);
  end;
  YhGrid.Cells[0,i]:= Edit4.Text;
  YhGrid.Cells[1,i]:= Edit5.Text;
  YhGrid.RowCount := YhGrid.RowCount+1;
end;

procedure TJGSetLl.Button4Click(Sender: TObject);
var
  i: smallint;
begin
  if (YhGrid.Row <=0) or (YhGrid.Row>= YhGrid.RowCount-1) then exit;
  for i := YhGrid.Row to YhGrid.RowCount-1 do
  begin
    YhGrid.Cells[0,i]:=  YhGrid.Cells[0,i+1];
    YhGrid.Cells[1,i]:=  YhGrid.Cells[1,i+1];
  end;
  if YhGrid.RowCount >2 then
    YhGrid.RowCount := YhGrid.RowCount -1;
end;

procedure TJGSetLl.ToolButton1Click(Sender: TObject);
begin
  SaveItem(PageControl1.ActivePageIndex);
end;

procedure TJGSetLl.RefreshItem(const iPage: smallint);
var
  i1,i2:smallint;
  aKhyh: TKhyhDynArray;
  aDkll: TDkllDynArray;
  aCkll: TCkllDynArray;
begin
  PageControl1.ActivePageIndex := iPage;
  case iPage of
    0: begin
         LlGrid.Cells[0,0]:='贷款年限';
         LlGrid.Cells[1,0]:='贷款年利率';
         LlGrid.Cells[2,0]:='罚息日利率';
         DkllInfo(aDkll);
         i2:= high(aDkll);
         for i1:=0 to i2 do
         begin
           llGrid.Cells[0,i1+1]:= inttostr(aDkll[i1].Dkqx);
           llGrid.Cells[1,i1+1]:= floattostr(aDkll[i1].DkNll);
           llGrid.Cells[2,i1+1]:= floattostr(aDkll[i1].FxTll);
           llGrid.RowCount := llGrid.RowCount+1;
         end;
//         llGrid.RowCount := llGrid.RowCount-1;

         CkLlGrid.Cells[0,0]:='执行日期';
         CkLlGrid.Cells[1,0]:='活期利率';
         CkLlGrid.Cells[2,0]:='定期利率';
         CkllInfo(aCkll);
         i2:= high(aCkll);
         for i1:=0 to i2 do
         begin
           CkllGrid.Cells[0,i1+1]:= aCkll[i1].ZxRq;
           CkllGrid.Cells[1,i1+1]:= floattostr(aCkll[i1].Hqll );
           CkllGrid.Cells[2,i1+1]:= floattostr(aCkll[i1].Dqll );
           CkllGrid.RowCount := CkllGrid.RowCount+1;
         end;
//         CkllGrid.RowCount := CkllGrid.RowCount-1;
       end;
    1: begin
         YhGrid.Cells[0,0]:='编号';
         YhGrid.Cells[1,0]:='名称';
         SpinEdit2.Value := KhyhHsInfo;
         KhyhInfo(aKhyh);
         i2:= High(aKhyh);
         for i1:=0 to i2 do
         begin
           yhGrid.Cells[0,i1+1]:= aKhyh[i1].bh;
           yhGrid.Cells[1,i1+1]:= aKhyh[i1].mc;
           YhGrid.RowCount := YhGrid.RowCount+1;
         end;
//         YhGrid.RowCount := YhGrid.RowCount-1;
       end;
  end;
end;

procedure TJGSetLl.Button5Click(Sender: TObject);
var
  i,j: smallint;
  c,c1,c2: string;
begin
  c:= dtos(dtZxrq.Date);
  c1:= edtHq.Text;
  c2:= edtDq.Text;
  i:=1;
  while i<=CkLlGrid.RowCount-2 do
  begin
    if CkLLGrid.Cells[0,i] = c then
    begin
      application.MessageBox(pchar('执行日期为'+c+'的利率已经存在!'),pMsgCaption,64);
      dtZxrq.SetFocus;
      exit;
    end
    else
    if CkLLGrid.Cells[0,i] > c then
    begin
      for j:= CkLlGrid.RowCount-1 downto i+1 do
      begin
        CkLlGrid.Cells[0,j]:=CkLlGrid.Cells[0,j-1];
        CkLlGrid.Cells[1,j]:=CkLlGrid.Cells[1,j-1];
        CkLlGrid.Cells[2,j]:=CkLlGrid.Cells[2,j-1];
      end;
      break;
    end;
    inc(i);
  end;
  CkLlGrid.Cells[0,i]:= c;
  CkLlGrid.Cells[1,i]:= c1;
  CkLlGrid.Cells[2,i]:= c2;
  CkLlGrid.RowCount := CkLlGrid.RowCount+1;
end;

procedure TJGSetLl.Button6Click(Sender: TObject);
var
  i: smallint;
begin
  if (CkLlGrid.Row <=0) or (CkLlGrid.Row>= CkLlGrid.RowCount-1) then exit;
  for i := CkLlGrid.Row to CkLlGrid.RowCount-1 do
  begin
    CkLlGrid.Cells[0,i]:=  CkLlGrid.Cells[0,i+1];
    CkLlGrid.Cells[1,i]:=  CKLlGrid.Cells[1,i+1];
    CkLlGrid.Cells[2,i]:=  CKLlGrid.Cells[2,i+1];
  end;
  if CkLlGrid.RowCount >2 then
    CkLlGrid.RowCount := CkLlGrid.RowCount -1;
end;

procedure TJGSetLl.SaveItem(const iPage: smallint);
var
  i1,i2,ir:smallint;
  aKhyh: TKhyhDynArray;
  aDkll: TDkllDynArray;
  aCkll: TCkllDynArray;
begin
  case iPage of
    0: begin
         i2 := LlGrid.RowCount -3;
         setlength(aDkll,i2+1);
         for i1:=0 to i2 do
         begin
           aDkll[i1].Dkqx := strtoint(llgrid.Cells[0,i1+1]);
           aDkll[i1].DkNll := strtofloat(LlGrid.Cells[1,i1+1]);
           aDkll[i1].FxTll := strtofloat(llGrid.Cells[2,i1+1]);
         end;
         ir := DkLLSave(aDkll);
         if ir<>0 then
           application.MessageBox('贷款利率存盘失败!',PMsgCaption,64);

         i2:= CkllGrid.RowCount-3;
         setlength(aCkll,i2+1);
         for i1:=0 to i2 do
         begin
           aCkll[i1].ZxRq := CkllGrid.Cells[0,i1+1];
           aCkll[i1].Hqll := strtofloat(CkllGrid.Cells[1,i1+1]);
           aCkll[i1].Dqll := strtofloat(CkllGrid.Cells[2,i1+1]);
         end;
         if CkLlSave(aCkll)<>0 then
           application.MessageBox('存款利率存盘失败!',PMsgCaption,64)
         else
           if ir=0 then
             application.MessageBox('设置存盘成功',PMsgCaption,64);
       end;
    1: begin
         i1 := SpinEdit2.Value;
         ir := KhyhHsSave(i1);
         if ir<>0 then
           application.MessageBox('开户户数存盘失败!',PMsgCaption,64);

         i2:= YhGrid.RowCount-3;
         setlength(aKhyh,i2+1);
         for i1:=0 to i2 do
         begin
           aKhyh[i1].bh := yhGrid.Cells[0,i1+1];
           aKhyh[i1].mc := yhGrid.Cells[1,i1+1];
         end;
         if KhyhSave(aKhyh)<>0 then
           application.MessageBox('开户利率存盘失败!',PMsgCaption,64)
         else
           if ir=0 then
             application.MessageBox('设置存盘成功',PMsgCaption,64);
       end;
  end;
end;

procedure TJGSetLl.FormCreate(Sender: TObject);
begin
  dtZxrq.Date := EncodeDate(YearOf(date()),7,1);
end;

end.

⌨️ 快捷键说明

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