OPW fix for wrong pages number in reports

Fixes #744.
Please merge this patch provided by OPW, intended to fix a bug in the page numbering of some reports such as the stock inventory report in v7.0