📄 wageinfo_unit.~pas
字号:
unit wageinfo_unit;
interface
uses
Windows,Messages,SysUtils,Variants,DBclient,Graphics,Classes,persondatamod_unit;
type
Twageinfo=class(TObject)
private
Datamod:TPerson_datamod;
public
function WageInfoRec(Id,GiveDate:string):Boolean;
function WageInfoRec1(FindSQL:string):Boolean;
function GetRecId(Id,GiveDate:string):string;
function GetWorkerName(Id,GiveDate:string):string;
function GetBaseWage(Id,GiveDate:string):string;
function GetAllowance1(Id,GiveDate:string):string;
function GetAllowance2(Id,GiveDate:string):string;
function GetReward(Id,GiveDate:string):string;
function GetOverTimeMoney(Id,GiveDate:string):string;
function GetDeductCheck(Id,GiveDate:string):string;
function GetAgedMoney(Id,GiveDate:string):string;
function GetMedicalMoney(Id,GiveDate:string):string;
function GetCompoMoney(Id,GiveDate:string):string;
function GetUnemployMoney(Id,GiveDate:string):string;
function GetHouseMoney(Id,GiveDate:string):string;
function GetIncomeTax(Id,GiveDate:string):string;
function GetRealWage(Id,GiveDate:string):string;
function WagesRecs(SQL:string):OLEVariant;
procedure RecInsert(InsertSQl:string);
procedure RecUpdate(UpdateSQl:string);
procedure RecDel(Id,GiveDate:string);
constructor create;
destructor Destroy;override;
end;
implementation
constructor Twageinfo.create ;
begin
Datamod:=TPerson_datamod.Create(nil);
end;
destructor Twageinfo.Destroy;
begin
freeandnil(Datamod);
inherited;
end;
function Twageinfo.WageInfoRec(Id,GiveDate:string):Boolean;
begin
Datamod.Person_adoq2.Close;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add(' select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open ;
if Datamod.Person_adoq2.Eof then result:=false
else result:=true;
end;
function Twageinfo.WageInfoRec1(FindSQL:string):Boolean;
begin
Datamod.Person_adoq2.Close;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add(FindSQL);
Datamod.Person_adoq2.Open ;
if Datamod.Person_adoq2.Eof then result:=false
else result:=true;
end;
function Twageinfo.GetRecId(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open ;
result:=Datamod.Person_adoq2.fieldbyname('record_id').AsString;
end;
function Twageinfo.GetWorkerName(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open ;
result:=Datamod.Person_adoq2.fieldbyname('worker_name').AsString;
end;
function Twageinfo.GetBaseWage(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add(' select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open ;
result:=Datamod.Person_adoq2.FieldValues['base_wage'];
end;
function Twageinfo.GetAllowance1(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open ;
result:=Datamod.Person_adoq2.FieldValues['allowance1'];
end;
function Twageinfo.GetAllowance2(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open ;
result:=Datamod.Person_adoq2.FieldValues['allowance2'];
end;
function Twageinfo.GetReward (Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues['reward'];
end;
function Twageinfo.GetOverTimeMoney(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues['overtime_money'];
end;
function Twageinfo.GetDeductCheck (Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues['deduct_check'];
end;
function Twageinfo.GetAgedMoney(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues ['aged_money'];
end;
function Twageinfo.GetMedicalMoney(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues ['medical_money'];
end;
function Twageinfo.GetCompoMoney (Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues['compo_money'];
end;
function Twageinfo.GetUnemployMoney(Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues ['unemploy_money'];
end;
function Twageinfo.GetHouseMoney (Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues['housing_money'];
end;
function Twageinfo.GetIncomeTax (Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues ['income_tax'];
end;
function Twageinfo.GetRealWage (Id,GiveDate:string):string;
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('select * from wage_info where '
+'worker_id='''+Id+''' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.Open;
result:=Datamod.Person_adoq2.FieldValues ['Real_wage'];
end;
function Twageinfo.WagesRecs(SQL:string):OLEVariant;
begin
Datamod.Person_adoq1.Close ;
Datamod.Person_adoq1.SQL.Clear;
Datamod.Person_adoq1.SQL.Add(SQL);
Datamod.Person_adoq1.Open ;
result:=Datamod.Person_dsp1.Data;
end;
procedure Twageinfo.RecInsert(InsertSQL:string);
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add(InsertSQL);
Datamod.Person_adoq2.ExecSQL;
end;
procedure Twageinfo.RecUpdate(UpdateSQL:string);
begin
Datamod.Person_adoq2.Close;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add(UpdateSQL);
Datamod.Person_adoq2.ExecSQL;
end;
procedure Twageinfo.RecDel(Id,GiveDate:string);
begin
Datamod.Person_adoq2.Close ;
Datamod.Person_adoq2.SQL.Clear;
Datamod.Person_adoq2.SQL.Add('delete from check_info where worker_id='''+Id+''' '
+' and give_date='''+GiveDate+'''');
Datamod.Person_adoq2.ExecSQL;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -