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_ITEM';
13 $path_to_root = "../..";
14 include($path_to_root . "/includes/session.inc");
17 if ($SysPrefs->use_popup_windows)
18 $js .= get_js_open_window(900, 500);
19 if (user_use_date_picker())
20 $js .= get_js_date_picker();
22 if (isset($_GET['type'])) {
23 if ($_GET['type'] == 'F') {
25 $page_security = 'SA_ASSET';
26 $_SESSION['page_title'] = _($help_context = "Fixed Assets");
27 $_POST['mb_flag'] = 'F';
28 } elseif ($_GET['type'] == 'T') {
30 $page_security = 'SA_SHIPPING';
31 $_SESSION['page_title'] = _($help_context = "Shipping Options");
32 $_POST['mb_flag'] = 'T';
36 $_SESSION['page_title'] = _($help_context = "Items");
40 page($_SESSION['page_title'], false, false, "", $js);
42 include_once($path_to_root . "/includes/date_functions.inc");
43 include_once($path_to_root . "/includes/ui.inc");
44 include_once($path_to_root . "/includes/data_checks.inc");
46 include_once($path_to_root . "/inventory/includes/inventory_db.inc");
47 include_once($path_to_root . "/fixed_assets/includes/fixed_assets_db.inc");
49 $user_comp = user_company();
50 $new_item = get_post('stock_id')=='' || get_post('cancel') || get_post('clone');
51 //------------------------------------------------------------------------------------
52 function set_edit($stock_id)
54 $_POST = array_merge($_POST, get_item($stock_id));
56 $_POST['depreciation_rate'] = number_format2($_POST['depreciation_rate'], 1);
57 $_POST['depreciation_factor'] = number_format2($_POST['depreciation_factor'], 1);
58 $_POST['depreciation_start'] = sql2date($_POST['depreciation_start']);
59 $_POST['depreciation_date'] = sql2date($_POST['depreciation_date']);
60 $_POST['del_image'] = 0;
63 if (isset($_GET['stock_id']))
65 $_POST['stock_id'] = $_GET['stock_id'];
67 $stock_id = get_post('stock_id');
68 if (list_updated('stock_id')) {
69 $_POST['NewStockID'] = $stock_id = get_post('stock_id');
71 $Ajax->activate('details');
72 $Ajax->activate('controls');
75 if (get_post('cancel')) {
76 $_POST['NewStockID'] = $stock_id = $_POST['stock_id'] = '';
78 set_focus('stock_id');
79 $Ajax->activate('_page_body');
81 if (list_updated('category_id') || list_updated('mb_flag') || list_updated('fa_class_id') || list_updated('depreciation_method')) {
82 $Ajax->activate('details');
85 if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
87 $stock_id = $_POST['NewStockID'];
88 $result = $_FILES['pic']['error'];
89 $upload_file = 'Yes'; //Assume all is well to start off with
90 $filename = company_path().'/images';
91 if (!file_exists($filename))
95 $filename .= "/".item_img_name($stock_id).".jpg";
97 if ($_FILES['pic']['error'] == UPLOAD_ERR_INI_SIZE) {
98 display_error(_('The file size is over the maximum allowed.'));
101 elseif ($_FILES['pic']['error'] > 0) {
102 display_error(_('Error uploading file.'));
106 //But check for the worst
107 if ((list($width, $height, $type, $attr) = getimagesize($_FILES['pic']['tmp_name'])) !== false)
112 if ($imagetype != IMAGETYPE_GIF && $imagetype != IMAGETYPE_JPEG && $imagetype != IMAGETYPE_PNG)
114 display_warning( _('Only graphics files can be uploaded'));
117 elseif (!in_array(strtoupper(substr(trim($_FILES['pic']['name']), strlen($_FILES['pic']['name']) - 3)), array('JPG','PNG','GIF')))
119 display_warning(_('Only graphics files are supported - a file extension of .jpg, .png or .gif is expected'));
122 elseif ( $_FILES['pic']['size'] > ($SysPrefs->max_image_size * 1024))
124 display_warning(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $SysPrefs->max_image_size);
127 elseif ( $_FILES['pic']['type'] == "text/plain" )
129 display_warning( _('Only graphics files can be uploaded'));
132 elseif (file_exists($filename))
134 $result = unlink($filename);
137 display_error(_('The existing image could not be removed'));
142 if ($upload_file == 'Yes')
144 $result = move_uploaded_file($_FILES['pic']['tmp_name'], $filename);
146 $Ajax->activate('details');
147 /* EOF Add Image upload for New Item - by Ori */
150 if (get_post('mb_flag') == 'F') {
151 check_db_has_fixed_asset_categories(_("There are no fixed asset categories defined in the system. At least one fixed asset category is required to add a fixed asset."));
152 check_db_has_fixed_asset_classes(_("There are no fixed asset classes defined in the system. At least one fixed asset class is required to add a fixed asset."));
154 check_db_has_stock_categories(_("There are no item categories defined in the system. At least one item category is required to add a item."));
156 check_db_has_item_tax_types(_("There are no item tax types defined in the system. At least one item tax type is required to add a item."));
158 function clear_data()
160 unset($_POST['long_description']);
161 unset($_POST['description']);
162 unset($_POST['category_id']);
163 unset($_POST['tax_type_id']);
164 unset($_POST['units']);
165 if (!in_array(@$_POST['mb_flag'], array('T', 'F')))
166 unset($_POST['mb_flag']);
167 unset($_POST['NewStockID']);
168 unset($_POST['dimension_id']);
169 unset($_POST['dimension2_id']);
170 unset($_POST['no_sale']);
171 unset($_POST['no_purchase']);
172 unset($_POST['depreciation_method']);
173 unset($_POST['depreciation_rate']);
174 unset($_POST['depreciation_factor']);
175 unset($_POST['depreciation_start']);
178 //------------------------------------------------------------------------------------
180 if (isset($_POST['addupdate']))
184 if ($upload_file == 'No')
186 if (strlen($_POST['description']) == 0)
189 display_error( _('The item name must be entered.'));
190 set_focus('description');
192 elseif (strlen($_POST['NewStockID']) == 0)
195 display_error( _('The item code cannot be empty'));
196 set_focus('NewStockID');
198 elseif (strstr($_POST['NewStockID'], " ") || strstr($_POST['NewStockID'],"'") ||
199 strstr($_POST['NewStockID'], "+") || strstr($_POST['NewStockID'], "\"") ||
200 strstr($_POST['NewStockID'], "&") || strstr($_POST['NewStockID'], "\t"))
203 display_error( _('The item code cannot contain any of the following characters - & + OR a space OR quotes'));
204 set_focus('NewStockID');
207 elseif ($new_item && db_num_rows(get_item_kit($_POST['NewStockID'])))
210 display_error( _("This item code is already assigned to stock item or sale kit."));
211 set_focus('NewStockID');
214 if (get_post('mb_flag') == 'F') {
215 if ($_POST['depreciation_rate'] > 100) {
216 $_POST['depreciation_rate'] = 100;
218 elseif ($_POST['depreciation_rate'] < 0) {
219 $_POST['depreciation_rate'] = 0;
221 $move_row = get_fixed_asset_move($_POST['NewStockID'], ST_SUPPRECEIVE);
222 if (isset($_POST['depreciation_start']) && strtotime($_POST['depreciation_start']) < strtotime($move_row['tran_date'])) {
223 display_warning(_('The depracation cannot start before the fixed asset purchase date'));
227 if ($input_error != 1)
229 if (check_value('del_image'))
231 $filename = company_path().'/images/'.item_img_name($_POST['NewStockID']).".jpg";
232 if (file_exists($filename))
236 write_item(get_post('stock_id'),
237 $_POST['NewStockID'], $_POST['description'],
238 $_POST['long_description'], $_POST['category_id'],
239 $_POST['tax_type_id'], get_post('units'),
240 get_post('mb_flag'), $_POST['sales_account'],
241 $_POST['inventory_account'], $_POST['cogs_account'],
242 $_POST['adjustment_account'], $_POST['wip_account'],
243 $_POST['dimension_id'], $_POST['dimension2_id'],
244 check_value('no_sale'), check_value('editable'), check_value('no_purchase'),
245 get_post('depreciation_method'), input_num('depreciation_rate'), input_num('depreciation_factor'), get_post('depreciation_start', null),
246 get_post('fa_class_id'), get_post('vat_category'), get_post('shipper', 0), check_value('inactive'));
249 { /*so its an existing one */
250 set_focus('stock_id');
251 $Ajax->activate('stock_id'); // in case of status change
252 display_notification(_("Item has been updated."));
256 display_notification(_("A new item has been added."));
257 $_POST['stock_id'] = $_POST['NewStockID'] =
258 $_POST['description'] = $_POST['long_description'] = '';
259 $_POST['no_sale'] = $_POST['editable'] = $_POST['no_purchase'] =0;
260 set_focus('NewStockID');
262 $Ajax->activate('_page_body');
266 if (get_post('clone')) {
267 set_edit($_POST['stock_id']); // restores data for disabled inputs too
268 unset($_POST['stock_id']);
270 unset($_POST['inactive']);
271 set_focus('NewStockID');
272 $Ajax->activate('_page_body');
275 //------------------------------------------------------------------------------------
277 function check_usage($stock_id, $dispmsg=true)
279 $msg = item_in_foreign_codes($stock_id);
282 if($dispmsg) display_error($msg);
288 //------------------------------------------------------------------------------------
290 if (isset($_POST['delete']) && strlen($_POST['delete']) > 1)
293 if (check_usage($_POST['NewStockID'])) {
295 $stock_id = $_POST['NewStockID'];
296 delete_item($stock_id);
297 $filename = company_path().'/images/'.item_img_name($stock_id).".jpg";
298 if (file_exists($filename))
300 display_notification(_("Selected item has been deleted."));
301 $_POST['stock_id'] = '';
303 set_focus('stock_id');
305 $Ajax->activate('_page_body');
309 function generateBarcode() {
312 while ($tmpBarcodeID == "") {
313 srand ((double) microtime( )*1000000);
314 $random_1 = rand(1,9);
315 $random_2 = rand(0,9);
316 $random_3 = rand(0,9);
317 $random_4 = rand(0,9);
318 $random_5 = rand(0,9);
319 $random_6 = rand(0,9);
320 $random_7 = rand(0,9);
321 //$random_8 = rand(0,9);
323 // http://stackoverflow.com/questions/1136642/ean-8-how-to-calculate-checksum-digit
324 $sum1 = $random_2 + $random_4 + $random_6;
325 $sum2 = 3 * ($random_1 + $random_3 + $random_5 + $random_7 );
326 $checksum_value = $sum1 + $sum2;
328 $checksum_digit = 10 - ($checksum_value % 10);
329 if ($checksum_digit == 10)
332 $random_8 = $checksum_digit;
334 $tmpBarcodeID = $random_1 . $random_2 . $random_3 . $random_4 . $random_5 . $random_6 . $random_7 . $random_8;
336 // LETS CHECK TO SEE IF THIS NUMBER HAS EVER BEEN USED
337 $query = "SELECT stock_id FROM ".TB_PREF."stock_master WHERE stock_id='" . $tmpBarcodeID . "'";
338 $arr_stock = db_fetch(db_query($query));
340 if ( !$arr_stock['stock_id'] ) {
341 return $tmpBarcodeID;
347 function item_settings(&$stock_id, $new_item)
349 global $SysPrefs, $path_to_root, $page_nested, $depreciation_methods;
351 start_outer_table(TABLESTYLE2);
355 table_section_title(_("General Settings"));
357 //------------------------------------------------------------------------------------
362 if (!empty($SysPrefs->prefs['barcodes_on_stock']))
364 $post_label = '<button class="ajaxsubmit" type="submit" aspect=\'default\' name="generateBarcode" id="generateBarcode" value="Generate Barcode EAN8"> '._("Generate EAN-8 Barcode").' </button>';
365 if (isset($_POST['generateBarcode']))
367 $tmpCodeID=generateBarcode();
368 $_POST['NewStockID'] = $tmpCodeID;
371 text_row(_("Item Code:"), 'NewStockID', $tmpCodeID, 21, 20, null, "", $post_label);
372 $_POST['inactive'] = 0;
375 { // Must be modifying an existing item
376 if (get_post('NewStockID') != get_post('stock_id') || get_post('addupdate')) { // first item display
378 $_POST['NewStockID'] = $_POST['stock_id'];
379 set_edit($_POST['stock_id']);
381 label_row(_("Item Code:"),$_POST['NewStockID']);
382 hidden('NewStockID', $_POST['NewStockID']);
383 set_focus('description');
386 text_row(_("Name:"), 'description', null, 52, 200);
388 textarea_row(_('Description:'), 'long_description', null, 42, 3);
390 stock_categories_list_row(_("Category:"), 'category_id', null, false, $new_item, get_post('mb_flag'));
392 if ($new_item && (list_updated('category_id') || !isset($_POST['sales_account']))) { // changed category for new item or first page view
394 $category_record = get_item_category($_POST['category_id']);
396 $_POST['tax_type_id'] = $category_record["dflt_tax_type"];
397 $_POST['units'] = $category_record["dflt_units"];
398 if (!in_array(get_post('mb_flag'), array('T', 'F')))
399 $_POST['mb_flag'] = $category_record["dflt_mb_flag"];
400 $_POST['inventory_account'] = $category_record["dflt_inventory_act"];
401 $_POST['cogs_account'] = $category_record["dflt_cogs_act"];
402 if (get_post('mb_flag') == 'T' && !isset($_POST['sales_account']))
403 $_POST['sales_account'] = get_company_pref('freight_act');
405 $_POST['sales_account'] = $category_record["dflt_sales_act"];
406 $_POST['adjustment_account'] = $category_record["dflt_adjustment_act"];
407 $_POST['wip_account'] = $category_record["dflt_wip_act"];
408 $_POST['dimension_id'] = $category_record["dflt_dim1"];
409 $_POST['dimension2_id'] = $category_record["dflt_dim2"];
410 $_POST['no_sale'] = $category_record["dflt_no_sale"];
411 $_POST['no_purchase'] = $category_record["dflt_no_purchase"];
412 $_POST['editable'] = 0;
415 $fresh_item = !isset($_POST['NewStockID']) || $new_item
416 || check_usage($_POST['stock_id'],false);
418 // show inactive item tax type in selector only if already set.
419 item_tax_types_list_row(_("Item Tax Type:"), 'tax_type_id', null, !$new_item && item_type_inactive(get_post('tax_type_id')));
421 if (!in_array(get_post('mb_flag'), array('T', 'F')))
422 stock_item_types_list_row(_("Item Type:"), 'mb_flag', null, $fresh_item, false);
424 stock_units_list_row(_('Units of Measure:'), 'units', null, $fresh_item);
426 vat_category_list_row(_("VAT category:"), 'vat_category', null, $fresh_item, false, !$new_item);
428 if (get_post('mb_flag') != 'T')
429 check_row(_("Editable description:"), 'editable');
431 if (get_post('mb_flag') == 'F')
432 hidden('no_sale', 0);
434 check_row(_("Exclude from sales:"), 'no_sale');
436 check_row(_("Exclude from purchases:"), 'no_purchase');
438 if (get_post('mb_flag') == 'F') {
439 table_section_title(_("Depreciation"));
441 fixed_asset_classes_list_row(_("Fixed Asset Class").':', 'fa_class_id', null, false, true);
443 array_selector_row(_("Depreciation Method").":", "depreciation_method", null, $depreciation_methods, array('select_submit'=> true));
445 if (!isset($_POST['depreciation_rate']) || (list_updated('fa_class_id') || list_updated('depreciation_method'))) {
446 $class_row = get_fixed_asset_class($_POST['fa_class_id']);
447 $_POST['depreciation_rate'] = get_post('depreciation_method') == 'N' ? ceil(100/$class_row['depreciation_rate'])
448 : $class_row['depreciation_rate'];
451 if ($_POST['depreciation_method'] == 'O')
453 hidden('depreciation_rate', 100);
454 label_row(_("Depreciation Rate").':', "100 %");
456 elseif ($_POST['depreciation_method'] == 'N')
458 small_amount_row(_("Depreciation Years").':', 'depreciation_rate', null, null, _('years'), 0);
460 elseif ($_POST['depreciation_method'] == 'D')
461 small_amount_row(_("Base Rate").':', 'depreciation_rate', null, null, '%', user_percent_dec());
463 small_amount_row(_("Depreciation Rate").':', 'depreciation_rate', null, null, '%', user_percent_dec());
465 if ($_POST['depreciation_method'] == 'D')
466 small_amount_row(_("Rate multiplier").':', 'depreciation_factor', null, null, '', 2);
468 // do not allow to change the depreciation start after this item has been depreciated
469 if ($new_item || $_POST['depreciation_start'] == $_POST['depreciation_date'])
470 date_row(_("Depreciation Start").':', 'depreciation_start', null, null, 1 - date('j'));
472 hidden('depreciation_start');
473 label_row(_("Depreciation Start").':', $_POST['depreciation_start']);
474 label_row(_("Last Depreciation").':', $_POST['depreciation_date']==$_POST['depreciation_start'] ? _("None") : $_POST['depreciation_date']);
476 hidden('depreciation_date');
477 } else if (get_post('mb_flag') == 'T') {
478 shippers_list_row(_("Shipping company:"), 'shipper');
482 $dim = get_company_pref('use_dimension');
485 table_section_title(_("Dimensions"));
487 dimensions_list_row(_("Dimension")." 1", 'dimension_id', null, true, " ", false, 1);
489 dimensions_list_row(_("Dimension")." 2", 'dimension2_id', null, true, " ", false, 2);
492 hidden('dimension_id', 0);
494 hidden('dimension2_id', 0);
496 table_section_title(_("GL Accounts"));
498 gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', $_POST['sales_account']);
500 switch(get_post('mb_flag')) {
502 gl_all_accounts_list_row(_("Asset account:"), 'inventory_account', $_POST['inventory_account']);
503 gl_all_accounts_list_row(_("Depreciation cost account:"), 'cogs_account', $_POST['cogs_account']);
504 gl_all_accounts_list_row(_("Depreciation/Disposal account:"), 'adjustment_account', $_POST['adjustment_account']);
508 gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'cogs_account', $_POST['cogs_account']);
509 hidden('inventory_account', $_POST['inventory_account']);
510 hidden('adjustment_account', $_POST['adjustment_account']);
513 gl_all_accounts_list_row(_("Inventory Account:"), 'inventory_account', $_POST['inventory_account']);
514 gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'cogs_account', $_POST['cogs_account']);
515 gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'adjustment_account', $_POST['adjustment_account']);
518 if (is_manufactured(get_post('mb_flag')))
519 gl_all_accounts_list_row(_("WIP Account:"), 'wip_account', $_POST['wip_account']);
521 hidden('wip_account', $_POST['wip_account']);
523 table_section_title(_("Other"));
525 // Add image upload for New Item - by Joe
526 file_row(_("Image File (.jpg)") . ":", 'pic', 'pic');
527 // Add Image upload for New Item - by Joe
528 $stock_img_link = "";
529 $check_remove_image = false;
530 if (isset($_POST['NewStockID']) && file_exists(company_path().'/images/'
531 .item_img_name($_POST['NewStockID']).".jpg"))
533 // 31/08/08 - rand() call is necessary here to avoid caching problems.
534 $stock_img_link .= "<img id='item_img' alt = '[".$_POST['NewStockID'].".jpg".
535 "]' src='".company_path().'/images/'.item_img_name($_POST['NewStockID']).
536 ".jpg?nocache=".rand()."'"." height='".$SysPrefs->pic_height."' border='0'>";
537 $check_remove_image = true;
541 $stock_img_link .= _("No image");
544 label_row(" ", $stock_img_link);
545 if ($check_remove_image)
546 check_row(_("Delete Image:"), 'del_image');
548 record_status_list_row(_("Item status:"), 'inactive');
549 if (get_post('mb_flag') == 'F') {
550 table_section_title(_("Values"));
552 hidden('material_cost');
553 hidden('purchase_cost');
554 label_row(_("Initial Value").":", price_format($_POST['purchase_cost']), "", "align='right'");
555 label_row(_("Depreciations").":", price_format($_POST['purchase_cost'] - $_POST['material_cost']), "", "align='right'");
556 label_row(_("Current Value").':', price_format($_POST['material_cost']), "", "align='right'");
561 div_start('controls');
562 if (@$_REQUEST['popup']) hidden('popup', 1);
563 if (!isset($_POST['NewStockID']) || $new_item)
565 submit_center('addupdate', _("Insert New Item"), true, '', 'default');
569 submit_center_first('addupdate', _("Update Item"), '',
570 $page_nested ? true : 'default');
571 submit_return('select', get_post('stock_id'),
572 _("Select this items and return to document entry."));
573 submit('clone', _("Clone This Item"), true, '', true);
574 submit('delete', _("Delete This Item"), true, '', true);
575 submit_center_last('cancel', _("Cancel"), _("Cancel Edition"), 'cancel');
581 //--------------------------------------------------------------------------------------------
585 if (db_has_stock_items())
587 start_table(TABLESTYLE_NOBORDER);
589 if (get_post('mb_flag') == 'T')
590 shipping_methods_list_cells(_("Select method:"), 'stock_id', null, _("New method"), true);
592 stock_items_list_cells(_("Select an item:"), 'stock_id', null,
593 _('New item'), true, check_value('show_inactive'), false,
594 array('fixed_asset' => get_post('mb_flag') == 'F'));
595 $new_item = get_post('stock_id')=='';
596 check_cells(_("Show inactive:"), 'show_inactive', null, true);
600 if (get_post('_show_inactive_update')) {
601 $Ajax->activate('stock_id');
602 set_focus('stock_id');
607 hidden('stock_id', get_post('stock_id'));
610 div_start('details');
612 $stock_id = get_post('stock_id');
614 unset($_POST['_tabs_sel']); // force settings tab for new customer
616 switch(get_post('mb_flag')) {
619 'settings' => array(_('&General settings'), $stock_id),
620 'movement' => array(_('&Transactions'), $stock_id) );
624 'settings' => array(_('&General settings'), $stock_id),
625 'sales_pricing' => array(_('S&ales Pricing'), (user_check_access('SA_SALESPRICE') ? $stock_id : null)),
626 'purchase_pricing' => array(_('&Purchasing Pricing'), (user_check_access('SA_PURCHASEPRICING') ? $stock_id : null)),
627 'unit_cost' => array(_('Unit &Cost'), (user_check_access('SA_STANDARDCOST') ? $stock_id : null)),
633 'settings' => array(_('&General settings'), $stock_id),
634 'sales_pricing' => array(_('S&ales Pricing'), (user_check_access('SA_SALESPRICE') ? $stock_id : null)),
635 'purchase_pricing' => array(_('&Purchasing Pricing'), (user_check_access('SA_PURCHASEPRICING') ? $stock_id : null)),
636 'unit_cost' => array(_('Unit &Cost'), (user_check_access('SA_STANDARDCOST') ? $stock_id : null)),
637 'reorder_level' => array(_('&Reorder Levels'), (is_inventory_item($stock_id) &&
638 user_check_access('SA_REORDER') ? $stock_id : null)),
639 'movement' => array(_('&Transactions'), (user_check_access('SA_ITEMSTRANSVIEW') && is_inventory_item($stock_id) ?
641 'status' => array(_('&Status'), (user_check_access('SA_ITEMSSTATVIEW') ? $stock_id : null)), );
643 tabbed_content_start('tabs', $tabs);
645 switch (get_post('_tabs_sel')) {
648 item_settings($stock_id, $new_item);
650 case 'sales_pricing':
651 $_GET['stock_id'] = $stock_id;
652 $_GET['page_level'] = 1;
653 include_once($path_to_root."/inventory/prices.php");
655 case 'purchase_pricing':
656 $_GET['stock_id'] = $stock_id;
657 $_GET['page_level'] = 1;
658 include_once($path_to_root."/inventory/purchasing_data.php");
661 $_GET['stock_id'] = $stock_id;
662 $_GET['page_level'] = 1;
663 include_once($path_to_root."/inventory/cost_update.php");
665 case 'reorder_level':
666 if (!is_inventory_item($stock_id))
668 $_GET['page_level'] = 1;
669 $_GET['stock_id'] = $stock_id;
670 include_once($path_to_root."/inventory/reorder_level.php");
673 if (!is_inventory_item($stock_id))
675 $_GET['stock_id'] = $stock_id;
676 include_once($path_to_root."/inventory/inquiry/stock_movements.php");
679 $_GET['stock_id'] = $stock_id;
680 include_once($path_to_root."/inventory/inquiry/stock_status.php");
685 tabbed_content_end();
689 hidden('fixed_asset', get_post('fixed_asset'));
690 if (in_array(get_post('mb_flag'), array('F', 'T')))
691 hidden('mb_flag', get_post('mb_flag'));