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

📄 sfc_wipinv_c.pas

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

Interface

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

Type
  TFrm_Sfc_WipInv_C = Class(TFrm_Base_Condition)
    Label1: TLabel;
    Label2: TLabel;
    CmBx_DeptCode: TComboBox;
    MEdt_Month: TMaskEdit;
    procedure FormActivate(Sender: TObject);
    procedure CmBx_DeptCodeChange(Sender: TObject);
    procedure btn_okClick(Sender: TObject);
  private
    { Private declarations }
    ItemType:string;
  public
    { Public declarations }
     procedure initform(Param1:string);
  end;

var
  Frm_Sfc_WipInv_C: TFrm_Sfc_WipInv_C;

implementation

uses Sys_Global;

{$R *.DFM}

procedure TFrm_Sfc_WipInv_C.FormActivate(Sender: TObject);
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;
    CmBx_DeptCodeChange(CmBx_DeptCode);
  end;
end;

procedure TFrm_Sfc_WipInv_C.CmBx_DeptCodeChange(Sender: TObject);
begin
  inherited;
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:='Select InvStatus'
    +' From InvStatus'
    +' Where InvStatusName=''wipInv'''
    +' And WHCode='''+GetCode(CmBx_DeptCode.Text)+'''';
  AdoQry_Tmp.Open;
  if AdoQry_Tmp.fieldbyname('InvStatus').AsString='' then
    MEdt_Month.Text:=FormatDateTime('yyyy.mm',Now)
  else
    MEdt_Month.Text:=FormatDateTime('yyyy.mm',IncMonth(StrToDateTime(
      AdoQry_Tmp.fieldbyname('InvStatus').AsString+'.01'),1));
end;

procedure TFrm_Sfc_WipInv_C.btn_okClick(Sender: TObject);
begin
  inherited;
  Condition:='WipInv.DeptCode='''+GetCode(CmBx_DeptCode.Text)+''''
    +' And WipInv.WipInvMonth='''+MEdt_Month.Text+'''';
  if ItemType='z01' then
     Condition:=Condition+' and wipInv.ItemType=0 ';
  if ItemType='z02' then
     Condition:=Condition+' and wipInv.ItemType=1 ';
  if ItemType='z03' then
     Condition:=Condition+' and wipInv.ItemType=2 ';
  if ItemType='p01' then
     Condition:=Condition+' and wipInv.ItemType=3 ';
  if ItemType='p02' then
     Condition:=Condition+' and wipInv.ItemType=4 ';
  ConditionHint:='部门:'+CmBx_DeptCode.Text+'/月份:'+MEdt_Month.Text;

  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:='Select InvStatus'
    +' From InvStatus'
    +' Where InvStatusName=''wipInv'''
    +' And WHCode='''+GetCode(CmBx_DeptCode.Text)+'''';
  AdoQry_Tmp.Open;
  if AdoQry_Tmp.fieldbyname('InvStatus').AsString<>'' then
  begin
    if MEdt_Month.Text<=AdoQry_Tmp.fieldbyname('InvStatus').AsString then
      FatherForm.SetFormParam(CmBx_DeptCode.Text,MEdt_Month.Text,'ReadOnly','','','')
    else
      FatherForm.SetFormParam(CmBx_DeptCode.Text,MEdt_Month.Text,'','','','');
  end
  else
    FatherForm.SetFormParam(CmBx_DeptCode.Text,MEdt_Month.Text,'','','','');
  ModalResult:=mrOk;
end;

procedure TFrm_Sfc_WipInv_C.initform(Param1:string);
begin
  ItemType:=Param1;
end;

end.

⌨️ 快捷键说明

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