ac8432dc2ecc4d6a26aebabb874c28dde6f0c75f
[fa-stable.git] / purchasing / view / view_supp_invoice.php
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU Affero General Public License,
5         AGPL, as published by the Free Software Foundation, either version 
6         3 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/agpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 1;
13 $path_to_root="../..";
14
15 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
16 include_once($path_to_root . "/includes/session.inc");
17
18 include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
19
20 $js = "";
21 if ($use_popup_windows)
22         $js .= get_js_open_window(900, 500);
23 page(_("View Supplier Invoice"), true, false, "", $js);
24
25 if (isset($_GET["trans_no"]))
26 {
27         $trans_no = $_GET["trans_no"];
28
29 elseif (isset($_POST["trans_no"]))
30 {
31         $trans_no = $_POST["trans_no"];
32 }
33
34 $supp_trans = new supp_trans();
35 $supp_trans->is_invoice = true;
36
37 read_supp_invoice($trans_no, 20, $supp_trans);
38
39 $supplier_curr_code = get_supplier_currency($supp_trans->supplier_id);
40
41 display_heading(_("SUPPLIER INVOICE") . " # " . $trans_no);
42 echo "<br>";
43
44 start_table("$table_style width=95%");   
45 start_row();
46 label_cells(_("Supplier"), $supp_trans->supplier_name, "class='tableheader2'");
47 label_cells(_("Reference"), $supp_trans->reference, "class='tableheader2'");
48 label_cells(_("Supplier's Reference"), $supp_trans->supp_reference, "class='tableheader2'");
49 end_row();
50 start_row();
51 label_cells(_("Invoice Date"), $supp_trans->tran_date, "class='tableheader2'");
52 label_cells(_("Due Date"), $supp_trans->due_date, "class='tableheader2'");
53 if (!is_company_currency($supplier_curr_code))
54         label_cells(_("Currency"), $supplier_curr_code, "class='tableheader2'");
55 end_row();
56 comments_display_row(20, $trans_no);
57
58 end_table(1);
59
60 $total_gl = display_gl_items($supp_trans, 2);
61 $total_grn = display_grn_items($supp_trans, 2);
62
63 $display_sub_tot = number_format2($total_gl+$total_grn,user_price_dec());
64
65 start_table("width=95% $table_style");
66 label_row(_("Sub Total"), $display_sub_tot, "align=right", "nowrap align=right width=15%");
67
68 $tax_items = get_trans_tax_details(20, $trans_no);
69 display_supp_trans_tax_details($tax_items, 1);
70
71 $display_total = number_format2($supp_trans->ov_amount + $supp_trans->ov_gst,user_price_dec());
72
73 label_row(_("TOTAL INVOICE"), $display_total, "colspan=1 align=right", "nowrap align=right");
74
75 end_table(1);
76
77 is_voided_display(20, $trans_no, _("This invoice has been voided."));
78
79 end_page(true);
80
81 ?>