Removed get_js_set_focus() and get_js_form_entry()
[fa-stable.git] / reporting / rep102.php
index e9412e6a12977657d5b60e98fab0c453de35334a..508844da6c5d233fd8afffdba82d425a60b950a5 100644 (file)
@@ -98,27 +98,26 @@ function get_invoices($costomer_id, $to)
 
 function print_aged_customer_analysis()
 {
-    global $path_to_root;
+    global $comp_path, $path_to_root;
 
     include_once($path_to_root . "reporting/includes/pdf_report.inc");
 
     $to = $_POST['PARAM_0'];
     $fromcust = $_POST['PARAM_1'];
-    $tocust = $_POST['PARAM_2'];
-    $currency = $_POST['PARAM_3'];
-       $summaryOnly = $_POST['PARAM_4'];
-    $graphics = $_POST['PARAM_5'];
-    $comments = $_POST['PARAM_6'];
+    $currency = $_POST['PARAM_2'];
+       $summaryOnly = $_POST['PARAM_3'];
+    $graphics = $_POST['PARAM_4'];
+    $comments = $_POST['PARAM_5'];
        if ($graphics)
        {
                include_once($path_to_root . "reporting/includes/class.graphic.inc");
                $pg = new graph();
        }       
     
-       if ($fromcust == null)
-               $fromcust = 0;
-       if ($tocust == null)
-               $tocust = 0;
+       if ($fromcust == reserved_words::get_all_numeric())
+               $from = _('All');
+       else
+               $from = get_customer_name($fromcust);
     $dec = user_price_dec();
 
        if ($summaryOnly == 1)
@@ -147,8 +146,7 @@ function print_aged_customer_analysis()
     
     $params =   array(         0 => $comments,   
                                        1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''),
-                                   2 => array('text' => _('Customer'), 'from' => get_customer_name($fromcust),
-                            'to' => get_customer_name($tocust)),
+                                   2 => array('text' => _('Customer'), 'from' => $from, 'to' => ''),
                                    3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''),
                        4 => array('text' => _('Type'),         'from' => $summary,'to' => ''));
 
@@ -163,8 +161,10 @@ function print_aged_customer_analysis()
        $total = array();
        $total[0] = $total[1] = $total[2] = $total[3] = $total[4] = 0.0;
        
-       $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master
-               WHERE debtor_no>=$fromcust AND debtor_no<=$tocust ORDER BY name";
+       $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master ";
+       if ($fromcust != reserved_words::get_all_numeric())
+               $sql .= "WHERE debtor_no=$fromcust ";
+       $sql .= "ORDER BY name";
        $result = db_query($sql, "The customers could not be retrieved");
        
        while ($myrow=db_fetch($result)) 
@@ -228,7 +228,7 @@ function print_aged_customer_analysis()
        $rep->Line($rep->row  + 4);
        $rep->NewLine();
        }
-    $rep->fontSize += 2;
+       $rep->fontSize += 2;
        $rep->TextCol(0, 3, _('Grand Total'));
        $rep->fontSize -= 2;
        for ($i = 0; $i < count($total); $i++)
@@ -253,7 +253,7 @@ function print_aged_customer_analysis()
                $pg->built_in  = false;
                $pg->fontfile  = $path_to_root . "reporting/fonts/Vera.ttf";
                $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".");
-               $filename = $path_to_root . "reporting/pdf_files/test.png";
+               $filename = $comp_path .'/'. user_company(). "/images/test.png";
                $pg->display($filename, true);
                $w = $pg->width / 1.5;
                $h = $pg->height / 1.5;