"inventory/manage/sales_kits.php?", 'SA_SALESKIT', MENU_MAINTENANCE);
$this->add_lapp_function(2, _("Item &Categories"),
"inventory/manage/item_categories.php?", 'SA_ITEMCATEGORY', MENU_MAINTENANCE);
- $this->add_lapp_function(2, _("Inventory &Locations"),
+ $this->add_rapp_function(2, _("Inventory &Locations"),
"inventory/manage/locations.php?", 'SA_INVENTORYLOCATION', MENU_MAINTENANCE);
- $this->add_rapp_function(2, _("Inventory &Movement Types"),
- "inventory/manage/movement_types.php?", 'SA_INVENTORYMOVETYPE', MENU_MAINTENANCE);
$this->add_rapp_function(2, _("&Units of Measure"),
"inventory/manage/item_units.php?", 'SA_UOM', MENU_MAINTENANCE);
$this->add_rapp_function(2, _("&Reorder Levels"),
}
}
-function db_has_movement_types()
-{
- return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."movement_types");
-}
-
-function check_db_has_movement_types($msg)
-{
- global $path_to_root;
- if (!db_has_movement_types())
- {
- display_error($msg, true);
- end_page();
- exit;
- }
-}
-
function db_customer_has_branches($customer_id)
{
return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."cust_branch "
//-----------------------------------------------------------------------------------------------
-function movement_types_list($name, $selected_id=null)
-{
- $sql = "SELECT id, name FROM ".TB_PREF."movement_types";
- return combo_input($name, $selected_id, $sql, 'id', 'name', array());
-}
-
-function movement_types_list_cells($label, $name, $selected_id=null)
-{
- if ($label != null)
- echo "<td>$label</td>\n";
- echo "<td>";
- echo movement_types_list($name, $selected_id);
- echo "</td>\n";
-}
-
-function movement_types_list_row($label, $name, $selected_id=null)
-{
- echo "<tr><td class='label'>$label</td>";
- movement_types_list_cells(null, $name, $selected_id);
- echo "</tr>\n";
-}
-
-//-----------------------------------------------------------------------------------------------
function _format_date($row)
{
return sql2date($row['reconciled']);
+++ /dev/null
-<?php
-/**********************************************************************
- Copyright (C) FrontAccounting, LLC.
- Released under the terms of the GNU General Public License, GPL,
- as published by the Free Software Foundation, either version 3
- of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
-***********************************************************************/
-function add_movement_type($name)
-{
- $sql = "INSERT INTO ".TB_PREF."movement_types (name)
- VALUES (".db_escape($name).")";
-
- db_query($sql, "could not add item movement type");
-}
-
-function update_movement_type($type_id, $name)
-{
- $sql = "UPDATE ".TB_PREF."movement_types SET name=".db_escape($name)."
- WHERE id=".db_escape($type_id);
-
- db_query($sql, "could not update item movement type");
-}
-
-function get_all_movement_type($all=false)
-{
- $sql = "SELECT * FROM ".TB_PREF."movement_types";
- if (!$all) $sql .= " WHERE !inactive";
-
- return db_query($sql, "could not get all item movement type");
-}
-
-function get_movement_type($type_id)
-{
- $sql = "SELECT * FROM ".TB_PREF."movement_types WHERE id=".db_escape($type_id);
-
- $result = db_query($sql, "could not get item movement type");
-
- return db_fetch($result);
-}
-
-function delete_movement_type($type_id)
-{
- $sql="DELETE FROM ".TB_PREF."movement_types WHERE id=".db_escape($type_id);
-
- db_query($sql, "could not delete item movement type");
-}
-
-
-function get_stock_movements_before($stock_id, $StockLocation, $AfterDate)
-{
- $after_date = date2sql($AfterDate);
- $sql = "SELECT SUM(qty) FROM ".TB_PREF."stock_moves WHERE stock_id=".db_escape($stock_id);
- if ($StockLocation)
- $sql .= " AND loc_code=".db_escape( $StockLocation);
- $sql .= " AND tran_date < '" . $after_date . "'";
- $before_qty = db_query($sql, "The starting quantity on hand could not be calculated");
-
- $before_qty_row = db_fetch_row($before_qty);
- return $before_qty_row[0];
-}
-
-function movement_types_in_stock_moves($selected_id)
-{
- $sql= "SELECT COUNT(*) FROM ".TB_PREF."stock_moves
- WHERE type=" . ST_INVADJUST. " AND person_id=".db_escape($selected_id);
-
- $result = db_query($sql, "could not query stock moves");
- $myrow = db_fetch_row($result);
- return ($myrow[0] > 0);
-}
include_once($path_to_root . "/inventory/includes/db/items_codes_db.inc");
include_once($path_to_root . "/inventory/includes/db/items_db.inc");
include_once($path_to_root . "/inventory/includes/db/items_locations_db.inc");
-include_once($path_to_root . "/inventory/includes/db/movement_types_db.inc");
include_once($path_to_root . "/inventory/includes/db/items_adjust_db.inc");
include_once($path_to_root . "/inventory/includes/db/items_transfer_db.inc");
include_once($path_to_root . "/inventory/includes/db/items_units_db.inc");
+++ /dev/null
-<?php
-/**********************************************************************
- Copyright (C) FrontAccounting, LLC.
- Released under the terms of the GNU General Public License, GPL,
- as published by the Free Software Foundation, either version 3
- of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
-***********************************************************************/
-$page_security = 'SA_INVENTORYMOVETYPE';
-$path_to_root = "../..";
-include($path_to_root . "/includes/session.inc");
-
-page(_($help_context = "Inventory Movement Types"));
-
-include_once($path_to_root . "/inventory/includes/inventory_db.inc");
-
-include_once($path_to_root . "/includes/ui.inc");
-
-simple_page_mode(true);
-//-----------------------------------------------------------------------------------
-
-if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
-{
-
- //initialise no input errors assumed initially before we test
- $input_error = 0;
-
- if (strlen($_POST['name']) == 0)
- {
- $input_error = 1;
- display_error(_("The inventory movement type name cannot be empty."));
- set_focus('name');
- }
-
- if ($input_error != 1)
- {
- if ($selected_id != -1)
- {
- update_movement_type($selected_id, $_POST['name']);
- display_notification(_('Selected movement type has been updated'));
- }
- else
- {
- add_movement_type($_POST['name']);
- display_notification(_('New movement type has been added'));
- }
-
- $Mode = 'RESET';
- }
-}
-
-//-----------------------------------------------------------------------------------
-
-function can_delete($selected_id)
-{
- if (movement_types_in_stock_moves($selected_id))
- {
- display_error(_("Cannot delete this inventory movement type because item transactions have been created referring to it."));
- return false;
- }
-
- return true;
-}
-
-
-//-----------------------------------------------------------------------------------
-
-if ($Mode == 'Delete')
-{
- if (can_delete($selected_id))
- {
- delete_movement_type($selected_id);
- display_notification(_('Selected movement type has been deleted'));
- }
- $Mode = 'RESET';
-}
-
-if ($Mode == 'RESET')
-{
- $selected_id = -1;
- $sav = get_post('show_inactive');
- unset($_POST);
- $_POST['show_inactive'] = $sav;
-}
-//-----------------------------------------------------------------------------------
-
-$result = get_all_movement_type(check_value('show_inactive'));
-
-start_form();
-start_table(TABLESTYLE, "width='30%'");
-
-$th = array(_("Description"), "", "");
-inactive_control_column($th);
-table_header($th);
-$k = 0;
-while ($myrow = db_fetch($result))
-{
-
- alt_table_row_color($k);
-
- label_cell($myrow["name"]);
- inactive_control_cell($myrow["id"], $myrow["inactive"], 'movement_types', 'id');
- edit_button_cell("Edit".$myrow['id'], _("Edit"));
- delete_button_cell("Delete".$myrow['id'], _("Delete"));
- end_row();
-}
-inactive_control_row($th);
-end_table(1);
-
-//-----------------------------------------------------------------------------------
-
-start_table(TABLESTYLE2);
-
-if ($selected_id != -1)
-{
- if ($Mode == 'Edit') {
- //editing an existing status code
-
- $myrow = get_movement_type($selected_id);
-
- $_POST['name'] = $myrow["name"];
- }
- hidden('selected_id', $selected_id);
-}
-
-text_row(_("Description:"), 'name', null, 50, 50);
-
-end_table(1);
-
-submit_add_or_update_center($selected_id == -1, '', 'both');
-
-end_form();
-
-//------------------------------------------------------------------------------------
-
-end_page();
-
ALTER TABLE `0_item_codes` ENGINE=InnoDB;
ALTER TABLE `0_item_units` ENGINE=InnoDB;
ALTER TABLE `0_locations` ENGINE=InnoDB;
-ALTER TABLE `0_movement_types` ENGINE=InnoDB;
ALTER TABLE `0_payment_terms` ENGINE=InnoDB;
ALTER TABLE `0_prices` ENGINE=InnoDB;
ALTER TABLE `0_printers` ENGINE=InnoDB;
UPDATE `0_stock_moves` SET
price = price*(1-discount_percent);
ALTER TABLE `0_stock_moves` DROP COLUMN `discount_percent`;
+
+DROP TABLE IF EXISTS `0_movement_types`;
-- --------------------------------------------------------
---
--- Table structure for table `0_movement_types`
---
-
-DROP TABLE IF EXISTS `0_movement_types`;
-CREATE TABLE IF NOT EXISTS `0_movement_types` (
- `id` int(11) NOT NULL auto_increment,
- `name` varchar(60) NOT NULL default '',
- `inactive` tinyint(1) NOT NULL default '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
-
---
--- Dumping data for table `0_movement_types`
---
-
-INSERT INTO `0_movement_types` VALUES(1, 'Adjustment', 0);
-
--- --------------------------------------------------------
-
--
-- Table structure for table `0_payment_terms`
--
-- Dumping data for table `0_loc_stock`
--
-
--- --------------------------------------------------------
-
---
--- Table structure for table `0_movement_types`
---
-
-DROP TABLE IF EXISTS `0_movement_types`;
-CREATE TABLE IF NOT EXISTS `0_movement_types` (
- `id` int(11) NOT NULL auto_increment,
- `name` varchar(60) NOT NULL default '',
- `inactive` tinyint(1) NOT NULL default '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
-
---
--- Dumping data for table `0_movement_types`
---
-
-INSERT INTO `0_movement_types` VALUES(1, 'Adjustment', 0);
-
-- --------------------------------------------------------
--