2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 'SA_EXCHANGERATE';
13 $path_to_root = "../..";
14 include_once($path_to_root . "/includes/session.inc");
16 include_once($path_to_root . "/includes/date_functions.inc");
17 include_once($path_to_root . "/includes/ui.inc");
18 include_once($path_to_root . "/includes/banking.inc");
21 if (user_use_date_picker())
22 $js .= get_js_date_picker();
23 page(_($help_context = "Revaluation of Currency Accounts"), false, false, "", $js);
25 if (isset($_GET['BA']))
30 if ($BA != 0 || $JE !=0)
32 display_notification_centered(sprintf(_("%d Journal Entries for Bank Accounts have been added"), $BA));
33 display_notification_centered(sprintf(_("%d Journal Entries for AR/AP accounts have been added"), $JE));
36 display_notification_centered( _("No revaluation was needed."));
40 //---------------------------------------------------------------------------------------------
43 if (!is_date($_POST['date']))
45 display_error( _("The entered date is invalid."));
49 if (!is_date_in_fiscalyear($_POST['date']))
51 display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
59 //---------------------------------------------------------------------------------------------
61 function handle_submit()
66 $trans = add_exchange_variation_all($_POST['date'], $_POST['memo_']);
68 meta_forward($_SERVER['PHP_SELF'], "BA=".$trans[0]."&JE=".$trans[1]);
73 //---------------------------------------------------------------------------------------------
75 function display_reval()
78 start_table(TABLESTYLE2);
80 if (!isset($_POST['date']))
81 $_POST['date'] = Today();
82 date_row(_("Date for Revaluation:"), 'date', '', null, 0, 0, 0, null, true);
83 textarea_row(_("Memo:"), 'memo_', null, 40,4);
86 submit_center('submit', _("Revaluate Currencies"), true, false);
90 //---------------------------------------------------------------------------------------------
94 unset($_POST['date_']);
95 unset($_POST['memo_']);
98 //---------------------------------------------------------------------------------------------
100 if (get_post('submit'))
103 //---------------------------------------------------------------------------------------------