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

📄 inv_mninbillqry.pas

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

unit Inv_MnInBillQry;

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_MnInBillQry = 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_MainInvBillRemArk: TStringField;
    AdoQry_MainWhPositionName: TStringField;
    AdoQry_MainWhPositionCode: TStringField;
    AdoQry_MainInvBillNoTaxPrice: TFloatField;
    AdoQry_MainInvBillNoTaxAmount: TBCDField;
    Panel1: TPanel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Lbl_MoNo: TLabel;
    LbL_ShiftType: TLabel;
    Edt_BillNo: TEdit;
    Edt_Date: TMaskEdit;
    AdoQry_MainMoNo: TStringField;
    AdoQry_MainMoLineNo: TIntegerField;
    AdoQry_MainInvBillSfcQty: TFloatField;
    AdoQry_MainShiftType: TStringField;
    AdoQry_MainInvBillPrice: TFloatField;
    AdoQry_MainInvBillAmount: TFloatField;
    Label2: TLabel;
    Lbl_WhCodeName: TLabel;
    Lable1: TLabel;
    Label5: TLabel;
    Lbl_DeptCodeName: TLabel;
    Lbl_WhPosition: TLabel;
    AdoQry_MainDeptCodeName: TStringField;
    AdoQry_MainWHCodeName: TStringField;
    Lbl_RemArk: TLabel;
    procedure Act_PreviewExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    InvBillNo,WHCode:string;
    InvBillTypeCode,RecTypeCode:string;
    { Private declarations }
    ModuleCode:string;
  public
    { Public declarations }
    procedure Getvar(RInvBillNo,RWHCode,RInvBillTypeCode:string);
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override ;
  end;

var
  Frm_Inv_MnInBillQry: TFrm_Inv_MnInBillQry;
  
implementation

uses Inv_PurchaseInBillQry,Sys_Global,Inv_Global;

{$R *.DFM}

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

procedure TFrm_Inv_MnInBillQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
  inherited;
  AmountFields:='InvBillNoTaxAmount,InvBillAmount,';
  PriceFields:='InvBillNoTaxPrice,InvBillPrice,';
  ModuleCode:='Stk';
  if(not ShowExtendColumn)then
  begin
    ModuleCode:='Inv';
    DBGridEh.Columns.Delete(9);
    DBGridEh.Columns.Delete(8);
    DBGridEh.Columns.Delete(7);
    DBGridEh.Columns.Delete(6);
  end;
  SelectFromSQL:=' Select '
                 +' InvInBill.InvBillDate,'
                 +' InvInBill.InvBillId,'
                 +' InvInBill.InvBillNo, '
                 +' InvInBill.MONo,'
                 +' InvInBillLine.MoLineNo,'
                 +' InvInBill.DeptCode+'' ''+Dept.DeptName As DeptCodeName,'
                 +' InvInBillLine.ItemCode,'
                 +' Item.ItemName, '
                 +' Uom.UomName, '
                 +' InvInBill.whCode+'' ''+Warehouse.whName as whCodeName,' //仓库
                 +' InvInBillLine.InvBillQty,'
                 +' InvInBillLine.InvBillSfcQty ,'
                // +' InvInBill.InvBillTaxRate ,'  //税率
                // +' InvInBill.InvBillValuation,'//是否暂估价
                 +' StandardPrice.SPPrice As InvBillNoTaxPrice,'
                 +' StandardPrice.SPPrice*InvInBillLine.InvBillQty As InvBillNoTaxAmount,'
                 +' InvInBillLine.InvBillPrice,InvInBillLine.InvBillAmount,'
                 +' InvInBill.shiftType,'
                 +' WhPosition.WhPositionCode,WhPosition.WhPositionName,'
                 +' InvInBill.InvBillRemArk '
                 +' From  InvInBillLine '
                 +' Join InvInBill on InvInBillLine.InvBillId=InvInBill.InvBillId '
                 +'   and (InvInBill.InvBillNo='+InvBillNo+' )'
                 +'   and (InvInBill.WHCode='+WHCode+')'
                 +'  and (InvInBill.BillTypeCode='+InvBillTypeCode+')'
                 +' left join StandardPrice on InvInBill.InvBillMonth=StandardPrice.spstArtMonth'
                 +'   and InvInBillline.ItemCode=StandardPrice.ItemCode '
                 +' Left Outer Join Item On  InvInBillLine.ItemCode=Item.ItemCode'
                 +' Left Outer Join Uom On  Item.UomCode=Uom.UomCode'
                 +' Left Outer Join Dept On  InvInBill.DeptCode=Dept.DeptCode '
                 +' left outer join Warehouse on InvInBill.whCode=Warehouse.whCode  '
                 +' left outer join WhPosition on InvInBill.whCode=WhPosition.whCode and InvInBill.WhPositionCode=WhPosition.WhPositionCode';
   Orderbyfields:='';
   getdata;
   lbl_WhCodeName.Caption:=AdoQry_Main.fieldbyname('WHCodeName').asstring;
   lbl_DeptCodeName.Caption:=AdoQry_Main.fieldbyname('DeptCodeName').asstring;
   lbl_WhPosition.Caption:=AdoQry_Main.fieldbyname('WhPositionCode').asstring+' '+AdoQry_Main.fieldbyname('WhPositionName').asstring; //货位
   Edt_Billno.text:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING;//单据号
   LbL_ShiftType.Caption:=AdoQry_Main.fieldbyname('ShiftType').ASSTRING;
   Lbl_MoNo.Caption:=AdoQry_Main.fieldbyname('mono').ASSTRING;   //采购订单号
   Edt_Date.text:=AdoQry_Main.fieldbyname('InvBilldate').asstring;//日期
   lbl_RemArk.Caption:=AdoQry_Main.fieldbyname('InvBillRemArk').ASSTRING; //备注
   if(RecTypeCode='0105')then
   begin
     Frm_Inv_MnInBillQry.Caption:='车间成品生产入库单列表查询';
     Pnl_Title.Caption:='车间成品生产入库单列表查询';
   end
   else
   begin
     Frm_Inv_MnInBillQry.Caption:='车间半成品生产入库单列表查询';
     Pnl_Title.Caption:='车间半成品生产入库单列表查询';
   end;
{  with AdoQry_Tmp do
  begin
    Close;
    sql.Text:='select InvBillRemArk'+
              '  from InvInBill '+
              ' where InvBillId='+AdoQry_Main.fieldbyname('InvBillId').asstring;
    open;
    Lbl_RemArk.Caption:=fieldbyname('InvBillRemArk').asstring;
  end;}
end;

procedure TFrm_Inv_MnInBillQry.Act_PreviewExecute(Sender: TObject);
begin
 //inherited;
  BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_WhCodeName.Caption),Edt_BillNo.text,RecTypeCode,ModuleCode,True,False,True,'');
end;

procedure TFrm_Inv_MnInBillQry.Act_PrintExecute(Sender: TObject);
begin
//inherited;
 BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_WhCodeName.Caption),Edt_BillNo.text,RecTypeCode,ModuleCode,False,False,True,'');
end;

procedure TFrm_Inv_MnInBillQry.FormActivate(Sender: TObject);
begin
  inherited;
  ToolButton4.left:=ToolButton13.left+ ToolButton4.Width;
end;

procedure TFrm_Inv_MnInBillQry.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
{  with AdoQry_Tmp do
  begin
    Close;
    sql.text:='update InvInBill '+
              '   set InvBillRemArk='''+Lbl_RemArk.Caption+''''+
              ' where InvBillId='+AdoQry_Main.fieldbyname('InvBillId').asstring;
    execsql;
  end;}
end;

end.

⌨️ 快捷键说明

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