Eliminated non-static method calls and other bulk fixes to fix php5 warnings
[fa-stable.git] / purchasing / view / view_supp_payment.php
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 'SA_SUPPTRANSVIEW';
13 $path_to_root = "../..";
14
15 include($path_to_root . "/includes/session.inc");
16
17 include_once($path_to_root . "/includes/ui.inc");
18 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
19 $js = "";
20 if ($use_popup_windows)
21         $js .= get_js_open_window(900, 500);
22 page(_("View Payment to Supplier"), true, false, "", $js);
23
24 if (isset($_GET["trans_no"]))
25 {
26         $trans_no = $_GET["trans_no"];
27 }
28
29 $receipt = get_supp_trans($trans_no, 22);
30
31 $company_currency = get_company_currency();
32
33 $show_currencies = false;
34 $show_both_amounts = false;
35
36 if (($receipt['bank_curr_code'] != $company_currency) || ($receipt['SupplierCurrCode'] != $company_currency))
37         $show_currencies = true;
38
39 if ($receipt['bank_curr_code'] != $receipt['SupplierCurrCode']) 
40 {
41         $show_currencies = true;
42         $show_both_amounts = true;
43 }
44
45 echo "<center>";
46
47 display_heading(_("Payment to Supplier") . " #$trans_no");
48
49 echo "<br>";
50 start_table("$table_style2 width=80%");
51
52 start_row();
53 label_cells(_("To Supplier"), $receipt['supplier_name'], "class='tableheader2'");
54 label_cells(_("From Bank Account"), $receipt['bank_account_name'], "class='tableheader2'");
55 label_cells(_("Date Paid"), sql2date($receipt['tran_date']), "class='tableheader2'");
56 end_row();
57 start_row();
58 if ($show_currencies)
59         label_cells(_("Payment Currency"), $receipt['bank_curr_code'], "class='tableheader2'");
60 label_cells(_("Amount"), number_format2(-$receipt['BankAmount'], user_price_dec()), "class='tableheader2'");
61 label_cells(_("Payment Type"), $bank_transfer_typea[$receipt['BankTransType']], "class='tableheader2'");
62 end_row();
63 start_row();
64 if ($show_currencies) 
65 {
66         label_cells(_("Supplier's Currency"), $receipt['SupplierCurrCode'], "class='tableheader2'");
67 }
68 if ($show_both_amounts)
69         label_cells(_("Amount"), number_format2(-$receipt['Total'], user_price_dec()), "class='tableheader2'");
70 label_cells(_("Reference"), $receipt['ref'], "class='tableheader2'");
71 end_row();
72 comments_display_row(22, $trans_no);
73
74 end_table(1);
75
76 $voided = is_voided_display(22, $trans_no, _("This payment has been voided."));
77
78 // now display the allocations for this payment
79 if (!$voided) 
80 {
81         display_allocations_from(PT_SUPPLIER, $receipt['supplier_id'], 22, $trans_no, -$receipt['Total']);
82 }
83
84 end_page(true);
85 ?>