$all_option=false, $submit_on_change=false, $all=false, $editkey=false)
{
return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("mb_flag!= 'M'"),
+ array('where'=>array("NOT no_purchase"),
'show_inactive'=>$all), $editkey);
}
//
if ($label != null)
echo "<td>$label</td>\n";
echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("mb_flag!= 'M'"),
+ array('where'=>array("NOT no_purchase"),
'editable' => 30,
'cells'=>true), $editkey);
}
***********************************************************************/
function add_item_category($description, $tax_type_id, $sales_account,
$cogs_account, $inventory_account, $adjustment_account, $assembly_account,
- $units, $mb_flag, $dim1, $dim2, $no_sale)
+ $units, $mb_flag, $dim1, $dim2, $no_sale, $no_purchase)
{
$sql = "INSERT INTO ".TB_PREF."stock_category (description, dflt_tax_type,
dflt_units, dflt_mb_flag, dflt_sales_act, dflt_cogs_act,
dflt_inventory_act, dflt_adjustment_act, dflt_assembly_act,
- dflt_dim1, dflt_dim2, dflt_no_sale)
+ dflt_dim1, dflt_dim2, dflt_no_sale, dflt_no_purchase)
VALUES ("
.db_escape($description).","
.db_escape($tax_type_id).","
.db_escape($assembly_account).","
.db_escape($dim1).","
.db_escape($dim2).","
- .db_escape($no_sale).")";
+ .db_escape($no_sale).","
+ .db_escape($no_purchase).")";
db_query($sql,"an item category could not be added");
}
function update_item_category($id, $description, $tax_type_id,
$sales_account, $cogs_account, $inventory_account, $adjustment_account,
- $assembly_account, $units, $mb_flag, $dim1, $dim2, $no_sale)
+ $assembly_account, $units, $mb_flag, $dim1, $dim2, $no_sale, $no_purchase)
{
$sql = "UPDATE ".TB_PREF."stock_category SET "
."dflt_assembly_act = ".db_escape($assembly_account).","
."dflt_dim1 = ".db_escape($dim1).","
."dflt_dim2 = ".db_escape($dim2).","
- ."dflt_no_sale = ".db_escape($no_sale)
+ ."dflt_no_sale = ".db_escape($no_sale).","
+ ."dflt_no_purchase = ".db_escape($no_purchase)
."WHERE category_id = ".db_escape($id);
db_query($sql,"an item category could not be updated");
function update_item($stock_id, $description, $long_description, $category_id,
$tax_type_id, $units='', $mb_flag='', $sales_account, $inventory_account,
$cogs_account, $adjustment_account, $assembly_account, $dimension_id,
- $dimension2_id, $no_sale, $editable)
+ $dimension2_id, $no_sale, $editable, $no_purchase)
{
$sql = "UPDATE ".TB_PREF."stock_master SET long_description=".db_escape($long_description).",
description=".db_escape($description).",
dimension2_id=".db_escape($dimension2_id).",
tax_type_id=".db_escape($tax_type_id).",
no_sale=".db_escape($no_sale).",
+ no_purchase=".db_escape($no_purchase).",
editable=".db_escape($editable);
if ($units != '')
function add_item($stock_id, $description, $long_description, $category_id,
$tax_type_id, $units, $mb_flag, $sales_account, $inventory_account,
$cogs_account, $adjustment_account, $assembly_account, $dimension_id,
- $dimension2_id, $no_sale, $editable)
+ $dimension2_id, $no_sale, $editable, $no_purchase)
{
$sql = "INSERT INTO ".TB_PREF."stock_master (stock_id, description, long_description, category_id,
tax_type_id, units, mb_flag, sales_account, inventory_account, cogs_account,
.", ".db_escape($assembly_account).", "
.db_escape($dimension_id).", ".db_escape($dimension2_id).","
.db_escape($no_sale).","
+ .db_escape($no_purchase).","
.db_escape($editable).")";
db_query($sql, "The item could not be added");
$_POST['cogs_account'], $_POST['inventory_account'],
$_POST['adjustment_account'], $_POST['assembly_account'],
$_POST['units'], $_POST['mb_flag'], $_POST['dim1'], $_POST['dim2'],
- check_value('no_sale'));
+ check_value('no_sale'), check_value('no_purchase'));
display_notification(_('Selected item category has been updated'));
}
else
$_POST['cogs_account'], $_POST['inventory_account'],
$_POST['adjustment_account'], $_POST['assembly_account'],
$_POST['units'], $_POST['mb_flag'], $_POST['dim1'],
- $_POST['dim2'], check_value('no_sale'));
+ $_POST['dim2'], check_value('no_sale'), check_value('no_purchase'));
display_notification(_('New item category has been added'));
}
$Mode = 'RESET';
$_POST['dim1'] = $myrow["dflt_dim1"];
$_POST['dim2'] = $myrow["dflt_dim2"];
$_POST['no_sale'] = $myrow["dflt_no_sale"];
+ $_POST['no_purchase'] = $myrow["dflt_no_purchase"];
}
hidden('selected_id', $selected_id);
hidden('category_id');
$_POST['long_description'] = '';
$_POST['description'] = '';
$_POST['no_sale'] = 0;
+ $_POST['no_purchase'] = 0;
$company_record = get_company_prefs();
check_row(_("Exclude from sales:"), 'no_sale');
+check_row(_("Exclude from purchases:"), 'no_purchase');
+
gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', $_POST['sales_account']);
if (is_service($_POST['mb_flag']))
unset($_POST['dimension_id']);
unset($_POST['dimension2_id']);
unset($_POST['no_sale']);
+ unset($_POST['no_purchase']);
}
//------------------------------------------------------------------------------------
$_POST['inventory_account'], $_POST['cogs_account'],
$_POST['adjustment_account'], $_POST['assembly_account'],
$_POST['dimension_id'], $_POST['dimension2_id'],
- check_value('no_sale'), check_value('editable'));
+ check_value('no_sale'), check_value('editable'), check_value('no_purchase'));
update_record_status($_POST['NewStockID'], $_POST['inactive'],
'stock_master', 'stock_id');
update_record_status($_POST['NewStockID'], $_POST['inactive'],
$_POST['inventory_account'], $_POST['cogs_account'],
$_POST['adjustment_account'], $_POST['assembly_account'],
$_POST['dimension_id'], $_POST['dimension2_id'],
- check_value('no_sale'), check_value('editable'));
+ check_value('no_sale'), check_value('editable'), check_value('no_purchase'));
display_notification(_("A new item has been added."));
$_POST['stock_id'] = $_POST['NewStockID'] =
$_POST['description'] = $_POST['long_description'] = '';
- $_POST['no_sale'] = $_POST['editable'] = 0;
+ $_POST['no_sale'] = $_POST['editable'] = $_POST['no_purchase'] =0;
set_focus('NewStockID');
}
$Ajax->activate('_page_body');
$_POST['dimension_id'] = $myrow['dimension_id'];
$_POST['dimension2_id'] = $myrow['dimension2_id'];
$_POST['no_sale'] = $myrow['no_sale'];
- $_POST['del_image'] = 0;
+ $_POST['no_purchase'] = $myrow['no_purchase'];
+ $_POST['del_image'] = 0;
$_POST['inactive'] = $myrow["inactive"];
$_POST['editable'] = $myrow["editable"];
}
$_POST['dimension_id'] = $category_record["dflt_dim1"];
$_POST['dimension2_id'] = $category_record["dflt_dim2"];
$_POST['no_sale'] = $category_record["dflt_no_sale"];
+ $_POST['no_purchase'] = $category_record["dflt_no_purchase"];
$_POST['editable'] = 0;
}
check_row(_("Exclude from sales:"), 'no_sale');
+ check_row(_("Exclude from purchases:"), 'no_purchase');
+
table_section(2);
$dim = get_company_pref('use_dimension');
{
// hidden('line_no', ($_SESSION['PO']->lines_on_order + 1));
- //Chaitanya : Manufcatured item can be purchased
- stock_items_list_cells(null, 'stock_id', null, false, true, true);
- //stock_purchasable_items_list_cells(null, 'stock_id', null, false, true, true);
+ stock_purchasable_items_list_cells(null, 'stock_id', null, false, true, true);
if (list_updated('stock_id')) {
$Ajax->activate('price');
$Ajax->activate('units');
UPDATE `0_security_roles` SET `areas`=CONCAT_WS(';', `areas`, '775')
WHERE NOT `areas` REGEXP '[^0-9]?775[^0-9]?';
+
+ALTER TABLE `0_stock_master` ADD COLUMN `no_purchase` tinyint(1) NOT NULL default '0' AFTER `no_sale`;
+ALTER TABLE `0_stock_category` ADD COLUMN `dflt_no_purchase` tinyint(1) NOT NULL default '0' AFTER `dflt_no_sale`;
`dflt_dim2` int(11) default NULL,
`inactive` tinyint(1) NOT NULL default '0',
`dflt_no_sale` tinyint(1) NOT NULL default '0',
+ `dflt_no_purchase` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`category_id`),
UNIQUE KEY `description` (`description`)
) ENGINE=MyISAM AUTO_INCREMENT=5 ;
-- Dumping data for table `0_stock_category`
--
-INSERT INTO `0_stock_category` VALUES(1, 'Components', 1, 'each', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
-INSERT INTO `0_stock_category` VALUES(2, 'Charges', 1, 'each', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
-INSERT INTO `0_stock_category` VALUES(3, 'Systems', 1, 'each', 'M', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
-INSERT INTO `0_stock_category` VALUES(4, 'Services', 1, 'hrs', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(1, 'Components', 1, 'each', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(2, 'Charges', 1, 'each', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(3, 'Systems', 1, 'each', 'M', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(4, 'Services', 1, 'hrs', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
-- --------------------------------------------------------
`overhead_cost` double NOT NULL default '0',
`inactive` tinyint(1) NOT NULL default '0',
`no_sale` tinyint(1) NOT NULL default '0',
+ `no_purchase` tinyint(1) NOT NULL default '0',
`editable` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`stock_id`)
) ENGINE=InnoDB;
-- Dumping data for table `0_stock_master`
--
-INSERT INTO `0_stock_master` VALUES('102', 1, 1, '17inch VGA Monitor', '', 'ea.', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 10, 0, 0, 0, 0, 0);
-INSERT INTO `0_stock_master` VALUES('103', 1, 1, '32MB VGA Card', '', 'ea.', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 11, 0, 0, 0, 0, 0);
-INSERT INTO `0_stock_master` VALUES('104', 1, 1, '52x CD Drive', '', 'ea.', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 12, 0, 0, 0, 0, 0);
-INSERT INTO `0_stock_master` VALUES('201', 4, 1, 'Assembly Labour', '', 'hrs', 'D', '4010', '5010', '5010', '5040', '1530', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-INSERT INTO `0_stock_master` VALUES('3400', 3, 1, 'P4 Business System', '', 'ea.', 'M', '4010', '5010', '1540', '5040', '1530', 0, 0, 0, 0, 33, 3.9999999999999, 2, 0, 0, 0);
+INSERT INTO `0_stock_master` VALUES('102', 1, 1, '17inch VGA Monitor', '', 'ea.', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_master` VALUES('103', 1, 1, '32MB VGA Card', '', 'ea.', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_master` VALUES('104', 1, 1, '52x CD Drive', '', 'ea.', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_master` VALUES('201', 4, 1, 'Assembly Labour', '', 'hrs', 'D', '4010', '5010', '5010', '5040', '1530', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_master` VALUES('3400', 3, 1, 'P4 Business System', '', 'ea.', 'M', '4010', '5010', '1540', '5040', '1530', 0, 0, 0, 0, 33, 3.9999999999999, 2, 0, 0, 0, 0);
-- --------------------------------------------------------
`dflt_dim2` int(11) default NULL,
`inactive` tinyint(1) NOT NULL default '0',
`dflt_no_sale` tinyint(1) NOT NULL default '0',
+ `dflt_no_sale` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`category_id`),
UNIQUE KEY `description` (`description`)
) ENGINE=MyISAM AUTO_INCREMENT=5 ;
-- Dumping data for table `0_stock_category`
--
-INSERT INTO `0_stock_category` VALUES(1, 'Components', 1, 'each', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
-INSERT INTO `0_stock_category` VALUES(2, 'Charges', 1, 'each', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
-INSERT INTO `0_stock_category` VALUES(3, 'Systems', 1, 'each', 'M', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
-INSERT INTO `0_stock_category` VALUES(4, 'Services', 1, 'hrs', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(1, 'Components', 1, 'each', 'B', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(2, 'Charges', 1, 'each', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(3, 'Systems', 1, 'each', 'M', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
+INSERT INTO `0_stock_category` VALUES(4, 'Services', 1, 'hrs', 'D', '4010', '5010', '1510', '5040', '1530', 0, 0, 0, 0, 0);
-- --------------------------------------------------------
`overhead_cost` double NOT NULL default '0',
`inactive` tinyint(1) NOT NULL default '0',
`no_sale` tinyint(1) NOT NULL default '0',
+ `no_purchase` tinyint(1) NOT NULL default '0',
`editable` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`stock_id`)
) ENGINE=InnoDB;