@@ -96,7 +96,7 @@ class OutputReportController extends Controller
{
if($id=="reportdata")
{
echo$id;
//echo $id;
$data=array();
$disabled="";
$dashboarduser=Auth::user();
...
...
@@ -113,7 +113,7 @@ class OutputReportController extends Controller
->get();
$report=DB::table('output_report')
->where('user_id',Auth::user()->id)
// ->where('date',DATE("Y-m-d",time()))
->where('date',DATE("Y-m-d",time()))
->get();
...
...
@@ -145,46 +145,54 @@ class OutputReportController extends Controller
$uniqueContacts=DB::table('crmcalls')->select('number',DB::raw('count(*) as total'))->whereIn('usersubstatus',["Contacted","Feedback"])->where('created_at','>',date('Y-m-d',time()))->groupBy('number');
//if dropdown value is All then use the below foreach othewise just put the user_id in array based on dropdown
$usersarray=array();
foreach($supervisoras$users){
$usersarray[]=$users->id;
}
//print_r($usersarray);
if($users=="ALL"){
foreach($supervisoras$usersval){
$usersarray[]=$usersval->id;
}
}else{
$usersarray[]=$users;
echo$users;
print_r($usersarray);
}
print_r($usersarray);
$totalIncome=DB::select("select sum(income) as income from output_report where user_id IN (".implode(',',$usersarray).")");
$Contacts=DB::select("select sum(call_attempts) as call_attempts, sum(call_contacts) as call_contacts, sum(call_unique_contacts) as unique_contacts from output_report where user_id IN (".implode(',',$usersarray).") group by product_id limit 1; ");
$report=DB::select("SELECT product_id,product_name, SUM(lead_generated) as totallead, SUM(lead_generated_amount) as totalleadamt, SUM(lead_closed) as totalleadclosed, Sum(lead_closed_amount) as leadcloseamt FROM `output_report` where user_id in (".implode(',',$usersarray).") group by product_id");