X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_lists.inc;h=5f7601497e2a9850a6b375c24800f4e6cd65b7d7;hb=7e830126b96477e969fe3b48d9fc0e78f6c1fe00;hp=e85e38995f574d4fd02638a162020c8f5a9ae41c;hpb=9a98bb3bc7a94f1a8e47f8dab45a87c8b4212080;p=fa-stable.git diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index e85e3899..5f760149 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -1484,14 +1484,16 @@ function pos_list_row($label, $name, $selected_id=null, $spec_option=false, $sub //----------------------------------------------------------------------------------------------- // Payment type selector for current user. // -function sale_payment_list($name, $category, $selected_id=null, $submit_on_change=true) +function sale_payment_list($name, $category, $selected_id=null, $submit_on_change=true, $prepayments=true) { $sql = "SELECT terms_indicator, terms, inactive FROM ".TB_PREF."payment_terms"; - + if ($category == PM_CASH) // only cash $sql .= " WHERE days_before_due=0 AND day_in_following_month=0"; - if ($category == PM_CREDIT) // only delayed payments - $sql .= " WHERE days_before_due!=0 OR day_in_following_month!=0"; + elseif ($category == PM_CREDIT) // only delayed payments + $sql .= " WHERE days_before_due".($prepayments ? '!=': '>')."0 OR day_in_following_month!=0"; + elseif (!$prepayments) + $sql .= " WHERE days_before_due>=0"; return combo_input($name, $selected_id, $sql, 'terms_indicator', 'terms', array( @@ -1501,13 +1503,13 @@ function sale_payment_list($name, $category, $selected_id=null, $submit_on_chang } -function sale_payment_list_cells($label, $name, $category, $selected_id=null, $submit_on_change=true) +function sale_payment_list_cells($label, $name, $category, $selected_id=null, $submit_on_change=true, $prepayments=true) { if ($label != null) echo "$label\n"; echo ""; - echo sale_payment_list($name, $category, $selected_id, $submit_on_change); + echo sale_payment_list($name, $category, $selected_id, $submit_on_change, $prepayments); echo "\n"; }