X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=inline;f=includes%2Fui%2Fui_lists.inc;h=5f7601497e2a9850a6b375c24800f4e6cd65b7d7;hb=7e830126b96477e969fe3b48d9fc0e78f6c1fe00;hp=1a1e658b17d5c2718fef8d9ce740011b701ce433;hpb=c7863c71d0ea360d7b4d4e923841b7febd629100;p=fa-stable.git
diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc
index 1a1e658b..5f760149 100644
--- a/includes/ui/ui_lists.inc
+++ b/includes/ui/ui_lists.inc
@@ -417,33 +417,19 @@ function _format_add_curr($row)
'' : (" - " . $row[2]));
}
-function add_edit_combo($combo_name,$url,$key_param='',$restrict_pages='')
+function add_edit_combo($type)
{
- global $path_to_root, $page_security;
+ 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();
- // Check if $url already has other parameters
- if ($key_param) {
- $key_param = ((strpos($url,'?')) ? '&' : '?') . $key_param;
- }
-
- $href1 = "href='$url${key_param}='";
- $href2 = "href='$url${key_param}'";
- $onclick1 = "onclick=\"javascript:var sel=(document.forms[0].$combo_name.selectedIndex == -1 ? '' : document.forms[0].$combo_name.options[document.forms[0].$combo_name.selectedIndex].value);openWindow(this.href+sel,this.target); return false;\"";
- $onclick2 = "onclick=\"javascript:openWindow(this.href,this.target); return false;\"";
+ $key = $popup_editors[$type][1];
+ $onclick = "onclick=\"javascript:callEditor($key); return false;\"";
$img = "
";
- $return_url = ($key_param) ?
- "$img" :
- "$img";
-
- // Don't pass edit button code If restrict_pages contains instructions but fails security check
- if ($restrict_pages && strpos($restrict_pages, $page_security) === false) {
- return '';
- }
-
- return $return_url;
+ return "$img";
}
function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false,
@@ -457,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',
@@ -473,10 +459,7 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_
'show_inactive'=>$all
));
if ($editkey)
- {
- global $path_to_root;
- $ret .= add_edit_combo('supplier_id',"$path_to_root/purchasing/manage/suppliers.php?popup=1",'supplier_id');
- }
+ $ret .= add_edit_combo('supplier');
return $ret;
}
@@ -528,10 +511,7 @@ function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_
'show_inactive' => $show_inactive
) );
if ($editkey)
- {
- global $path_to_root;
- $ret .= add_edit_combo('customer_id',"$path_to_root/sales/manage/customers.php?popup=1", "debtor_no");
- }
+ $ret .= add_edit_combo('customer');
return $ret;
}
@@ -549,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,
@@ -582,9 +561,8 @@ function customer_branches_list($customer_id, $name, $selected_id=null,
) );
if ($editkey)
{
- global $path_to_root;
- $ret .= add_edit_combo('branch_id',"$path_to_root/sales/manage/customer_branches.php?popup=1",'SelectedBranch');
- }
+ $ret .= add_edit_combo('branch');
+ }
return $ret;
}
//------------------------------------------------------------------------------------------------
@@ -782,12 +760,8 @@ function stock_items_list($name, $selected_id=null, $all_option=false,
'order' => array('c.description','stock_id')
), $opts) );
if ($editkey)
- {
- global $path_to_root;
- $ret .= add_edit_combo('stock_id',"$path_to_root/inventory/manage/items.php?popup=1",'stock_id');
- }
+ $ret .= add_edit_combo('item');
return $ret;
-
}
function _format_stock_items($row)
@@ -1463,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;
@@ -1474,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
@@ -1506,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(
@@ -1523,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";
}
@@ -2396,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";
+}