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;
nMarginBottom, nMarginLeft, nMarginRight, nMarginTop: Double;
begin
with RvProject1 do
begin
SetLength(FechaCorte,10);
ProjectFile:=GetCurrentDir()+'\Data\NOMREP1.rav';
Open;
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);
for i:=0 to ZQuery1.FieldDefs.Count - 1 do
MyFields[i] := ZQuery1.FieldDefs[i].CreateField(ZQuery1);
Temf := TStringField.Create(nil);
Temf.FieldKind := fkCalculated;
Open;
With ProjMan do
begin
Dataview := FindRaveComponent('DataView1',nil) as TRaveBaseDataView;
CreateFields(DataView, nil, nil, true); end;
Open;
With ProjMan do
begin
MyPage := FindRaveComponent('Report1.Page1',nil) as TRavePage;
MyText := FindRaveComponent('FECHACORTE',MyPage) as TRaveText;
MyText.Text:=FechaCorte;
end;
Open;
Save;
RpDev.SelectPrinter('microsoft xps document writer', False );
DireccionMisDocumentos:=GetMyDocuments;
if Not (DirectoryExists(DireccionMisDocumentos+'\Informes Luminatti\Nomina')) then
CreateDir(DireccionMisDocumentos+'\Informes Luminatti\Nomina');
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];
RvSystem1.Execute;
ShellExecute(FormPrincipal.Handle,nil,PChar(DireccionMisDocumentos+'\Informes Luminatti\Nomina\['+NOMREPMes.Text+' '+FechaCorte+']Reporte de Nómina.pdf'),'','',SW_SHOWMAXIMIZED);
end;
end;