Rerun. The aging reports / inquiries had a 1 day error in presentation. Fixed.
[fa-stable.git] / reporting / rep202.php
index 6bbf6d92c02fb1f53f13d0a559bfe49a6b373b88..c3b1e87a41ec7c9f0323cb30ea437b845238fe94 100644 (file)
@@ -47,9 +47,9 @@ function get_invoices($supplier_id, $to, $all=true)
                ".TB_PREF."supp_trans.reference,
                ".TB_PREF."supp_trans.tran_date,
                $value as Balance,
-               IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= 0,$value,0) AS Due,
-               IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $PastDueDays1,$value,0) AS Overdue1,
-               IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= $PastDueDays2,$value,0) AS Overdue2
+               IF ((TO_DAYS('$todate') - TO_DAYS($due)) > 0,$value,0) AS Due,
+               IF ((TO_DAYS('$todate') - TO_DAYS($due)) > $PastDueDays1,$value,0) AS Overdue1,
+               IF ((TO_DAYS('$todate') - TO_DAYS($due)) > $PastDueDays2,$value,0) AS Overdue2
 
                FROM ".TB_PREF."suppliers,
                        ".TB_PREF."payment_terms,
@@ -82,12 +82,14 @@ function print_aged_supplier_analysis()
     $no_zeros = $_POST['PARAM_5'];
     $graphics = $_POST['PARAM_6'];
     $comments = $_POST['PARAM_7'];
-       $destination = $_POST['PARAM_8'];
+       $orientation = $_POST['PARAM_8'];
+       $destination = $_POST['PARAM_9'];
 
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+       $orientation = ($orientation ? 'L' : 'P');
        if ($graphics)
        {
                include_once($path_to_root . "/reporting/includes/class.graphic.inc");
@@ -140,7 +142,9 @@ function print_aged_supplier_analysis()
 
        if ($convert)
                $headers[2] = _('currency');
-       $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize());
+    $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize(), 9, $orientation);
+    if ($orientation == 'L')
+       recalculate_cols($cols);
 
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);