// else print or print_update, fall through and load javascript to call form_popup and clear form
        } else {
            // else there was a post error, display and re-display form
            $order = new objectInfo($_POST);
            $order->post_date = gen_db_date_short($_POST['post_date']);
            // fix the date to original format
            $order->id = $_POST['id'] != '' ? $_POST['id'] : '';
            // will be null unless opening an existing purchase/receive
            $messageStack->add(GL_ERROR_NO_POST, 'error');
        }
        break;
    default:
}
/*****************   prepare to display templates  *************************/
// load the gl account beginning balance
$acct_balance = load_cash_acct_balance($post_date, $gl_acct_id, $period);
// load gl accounts
$gl_array_list = gen_coa_pull_down();
// generate the list of gl accounts and fill js arrays for dynamic pull downs
$js_gl_array = 'var js_gl_array = new Array(' . count($gl_array_list) . ');' . chr(10);
for ($i = 0; $i < count($gl_array_list); $i++) {
    $js_gl_array .= 'js_gl_array[' . $i . '] = new dropDownData("' . $gl_array_list[$i]['id'] . '", "' . $gl_array_list[$i]['text'] . '");' . chr(10);
}
// generate address arrays for javascript
$js_arrays = gen_build_acct_arrays();
$include_header = true;
$include_footer = true;
$include_tabs = false;
$include_calendar = true;
$include_template = 'template_main.php';
define('PAGE_TITLE', constant('BNK_DEP_' . JOURNAL_ID . '_' . strtoupper($type) . '_WINDOW_TITLE'));
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// |                                                                 |
// | The license that is bundled with this package is located in the |
// | file: /doc/manual/ch01-Introduction/license.html.               |
// | If not, see http://www.gnu.org/licenses/                        |
// +-----------------------------------------------------------------+
//  Path: /modules/banking/ajax/acct_balance.php
//
/**************   Check user security   *****************************/
// None
/**************  include page specific files    *********************/
require DIR_FS_MODULES . 'banking/functions/banking.php';
/**************   page specific initialization  *************************/
$gl_acct_id = $_GET['gl_acct_id'] ? db_prepare_input($_GET['gl_acct_id']) : AP_PURCHASE_INVOICE_ACCOUNT;
$post_date = $_GET['post_date'] ? gen_db_date_short($_GET['post_date']) : date('Y-m-d', time());
$period = gen_calculate_period($post_date);
if (!$period) {
    // bad post_date was submitted
    $post_date = date('Y-m-d', time());
    $period = 0;
}
$xml = xmlEntry("value", load_cash_acct_balance($post_date, $gl_acct_id, $period));
// error check
//put it all together
$str = createXmlHeader('acctbal');
$str .= $xml;
$str .= createXmlFooter();
echo $str;
die;