PageRenderTime 38ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/inventory/pages/main/template_main.php

http://phreedom.googlecode.com/
PHP | 94 lines | 73 code | 1 blank | 20 comment | 15 complexity | ba5209e42a9d6400e0fe2beae25c3ad0 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
  1. <?php
  2. // +-----------------------------------------------------------------+
  3. // | PhreeBooks Open Source ERP |
  4. // +-----------------------------------------------------------------+
  5. // | Copyright (c) 2008, 2009, 2010, 2011, 2012 PhreeSoft, LLC |
  6. // | http://www.PhreeSoft.com |
  7. // +-----------------------------------------------------------------+
  8. // | This program is free software: you can redistribute it and/or |
  9. // | modify it under the terms of the GNU General Public License as |
  10. // | published by the Free Software Foundation, either version 3 of |
  11. // | the License, or any later version. |
  12. // | |
  13. // | This program is distributed in the hope that it will be useful, |
  14. // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
  15. // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  16. // | GNU General Public License for more details. |
  17. // +-----------------------------------------------------------------+
  18. // Path: /modules/inventory/pages/main/template_main.php
  19. //
  20. echo html_form('inventory', FILENAME_DEFAULT, gen_get_all_get_params(array('action'))) . chr(10);
  21. echo html_hidden_field('todo', '') . chr(10);
  22. echo html_hidden_field('rowSeq', '') . chr(10);
  23. // customize the toolbar actions
  24. $toolbar->icon_list['cancel']['params'] = 'onclick="location.href = \'' . html_href_link(FILENAME_DEFAULT, '', 'SSL') . '\'"';
  25. $toolbar->icon_list['open']['show'] = false;
  26. $toolbar->icon_list['delete']['show'] = false;
  27. $toolbar->icon_list['save']['show'] = false;
  28. $toolbar->icon_list['print']['show'] = false;
  29. if ($security_level > 1) $toolbar->add_icon('new', 'onclick="submitToDo(\'new\')"', $order = 10);
  30. if (count($extra_toolbar_buttons) > 0) foreach ($extra_toolbar_buttons as $key => $value) $toolbar->icon_list[$key] = $value;
  31. $toolbar->add_help('07.04.01');
  32. if ($search_text) $toolbar->search_text = $search_text;
  33. echo $toolbar->build_toolbar($add_search = true);
  34. ?>
  35. <h1><?php echo MENU_HEADING_INVENTORY; ?></h1>
  36. <div id="filter_bar">
  37. <table class="ui-widget" style="border-style:none">
  38. <tbody class="ui-widget-content">
  39. <tr>
  40. <td><?php echo TEXT_FILTERS . '&nbsp;' . TEXT_SHOW_INACTIVE . '&nbsp;' . html_checkbox_field('f0', '1', $f0); ?></td>
  41. <td><?php echo '&nbsp;' . INV_ENTRY_INVENTORY_TYPE . '&nbsp;' . html_pull_down_menu('f1', $type_select_list, $f1, ''); ?></td>
  42. <td><?php echo '&nbsp;' . html_button_field('apply', TEXT_APPLY, 'onclick="submitToDo(\'search\');"'); ?></td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. </div>
  47. <div style="float:right"><?php echo $query_split->display_links($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['list']); ?></div>
  48. <div><?php echo $query_split->display_count($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['list'], TEXT_DISPLAY_NUMBER . TEXT_ITEMS); ?></div>
  49. <table class="ui-widget" style="border-collapse:collapse;width:100%">
  50. <thead class="ui-widget-header">
  51. <tr><?php echo $list_header; ?></tr>
  52. </thead>
  53. <tbody class="ui-widget-content">
  54. <?php
  55. $odd = true;
  56. while (!$query_result->EOF) {
  57. // only show quantity on hand if it is an inventory trackable item
  58. if (strpos(COG_ITEM_TYPES, $query_result->fields['inventory_type']) === false) {
  59. $qty_in_stock = '';
  60. } else {
  61. $qty_in_stock = $query_result->fields['quantity_on_hand'];
  62. }
  63. $bkgnd = ($query_result->fields['inactive']) ? ' style="background-color:pink"' : '';
  64. ?>
  65. <tr class="<?php echo $odd?'odd':'even'; ?>" style="cursor:pointer">
  66. <td<?php echo $bkgnd; ?> onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?>)"><?php echo $query_result->fields['sku']; ?></td>
  67. <td align="center" onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?>)"><?php echo ($query_result->fields['inactive']=='0' ? '' : TEXT_YES); ?></td>
  68. <td onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?>)"><?php echo $query_result->fields['description_short']; ?></td>
  69. <td align="center" onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?>)"><?php echo $qty_in_stock; ?></td>
  70. <td align="center" onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?>)"><?php echo $query_result->fields['quantity_on_sales_order']; ?></td>
  71. <td align="center" onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?>)"><?php echo $query_result->fields['quantity_on_allocation']; ?></td>
  72. <td align="center" onclick="submitSeq(<?php echo $query_result->fields['id'] . ', \'edit\''; ?>)"><?php echo $query_result->fields['quantity_on_order']; ?></td>
  73. <td align="right">
  74. <?php // build the action toolbar
  75. if (function_exists('add_extra_action_bar_buttons')) echo add_extra_action_bar_buttons($query_result->fields);
  76. if ($security_level > 1) echo html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'edit\')"') . chr(10);
  77. if ($security_level > 3 && $query_result->fields['inventory_type'] <> 'mi') echo html_icon('apps/accessories-text-editor.png', TEXT_RENAME, 'small', 'onclick="renameItem(' . $query_result->fields['id'] . ')"') . chr(10);
  78. if ($security_level > 3 && $query_result->fields['inventory_type'] <> 'mi') echo html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . INV_MSG_DELETE_INV_ITEM . '\')) deleteItem(' . $query_result->fields['id'] . ')"') . chr(10);
  79. if ($security_level > 1 && $query_result->fields['inventory_type'] <> 'mi') echo html_icon('actions/edit-copy.png', TEXT_COPY_TO, 'small', 'onclick="copyItem(' . $query_result->fields['id'] . ')"') . chr(10);
  80. if ($security_level > 2) echo html_icon('mimetypes/x-office-spreadsheet.png', TEXT_SALES_PRICE_SHEETS, 'small', 'onclick="priceMgr(' . $query_result->fields['id'] . ', ' . $query_result->fields['item_cost'] . ', ' . $query_result->fields['full_price'] . ', \'c\')"') . chr(10);
  81. ?>
  82. </td>
  83. </tr>
  84. <?php
  85. $query_result->MoveNext();
  86. $odd = !$odd;
  87. }
  88. ?>
  89. </tbody>
  90. </table>
  91. <div style="float:right"><?php echo $query_split->display_links($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['list']); ?></div>
  92. <div><?php echo $query_split->display_count($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['list'], TEXT_DISPLAY_NUMBER . TEXT_ITEMS); ?></div>
  93. </form>