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

📄 inv_otherinbillqry.pas

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

unit Inv_OtherInBillQry;

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, ExtEdit;

Type
  TFrm_Inv_OtherInBillQry = Class(TFrm_Base_Qry)
    Label1: TLabel;
    DBText1: TDBText;
    Panel1: TPanel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Lbl_OutName: TLabel;
    Edt_Memo: TEdit;
    Edt_BillNo: TEdit;
    Medt_Date: TMaskEdit;
    Edt_OutCode: TExtEdit;
    Edt_WhCodeName: TExtEdit;
    Edt_OutType: TExtEdit;
    edt_WhPosition: TExtEdit;
    Edt_BillType2CodeName: TExtEdit;
    Lbl_InvBillratetitle: TLabel;
    Lbl_InvBillrate: TLabel;
    lbl_InvBillValuationtitle: TLabel;
    lbl_Currency: TLabel;
    procedure Act_PreviewExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    InvBillNo,WHCode,InvBilldate:string;
    InvBillTypeCode,RecTypeCode:string;
    ModuleCode:string;
    { Private declarations }
  public
    { Public declarations }
    procedure Getvar(RInvBillNo,RWHCode,RInvBillTypeCode,RInvBilldate:string);
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override ;
  end;

var
  Frm_Inv_OtherInBillQry: TFrm_Inv_OtherInBillQry;
implementation
uses Sys_Global,Inv_Global;
{$R *.DFM}

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

procedure TFrm_Inv_OtherInBillQry.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(6);
    DBGridEh.Columns.Delete(5);
    DBGridEh.Columns.Delete(4);
    DBGridEh.Columns.Delete(3);
  end;
  SelectFromSQL:='select '+
                    'InvInBill.InvBilldate,'+
                    'InvInBill.InvBillno,'+
                    'InvInBill.currencyCode,'+
                    'InvInBill.currencyCode+'+''' '''+'+currency.currencyName as currencyName,'+
                    'BillType2.BillType2Code+'+''' '''+'+BillType2.BillType2Name as BillType2CodeName, '+
                  //入库对象
                    'OutType='+
                    'case'+
                    '  when InvInBill.DeptCode is not null then ''部门'' '+
                    '  when InvInBill.VendorCode is not null then ''供应商'' '+
                    'else '+
                    ' '''' '+
                    ' end,'+
                  //入库对象代码
                    'OutCode='+
                    'case'+
                    '  when InvInBill.DeptCode is not null then InvInBill.DeptCode '+
                    '  when InvInBill.VendorCode is not null then InvInBill.VendorCode '+
                    'else '+
                    ' '''' '+
                    'end,'+
                  //入库对象描述
                   'OutName='+
                   'case'+
                   '  when InvInBill.DeptCode is not null then Dept.DeptName '+
                   '  when InvInBill.VendorCode is not null then Vendor.VendorName '+
                   'else '+
                   ' '''' '+
                   'end, '+
                   'InvInBillline.ItemCode,'+
                   'Item.ItemName,'+
                   'InvInBillline.ItemCode+'+''' '''+'+Item.ItemName as ItemCodeName,'+
                   'Uom.UomName,'+
                   'WhPosition.WhPositionCode,WhPosition.WhPositionName, '+
                   'Warehouse.whCode+'' ''+Warehouse.whName as WHCodeName,'+
                   'InvInBillline.InvBillqty,'+
                   'InvInBill.InvBillTaxRate ,'+  //税率
                   'InvInBill.InvBillValuation,'+//是否暂估价
                   'InvBillNoTaxPrice='+
                   'case '+
                   '  when InvInBill.currencyCode=''00'' then InvInBillline.InvBillNoTaxPrice '+
                   ' else InvInBillline.InvBillNoTaxPricec end,'+
                   'InvBillnotaxAmount='+
                   ' case '+
                   '  when InvInBill.currencyCode=''00'' then InvInBillline.InvBillNoTaxAmount '+
                   '  else InvInBillline.InvBillNoTaxAmountc end, '+
                   ' InvBillPrice='+
                   ' case '+
                   '  when InvInBill.currencyCode=''00'' then InvInBillline.InvBillPrice '+
                   '  else InvInBillline.InvBillPricec end,'+
                   ' InvBillAmount='+
                   ' case '+
                   '   when InvInBill.currencyCode=''00'' then InvInBillline.InvBillAmount '+
                   '  else  InvInBillline.InvBillAmountc end,'+
                   'InvInBillLine.BilllineremArk,InvInBillLine.InvBillPrice,InvInBillLine.InvBillAmount,'+
                   'Employee.EmployeeCode+'+''' '''+'+Employee.EmployeeName as EmployeeCodeName,'+
                   'InvInBill.InvBillremArk,InvInBillline.Batchno '+
    'from InvInBillline '+
    'join InvInBill on InvInBillLine.InvBillId=InvInBill.InvBillId '+
                       ' And (InvInBill.InvBillNo='+InvBillno+')' +
                       ' And (InvInBill.BillTypeCode='+InvBillTypeCode+') '+
                       ' And (InvInBill.whCode='+whCode+')'+
    'Left join  Item On  InvInBillLine.ItemCode=Item.ItemCode '+
    'Left join  Uom On  Item.UomCode=Uom.UomCode '+
//    'left join StandardPrice on InvInBill.InvBillMonth=StandardPrice.spstArtMonth and '+
//                             '  InvInBillline.ItemCode=StandardPrice.ItemCode '+
{   'left join (select a.* '+
    '  from StandardPrice a,'+
    '   (select ItemCode,max(spstArtMonth) as spstArtMonth '+
         ' from StandardPrice '+
         ' where spstArtMonth<='''+copy(InvBilldate,1,7)+''''+
            ' group by ItemCode) b '+
      ' where a.ItemCode=b.ItemCode '+
     '   and a.spstArtMonth=b.spstArtMonth) StandardPrice '+
     '    on InvInBillline.ItemCode=StandardPrice.ItemCode '+}
    'Left Outer Join Dept On  InvInBill.DeptCode=Dept.DeptCode '+
    'left outer Join Warehouse On InvInBill.WHCode=Warehouse.WHCode '+
    'left outer join WhPosition on InvInBill.WhPositionCode=WhPosition.WhPositionCode and InvInBill.whCode=WhPosition.whCode '+
    'Left Outer Join Employee On  InvInBill.EmployeeCode=Employee.EmployeeCode '+
    'Left Outer Join Vendor On  InvInBill.VendorCode=Vendor.VendorCode '+
    'Left join currency on InvInBill.currencyCode=currency.currencyCode '+
    'Left Outer Join BillType2 On  InvInBill.BillType2Code=BillType2.BillType2Code ';

   Orderbyfields:='';
   getdata;
     edt_WhCodeName.text:=AdoQry_Main.fieldbyname('whCodeName').ASSTRING;//仓库
   edt_WhPosition.text:=AdoQry_Main.fieldbyname('WhPositionCode').asstring+' '+AdoQry_Main.fieldbyname('WhPositionName').asstring; //货位
   edt_BillType2CodeName.text:=AdoQry_Main.fieldbyname('BillType2CodeName').asstring;   //出库类型
   edt_Billno.text:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING;//单据号

   edt_OutType.text:=AdoQry_Main.fieldbyname('OutType').ASSTRING; //出库对象
   edt_OutCode.text:=AdoQry_Main.fieldbyname('OutCode').ASSTRING; //输入代码
   lbl_OutName.Caption:=AdoQry_Main.fieldbyname('OutName').ASSTRING; //名称
   lbl_Currency.Caption:=AdoQry_Main.fieldbyname('currencyName').asstring;
   edt_memo.text:=AdoQry_Main.fieldbyname('InvBillRemArk').ASSTRING; //备注
   medt_Date.text:=AdoQry_Main.fieldbyname('InvBilldate').asstring;  //日期
   lbl_InvBillrate.Caption:=AdoQry_Main.fieldbyname('InvBillTaxRate').asstring+' %';//税率
   if(not ShowExtendColumn)then
   begin
       lbl_InvBillValuationtitle.Visible:=False;
       lbl_InvBillratetitle.Visible:=False;
       lbl_InvBillrate.Visible:=False ;
  end ;
end;
procedure TFrm_Inv_OtherInBillQry.Act_PreviewExecute(Sender: TObject);
begin
 //inherited;
 BillPrint(AdoQry_Tmp.Connection,GetCode(Edt_WhCodeName.Text),Edt_BillNo.text,RecTypeCode,ModuleCode,True,False,True,'');

end;

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

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

end.

⌨️ 快捷键说明

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