📄 inv_qry_currentinv_position.pas
字号:
unit Inv_Qry_CurrentInv_Position;
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_Qry_CurrentInv_Position = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
AdoQry_MainWHCode: TStringField;
AdoQry_MainWHCodeName: TStringField;
AdoQry_MainWhPositionCode: TStringField;
AdoQry_MainWHPCodeName: TStringField;
AdoQry_MainItemCode: TStringField;
AdoQry_MainItemName: TStringField;
AdoQry_MainUomName: TStringField;
AdoQry_MainNoTaxPrice: TFloatField;
AdoQry_MainOnHandInv: TFloatField;
AdoQry_MainOnCheckInv: TFloatField;
AdoQry_MainFreezeInv: TFloatField;
AdoQry_MainOnShipInv: TFloatField;
AdoQry_MainTotalInv: TFloatField;
AdoQry_MainOnHandACount: TFloatField;
AdoQry_MainOnCheckACount: TFloatField;
AdoQry_MainFreezeACount: TFloatField;
AdoQry_MainOnShipACount: TFloatField;
AdoQry_MainTotalACount: TFloatField;
AdoQry_MainWasterInv: TFloatField;
AdoQry_MainWasterACount: TFloatField;
AdoQry_MainItemCodeName: TStringField;
AdODataSet: TAdODataSet;
private
{ Private declarations }
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
end;
var
Frm_Inv_Qry_CurrentInv_Position: TFrm_Inv_Qry_CurrentInv_Position;
implementation
uses Inv_Qry_CurrentInv_Position_C;
{$R *.DFM}
{ TFrm_Inv_CurrentInvQry }
procedure TFrm_Inv_Qry_CurrentInv_Position.InitForm(AdOConnection: TAdOConnection;
ShowExtendColumn: Boolean);
begin
inherited;
AmountFields:='TotalACount,OnHandACount,OnCheckACount,FreezeACount,'
+'OnShipACount,WasterACount,';
PriceFields:='NoTaxPrice,';
if not ShowExtendColumn then
begin
DBGridEh.Columns.Delete(18);
DBGridEh.Columns.Delete(17);
DBGridEh.Columns.Delete(16);
DBGridEh.Columns.Delete(15);
DBGridEh.Columns.Delete(14);
DBGridEh.Columns.Delete(8);
DBGridEh.Columns.Delete(6);
end;
SelectFromSQL:='Select CurrentInv.WHCode'
+',CurrentInv.WHCode+'' ''+Warehouse.WHName As WHCodeName'
+',CurrentInv.WhPositionCode'
+',WhPosition.WhPositionCode+'' ''+WhPosition.WhPositionName As WHPCodeName'
+',CurrentInv.ItemCode'
+',Item.ItemName'
+',CurrentInv.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice'
+' else AveragePrice.AveragePrice end As NoTaxPrice'
+',CurrentInv.OnHandInv'
+',CurrentInv.OnCheckInv'
+',CurrentInv.FreezeInv'
+',CurrentInv.OnShipInv'
+',CurrentInv.WasterInv'
+',CurrentInv.OnHandInv+CurrentInv.OnCheckInv+CurrentInv.FreezeInv+'
+' CurrentInv.OnShipInv+CurrentInv.WasterInv As TotalInv'
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice*CurrentInv.OnHandInv'
+' else AveragePrice.AveragePrice*CurrentInv.OnHandInv end As OnHandACount'
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice*CurrentInv.OnCheckInv'
+' else AveragePrice.AveragePrice*CurrentInv.OnCheckInv end As OnCheckACount'
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice*CurrentInv.FreezeInv'
+' else AveragePrice.AveragePrice*CurrentInv.FreezeInv end As FreezeACount'
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice*CurrentInv.OnShipInv'
+' else AveragePrice.AveragePrice*CurrentInv.OnShipInv end As OnShipACount'
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice*CurrentInv.OnShipInv'
+' else AveragePrice.AveragePrice*CurrentInv.WasterInv end As WasterACount'
+',case Warehouse.PriceType When 1 then StandardPrice.SPPrice*(CurrentInv.OnHandInv+'
+' CurrentInv.OnCheckInv+CurrentInv.FreezeInv+CurrentInv.OnShipInv+CurrentInv.WasterInv)'
+' else AveragePrice.AveragePrice*(CurrentInv.OnHandInv+CurrentInv.OnCheckInv+'
+' CurrentInv.FreezeInv+CurrentInv.OnShipInv+CurrentInv.WasterInv) end As TotalACount'
+' From CurrentInv'
+' Join Warehouse On CurrentInv.WHCode=Warehouse.WHCode'
+' Join Item On CurrentInv.ItemCode=Item.ItemCode'
+' Left Join AveragePrice On (CurrentInv.WHCode=AveragePrice.WHCode)'
+' And (CurrentInv.ItemCode=AveragePrice.ItemCode)'
+' Left Join StandardPrice On (StandardPrice.SPStArtMonth='''
+ FormatDateTime('yyyy.mm',Now)+''')'
+' And (CurrentInv.ItemCode=StandardPrice.ItemCode)'
+' join Uom on Item.UomCode=Uom.UomCode'
+' join WhPosition on CurrentInv.WHCode=WhPosition.WHCode'
+' And CurrentInv.WhPositionCode=WhPosition.WhPositionCode';
OrderByFields:='WHCode,WhPositionCode,ItemCode';
Frm_Sys_Condition:=TFrm_Inv_Qry_CurrentInv_Position_C.Create(Self);
Act_Filter.Execute;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -