Implemented attachments for Bank Account, and redesign of Bank Accounts to a tabbed...
[fa-stable.git] / gl / inquiry / bank_inquiry.php
index 4330a2ade68f54fd6de21a716c05fc9df2fcdc48..d17716d694fa5db85604a91d1c57c4631289aa0f 100644 (file)
@@ -14,6 +14,7 @@ $path_to_root="../..";
 include_once($path_to_root . "/includes/session.inc");
 
 include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/db_pager.inc");
 include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
 
@@ -21,11 +22,11 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 include_once($path_to_root . "/includes/banking.inc");
 
 $js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
        $js .= get_js_open_window(800, 500);
-if ($use_date_picker)
+if (user_use_date_picker())
        $js .= get_js_date_picker();
-page(_($help_context = "Bank Statement"), isset($_GET['bank_account']), false, "", $js);
+page(_($help_context = "Bank Account Inquiry"), isset($_GET['bank_account']) && !isset($_GET['TransAfterDate']), false, "", $js, false, "", true);
 
 check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
 
@@ -44,12 +45,13 @@ if (isset($_GET['bank_account']))
 start_form();
 start_table(TABLESTYLE_NOBORDER);
 start_row();
-bank_accounts_list_cells(_("Account:"), 'bank_account', null);
+if (!$page_nested)
+       bank_accounts_list_cells(_("Account:"), 'bank_account', null);
 
-date_cells(_("From:"), 'TransAfterDate', '', null, -$_SESSION["wa_current_user"]->prefs->transaction_days());
+date_cells(_("From:"), 'TransAfterDate', '', null, -user_transaction_days());
 date_cells(_("To:"), 'TransToDate');
 
-submit_cells('Show',_("Show"),'','', 'default');
+submit_cells('Show',_("Show"),'', '', 'default');
 end_row();
 end_table();
 end_form();
@@ -62,13 +64,16 @@ if (!isset($_POST['bank_account']))
 $result = get_bank_trans_for_bank_account($_POST['bank_account'], $_POST['TransAfterDate'], $_POST['TransToDate']);    
 
 div_start('trans_tbl');
-$act = get_bank_account($_POST["bank_account"]);
-display_heading($act['bank_account_name']." - ".$act['bank_curr_code']);
+if (!$page_nested)
+{
+       $act = get_bank_account($_POST["bank_account"]);
+       display_heading($act['bank_account_name']." - ".$act['bank_curr_code']);
+}
 
 start_table(TABLESTYLE);
 
 $th = array(_("Type"), _("#"), _("Reference"), _("Date"),
-       _("Debit"), _("Credit"), _("Balance"), _("Person/Item"), "");
+       _("Debit"), _("Credit"), _("Balance"), _("Person/Item"), _("Memo"), "", "");
 table_header($th);
 
 $bfw = get_balance_before_for_bank_account($_POST['bank_account'], $_POST['TransAfterDate']);
@@ -78,7 +83,7 @@ start_row("class='inquirybg' style='font-weight:bold'");
 label_cell(_("Opening Balance")." - ".$_POST['TransAfterDate'], "colspan=4");
 display_debit_or_credit_cells($bfw);
 label_cell("");
-label_cell("", "colspan=2");
+label_cell("", "colspan=4");
 
 end_row();
 $running_total = $bfw;
@@ -102,8 +107,14 @@ while ($myrow = db_fetch($result))
        label_cell($trandate);
        display_debit_or_credit_cells($myrow["amount"]);
        amount_cell($running_total);
-       label_cell(get_counterparty_name($myrow["type"], $myrow["trans_no"]));
+
+       label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
+
+       label_cell(get_comments_string($myrow["type"], $myrow["trans_no"]));
        label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
+       if (!$page_nested)
+               label_cell(trans_editor_link($myrow["type"], $myrow["trans_no"]));
+
        end_row();
        if ($myrow["amount"] > 0 ) 
                $debit += $myrow["amount"];
@@ -125,8 +136,7 @@ amount_cell($debit);
 amount_cell(-$credit);
 //display_debit_or_credit_cells($running_total);
 amount_cell($debit+$credit);
-label_cell("");
-label_cell("", "colspan=2");
+label_cell("", "colspan=4");
 end_row();
 end_table(2);
 div_end();
@@ -134,4 +144,3 @@ div_end();
 
 end_page();
 
-?>