Fixed numeric fields to accept user native number format.
[fa-stable.git] / inventory / reorder_level.php
1 <?php
2
3 $page_security = 4;
4 $path_to_root="..";
5 include_once($path_to_root . "/includes/session.inc");
6
7 page(_("Reorder Levels"));
8
9 include_once($path_to_root . "/includes/date_functions.inc");
10 include_once($path_to_root . "/includes/ui.inc");
11 include_once($path_to_root . "/includes/data_checks.inc");
12
13 include_once($path_to_root . "/inventory/includes/inventory_db.inc");
14
15 check_db_has_costable_items(_("There are no inventory items defined in the system (Purchased or manufactured items)."));
16
17 //------------------------------------------------------------------------------------
18
19 if (isset($_GET['stock_id']))
20 {
21         $_POST['stock_id'] = $_GET['stock_id'];
22 }
23
24 //------------------------------------------------------------------------------------
25
26 start_form(false, true);
27
28 if (!isset($_POST['stock_id']))
29         $_POST['stock_id'] = get_global_stock_item();
30
31 echo "<center>" . _("Item:"). "&nbsp;";
32 stock_costable_items_list('stock_id', $_POST['stock_id'], false, true);
33
34 echo "<hr>";
35
36 stock_item_heading($_POST['stock_id']);
37
38 set_global_stock_item($_POST['stock_id']);
39
40 start_table("$table_style width=30%");
41
42 $th = array(_("Location"), _("Quantity On Hand"), _("Re-Order Level"));
43 table_header($th);
44
45 $j = 1;
46 $k=0; //row colour counter
47
48 $result = get_loc_details($_POST['stock_id']);
49
50 while ($myrow = db_fetch($result)) 
51 {
52
53         alt_table_row_color($k);
54
55         if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"]))
56         {
57
58                 $myrow["reorder_level"] = input_num($myrow["loc_code"]);
59                 set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
60         }
61
62         $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
63         
64         label_cell($myrow["location_name"]);
65
66         $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"]);
67
68         label_cell(number_format2($qoh,user_qty_dec()), "nowrap align='right'");
69         amount_cells(null, $myrow["loc_code"]);
70         end_row();
71         $j++;
72         If ($j == 12)
73         {
74                 $j = 1;
75                 table_header($th);
76         }
77 }
78
79 end_table(1);
80
81 submit('UpdateData', _("Update"));
82
83 end_form();
84 end_page();
85
86 ?>