<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_BUDGETENTRY';
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");


//add_js_file('budget.js');

page(_($help_context = "Budget Entry"));

include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/gl/includes/ui/gl_account_budgets_ui.inc");
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/admin/db/fiscalyears_db.inc");


check_db_has_gl_account_groups(_("There are no account groups defined. Please define at least one account group before entering accounts."));

//-------------------------------------------------------------------------------------

if(isset($_POST['Update_GL_Budgets'])){
    update_gl_account_budgets();
}
//-------------------------------------------------------------------------------------

global $Ajax;

start_form();
if (db_has_gl_accounts())
{
    
    $Ajax->activate('budget_tbl');
    div_start('budget_tbl');
    display_gl_account_budget_filtering_controls();
    display_gl_account_budget_edit_controls();
   
    br(2);
    submit_center_first('Calculate_GL_Budgets', _("Calculate"), '', 'default');
    br(2);
    
    submit_center_first('Update_GL_Budgets', _("Update"), '', 'default');
    
    div_end();
}

end_form(2);

end_page();

?>
