[0004212] Work Order Entry: fixed error when voided WO refence is reused.
[fa-stable.git] / reporting / rep707.php
index bd13ff9b218e4da2092999b2e7dad996b65cf397..19a01cabbfe64952f350729c9a8839aa75d77319 100644 (file)
@@ -252,6 +252,8 @@ function print_profit_and_loss_statement()
        {
                $begin = add_months($from, -12);
                $end = add_months($to, -12);
+               if (date_comp($to, end_month($to)) == 0) // compensate for leap years. If to-date equal end month 
+                       $end = end_month($end);                          // then the year-1 should also be end month    
                $headers[3] = _('Period Y-1');
        }
 
@@ -330,7 +332,7 @@ function print_profit_and_loss_statement()
                $pg->skin      = $SysPrefs->graph_skin;
                $pg->built_in  = false;
                $pg->latin_notation = ($SysPrefs->decseps[user_dec_sep()] != ".");
-               $filename = company_path(). "/pdf_files/". uniqid("").".png";
+               $filename = company_path(). "/pdf_files/". random_id().".png";
                $pg->display($filename, true);
                $w = $pg->width / 1.5;
                $h = $pg->height / 1.5;