ar_qry_chginfoeachinvoiceh_c.pas

来自「一个MRPII系统源代码版本」· PAS 代码 · 共 154 行

PAS
154
字号
unit Ar_Qry_ChgInfoEachInvoiceH_C;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Condition, Db, AdODB, StdCtrls, Mask, ExtEdit;

Type
  TFrm_Ar_Qry_ChgInfoEachInvoiceH_C = Class(TFrm_Base_Condition)
    Label2: TLabel;
    Label3: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Edt_Operator1: TExtEdit;
    Edt_Operator2: TExtEdit;
    Medt_Date1: TMaskEdit;
    Medt_Date2: TMaskEdit;
    procedure btn_okClick(Sender: TObject);
    procedure Edt_Customer1Exit(Sender: TObject);
    procedure Edt_Operator1Exit(Sender: TObject);
    procedure Edt_Operator2Exit(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    procedure CheckCustomer(Extedt:TExtedit);
    procedure CheckEmployee(Extedt:TExtedit);
  public
    { Public declarations }
  end;

var
  Frm_Ar_Qry_ChgInfoEachInvoiceH_C: TFrm_Ar_Qry_ChgInfoEachInvoiceH_C;

implementation

{$R *.DFM}

procedure TFrm_Ar_Qry_ChgInfoEachInvoiceH_C.btn_okClick(Sender: TObject);
begin
  inherited;
  condition:=' 1=1 ';
  if Trim(Edt_Operator1.Text)<>'' then
    condition:=condition+' and Sa_EachInvoiceHistory.ChgEmployeeCode>='+Quotedstr(Edt_Operator1.Text);
  if Trim(Edt_Operator2.Text)<>'ZZZZ' then
    condition:=condition+' and Sa_EachInvoiceHistory.ChgEmployeeCode<='+Quotedstr(Edt_Operator2.Text);
  condition:=condition+' and  Sa_EachInvoiceHistory.ChgTime>='+Quotedstr(Medt_Date1.Text)+' and Sa_EachInvoiceHistory.ChgTime<='+Quotedstr(Medt_Date2.Text);

  conditionHint:='操作员代码从:'+Edt_Operator1.Text+'到:'+Edt_Operator2.Text+
                  '/操作日期从:'+Medt_Date1.Text+'到:'+Medt_Date2.Text;
  Self.ModalResult := mrok;
end;

procedure TFrm_Ar_Qry_ChgInfoEachInvoiceH_C.CheckCustomer(
  Extedt:TExtedit);
var
  S:String;
begin
  with AdoQry_tmp do
  begin
    if Extedt.Text<>''  then
    begin
      if Extedt.Text='ZZZZ' then exit
      else
      begin
        S:=' select CUSTOMERCode from CUSTOMER where CUSTOMERCode='+
            Quotedstr(Extedt.Text);
        Close;
        SQL.clear;
        SQL.Add(S);
        Open;
        if IsEmpty then
        begin
          Application.MessageBox('代码错误!','信息提示',MB_OK+MB_IconWArNING);
          Extedt.SetFocus;
          Abort;
        end;
     end;
    end
    else
     exit;
  end;
end;

procedure TFrm_Ar_Qry_ChgInfoEachInvoiceH_C.CheckEmployee(
  Extedt:TExtedit);
var
  S:String;
begin
  with AdoQry_tmp do
  begin
    if Extedt.Text<>'' then
    begin
      if Extedt.Text='ZZZZ' then exit
      else
      begin
        S:=' select EmployeeCode from Employee where EmployeeCode='+
            Quotedstr(Extedt.Text);
        Close;
        SQL.clear;
        SQL.Add(S);
        Open;
        if IsEmpty then
        begin
          Application.MessageBox('代码错误!','信息提示',MB_OK+MB_IconWArNING);
          Extedt.SetFocus;
          Abort;
        end;
      end;
    end
    else
      exit;
  end;
end;


procedure TFrm_Ar_Qry_ChgInfoEachInvoiceH_C.Edt_Customer1Exit(
  Sender: TObject);
begin
  inherited;
//  CheckCustomer(Edt_Customer1);
end;

procedure TFrm_Ar_Qry_ChgInfoEachInvoiceH_C.Edt_Operator1Exit(
  Sender: TObject);
begin
  inherited;
  CheckEmployee(Edt_Operator1);
end;

procedure TFrm_Ar_Qry_ChgInfoEachInvoiceH_C.Edt_Operator2Exit(
  Sender: TObject);
begin
  inherited;
  if Edt_Operator2.Text='' then
  begin
    Application.MessageBox('代码错误!','信息提示',MB_OK+MB_IconWArNING);
    Edt_Operator2.SetFocus;
    Abort;
  end;
  
  CheckEmployee(Edt_Operator2);
end;

procedure TFrm_Ar_Qry_ChgInfoEachInvoiceH_C.FormShow(Sender: TObject);
begin
  inherited;
  Medt_Date1.Text := FormatDateTime('yyyy.mm.dd', date()-30);
  Medt_Date2.Text  := FormatDateTime('yyyy.mm.dd',date());
  Edt_Operator1.SetFocus;
end;

end.

⌨️ 快捷键说明

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