e5722c54ff5e6fd4e08d5aa1503a89dbdbbd4679
[fa-stable.git] / inventory / view / view_adjustment.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_ITEMSTRANSVIEW';
13 $path_to_root = "../..";
14
15 include($path_to_root . "/includes/session.inc");
16
17 page(_($help_context = "View Inventory Adjustment"), true);
18
19 include_once($path_to_root . "/includes/date_functions.inc");
20 include_once($path_to_root . "/includes/ui.inc");
21 include_once($path_to_root . "/inventory/includes/inventory_db.inc");
22
23 if (isset($_GET["trans_no"]))
24 {
25         $trans_no = $_GET["trans_no"];
26 }
27
28 display_heading($systypes_array[ST_INVADJUST] . " #$trans_no");
29
30 br(1);
31 $adjustment_items = get_stock_adjustment_items($trans_no);
32 $k = 0;
33 $header_shown = false;
34 while ($adjustment = db_fetch($adjustment_items))
35 {
36
37         if (!$header_shown)
38         {
39                 $adjustment_type = get_movement_type($adjustment['person_id']) ;
40
41                 start_table(TABLESTYLE2, "width=90%");
42                 start_row();
43                 label_cells(_("At Location"), $adjustment['location_name'], "class='tableheader2'");
44         label_cells(_("Reference"), $adjustment['reference'], "class='tableheader2'", "colspan=6");
45                 label_cells(_("Date"), sql2date($adjustment['tran_date']), "class='tableheader2'");
46                 label_cells(_("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'");
47                 end_row();
48                 comments_display_row(ST_INVADJUST, $trans_no);
49
50                 end_table();
51                 $header_shown = true;
52
53                 echo "<br>";
54                 start_table(TABLESTYLE, "width=90%");
55
56         $th = array(_("Item"), _("Description"), _("Quantity"),
57                 _("Units"), _("Unit Cost"));
58         table_header($th);
59         }
60
61     alt_table_row_color($k);
62
63     label_cell($adjustment['stock_id']);
64     label_cell($adjustment['description']);
65     qty_cell($adjustment['qty'], false, get_qty_dec($adjustment['stock_id']));
66     label_cell($adjustment['units']);
67     amount_decimal_cell($adjustment['standard_cost']);
68     end_row();
69 }
70
71 end_table(1);
72
73 is_voided_display(ST_INVADJUST, $trans_no, _("This adjustment has been voided."));
74
75 end_page(true, false, false, ST_INVADJUST, $trans_no);
76 ?>