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

📄 inv_valuationbilllistqry.pas

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

unit Inv_ValuationBillListQry;

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_ValuationBillListQry = Class(TFrm_Base_Qry)
    Label1: TLabel;
    DBText1: TDBText;
    AdoQry_MainInvBillDate: TDateTimeField;
    AdoQry_MainInvBillNo: TStringField;
    AdoQry_MaInvendorCodeName: TStringField;
    AdoQry_MainPONo: TStringField;
    AdoQry_MainPOLineNo: TIntegerField;
    AdoQry_MainItemCode: TStringField;
    AdoQry_MainItemName: TStringField;
    AdoQry_MainUomName: TStringField;
    AdoQry_MainInvBillQty: TFloatField;
    AdoQry_MainInvBillNoTaxPrice: TFloatField;
    AdoQry_MainInvBillNoTaxAmount: TBCDField;
    AdoQry_MainEmployeeCodeName: TStringField;
    AdoQry_MainBatchNo: TStringField;
    AdoQry_MainWHName: TStringField;
    AdoQry_MainWHCode: TStringField;
    AdoQry_MaInBillTypeName: TStringField;
    AdoQry_MaInBillTypeCode: TStringField;
    procedure Act_LookExecute(Sender: TObject);
    procedure DBGridEhDblClick(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
  private
    FShowExtendColumn:Boolean;
    { Private declarations }
    procedure SendDataToForm();
  public
      RecTypeCode :String;
    { Public declarations }
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
  end;

var
  Frm_Inv_ValuationBillListQry: TFrm_Inv_ValuationBillListQry;

implementation

uses  Inv_ValuationBillListQry_C,Sys_Global,Inv_ValuationBillQry,Inv_BillListPrint_C,Inv_Global;



{$R *.DFM}

procedure TFrm_Inv_ValuationBillListQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
  inherited;
  AmountFields:='InvBillNoTaxAmount,InvBillNoTaxAmountc,';
  PriceFields:='InvBillNoTaxPrice,InvBillNoTaxPricec,';
  SelectFromSQL:='Select InvInBill.InvBillDate, '+
    'InvInBill.InvBillNo, '+
    'InvInBill.BillTypeCode,'+
    'BillType.BillTypeName, '+
    'InvInBill.VendorCode+'' ''+Vendor.VendorName As VendorCodeName, '+
    'InvInBill.PONo, '+
    'InvInBillLine.POLineNo, '+
    'InvInBillLine.ItemCode,Warehouse.WHCode,'+
    ' Warehouse.whCode+'' ''+Warehouse.WHName AS WHName ,'+
    'Item.ItemCode+'' ''+Item.ItemName as ItemName, '+
    'Uom.UomName, '+
    'InvInBillLine.InvBillQty, '+
    'InvInBillLine.InvBillNoTaxPrice, '+
    'InvInBillLine.InvBillNoTaxAmount, '+
    'InvInBillLine.InvBillNoTaxPriceC, '+
    'InvInBillLine.InvBillNoTaxAmountC, '+
    'InvInBill.EmployeeCode+'' ''+Employee.EmployeeName As EmployeeCodeName, '+
    'InvInBillLine.BatchNo, '+
    'InvInBillLine.BilllineremArk '+
    'From  InvInBillLine '+
    'Left Outer Join Item On  InvInBillLine.ItemCode=Item.ItemCode  '+
    'Left Outer Join Uom On  Item.UomCode=Uom.UomCode, '+
    'InvInBill '+
    'Left Outer Join Dept On  InvInBill.DeptCode=Dept.DeptCode '+
    'Left Outer Join Vendor On InvInBill.VendorCode=Vendor.VendorCode '+
    'left outer join Warehouse on InvInBill.WHCode=Warehouse.WhCode  '+
    'Left Outer Join Employee On  InvInBill.Stk_EmployeeCode=Employee.EmployeeCode '+
    'Left Outer Join BillType ON InvInBill.BillTypeCode=BillType.BillTypeCode ';
  ConditionUserDefine:='(InvInBillLine.InvBillId=InvInBill.InvBillId) '
                      +' and (InvInBill.InvBillValuation=''1'' )';
  OrderByFields:='InvBillDate,InvBillNo';


  Frm_Sys_Condition:=TFrm_Inv_ValuationBillListQry_C.Create(Self);
  TFrm_Inv_ValuationBillListQry_C(Frm_Sys_Condition).InitForm(DBConnect,UserCode);
  Act_Filter.Execute;
end;

procedure TFrm_Inv_ValuationBillListQry.Act_LookExecute(Sender: TObject);
begin
  inherited;
  SendDataToForm;
end;

procedure TFrm_Inv_ValuationBillListQry.SendDataToForm;
var
 InvBillNo:string;
 WHCode:string;
 InvBillTypeCode:string;
begin
 if AdoQry_Main.RecordCount<1 then
    DispInfo('没有可用的单据!   ',3)
 else
   begin
     //创建窗体
     Application.CreateForm(TFrm_Inv_ValuationBillQry,Frm_Inv_ValuationBillQry);
     //传递变量
     InvBillno:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING;  //单据号
     WHCode:=AdoQry_Main.fieldbyname('WHCode').ASSTRING;        //仓库代码
     InvBillTypeCode:=AdoQry_Main.fieldbyname('BillTypeCode').ASSTRING;
     Frm_Inv_ValuationBillQry.Getvar(InvBillno,WHCode,InvBillTypeCode);
     //显示信息
     Frm_Inv_ValuationBillQry.InitForm(AdoQry_Main.Connection,FShowExtendColumn);
   end;
end;

procedure TFrm_Inv_ValuationBillListQry.DBGridEhDblClick(Sender: TObject);
begin
  inherited;
  SendDataToForm;
end;

procedure TFrm_Inv_ValuationBillListQry.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;

end.

⌨️ 快捷键说明

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