6 include($path_to_root . "/includes/session.inc");
8 page(_("View Bank Payment"), true);
10 include_once($path_to_root . "/includes/date_functions.inc");
11 include_once($path_to_root . "/includes/ui.inc");
13 include_once($path_to_root . "/gl/includes/gl_db.inc");
15 if (isset($_GET["trans_no"]))
17 $trans_no = $_GET["trans_no"];
20 // get the pay-from bank payment info
21 $result = get_bank_trans(systypes::bank_payment(), $trans_no);
23 if (db_num_rows($result) != 1)
24 display_db_error("duplicate payment bank transaction found", "");
26 $from_trans = db_fetch($result);
28 $company_currency = get_company_currency();
30 $show_currencies = false;
32 if ($from_trans['bank_curr_code'] != $company_currency)
34 $show_currencies = true;
37 display_heading(_("GL Payment") . " #$trans_no");
40 start_table("$table_style width=80%");
53 label_cells(_("From Bank Account"), $from_trans['bank_account_name'], "class='tableheader2'");
55 label_cells(_("Currency"), $from_trans['bank_curr_code'], "class='tableheader2'");
56 label_cells(_("Amount"), number_format2(-$from_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
57 label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
60 label_cells(_("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
61 label_cells(_("Payment Type"), $from_trans['BankTransType'], "class='tableheader2'");
64 label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan=$colspan2");
66 comments_display_row(systypes::bank_payment(), $trans_no);
70 $voided = is_voided_display(systypes::bank_payment(), $trans_no, _("This payment has been voided."));
72 $items = get_gl_trans(systypes::bank_payment(), $trans_no);
74 if (db_num_rows($items)==0)
76 echo "<br>" . _("There are no items for this payment.");
81 display_heading2(_("Items for this Payment"));
83 display_heading2(_("Item Amounts are Shown in :") . " " . $company_currency);
86 start_table("$table_style width=80%");
87 $th = array(_("Account Code"), _("Account Description"),
88 _("Amount"), _("Memo"));
91 $k = 0; //row colour counter
94 while ($item = db_fetch($items))
97 if ($item["account"] != $from_trans["account_code"])
99 alt_table_row_color($k);
101 label_cell($item["account"]);
102 label_cell($item["account_name"]);
103 amount_cell($item["amount"]);
104 label_cell($item["memo_"]);
106 $totalAmount += $item["amount"];
110 label_row(_("Total"), number_format2($totalAmount, user_price_dec()),"colspan=2 align=right", "align=right");
115 display_allocations_from($from_trans['person_type_id'], $from_trans['person_id'], 1, $trans_no, -$from_trans['amount']);