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

📄 c_jfdefine.pas

📁 酒店管理系统 酒店管理系统 酒店管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit C_JfDefine;

interface
uses SysUtils, DateUtils;

const
  BufLen = 80;

  SNDH   = '市内电话';

  DHFL_SH = 1;//市话
  DHFL_NH = 2;//农话
  DHFL_GN = 3;//国内长途
  DHFL_GJ = 4;//国际长途

  //系统配置文件
  INI_FILENAME = 'LFHOTEL.ini';

type
  TComBuf = array[0..BufLen-1] of Char;
  TBasicFmt = record
    Room : string;
    SDate: string;
    STime: string;
    Last : string;
    Number: string;
  end;
  TFee = record
    STime: TDateTime;
    FTime: TDateTime;
    AddiFee: Currency;
    AddiFee0: Currency;
    Xxtf: Currency;
    Svc: Double;
    Svc0: Currency;
    Gn: Currency;
    Gj: Currency;
    Nh: Currency;
    Wxf: Currency;
    Yzf: Currency;
    ShFee: Currency;
    ShUnit: Double;
    ShFee0: Currency;
    ShUnit0: Double;
    NhFee: Currency;
    NhUnit: Double;
    GnFee: Currency;
    GnUnit: Double;
    GjFee: Currency;
    GjUnit: Double;
    GatFee: Currency;
    GatUnit: Double;
    GnFeeYh: Currency;
    GnYhUnit: Double;
    GjFeeYh: Currency;
    GjYhUnit: Double;
  end;

  TCodeInfo = record
    APlace: string;
    AFee: Currency;
    AUnit: Double;
    JFYN: Boolean;
    NHYN: Boolean;
    DHFL: Integer;
  end;

  TNewData = record
    AClass: string;
    Room : string;
    Place: string;
    Number: string;
    SDate: TDateTime;
    STime: TDateTime;
    Last : Double;
    AUnit: Currency;
    Fee  : Currency;
    AddiFee: Currency;
    SvcFee: Currency;
    Total: Currency;
    Flty: Integer;
  end;

var
  ComBuf  : TComBuf;
  BasBuf  : TComBuf;
  BasicFmt: TBasicFmt;
  NewData : TNewData;
  IsWrite : Boolean;
  Fee     : TFee;
  CodeInfo: TCodeInfo;
  PORTNUM : Integer;
  APP_DIR : string;
  
function FindData: Integer;
function MoveData: Boolean;
procedure ReadData;
procedure WriteData;
procedure MainWork;
function CaculateLast(const ALast: string): Double;
function GetNewData: TNewData;
procedure WriteNewData(ANewData: TNewData);
procedure ShowNewData(ANewData: TNewData);
procedure InitFee;
procedure GetCodeInfo(const ANumber: string);
function FindCode(const ANumber: string): Boolean;
function FindShCode(const ANumber: string): Boolean;
function GetDate(const s: string): TDateTime;
function GetTime(const s: string): TDateTime;
function IsYh(ATime: TDateTime): Boolean;


implementation

uses C_JfMain, C_JfData;

function IsYh(ATime: TDateTime): Boolean;
begin
  Result := False;
  if (ATime>Fee.STime)or(ATime<Fee.FTime) then
    Result := True;
end;

function GetTime(const s: string): TDateTime;
var
  hh,nn: Word;
begin
  hh := StrToInt(Copy(s,1,2));
  nn := StrToInt(Copy(s,4,2));
  Result := EnCodeTime(hh,nn,0,0);
end;

function GetDate(const s: string): TDateTime;
var
  MM,DD: Word;
begin
  MM := StrToInt(Copy(s,1,2));
  DD := StrToInt(Copy(s,4,2));
  Result := EnCodeDate(YearOf(Now),MM,DD);
end;

function FindCode(const ANumber: string): Boolean;
var
  i,l: Integer;
  s: string;
begin
  Result := False;
  l := Length(ANumber);
  for i:=1 to l do
  begin
    s := Copy(ANumber,1,i);
    if JfData.tblFare.Locate('CODE',s,[]) then
    begin
      Result := True;
      Break;
    end;
  end;
end;

function FindShCode(const ANumber: string): Boolean;
var
  i,l: Integer;
  s: string;
begin
  Result := False;
  l := Length(ANumber);
  for i:=1 to l do
  begin
    s := Copy(ANumber,1,i);
    if JfData.tblShfare.Locate('CODE',s,[]) then
    begin
      Result := True;
      Break;
    end;
  end;
end;

procedure GetCodeInfo(const ANumber: string);
var
  ANum,s1,s2: string;
begin
  s1 := Copy(ANumber,1,1);
  s2 := Copy(ANumber,2,1);
  ANum := Copy(ANumber,1,6);
  if s1<>'0' then
  begin
    if JfData.tblShfare.Locate('CODE',ANum,[]) then
    begin
      CodeInfo.APlace := SNDH;
      CodeInfo.AFee := JfData.tblShfare.FieldByName('UNIT').AsCurrency;
      CodeInfo.AUnit:= JfData.tblShfare.FieldByName('PRICE').AsFloat;
      CodeInfo.JFYN := JfData.tblShfare.FieldByName('JFYN').AsBoolean;
      CodeInfo.NHYN := JfData.tblShfare.FieldByName('NHYN').AsBoolean;
      if CodeInfo.NHYN then
        CodeInfo.DHFL := DHFL_NH
      else
        CodeInfo.DHFL := DHFL_SH;
    end
    else
    begin
      if FindShCode(ANum) then
      begin
        CodeInfo.JFYN := JfData.tblShfare.FieldByName('JFYN').AsBoolean;
        CodeInfo.NHYN := JfData.tblShfare.FieldByName('NHYN').AsBoolean;
      end
      else
      begin
        CodeInfo.JFYN := True;
        CodeInfo.NHYN := False;
      end;
      CodeInfo.APlace := SNDH;
      if CodeInfo.NHYN then
      begin
        CodeInfo.AFee := Fee.NhFee;
        CodeInfo.AUnit:= Fee.NhUnit;
        CodeInfo.DHFL := DHFL_NH;
      end
      else
      begin
        CodeInfo.AFee := Fee.ShFee;
        CodeInfo.AUnit:= Fee.ShUnit;
        CodeInfo.DHFL := DHFL_SH;
      end;
    end;
  end
  else
  begin
    if s2<>'0' then
    begin
      if FindCode(ANum) then
        CodeInfo.APlace := JfData.tblFare.FieldByName('PLACE').AsString
      else
        CodeInfo.APlace := '未知地区';
      CodeInfo.AFee := Fee.GnFee;
      CodeInfo.AUnit:= Fee.GnUnit;
      CodeInfo.JFYN := True;
      CodeInfo.NHYN := False;
      CodeInfo.DHFL := DHFL_GN;
    end
    else
    begin
      if FindCode(ANum) then
        CodeInfo.APlace := JfData.tblFare.FieldByName('PLACE').AsString
      else
        CodeInfo.APlace := '未知地区';
      CodeInfo.AFee := Fee.GjFee;
      CodeInfo.AUnit:= Fee.GjUnit;
      CodeInfo.JFYN := True;
      CodeInfo.NHYN := False;
      CodeInfo.DHFL := DHFL_GJ;
    end;
  end;
end;

procedure InitFee;
begin
  with JfData.tblJfConfig do
  begin
    Open;
    First;
    Fee.STime := FieldByName('STime').AsDateTime;
    Fee.FTime := FieldByName('FTime').AsDateTime;
    Fee.AddiFee := FieldByName('AddiFee').AsCurrency;
    Fee.AddiFee0 := FieldByName('AddiFee0').AsCurrency;
    Fee.Xxtf := FieldByName('Xxtf').AsCurrency;
    Fee.Svc := FieldByName('Svc').AsFloat;
    Fee.Svc0 := FieldByName('Svc0').AsCurrency;
    Fee.Gn := FieldByName('Gn').AsCurrency;
    Fee.Gj := FieldByName('Gj').AsCurrency;
    Fee.Nh := FieldByName('Nh').AsCurrency;
    Fee.Wxf := FieldByName('Wxf').AsCurrency;
    Fee.Yzf := FieldByName('Yzf').AsCurrency;
    Fee.ShFee := FieldByName('ShFee').AsCurrency;
    Fee.ShUnit:= FieldByName('ShUnit').AsFloat;
    Fee.ShFee0 := FieldByName('ShFee0').AsCurrency;
    Fee.ShUnit0 := FieldByName('ShUnit0').AsFloat;
    Fee.NhFee := FieldByName('NhFee').AsCurrency;
    Fee.NhUnit := FieldByName('NhUnit').AsFloat;
    Fee.GnFee := FieldByName('GnFee').AsCurrency;

⌨️ 快捷键说明

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