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

📄 inv_mnoutbillqry.pas

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

unit Inv_MnOutBillQry;

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_MnOutBillQry = Class(TFrm_Base_Qry)
    Label1: TLabel;
    DBText1: TDBText;
    Panel1: TPanel;
    Label4: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label11: TLabel;
    Label10: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    lbl_WhPositionCode: TLabel;
    lbl_WhCode: TLabel;
    lbl_DeptCode: TLabel;
    lbl_MoRequestshift: TLabel;
    lbl_Mono: TLabel;
    lbl_MoLineno: TLabel;
    medt_Date: TMaskEdit;
    edt_memo: TEdit;
    edt_Billno: TEdit;
    Label2: TLabel;
    lbl_ItemCode: TLabel;
    procedure Act_PreviewExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
  private
    InvBillNo,WHCode:string;
    InvBillTypeCode:string;
    RecTypeCode:string;
    ModuleCode:string;
    { Private declarations }
  public
    { Public declarations }
    procedure Getvar(RInvBillNo,RWHCode,RInvBillTypeCode:string);
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override ;
  end;

var
  Frm_Inv_MnOutBillQry: TFrm_Inv_MnOutBillQry;
implementation
uses Sys_Global,Inv_Global;
{$R *.DFM}

procedure TFrm_Inv_MnOutBillQry.Getvar(RInvBillNo,RWHCode,
  RInvBillTypeCode: string);
begin
  InvBillNo:=''''+RInvBillNo+'''';
  WHCode:=''''+RWHCode+'''';
  InvBillTypeCode:=''''+RInvBillTypeCode+'''';
  RecTypeCode:=RInvBillTypeCode;
end;

procedure TFrm_Inv_MnOutBillQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
  inherited;
      //这两个参数是回传到基类后控制价格及金额的显示格式
  AmountFields:='InvBillnotaxAmount,';
  PriceFields:='InvBillnotaxPrice,';
  
  ModuleCode:='Stk';
  if(not ShowExtendColumn)then
  begin
    ModuleCode:='Inv';
    DBGridEh.Columns.Delete(6);
    DBGridEh.Columns.Delete(5);
  end;
  SelectFromSQL:=' select '
                 +'   InvOutBill.InvBillNo As InvBillNo ,InvOutBill.MONo,'
                 +'   InvOutBillLine.MoLineNo,'
                 +'   InvOutBillLine.ItemCode,Item.ItemName ,Item.ItemCode2,Uom.UomName ,'
                 +'   InvOutBillLine.ItemCode+'+''' '''+'+Item.ItemName as ItemCodeName,'
                 +'   InvOutBillLine.InvBillQty,InvOutBillLine.InvBillSfcQty, Warehouse.whCode+'' ''+Warehouse.whName as whName,  '
                 +'   InvOutBillline.BilllineremArk,InvOutBillline.Batchno,' 
                 +'   WhPosition.WhPositionCode,WhPosition.WhPositionName  ,'
                 +'   Dept.DeptCode+'' ''+Dept.DeptName As DeptName,InvOutBill.ShiftType ,'
                 +'   InvOutBill.InvBillRemArk ,InvOutBill.InvBillDate, '
                 +'   InvOutBillLine.InvBillNoTaxPrice,InvOutBillLine.InvBillNoTaxAmount '
                 +' From InvOutBill '
                 +'   left outer join Employee on InvOutBill.wh_EmployeeCode=Employee.EmployeeCode '
                 +'   left outer join Warehouse on InvOutBill.whCode=Warehouse.whCode  '
                 +'   left outer join Dept  on InvOutBill.DeptCode=Dept.DeptCode    '
                 +'   left outer join WhPosition on InvOutBill.WhPositionCode=WhPosition.WhPositionCode and InvOutBill.whCode=WhPosition.whCode '
                 +'   ,InvOutBillLine         '
                 +'    left outer join Item on InvOutBillLine.ItemCode=Item.ItemCode'
                 +'    left outer join Uom  on Item.UomCode=Uom.UomCode '
                 +' where InvOutBillLine.InvBillId=InvOutBill.InvBillId '
                 +'   and InvOutBill.InvBillNo='+InvBillNo
                 +'   and Warehouse.whCode='+whCode
                 +'   and InvOutBill.BillTypeCode='+InvBillTypeCode
                 +' Order by InvOutBillLine.ItemCode ';
   Orderbyfields:='';
   getdata;

   edt_Billno.text:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING;//单据号
   edt_memo.text:=AdoQry_Main.fieldbyname('InvBillRemArk').ASSTRING; //备注
   lbl_WhCode.Caption:=AdoQry_Main.fieldbyname('whName').ASSTRING;  // 仓库
   lbl_DeptCode.Caption:=AdoQry_Main.fieldbyname('DeptName').ASSTRING; //领料部门
   lbl_Mono.Caption:=AdoQry_Main.fieldbyname('mono').ASSTRING;   //生产订单号
   lbl_MoLineno.Caption:=AdoQry_Main.fieldbyname('MoLineno').ASSTRING; //生产订单行号
   lbl_WhPositionCode.Caption:=AdoQry_Main.fieldbyname('WhPositionCode').asstring+' '+AdoQry_Main.fieldbyname('WhPositionName').asstring; //货位
   lbl_MoRequestshift.Caption:=AdoQry_Main.fieldbyname('ShiftType').asstring;  //班别
   medt_Date.text:=AdoQry_Main.fieldbyname('InvBilldate').asstring;  //日期
   //物料
   with AdoQry_tmp do
     begin
       Close;
       sql.clear;
       sql.Add(' select ml.ItemCode,i.ItemName from MoLine ml ,Item i '
               +' where ml.mono='''+lbl_Mono.Caption+''''
               +'   and ml.MoLineno='''+lbl_MoLineno.Caption+''''
               +'   and ml.ItemCode=i.ItemCode');
       open;
      lbl_ItemCode.Caption:=AdoQry_tmp.fieldbyname('ItemCode').asstring+' '+AdoQry_tmp.fieldbyname('ItemName').asstring;
     end;
end;
procedure TFrm_Inv_MnOutBillQry.Act_PreviewExecute(Sender: TObject);
begin
 //inherited;
   BillPrint(AdoQry_Tmp.Connection,GetCode(lbl_WhCode.Caption),edt_Billno.text,RecTypeCode,ModuleCode,True,False,True,'all');
end;

procedure TFrm_Inv_MnOutBillQry.Act_PrintExecute(Sender: TObject);
begin
  //inherited;
  BillPrint(AdoQry_Tmp.Connection,GetCode(lbl_WhCode.Caption),edt_Billno.text,RecTypeCode,ModuleCode,False,False,True,'all');
end;

end.

⌨️ 快捷键说明

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