Two of them work perfectly. The third however will not function correctly.
The first two simply grab data from a text file and insert the data into a dbf.
The third app is trying to create a PDF using the built-in FWH Report (Report oReport.....)
Has anyone ever tried doing something like this and had success ?
The app works perfectly if run as a regular program.
I've even tried running the app as a service via AlwaysUp and FireDeamon but no luck.
I added some logging info in my app and it looks like it never gets to the function "AddData()"
When run as a regular program my log file shows:
03/24/17 09:13:05*******CertusReports Started*****
03/24/17 09:13:05 Initial Timer Started
03/24/17 09:13:10 Function GenReport: Processing: 20170324085918677.txt
03/24/17 09:13:10 Function GenReport: Option: Date Confirmed, Site: ALL, From: 20170222, To: 20170324, RepFile: 20170324085918677.pdf
03/24/17 09:13:10 Function DoReport called
03/24/17 09:13:11 Function AddData called
03/24/17 09:13:14 *** Report Generated ***
When run as a service my log file shows:
03/24/17 09:11:33*******CertusReports Started*****
03/24/17 09:11:33 Initial Timer Started
03/24/17 09:11:38 Function GenReport: Processing: 20170324085918677.txt
03/24/17 09:11:38 Function GenReport: Option: Date Confirmed, Site: ALL, From: 20170222, To: 20170324, RepFile: 20170324085918677.pdf
03/24/17 09:11:38 Function DoReport called
Any ideas??
- Code: Select all Expand view RUN
Function DoReport(cNote)
PRIVATE oReport
oLog:Add(DTOC(Date())+" "+TIME()+" Function DoReport called")
DEFINE FONT oFontRep NAME "ARIAL" SIZE 0,-9
cSave := cRepFile
cSave2:= "C:\Certus\Temp\"+cRepFile
PRINTER oPrn FILE cSave2
REPORT oReport ; //PREVIEW ;
FONT oFontRep ;
HEADER ALLTRIM("Certus Management Report"+SPACE(20)+"Date: "+DTOC(DATE()))+" Time: "+Time(), ;
ALLTRIM(cSave), ;
ALLTRIM(cNote), ;
" " ;
CENTER ;
TITLE "";
LEFT;
FOOTER "Certus Management report" +Space(40) + ;
"Page Number: " + ALLTRIM(Str(oReport:nPage,3)) CENTER ;
TO DEVICE oPrn
COLUMN TITLE "Patient Name " DATA " " //GRID 1
COLUMN TITLE "Gender" DATA " " GRID 1
COLUMN TITLE "D.O.B. " DATA "" GRID 1
COLUMN TITLE "MRN / ID " DATA " " GRID 1
COLUMN TITLE "Reading Phy " DATA " " GRID 1
COLUMN TITLE "Referring Phy " DATA " " GRID 1
COLUMN TITLE "Type " DATA "" GRID 1
COLUMN TITLE "Test Date" DATA " " GRID 1
COLUMN TITLE "Days" DATA " " LEFT GRID 1
COLUMN TITLE "Imported" DATA " " LEFT GRID 1
COLUMN TITLE "Confirmed" DATA " " LEFT //GRID 1
ENDREPORT
ACTIVATE REPORT oReport on init AddData()
oFontRep:End()
CLOSE TESTDB
oLog:Add(DTOC(Date())+" "+TIME()+" *** Report Generated ***")
Return Nil
Function AddData()
LOCAL cText, nCol, nRow
oLog:Add(DTOC(Date())+" "+TIME()+" Function AddData called")
nRow := 1
nCol := 1
DO WHILE ! EOF()
oReport:StartLine()
oReport:Say(nCol, LEFT(ALLTRIM(TESTDB->Last)+", "+ALLTRIM(TESTDB->First),26) )
oReport:Say(nCol+1, LEFT(TESTDB->Gender,6) )
oReport:Say(nCol+2, LEFT(TESTDB->DOB,10) )
oReport:Say(nCol+3, LEFT(TESTDB->MRN,17) )
oReport:Say(nCol+4, LEFT(TESTDB->ATTDOC,18) )
oReport:Say(nCol+5, LEFT(TESTDB->REFDOC,25) )
oReport:Say(nCol+6, LEFT(TESTDB->TestType,6) )
oReport:Say(nCol+7, LEFT(TESTDB->TESTDATE,10) )
IF ! EMPTY(ALLTRIM(TESTDB->DateConf)) .and. ! EMPTY( STRTRAN(DTOC(TESTDB->ImportDate),"/",""))
dImportDate:= STOD(DTOS(TESTDB->IMPORTDATE))
dConfirmDate:= STOD(DTOS(CTOD(TESTDB->DATECONF)))
oReport:Say(nCol+8, ALLTRIM(STR( ABS(dConfirmDate - dImportDate) )))
ELSE
oReport:Say(nCol+8, "" )
ENDIF
oReport:Say(nCol+9, LEFT(DTOC(TESTDB->IMPORTDATE),8 ) )
oReport:Say(nCol+10, LEFT(TESTDB->DATECONF,8) )
oReport:EndLine()
nRow++
IF nRow = 55
oReport:EndPage()
nRow := 1
ENDIF
SKIP
ENDDO
Return Nil