X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fdb%2Fcompany_db.inc;h=ba56c4b905d8c55e3549566488ca8ec708145afd;hb=c9b7acbdfefe7a626368bfea9af867c4f8b99a1a;hp=e288e1aaa26b186380c24fbd6874056b9ab08d04;hpb=f9a5e41b07e0692301a89b475b6e1fce680e0c8d;p=fa-stable.git diff --git a/admin/db/company_db.inc b/admin/db/company_db.inc index e288e1aa..ba56c4b9 100644 --- a/admin/db/company_db.inc +++ b/admin/db/company_db.inc @@ -1,8 +1,17 @@ . +***********************************************************************/ +function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act, $freight_act, + $exchange_diff_act, $default_sales_act, $default_sales_discount_act, $default_prompt_payment_act, @@ -14,6 +23,8 @@ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act $allow_negative_stock, $po_over_receive, $po_over_charge, + $accumulate_shipping, + $legal_text, $past_due_days, $default_credit_limit, $default_workorder_required, @@ -23,6 +34,7 @@ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act debtors_act=".db_escape($debtors_act).", pyt_discount_act=".db_escape($pyt_discount_act).", creditors_act=".db_escape($creditors_act).", freight_act=".db_escape($freight_act).", + exchange_diff_act=".db_escape($exchange_diff_act).", default_sales_act=".db_escape($default_sales_act).", default_sales_discount_act=".db_escape($default_sales_discount_act).", default_prompt_payment_act=".db_escape($default_prompt_payment_act).", @@ -34,6 +46,8 @@ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act allow_negative_stock=$allow_negative_stock, po_over_receive=$po_over_receive, po_over_charge=$po_over_charge, + accumulate_shipping=$accumulate_shipping, + legal_text=".db_escape($legal_text).", past_due_days=$past_due_days, default_credit_limit=$default_credit_limit, default_workorder_required=$default_workorder_required, @@ -78,9 +92,10 @@ function update_company_setup($coy_name, $coy_no, $gst_no, $tax_prd, $tax_last, db_query($sql, "The company setup could not be updated "); } -function get_company_prefs() +function get_company_prefs($tbpref = TB_PREF) { - $sql = "SELECT * FROM ".TB_PREF."company WHERE coy_code=1"; + $sql = "SELECT * FROM ".$tbpref."company WHERE coy_code=1"; + $result = db_query($sql, "The company preferences could not be retrieved"); if (db_num_rows($result) == 0) @@ -89,9 +104,9 @@ function get_company_prefs() return db_fetch($result); } -function get_company_pref($pref_name) +function get_company_pref($pref_name, $tbpref = TB_PREF) { - $prefs = get_company_prefs(); + $prefs = get_company_prefs($tbpref); return $prefs[$pref_name]; } @@ -107,12 +122,10 @@ function add_fiscalyear($from_date, $to_date, $closed) db_query($sql, "could not add fiscal year"); } -function update_fiscalyear($from_date, $closed) +function update_fiscalyear($id, $closed) { - $from = date2sql($from_date); - $sql = "UPDATE ".TB_PREF."fiscal_year SET closed=$closed - WHERE begin=".db_escape($from); + WHERE id=".db_escape($id); db_query($sql, "could not update fiscal year"); } @@ -124,11 +137,9 @@ function get_all_fiscalyears() return db_query($sql, "could not get all fiscal years"); } -function get_fiscalyear($from_date) +function get_fiscalyear($id) { - $from = date2sql($from_date); - - $sql = "SELECT * FROM ".TB_PREF."fiscal_year WHERE begin=".db_escape($from); + $sql = "SELECT * FROM ".TB_PREF."fiscal_year WHERE id=".db_escape($id); $result = db_query($sql, "could not get fiscal year"); @@ -146,12 +157,11 @@ function get_current_fiscalyear() return db_fetch($result); } -function delete_fiscalyear($from_date) +function delete_fiscalyear($id) { - $from = date2sql($from_date); begin_transaction(); - $sql="DELETE FROM ".TB_PREF."fiscal_year WHERE begin=".db_escape($from); + $sql="DELETE FROM ".TB_PREF."fiscal_year WHERE id=".db_escape($id); db_query($sql, "could not delete fiscal year"); @@ -161,7 +171,7 @@ function delete_fiscalyear($from_date) function get_base_sales_type() { $sql = "SELECT base_sales FROM ".TB_PREF."company WHERE coy_code=1"; - + $result = db_query($sql, "could not get base sales type"); $myrow = db_fetch($result); return $myrow[0];