Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Impresión (https://www.clubdelphi.com/foros/forumdisplay.php?f=4)
-   -   Generacion de Reportes en blanco Rave Reports (https://www.clubdelphi.com/foros/showthread.php?t=87210)

martini002 28-11-2014 23:41:09

Generacion de Reportes en blanco Rave Reports
 
Hola amigos,

Tengo un pequeño inconveniente, no se porque razon cuando envio el reporte para su generacion,
este sale totalmente en blanco?, no es la primera vez que los hago, de hecho estoy
bastante familiarizado con rave, pero esta vez o me fallo o le falle :S
podrian echarle un ojito al codigo y decirme si hay algo malo?
El reporte ya esta construido y diseñado, las propiedades del dataview y el databand estan
establecidas, de hecho, lo puedo ver ya generado desde el diseñador de rave.

Saludos.

Código Delphi [-]
procedure TFormPrincipal.ImprimirReporteDeNomina(FechaCorte:String);
var
  DireccionMisDocumentos,A:String;
  Año, Mes, Dia:Word;
  I:Integer;
  MyFields: array of TField;
  Temf: TStringField;
  DataView: TRaveBaseDataView;
  myPage:TRavePage;
  MyDataText:TRaveDataText;
  MyText:TRaveText;
  //MyPage2:TRavePage;
  nMarginBottom, nMarginLeft, nMarginRight, nMarginTop: Double;
begin
  with RvProject1 do
    begin
      SetLength(FechaCorte,10);

      //A:=GetCurrentDir()+'\Data\NOMREP1.rav';
      ProjectFile:=GetCurrentDir()+'\Data\NOMREP1.rav';
      Open;
      //LoadFromFile(GetCurrentDir()+'\Data\NOMREP1.rav');
      //StoreRAV:=True;
      //ZQuery1.Fields.Clear;
      //ZQuery1.Fields.Clear;
      ZQuery1.Close;
      ZQuery1.SQL.Clear;
      ZQuery1.SQL.Add('Select');
      ZQuery1.SQL.Add('NumeroEmpleado,');
      ZQuery1.SQL.Add('Cargo,');
      ZQuery1.SQL.Add('Nombre,');
      ZQuery1.SQL.Add('Apellido,');
      ZQuery1.SQL.Add('Format(Cedula,0),');
      ZQuery1.SQL.Add('Ingreso,');
      ZQuery1.SQL.Add('Format(SalarioMensual,2),');
      ZQuery1.SQL.Add('Format(SalarioDiario,2),');
      ZQuery1.SQL.Add('Format(CTDiario,2),');
      ZQuery1.SQL.Add('DiasTrabajados,');
      ZQuery1.SQL.Add('DiasLibres,');
      ZQuery1.SQL.Add('CT,');
      ZQuery1.SQL.Add('Ausencias,');
      ZQuery1.SQL.Add('Format(SSO,2),');
      ZQuery1.SQL.Add('Format(RPE,2),');
      ZQuery1.SQL.Add('Format(FAOV,2),');
      ZQuery1.SQL.Add('Format(TotalSueldo,2),');
      ZQuery1.SQL.Add('Format(TotalSanciones,2),');
      ZQuery1.SQL.Add('Format(TotalCT,2),');
      ZQuery1.SQL.Add('Format(TotalDiasLibres,2),');
      ZQuery1.SQL.Add('Format(TotalAusencias,2),');
      ZQuery1.SQL.Add('Format(TotalAsignaciones,2),');
      ZQuery1.SQL.Add('Format(TotalDeducciones,2),');
      ZQuery1.SQL.Add('Format(TotalCobrar,2)');
      ZQuery1.SQL.Add('From Constructor.ZRepNom');
      ZQuery1.Open;
      ZQuery1.Close;

      SetLength(MyFields, ZQuery1.FieldDefs.Count);
      //Add one by one the fields to make them accesible.
      for i:=0 to ZQuery1.FieldDefs.Count - 1 do
        MyFields[i] := ZQuery1.FieldDefs[i].CreateField(ZQuery1);
      //Create all Calculated Fields as you need
      Temf := TStringField.Create(nil);
      Temf.FieldKind := fkCalculated;
      //Temf.FieldName := 'NewCalcField';

      Open;

      With ProjMan do
        begin
          Dataview := FindRaveComponent('DataView1',nil) as TRaveBaseDataView;
          CreateFields(DataView, nil, nil, true); // refresh the dataview
        end;

      Open;
      With ProjMan do
        begin
          MyPage := FindRaveComponent('Report1.Page1',nil) as TRavePage;
          MyText := FindRaveComponent('FECHACORTE',MyPage) as TRaveText;
          MyText.Text:=FechaCorte;
        end; { with }

      Open;

      Save;
      {
      with IACProyectUnidades.ProjMan do
        begin
          nMarginBottom := 0.5;
          nMarginLeft := 0.5;
          nMarginRight := 0.5;
          nMarginTop := 0.5;
        end;
        }
      //seleccionamos el printer por defecto,
      //asi salen los reportes tal cual queremos
      //desde cualquier maquina con cualquier impresora
      RpDev.SelectPrinter('microsoft xps document writer', False );
      DireccionMisDocumentos:=GetMyDocuments;
      if Not (DirectoryExists(DireccionMisDocumentos+'\Informes Luminatti\Nomina')) then
        CreateDir(DireccionMisDocumentos+'\Informes Luminatti\Nomina');
      //Label4.Caption:= 'Generando Reporte...';
      RvSystem1.DefaultDest := rdFile;
      RvSystem1.DoNativeOutput := false;
      RvSystem1.RenderObject := RvRenderPDF1;
      RvSystem1.OutputFileName := DireccionMisDocumentos+'\Informes Luminatti\Nomina\['+NOMREPMes.Text+' '+FechaCorte+']Reporte de Nómina.pdf';
      RvSystem1.SystemSetups := RvSystem1.SystemSetups - [ssAllowSetup];
      //ZConnection1.Connected:=False;
      RvSystem1.Execute;
      //Label4.Caption:= 'Reporte Generado!';
      ShellExecute(FormPrincipal.Handle,nil,PChar(DireccionMisDocumentos+'\Informes Luminatti\Nomina\['+NOMREPMes.Text+' '+FechaCorte+']Reporte de Nómina.pdf'),'','',SW_SHOWMAXIMIZED);
    end;
end;

martini002 29-11-2014 18:53:39

Por cierto, esto es la version XE2


La franja horaria es GMT +2. Ahora son las 13:48:42.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi