<?php 

function add_item_westage($wo_type, $stock_id_,$is_not_cal=0)
{
	$sql = "INSERT INTO ".TB_PREF."wo_item_wesatge (wo_type, stock_id_,is_not_cal) VALUES 
	(".db_escape($wo_type) . ", ".db_escape($stock_id_) . ", ".db_escape($is_not_cal) . ")";
   	db_query($sql,"The item could not be added");
   //	display_error($sql);
}

function update_item_westage($selected_id, $stock_id_,$is_not_cal=0)
{
	$sql = "UPDATE ".TB_PREF."wo_item_wesatge SET stock_id_=".db_escape($stock_id_).",is_not_cal=".db_escape($is_not_cal)." WHERE
		 id = ".db_escape($selected_id);
   	db_query($sql,"The item could not be updated");
}

function delete_item_westage($selected_id)
{
	$sql="DELETE FROM ".TB_PREF."wo_item_wesatge WHERE id=".db_escape($selected_id);
	db_query($sql,"could not delete item");
}

function get_item_westages($show_inactive, $wo_type='')
{
	$sql = "SELECT * FROM ".TB_PREF."wo_item_wesatge";
	if (!$show_inactive) $sql .= " WHERE !inactive";
	if($wo_type != '')
		$sql .= " AND wo_type=".db_escape($wo_type);
	// $sql .= " ORDER BY item";

	// display_error($sql);
	return db_query($sql,"could not item");
}

function get_item_westage($selected_id)
{
	$sql = "SELECT * FROM ".TB_PREF."wo_item_wesatge WHERE id=".db_escape($selected_id);

	$result = db_query($sql,"could not item");
	return db_fetch($result);
}

// function get_brand_name($id)
// {
// 	$sql = "SELECT brand FROM ".TB_PREF."wo_item_wesatge WHERE id = ".db_escape($id);
// 	$result = db_query($sql, "could not brand");
// 	$row = db_fetch($result);
// 	return is_array($row) ? $row[0] : false;
// }

function item_wise_westage($wo_type)
{
	$sql = "SELECT * FROM ".TB_PREF."wo_item_wesatge WHERE wo_type=".db_escape($wo_type);
	return db_query($sql,"could not item");
}

?>