*** empty log message ***
[fa-stable.git] / gl / view / gl_deposit_view.php
1 <?php
2
3 $page_security = 1;
4 $path_to_root="../..";
5
6 include($path_to_root . "/includes/session.inc");
7
8 page(_("View Bank Deposit"), true);
9
10 include_once($path_to_root . "/includes/date_functions.inc");
11 include_once($path_to_root . "/includes/ui.inc");
12
13 include_once($path_to_root . "/gl/includes/gl_db.inc");
14
15 if (isset($_GET["trans_no"]))
16 {
17         $trans_no = $_GET["trans_no"];
18 }
19
20 // get the pay-to bank payment info
21 $result = get_bank_trans(systypes::bank_deposit(), $trans_no);
22
23 if (db_num_rows($result) != 1)
24         display_db_error("duplicate payment bank transaction found", "");
25
26 $to_trans = db_fetch($result);
27
28 $company_currency = get_company_currency();
29
30 $show_currencies = false;
31
32 if ($to_trans['bank_curr_code'] != $company_currency) 
33 {
34         $show_currencies = true;
35 }
36
37 echo "<center>";
38
39 display_heading(_("GL Deposit") . " #$trans_no");
40
41 echo "<br>";
42 start_table("$table_style width=80%");
43
44 if ($show_currencies)
45 {
46         $colspan1 = 5;
47         $colspan2 = 8;
48 }
49 else
50 {
51         $colspan1 = 3;
52         $colspan2 = 6;
53 }
54 start_row();
55 label_cells(_("To Bank Account"), $to_trans['bank_account_name'], "class='tableheader2'");
56 if ($show_currencies)
57         label_cells(_("Currency"), $to_trans['bank_curr_code'], "class='tableheader2'");
58 label_cells(_("Amount"), number_format2($to_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
59 label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
60 end_row();
61 start_row();
62 label_cells(_("From"), payment_person_types::person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
63 label_cells(_("Deposit Type"), $to_trans['BankTransType'], "class='tableheader2'");
64 end_row();
65 start_row();
66 label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan=$colspan2");
67 end_row();
68 comments_display_row(systypes::bank_deposit(), $trans_no);
69
70 end_table(1);
71
72 is_voided_display(systypes::bank_deposit(), $trans_no, _("This deposit has been voided."));
73
74 $items = get_gl_trans(systypes::bank_deposit(), $trans_no);
75
76 if (db_num_rows($items) == 0)
77 {
78         echo "<br>" . _("There are no items for this deposit.");
79
80 else 
81 {
82
83         display_heading2(_("Items for this Deposit"));
84         if ($show_currencies)
85                 display_heading2(_("Item Amounts are Shown in :") . " " . $company_currency);
86
87     start_table("$table_style width=80%");
88     $th = array(_("Account Code"), _("Account Description"),
89         _("Amount"), _("Memo"));
90     table_header($th);  
91
92     $k = 0; //row colour counter
93         $total_amount = 0;
94
95     while ($item = db_fetch($items)) 
96     {
97
98                 if ($item["account"] != $to_trans["account_code"]) 
99                 {
100                 alt_table_row_color($k);
101
102                 label_cell($item["account"]);
103                 label_cell($item["account_name"]);
104             amount_cell(abs($item["amount"]));
105                 label_cell($item["memo_"]);
106                 end_row();
107                 $total_amount += abs($item["amount"]);
108                 }
109         }
110
111         label_row(_("Total"), number_format2($total_amount, user_price_dec()),"colspan=2 align=right", "align=right");
112
113         end_table(1);
114
115         display_allocations_from($to_trans['person_type_id'], $to_trans['person_id'], 2, $trans_no, $to_trans['amount']);
116 }
117
118 end_page(true);
119 ?>