unit U_CheckJiPrint;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB, RM_Dataset, RM_e_Graphic, RM_e_bmp,
  RM_Common, RM_Class, RM_e_Xls, RM_System, RM_GridReport, DBClient;

type
  Tfrm_CheckJiPrint = class(TForm)
    RMGridReport1: TRMGridReport;
    RMXLSExport1: TRMXLSExport;
    RMBMPExport1: TRMBMPExport;
    RMDS_Main: TRMDBDataSet;
    ADOConnection1: TADOConnection;
    ADOQueryTmp: TADOQuery;
    BtylPrint: TButton;
    RMDB_Other: TRMDBDataSet;
    CDS_other: TClientDataSet;
    CDS_otherprinter: TStringField;
    CDS_otherprintdate: TDateField;
    CDS_otherWorkClass: TStringField;
    CDS_otherbegDate: TStringField;
    CDS_otherendDate: TStringField;
    procedure BtylPrintClick(Sender: TObject);
  private
    fPrintFile:string;
    procedure DoPrint();
  public
    fPrintModal:integer;
    fWorkClass:string; //班组
    fbegDate,fEndDate:string;
  end;

var
  frm_CheckJiPrint: Tfrm_CheckJiPrint;

implementation
uses
  U_global;
{$R *.dfm}
//////////////////////////////////////////////////////
  //
//////////////////////////////////////////////////////
procedure Tfrm_CheckJiPrint.DoPrint();
begin
  /////////////////////////////
  //处理备注信息显示
  CDS_Other.Close ;
  CDS_Other.CreateDataSet;
  with CDS_Other do
  begin
    Append;
    fieldByName('printDate').Value :=formatdateTime('yyyy-MM-dd',date());
    fieldByName('printer').value:=gusername;
    fieldByName('WorkClass').value:=fWorkClass;
    fieldByName('begDate').value:=fbegDate;
    fieldByName('endDate').value:=fendDate;
    Post;
  end;
   //////////////////////////////////////////////
  if trim(fPrintFile)='' then
    fPrintFile:='checkreport\成品检验记录表.rmf';
  with RMGridReport1 do
  begin
    LoadFromFile(ExtractFilePath(Application.ExeName)+fPrintFile);
    reportInfo.Title:=fPrintFile;
    Preview:=NIL;
    if fPrintModal=0 then
      ShowReport
    else
      PrintReport;
    end;
  self.Close ;
end;


procedure Tfrm_CheckJiPrint.BtylPrintClick(Sender: TObject);
begin
  DoPrint();
end;

end.
