Fotter location not always corect on report printout.
Posted
#1
(In Topic #1571)
Enthusiast

As I am running a lot of text based reports on my system I have come up with a way to create the reports myself (I am always open to how to do reports quicker if that means using the report.2 with in gambas then sure but someone will have to show me a example of how it works)
below is the full code from my "Current System Stock Price Report - **Active Product Only**" Report
Code (gambas)
- ' Gambas module file
- DisplayMessage &= "Processing Current Product Pricing" & gb.crlf
- DisplayMessage &= "for STOCK CONTROLED ENABLED Products" & gb.crlf
- DisplayMessage &= "only" & gb.crlf
- DisplayMessage &= gb.crlf
- DisplayMessage &= "Please wait..."
- frmProcesingRequest.labSystemMessage.Text = DisplayMessage
- frmbackground.Workspace1.Add(frmProcesingRequest, 0)
- Wait 0.01
- ReportNumberOfLineAvaliabe = ReportNumberOfLinesPerPage - 4
- ReportPageNumber = 1
- ProcessReport_CurrentStock(ReportType, UseStockControl)
- 'get all the Sale locations into memory so they can be looped through
- GetSaleLocations()
- Global.RowCount = 0
- SalelocationNumbers[Global.RowCount] = Global.BODataResult!deptnumber & "|" & Global.BODataResult!deptname
- Global.RowCount += 1
- GetDataFromDatabase(SalelocationNumbers, UseStockControl)
- BackOfficeReportModule.PrintReportFunction(ReportType, ReportName)
- SQLCommandLocal = Null
- SQLCommandLocal &= "Select "
- SQLCommandLocal &= "barcodenumber, "
- SQLCommandLocal &= "UPPER(posdescription) as posdescription, "
- SQLCommandLocal &= "LPAD(salelocation, 4, '0') as salelocation, "
- SQLCommandLocal &= "concat('£', format(retailprice,2)) as retailprice "
- SQLCommandLocal &= "from producttable "
- SQLCommandLocal &= "AND itemstatus ='1' "
- SQLCommandLocal &= "ORDER BY barcodenumber ASC;"
- StkLe = "OPEN"
- StkLe = Global.BODataResult!retailprice
- PrintDeptProducts(SysID, PoSDe, StkLe)
- .ReportNumberOflinesUsed += 1
- 'reset the line count - start a new page
- PadToEndOfPage ' * UPDATED: Pad lines before footer
- BackOfficeReportModule.SetReportFooter(frmbackground.labUserName.Caption, "Page " & .ReportPageNumber)
- .ReportNumberOflinesUsed = 0
- .ReportPageNumber += 1
- PrintDeptProducts(SysID, PoSDe, StkLe)
- .ReportNumberOflinesUsed += 1
- .BackOfficeReportData &= "~"
- PadToEndOfPage ' * UPDATED: Pad remaining lines before final footer
- BackOfficeReportModule.SetReportFooter(frmbackground.labUserName.Caption, "Page " & .ReportPageNumber)
- .BackOfficeReportData &= ReportHeader & "~"
- PrintDeptProducts("PRODUCT", "POS", "SYSTEM")
- PrintDeptProducts("BARCODE", "DESCRIPTION", "PRICE")
- .ReportNumberOflinesUsed += 5
- frmProcesingRequest.labSystemMessage2.Caption = SystemID & " " & PoSDescription
- frmProcesingRequest.Refresh
- Wait 0.001
- Global.BackOfficeQuery &= "Select "
- Global.BackOfficeQuery &= "deptnumber, "
- Global.BackOfficeQuery &= "UPPER(deptname) as deptname "
- Global.BackOfficeQuery &= "from salelocationtable "
- Global.BackOfficeQuery &= "order by deptnumber ASC;"
- Global.BackOfficeQuery &= "Select "
- Global.BackOfficeQuery &= "deptnumber, "
- Global.BackOfficeQuery &= "UPPER(deptname) as deptname "
- Global.BackOfficeQuery &= "from salelocationtable "
- Global.BackOfficeQuery &= "order by deptnumber ASC;"
- .BackOfficeReportData &= "~"
- .ReportNumberOflinesUsed += 1
This is the output from the above code https://algpos.co.uk/pdf/ReportV2_noformating.pdf
the Footer is not always being aligned at the bottom of the page
I would like the reports to look like this https://algpos.co.uk/pdf/ReportV2.pdf
I have been looking at this all week and I am hoping a fresh set of eyes can see where I have gone wrong. and Show me what I am missing (as I am sure it is Something VERY simple that I am overlooking)
Kind Regards to all who help me
Andrew
Posted
Trainee
In your routine, PadToEndOfPage() dont you have to compare with ReportNumberOfLineAvaliabe .
Regards
Posted
Enthusiast

gbAmainie said
Hi
In your routine, PadToEndOfPage() dont you have to compare with ReportNumberOfLineAvaliabe .
Regards
I'm not sure to be honest I have gotten myself into a right mix up
Here are my basics I started with
I can get 79 lines in total on the A4 page
my header always uses 5 lines (the one with the store name and report type on it) and the footer always uses 2 line.
so in my mind I have 72 lines i can use for the report (79 - 5 - 2 = 72)
BUT i would love to have it not cut the items off half way for example
where it would start a new sub header (0001 etc)
I am more then happy to scrap this methold of report generating if someone know how to do a simpler one.
1 guest and 0 members have just viewed this.




