📄 inv_salebilllistqry.pas
字号:
unit Inv_SaleBillListQry;
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_SaleBillListQry = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
procedure Act_LookExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
private
{ Private declarations }
FShowExtendColum:Boolean;
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
end;
var
Frm_Inv_SaleBillListQry: TFrm_Inv_SaleBillListQry;
implementation
uses Inv_SaleBillListQry_C, Inv_SaleBillQry, Sys_Global,Inv_BillListPrint_C,Inv_Global;
{$R *.DFM}
procedure TFrm_Inv_SaleBillListQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
var
Temp_Str,Temp_Str1:String;
begin
inherited;
AmountFields:='InvBillNoTaxAmount,RealSaleAmount,';
PriceFields:='InvBillNoTaxPrice,RealSalePrice,';
{如果是Inv或Stk模块,显示InvOutBill.InvBillWHChck=1的记录,
如果是Sal模块,则显示InvOutBill.InvBillWHChck=0的记录}
if(Param2='Inv')then
begin
DBGridEh.Columns.Delete(13);
DBGridEh.Columns.Delete(12);
DBGridEh.Columns.Delete(11);
DBGridEh.Columns.Delete(10);
Temp_Str:='';
Temp_Str1:='';
FShowExtendColum:=False;
ConditionUserDefine:='InvOutBill.InvBillWHChck=1'
+' And InvOutBill.BillTypeCode='''+Param1+'''';
if Param1='0204' then
begin
if Param3='NoMps' then
ConditionUserDefine:=ConditionUserDefine
+' And InvOutBill.MpsSale=0'
else
ConditionUserDefine:=ConditionUserDefine
+' And InvOutBill.MpsSale=1';
end;
end
else if(Param2='Stk')then
begin
FShowExtendColum:=True;
DBGridEh.Columns.Delete(13);
DBGridEh.Columns.Delete(12);
Temp_Str:=' Left Join StandardPrice On (InvOutBillLine.ItemCode=StandardPrice.ItemCode)'
+' And (InvOutBill.InvBillMonth=StandardPrice.SPStArtMonth)';
Temp_Str1:=''
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice'
+' else InvOutBillLine.InvBillNoTaxPrice end As InvBillNoTaxPrice '
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice*InvOutBillLine.InvBillQty'
+' else InvOutBillLine.InvBillNoTaxAmount end As InvBillNoTaxAmount';
ConditionUserDefine:='InvOutBill.InvBillWHChck=1'
+' And InvOutBill.BillTypeCode='''+Param1+'''';
if Param1='0204' then
begin
if Param3='NoMps' then
ConditionUserDefine:=ConditionUserDefine
+' And InvOutBill.MpsSale=0'
else
ConditionUserDefine:=ConditionUserDefine
+' And InvOutBill.MpsSale=1';
end;
end
else
begin
DBGridEh.Columns.Delete(11);
DBGridEh.Columns.Delete(10);
Temp_Str:=' Join RealSalePrice On (InvOutBillLine.InvBillId=RealSalePrice.InvBillId)'
+' And (InvOutBillLine.InvBillLineNo=RealSalePrice.InvBillLineNo)';
Temp_Str1:=''
+',RealSalePrice.InvBillSalePrice As RealSalePrice'
+',RealSalePrice.InvBillSaleAmount As RealSaleAmount';
ConditionUserDefine:='InvOutBill.InvBillWHChck=0'
+' And InvOutBill.BillTypeCode='''+Param1+'''';
if Param1='0204' then
begin
if Param3='NoMps' then
ConditionUserDefine:=ConditionUserDefine
+' And InvOutBill.MpsSale=0'
else
ConditionUserDefine:=ConditionUserDefine
+' And InvOutBill.MpsSale=1';
end;
end;
SelectFromSQL:='Select'
+' InvOutBill.InvBillDate'
+',InvOutBill.WHCode+'' ''+Warehouse.WHName As WHName'
+',InvOutBill.WhPositionCode+'' ''+WhPosition.WhPositionName As WhPositionName'
+',InvOutBill.InvBillNo '
+',InvOutBill.CustomerCode+'' ''+Customer.CustomerName As CustomerCodeName'
+',InvOutBillLine.MpsId'
+',InvOutBillLine.BillLineRemArk'
+',InvOutBillLine.ItemCode'
+',Item.ItemName'
+',InvOutBillLine.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+',InvOutBillLine.InvBillQty'
+Temp_Str1
+',InvOutBill.WH_EmployeeCode+'' ''+Employee.EmployeeName As EmployeeCodeName'
+',InvOutBill.Sal_EmployeeCode+'' ''+Employee1.EmployeeName As EmployeeCodeName1'
+',InvOutBillLine.BatchNo,Warehouse.WHCode'
+' From InvOutBillLine'
+' Join Item On InvOutBillLine.ItemCode=Item.ItemCode'
+' Join Uom On Item.UomCode=Uom.UomCode'
+' Join InvOutBill On InvOutBillLine.InvBillId=InvOutBill.InvBillId'
+' Join Customer On InvOutBill.CustomerCode=Customer.CustomerCode'
+' Join Warehouse On InvOutBill.WHCode=Warehouse.WHCode'
+' Join WhPosition On InvOutBill.WhPositionCode=WhPosition.WhPositionCode'
+' And InvOutBill.WHCode=WhPosition.WHCode'
+' Left Join Employee On InvOutBill.WH_EmployeeCode=Employee.EmployeeCode'
+' Left Join Employee Employee1 On InvOutBill.Sal_EmployeeCode=Employee1.EmployeeCode'
+Temp_Str;
OrderByFields:='InvBillDate,InvBillNo,WHCode';
Frm_Sys_Condition:=TFrm_Inv_SaleBillListQry_C.Create(Self);
TFrm_Inv_SaleBillListQry_C(Frm_Sys_Condition).InitForm(DBConnect,UserCode);
if Param1='0203' then
begin
Caption:='材料销售出库单列表查询';
Pnl_Title.Caption:='材料销售出库单列表查询';
end
else// if Param1='0204' then
begin
if Param3='NoMps' then
begin
Caption:='非主计划销售出库单列表查询';
Pnl_Title.Caption:='非主计划销售出库单列表查询';
end
else
begin
Caption:='主计划销售出库单列表查询';
Pnl_Title.Caption:='主计划销售出库单列表查询';
end;
end;
Act_Filter.Execute;
end;
procedure TFrm_Inv_SaleBillListQry.Act_LookExecute(Sender: TObject);
begin
inherited;
if AdoQry_Main.RecordCount=0 then
DispInfo('没有可用的单据!',3)
else
begin
Application.CreateForm(TFrm_Inv_SaleBillQry,Frm_Inv_SaleBillQry);
Frm_Inv_SaleBillQry.Getvar(AdoQry_Main.fieldbyname('InvBillNo').AsString,
AdoQry_Main.fieldbyname('WHCode').AsString,Param1,Param2,Param3);
Frm_Inv_SaleBillQry.InitForm(DBConnect,FShowExtendColum);
end;
end;
procedure TFrm_Inv_SaleBillListQry.Act_PrintExecute(Sender: TObject);
var
WHCode_InvBillNo,WHCode:String;
begin
with TFrm_Inv_BillListPrint_C.Create(Self) do
begin
if ShowModal=mrOk then
begin
if RdBtn_PrintList.Checked then
inherited
else
begin
AdoQry_Main.First;
while not AdoQry_Main.Eof do
begin
WHCode:=GetCode(AdoQry_Main.fieldbyname('WHName').AsString);
if WHCode_InvBillNo<>WHCode+AdoQry_Main.fieldbyname('InvBillNo').AsString then
begin
WHCode_InvBillNo:=WHCode+AdoQry_Main.fieldbyname('InvBillNo').AsString;
BillPrint(DBConnect,WHCode,AdoQry_Main.fieldbyname('InvBillNo').AsString
,Param1,ModuleCode,False,False,True,'');
end;
AdoQry_Main.Next;
end;
end;
end;
Release;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -