From 5e87601d677dd16f609cb47262cecfd0cd297fca Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sun, 3 Apr 2011 23:58:41 +0200 Subject: [PATCH] Display bank balance in payment forms. --- gl/bank_transfer.php | 2 ++ gl/includes/ui/gl_bank_ui.inc | 5 ++++- gl/inquiry/bank_inquiry.php | 5 ++++- includes/ui/ui_input.inc | 14 ++++++++++++++ purchasing/supplier_payment.php | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gl/bank_transfer.php b/gl/bank_transfer.php index a9f99de..89ba5fc 100644 --- a/gl/bank_transfer.php +++ b/gl/bank_transfer.php @@ -65,6 +65,8 @@ function gl_payment_controls() bank_accounts_list_row(_("From Account:"), 'FromBankAccount', null, true); + bank_balance_row($_POST['FromBankAccount']); + bank_accounts_list_row(_("To Account:"), 'ToBankAccount', null, true); date_row(_("Transfer Date:"), 'DatePaid', '', null, 0, 0, 0, null, true); diff --git a/gl/includes/ui/gl_bank_ui.inc b/gl/includes/ui/gl_bank_ui.inc index 6454edb..b1031a9 100644 --- a/gl/includes/ui/gl_bank_ui.inc +++ b/gl/includes/ui/gl_bank_ui.inc @@ -21,7 +21,10 @@ function display_bank_header(&$order) table_section(1); bank_accounts_list_row( $payment ? _("From:") : _("To:"), 'bank_account', null, true); - + + if ($payment) + bank_balance_row($_POST['bank_account']); + date_row(_("Date:"), 'date_', '', true, 0, 0, 0, null, true); table_section(2, "33%"); diff --git a/gl/inquiry/bank_inquiry.php b/gl/inquiry/bank_inquiry.php index 65a691f..b264fe7 100644 --- a/gl/inquiry/bank_inquiry.php +++ b/gl/inquiry/bank_inquiry.php @@ -25,7 +25,7 @@ if ($use_popup_windows) $js .= get_js_open_window(800, 500); if ($use_date_picker) $js .= get_js_date_picker(); -page(_($help_context = "Bank Statement"), false, false, "", $js); +page(_($help_context = "Bank Statement"), isset($_GET['bank_account']), false, "", $js); check_db_has_bank_accounts(_("There are no bank accounts defined in the system.")); @@ -38,6 +38,9 @@ if (get_post('Show')) } //------------------------------------------------------------------------------------------------ +if (isset($_GET['bank_account'])) + $_POST['bank_account'] = $_GET['bank_account']; + start_form(); start_table(TABLESTYLE_NOBORDER); start_row(); diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 1889962..1e966a1 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -931,4 +931,18 @@ function supplier_credit_row($supplier, $credit, $parms='') ."", $parms); } +function bank_balance_row($bank_acc, $parms='') +{ + global $path_to_root; + + $to = add_days(Today(), 1); + $bal = get_balance_before_for_bank_account($bank_acc, $to); + label_row( _("Bank Balance:"), + " " + . price_format($bal) + ."", $parms); +} + ?> \ No newline at end of file diff --git a/purchasing/supplier_payment.php b/purchasing/supplier_payment.php index 5421ee4..276a821 100644 --- a/purchasing/supplier_payment.php +++ b/purchasing/supplier_payment.php @@ -275,6 +275,8 @@ start_form(); set_global_supplier($_POST['supplier_id']); bank_accounts_list_row(_("From Bank Account:"), 'bank_account', null, true); + + bank_balance_row($_POST['bank_account']); table_section(2); -- 2.30.2