⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inv_salebillqry.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Inv_SaleBillQry;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
  StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls, Mask;

Type
  TFrm_Inv_SaleBillQry = Class(TFrm_Base_Qry)
    Label1: TLabel;
    DBText1: TDBText;
    Panel1: TPanel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label7: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Lbl_CustomerName: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Lbl_Warehouse: TLabel;
    Lbl_CustomerCode: TLabel;
    Lbl_InvBillNo: TLabel;
    Lbl_WhPosition: TLabel;
    Lbl_InvBillDate: TLabel;
    Lbl_InvBillRemArk: TLabel;
    procedure Act_PreviewExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
  private
    InvBillNo,WHCode:string;
    InvBillTypeCode:string;
    InvBillTypeFlag:string;
    RecTypeCode:string;
    ModuleCode:string;
    { Private declarations }
  public
    { Public declarations }
    procedure Getvar(RInvBillNo,RWHCode,RInvBillTypeCode,RInvBillTypeFlag:String;Mps:String='');
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override ;
  end;

var
  Frm_Inv_SaleBillQry: TFrm_Inv_SaleBillQry;

implementation

uses Sys_Global,Inv_Global;

{$R *.DFM}

procedure TFrm_Inv_SaleBillQry.Getvar(RInvBillNo,RWHCode,
  RInvBillTypeCode,RInvBillTypeFlag:String;Mps:String='');
begin
  InvBillNo:=RInvBillNo;
  WHCode:=RWHCode;
  InvBillTypeCode:=RInvBillTypeCode;
  InvBillTypeFlag:=RInvBillTypeFlag;
  RecTypeCode:=RInvBillTypeCode;
  Param3:=Mps;
end;

procedure TFrm_Inv_SaleBillQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
var 
  Temp_Str,Temp_Str1:String;
begin
  inherited;
  AmountFields:='InvBillNoTaxAmount,RealNoTaxSaleAmount,RealSaleAmount,';
  PriceFields:='InvBillNoTaxPrice,RealNoTaxSalePrice,RealSalePrice,';
  ModuleCode:='Stk';
  if InvBillTypeFlag='Inv' then
  begin
    ModuleCode:='Inv';
    DBGridEh.Columns.Delete(10);
    DBGridEh.Columns.Delete(9);
    DBGridEh.Columns.Delete(8);
    DBGridEh.Columns.Delete(7);
    DBGridEh.Columns.Delete(6);
    DBGridEh.Columns.Delete(5);
  end;
  if(InvBillTypeFlag='Inv')then
  begin
    Temp_Str:='';
    Temp_Str1:='';
  end
  else if(InvBillTypeFlag='Stk')then
  begin
    DBGridEh.Columns.Delete(10);
    DBGridEh.Columns.Delete(9);
    DBGridEh.Columns.Delete(8);
    DBGridEh.Columns.Delete(7);
    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'
  end
  else// if(Param2='Sal')then
  begin
    DBGridEh.Columns.Delete(6);
    DBGridEh.Columns.Delete(5);
    
    Temp_Str:=' Left Join RealSalePrice On InvOutBillLine.InvBillId=RealSalePrice.InvBillId'
      +' And InvOutBillLine.InvBillLineNo=RealSalePrice.InvBillLineNo';
    Temp_Str1:=''
      +',RealSalePrice.InvBillSalePrice As RealSalePrice'
      +',RealSalePrice.InvBillSaleAmount As RealSaleAmount'
      +',RealSalePrice.InvBillNoTaxSalePrice As RealNoTaxSalePrice' 
      +',RealSalePrice.InvBillNoTaxSaleAmount As RealNoTaxSaleAmount';
  end;
  SelectFromSQL:='Select InvOutBill.InvBillDate'
    +',InvOutBill.InvBillNo'
    +',InvOutBill.CustomerCode,Customer.CustomerName '
    +',InvOutBillLine.ItemCode'
    +',InvOutBillLine.BillLineRemArk'
    +',Item.ItemName'
    +',InvOutBillLine.ItemCode+'' ''+Item.ItemName As ItemCodeName'
    +',Uom.UomName'
    +',InvOutBillLine.InvBillQty'
    +Temp_Str1
    +',InvOutBill.EmployeeCode+'' ''+Employee.EmployeeName As EmployeeCodeName '
    +',InvOutBillLine.BatchNo,Warehouse.WHCode+''  ''+Warehouse.whName AS WHName '
    +',InvOutBill.InvBillRemArk '
    +',WhPosition.WhPositionCode+'' ''+WhPosition.WhPositionName as WhPositionName '
    +' 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 Employee On InvOutBill.EmployeeCode=Employee.EmployeeCode'
    +' Join WhPosition On InvOutBill.WhPositionCode=WhPosition.WhPositionCode'
    +' And InvOutBill.WHCode=WhPosition.WHCode'
    +Temp_Str;
    
  ConditionUserDefine:='InvOutBill.InvBillNo='''+InvBillNo+''''
    +' And InvOutBill.WHCode='''+WHCode+'''';
  OrderByFields:='ItemCode';
  
  GetData;

  Lbl_Warehouse.Caption:=AdoQry_Main.fieldbyname('WHName').AsString;
  Lbl_WhPosition.Caption:=AdoQry_Main.fieldbyname('WhPositionName').AsString;
  Lbl_CustomerCode.Caption:=AdoQry_Main.fieldbyname('CustomerCode').AsString;
  Lbl_CustomerName.Caption:=AdoQry_Main.fieldbyname('CustomerName').AsString;
  Lbl_InvBillNo.Caption:=AdoQry_Main.fieldbyname('InvBillNo').AsString;
  Lbl_InvBillDate.Caption:=AdoQry_Main.fieldbyname('InvBillDate').AsString;
  Lbl_InvBillRemArk.Caption:=AdoQry_Main.fieldbyname('InvBillRemArk').AsString;

  if InvBillTypeCode='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;
end;
procedure TFrm_Inv_SaleBillQry.Act_PreviewExecute(Sender: TObject);
begin
 //inherited;
  BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_Warehouse.Caption),Lbl_InvBillNo.Caption,RecTypeCode,ModuleCode,True,False,True,'');
end;

procedure TFrm_Inv_SaleBillQry.Act_PrintExecute(Sender: TObject);
begin
 //inherited;
  BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_Warehouse.Caption),Lbl_InvBillNo.Caption,RecTypeCode,ModuleCode,False,False,True,'');
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -