How to display [(Rate)] - [Description] - [(Inventory Quantity)] on the Invoice while selecting the item
public function wh_commodity_code_search($q, $type, $can_be = '', $search_all = false)
{
$this->db->select('rate, id, description as name, long_description as subtext, commodity_code, purchase_price, CONCAT(description, " - (", IFNULL(( SELECT sum(inventory_number) from '.db_prefix().'inventory_manage where '.db_prefix().'items.id = '.db_prefix().'inventory_manage.commodity_id group by commodity_id), 0),")") as description_iv');
$this->db->group_start();
$this->db->like('description', $q);
$this->db->or_like('long_description', $q);
$this->db->or_like('commodity_code', $q);
$this->db->or_like('sku_code', $q);
$this->db->group_end();
if(new_strlen($can_be) > 0){
$this->db->where($can_be, $can_be);
}
$this->db->where('active', 1);
if(!$search_all){
$this->db->where('id not in ( SELECT distinct parent_id from '.db_prefix().'items WHERE parent_id is not null AND parent_id != "0" )');
}
$this->db->order_by('id', 'desc');
$this->db->limit(500);
$items = $this->db->get(db_prefix() . 'items')->result_array();
foreach ($items as $key => $item) {
$items[$key]['subtext'] = strip_tags(mb_substr($item['subtext'], 0, 200)) . '...';
if($type == 'rate'){
$items[$key]['name'] = '(' . app_format_number($item['rate']) . ') -'. $item['description_iv'];
}else{
$items[$key]['name'] = '(' . app_format_number($item['purchase_price']) . ') ' .$item['commodity_code'].'-'. $item['description_iv'];
}
}
return $items;
}
How to display SKU Code on the Invoice while selecting the item