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

📄 inv_whpmovebilllistqry.pas

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

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_WhPMoveBillListQry = Class(TFrm_Base_Qry)
    Label1: TLabel;
    DBText1: TDBText;
    AdoQry_MainInvBillDate: TDateTimeField;
    AdoQry_MainInvBillNo: TStringField;
    AdoQry_MainItemCode: TStringField;
    AdoQry_MainItemName: TStringField;
    AdoQry_MainUomName: TStringField;
    AdoQry_MainInvBillQty: TFloatField;
    AdoQry_MainEmployeeCodeName: TStringField;
    AdoQry_MainBatchNo: TStringField;
    AdoQry_MainWHName: TStringField;
    AdoQry_MainWHCode: TStringField;
    AdoQry_MainWhPositionName: TStringField;
    AdoQry_MainOWhPositionName: TStringField;
    AdoQry_MaInBillLineRemArk: TStringField;
    procedure Act_LookExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
  private
    FShowExtendColumn:Boolean;
    { Private declarations }
  public
    { Public declarations }
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
  end;

var
  Frm_Inv_WhPMoveBillListQry: TFrm_Inv_WhPMoveBillListQry;

implementation

uses Sys_Global,Inv_WhPMoveBillListQry_C,Inv_WhPMoveBillQry,Inv_BillListPrint_C,Inv_Global;

{$R *.DFM}

procedure TFrm_Inv_WhPMoveBillListQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
  inherited;
  SelectFromSQL:='Select InvOutBill.InvBillDate'
    +',InvOutBill.InvBillNo'
    +',InvOutBill.WhPositionCode+'' ''+WHP1.WhPositionName As WhPositionName'
    +',InvOutBill.OWhPositionCode+''  ''+WHP2.WhPositionName as OWhPositionName'
    +',InvOutBillLine.ItemCode'
    +',InvOutBillLine.BillLineRemArk'
    +',Warehouse.WHCode'
    +',Warehouse.WHCode+'' ''+Warehouse.WHName As WHName'
    +',Item.ItemName'
    +',Uom.UomName'
    +',InvOutBillLine.InvBillQty'
    +',InvOutBill.EmployeeCode+'' ''+Employee.EmployeeName As EmployeeCodeName'
    +',InvOutBillLine.BatchNo'
    +' From InvOutBillLine'
    +' Join Item On InvOutBillLine.ItemCode=Item.ItemCode'
    +' Join Uom On Item.UomCode=Uom.UomCode'
    +' Join InvOutBill On InvOutBillLine.InvBillId=InvOutBill.InvBillId'
    +' Join Warehouse On InvOutBill.WHCode=Warehouse.WhCode'
    +' Join Employee On  InvOutBill.EmployeeCode=Employee.EmployeeCode'
    +' Join WhPosition AS WHP1 On InvOutBill.WhPositionCode=WHP1.WhPositionCode'
    +' And InvOutBill.WHCode=WHP1.WHCode'
    +' Join WhPosition AS WHP2 On InvOutBill.OWhPositionCode=WHP2.WhPositionCode'
    +' And InvOutBill.WHCode=WHP2.WHCode';
  ConditionUserDefine:='InvOutBill.BillTypeCode ='''+Param1+'''';
  OrderByFields:='InvBillDate,InvBillNo,WHCode';
  
  Frm_Sys_Condition:=TFrm_Inv_WhPMoveBillListQry_C.Create(Self);
  Act_Filter.Execute;
end;

procedure TFrm_Inv_WhPMoveBillListQry.Act_LookExecute(Sender: TObject);
begin
  inherited;
  if AdoQry_Main.RecordCount=0 then
    DispInfo('没有可用的单据!',3)
  else
  begin
    Application.CreateForm(TFrm_Inv_WhPMoveBillQry,Frm_Inv_WhPMoveBillQry);
    Frm_Inv_WhPMoveBillQry.Getvar(AdoQry_Main.fieldbyname('InvBillNo').AsString,
      AdoQry_Main.fieldbyname('WHCode').AsString,Param1);
    Frm_Inv_WhPMoveBillQry.InitForm(DBConnect,FShowExtendColumn);
  end;
end;

procedure TFrm_Inv_WhPMoveBillListQry.Act_PrintExecute(Sender: TObject);
var
  WHCode_InvBillNo: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
          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,'');
          end;
          AdoQry_Main.Next;
        end;
      end;
    end;
    Release;
  end;
end;

end.

⌨️ 快捷键说明

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