<?php
-
-
-function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act, $grn_act,
- $exchange_diff_act, $purch_exchange_diff_act,
- $retained_earnings_act, $freight_act,
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU Affero General Public License,
+ AGPL, as published by the Free Software Foundation, either version
+ 3 of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+***********************************************************************/
+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,
$default_adj_act,
$default_inv_sales_act,
$default_assembly_act,
- $payroll_act,
$allow_negative_stock,
$po_over_receive,
$po_over_charge,
{
$sql = "UPDATE ".TB_PREF."company SET
debtors_act=".db_escape($debtors_act).", pyt_discount_act=".db_escape($pyt_discount_act).",
- creditors_act=".db_escape($creditors_act).", grn_act=".db_escape($grn_act).",
- exchange_diff_act=".db_escape($exchange_diff_act).",
- purch_exchange_diff_act=".db_escape($purch_exchange_diff_act).",
- retained_earnings_act=".db_escape($retained_earnings_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).",
default_adj_act=".db_escape($default_adj_act).",
default_inv_sales_act=".db_escape($default_inv_sales_act).",
default_assembly_act=".db_escape($default_assembly_act).",
- payroll_act=".db_escape($payroll_act).",
allow_negative_stock=$allow_negative_stock,
po_over_receive=$po_over_receive,
po_over_charge=$po_over_charge,
function update_company_setup($coy_name, $coy_no, $gst_no, $tax_prd, $tax_last, $postal_address, $phone, $fax, $email,
$coy_logo, $domicile, $Dimension, $custom1_name, $custom2_name, $custom3_name,
$custom1_value, $custom2_value, $custom3_value, $curr_default, $f_year, $no_item_list, $no_customer_list,
- $no_supplier_list)
+ $no_supplier_list, $base_sales)
{
if ($f_year == null)
$f_year = 0;
custom2_value=".db_escape($custom2_value).",
custom3_value=".db_escape($custom3_value).",
curr_default=".db_escape($curr_default).",
- f_year=$f_year
+ f_year=$f_year,
+ base_sales=$base_sales
WHERE coy_code=1";
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)
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];
}
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");
}
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");
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");
commit_transaction();
}
+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];
+}
+
?>
\ No newline at end of file