Fixed document total presentation in customer/supplier transaction inquiries.
[fa-stable.git] / purchasing / inquiry / supplier_inquiry.php
index 88c30d23a3feaa9736fec7226e4ebc8ee809912f..023e839e1f454a809242a3136fde705cb61528b4 100644 (file)
@@ -27,6 +27,7 @@ page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false,
 if (isset($_GET['supplier_id'])){
        $_POST['supplier_id'] = $_GET['supplier_id'];
 }
+
 if (isset($_GET['FromDate'])){
        $_POST['TransAfterDate'] = $_GET['FromDate'];
 }
@@ -47,7 +48,7 @@ start_row();
 if (!$page_nested)
        supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, true);
 
-date_cells(_("From:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
+date_cells(_("From:"), 'TransAfterDate', '', null, -user_transaction_days());
 date_cells(_("To:"), 'TransToDate');
 
 supp_transactions_list_cell("filterType", null, true);
@@ -69,7 +70,7 @@ function display_supplier_summary($supplier_record)
        $pastdue2 = _('Over') . " " . $past2 . " " . _('Days');
        
 
-    start_table(TABLESTYLE, "width=80%");
+    start_table(TABLESTYLE, "width='80%'");
     $th = array(_("Currency"), _("Terms"), _("Current"), $nowdue,
        $pastdue1, $pastdue2, _("Total Balance"));
 
@@ -106,7 +107,6 @@ function systype_name($dummy, $type)
        global $systypes_array;
        return $systypes_array[$type];
 }
-div_end();
 
 function trans_view($trans)
 {
@@ -136,17 +136,10 @@ function credit_link($row)
                        : '';
 }
 
-function fmt_debit($row)
+function fmt_amount($row)
 {
        $value = $row["TotalAmount"];
-       return $value>0 ? price_format($value) : '';
-
-}
-
-function fmt_credit($row)
-{
-       $value = -$row["TotalAmount"];
-       return $value>0 ? price_format($value) : '';
+       return price_format($value);
 }
 
 function prt_link($row)
@@ -163,6 +156,10 @@ function check_overdue($row)
 
 function edit_link($row)
 {
+       global $page_nested;
+
+       if ($page_nested)
+               return '';
        return trans_editor_link($row['type'], $row['trans_no']);
 }
 //------------------------------------------------------------------------------------------------
@@ -178,8 +175,7 @@ $cols = array(
                        _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'desc'), 
                        _("Due Date") => array('type'=>'date', 'fun'=>'due_date'), 
                        _("Currency") => array('align'=>'center'),
-                       _("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'), 
-                       _("Credit") => array('align'=>'right', 'insert'=>true,'fun'=>'fmt_credit'), 
+                       _("Amount") => array('align'=>'right', 'fun'=>'fmt_debit'), 
                        array('insert'=>true, 'fun'=>'gl_view'),
                        array('insert'=>true, 'fun'=>'credit_link'),
                        array('insert'=>true, 'fun'=>'prt_link'),