📄 sfc_qry_mounitmnrequestauditing.pas
字号:
unit Sfc_Qry_MoUnitMnRequestAuditing;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Body, ExtPrintReport, Db, ActnList, DBClient, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, jpeg, Mask, ExtEdit, AdODB, Buttons,
pr_PrintReportType;
Type
TFrm_Sfc_Qry_MoUnitMnRequestAuditing = Class(TFrm_Base_Entry_Body)
Label1: TLabel;
cmbbx_WhCode: TComboBox;
Label3: TLabel;
Edt_Dept: TExtEdit;
Label12: TLabel;
edt_memo: TExtEdit;
cmbbx_Shift: TComboBox;
Label5: TLabel;
Label2: TLabel;
cmbbx_WhPositionCode: TComboBox;
Label7: TLabel;
cmbbx_WhEmployee: TComboBox;
Label4: TLabel;
edt_Billno: TExtEdit;
medt_Date: TMaskEdit;
Label6: TLabel;
Button2: TButton;
Button1: TButton;
procedure TlBtn_ExcelClick(Sender: TObject);
procedure Act_PreviewExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure InitControls; Override;
end;
var
Frm_Sfc_Qry_MoUnitMnRequestAuditing: TFrm_Sfc_Qry_MoUnitMnRequestAuditing;
MONO:string;
implementation
uses Sys_Global,Sfc_MnOut_NotSave_P,Inv_Global;
{$R *.DFM}
{ TFrm_Sfc_Qry_MoUnitMnRequestAuditing }
procedure TFrm_Sfc_Qry_MoUnitMnRequestAuditing.InitControls;
begin
inherited;
TlBtn_Excel.Visible:=True;
TlBtn_Excel.Enabled:=True;
Button1.Enabled:=True;
Button2.Enabled:=True;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='select InvOutBill.MONO,InvOutBill.InvBillNo,InvOutBill.DeptCode+'' ''+Dept.DeptName DeptCodeName,InvOutBill.InvBillDate,'+
'InvOutBill.WHCode+'' ''+Warehouse.WHName WHCodeName,InvOutBill.WhPositionCode+'' ''+WhPosition.WhPositionName WHPCodeName,'+
'InvOutBill.WH_EmployeeCode2+'' ''+Employee.EmployeeName EmpCodeName,InvOutBill.ShiftType,InvOutBill.RemArk '+
'from InvOutBill left join Dept on Dept.DeptCode=InvOutBill.DeptCode '+
'left join Warehouse on Warehouse.WHCode=InvOutBill.WHCode '+
'left join WhPosition on Warehouse.WHCode=WhPosition.WHCode and WhPosition.WhPositionCode=InvOutBill.WhPositionCode '+
'left join Employee on Employee.EmployeeCode=InvOutBill.WH_EmployeeCode2 '+
'where InvOutBill.InvBillId='''+ AdoQry_Head.fieldbyname('InvBillId').asstring+'''';
AdoQry_Tmp.Open;
cmbbx_WhCode.Items.clear;
cmbbx_WhCode.Items.Add(AdoQry_Tmp.fieldbyname('WHCodeName').AsString);
cmbbx_WhCode.ItemIndex:=0;
cmbbx_WhPositionCode.Items.clear;
cmbbx_WhPositionCode.Items.Add(AdoQry_Tmp.fieldbyname('WHPCodeName').AsString);
cmbbx_WhPositionCode.ItemIndex:=0;
cmbbx_WhEmployee.Items.clear;
cmbbx_WhEmployee.Items.Add(AdoQry_Tmp.fieldbyname('EmpCodeName').AsString);
cmbbx_WhEmployee.ItemIndex:=0;
cmbbx_Shift.Items.clear;
cmbbx_Shift.Items.Add(AdoQry_Tmp.fieldbyname('ShiftType').AsString);
cmbbx_Shift.ItemIndex:=0;
edt_Billno.Text:=AdoQry_Tmp.fieldbyname('InvBillNo').AsString;
Edt_Dept.Text:=AdoQry_Tmp.fieldbyname('DeptCodeName').AsString;
medt_Date.Text:=AdoQry_Tmp.fieldbyname('InvBillDate').AsString;
edt_memo.Text:=AdoQry_Tmp.fieldbyname('RemArk').AsString;
AdoQry_Body.Close;
AdoQry_Body.SQL.Text:='Select InvOutBillLine.MoNo,InvOutBillLine.MoLineNo,InvOutBillLine.ItemCode,Item.ItemName,Uom.UomName,sum(InvOutBillLine.InvBillSfcQty) as InvBillSfcQty,'+
'sum(MNItemList.MoRealQty) as MoRealQty,InvOutBillLine.BatchNo,InvOutBillLine.BillLineRemArk '+
'From InvOutBillLine left join Item on Item.ItemCode=InvOutBillLine.ItemCode '+
'left join Uom on Item.UomCode=Uom.UomCode '+
'left join MNItemList On InvOutBillLine.MoNo=MNItemList.MoNo And '+
'InvOutBillLine.MoLineNo=MNItemList.MoLineNo and '+
'InvOutBillLine.ItemCode=MNItemList.ItemCode '+
'Where InvOutBillLine.InvBillId='''+AdoQry_Head.fieldbyname('InvBillId').AsString+''' '+
'group by InvOutBillLine.MoNo,InvOutBillLine.MoLineNo,InvOutBillLine.ItemCode,Item.ItemName,Uom.UomName,InvOutBillLine.BatchNo,InvOutBillLine.BillLineRemArk '+
'Order by InvOutBillLine.MoNo,InvOutBillLine.MoLineNo,InvOutBillLine.ItemCode';
AdoQry_Body.Open;
end;
procedure TFrm_Sfc_Qry_MoUnitMnRequestAuditing.TlBtn_ExcelClick(
Sender: TObject);
begin
inherited;
DBGridEhToExcel(DBGridEh);
end;
procedure TFrm_Sfc_Qry_MoUnitMnRequestAuditing.Act_PreviewExecute(
Sender: TObject);
var
CK,BM:string;
HW,BB:string;
i:integer;
begin
CK:=cmbbx_WhCode.Text;
BM:=Edt_Dept.Text;
HW:=cmbbx_WhPositionCode.Text;
BB:=cmbbx_Shift.Text;
if length(cmbbx_WhCode.Text)>length(Edt_Dept.Text) then
for i:=1 to length(cmbbx_WhCode.Text)-length(Edt_Dept.Text) do
BM:=BM+' ';
if length(cmbbx_WhCode.Text)<length(Edt_Dept.Text) then
for i:=1 to length(Edt_Dept.Text)-length(cmbbx_WhCode.Text) do
CK:=CK+' ';
if length(cmbbx_WhPositionCode.Text)>length(cmbbx_Shift.Text) then
for i:=1 to length(cmbbx_WhPositionCode.Text)-length(cmbbx_Shift.Text) do
BB:=BB+' ';
if length(cmbbx_WhPositionCode.Text)<length(cmbbx_Shift.Text) then
for i:=1 to length(cmbbx_Shift.Text)-length(cmbbx_WhPositionCode.Text) do
HW:=HW+' ';
ExtPrintReport.Subtitle2:='仓 库:'+CK+' 货位:'+HW+' 仓管员:'+cmbbx_WhEmployee.Text+' 单据号:'+edt_Billno.Text;
ExtPrintReport.Subtitle3:='领料部门:'+BM+' 班别:'+BB+' 日 期:'+medt_Date.Text;
ExtPrintReport.Subtitle4:='备 注:'+ edt_memo.Text;
inherited;
ExtPrintReport.Subtitle2:='';
ExtPrintReport.Subtitle3:='';
ExtPrintReport.Subtitle4:='';
end;
procedure TFrm_Sfc_Qry_MoUnitMnRequestAuditing.Act_PrintExecute(
Sender: TObject);
var
CK,BM:string;
HW,BB:string;
i:integer;
begin
CK:=cmbbx_WhCode.Text;
BM:=Edt_Dept.Text;
HW:=cmbbx_WhPositionCode.Text;
BB:=cmbbx_Shift.Text;
if length(cmbbx_WhCode.Text)>length(Edt_Dept.Text) then
for i:=1 to length(cmbbx_WhCode.Text)-length(Edt_Dept.Text) do
BM:=BM+' ';
if length(cmbbx_WhCode.Text)<length(Edt_Dept.Text) then
for i:=1 to length(Edt_Dept.Text)-length(cmbbx_WhCode.Text) do
CK:=CK+' ';
if length(cmbbx_WhPositionCode.Text)>length(cmbbx_Shift.Text) then
for i:=1 to length(cmbbx_WhPositionCode.Text)-length(cmbbx_Shift.Text) do
BB:=BB+' ';
if length(cmbbx_WhPositionCode.Text)<length(cmbbx_Shift.Text) then
for i:=1 to length(cmbbx_Shift.Text)-length(cmbbx_WhPositionCode.Text) do
HW:=HW+' ';
ExtPrintReport.Subtitle2:='仓 库:'+CK+' 货位:'+HW+' 仓管员:'+cmbbx_WhEmployee.Text+' 单据号:'+edt_Billno.Text;
ExtPrintReport.Subtitle3:='领料部门:'+BM+' 班别:'+BB+' 日 期:'+medt_Date.Text;
ExtPrintReport.Subtitle4:='备 注:'+ edt_memo.Text;
inherited;
ExtPrintReport.Subtitle2:='';
ExtPrintReport.Subtitle3:='';
ExtPrintReport.Subtitle4:='';
end;
procedure TFrm_Sfc_Qry_MoUnitMnRequestAuditing.Button2Click(
Sender: TObject);
var SqlText : String;
TmpAdoQry : TAdoQuery;
TmpAdoQry1 : TAdoQuery;
begin
inherited;
TmpAdoQry := TAdoQuery.Create(self);
TmpAdoQry.Connection := Dbconnect;
TmpAdoQry.EnableBCD := False;
TmpAdoQry1 := TAdoQuery.Create(self);
TmpAdoQry1.Connection := Dbconnect;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -