sfc_mninbilllistqry_c.pas

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

PAS
107
字号
unit Sfc_MnInBillListQry_C;

Interface

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

Type
  TFrm_Sfc_MnInBillListQry_C = Class(TFrm_Base_Condition)
    Label3: TLabel;
    cmbbx_Shift: TComboBox;
    Label2: TLabel;
    Label1: TLabel;
    MEdt_StArtDate: TMaskEdit;
    MEdt_EndDate: TMaskEdit;
    Label4: TLabel;
    CmBx_DeptCode: TComboBox;
    procedure btn_okClick(Sender: TObject);
    procedure MEdt_EndDateExit(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure SetDBConnect(AdOConnection:TAdOConnection); Override ;
  end;

var
  Frm_Sfc_MnInBillListQry_C: TFrm_Sfc_MnInBillListQry_C;

implementation

uses Sys_Global;

{$R *.DFM}

procedure TFrm_Sfc_MnInBillListQry_C.SetDBConnect(AdOConnection:TAdOConnection);
var
  DeptCode:String;
begin
  inherited;
  if CmBx_DeptCode.Items.Count=0 then
  begin
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.Text:='Select DeptCode From Employee'
      +' Where EmployeeCode='''+UserCode+'''';
    AdoQry_Tmp.Open;
    DeptCode:=AdoQry_Tmp.fieldbyname('DeptCode').AsString;
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.Text:='Select DeptCode+'' ''+DeptName As DeptCodeName'
      +' From Dept'
      +' Where DeptCode Like '''+DeptCode+'%''';
    AdoQry_Tmp.Open;
    while not AdoQry_Tmp.Eof do
    begin
      CmBx_DeptCode.Items.Add(AdoQry_Tmp.fieldbyname('DeptCodeName').AsString);
      AdoQry_Tmp.Next;
    end;
    CmBx_DeptCode.ItemIndex:=0;
    InitShiftCmBx(AdoQry_Tmp,cmbbx_Shift,True);
    cmbbx_Shift.Items.Insert(0,'全部');
    cmbbx_Shift.ItemIndex:=0;
  end;
end;

procedure TFrm_Sfc_MnInBillListQry_C.btn_okClick(Sender: TObject);
begin
  inherited;
  if cmbbx_Shift.Text='全部' then
    Condition:='InvInBill.InvBillDate>='''+MEdt_StArtDate.Text+''''
      +' And InvInBill.InvBillDate<='''+MEdt_EndDate.Text+''''
      +' And InvInBill.DeptCode='''+GetCode(CmBx_DeptCode.Text)+''''
  else
    Condition:='InvInBill.InvBillDate>='''+MEdt_StArtDate.Text+''''
      +' And InvInBill.InvBillDate<='''+MEdt_EndDate.Text+''''
      +' And InvInBill.DeptCode='''+GetCode(CmBx_DeptCode.Text)+''''
      +' And InvInBill.ShiftType='''+cmbbx_Shift.Text+'''';
  ConditionHint:='日期: '+MEdt_StArtDate.Text+' '+MEdt_EndDate.Text
    +'/生产部门: '+CmBx_DeptCode.Text
    +'/班别: '+cmbbx_Shift.Text;
  ModalResult:=mrOk;
end;

procedure TFrm_Sfc_MnInBillListQry_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_Sfc_MnInBillListQry_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;

end.

⌨️ 快捷键说明

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