beforeregister.~pas

来自「企业端数据申报系统:单位管理模块 单位查询. 业务申报模块 在线数据下载」· ~PAS 代码 · 共 826 行 · 第 1/3 页

~PAS
826
字号
unit BeforeRegister;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, BASEWIN, XPMenu, Menus, ActnList, ImgList, ToolWin, ComCtrls,
  ExtCtrls, Grids, DBGrids, TFlatSpeedButtonUnit, StdCtrls, TFlatEditUnit,
  TFlatButtonUnit, TFlatRadioButtonUnit, TFlatComboBoxUnit, DB, RxMemDS,typinfo,
  Mask, ToolEdit, RXDBCtrl;
const screenwidth=1024;
const screenheight=768;
type
  TBeforeRegister_frm = class(Tbasewin_frm)
    Panel3: TPanel;
    Panel4: TPanel;
    FlatButton1: TFlatButton;
    Panel2: TPanel;
    RMD1: TRxMemoryData;
    RMD1iscode: TStringField;
    RMD1psname: TStringField;
    RMD1psseno: TIntegerField;
    RMD1yearno: TIntegerField;
    RMD1cpsum: TFloatField;
    RMD1cymonths: TIntegerField;
    RMD1cypj: TFloatField;
    RMD1cyints: TFloatField;
    RMD1lysum: TFloatField;
    RMD1lyints: TFloatField;
    Label32: TLabel;
    FlatEdit: TFlatEdit;
    FlatComboBox4: TFlatComboBox;
    FlatComboBox2: TFlatComboBox;
    FlatComboBox1: TFlatComboBox;
    Label31: TLabel;
    FlatSpeedButton1: TFlatSpeedButton;
    DataSource1: TDataSource;
    RMD2: TRxMemoryData;
    RMD2iscode: TStringField;
    RMD2psname: TStringField;
    RMD2psseno: TStringField;
    RMD2bgjfdate: TDateField;
    RMD2months: TIntegerField;
    RMD2psdate: TDateField;
    GroupBox1: TGroupBox;
    DBGrid1: TDBGrid;
    GroupBox2: TGroupBox;
    Label3: TLabel;
    Label2: TLabel;
    Label1: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    FlatEdit1: TFlatEdit;
    FlatEdit2: TFlatEdit;
    FlatEdit3: TFlatEdit;
    FlatEdit5: TFlatEdit;
    DateEdit1: TDateEdit;
    Label7: TLabel;
    FlatComboBox5: TFlatComboBox;
    FlatComboBox3: TFlatComboBox;
    RMD1cyActual: TFloatField;
    RMD1cyrely: TFloatField;
    RMD1siinter: TFloatField;
    RMD1lycycpints: TFloatField;
    RMD1lycypsints: TFloatField;
    RMD1lycpprin: TFloatField;
    RMD1lypsprin: TFloatField;
    RMD1lycpints: TFloatField;
    RMD1lypsints: TFloatField;
    RMD1cycpints: TFloatField;
    RMD1cypsints: TFloatField;
    RMD: TRxMemoryData;
    RMDiscode: TStringField;
    RMDpsname: TStringField;
    RMDpsseno: TIntegerField;
    RMDyearno: TIntegerField;
    RMDcpsum: TFloatField;
    RMDcymonths: TIntegerField;
    RMDcypj: TFloatField;
    RMDcyints: TFloatField;
    RMDlysum: TFloatField;
    RMDlyints: TFloatField;
    RMDcyActual: TFloatField;
    RMDcyrely: TFloatField;
    RMDcycpints: TFloatField;
    RMDcypsints: TFloatField;
    RMDlycpints: TFloatField;
    RMDlypsints: TFloatField;
    RMDlycpprin: TFloatField;
    RMDlypsprin: TFloatField;
    RMDcyftcpfd: TFloatField;
    RMDcypsarac: TFloatField;
    RMDcyrelycpfd: TFloatField;
    RMDcyrelypsfd: TFloatField;
    RMDsiinter: TFloatField;
    RMDlycycpints: TFloatField;
    RMDlycypsints: TFloatField;
    FlatEdit4: TFlatEdit;
    Label8: TLabel;
    FlatButton2: TFlatButton;
    Label15: TLabel;
    FlatEdit6: TFlatEdit;
    procedure FormCreate(Sender: TObject);
    procedure FlatComboBox1Change(Sender: TObject);
    procedure FlatSpeedButton1Click(Sender: TObject);
    procedure FlatComboBox3Change(Sender: TObject);
    procedure DateEdit1Change(Sender: TObject);
    procedure FlatButton1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FlatButton2Click(Sender: TObject);
    procedure FlatEditKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
    changed:boolean;
    procedure showdata;
    function  WhetherChanged:boolean;
    procedure SaveDataV1; //固定工
    procedure SaveDataV2; //合同工
    procedure init;
  public
    { Public declarations }
  end;

var
  BeforeRegister_frm: TBeforeRegister_frm;

implementation

uses datashare, sbp_psagacct_all, Main;

{$R *.dfm}
procedure TBeforeRegister_frm.init ;
begin
  Flatedit1.Text :='';
  Flatedit2.Text :='';
  Flatedit3.Text :='';
  Flatedit5.Text :='';
  flatedit6.Text :='';

  Dateedit1.Date:=0;
  FlatEdit4.Text :='';
  //Flatedit.Text :='';
  changed:=false;
  RMD.Close ;
end;
procedure TBeforeRegister_frm.showdata ;
var
  interest,lysum,lyints, lycycpints,lycypsints:double;
begin
  RMD.Close ;
  RMD2.Close ;
  Dateedit1.Date:=0;
  //Dateedit2.Date :=0;
  Flatedit5.Text :='';
  
   with DataShare_frm.Query2 do
        begin
        close;
        Params.Clear ;
        sql.Clear ; //年份, 当年缴费工资总额,当年缴费总月数,月平均缴费,本年利息,历年缴费月数,历年利息 ,当年实缴,当年补缴
        sql.Add('select A.yearno ,A.TTWAGE,A.MONTHS,A.TTWAGE/(case when A.MONTHS=0 then 1 else A.months end),B.cycpints+B.cypsints ,B.lycpprin+B.lypsprin ,B.lycpints+B.lypsints,B.cyftcpfd+B.cypsarac,B.cyrelycpfd+B.cyrelypsfd,');
               //           0        1          2         3                 4                       5                          6                        7                   8
         //本年单位利息,本年个人利息,历年单位利息,历年个人利息,上年末单位划转部分本金累计,上年末个人划转部分本金累计, 本年补缴历年缴费年限单位欠划入,本年补缴历年缴费年限个人欠划入
        sql.Add('B.cycpints,B.cypsints,B.lycpints,B.lypsints,B.lycpprin,B.lypsprin,B.cyftcpfd,B.cypsarac,B.cyrelycpfd,B.cyrelypsfd,B.siinter,B.lycycpints,B.lycypsints');
              //      9        10           11        12        13           14          15         16         17          18         19          20              21
              //                                                                 //本年单位实划入到帐额 ,本年个人应缴到帐额         当年利率 上年末单位划转部分本息本年利息 上年末个人划转部分本息本年利息
        sql.Add('  from sbdu_pswgcase A ,sbda_psagacct B');
        sql.Add('  where  A.psseno=B.psseno and A.Yearno=B.Yearno and A.psseno=:param');
        sql.Add('order by A.yearno');
        parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex]; 
        prepare;
        open;
        //if Recordcount<1 then exit;
        RMD.Close ;
        RMD.Open ;
        RMD.DisableControls ;
        while not eof do
          begin
            if Fields[0].AsInteger<2002 then
            RMD.AppendRecord([Flatcombobox4.Items[Flatcombobox1.ItemIndex],Flatcombobox1.Items[Flatcombobox1.ItemIndex],Flatcombobox2.Items[Flatcombobox1.ItemIndex],Fields[0].AsInteger,Fields[1].AsFloat,Fields[2].AsInteger,
                             formatfloat('0.00',Fields[3].AsFloat),Fields[4].AsFloat,Fields[5].AsFloat,Fields[6].asfloat,Fields[7].asfloat,Fields[8].asfloat,
                             Fields[9].AsFloat,Fields[10].asfloat,Fields[11].Asfloat,Fields[12].asfloat,Fields[13].asfloat,Fields[14].asfloat,Fields[15].asfloat,
                             Fields[16].asfloat,Fields[17].asfloat,Fields[18].asfloat,Fields[19].AsFloat,Fields[20].asfloat,Fields[21].asfloat])
            else
            begin
              interest:=0;lysum:=0;lyints:=0; lycycpints:=0;lycypsints:=0;
              With DataShare_frm.Query6 do
                begin
                  close;
                  sql.Clear ;
                  sql.Add('select distinct SIINTER  from sbds_inancons where yearno=:param');
                  parambyname('param').AsInteger :=DataShare_frm.Query2.Fields[0].AsInteger ;
                  prepare;
                  open;
                  if recordcount>0 then interest:=Fields[0].AsFloat ;
                end;
              RMD.Last ;
              lysum:=RMD.fieldbyname('cyActual').AsFloat+RMD.fieldbyname('cyrely').AsFloat+RMD.fieldbyname('lysum').AsFloat ;
              //lyints:=(lysum+RMD.Fieldbyname('lyints').AsFloat+RMD.fieldbyname('cyints').AsFloat)*interest+RMD.fieldbyname('lyints').AsFloat+RMD.fieldbyname('cyints').AsFloat;
              lyints:=(RMD.fieldbyname('lycpprin').AsFloat+RMD.fieldbyname('lypsprin').AsFloat+RMD.fieldbyname('lycpints').AsFloat+RMD.fieldbyname('lypsints').AsFloat)*interest+
                       RMD.fieldbyname('cycpints').AsFloat+RMD.fieldbyname('cypsints').AsFloat+RMD.Fieldbyname('lycpints').AsFloat+RMD.fieldbyname('lypsints').AsFloat;

              lycypsints:=(RMD.fieldbyname('lypsprin').AsFloat+RMD.Fieldbyname('lypsints').AsFloat)*interest+RMD.fieldbyname('cypsints').AsFloat+RMD.fieldbyname('lypsints').AsFloat ;
              lycycpints:=(RMD.fieldbyname('lycpprin').AsFloat+RMD.fieldbyname('lycpints').AsFloat)*interest+RMD.fieldbyname('cycpints').AsFloat+RMD.fieldbyname('lycpints').AsFloat ;

              RMD.AppendRecord([Flatcombobox4.Items[Flatcombobox1.ItemIndex],Flatcombobox1.Items[Flatcombobox1.ItemIndex],Flatcombobox2.Items[Flatcombobox1.ItemIndex],Fields[0].AsInteger,Fields[1].AsFloat,Fields[2].AsInteger,
                             formatfloat('0.00',Fields[3].AsFloat),Fields[4].AsFloat,formatfloat('0.00',lysum),formatfloat('0.00',lyints),Fields[7].asfloat,Fields[8].asfloat,
                             Fields[9].AsFloat,Fields[10].asfloat,Fields[11].Asfloat,Fields[12].asfloat,Fields[13].asfloat,Fields[14].asfloat,Fields[15].asfloat,
                             Fields[16].asfloat,Fields[17].asfloat,Fields[18].asfloat,formatfloat('0.0000',interest),formatfloat('0.00',lycycpints),formatfloat('0.00',lycycpints)])


            end;
            next;
          end;
        RMD.EnableControls ;
        {close;
        Params.Clear ;
        sql.Clear ; //年份, 当年缴费工资总额,当年缴费总月数,月平均缴费,本年利息,历年缴费月数,历年利息
        sql.Add('select A.yearno ,A.TTWAGE,A.MONTHS,A.TTWAGE/A.MONTHS,B.cycpints+B.cypsints ,B.lycpprin+B.lypsprin ,B.lycpints+B.lypsints ,');
        sql.Add('  B.siinter,B.lycycpints,B.lycypsints,B.lycpprin,B.lypsprin,B.lycpints,B.lypsints,cycpints,cypsints,B.cyrelycpfd+B.cyrelypsfd');
        sql.Add('  from sbdu_pswgcase A ,sbda_psagacct B');
        sql.Add('  where  A.psseno=B.psseno and A.Yearno=B.Yearno and A.psseno=:param');
        sql.Add('order by A.yearno');
        parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex];
        prepare;
        open;
        if Recordcount<1 then exit;
        RMD.open;
        RMD.DisableControls ;
        while not eof do
          begin
            if Fields[0].AsInteger<2002 then
            RMD.AppendRecord([Flatcombobox4.Items[Flatcombobox1.ItemIndex],Flatcombobox1.Items[Flatcombobox1.ItemIndex],Flatcombobox2.Items[Flatcombobox1.ItemIndex],Fields[0].AsInteger,Fields[1].AsFloat,Fields[2].AsInteger,
                             Fields[3].AsFloat,Fields[4].AsFloat,Fields[5].AsFloat,Fields[6].asfloat,Fields[7].asfloat,Fields[16].asfloat,Fields[8].asfloat,Fields[9].asfloat,fields[10].asfloat,
                             Fields[11].asfloat,Fields[12].asfloat,Fields[13].asfloat,Fields[14].asfloat,Fields[15].asfloat])
            else
            begin
              interest:=0;lysum:=0;lyints:=0; lycycpints:=0;lycypsints:=0;
              With DataShare_frm.Query6 do
                begin
                  close;
                  sql.Clear ;
                  sql.Add('select distinct SIINTER  from sbds_inancons where yearno=:param');
                  parambyname('param').AsInteger :=DataShare_frm.Query2.Fields[0].AsInteger ;
                  prepare;
                  open;
                  if recordcount>0 then interest:=Fields[0].AsFloat ;
                end;
              RMD.Last ;
              lysum:=RMD.fieldbyname('cyActual').AsFloat+RMD.fieldbyname('cyrely').AsFloat+RMD.fieldbyname('lysum').AsFloat ;
              //lyints:=(lysum+RMD.Fieldbyname('lyints').AsFloat+RMD.fieldbyname('cyints').AsFloat)*interest+RMD.fieldbyname('lyints').AsFloat+RMD.fieldbyname('cyints').AsFloat;
              lyints:=(RMD.fieldbyname('lycpprin').AsFloat+RMD.fieldbyname('lypsprin').AsFloat+RMD.fieldbyname('lycpints').AsFloat+RMD.fieldbyname('lypsints').AsFloat)*interest+
                       RMD.fieldbyname('cycpints').AsFloat+RMD.fieldbyname('cypsints').AsFloat+RMD.Fieldbyname('lycpints').AsFloat+RMD.fieldbyname('lypsints').AsFloat;

              lycycpints:=(RMD.fieldbyname('lypsprin').AsFloat+RMD.Fieldbyname('lypsints').AsFloat)*interest+RMD.fieldbyname('cypsints').AsFloat+RMD.fieldbyname('lypsints').AsFloat ;
              lycypsints:=(RMD.fieldbyname('lycpprin').AsFloat+RMD.fieldbyname('lycpints').AsFloat)*interest+RMD.fieldbyname('cycpints').AsFloat+RMD.fieldbyname('lycpints').AsFloat ;

              RMD.AppendRecord([Flatcombobox4.Items[Flatcombobox1.ItemIndex],Flatcombobox1.Items[Flatcombobox1.ItemIndex],Flatcombobox2.Items[Flatcombobox1.ItemIndex],Fields[0].AsInteger,Fields[1].AsFloat,Fields[2].AsInteger,
                             Fields[3].AsFloat,Fields[4].AsFloat,formatfloat('0.00',lysum),formatfloat('0.00',lyints),formatfloat('0.00',interest),Fields[16].asfloat,formatfloat('0.00',lycycpints),formatfloat('0.00',lycypsints),
                             Fields[9].AsFloat,Fields[10].AsFloat,Fields[11].AsFloat,Fields[12].AsFloat,Fields[13].AsFloat,Fields[14].AsFloat,Fields[15].asfloat]);
            end;
            next;
          end;
        RMD.EnableControls ; }
    end;
    with DataShare_frm.Query3 do
    begin
      close;
      sql.Clear ;
      sql.Add('select accpinup+acpswginup from sbda_psagacct where psseno=:param and yearno=2003');
      parambyname('param').AsString :=Flatcombobox2.Items[Flatcombobox1.itemindex];
      prepare;
      open;
      flatedit6.Text :=formatfloat('0.00',Fields[0].asfloat);
    end;

⌨️ 快捷键说明

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