*** empty log message ***
[fa-stable.git] / purchasing / view / view_supp_payment.php
1 <?php
2
3 $page_security = 1;
4 $path_to_root="../..";
5
6 include($path_to_root . "/includes/session.inc");
7
8 include_once($path_to_root . "/includes/ui.inc");
9 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
10 $js = "";
11 if ($use_popup_windows)
12         $js .= get_js_open_window(900, 500);
13 page(_("View Payment to Supplier"), true, false, "", $js);
14
15 if (isset($_GET["trans_no"]))
16 {
17         $trans_no = $_GET["trans_no"];
18 }
19
20 $receipt = get_supp_trans($trans_no, 22);
21
22 $company_currency = get_company_currency();
23
24 $show_currencies = false;
25 $show_both_amounts = false;
26
27 if (($receipt['bank_curr_code'] != $company_currency) || ($receipt['SupplierCurrCode'] != $company_currency))
28         $show_currencies = true;
29
30 if ($receipt['bank_curr_code'] != $receipt['SupplierCurrCode']) 
31 {
32         $show_currencies = true;
33         $show_both_amounts = true;
34 }
35
36 echo "<center>";
37
38 display_heading(_("Payment to Supplier") . " #$trans_no");
39
40 echo "<br>";
41 start_table("$table_style2 width=80%");
42
43 start_row();
44 label_cells(_("To Supplier"), $receipt['supplier_name'], "class='tableheader2'");
45 label_cells(_("From Bank Account"), $receipt['bank_account_name'], "class='tableheader2'");
46 label_cells(_("Date Paid"), sql2date($receipt['tran_date']), "class='tableheader2'");
47 end_row();
48 start_row();
49 if ($show_currencies)
50         label_cells(_("Payment Currency"), $receipt['bank_curr_code'], "class='tableheader2'");
51 label_cells(_("Amount"), number_format2(-$receipt['BankAmount'], user_price_dec()), "class='tableheader2'");
52 label_cells(_("Payment Type"), $receipt['BankTransType'], "class='tableheader2'");
53 end_row();
54 start_row();
55 if ($show_currencies) 
56 {
57         label_cells(_("Supplier's Currency"), $receipt['SupplierCurrCode'], "class='tableheader2'");
58 }
59 if ($show_both_amounts)
60         label_cells(_("Amount"), number_format2(-$receipt['ov_amount'], user_price_dec()), "class='tableheader2'");
61 label_cells(_("Reference"), $receipt['ref'], "class='tableheader2'");
62 end_row();
63 comments_display_row(22, $trans_no);
64
65 end_table(1);
66
67 $voided = is_voided_display(22, $trans_no, _("This payment has been voided."));
68
69 // now display the allocations for this payment
70 if (!$voided) 
71 {
72         display_allocations_from(payment_person_types::supplier(), $receipt['supplier_id'], 22, $trans_no, -$receipt['ov_amount']);
73 }
74
75 end_page(true);
76 ?>