$link = "";
$id = $name;
if ($SysPrefs->use_popup_windows) {
- //_vd("type= $type");
switch (strtolower($type)) {
case "stock":
$link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id;
$link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id;
$img_title = _("Search items");
break;
+ case "component":
+ $parent = $opts['parent'];
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=component&parent=".$parent."&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
case "kits":
$link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id;
$img_title = _("Search items");
function stock_component_items_list($name, $parent_stock_id, $selected_id=null,
$all_option=false, $submit_on_change=false, $editkey = false)
{
+ $parent = db_escape($parent_stock_id);
return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("stock_id != ".db_escape($parent_stock_id))), $editkey);
+ array('where'=>array("stock_id != $parent"), 'parent'=> $parent_stock_id), $editkey, "component");
}
+
function stock_component_items_list_cells($label, $name, $parent_stock_id,
$selected_id=null, $all_option=false, $submit_on_change=false, $editkey = false)
{
if ($label != null)
echo "<td>$label</td>\n";
echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("stock_id != ".db_escape($parent_stock_id)), 'cells'=>true),
- $editkey);
+ array('where'=>array("stock_id != $parent"), 'cells'=>true, 'parent'=> $parent_stock_id), $editkey, "component");
}
//------------------------------------------------------------------------------------
// Query based on function sales_items_list in includes/ui/ui_lists.inc.
$sql = "SELECT COUNT(i.item_code) AS kit, i.item_code, i.description, c.description category
- FROM
- ".TB_PREF."stock_master s,
- ".TB_PREF."item_codes i
- LEFT JOIN
- ".TB_PREF."stock_category c
+ FROM ".TB_PREF."stock_master s, ".TB_PREF."item_codes i
+ LEFT JOIN ".TB_PREF."stock_category c
ON i.category_id=c.category_id
WHERE i.stock_id=s.stock_id
AND !i.inactive AND !s.inactive
if (isset($_GET['type'])) {
$type = $_GET['type'];
}
-//_vd("type = $type");
+
switch ($type) {
case "sales":
$sql .= " AND !s.no_sale AND mb_flag != 'F'";
case "costable":
$sql .= " AND mb_flag != 'D' AND mb_flag != 'F' AND i.item_code=i.stock_id";
break;
+ case "component":
+ $sql .= " AND i.item_code=i.stock_id AND i.stock_id != ".$_GET['parent']." AND mb_flag != 'F' ";
+ break;
case "assets":
$sql .= " AND mb_flag = 'F'";
break;
}
$sql .= " GROUP BY i.item_code ORDER BY i.description LIMIT 0, $limit"; // We only display 10 items.
-//_vd($sql);
+
$result = db_query($sql, "Failed in retreiving item list.");
$k = 0; //row colour counter