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

📄 sfc_moinqry.pas

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

Interface

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

Type
  TFrm_Sfc_MoInQry = Class(TFrm_Base_Qry)
    Label1: TLabel;
    AdoQry_MainMoNo: TStringField;
    AdoQry_MainMoLineNo: TIntegerField;
    AdoQry_MainItemCodeName: TStringField;
    AdoQry_MainUomName: TStringField;
    AdoQry_MainQtyDiff: TFloatField;
    AdoQry_MainQtyDiffPercent: TStringField;
    AdoQry_MainAmountDiff: TFloatField;
    DBEdt_Item: TDBEdit;
    Label3: TLabel;
    AdoQry_MainMOQty: TFloatField;
    AdoQry_MainMoRealInQty: TFloatField;
    procedure Act_FilterExecute(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Act_PreviewExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
    procedure Act_ExcelExecute(Sender: TObject);
  private
    FStArtMoNo,FendMoNo,FDeptCode :String;
    FLineStatus :Integer;
    { Private declarations }
  public
    procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
    { Public declarations }
  end;

var
  Frm_Sfc_MoInQry: TFrm_Sfc_MoInQry;

implementation
Uses Sfc_MoInQry_C;
{$R *.DFM}

{ TFrm_Sfc_MoOutQry }

procedure TFrm_Sfc_MoInQry.InitForm(AdOConnection: TAdOConnection;
  ShowExtendColumn: Boolean);
begin
  inherited;
   Application.CreateForm(TFrm_Sfc_MoInQry_C,Frm_Sfc_MoInQry_C);
   Act_Filter.Execute;
end;

procedure TFrm_Sfc_MoInQry.Act_FilterExecute(Sender: TObject);
begin
//  inherited;
  Frm_Sfc_MoInQry_C.SetUserParam(Param1,Param2,Param3,Param4,Param5,Param6);
  Frm_Sfc_MoInQry_C.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
  Frm_Sfc_MoInQry_C.SetDBConnect(DBConnect);
  if Frm_Sfc_MoInQry_C.Showmodal=mrOk then
  begin
    Lbl_Condition.Caption:=Frm_Sfc_MoInQry_C.ConditionHint;
    FStArtMoNo:=Frm_Sfc_MoInQry_C.FStArtMoNo;
    FendMoNo:=Frm_Sfc_MoInQry_C.FendMoNo;
    FDeptCode:=Frm_Sfc_MoInQry_C.FDeptCode;
    FLineStatus:=Frm_Sfc_MoInQry_C.FLineStatus;
    SelectFromSql:=' select ML.MoNo,ML.MoLineNo, '+
                   '   ML.ItemCode+'' ''+Item.ItemName as ItemCodeName, '+
                   '   Uom.UomName,ML.MOQty, '+
                   '   ML.MoRealInQty,ML.MoRealInQty-(ML.MOQty) QtyDiff, '+
                   ' case '+
                   '   when ML.MOQty<>0 then Convert(varchAr(20),(ML.MoRealInQty-ML.MOQty)/ML.MOQty*100) '+
                   ' else ''--'''+
                   ' end QtyDiffPercent,  '+
                   '   Round(((ML.MoRealInQty-(ML.MOQty))*SP.SPPrice),2) AmountDiff  '+
                   ' from MoLine ML '+
                   'Left Join '+
                   ' (select SP.ItemCode,SP.SPPrice '+
                   '    from StandardPrice SP,MO '+
                   '    where MO.MONo='''+FendMoNo+''' and '+
                   '      Year(MO.MODate)+Month(MO.MODate)=Year(SP.SPStArtMonth+''.01'')+Month(SP.SPStArtMonth+''.01'')) SP '+
                   '    On ML.ItemCode=SP.ItemCode '+
                   ' Join Item on Item.ItemCode=Ml.ItemCode '+
                   ' Join Uom on Item.UomCode=Uom.UomCode '+
                   ' join MO '+
                   ' on (MO.MONo between '''+FStArtMoNo+''' and '''+FendMoNo+''') and '+
                   ' MO.DeptCode='''+FDeptCode+''' and '+
                   ' ML.MoNO=MO.MoNo and '+
                   ' ML.MoLineStatus>='+IntToStr(FLineStatus);
    OrderByFields:='MONO,MoLineNO';
    Lbl_Condition.Caption:=Frm_Sfc_MoInQry_C.ConditionHint;
    GetData;
  end;

end;

procedure TFrm_Sfc_MoInQry.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Sfc_MoInQry_C.Release;
end;

procedure TFrm_Sfc_MoInQry.Act_PreviewExecute(Sender: TObject);
begin
  If AdoQry_Main.IsEmpty then Exit;
  inherited;

end;

procedure TFrm_Sfc_MoInQry.Act_PrintExecute(Sender: TObject);
begin
  If AdoQry_Main.IsEmpty then Exit;
  inherited;

end;

procedure TFrm_Sfc_MoInQry.Act_ExcelExecute(Sender: TObject);
begin
  If AdoQry_Main.IsEmpty then Exit;
  inherited;

end;

end.

⌨️ 快捷键说明

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