📄 inv_mninbilllistqry.pas
字号:
unit Inv_MnInBillListQry;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls;
Type
TFrm_Inv_MnInBillListQry = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
AdoQry_MainInvBillDate: TDateTimeField;
AdoQry_MainInvBillNo: TStringField;
AdoQry_MainDeptCodeName: TStringField;
AdoQry_MainMONo: TStringField;
AdoQry_MainMoLineNo: TIntegerField;
AdoQry_MainUomName: TStringField;
AdoQry_MainInvBillQty: TFloatField;
AdoQry_MainInvBillNoTaxPrice: TFloatField;
AdoQry_MainInvBillNoTaxAmount: TFloatField;
AdoQry_MainBatchNo: TStringField;
AdoQry_MainWHCode: TStringField;
AdoQry_MainInvBillSfcQty: TFloatField;
AdoQry_MainshiftType: TStringField;
AdoQry_MainItemFlag: TStringField;
AdoQry_MainwhFlag: TStringField;
AdoQry_MainWhPosition: TStringField;
AdoQry_MainSfc_EmployeeCodeName: TStringField;
AdoQry_MainWH_EmployeeCodeName: TStringField;
AdoQry_MaInBillLineRemArk: TStringField;
AdoQry_MainIsOverPlan: TIntegerField;
procedure Act_LookExecute(Sender: TObject);
procedure DBGridEhDblClick(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
private
{ Private declarations }
FShowExtendColum:BooLean;
procedure SendDataToForm;
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
end;
var
Frm_Inv_MnInBillListQry: TFrm_Inv_MnInBillListQry;
implementation
uses Inv_MnInBillListQry_C,Sys_Global,Inv_MnInBillQry, Inv_BillListPrint_C,
Inv_Global;
{$R *.DFM}
procedure TFrm_Inv_MnInBillListQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
inherited;
FShowExtendColum:=ShowExtendColumn;
if(not ShowExtendColumn)then
begin
DBGridEh.Columns.Delete(13);
DBGridEh.Columns.Delete(12);
end
else
begin
PriceFields:='InvBillNoTaxPrice,';
AmountFields:='InvBillNoTaxAmount,';
end;
SelectFromSQL:='Select distinct InvInBill.InvBillDate,'+
'InvInBill.InvBillNo,'+ //单据号
'InvInBill.DeptCode+'' ''+Dept.DeptName As DeptCodeName,'+
'InvInBill.MONo,'+
'InvInBill.shiftType,'+
'InvInBillLine.MoLineNo,'+
'InvInBill.whCode+'' ''+Warehouse.whName whFlag,'+
'InvInBill.WhPositionCode+'' ''+WhPosition.WhPositionName WhPosition,'+
' Warehouse.whCode,'+//仓库代码
'InvInBillLine.ItemCode+'' ''+Item.ItemName ItemFlag,'+
'Uom.UomName,'+
'InvInBill.OverPlan isOverPlan, '+//是否超订单
'InvInBillLine.InvBillSfcQty,'+
'InvInBillLine.InvBillQty,'+
'StandardPrice.SPPrice As InvBillNoTaxPrice,'+
'StandardPrice.SPPrice*InvInBillLine.InvBillQty As InvBillNoTaxAmount,'+
'InvInBill.Sfc_EmployeeCode+'' ''+Employee1.EmployeeName As Sfc_EmployeeCodeName,'+
'InvInBill.WH_EmployeeCode+'' ''+Employee2.EmployeeName As WH_EmployeeCodeName,'+
'InvInBillLine.BatchNo,InvInBill.Sfc_EmployeeCode, '+
'InvInBillLine.BillLineRemArk '+
'From InvInBillLine '+
'Join InvInBill on InvInBillLine.InvBillId=InvInBill.InvBillId '+
' And (InvInBill.BillTypeCode='''+Param1+''')'+
'left join StandardPrice on InvInBill.InvBillMonth=StandardPrice.spstArtMonth '+
' and InvInBillline.ItemCode=StandardPrice.ItemCode '+
'Left Outer Join Item On InvInBillLine.ItemCode=Item.ItemCode '+
'Left Outer Join Uom On Item.UomCode=Uom.UomCode '+
'Left Outer Join Dept On InvInBill.DeptCode=Dept.DeptCode '+
'Left Outer Join Employee Employee1 On InvInBill.Sfc_EmployeeCode=Employee1.EmployeeCode '+
'left outer join Warehouse on InvInBill.whCode=Warehouse.whCode '+
'Left outer Join WhPosition on WhPosition.WhPositionCode=InvInBill.WhPositionCode and WhPosition.whCode=InvInBill.whCode '+
'Left outer Join Employee Employee2 on InvInBill.Wh_EmployeeCode=Employee2.EmployeeCode ';
OrderByFields:='InvBillDate,InvBillNo';
Frm_Sys_Condition:=TFrm_Inv_MnInBillListQry_C.Create(Self);
TFrm_Inv_MnInBillListQry_C(Frm_Sys_Condition).InitForm(DBConnect,UserCode);
if(Param2='成品')then
begin
Caption:='车间成品生产入库单列表查询';
Pnl_Title.Caption:='车间成品生产入库单列表查询';
end
else
begin
Caption:='车间半成品生产入库单列表查询';
Pnl_Title.Caption:='车间半成品生产入库单列表查询';
end;
Act_Filter.Execute;
end;
procedure TFrm_Inv_MnInBillListQry.Act_LookExecute(Sender: TObject);
begin
inherited;
SendDataToForm;
end;
procedure TFrm_Inv_MnInBillListQry.SendDataToForm;
var
InvBillNo:string;
WHCode:string;
InvBillTypeCode:string;
begin
if (AdoQry_Main.eof) and (AdoQry_Main.bof) then
DispInfo('没有可用的单据! ',3)
else
begin
//创建窗体
Application.CreateForm(TFrm_Inv_MnInBillQry,Frm_Inv_MnInBillQry);
//传递变量
InvBillno:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING; //单据号
WHCode:=AdoQry_Main.fieldbyname('WHCode').ASSTRING; //仓库代码
InvBillTypeCode:=Param1;
Frm_Inv_MnInBillQry.Getvar(InvBillno,WHCode,InvBillTypeCode);
//显示信息
Frm_Inv_MnInBillQry.InitForm(AdoQry_Main.Connection,FShowExtendColum);
end;
end;
procedure TFrm_Inv_MnInBillListQry.DBGridEhDblClick(Sender: TObject);
begin
inherited;
SendDataToForm;
end;
procedure TFrm_Inv_MnInBillListQry.Act_PrintExecute(Sender: TObject);
var
WHCode_InvBillNo:String;
begin
with TFrm_Inv_BillListPrint_C.Create(Self) do //新建的Form
begin
if ShowModal=mrOk then
begin
if RdBtn_PrintList.Checked then //打印列表时,用基类提供的打印功能
inherited
else //否则打印当前列表中的所有单据
begin
AdoQry_Main.First;
while not AdoQry_Main.Eof do
begin
if WHCode_InvBillNo<>AdoQry_Main.fieldbyname('WHCode').AsString
+AdoQry_Main.fieldbyname('InvBillNo').AsString then //列表中列出的不是单据头,而是单据行
begin
WHCode_InvBillNo:=AdoQry_Main.fieldbyname('WHCode').AsString
+AdoQry_Main.fieldbyname('InvBillNo').AsString;
BillPrint(DBConnect,AdoQry_Main.fieldbyname('WHCode').AsString
,AdoQry_Main.fieldbyname('InvBillNo').AsString
,Param1,ModuleCode,False,False,True,'');
//注意Param1是当前查询的单据类型,我们不要用参数,直接书写单据类型代码,例如“其它出库单据列表查询”,就是 0299
end;
AdoQry_Main.Next;
end;
end;
end;
Release;
end;
end;
procedure TFrm_Inv_MnInBillListQry.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
if (gdSelected in State)or(gdFocused in State) then
begin
Background:=clNavy;
AFont.Color:=clWindow;
end
else
begin
if AdoQry_Main.fieldbyname('isOverPlan').asstring='1' then
AFont.color:=clBlue
else
AFont.Color:=clBlack;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -