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

📄 pay550_06.pas.svn-base

📁 这是一个功能齐全的,代码完整的ERP企业信息管理系统,现在上传和大家分享
💻 SVN-BASE
字号:
unit Pay550_06;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Bas100_01, StdCtrls, ExtCtrls, Buttons, ComCtrls, Db, ADODB, Menus;

type
  TPay550_06Form = class(TBas100_01Form)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    ComboBox1: TComboBox;
    Label3: TLabel;
    Edit2: TEdit;
    Label4: TLabel;
    Bevel1: TBevel;
    bbtnOk: TBitBtn;
    bbtnExit: TBitBtn;
    Edit3: TEdit;
    UpDown1: TUpDown;
    CheckBox1: TCheckBox;
    ComboBox2: TComboBox;
    Label5: TLabel;
    ComboBox3: TComboBox;
    qryPay150: TADOQuery;
    ADOQuery1: TADOQuery;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure bbtnOkClick(Sender: TObject);
    procedure bbtnExitClick(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure ComboBox3Change(Sender: TObject);
  private
    TYPNO,FLG01,FLG02,TYP01:Integer;
    procedure SetInterface;
    { Private declarations }
  public
    YEARS,MONTH:Integer;
    { Public declarations }
  end;

var
  Pay550_06Form: TPay550_06Form;

implementation

uses CommFun, SYSDATA;

{$R *.DFM}

procedure TPay550_06Form.SetInterface;
begin
{  Caption:=GetDBString(20500);  //薪资划分
  Label1.Caption:=GetDBString(20501);  //金额大于
  Label2.Caption:=GetDBString(20502);  //元
  RadioButton1.Caption:=GetDBString(20503);  //按比例划分(所有薪资项目)
  RadioButton2.Caption:=GetDBString(20504);  //按薪资项目划分
  Label3.Caption:=GetDBString(20505);  //金额大于
  Label4.Caption:=GetDBString(20506);  //元的部分划分出去
  bbtnOk.Caption:=GetDBString(20507);  //确定(&O)
  bbtnExit.Caption:=GetDBString(20508);  //退出(&X)
  CheckBox1.Caption:=GetDBString(20513);  //保留至
  Label5.Caption:=GetDBString(20514);  //数不划分  }
end;

//薪资划分
{  @I_YEARS	int,			--年份
  @I_MONTH	int,			--月份
  @I_AMOUT	float,			--金额
  @I_FLG01	char(1),		--'1'=按比例划分,'2'=按项目划分
  @I_PER01	int,			--百分比
  @I_TYPNO	int,			--薪资项目
  @I_AMT01	float,			--金额
  @I_FLG02	char(1),		--'Y','N'      AFlg02  (1,0)
  @I_KEP01	int,			--0=个位,1=十位,2=百位,3=千位
  @I_TYP01	int,			--
}
procedure SP_PAY551(AYear,AMonth:Integer;AAmount:Double;AFlag,APer,ATypeNo:Integer;AAmt01:Double;AFlg02,ARount,AType:Integer);
var
  P550_001:Integer; 			//薪资年份(1900-2100)
  P550_002:Integer;			//薪资月份(1-12)
  P550_003:Integer;			//员工编号
  P550_004:string;			//员工姓名
  P550_005:Integer;			//薪资项目
  P550_006:Double;			//项目金额
  P550_007:string;			//已审核否('Y','N')
  TOT01:Double;
begin
  if AYear=0 then
  begin
    ShowMsg('年份不能为空');
    Abort;
  end;

  ExecSQL('delete PAY551 where P551_001='+IntToStr(AYear)+' and P551_002='+IntToStr(AMonth));

  SYSDM.qryQuery.Close;
  SYSDM.qryQuery.SQL.Clear;
  SYSDM.qryQuery.SQL.Add('select P550_001,P550_002,P550_003,P550_004,P550_005,P550_006,P550_007 from PAY550');
  SYSDM.qryQuery.SQL.Add('where P550_001='+IntToStr(AYear)+' and P550_002='+IntToStr(AMonth)+' and P550_005='+IntToStr(ATypeNo)+' and P550_006>='+FloatToStr(AAmount));
  SYSDM.qryQuery.Open;
  while not SYSDM.qryQuery.Eof do
  begin
    P550_001:=SYSDM.qryQuery.FieldByName('P550_001').Value;
    P550_002:=SYSDM.qryQuery.FieldByName('P550_002').Value;
    P550_003:=SYSDM.qryQuery.FieldByName('P550_003').Value;
    P550_004:=SYSDM.qryQuery.FieldByName('P550_004').Value;
    P550_005:=SYSDM.qryQuery.FieldByName('P550_005').Value;
    P550_006:=SYSDM.qryQuery.FieldByName('P550_006').Value;
    P550_007:=SYSDM.qryQuery.FieldByName('P550_007').Value;
    //1=按比例划分,
    if AFlag=1 then
    begin
      TOT01:=APer*P550_006;
      if AFlg02=1 then
      begin
        case ARount of
          0:TOT01:=GetValue('select round(TOT01,0)');    //1=个位
          1:TOT01:=GetValue('select round(TOT01,-1)');   //2=十位
          2:TOT01:=GetValue('select round(TOT01,-2)');   //3=百位
          3:TOT01:=GetValue('select round(TOT01,-3)');   //4=千位
        end;
      end;


      Pay550_06Form.ADOQuery1.Close;
      Pay550_06Form.ADOQuery1.SQL.Clear;
      Pay550_06Form.ADOQuery1.SQL.Add('insert into PAY551(P551_001,P551_002,P551_003,P551_004,P551_005,P551_006,P551_007)');
      Pay550_06Form.ADOQuery1.SQL.Add('select '+IntToStr(P550_001)+', '+IntToStr(P550_002)+', '+IntToStr(P550_003)+', '+P550_004+', '+IntToStr(P550_005)+', '+FloatToStr(TOT01)+', '+P550_007);
      Pay550_06Form.ADOQuery1.ExecSQL;

      SYSDM.qryQuery.Edit;
      SYSDM.qryQuery.FieldByName('P550_006').Value:=SYSDM.qryQuery.FieldByName('P550_006').Value-TOT01;
      SYSDM.qryQuery.Post;
    end;
    //2=按项目划分
    if (AFlag=2) and (ATypeNo=P550_005) then
    begin
      TOT01:=P550_006-AAmount;
      if AFlg02=1 then
      begin
        case ARount of
          0:TOT01:=GetValue('select round(TOT01,0)');  //1=个位
          1:TOT01:=GetValue('select round(TOT01,-1)');  //2=十位
          2:TOT01:=GetValue('select round(TOT01,-2)');  //3=百位
          3:TOT01:=GetValue('select round(TOT01,-3)');  //4=千位
        end;
      end;

      Pay550_06Form.ADOQuery1.Close;
      Pay550_06Form.ADOQuery1.SQL.Clear;
      Pay550_06Form.ADOQuery1.SQL.Add('insert into PAY551(P551_001,P551_002,P551_003,P551_004,P551_005,P551_006,P551_007)');
      Pay550_06Form.ADOQuery1.SQL.Add('select '+IntToStr(P550_001)+', '+IntToStr(P550_002)+', '+IntToStr(P550_003)+', '+P550_004+', '+IntToStr(P550_005)+', '+FloatToStr(TOT01)+', '+P550_007);
      Pay550_06Form.ADOQuery1.ExecSQL;

      SYSDM.qryQuery.Edit;
      SYSDM.qryQuery.FieldByName('P550_006').Value:=SYSDM.qryQuery.FieldByName('P550_006').Value-TOT01;
      SYSDM.qryQuery.Post;
    end;
    SYSDM.qryQuery.Next;
  end;
end;

procedure TPay550_06Form.FormCreate(Sender: TObject);
begin
  inherited;
  //设置界面信息
  SetInterface;
  
  ComboBox2.Items.Clear;
  ComboBox2.Items.Add('个位');
  ComboBox2.Items.Add('十位');
  ComboBox2.Items.Add('百位');
  ComboBox2.Items.Add('千位');
  ComboBox2.ItemIndex:=0;
  
  ComboBox1.Items.Clear;
  ComboBox3.Items.Clear;
  qryPay150.Close;
  qryPay150.Open;
  while not qryPay150.Eof do
  begin
    ComboBox1.Items.Add(qryPay150.FieldByName('P150_003').AsString);
    ComboBox3.Items.Add(qryPay150.FieldByName('P150_003').AsString);
    qryPay150.Next;
  end;
  ComboBox1.ItemIndex:=0;
  ComboBox3.ItemIndex:=0;
end;

procedure TPay550_06Form.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
//
end;

procedure TPay550_06Form.bbtnOkClick(Sender: TObject);
var
  AYear,AMonth:Integer;
  AAmount:Double;
  AFlag,APer,ATypeNo:Integer;
  AAmt01:Double;
  AFlg02,ARount,AType:Integer;
begin
  inherited;
//确定
  AYear:=YEARS;
  AMonth:=MONTH;
  AAmount:=StrToFloat(Edit1.Text);
  AFlag:=FLG01;
  APer:=StrToInt(Edit3.Text);
  ATypeNo:=TYPNO;
  AAmt01:=StrToFloat(Edit2.Text);
  AFlg02:=FLG02;
  ARount:=ComboBox2.ItemIndex;
  AType:=TYP01;
  SP_PAY551(AYear,AMonth,AAmount,AFlag,APer,ATypeNo,AAmt01,AFlg02,ARount,AType);
end;

procedure TPay550_06Form.bbtnExitClick(Sender: TObject);
begin
  inherited;
//退出
  Close;
end;

procedure TPay550_06Form.ComboBox1Change(Sender: TObject);
begin
  inherited;
  qryPay150.Locate('P150_003',ComboBox1.Text,[loCaseInsensitive]);
  TYPNO:=qryPay150.FieldByName('P150_001').Value;
end;

procedure TPay550_06Form.RadioButton1Click(Sender: TObject);
begin
  inherited;
  if RadioButton1.Checked then
  begin
    Edit3.Enabled:=True;
    Edit3.Color:=clWhite;
    UpDown1.Enabled:=True;
    FLG01:=1  //'1'=按比例划分,'2'=按项目划分
  end else
  begin
    Edit3.Enabled:=False;
    Edit3.Color:=clSilver;
    UpDown1.Enabled:=False;
  end;
end;

procedure TPay550_06Form.RadioButton2Click(Sender: TObject);
begin
  inherited;
  if RadioButton2.Checked then
  begin
    ComboBox1.Enabled:=True;
    ComboBox1.Color:=clWhite;
    Edit2.Enabled:=True;
    Edit2.Color:=clWhite;
    FLG01:=2  //'1'=按比例划分,'2'=按项目划分
  end else
  begin
    ComboBox1.Enabled:=False;
    ComboBox1.Color:=clSilver;
    Edit2.Enabled:=False;
    Edit2.Color:=clSilver;
  end;
end;

procedure TPay550_06Form.CheckBox1Click(Sender: TObject);
begin
  inherited;
  if CheckBox1.Checked then
  begin
    ComboBox2.Enabled:=True;
    ComboBox2.Color:=clWhite;
    FLG02:=1;
  end else
  begin
    ComboBox2.Enabled:=False;
    ComboBox2.Color:=clSilver;
    FLG02:=0;
  end;
end;

procedure TPay550_06Form.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  ValidInteger(Sender,Key);
end;

procedure TPay550_06Form.ComboBox3Change(Sender: TObject);
begin
  inherited;
  qryPay150.Locate('P150_003',ComboBox1.Text,[loCaseInsensitive]);
  TYP01:=qryPay150.FieldByName('P150_001').Value;
end;

initialization
  RegisterClass(TPay550_06Form);

finalization
  UnRegisterClass(TPay550_06Form);

end.

⌨️ 快捷键说明

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