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

📄 inv_otherout_h.pas

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

unit Inv_OtherOut_H;
//其它出库的表头单元
Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Entry_Head, Menus, Db, ActnList, AdODB, Grids, DBGridEh, StdCtrls,
  ExtCtrls, ComCtrls, ToolWin, jpeg, ExtPrintReport;

Type
  TFrm_Inv_OtherOut_H = Class(TFrm_Base_Entry_Head)
    AdoQry_HeadInvBillId: TBCDField;
    AdoQry_HeadWhCodeName: TStringField;
    AdoQry_HeadInvBillNo: TStringField;
    AdoQry_HeadInvBillDate: TDateTimeField;
    AdoQry_HeadBillType2CodeName: TStringField;
    AdoQry_HeadWhPositionName: TStringField;
    AdoQry_HeadOutType: TStringField;
    AdoQry_HeadOutCode: TStringField;
    AdoQry_HeadOutName: TStringField;
    AdoQry_HeadInvBillRemArk: TStringField;
    AdoQry_HeadPriceAdjustBill: TIntegerField;
    procedure Act_NewExecute(Sender: TObject);
    procedure Act_LookExecute(Sender: TObject);
  private
    BillTypeCode: String;
    HasNegative: String;
    { Private declarations }
  public
   Billlines:    integer;
   procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);OverRide;
    { Public declarations }
  end;

var
  Frm_Inv_OtherOut_H: TFrm_Inv_OtherOut_H;

implementation

uses Inv_OtherOut_B;

{$R *.DFM}

{ TFrm_Inv_OtherOut_H }

procedure TFrm_Inv_OtherOut_H.InitForm(AdOConnection: TAdOConnection;
  ReadOnly: Boolean);
begin  //初始化窗体过程
  inherited;
  BillTypeCode:=Param1;
  //设置AdoQry_Main的SQL
  SelectFromSql:='select B.InvBillId ,'+
        'B.WhCode+'''+' '+'''+Warehouse.WHName As WhCodeName, '+
        'B.InvBillNo, '+
        'B.InvBillDate, '+
        'B.InvBillRemArk,'+
        'B.PriceAdjustBill,'+
        'B.BillType2Code+'''+' '+'''+BillType2.BillType2Name As BillType2CodeName, '+
        'B.WhPositionCode+'''+' '+'''+WhPosition.WhPositionName As WhPositionName, '+
        'OutType= '+
           'case '+
               'when B.DeptCode is not null then '+'''部门'''+
               'when B.customerCode is not null then '+ '''客户'''+
               'when B.VendorCode is not null then '+'''供应商'''+
               'else  '''+''''+
           'end, '+
        'OutCode= '+
           'case '+
               'when B.DeptCode is not null then B.DeptCode '+
               'when B.customerCode is not null then B.customerCode '+
               'when B.VendorCode is not null then B.VendorCode '+
               'else '''+''' '+
           'end, OutName= '+
            'case '+
                'when B.DeptCode is not null then D.DeptName '+
                'when B.customerCode is not null then C.customerName '+
                'when B.VendorCode is not null then V.VendorName '+
                'else '''+''' '+
            'end '+
    'from InvOutBill B '+
    'left join Dept D '+
        'on B.DeptCode=D.DeptCode '+
    'left join customer C '+
        'on B.customerCode=C.customerCode '+
    'left join Vendor V '+
        'on B.VendorCode=V.VendorCode '+
    'Join BillType2 on B.BillType2Code=BillType2.BillType2Code '+
    'Join WhPosition on (B.WhPositionCode=WhPosition.WhPositionCode) '+
    '               and (B.WhCode=WhPosition.WhCode) '+
    'Join Warehouse on (Warehouse.WhCode=B.WhCode) '+
    '  and (b.BillTypeCode='''+BillTypeCode+''')';
    //指定排序字段
    OrderByFields:='WhCodeName,InvBillNo';
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Add('select BillLines from BillType where BillTypeCode='''+BillTypeCode+'''');
      open;
      Billlines:=fieldbyname('Billlines').asinteger;
      Billlines:=10000;
    end;
   ConditionUserDefine:=' B.InvBillMonth='''+copy(datetostr(date),1,7)+''' and b.opBill=0 and '+
              ' b.WHCode In '+
              ' (Select WHCode From WHAccessCtrl Where EmployeeCode='''+UserCode+''') ';

   //打开QryMain
   GetData;
   //BODY窗体的创建
   Frm_Entry_Body:=TFrm_Inv_OtherOut_B.Create(self);
end;

procedure TFrm_Inv_OtherOut_H.Act_NewExecute(Sender: TObject);
var
  Book1:TBookMArk;
begin
  Param2:='NONE';
  Book1:=AdoQry_Head.GetBookmArk;
  inherited;
  AdoQry_Head.GotoBookmArk(Book1);
  AdoQry_Head.FreeBookmArk(Book1);
end;

procedure TFrm_Inv_OtherOut_H.Act_LookExecute(Sender: TObject);
begin
  //明细查询的条件设置
  if AdoQry_Head.fieldbyname('InvBillId').Asstring='' then abort;
  With AdoQry_Tmp do
  begin
    Close;
    Sql.clear;
    Sql.Add('select Count(*) As RecCount '+
             ' from InvOutBillLine '+
             ' where InvBillId='+AdoQry_Head.fieldbyname('InvBillId').Asstring+
             ' and InvBillQty<0');
    Open;
    If fieldbyname('RecCount').AsInteger>0 Then
      HasNegative:='Yes'
    Else
    begin
      Close;
      Sql.clear;
      Sql.Add('select Count(*) As RecCount '+
             ' from InvOutBillLine '+
             ' where InvBillId='+AdoQry_Head.fieldbyname('InvBillId').AsString+
             ' and InvBillQty>0');
      Open;
      If fieldbyname('RecCount').AsInteger>0 Then
          HasNegative:='No'
      Else
          HasNegative:='NONE';
    end;
    Param2:=HasNegative;
  end;
  inherited;
end;

end.

⌨️ 快捷键说明

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