📄 inv_dailymnout_c.pas
字号:
unit Inv_DailyMnOut_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, Db, AdODB, StdCtrls, ExtEdit, Mask, CheckLst;
Type
TFrm_Inv_DailyMnOut_C = Class(TFrm_Base_Condition)
ChLstBx_WhSelect: TCheckListBox;
Label1: TLabel;
ChBx_SelectAll: TCheckBox;
MEdt_Date_begin: TMaskEdit;
MEdt_Date_End: TMaskEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Lbl_DeptName: TLabel;
ExtEdt_DeptCode: TExtEdit;
procedure ChBx_SelectAllClick(Sender: TObject);
procedure btn_okClick(Sender: TObject);
procedure MEdt_Date_EndExit(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ChLstBx_WhSelectClickCheck(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_Inv_DailyMnOut_C: TFrm_Inv_DailyMnOut_C;
implementation
uses Sys_Global;
{$R *.DFM}
procedure TFrm_Inv_DailyMnOut_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_DailyMnOut_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:=Condition
+' And InvOutBill.InvBillDate Between '''+MEdt_Date_begin.Text+''''
+' And '''+MEdt_Date_End.Text+'''';
ConditionHint:=ConditionHint+'/日期从'+MEdt_Date_begin.Text+' 到'+MEdt_Date_End.Text;
if Extedt_DeptCode.text<>'' then
begin
Condition:=Condition+' And InvOutBill.DeptCode='''+ExtEdt_DeptCode.Text+'''';
ConditionHint:=ConditionHint+'/领料部门:'+ExtEdt_DeptCode.Text;
end;
Condition:='Select a.ItemCode'
+',a.ItemCode+'+''' '''+'+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+',a.InvBillQty'
+' From'
+' (Select InvOutBillLine.ItemCode'
+',Sum(IsNull(InvOutBillLine.InvBillQty,0)) As InvBillQty'
+' From InvOutBill,InvOutBillLine'
+' Where InvOutBill.BillTypeCode=''0201'''
+' And InvOutBill.InvBillWHChck=1'
+' And InvOutBill.WHCode in '+Condition
+' And InvOutBill.InvBillId=InvOutBillLine.InvBillId'
+' Group By InvOutBillLine.ItemCode) a'
+',Item,Uom'
+' Where a.ItemCode=Item.ItemCode'
+' And Item.UomCode=Uom.UomCode';
ModalResult:=mrOk;
end;
procedure TFrm_Inv_DailyMnOut_C.MEdt_Date_EndExit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
Exit;
DateCheck(Sender);
if MEdt_Date_End.Text<MEdt_Date_begin.Text then
begin
DispInfo('结束时间不能小于开始时间',3);
TWinControl(Sender).SetFocus;
Abort;
end;
end;
procedure TFrm_Inv_DailyMnOut_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;
MEdt_Date_begin.Text:=FormatDateTime('yyyy.mm.dd',IncMonth(Now,-1));
MEdt_Date_End.Text:=FormatDateTime('yyyy.mm.dd',Now);
end;
end;
procedure TFrm_Inv_DailyMnOut_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;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -