A lot of annoying layout bugs taken. Mostly from views and inquiries.
[fa-stable.git] / sales / inquiry / customer_allocation_inquiry.php
index 5606cbf83df1f5c45328f87fa5787170d9f272f5..c20262d5acbb17d3a39e14cf62dfe44d953c7123 100644 (file)
@@ -172,8 +172,8 @@ while ($myrow = db_fetch($result))
                $allocations_str = $allocations;
 
        }
-       elseif ($myrow["type"] == systypes::cust_payment() &&
-               ($myrow['TotalAmount'] + $myrow['Allocated']) > 0)
+       elseif (($myrow["type"] == systypes::cust_payment() || $myrow["type"] == systypes::bank_deposit()) &&
+               ($myrow['TotalAmount'] - $myrow['Allocated']) > 0)
        {
                /*its a receipt  which could have an allocation*/
                $allocations_str = $allocations;
@@ -185,8 +185,7 @@ while ($myrow = db_fetch($result))
        }
 
        label_cell(systypes::name($myrow["type"]));
-
-       label_cell(get_customer_trans_view_str($myrow["type"], $myrow["trans_no"]));
+       label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
        label_cell($myrow["reference"]);
        label_cell($preview_order_str);
        label_cell(sql2date($myrow["tran_date"]), "nowrap");
@@ -196,7 +195,9 @@ while ($myrow = db_fetch($result))
                label_cell($myrow["CustName"]);
                label_cell($myrow["CustCurrCode"]);
        }
-       display_debit_or_credit_cells($myrow["TotalAmount"]);
+       display_debit_or_credit_cells(
+           $myrow['type']==11 || $myrow['type']==12 || $myrow['type']==2 ?
+               -$myrow["TotalAmount"] : $myrow["TotalAmount"]);
        amount_cell(abs($myrow["Allocated"]));
        amount_cell(abs($myrow["TotalAmount"]) - $myrow["Allocated"]);
        label_cell($allocations_str);