df4299750e4d8021b4774db19049e3556b434891
[fa-stable.git] / sales / view / view_receipt.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_SALESTRANSVIEW';
13 $path_to_root = "../..";
14 include_once($path_to_root . "/includes/session.inc");
15
16 include_once($path_to_root . "/includes/date_functions.inc");
17 include_once($path_to_root . "/includes/ui.inc");
18 include_once($path_to_root . "/sales/includes/sales_db.inc");
19
20 $js = "";
21 if ($SysPrefs->use_popup_windows)
22         $js .= get_js_open_window(900, 600);
23
24 page(_($help_context = "View Customer Payment"), true, false, "", $js);
25
26 if (isset($_GET["trans_no"]))
27 {
28         $trans_id = $_GET["trans_no"];
29 }
30
31 $receipt = get_customer_trans($trans_id, ST_CUSTPAYMENT);
32
33 display_heading(sprintf(_("Customer Payment #%d"),$trans_id));
34
35 echo "<br>";
36 start_table(TABLESTYLE, "width='80%'");
37 start_row();
38 label_cells(_("From Customer"), $receipt['DebtorName'], "class='tableheader2'");
39 label_cells(_("Reference"), $receipt['reference'], "class='tableheader2'");
40 label_cells(_("Date of Deposit"), sql2date($receipt['tran_date']), "class='tableheader2'");
41 end_row();
42 start_row();
43 label_cells(_("Customer Currency"), $receipt['curr_code'], "class='tableheader2'");
44 label_cells(_("Amount"), price_format($receipt['Total'] - $receipt['ov_discount']), "class='tableheader2'");
45 label_cells(_("Discount"), price_format($receipt['ov_discount']), "class='tableheader2'");
46 end_row();
47 start_row();
48 label_cells(_("Into Bank Account"), $receipt['bank_account_name'].' ['.$receipt['bank_curr_code'].']', "class='tableheader2'");
49 label_cells(_("Bank Amount"), price_format($receipt['bank_amount']), "class='tableheader2'");
50 label_cells(_("Payment Type"), $bank_transfer_types[$receipt['BankTransType']], "class='tableheader2'");
51 end_row();
52 comments_display_row(ST_CUSTPAYMENT, $trans_id);
53
54 end_table(1);
55
56 $voided = is_voided_display(ST_CUSTPAYMENT, $trans_id, _("This customer payment has been voided."));
57
58 if (!$voided)
59 {
60         display_allocations_from(PT_CUSTOMER, $receipt['debtor_no'], ST_CUSTPAYMENT, $trans_id, $receipt['Total']);
61 }
62
63 end_page(true, false, false, ST_CUSTPAYMENT, $trans_id);