6 include($path_to_root . "/includes/session.inc");
8 page(_("View Bank Transfer"), true);
10 include_once($path_to_root . "/includes/date_functions.inc");
11 include_once($path_to_root . "/includes/ui.inc");
12 include_once($path_to_root . "/gl/includes/gl_db.inc");
14 if (isset($_GET["trans_no"])){
16 $trans_no = $_GET["trans_no"];
19 $result = get_bank_trans(systypes::bank_transfer(), $trans_no);
21 if (db_num_rows($result) != 2)
22 display_db_error("Bank transfer does not contain two records", $sql);
24 $trans1 = db_fetch($result);
25 $trans2 = db_fetch($result);
27 if ($trans1["amount"] < 0)
29 $from_trans = $trans1; // from trans is the negative one
34 $from_trans = $trans2;
38 $company_currency = get_company_currency();
40 $show_currencies = false;
41 $show_both_amounts = false;
43 if (($from_trans['bank_curr_code'] != $company_currency) || ($to_trans['bank_curr_code'] != $company_currency))
44 $show_currencies = true;
46 if ($from_trans['bank_curr_code'] != $to_trans['bank_curr_code'])
48 $show_currencies = true;
49 $show_both_amounts = true;
52 display_heading(systypes::name(systypes::bank_transfer()) . " #$trans_no");
55 start_table("$table_style width=80%");
58 label_cells(_("From Bank Account"), $from_trans['bank_account_name'], "class='tableheader2'");
60 label_cells(_("Currency"), $from_trans['bank_curr_code'], "class='tableheader2'");
61 label_cells(_("Amount"), number_format2(-$from_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
67 label_cells(_("To Bank Account"), $to_trans['bank_account_name'], "class='tableheader2'");
69 label_cells(_("Currency"), $to_trans['bank_curr_code'], "class='tableheader2'");
70 if ($show_both_amounts)
71 label_cells(_("Amount"), number_format2($to_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
74 label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
75 label_cells(_("Transfer Type"), $from_trans['BankTransType'], "class='tableheader2'");
76 label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'");
78 comments_display_row(systypes::bank_transfer(), $trans_no);
82 is_voided_display(systypes::bank_transfer(), $trans_no, _("This transfer has been voided."));