Rerun bug 5512: Customer Allocation Inquiry - No alloc-icon for DEBET-Accounts-receiv...
[fa-stable.git] / sales / inquiry / customer_inquiry.php
index 4674989f729a5309669e483c321ed1ea2f9f473b..930ff08ab6cbec2051c08ae6e98e91c90c2e125a 100644 (file)
@@ -59,8 +59,7 @@ function gl_view($row)
 function fmt_amount($row)
 {
        $value =
-           $row['type']==ST_CUSTCREDIT || $row['type']==ST_CUSTPAYMENT || $row['type']==ST_BANKDEPOSIT ?
-               -$row["TotalAmount"] : $row["TotalAmount"];
+           $row['type']==ST_CUSTCREDIT || $row['type']==ST_CUSTPAYMENT || $row['type']==ST_BANKDEPOSIT ? -$row["TotalAmount"] : $row["TotalAmount"];
     return price_format($value);
 }
 
@@ -106,7 +105,7 @@ function prt_link($row)
 function check_overdue($row)
 {
        return $row['OverDue'] == 1
-               && floatcmp($row["TotalAmount"], $row["Allocated"]) != 0;
+               && floatcmp(ABS($row["TotalAmount"]), $row["Allocated"]) != 0;
 }
 //------------------------------------------------------------------------------------------------
 
@@ -209,8 +208,8 @@ $cols = array(
        _("Amount") => array('align'=>'right', 'fun'=>'fmt_amount'), 
        _("Balance") => array('align'=>'right', 'type'=>'amount'),
                array('insert'=>true, 'fun'=>'gl_view'),
-               array('insert'=>true, 'fun'=>'credit_link'),
                array('insert'=>true, 'fun'=>'edit_link'),
+               array('insert'=>true, 'fun'=>'credit_link'),
                array('insert'=>true, 'fun'=>'prt_link')
        );