Merged bugfixes upto [0000072] (version 2.0.3).
[fa-stable.git] / admin / db / company_db.inc
index e288e1aaa26b186380c24fbd6874056b9ab08d04..8a832211bee06d4369d8dcd736227dca87c67eb4 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 
 
-function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act, 
+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,
@@ -23,6 +24,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).",
@@ -107,12 +109,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 +124,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 +144,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 +158,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];