Early payment discount option moved from branch to payment terms.
[fa-stable.git] / sales / allocations / customer_allocation_main.php
index 56d4312f5fb1c2fa0a40f4679ade924faf5d8770..b08d8548d8e75bf45f85609c3c2a13fa0b6e2e78 100644 (file)
@@ -32,6 +32,7 @@ if (!isset($_POST['customer_id']))
 echo "<center>" . _("Select a customer: ") . "&nbsp;&nbsp;";
 echo customer_list('customer_id', $_POST['customer_id'], true, true);
 echo "<br>";
+
 check(_("Show Settled Items:"), 'ShowSettled', null, true);
 echo "</center><br><br>";
 
@@ -65,7 +66,9 @@ function trans_view($trans)
 
 function alloc_link($row)
 {
-       return pager_link(_("Allocate"),
+       global $all_settled;
+
+       return  ($row['settled']&&!get_post('ShowSettled')) || (!$row['settled'] && $all_settled)  ? '' : pager_link(_("Allocate"),
                "/sales/allocations/customer_allocate.php?trans_no="
                        .$row["trans_no"] . "&trans_type=" . $row["type"]. "&debtor_no=" . $row["debtor_no"], ICON_ALLOC);
 }
@@ -85,6 +88,9 @@ function check_settled($row)
        return $row['settled'] == 1;
 }
 
+$all_settled = !db_num_rows(get_allocatable_to_cust_transactions($customer_id));
+if ($all_settled)
+       display_note('<b>'._("There is no unsettled transactions for this customer.").'</b>');
 
 $sql = get_allocatable_from_cust_sql($customer_id, $settled);