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

📄 inv_invcompare.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Inv_InvCompare;
{程序员:}
Interface

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

Type
  TFrm_Inv_InvCompare = Class(TFrm_Base_Qry)
    procedure Act_FilterExecute(Sender: TObject);
    procedure DBGridEhDblClick(Sender: TObject);
    procedure Act_LookExecute(Sender: TObject);
  private
    tmp_Showclumns:string;
    procedure SendDataToForm;
    { Private declarations }
  public
    { Public declarations }
    procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);Override;
    procedure getData;Override;
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
  end;

var
  Frm_Inv_InvCompare: TFrm_Inv_InvCompare;

implementation

uses Inv_InvCompare_C,Sys_Global, Inv_InvCompareList;
{$R *.DFM}

procedure TFrm_Inv_InvCompare.getData;
begin
  AdoQry_Main.Close;
  AdoQry_Main.sql.clear;
  AdoQry_Main.sql.text:=condition;
  AdoQry_Main.Open;
end;


procedure TFrm_Inv_InvCompare.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
  inherited;
  Frm_Sys_Condition:=TFrm_Inv_InvCompare_C.Create(Self);
  TFrm_Inv_InvCompare_C(Frm_Sys_Condition).InitForm(UserCode,ModuleCode,LoginDate);
  Act_Filter.Execute;

end;

procedure TFrm_Inv_InvCompare.SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);
begin
  inherited;
  //把参数从CONDITION窗体中传过来
  tmp_Showclumns:=FrmParam1;
end;

procedure TFrm_Inv_InvCompare.Act_FilterExecute(Sender: TObject);
begin
  inherited;
  if tmp_Showclumns='True' then
  begin
    lbl_Order.Caption:='日期,物料标识,参考码,单据类型';
    with dbgrideh do
    begin
      columns.clear;
      Columns.Add;
      Columns[0].FieldName:='tdate';
      Columns[0].Width:=70;
      Columns[0].Title.Caption:='日期';
      columns[0].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[1].FieldName:='ItemCodeName';
      Columns[1].Width:=280;
      Columns[1].Title.Caption:='物料标识';
      columns[1].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[2].FieldName:='ItemCode2';
      Columns[2].Width:=70;
      Columns[2].Title.Caption:='参考码';
      columns[2].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[3].FieldName:='BillTypeName';
      Columns[3].Width:=120;
      Columns[3].Title.Caption:='单据类型';
      columns[3].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[4].FieldName:='newBillqty';
      Columns[4].Width:=70;
      Columns[4].Title.Caption:='新系统数量';
      columns[4].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[5].FieldName:='oldBillqty';
      Columns[5].Width:=70;
      Columns[5].Title.Caption:='旧系统数量';
      columns[5].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[6].FieldName:='Compareqty';
      Columns[6].Width:=70;
      Columns[6].Title.Caption:='差异数量';
      columns[6].title.Alignment:=(taCenter);
    end;
  end
  else
  begin
    lbl_Order.Caption:='物料标识,参考码,单据类型';
    with dbgrideh do
    begin
      columns.clear;
      Columns.Add;
      Columns[0].FieldName:='ItemCodeName';
      Columns[0].Width:=360;
      Columns[0].Title.Caption:='物料标识';
      columns[0].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[1].FieldName:='ItemCode2';
      Columns[1].Width:=60;
      Columns[1].Title.Caption:='参考码';
      columns[1].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[2].FieldName:='BillTypeName';
      Columns[2].Width:=120;
      Columns[2].Title.Caption:='单据类型';
      columns[2].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[3].FieldName:='newBillqty';
      Columns[3].Width:=70;
      Columns[3].Title.Caption:='新系统数量';
      columns[3].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[4].FieldName:='oldBillqty';
      Columns[4].Width:=70;
      Columns[4].Title.Caption:='旧系统数量';
      columns[4].title.Alignment:=(taCenter);
      Columns.Add;
      Columns[5].FieldName:='Compareqty';
      Columns[5].Width:=70;
      Columns[5].Title.Caption:='差异数量';
      columns[5].title.Alignment:=(taCenter);
    end;
  end;
end;

procedure TFrm_Inv_InvCompare.SendDataToForm;
var
  tmp_BillTypeCode,tmp_BillTypeName:string;
  tmp_ItemCode:string;
  tmp_Item:string;
  tmp_Date:string;
begin
  if AdoQry_Main.Eof then
    DispInfo('没有可用的单据!   ',3)
  else
    begin
      with AdoQry_tmp do
      begin
        Close;
        sql.clear;
        if (AdoQry_Main.fieldbyname('BillTypeCode').asstring='0101') then
        sql.Add('select Count(*) as record '+
                ' from InvInBill i,InvInBillline il'+
                ' where i.InvBilldate='''+AdoQry_Main.fieldbyname('tdate').asstring+''''+
                '   and (i.BillTypeCode=''0101'' or i.BillTypeCode=''0102'') '+
                '   and  i.InvBillid=il.InvBillid '+
                '   and  il.ItemCode='''+AdoQry_Main.fieldbyname('ItemCode').asstring+'''')
        else if (AdoQry_Main.fieldbyname('BillTypeCode').asstring='0103') then
        sql.Add('select Count(*) as record '+
                ' from InvInBill i,InvInBillline il'+
                ' where i.InvBilldate='''+AdoQry_Main.fieldbyname('tdate').asstring+''''+
                '   and  i.BillTypeCode=''0103'' '+
                '   and  i.InvBillid=il.InvBillid '+
                '   and  il.ItemCode='''+AdoQry_Main.fieldbyname('ItemCode').asstring+'''')
        else if (AdoQry_Main.fieldbyname('BillTypeCode').asstring='0201') then
        sql.Add('select Count(*) as record '+
                ' from InvOutBill o,InvOutBillline ol'+
                ' where o.InvBilldate='''+AdoQry_Main.fieldbyname('tdate').asstring+''''+
                '   and o.BillTypeCode=''0201''  '+
                '   and o.InvBillwhchck=1 '+
                '   and o.InvBillid=ol.InvBillid '+
                '   and  ol.ItemCode='''+AdoQry_Main.fieldbyname('ItemCode').asstring+'''')
        else
        sql.Add('select Count(*) as record '+
                ' from InvOutBill o,InvOutBillline ol'+
                ' where o.InvBilldate='''+AdoQry_Main.fieldbyname('tdate').asstring+''''+
                '   and o.BillTypeCode=''0202''  '+
                '   and o.InvBillid=ol.InvBillid '+
                '   and ol.ItemCode='''+AdoQry_Main.fieldbyname('ItemCode').asstring+'''');
        open;
        if fieldbyname('record').asinteger=0 then
        begin
          DispInfo('新系统没有相对应的记录!',1);
          abort;
        end;
      end;
      //创建窗体
      Application.CreateForm(TFrm_Inv_InvCompareList,Frm_Inv_InvCompareList);
      //传递变量
      tmp_Date:=AdoQry_Main.fieldbyname('tdate').asstring;
      tmp_BillTypeCode:=AdoQry_Main.fieldbyname('BillTypeCode').asstring;
      tmp_ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
      tmp_Item:=AdoQry_Main.fieldbyname('ItemCodeName').asstring;
      tmp_BillTypeName:=AdoQry_Main.fieldbyname('BillTypeName').asstring;
      Frm_Inv_InvCompareList.Getvar(tmp_Date,tmp_BillTypeCode,tmp_ItemCode,tmp_Item,tmp_BillTypeName);
      //显示信息
      Frm_Inv_InvCompareList.InitForm(AdoQry_Main.Connection,False);
    end;
end;

procedure TFrm_Inv_InvCompare.DBGridEhDblClick(Sender: TObject);
begin
  inherited;
   if tmp_Showclumns='True' then
   SendDataToForm;
end;

procedure TFrm_Inv_InvCompare.Act_LookExecute(Sender: TObject);
begin
  inherited;
  if tmp_Showclumns='True' then
    SendDataToForm;
end;

end.

⌨️ 快捷键说明

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