📄 inv_whpmovebilllistqry_c.pas
字号:
unit Inv_WhPMoveBillListQry_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, StdCtrls, Db, AdODB, CheckLst, ExtEdit, Mask;
Type
TFrm_Inv_WhPMoveBillListQry_C = Class(TFrm_Base_Condition)
ChLstBx_WhSelect: TCheckListBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label8: TLabel;
Label9: TLabel;
Label12: TLabel;
MEdt_StArtDate: TMaskEdit;
MEdt_EndDate: TMaskEdit;
Edt_StArtNo: TEdit;
Edt_EndNo: TEdit;
Lbl_DeptName: TLabel;
ExtEdt_ItemCode: TExtEdit;
Lbl_ItemName: TLabel;
Edt_StArtAmount: TEdit;
Edt_EndAmount: TEdit;
Lbl_Out: TLabel;
Lbl_in: TLabel;
CmBx_WhPositionCode: TComboBox;
CmBx_OWhPositionCode: TComboBox;
procedure btn_okClick(Sender: TObject);
procedure ChLstBx_WhSelectClickCheck(Sender: TObject);
procedure MEdt_EndDateExit(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Edt_EndNoExit(Sender: TObject);
procedure Edt_EndAmountExit(Sender: TObject);
procedure ChLstBx_WhSelectClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
procedure InitCmbxWHPostion(CmBxWhPosition: TComboBox);
{ Private declarations }
public
BillTypeCode:string;
{ Public declarations }
end;
var
Frm_Inv_WhPMoveBillListQry_C: TFrm_Inv_WhPMoveBillListQry_C;
implementation
uses Sys_Global;
{$R *.DFM}
procedure TFrm_Inv_WhPMoveBillListQry_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:=' InvOutBill.WHCode In'+Condition;
i:=ChLstBx_WhSelect.Itemindex;
if CmBx_WhPositionCode.text<>''then
Condition:=Condition+' and InvOutBill.WhPositionCode='+''''+GetCode(CmBx_WhPositionCode.Text)+'''';
if CmBx_OWhPositionCode.text<>''then
Condition:=Condition+' and InvOutBill.OWhPositionCode='+''''+GetCode(CmBx_OWhPositionCode.Text)+'''';
Condition:=Condition+' And InvOutBill.InvBillDate>='''+MEdt_StArtDate.Text+'''';
Condition:=Condition+' And InvOutBill.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 InvOutBill.InvBillNo='''+Edt_StArtNo.Text+'''';
ConditionHint:=ConditionHint+' 单号:等于 '+Edt_StArtNo.Text;
end
Else if(Edt_EndNo.Text<>'')then
begin
ConditionHint:=ConditionHint+' 单号从 '+Edt_StArtNo.Text+' 到 '+Edt_EndNo.Text;
Condition:=Condition+' And InvOutBill.InvBillNo<='''+Edt_EndNo.Text+''''+
' And InvOutBill.InvBillNo>='''+Edt_StArtNo.Text+'''';
end;
if(ExtEdt_ItemCode.Text<>'')then
begin
Condition:=Condition+' And InvOutBillLine.ItemCode like '''+ExtEdt_ItemCode.Text+'%''';
ConditionHint:=ConditionHint+' 物料代码: '+ExtEdt_ItemCode.Text;
end;
if (Edt_StArtAmount.Text<>'') and (Edt_EndAmount.Text='')then
begin
Condition:=Condition+' And InvOutBillLine.InvBillQty='+Edt_StArtAmount.Text;
ConditionHint:=ConditionHint+' 数量:等于 '+Edt_StArtAmount.Text;
end
Else if (Edt_EndAmount.Text<>'') then
begin
Condition:=Condition+' And InvOutBillLine.InvBillQty<='+Edt_EndAmount.Text+
' And InvOutBillLine.InvBillQty>='+Edt_StArtAmount.Text;
ConditionHint:=ConditionHint+'数量从'+Edt_StArtAmount.Text+' 到 '+Edt_EndAmount.Text
end;
ModalResult:=mrOk;
end;
procedure TFrm_Inv_WhPMoveBillListQry_C.ChLstBx_WhSelectClickCheck(
Sender: TObject);
var
i:Integer;
begin
inherited;
btn_ok.Enabled:=False;
lbl_Out.Enabled:=False;
lbl_in.Enabled:=False;
CmBx_OWhPositionCode.Enabled :=False;
CmBx_OWhPositionCode.Text :='';
CmBx_WhPositionCode.Enabled :=False;
CmBx_WhPositionCode.Text :='';
for i:=0 to ChLstBx_WhSelect.Items.Count-1 do
begin
if ChLstBx_WhSelect.Checked[i] then
begin
btn_ok.Enabled:=True ;
lbl_Out.Enabled:=True;
CmBx_OWhPositionCode.Enabled :=True;
lbl_in.Enabled:=True;
CmBx_WhPositionCode.Enabled :=True;
InitCmbxWHPostion(CmBx_WhPositionCode);
InitCmbxWHPostion(CmBx_OWhPositionCode);
break;
end;
end;
end;
procedure TFrm_Inv_WhPMoveBillListQry_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_WhPMoveBillListQry_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_WhPMoveBillListQry_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_WhPMoveBillListQry_C.Edt_EndAmountExit(
Sender: TObject);
begin
inherited;
ConditionFloatCheck(sender);
If ActiveControl.Name='Btn_Cancel' then
Exit;
If (Edt_StArtAmount.Text='') and (Edt_EndAmount.text<>'') then
begin
DispInfo('请先填入起始数量!',1);
Edt_StArtAmount.SetFocus;
end;
end;
procedure TFrm_Inv_WhPMoveBillListQry_C.ChLstBx_WhSelectClick(
Sender: TObject);
var
I,J:Integer;
begin
inherited;
J:=ChLstBx_WhSelect.ItemIndex;
For I:=0 To ChLstBx_WhSelect.Items.Count-1 do
begin
if I<>j Then
ChLstBx_WhSelect.Checked[i]:=False;
end;
end;
procedure TFrm_Inv_WhPMoveBillListQry_C.InitCmbxWHPostion(
CmBxWhPosition: TComboBox);
var
i:integer;
whCode:string;
begin
i:=ChLstBx_WhSelect.Itemindex;
whCode:=''''+GetCode(ChLstBx_WhSelect.Items.Strings[i])+'''';
CmBxWhPosition.clear ;
CmBxWhPosition.Items.Add('');
with AdoQry_Tmp do
begin
Close;
SQL.clear;
SQL.Text:='select WhPositionCode,WhPositionName From WhPosition '
+'where WHCode='+whCode+' Order by WhPositionCode ';
Open;
First;
while not Eof do
begin
CmBxWhPosition.Items.Add(fieldbyname('WhPositionCode').AsString+' '+fieldbyname('WhPositionName').AsString);
AdoQry_Tmp.Next;
end;
end;
CmBxWhPosition.ItemIndex:=0;
end;
procedure TFrm_Inv_WhPMoveBillListQry_C.FormActivate(Sender: TObject);
begin
inherited;
if ChLstBx_WhSelect.Items.Count=0 then
with AdoQry_Tmp do
begin
Close;
SQL.Text:='Select Warehouse.WHCode+'' ''+Warehouse.WHName As CodeName'
+' From Warehouse Join WHAccessCtrl On Warehouse.WHCode=WHAccessCtrl.WHCode'
+' Where WHAccessCtrl.EmployeeCode='''+UserCode+'''';
Open;
ChLstBx_WhSelect.clear;
First;
while not Eof do
begin
ChLstBx_WhSelect.Items.Add(fieldbyname('CodeName').AsString);
AdoQry_Tmp.Next;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -