9ff19f63 by G Manojkumar

Supervisor view

1 parent a6cf55d5
......@@ -96,7 +96,7 @@ class OutputReportController extends Controller
{
if($id=="reportdata")
{
echo $id;
$data = array();
$disabled = "";
$dashboarduser=Auth::user();
......@@ -113,6 +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()))
->get();
......@@ -163,7 +164,7 @@ class OutputReportController extends Controller
}
//print_r($usersarray);
$output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get();
print_r($noOfAttempts);
$data['disabled'] = $disabled;
$data['products'] = $outputReport;
$data['totalIncome'] = $totalIncome[0]->income;
......@@ -176,6 +177,24 @@ class OutputReportController extends Controller
return view("layout.module.outputreport.outputreport", $data);
// }
}
if($id == "supervisordata"){
$supervisor = User::where('supervisor','=',Auth::user()->username)->get();
//if dropdown value is All then use the below foreach othewise just put the user_id in array based on dropdown
$usersarray= array();
foreach($supervisor as $users){
$usersarray[] = $users->id;
}
//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");
//print_r($report);
$data['supervisor'] = $supervisor;
$data['Contacts'] = $Contacts[0];
$data['totalIncome'] = $totalIncome[0]->income;
$data['report'] = $report;
return view("layout.module.outputreport.supervisorreport", $data);
}
return view("layout.module.outputreport.$id",array());
......
......@@ -15,6 +15,7 @@ return [
'log' => 'daily',
'log_max_files' => 30,
'providers' => [
......@@ -98,6 +99,7 @@ return [
"submenu"=>["Dialer"=>["kDialerModel();"],
"Reports"=>["menuAction('dialer/reports');"],
"Output Report"=>["menuAction('outputreport/reportdata');"],
"Supervisor Output Report"=>["menuAction('outputreport/supervisordata');"],
]],
"DialerCampaign" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"",
"submenu"=>[
......
<div class="container">
<div style="text-align:center">
<h2>Output Report</h2>
<p></p>
</div>
<label>
User Id
</label>
<select id="supervisorid" style="border:1px solid #efefef;" onchange='userchange("");'>
<option>ALL
</option>
<?php
foreach($supervisor as $user){ ?>
<option value="{{$user->id }}">{{$user->username}}</option>
<?php } ?>
</select>
<div class="row">
<div class="column">
<form class="form-horizontal" id="output-report" name="output-report">
<div class="table-responsive" style="background: #fff;">
<table class="table">
<thead>
<tr>
<th>No.of Attempts</th>
<th>{{ $Contacts->call_attempts }}
</th>
</tr>
<tr>
<th>No.of Contacts</th>
<th> {{ $Contacts->call_contacts }}
</th>
</tr>
<tr>
<th>Unique Contacts</th>
<th> {{ $Contacts->unique_contacts }}
</th>
</tr>
<tr>
<th>Income Achievement</th>
<th>{{ $totalIncome }}</th>
</tr>
<tr>
<th>Product</th>
<th>LG</th>
<th>Expected Amount(If Applicable)</th>
<th>LC</th>
<th>Amount(If Applicable)</th>
</tr>
</thead>
<tbody>
<?php foreach($report as $key => $val){ //print_r($val); ?>
<tr>
<td>{{$val->product_name}}</td>
<td>{{$val->totallead}}</td>
<td>{{$val->totalleadamt}}</td>
<td>{{$val->totalleadclosed}}</td>
<td>{{$val->leadcloseamt}}</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</form>
<script>
function userchange()
{
var user = $('#supervisorid').val();
//console.log(user);
}
</script>
</div>
</div>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!