// fiscal year routines
function add_fiscalyear($from_date, $to_date, $closed)
{
+ begin_transaction(__FUNCTION__, func_get_args());
+
$from = date2sql($from_date);
$to = date2sql($to_date);
VALUES (".db_escape($from).",".db_escape($to).", ".db_escape($closed).")";
db_query($sql, "could not add fiscal year");
+
+ commit_transaction();
}
function update_fiscalyear($id, $closed)
{
+ begin_transaction(__FUNCTION__, func_get_args());
+
$sql = "UPDATE ".TB_PREF."fiscal_year SET closed=".db_escape($closed)."
WHERE id=".db_escape($id);
-
db_query($sql, "could not update fiscal year");
+
+ commit_transaction();
}
function get_all_fiscalyears()
function delete_fiscalyear($id)
{
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
$sql="DELETE FROM ".TB_PREF."fiscal_year WHERE id=".db_escape($id);
{
global $Refs;
- $co = get_company_prefs();
- if (get_gl_account($co['retained_earnings_act']) == false || get_gl_account($co['profit_loss_year_act']) == false)
- {
- display_error(_("The Retained Earnings Account or the Profit and Loss Year Account has not been set in System and General GL Setup"));
- return false;
- }
- if (!is_account_balancesheet($co['retained_earnings_act']) || is_account_balancesheet($co['profit_loss_year_act']))
- {
- display_error(_("The Retained Earnings Account should be a Balance Account or the Profit and Loss Year Account should be an Expense Account (preferred the last one in the Expense Class)"));
- return false;
- }
-
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
$myrow = get_fiscalyear($year);
$to = $myrow['end'];
function open_year($year)
{
+ begin_transaction(__FUNCTION__, func_get_args());
+
$myrow = get_fiscalyear($year);
$from = sql2date($myrow['begin']);
- begin_transaction();
close_transactions(add_days($from, -1));
+
commit_transaction();
}
global $db_connections;
db_backup($db_connections[user_company()], 'Security backup before Fiscal Year Removal');
- begin_transaction();
+
+ begin_transaction(__FUNCTION__, func_get_args());
+
$ref = _("Open Balance");
$myrow = get_fiscalyear($selected_id);
$to = $myrow['end'];