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

📄 salary_impl.pas

📁 Delphi6分布式开发例程7 )
💻 PAS
字号:
unit salary_impl;

{This file was generated on 16 Sep 2001 10:46:29 GMT by version 03.03.03.C1.A1}
{of the Inprise VisiBroker idl2pas CORBA IDL compiler.                        }

{Please do not edit the contents of this file. You should instead edit and    }
{recompile the original IDL which was located in the file                     }
{E:\corba\Salary.idl.                                                         }

{Delphi Pascal unit      : salary_impl                                      }
{derived from IDL module : salary                                           }



interface

uses
  SysUtils,
  CORBA,
  salary_i,
  salary_c;

type
  TITaxCal = class;
  TTaxCalFactory = class;

  TITaxCal = class(TInterfacedObject, salary_i.ITaxCal)
  protected
    {******************************}
    {*** User variables go here ***}
    {******************************}
  public
    OriSalary : Single; //声明全局变量OriSalary为从客户程序传送来的个人总收入
    constructor Create;
    procedure SetSalary ( const x : Single);
    function  GetTax : Single;
    function  GetMySalary : Single;
  end;

  TTaxCalFactory = class(TInterfacedObject, salary_i.TaxCalFactory)
  protected
    {******************************}
    {*** User variables go here ***}
    {******************************}
  public
    constructor Create;
    function  CreateInstance ( const InstanceName : AnsiString): salary_i.ITaxCal;
  end;


implementation

uses ServerUnit1;

constructor TITaxCal.Create;
begin
  inherited;
  { *************************** }
  { *** User code goes here *** }
  { *************************** }
end;

procedure TITaxCal.SetSalary ( const x : Single);
begin
  //设置个人总薪水
  OriSalary := x;
  //信息输出
  Form1.Memo1.Lines.Append('客户程序向CORBA服务器传送了个人总薪水!');
end;

function  TITaxCal.GetTax : Single;
begin
//根据不同的薪水等级计算税率
  if OriSalary <= 1000 then
    Result := 0
  else
    begin
     if (OriSalary > 1000) and (OriSalary <= 3000) then
       Result := (OriSalary-1000) * 0.1 - 25
     else
       begin
         if (OriSalary > 3000) and (OriSalary <= 5000) then
           Result := (OriSalary-1000) * 0.15 - 125
         else
           begin
             if (OriSalary >5000) and (OriSalary <= 1000) then
                Result := (OriSalary-1000) * 0.20 - 325
             else
               Result := (OriSalary-1000) * 0.25 - 575;
           end;
       end;
    end;
  //信息输出
  Form1.Memo1.Lines.Append('客户程序调用了计算应该纳税额函数!');
end;

function  TITaxCal.GetMySalary : Single;
begin
  //计算净收入
  Result := OriSalary - GetTax;
  //显示信息
  Form1.Memo1.Lines.Append('客户程序调用了计算净收入函数!');
end;

constructor TTaxCalFactory.Create;
begin
  inherited;
  { *************************** }
  { *** User code goes here *** }
  { *************************** }
end;

function  TTaxCalFactory.CreateInstance ( const InstanceName : AnsiString): salary_i.ITaxCal;
begin
  { *************************** }
  { *** User code goes here *** }
  { *************************** }
end;


initialization


end.

⌨️ 快捷键说明

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