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

📄 inv_opdiffbilllistqry_c.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Inv_OpDiffBillListQry_C;

Interface

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

Type
  TFrm_Inv_OpDiffBillListQry_C = Class(TFrm_Base_Condition)
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    MEdt_StArtDate: TMaskEdit;
    MEdt_EndDate: TMaskEdit;
    Edt_StArtNo: TEdit;
    Edt_EndNo: TEdit;
    ExtEdt_VendorCode: TExtEdit;
    Lbl_DeptName: TLabel;
    ExtEdt_ItemCode: TExtEdit;
    Lbl_ItemName: TLabel;
    Edt_PoNo: TEdit;
    Edt_PoLineNo: TEdit;
    lbl_Employee: TLabel;
    Label1: TLabel;
    ChLstBx_WhSelect: TCheckListBox;
    ChBx_SelectAll: TCheckBox;
    procedure btn_okClick(Sender: TObject);
    procedure MEdt_EndDateExit(Sender: TObject);
    procedure Edt_PoNoExit(Sender: TObject);
    procedure Edt_EndNoExit(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ChLstBx_WhSelectClickCheck(Sender: TObject);
    procedure ChBx_SelectAllClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frm_Inv_OpDiffBillListQry_C: TFrm_Inv_OpDiffBillListQry_C;

implementation

uses Sys_Global;

{$R *.DFM}

procedure TFrm_Inv_OpDiffBillListQry_C.btn_okClick(Sender: TObject);
var
  i:Integer;
begin
  inherited;
  Condition:='';
  for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
  begin
    if ChLstBx_WhSelect.Checked[i] then
    begin
      if Condition='' then
      begin
        Condition:='('''+GetCode(ChLstBx_WhSelect.Items.Strings[i])+'''';
        ConditionHint:='仓库:'+GetName(ChLstBx_WhSelect.Items.Strings[i]);
      end
      else
      begin
        Condition:=Condition+','''+GetCode(ChLstBx_WhSelect.Items.Strings[i])+'''';
        ConditionHint:=ConditionHint+'.'+GetName(ChLstBx_WhSelect.Items.Strings[i]);
      end;
    end;
  end;
  {Condition:=Condition+')';
  Condition:=' InvInBill.WHCode In'+Condition;

  Condition:=Condition+' And InvInBill.InvBillDate>='''+MEdt_StArtDate.Text+''''
    +' And InvInBill.InvBillDate<='''+MEdt_EndDate.Text+'''';}
  if pos('(',Condition)<>0 then
   Condition:=Condition+')';
  if Condition<>'' then
  begin
    Condition:=' InvInBill.WHCode In'+Condition;
    Condition:=Condition+' And InvInBill.InvBillDate>='''+MEdt_StArtDate.Text+'''';
  end
  else
    Condition:=Condition+' InvInBill.InvBillDate>='''+MEdt_StArtDate.Text+'''';
  Condition:=Condition+' And InvInBill.InvBillDate<='''+MEdt_EndDate.Text+'''';    
  ConditionHint:=ConditionHint+'/日期:从'+MEdt_StArtDate.Text+' 到'+MEdt_EndDate.Text;
  if (Edt_StArtNo.Text<>'')and(Edt_EndNo.Text='') then
  begin
    Condition:=Condition+' And InvInBill.InvBillNo='''+Edt_StArtNo.Text+'''';
    ConditionHint:=ConditionHint+'/单号:'+Edt_StArtNo.Text;
  end
  else if(Edt_EndNo.Text<>'')then
  begin
    Condition:=Condition+' And InvInBill.InvBillNo<='''+Edt_EndNo.Text+''''
      +' And InvInBill.InvBillNo>='''+Edt_StArtNo.Text+'''';
    ConditionHint:=ConditionHint+'/单号从'+Edt_StArtNo.Text+' 到'+Edt_EndNo.Text;
  end;
  if(ExtEdt_VendorCode.Text<>'')then
  begin
    Condition:=Condition+' And InvInBill.VendorCode Like '''+ExtEdt_VendorCode.Text+'%''';
    ConditionHint:=ConditionHint+'/供应商:'+ExtEdt_VendorCode.Text;
  end;
  if(ExtEdt_ItemCode.Text<>'')then
  begin
    Condition:=Condition+' And InvInBillLine.ItemCode Like '''+ExtEdt_ItemCode.Text+'%''';
    ConditionHint:=ConditionHint+'/物料代码:'+ExtEdt_ItemCode.Text;
  end;
  if(Edt_PoNo.Text<>'')then
  begin
    Condition:=Condition+' And InvInBill.PoNo='''+Edt_PoNo.Text+'''';
    ConditionHint:=ConditionHint+'/采购订单号:'+Edt_PoNo.Text;
  end;
  if (Edt_PoLineNo.Text<>'')then
  begin
    Condition:=Condition+' And InvInBillLine.PoLineNo='''+Edt_PoLineNo.Text+'''';
    ConditionHint:=ConditionHint+'/采购订单行号:'+Edt_PoLineNo.Text;
  end;
  ModalResult:=mrOk;
end;

procedure TFrm_Inv_OpDiffBillListQry_C.MEdt_EndDateExit(Sender: TObject);
begin
  inherited;
  if ActiveControl.Name='btn_Cancel' then
    Exit;
  DateCheck(Sender);
  if StrToDateTime(MEdt_EndDate.Text)<StrToDateTime(MEdt_StArtDate.Text) then
  begin
    DispInfo('结束时间不能小于开始时间',3);
    TWinControl(Sender).SetFocus;
    Abort;
  end;
end;

procedure TFrm_Inv_OpDiffBillListQry_C.Edt_PoNoExit(Sender: TObject);
begin
  inherited;
  if Edt_PoNo.Text='' then
    Edt_PoLineNo.Text:='';
end;

procedure TFrm_Inv_OpDiffBillListQry_C.Edt_EndNoExit(Sender: TObject);
begin
  inherited;
  if ActiveControl.Name='btn_Cancel' then
    Exit;
  if (Edt_StArtNo.Text='')and(Edt_EndNo.Text<>'') then
  begin
    DispInfo('请先填入起始单据号!',1);
    Edt_StArtNo.SetFocus;
  end;
end;

procedure TFrm_Inv_OpDiffBillListQry_C.FormCreate(Sender: TObject);
begin
  inherited;
  MEdt_StArtDate.Text:=FormatDateTime('yyyy.mm.dd',IncMonth(Now,-1));
  MEdt_EndDate.Text:=FormatDateTime('yyyy.mm.dd',Now);
end;

procedure TFrm_Inv_OpDiffBillListQry_C.ChLstBx_WhSelectClickCheck(
  Sender: TObject);
var
  i:Integer;
begin
  inherited;
  btn_ok.Enabled:=False;
  for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
  begin
    if ChLstBx_WhSelect.Checked[i] then
      btn_ok.Enabled:=True;
  end;
end;

procedure TFrm_Inv_OpDiffBillListQry_C.ChBx_SelectAllClick(
  Sender: TObject);
var
  i:integer;
begin
  inherited;
  if ChBx_SelectAll.Checked then
  begin
    for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
    begin
      ChLstBx_WhSelect.Checked[i]:=True;
    end;
    btn_ok.Enabled:=True;
  end
  else
  begin
    for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
    begin
      ChLstBx_WhSelect.Checked[i]:=False;
    end;
    btn_ok.Enabled:=False;
  end;
end;

procedure TFrm_Inv_OpDiffBillListQry_C.FormActivate(Sender: TObject);
begin
  inherited;
  if ChLstBx_WhSelect.Items.Count=0 then
  begin
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.Text:='Select Warehouse.WHCode+'' ''+Warehouse.WHName As CodeName'
      +' From Warehouse'
      +' Join WHAccessCtrl On Warehouse.WHCode=WHAccessCtrl.WHCode'
      +' Where WHAccessCtrl.EmployeeCode='''+UserCode+'''';
    AdoQry_Tmp.Open;
    ChLstBx_WhSelect.clear;
    AdoQry_Tmp.First;
    while not AdoQry_Tmp.Eof do
    begin
      ChLstBx_WhSelect.Items.Add(AdoQry_Tmp.fieldbyname('CodeName').AsString);
      AdoQry_Tmp.Next;
    end;
  end;
end;

end.

⌨️ 快捷键说明

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