$db->query("select count(*) as total, entity_label, destination from ".$view." where status in ".$str_status." ".$where_date.$where_clause." group by destination,entity_label");
//$db->show();
while($res=$db->fetch_object())
{
/*
$db->query("select count(*) as total from ".$view." where status in ".$str_status." ".$where_date." and category_id = '".$key."'");
$db->query("select count(*) as total from ".$view." where status not in ('DEL','INIT') ".$where_date.$where_clause." and destination = '".$entities[$i]['ID']."'");
//$db->show();
$res=$db->fetch_object();
/*
$db->query("select count(*) as total from ".$view." where status in ".$str_status." ".$where_date." and category_id = '".$key."'");