X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_lists.inc;h=5f7601497e2a9850a6b375c24800f4e6cd65b7d7;hb=7e830126b96477e969fe3b48d9fc0e78f6c1fe00;hp=d83a4703bc3bbea540a966230f086413135b8aba;hpb=05d1e1fc65fe68645b540e06884db0e9f24b1a21;p=fa-stable.git diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index d83a4703..5f760149 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -419,8 +419,10 @@ function _format_add_curr($row) function add_edit_combo($type) { - global $path_to_root, $popup_editors; + global $path_to_root, $popup_editors, $use_icon_for_editkey; + if (!isset($use_icon_for_editkey) || $use_icon_for_editkey==0) + return ""; // Derive theme path $theme_path = $path_to_root . '/themes/' . user_theme(); @@ -441,7 +443,7 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_ if ($editkey) set_editor('supplier', $name, $editkey); - + $ret = combo_input($name, $selected_id, $sql, 'supplier_id', 'supp_name', array( 'format' => '_format_add_curr', @@ -527,7 +529,6 @@ function customer_list_cells($label, $name, $selected_id=null, $all_option=false function customer_list_row($label, $name, $selected_id=null, $all_option = false, $submit_on_change=false, $show_inactive=false, $editkey = false) { - global $path_to_root; echo "$label"; echo customer_list($name, $selected_id, $all_option, $submit_on_change, @@ -561,7 +562,7 @@ function customer_branches_list($customer_id, $name, $selected_id=null, if ($editkey) { $ret .= add_edit_combo('branch'); - } + } return $ret; } //------------------------------------------------------------------------------------------------ @@ -759,9 +760,8 @@ function stock_items_list($name, $selected_id=null, $all_option=false, 'order' => array('c.description','stock_id') ), $opts) ); if ($editkey) - $ret .= add_edit_combo('item'); + $ret .= add_edit_combo('item'); return $ret; - } function _format_stock_items($row) @@ -1437,8 +1437,10 @@ function bank_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha } //----------------------------------------------------------------------------------------------- -function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false) +function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false, $all_option=false) { + global $all_items; + $sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code, inactive FROM ".TB_PREF."bank_accounts WHERE ".TB_PREF."bank_accounts.account_type=".BT_CASH; @@ -1448,6 +1450,8 @@ function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha echo ""; echo combo_input($name, $selected_id, $sql, 'id', 'bank_account_name', array( + 'spec_option' => $all_option, + 'spec_id' => $all_items, 'format' => '_format_add_curr', 'select_submit'=> $submit_on_change, 'async' => true @@ -1480,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( @@ -1497,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"; } @@ -2370,4 +2376,78 @@ function payment_services($name) )); } -?> +function tax_algorithm_list($name, $value=null, $submit_on_change = false) +{ + global $tax_algorithms; + + return array_selector($name, $value, $tax_algorithms, + array( + 'select_submit'=> $submit_on_change, + 'async' => true, + ) + ); +} + +function tax_algorithm_list_cells($label, $name, $value=null, $submit_on_change=false) +{ + if ($label != null) + echo "$label\n"; + echo ""; + echo tax_algorithm_list($name, $value, $submit_on_change); + echo "\n"; +} + +function tax_algorithm_list_row($label, $name, $value=null, $submit_on_change=false) +{ + echo "$label"; + tax_algorithm_list_cells(null, $name, $value, $submit_on_change); + echo "\n"; +} +//---------------------------------------------------------------------------------------------- + +function subledger_list($name, $account, $selected_id=null) +{ + global $all_items; + + $type = is_subledger_account($account); + if (!$type) + return ''; + + if($type > 0) + $sql = "SELECT DISTINCT d.debtor_no as id, debtor_ref as name + FROM " + .TB_PREF."debtors_master d," + .TB_PREF."cust_branch c + WHERE d.debtor_no=c.debtor_no AND c.receivables_account=".db_escape($account); + else + $sql = "SELECT supplier_id as id, supp_ref as name + FROM " + .TB_PREF."suppliers s + WHERE s.payable_account=".db_escape($account); + + $mode = get_company_pref('no_customer_list'); + + return combo_input($name, $selected_id, $sql, 'id', 'name', + array( + 'type' => 1, + 'size' => 20, + 'async' => false, + ) ); +} + +function subledger_list_cells($label, $name, $account, $selected_id=null) +{ + if ($label != null) + echo "$label\n"; + echo ""; + echo subledger_list($name, $account, $selected_id); + echo "\n"; +} + +function subledger_list_row($label, $name, $selected_id=null, $all_option = false, + $submit_on_change=false, $show_inactive=false, $editkey = false) +{ + echo "$label"; + echo subledger_list($name, $account, $selected_id); + echo "\n\n"; +}