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

📄 invsetparams.~pas

📁 文件包含程序源原文件
💻 ~PAS
字号:
unit InvSetParams;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, InvDef, dpConst, Buttons;

type
  TfrmParams = class(TForm)
    Panel1: TPanel;
    grpOutPriceMode: TRadioGroup;
    rdgPrint: TRadioGroup;
    GrpCheck: TGroupBox;
    chkboxCheckQty: TCheckBox;
    GrpTune: TGroupBox;
    chkboxtuneQty: TCheckBox;
    Panel2: TPanel;
    Panel3: TPanel;
    grbDate: TGroupBox;
    lblDate1: TLabel;
    ckbDate: TCheckBox;
    edtDate1: TEdit;
    edtDate2: TEdit;
    rdoWarningdays: TRadioGroup;
    grpInPriceMode: TRadioGroup;
    grpbomcheck: TGroupBox;
    chkbomcheck: TCheckBox;
    btnOK: TBitBtn;
    btnCancel: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnOKClick(Sender: TObject);
    procedure btnCancelClick(Sender: TObject);
    procedure ckbDateClick(Sender: TObject);

    procedure edtDateEnter(Sender: TObject);
    procedure edtDateExit(Sender: TObject);
    procedure edtKeyPress(Sender: TObject; var Key: Char);

  private
    { Private declarations }
    Procedure ViewIniFileData;
    Procedure SetIniFileData;

    procedure SetMultilingual;
  public
    { Public declarations }

  end;

var
  frmParams: TfrmParams;
  InvIniData: TIniFileData;
  BUDate: string[10];
  InitFlg: Boolean;


implementation

uses Main, InvDM;

{$R *.dfm}

procedure TfrmParams.FormCreate(Sender: TObject);
begin
  Top    := frmMain.Height;
  Left   := 0;
  Width  := Width;
  Height := Height;

  InitFlg := true;
  SetMultilingual;
  ViewIniFileData;
  InitFlg := false;
end;

procedure TfrmParams.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  //SetIniFileData;
end;

procedure TfrmParams.ViewIniFileData;
var
  OutPriceMode: Integer;
  InPriceMode,i:  Integer;
begin
  InvIniData := frmMain.IniData;
  OutPriceMode := StrToIntDef(frmMain.IniData.OutPrice, -1);

  if not (OutPriceMode in[0,1,2,3]) then OutPriceMode := 0;
  grpOutPriceMode.ItemIndex := OutPriceMode;
  InPriceMode := StrToIntDef(frmMain.IniData.InPrice, -1);
  grpInPriceMode.ItemIndex := InPriceMode;

  if frmMain.IniData.isExcelPrint then rdgPrint.ItemIndex := 0
  else rdgPrint.ItemIndex := 1;
  if frmMain.IniData.isCheckQty then chkboxCheckQty.Checked := true
  else chkboxCheckQty.Checked := false;
  if frmMain.IniData.isTuneQty then chkboxtuneQty.Checked := true
  else chkboxtuneQty.Checked := false;
  if frmMain.IniData.is_bomcheck then chkbomcheck.Checked := true
  else chkbomcheck.Checked := false;

  ckbDate.Checked := ((frmMain.IniData.ListDate[0]='')and(frmMain.IniData.ListDate[1]=''));
  for i:=0 to 1 do with TEdit(FindComponent('edtDate'+IntToStr(i+1))) do
    Text := frmMain.IniData.ListDate[i];
  ckbDateClick(ckbDate);

  rdoWarningdays.ItemIndex  := frmMain.IniData.warningdays;
end;

procedure TfrmParams.SetIniFileData;
var i: integer;
    WDate: string[10];
begin
  InvIniData := frmMain.IniData;
  frmMain.IniData.OutPrice  := IntToStr(grpOutPriceMode.ItemIndex);
  frmMain.IniData.InPrice   := IntToStr(grpInPriceMode.ItemIndex);
  frmMain.IniData.isExcelPrint := (rdgPrint.ItemIndex = 0);
  frmMain.IniData.isCheckQty   := chkboxCheckQty.Checked;
  frmMain.IniData.isTuneQty    := chkboxtuneQty.Checked;
  frmMain.IniData.is_bomcheck  := chkbomcheck.Checked;

  if ckbDate.Checked then for i:=0 to 1 do InvIniData.ListDate[i] := ''
  else begin
    for i:=0 to 1 do
      InvIniData.ListDate[i] := TEdit(FindComponent('edtDate'+IntToStr(i+1))).Text;
    if ((InvIniData.ListDate[0]<>'')and(InvIniData.ListDate[1]<>''))and
        (InvIniData.ListDate[0] > InvIniData.ListDate[1]) then begin
      WDate           := InvIniData.ListDate[0];
      frmMain.IniData.ListDate[0] := InvIniData.ListDate[1];
      frmMain.IniData.ListDate[1] := WDate;
    end
    else begin
      frmMain.IniData.ListDate[0] := InvIniData.ListDate[0];
      frmMain.IniData.ListDate[1] := InvIniData.ListDate[1]
    end;
  end;

  frmMain.IniData.warningdays  := rdoWarningdays.ItemIndex;
  frmMain.FinalWriteIniData;
end;


procedure TfrmParams.btnOKClick(Sender: TObject);
begin
  SetIniFileData;
  Close;
end;

procedure TfrmParams.btnCancelClick(Sender: TObject);
begin
  Close;
end;

procedure TfrmParams.SetMultilingual;
begin
  self.Caption             := GetMultiLingalMsg(90180,'Configuration Setting');
  grpOutPriceMode.Caption  := GetMultiLingalMsg(90036,'Pirce Mode of Inventory Material');
  grpOutPriceMode.Items[0] := GetMultiLingalMsg(90037,'AVG Price');
  grpOutPriceMode.Items[1] := GetMultiLingalMsg(90038,'FILO');
  grpOutPriceMode.Items[2] := GetMultiLingalMsg(90039,'FIFO');
  grpOutPriceMode.Items[3] := GetMultiLingalMsg(90040,'Standard Price');

  rdgPrint.Caption         := GetMultiLingalMsg(90181,'Excel Startup Print Status');
  rdgPrint.Items[0]        := GetMultiLingalMsg(90182,'Print');
  rdgPrint.Items[1]        := GetMultiLingalMsg(90183,'Preview');

  GrpCheck.Caption         := GetMultiLingalMsg(90184,'Check Status');
  chkboxCheckQty.Caption   := GetMultiLingalMsg(90185,'Used Checked');

  GrpTune.Caption          := GetMultiLingalMsg(90186,'Tune Status');
  chkboxtuneQty.Caption    := GetMultiLingalMsg(90187,'Used Tune');

  grbDate.Caption          := GetMultiLingalMsg(90234,'Default Period Date');
  ckbDate.Caption          := GetMultiLingalMsg(90235,'None Used');

  rdoWarningdays.Caption  := GetMultiLingalMsg(90188,'Delivery Warning');
  rdoWarningdays.Items[0] := GetMultiLingalMsg(90191,'3 days');
  rdoWarningdays.Items[1] := GetMultiLingalMsg(90192,'7 days');
  rdoWarningdays.Items[2] := GetMultiLingalMsg(90193,'14 days');
  rdoWarningdays.Items[3] := GetMultiLingalMsg(90194,'None Used');

  grpInPriceMode.Caption  := GetMultiLingalMsg(90189,'Price Mode of Stock In');
  grpInPriceMode.Items[0] := GetMultiLingalMsg(90190,'Buy Price');
  grpInPriceMode.Items[1] := GetMultiLingalMsg(90040,'Standard Price');

  grpbomcheck.Caption      := GetMultiLingalMsg(90232,'Use BOM Check ');
  chkbomcheck.Caption      := GetMultiLingalMsg(90233,'Used BOM Check Status ');
end;

procedure TfrmParams.ckbDateClick(Sender: TObject);
begin
  edtDate1.Enabled := not(ckbDate.Checked);
  edtDate2.Enabled := not(ckbDate.Checked);
  lblDate1.Enabled := not(ckbDate.Checked);
  if InitFlg then Exit;
  if not(ckbDate.Checked) then edtDate1.SetFocus;
end;

//***-----------------***
procedure TfrmParams.edtDateEnter(Sender: TObject);
begin
  BUDate := TEdit(Sender).Text;
end;

//***---------***
procedure TfrmParams.edtDateExit(Sender: TObject);
var WDate: TDateTime;
begin
  if not(dm_inventory.DateProc((Sender as TEdit), WDate)) then begin
    TEdit(Sender).Text := BUDate;
    TEdit(Sender).SetFocus;
    TEdit(Sender).SelectAll;
    Exit;
  end;
end;

//***----------------***
procedure TfrmParams.edtKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then begin
    Key := #0;
    SelectNext(ActiveControl, GetAsyncKeyState(VK_SHIFT)>=0, True);
  end;
end;

end.

⌨️ 快捷键说明

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