Hi, I've created a report, it prints to screen, printer and I can save manually to a file, but I cannot automate it, despite being able to do exactly what I want in the last program I wrote. I cannot see where I'm going wrong. Here's the code, and a screenshot of the variables output:
METHOD OKButton( ) CLASS EditInvoice
Local oReport as RpReport
Local cFileName, cWorkDir,cMessage, cStr as String
Local nInv, cCaption
nInv := self:Server:FIELDGET(#INVNO)
If gTermDays == 0
gDueDate := FT_LDay(Today())
else
gDueDate := Today() + gTermDays
end if
// Bill To fields
self:Server:FIELDPUT(#MAILADD1, AllTrim(self:oDCMAILADD1:CurrentText))
self:Server:FIELDPUT(#MAILADD2, AllTrim(self:oDCMAILADD2:CurrentText))
self:Server:FIELDPUT(#MAILSUBURB, AllTrim(self:oDCMAILSUBURB:CurrentText))
self:Server:FIELDPUT(#MAILPCODE, AllTrim(self:oDCMAILPCODE:CurrentText))
self:Server:FIELDPUT(#MAILSTATE, AllTrim(self:oDCMAILSTATE:CurrentText))
self:Server:FIELDPUT(#CLNAME, AllTrim(self:oDCCLNAME:CurrentText))
self:Server:FIELDPUT(#INVDATE, self:oDCInvDateDTP:SelectedDate)
self:Server:FIELDPUT(#INVDUE, self:oDCDateTimePicker1:SelectedDate)
self:Server:FIELDPUT(#CLIENTREF, self:oDCCLIENTREF:CurrentText)
// Line 1
self:Server:FIELDPUT(#ITEM1, AllTrim(self:oDCComboBoxEx1:CurrentItem))
self:Server:FIELDPUT(#TAXTYPE1, iif(IsNil(self:oDCComboBoxEx11:VALUE), "", self:oDCComboBoxEx11:VALUE))
self:Server:FIELDPUT(#ACC1, AllTrim(self:oDCComboBoxEx21:CurrentItem))
self:Server:FIELDPUT(#UNITPR1, self:oDCUNITPR1:VALUE)
self:Server:FIELDPUT(#QTY1, self:oDCQTY1:VALUE)
self:Server:FIELDPUT(#GST1, self:oDCSingleLineEdit37:VALUE)
self:Server:FIELDPUT(#TOTPR1, self:oDCTOTPR1:VALUE)
self:Server:FIELDPUT(#LINE1, self:oDCLINE1:CurrentText)
self:Server:Commit()
// Line 2
self:Server:FIELDPUT(#ITEM2, self:oDCComboBoxEx2:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE2, iif(IsNil(self:oDCComboBoxEx12:VALUE), "", self:oDCComboBoxEx12:VALUE))
self:Server:FIELDPUT(#ACC2, self:oDCComboBoxEx22:CurrentItem)
self:Server:FIELDPUT(#UNITPR2, self:oDCUNITPR2:VALUE)
self:Server:FIELDPUT(#QTY2, self:oDCQTY2:VALUE)
self:Server:FIELDPUT(#GST2, self:oDCSingleLineEdit38:VALUE)
self:Server:FIELDPUT(#TOTPR2, self:oDCTOTPR2:VALUE)
self:Server:FIELDPUT(#LINE2, self:oDCLINE2:CurrentText)
self:Server:Commit()
// Line 3
self:Server:FIELDPUT(#ITEM3, self:oDCComboBoxEx3:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE3, iif(IsNil(self:oDCComboBoxEx13:VALUE), "", self:oDCComboBoxEx13:VALUE))
self:Server:FIELDPUT(#ACC3, self:oDCComboBoxEx23:CurrentItem)
self:Server:FIELDPUT(#UNITPR3, self:oDCUNITPR3:VALUE)
self:Server:FIELDPUT(#QTY3, self:oDCQTY3:VALUE)
self:Server:FIELDPUT(#GST3, self:oDCSingleLineEdit39:VALUE)
self:Server:FIELDPUT(#TOTPR3, self:oDCTOTPR3:VALUE)
self:Server:FIELDPUT(#LINE3, self:oDCLINE3:CurrentText)
self:Server:Commit()
// Line 4
self:Server:FIELDPUT(#ITEM4, self:oDCComboBoxEx4:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE4, iif(IsNil(self:oDCComboBoxEx14:VALUE), "", self:oDCComboBoxEx14:VALUE))
self:Server:FIELDPUT(#ACC4, self:oDCComboBoxEx24:CurrentItem)
self:Server:FIELDPUT(#UNITPR4, self:oDCUNITPR4:VALUE)
self:Server:FIELDPUT(#QTY4, self:oDCQTY4:VALUE)
self:Server:FIELDPUT(#GST4, self:oDCSingleLineEdit40:VALUE)
self:Server:FIELDPUT(#TOTPR4, self:oDCTOTPR4:VALUE)
self:Server:FIELDPUT(#LINE4, self:oDCLINE4:CurrentText)
self:Server:Commit()
// Line 5
self:Server:FIELDPUT(#ITEM5, self:oDCComboBoxEx5:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE5, iif(IsNil(self:oDCComboBoxEx15:VALUE), "", self:oDCComboBoxEx15:VALUE))
self:Server:FIELDPUT(#ACC5, self:oDCComboBoxEx25:CurrentItem)
self:Server:FIELDPUT(#UNITPR5, self:oDCUNITPR5:VALUE)
self:Server:FIELDPUT(#QTY5, self:oDCQTY5:VALUE)
self:Server:FIELDPUT(#GST5, self:oDCSingleLineEdit41:VALUE)
self:Server:FIELDPUT(#TOTPR5, self:oDCTOTPR5:VALUE)
self:Server:FIELDPUT(#LINE5, self:oDCLINE5:CurrentText)
self:Server:Commit()
// Line 6
self:Server:FIELDPUT(#ITEM6, self:oDCComboBoxEx6:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE6, iif(IsNil(self:oDCComboBoxEx16:VALUE), "", self:oDCComboBoxEx16:VALUE))
self:Server:FIELDPUT(#ACC6, self:oDCComboBoxEx26:CurrentItem)
self:Server:FIELDPUT(#UNITPR6, self:oDCUNITPR6:VALUE)
self:Server:FIELDPUT(#QTY6, self:oDCQTY6:VALUE)
self:Server:FIELDPUT(#GST6, self:oDCSingleLineEdit42:VALUE)
self:Server:FIELDPUT(#TOTPR6, self:oDCTOTPR6:VALUE)
self:Server:FIELDPUT(#LINE6, self:oDCLINE6:CurrentText)
self:Server:Commit()
// Line 7
self:Server:FIELDPUT(#ITEM7, self:oDCComboBoxEx7:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE7, iif(IsNil(self:oDCComboBoxEx17:VALUE), "", self:oDCComboBoxEx17:VALUE))
self:Server:FIELDPUT(#ACC7, self:oDCComboBoxEx27:CurrentItem)
self:Server:FIELDPUT(#UNITPR7, self:oDCUNITPR7:VALUE)
self:Server:FIELDPUT(#QTY7, self:oDCQTY7:VALUE)
self:Server:FIELDPUT(#GST7, self:oDCSingleLineEdit43:VALUE)
self:Server:FIELDPUT(#TOTPR7, self:oDCTOTPR7:VALUE)
self:Server:FIELDPUT(#LINE7, self:oDCLINE7:CurrentText)
self:Server:Commit()
// Line 8
self:Server:FIELDPUT(#ITEM8, self:oDCComboBoxEx8:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE8, iif(IsNil(self:oDCComboBoxEx18:VALUE), "", self:oDCComboBoxEx18:VALUE))
self:Server:FIELDPUT(#ACC8, self:oDCComboBoxEx28:CurrentItem)
self:Server:FIELDPUT(#UNITPR8, self:oDCUNITPR8:VALUE)
self:Server:FIELDPUT(#QTY8, self:oDCQTY8:VALUE)
self:Server:FIELDPUT(#GST8, self:oDCSingleLineEdit44:VALUE)
self:Server:FIELDPUT(#TOTPR8, self:oDCTOTPR8:VALUE)
self:Server:FIELDPUT(#LINE8, self:oDCLINE8:CurrentText)
self:Server:Commit()
// Line 9
self:Server:FIELDPUT(#ITEM9, self:oDCComboBoxEx9:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE9, iif(IsNil(self:oDCComboBoxEx19:VALUE), "", self:oDCComboBoxEx19:VALUE))
self:Server:FIELDPUT(#ACC9, self:oDCComboBoxEx29:CurrentItem)
self:Server:FIELDPUT(#UNITPR9, self:oDCUNITPR9:VALUE)
self:Server:FIELDPUT(#QTY9, self:oDCQTY9:VALUE)
self:Server:FIELDPUT(#GST9, self:oDCSingleLineEdit45:VALUE)
self:Server:FIELDPUT(#TOTPR9, self:oDCTOTPR9:VALUE)
self:Server:FIELDPUT(#LINE9, self:oDCLINE9:CurrentText)
// Line 10
self:Server:FIELDPUT(#ITEM10, self:oDCComboBoxEx10:CurrentItem)
self:Server:FIELDPUT(#TAXTYPE10, iif(IsNil(self:oDCComboBoxEx20:VALUE), "", self:oDCComboBoxEx20:VALUE))
self:Server:FIELDPUT(#ACC10, self:oDCComboBoxEx30:CurrentItem)
self:Server:FIELDPUT(#UNITPR10, self:oDCUNITPR10:VALUE)
self:Server:FIELDPUT(#QTY10, self:oDCQTY10:VALUE)
self:Server:FIELDPUT(#GST10, self:oDCSingleLineEdit46:VALUE)
self:Server:FIELDPUT(#TOTPR10, self:oDCTOTPR10:VALUE)
self:Server:FIELDPUT(#LINE10, self:oDCLINE10:CurrentText)
self:Server:Commit()
cWorkDir := WorkDir() + "Invoices"
self:Server:Seek(nInv)
cFileName := ""
cFileName := cWorkDir + "Invoice "+ PadL(AllTrim(self:Server:FIELDGET(#INVNO)), 8, "0") + " from " + ProperA(AllTrim(gCompanyName)) + ".pdf"
cFileName := "'" + cFileName + "'"
cMessage := "Please Wait..."
cCaption := "Test"
oReport := RpReport{self, "LAINVOICE.RPT"}
oReport:SeekExpression := AllTrim(nInv)
oReport:SetVariableValue("gInvNo", AllTrim(nInv) )
oReport:SetVariableValue("gAdd1", gAdd1)
oReport:SetVariableValue("gAdd2", gAdd2)
oReport:SetVariableValue("gABN", StrTran(gABN, "-", " "))
oReport:SetVariableValue("gSuburb", gSuburb)
oReport:SetVariableValue("gState", gState)
oReport:SetVariableValue("gPCode", gPCode)
oReport:SetVariableValue("gEmail", gEmail)
oReport:SetVariableValue("gTermDays", gTermDays)
oReport:SetVariableValue("gEOMPlusDay", gEOMPlusDay)
oReport:SetVariableValue("cPhone", "Phone: " + AllTrim(gPhone))
oReport:SetVariableValue("cEmail", "Email: " + AllTrim(gEmail))
cStr := "Date Due: " + iif( gTermDays > 0, DToC(Today()+gTermDays), DToC(FT_LDay(Today()) + gEOMPlusDay))
oReport:SetVariableValue("gEOMStr", cStr)
oReport:PrintExport(cCaption ,cMessage, #RP_PDF, cFileName)
? "cCaption = " + cCaption
? "cMessage = " + cMessage
? "cFileName = " + cFileName
oReport:Close()
self:EndWindow()
RETURN nil
In the screenshot above, I've tried the file name (cFileName) with and without the ' at either end. No difference.
Any ideas please?
PDF File not being created
PDF File not being created - UPDATE!
OK, looks like it is to do with RpExport.dll somehow, as it doesn't export to ANY format. The file size is always 0kb. Surely if it was a programmatic thing it wouldn't print properly? And why does it work fine from my other program???
OK, NOW any ideas?
OK, NOW any ideas?
PDF File not being created
Try file name with NO SPACES... seen weird things relating to this.
Phil McGuinness
PDF File not being created - UPDATE!
Jeff,
Does the version of the export DLL match the version of the other RP dlls ?
Look at the tab 'Details'.
Robert
Does the version of the export DLL match the version of the other RP dlls ?
Look at the tab 'Details'.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
PDF File not being created
No spaces didn't work I'm afraid Phil, but thank you. I tried aTest.pdf no difference... As for the DLL versions Robert, they all say 2.30.1.0
After further investigation and testing, it appears the report itself is the culprit. Any ideas what may be causing it please? BMINVOICE WORKS, LAINVOICE does not. I also removed the image.... no difference....
After further investigation and testing, it appears the report itself is the culprit. Any ideas what may be causing it please? BMINVOICE WORKS, LAINVOICE does not. I also removed the image.... no difference....
- Attachments
-
- Reports.zip
- (5.82 KiB) Downloaded 70 times
PDF File not being created
I have now deleted EVERYTHING off the report - text, fields, boxes, image, everything. It still plays up. Now this error has started:
WTH does THAT mean please?
WTH does THAT mean please?
PDF File not being created
Hi Jeff,
"memory low" means exactly that - you have run out of memory.
Maybe you have some sort of loop in your code, or better, an inifinite recursion.
When I see this error, normally thatis the cause.
Wolfgang
P.S. I don't use nor know ReportPro, so I cannot give you any hint
"memory low" means exactly that - you have run out of memory.
Maybe you have some sort of loop in your code, or better, an inifinite recursion.
When I see this error, normally thatis the cause.
Wolfgang
P.S. I don't use nor know ReportPro, so I cannot give you any hint
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
PDF File not being created
Yeah thanks Wolfgang, It's totally got me beat. I fire up the program, click the screen to activate the listing, then click ok. That's it! I cannot for the life of me see any loop.
PDF File not being created
Jeff,
Send me the report and the data files.
I'll have a look tonight.
Robert
Send me the report and the data files.
I'll have a look tonight.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
PDF File not being created
Well, that didn't work out. BUT I now KNOW it's not my code. It's the Report itself causing all my grief. I can export other reports to pdf using my code, just not this one report, which is attached. Any ideas please? I suspect maybe the grouping???
- Attachments
-
- LAInvoice.zip
- (3.15 KiB) Downloaded 65 times