Merging version 2.1 RC to main trunk.
[fa-stable.git] / purchasing / view / view_grn.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 = 2;
13 $path_to_root="../..";
14 include($path_to_root . "/purchasing/includes/po_class.inc");
15
16 include($path_to_root . "/includes/session.inc");
17 page(_("View Purchase Order Delivery"), true);
18
19 include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
20
21 if (!isset($_GET['trans_no']))
22 {
23         die ("<BR>" . _("This page must be called with a Purchase Order Delivery number to review."));
24 }
25
26 $purchase_order = new purch_order;
27 read_grn($_GET["trans_no"], $purchase_order);
28
29 display_heading(_("Purchase Order Delivery") . " #" . $_GET['trans_no']);
30 echo "<BR>";
31 display_grn_summary($purchase_order);
32
33 display_heading2(_("Line Details"));
34
35 start_table("colspan=9 $table_style width=90%");
36 $th = array(_("Item Code"), _("Item Description"), _("Delivery Date"), _("Quantity"),
37         _("Unit"), _("Price"), _("Line Total"), _("Quantity Invoiced"));
38
39 table_header($th);
40
41 $total = 0;
42 $k = 0;  //row colour counter
43
44 foreach ($purchase_order->line_items as $stock_item)
45 {
46
47         $line_total = $stock_item->qty_received * $stock_item->price;
48
49         alt_table_row_color($k);
50
51         label_cell($stock_item->stock_id);
52         label_cell($stock_item->item_description);
53         label_cell($stock_item->req_del_date, "nowrap align=right");
54         $dec = get_qty_dec($stock_item->stock_id);
55         qty_cell($stock_item->qty_received, false, $dec);
56         label_cell($stock_item->units);
57         amount_cell($stock_item->price);
58         amount_cell($line_total);
59         qty_cell($stock_item->qty_inv, false, $dec);
60         end_row();
61
62         $total += $line_total;
63 }
64
65 $display_total = number_format2($total,user_price_dec());
66 label_row(_("Total Excluding Tax/Shipping"),  $display_total,
67         "colspan=6", "nowrap align=right");
68
69 end_table(1);
70
71 is_voided_display(25, $_GET['trans_no'], _("This delivery has been voided."));
72
73 end_page(true);
74
75 ?>