Charly lo que hago es generar el reporte con FastReport desde un programa externo, el mismo fuente que el programa desktop
el fuente
Code: Select all | Expand
cFilePdf := cNewFileName( cPath, "PDF" )
cPArame := "D:\APL\PRGS\HARBOUR\REPORTE\dbf\wcta.exe SALDOCLI "+cFileTemp+" "+cCdxTemp + " "+cFilePdf
RUN (cParame)
fErase(cFileTemp ) ; fErase( cCdxTemp )
cFilePdf := cFileNoPath( cFilePdf )
hResponse := { 'success' => .t., 'rows' => aRows, 'buscar' => cRutCli, 'len' => len( aRows), 'nomcli' => cNomCli, 'cFileTempPdf' => cFilePdf }
AdsDisconnect()
aqui el programa externo
Code: Select all | Expand
#include "Fivewin.ch"
#include "Ads.ch"
#Define DRIVELOCAL DiskName() + ":\"+Curdir()
ANNOUNCE RDDSYS
static oApp, oWnd, nIdPanel := 0, cOldDir
Function Main( cOpcion, cFileTemp , cCdxTemp, cFilePdf )
local cPath := "C:\XAMPP\"
if pCount() < 4
return(0)
endif
cOldDir := DRIVELOCAL
DirChange( "D:\APL\PRGS\HARBOUR\REPORTE\dbf" )
do case
case cOpcion = "SALDOCLI"
TRY
cFileTemp := cPath+cFileTemp
cCdxTemp := cPath+cCdxTemp
cFilePdf := cPath+cFilePdf
SELE 0 ; USE PARAME NEW SHARED VIA "ADS"
SELE 0 ; USE PARAME2 INDEX PARAME2 NEW SHARED VIA "ADS"
SELE 0 ; USE TABLAS INDEX TABLAS NEW SHARED VIA "ADS"
SELE 0 ; USE CLIENTES INDEX CLIENTES NEW SHARED VIA "ADS" ALIAS "CLI"
SELE 0 ; USE (cFileTemp) NEW ALIAS TEMPO SHARED VIA "DBFCDX" INDEX (cCdxTemp)
Cli->( dbSeek( strTran( Tempo->rut_cli, ".", "" ) ) )
PrnSaldoCli(cFilePdf)
dbCloseAll()
fErase( cFileTemp )
fErase( cCdxTemp )
CATCH
END
endcase
DirChange( cOldDir )
Return Nil
//---------------------------------------------------------------------------------------------------------------------------
procedure PrnSaldoCli(cFilePdf)
local oFrPrn
PRIVATE MyVar := Parame->Logo
oFrPrn := frReportManager():new()
oFrPrn:LoadLangRes("spanish.xml")
oFrPrn:SetEventHandler("Report", "OnAfterPrint", {|ObjName|ShowProcess(ObjName,oFrPrn)})
oFrPrn:SetWorkArea("PAR", Select( "Parame" ) )
oFrPrn:SetWorkArea("PAR2", Select( "Parame2" ) )
oFrPrn:SetWorkArea("CLI", Select( "CLI" ) )
oFrPrn:SetWorkArea("TMP", Select( "TEMPO" ) )
oFrPrn:SetWorkArea("TAB", Select( "Tablas" ) )
oFrPrn:LoadFromFile("report\saldocli.fr3")
oFrPrn:SetIcon(2)
oFrPrn:SetTitle("Impresión..")
oFrPrn:PreviewOptions:SetButtons( 1+4+8+16+32+64+128+1024 )
oFrPrn:SetProperty("Page1", "PaperSize", 1)
oFrPrn:SetProperty("PDFExport", "FileName", cFilePdf )
oFrPrn:SetProperty("PDFExport", "EmbeddedFonts", .t.)
oFrPrn:SetProperty("PDFExport", "PrintOptimized", .t.)
oFrPrn:SetProperty("PDFExport", "Creator", "Sistema WEB-Invent")
oFrPrn:SetProperty("PDFExport", "OpenAfterExport", .f.)
oFrPrn:SetProperty("PDFExport", "ShowDialog",.f.)
oFrPrn:PrepareReport()
oFrPrn:DoExport("PDFExport")
oFrPrn:ClearDataSets()
oFrPrn:DestroyFR()
MyVar := NIL
return
//------------------------------------------------------------------------------------------------------------------------------
Function ShowProcess(sObjectName,oFrPrn)
local cColor, dDate := DATE(), nDias
if "TMP" $ sObjectName
sObjectName += ".Font"
if dDate > Tempo->Fec_Vto
if (nDias := dDate - Tempo->Fec_Vto) > 60
cColor := CLR_BLACK
elseif nDias <= 30
cColor := CLR_HRED
elseif nDias <= 60
cColor := CLR_MAGENTA
else
cColor := CLR_YELLOW
endif
else
if (nDias := Tempo->Fec_Vto - dDate ) <= 30
cColor := CLR_HBLUE
else
cColor := CLR_GREEN
endif
endif
oFrPrn:SetProperty(sObjectName, "Color", cColor )
endif
RETURN nil
Saludos
Patricio
__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl