9ff19f63 by G Manojkumar

Supervisor view

1 parent a6cf55d5
...@@ -96,7 +96,7 @@ class OutputReportController extends Controller ...@@ -96,7 +96,7 @@ class OutputReportController extends Controller
96 { 96 {
97 if($id=="reportdata") 97 if($id=="reportdata")
98 { 98 {
99 99 echo $id;
100 $data = array(); 100 $data = array();
101 $disabled = ""; 101 $disabled = "";
102 $dashboarduser=Auth::user(); 102 $dashboarduser=Auth::user();
...@@ -113,6 +113,7 @@ class OutputReportController extends Controller ...@@ -113,6 +113,7 @@ class OutputReportController extends Controller
113 ->get(); 113 ->get();
114 $report = DB::table('output_report') 114 $report = DB::table('output_report')
115 ->where('user_id',Auth::user()->id) 115 ->where('user_id',Auth::user()->id)
116 // ->where('date',DATE("Y-m-d",time()))
116 ->get(); 117 ->get();
117 118
118 119
...@@ -163,7 +164,7 @@ class OutputReportController extends Controller ...@@ -163,7 +164,7 @@ class OutputReportController extends Controller
163 } 164 }
164 //print_r($usersarray); 165 //print_r($usersarray);
165 $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get(); 166 $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get();
166 167 print_r($noOfAttempts);
167 $data['disabled'] = $disabled; 168 $data['disabled'] = $disabled;
168 $data['products'] = $outputReport; 169 $data['products'] = $outputReport;
169 $data['totalIncome'] = $totalIncome[0]->income; 170 $data['totalIncome'] = $totalIncome[0]->income;
...@@ -176,6 +177,24 @@ class OutputReportController extends Controller ...@@ -176,6 +177,24 @@ class OutputReportController extends Controller
176 return view("layout.module.outputreport.outputreport", $data); 177 return view("layout.module.outputreport.outputreport", $data);
177 // } 178 // }
178 } 179 }
180 if($id == "supervisordata"){
181 $supervisor = User::where('supervisor','=',Auth::user()->username)->get();
182 //if dropdown value is All then use the below foreach othewise just put the user_id in array based on dropdown
183 $usersarray= array();
184 foreach($supervisor as $users){
185 $usersarray[] = $users->id;
186 }
187 //print_r($usersarray);
188 $totalIncome = DB::select("select sum(income) as income from output_report where user_id IN (".implode(',',$usersarray).")");
189 $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; ");
190 $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");
191 //print_r($report);
192 $data['supervisor'] = $supervisor;
193 $data['Contacts'] = $Contacts[0];
194 $data['totalIncome'] = $totalIncome[0]->income;
195 $data['report'] = $report;
196 return view("layout.module.outputreport.supervisorreport", $data);
197 }
179 198
180 return view("layout.module.outputreport.$id",array()); 199 return view("layout.module.outputreport.$id",array());
181 200
......
...@@ -15,6 +15,7 @@ return [ ...@@ -15,6 +15,7 @@ return [
15 15
16 'log' => 'daily', 16 'log' => 'daily',
17 17
18 'log_max_files' => 30,
18 19
19 'providers' => [ 20 'providers' => [
20 21
...@@ -98,6 +99,7 @@ return [ ...@@ -98,6 +99,7 @@ return [
98 "submenu"=>["Dialer"=>["kDialerModel();"], 99 "submenu"=>["Dialer"=>["kDialerModel();"],
99 "Reports"=>["menuAction('dialer/reports');"], 100 "Reports"=>["menuAction('dialer/reports');"],
100 "Output Report"=>["menuAction('outputreport/reportdata');"], 101 "Output Report"=>["menuAction('outputreport/reportdata');"],
102 "Supervisor Output Report"=>["menuAction('outputreport/supervisordata');"],
101 ]], 103 ]],
102 "DialerCampaign" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"", 104 "DialerCampaign" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"",
103 "submenu"=>[ 105 "submenu"=>[
......
1
2 <div class="container">
3 <div style="text-align:center">
4 <h2>Output Report</h2>
5 <p></p>
6 </div>
7 <label>
8 User Id
9 </label>
10 <select id="supervisorid" style="border:1px solid #efefef;" onchange='userchange("");'>
11 <option>ALL
12 </option>
13 <?php
14 foreach($supervisor as $user){ ?>
15 <option value="{{$user->id }}">{{$user->username}}</option>
16 <?php } ?>
17 </select>
18 <div class="row">
19 <div class="column">
20 <form class="form-horizontal" id="output-report" name="output-report">
21 <div class="table-responsive" style="background: #fff;">
22
23 <table class="table">
24 <thead>
25 <tr>
26 <th>No.of Attempts</th>
27 <th>{{ $Contacts->call_attempts }}
28 </th>
29 </tr>
30 <tr>
31 <th>No.of Contacts</th>
32 <th> {{ $Contacts->call_contacts }}
33 </th>
34 </tr>
35 <tr>
36 <th>Unique Contacts</th>
37
38 <th> {{ $Contacts->unique_contacts }}
39 </th>
40 </tr>
41 <tr>
42 <th>Income Achievement</th>
43 <th>{{ $totalIncome }}</th>
44 </tr>
45
46 <tr>
47 <th>Product</th>
48 <th>LG</th>
49 <th>Expected Amount(If Applicable)</th>
50 <th>LC</th>
51 <th>Amount(If Applicable)</th>
52 </tr>
53 </thead>
54 <tbody>
55 <?php foreach($report as $key => $val){ //print_r($val); ?>
56 <tr>
57 <td>{{$val->product_name}}</td>
58 <td>{{$val->totallead}}</td>
59 <td>{{$val->totalleadamt}}</td>
60 <td>{{$val->totalleadclosed}}</td>
61 <td>{{$val->leadcloseamt}}</td>
62 </tr>
63 <?php } ?>
64 </tbody>
65 </table>
66 </div>
67 </form>
68 <script>
69 function userchange()
70 {
71 var user = $('#supervisorid').val();
72 //console.log(user);
73 }
74 </script>
75 </div>
76 </div>
77
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!