📄 inv_otheriosum.pas
字号:
unit Inv_OtherIoSum;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin,pr_PrintReportType;
Type
TFrm_Inv_OtherIoSum = Class(TFrm_Base_Qry)
Label1: TLabel;
Lbl_TaxAmountTatol: TLabel;
Edit1: TEdit;
procedure AdoQueryAfterOpen(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
procedure initReport;Override;
end;
var
Frm_Inv_OtherIoSum: TFrm_Inv_OtherIoSum;
implementation
uses Inv_OtherIoSum_C;
{$R *.DFM}
{ TFrm_Inv_ItemSaleSum }
procedure TFrm_Inv_OtherIoSum.initReport;
var
i:integer;
userName:string;
begin
inherited;
with AdoQry_tmp do
begin
Close;
sql.Text:='select * from Employee where EmployeeCode='''+userCode+'''';
open;
userName:=fieldbyname('EmployeeName').asstring;
end;
if Param2<>'Inv' then
begin
i:=ExtPrintReport.Headers.indexof('InvBillNoTaxAmount');
if i>=0 then
begin
ExtPrintReport.Headers[i].sum:=True;
ExtPrintReport.Headers[i].style:=dSconcise;
end;
end;
ExtprintReport.Foot1:=' 制 表:'+userName+' 审核:';
ExtprintReport.Headers.Items[ExtprintReport.Headers.indexof('InvBillQty')].sum:=True;
if Param2<>'Inv' then
ExtprintReport.Headers.Items[ExtprintReport.Headers.indexof('InvBillNoTaxAmount')].sum:=True;
end;
procedure TFrm_Inv_OtherIoSum.InitForm(AdOConnection: TAdOConnection;
ShowExtendColumn: Boolean);
begin
AmountFields:='InvBillNoTaxAmount,';
PriceFields:='InvBillNoTaxPrice,';
if Param2='Inv' then
begin
DBGridEh.Columns.Delete(7);
Label1.Visible:=False;
edit1.Visible:=False;
end;
if Param1='0199' then
begin
Caption:='其它入库汇总表';
Pnl_Title.Caption:='其它入库汇总表';
SelectFromSQL:='Select InvInBillLine.ItemCode'
+',Item.ItemName'
//入库对象
+ ',OutinType='
+ 'case'
+ ' when InvInBill.DeptCode is not null then InvInBill.DeptCode '
+ ' when InvInBill.VendorCode is not null then InvInBill.VendorCode '
+ ' when InvInBill.customerCode is not null then InvInBill.customerCode '
+ 'else '
+ ' '''' '
+ ' end'
//入库对象标识
+',OutinName= '
+'case'
+' when InvInBill.DeptCode is not null then InvInBill.DeptCode+'+''' '''+'+Dept.DeptName '
+' when InvInBill.VendorCode is not null then InvInBill.VendorCode+'+''' '''+'+Vendor.VendorName '
+' when InvInBill.customerCode is not null then InvInBill.customerCode+'+''' '''+'+customer.customerName '
+'else '
+' '''' '
+'end '
+',BillType2.BillType2Name'
+',InvInBillLine.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+',sum(InvInBillLine.InvBillQty) as InvBillqty '
// +',InvInBillLine.InvBillNoTaxPrice'
+',sum(InvInBillLine.InvBillNoTaxAmount) as InvBillNoTaxAmount '
+' From InvInBillLine'
+' Join InvInBill on InvInBillLine.InvBillId=InvInBill.InvBillId'
+' left Join Item on InvInBillLine.ItemCode=Item.ItemCode'
+' left Join Uom on Item.UomCode=Uom.UomCode'
+' left Join BillType2 on InvInBill.BillType2Code=BillType2.BillType2Code'
+' Left join Vendor on InvInBill.VendorCode=Vendor.VendorCode'
+' Left join customer on InvInBill.customerCode=customer.customerCode '
+' left join Dept on InvInBill.DeptCode=Dept.DeptCode';
ConditionUserDefine:='InvInBill.BillTypeCode='''+Param1+'''';
GroupByFields:=' InvInBillLine.ItemCode,Item.ItemName,InvInBill.DeptCode,'+
'InvInBill.customerCode,InvInBill.VendorCode,Dept.DeptName,customer.customerName,'+
'Vendor.VendorName,BillType2.BillType2Name,Uom.UomName ';
end
else if Param1='0299' then
begin
Dbgrideh.columns[0].title.Caption:='出库对象标识';
DBGridEh.Columns[1].Title.Caption:='出库类型';
Caption:='其它出库汇总表';
Pnl_Title.Caption:='其它出库汇总表';
SelectFromSQL:='Select InvOutBillLine.ItemCode'
+',Item.ItemName'
//出库对象
+ ',OutinType= '
+ 'case'
+ ' when InvOutBill.DeptCode is not null then InvOutBill.DeptCode '
+ ' when InvOutBill.customerCode is not null then InvOutBill.customerCode '
+ ' when InvOutBill.VendorCode is not null then InvOutBill.VendorCode '
+ 'else '
+ ' '''' '
+ ' end '
//出库对象标识
+',OutinName= '
+'case'
+ ' when InvOutBill.DeptCode is not null then InvOutBill.DeptCode+'+''' '''+'+Dept.DeptName '
+ ' when InvOutBill.customerCode is not null then InvOutBill.customerCode+'+''' '''+'+customer.customerName '
+ ' when InvOutBill.VendorCode is not null then InvOutBill.VendorCode+'+''' '''+'+Vendor.VendorName '
+ 'else '
+ ' '''' '
+ 'end '
+',BillType2.BillType2Name'
+',InvOutBillLine.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+',sum(InvOutBillLine.InvBillQty) as InvBillqty '
// +',InvOutBillLine.InvBillNoTaxPrice'
+',sum(InvOutBillLine.InvBillNoTaxAmount) as InvBillnotaxAmount'
+' From InvOutBillLine'
+' Join InvOutBill on InvOutBillLine.InvBillId=InvOutBill.InvBillId'
+' left Join Item on InvOutBillLine.ItemCode=Item.ItemCode'
+' left Join Uom on Item.UomCode=Uom.UomCode'
+' left Join BillType2 on InvOutBill.BillType2Code=BillType2.BillType2Code'
+' Left join Dept on InvOutBill.DeptCode=Dept.DeptCode'
+' Left join Vendor on InvOutBill.VendorCode=Vendor.VendorCode'
+' left join Customer on InvOutBill.customerCode=Customer.customerCode';
ConditionUserDefine:='InvOutBill.BillTypeCode='''+Param1+'''';
GroupByFields:=' InvOutBillLine.ItemCode,Item.ItemName,InvOutBill.DeptCode,'+
'InvOutBill.customerCode,InvOutBill.VendorCode,Dept.DeptName,customer.customerName,'+
'Vendor.VendorName,BillType2.BillType2Name,Uom.UomName ';
end;
inherited;
OrderByFields:='ItemCodeName,OutinName,BillType2Name';
Frm_Sys_Condition:=TFrm_Inv_OtherIoSum_C.Create(Self);
Lbl_Order.Caption:='物料标识,对象标识,类型标识';
Act_Filter.Execute;
end;
procedure TFrm_Inv_OtherIoSum.AdoQueryAfterOpen(DataSet: TDataSet);
var
TaxAmountTatol:Double;
begin
inherited;
if Param2<>'Inv' then
begin
TaxAmountTatol:=0;
DataSet.DisableControls;
DataSet.Last;
while not DataSet.Bof do
begin
TaxAmountTatol:=TaxAmountTatol+DataSet.fieldbyname('InvBillNoTaxAmount').AsFloat;
DataSet.Prior;
end;
Lbl_TaxAmountTatol.Caption:=FloatToStr(TaxAmountTatol);
edit1.text:=FormatFloat('#.##',TaxAmountTatol);
DataSet.EnableControls;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -