Topic: PriceList printing bug

After choose Price List printing in Report/Analysis I can print price list at first time, but any data changes in database are not visible on next time display. This is because of javascript redirection to pdf file in reporting/pdf_file dir. The redirected file has no expiration limit set, so browser (Mozilla 1.7.8 in my case) get it from cache, not from server.
This bug is browser-dependent but as far as I know Mozilla is not the one suffred browser.

Re: PriceList printing bug

Hello,
We are aware of this. Can you point out a solution for this? It should probably be done in the include file /reporting/includes/pdf_report.inc.

Joe

3 (edited by itronics 12/29/2007 10:45:21 am)

Re: PriceList printing bug

Hi, joe
AFAIK there is simple way to do it in JS. Below are changes to pdf_report.inc which are simply and effective.

Regards
janusz

BTW. On the invoice printing there was reference text placed instead od invoice #. Below this mistake is removed too.
jd

--- /var/www/frontaccounting/reporting/includes/pdf_report.inc    2007-09-06 22:15:37.000000000 +0200
+++ /var/www/fa/reporting/includes/pdf_report.inc    2007-12-29 11:07:23.000000000 +0100
@@ -341,7 +341,7 @@
        else if ($doctype == 9) // SO
            $this->Text($mcol, $myrow['order_no'] ." ".$myrow['customer_ref'], $mcol + 90);
        else // INV/CRE/STA   
-            $this->Text($mcol, $myrow['reference'], $mcol + 90);
+            $this->Text($mcol, $myrow['trans_no'], $mcol + 90);
        $this->Text($mcol + 90, $myrow['debtor_no'], $mcol + 180);
        if ($doctype == 8 || $doctype == 9)
            $this->Text($mcol + 180, sql2date($myrow['ord_date']));
@@ -696,16 +696,13 @@
            }
            else
            {
-                echo '<html>
-                        <head>
-                            <SCRIPT LANGUAGE="JavaScript"><!--
-                          function go_now () { window.location.href = "'.$fname.'"; }
-                          //--></SCRIPT>
-                      </head>
-                      <body onLoad="go_now()"; >
-                        <a href="'.$fname.'">click here</a> if you are not re-directed.
-                      </body>
-                    </html>';
+
+                header('Content-type: application/pdf');
+                header('Content-Disposition: inline; filename=PriceListing.pdf');
+                header('Expires: 0');
+                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+                header('Pragma: public');
+                $this->Stream();
            }        
            // also have a look through the directory, and remove the files that are older than a week
            // rather want to save 'em

Re: PriceList printing bug

Hello,
Thanks. Regarding the Invoice No/Reference no. Most companies use their own number series for their Invoice Numbers (the Reference) instead of the autoincremented Invoice No. This is the reason that we chose to use the Reference instead. We could probably use a switch inside config.php for doing this.
Regarding your suggestions with directing the pdf, we have used this before, but had some problems with some browsers. This was the reason to use our own presentation. Are you sure that this is browser safe now? If you are, then we will try it again.

/Joe

Re: PriceList printing bug

joe wrote:

Regarding the Invoice No/Reference no. Most companies use their own number series for their Invoice Numbers (the Reference) instead of the autoincremented Invoice No. This is the reason that we chose to use the Reference instead. We could probably use a switch inside config.php for doing this.

Ok. This make sense, but most (if not all) fiscal autorithies require invoice numbers to be unique and sequential. Here manual edition can be source of legal problems. Most frequently invoice numbers consists serial number + any pre- or postfix. If I can suggest, optimal solution seems to be formating string defined in config.php (sth like "%d/2007"),  used to format default value, which can be edited. Anyway - now default value for field 'Invoice No.' on printing (from reference db field) ) is number of sales order which is not the adequate.

Regarding your suggestions with directing the pdf, we have used this before, but had some problems with some browsers. This was the reason to use our own presentation. Are you sure that this is browser safe now? If you are, then we will try it again.

I cannot guarantee that it will work in any browser (all my hw works on Linux), but JS version do not works at least for Mozilla. Version which I send is simply cut&paste from webERP and is well tested by their community smile.

Regards
janusz

Re: PriceList printing bug

Hello again,
We will implement a new variable, $print_invoice_no, in config.php. A value of 0 will print the reference number and a value of 1 will print the invoice_no.

We will take the risk and go back to our former directing of the PDF files as you point out.

/Joe