+ $row = db_fetch_row($result);
+ $balance = round2($row[0], user_price_dec());
+
+ begin_transaction();
+ $to = sql2date($to);
+
+ if ($balance != 0.0)
+ {
+ $co = get_company_prefs();
+
+ $trans_type = systypes::journal_entry();
+ $trans_id = get_next_trans_no($trans_type);
+
+ add_gl_trans($trans_type, $trans_id, $to, $co['retained_earnings_act'],
+ 0, 0, _("Closing Year"), -$balance);
+ add_gl_trans($trans_type, $trans_id, $to, $co['profit_loss_year_act'],
+ 0, 0, _("Closing Year"), $balance);
+
+ }
+ close_transactions($to);
+ commit_transaction();
+}
+
+function open_year($year)