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 = "../..";
15 include($path_to_root . "/includes/session.inc");
17 include_once($path_to_root . "/includes/ui.inc");
18 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
20 if ($SysPrefs->use_popup_windows)
21 $js .= get_js_open_window(900, 500);
22 page(_($help_context = "View Payment to Supplier"), true, false, "", $js);
24 if (isset($_GET["trans_no"]))
26 $trans_no = $_GET["trans_no"];
29 $receipt = get_supp_trans($trans_no, ST_SUPPAYMENT);
31 $company_currency = get_company_currency();
33 $show_currencies = false;
34 $show_both_amounts = false;
36 if (($receipt['bank_curr_code'] != $company_currency) || ($receipt['curr_code'] != $company_currency))
37 $show_currencies = true;
39 if ($receipt['bank_curr_code'] != $receipt['curr_code'])
41 $show_currencies = true;
42 $show_both_amounts = true;
47 display_heading(_("Payment to Supplier") . " #$trans_no");
50 start_table(TABLESTYLE2, "width='80%'");
53 $act = $show_currencies ? $receipt['bank_account_name'].' '.$receipt['bank_curr_code'] : $receipt['bank_account_name'];
54 label_cells(_("From Bank Account"), $act, "class='tableheader2'");
55 label_cells(_("Amount"), number_format2(-$receipt['bank_amount'], user_price_dec()), "class='tableheader2'");
56 label_cells(_("Bank Fee"), number_format2(-$receipt['bank_charge'], user_price_dec()), "class='tableheader2'");
60 $supp = $show_currencies ? $receipt['supplier_name'].' '.$receipt['curr_code'] : $receipt['supplier_name'];
61 label_cells(_("To Supplier"), $supp, "class='tableheader2'");
62 label_cells(_("Reference"), $receipt['ref'], "class='tableheader2'");
63 label_cells(_("Date Paid"), sql2date($receipt['tran_date']), "class='tableheader2'");
67 label_cells(_("Discount"), number_format2(-$receipt['ov_discount']*$receipt['rate'], user_price_dec()), "class='tableheader2'");
68 label_cells(_("Tottal settled"), number_format2(-$receipt['Total'], user_price_dec()), "class='tableheader2'");
71 comments_display_row(ST_SUPPAYMENT, $trans_no);
75 $voided = is_voided_display(ST_SUPPAYMENT, $trans_no, _("This payment has been voided."));
77 // now display the allocations for this payment
80 display_allocations_from(PT_SUPPLIER, $receipt['supplier_id'], ST_SUPPAYMENT, $trans_no, -$receipt['Total']);
83 end_page(true, false, false, ST_SUPPAYMENT, $trans_no);