Need some changes
Showing
2 changed files
with
83 additions
and
111 deletions
| ... | @@ -96,7 +96,13 @@ class OutputReportController extends Controller | ... | @@ -96,7 +96,13 @@ class OutputReportController extends Controller |
| 96 | if($id=="reportdata") | 96 | if($id=="reportdata") |
| 97 | { | 97 | { |
| 98 | 98 | ||
| 99 | $dashboarduser=Auth::user(); | 99 | $data = array(); |
| 100 | $disabled = ""; | ||
| 101 | $dashboarduser=Auth::user(); | ||
| 102 | |||
| 103 | if($dashboarduser->usertype == "Supervisor"){ | ||
| 104 | $disabled = "disabled"; | ||
| 105 | } | ||
| 100 | //if($dashboarduser->usertype == "User"){ | 106 | //if($dashboarduser->usertype == "User"){ |
| 101 | // output reports | 107 | // output reports |
| 102 | $products = DB::table('output_products') | 108 | $products = DB::table('output_products') |
| ... | @@ -136,7 +142,17 @@ class OutputReportController extends Controller | ... | @@ -136,7 +142,17 @@ class OutputReportController extends Controller |
| 136 | } | 142 | } |
| 137 | //print_r($usersarray); | 143 | //print_r($usersarray); |
| 138 | $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get(); | 144 | $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get(); |
| 139 | return view("layout.module.outputreport.outputreport")->with('data', ['products' => $products, 'totalIncome' => $totalIncome[0]->income, 'noOfAttempts' => $noOfAttempts , 'noOfContacts' => $noOfContacts , 'uniqueContacts' => $uniqueContacts , 'output' => $output, 'report' => $report]); | 145 | |
| 146 | $data['disabled'] = $disabled; | ||
| 147 | $data['products'] = $products; | ||
| 148 | $data['totalIncome'] = $totalIncome[0]->income; | ||
| 149 | $data['noOfAttempts'] = $noOfAttempts; | ||
| 150 | $data['noOfContacts'] = $noOfContacts; | ||
| 151 | $data['uniqueContacts'] = $uniqueContacts; | ||
| 152 | $data['output'] = $output; | ||
| 153 | $data['report'] = $report; | ||
| 154 | |||
| 155 | return view("layout.module.outputreport.outputreport", $data); | ||
| 140 | // } | 156 | // } |
| 141 | } | 157 | } |
| 142 | 158 | ... | ... |
| 1 | |||
| 2 | <?php | 1 | <?php |
| 3 | use App\Models\User; | 2 | use App\Models\User; |
| 4 | if(Auth::user()->id=="1"){ ?> | 3 | if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?> |
| 5 | <div class="container"> | 4 | <div class="container"> |
| 6 | <div style="text-align:center"> | 5 | <div style="text-align:center"> |
| 7 | <h2>Output Report</h2> | 6 | <h2>Output Report</h2> |
| 8 | <p></p> | 7 | <p></p> |
| 9 | </div> | 8 | </div> |
| 10 | 9 | ||
| 11 | <div class="row"> | 10 | <div class="row"> |
| 12 | <div class="column"> | 11 | <div class="column"> |
| 13 | <?php if(Auth::user()->usertype == "User"){ ?> | 12 | <form class="form-horizontal" id="output-report" name="output-report"> |
| 14 | <form class="form-horizontal" id="output-report" name="output-report"> | 13 | <div class="table-responsive" style="background: #fff;"> |
| 15 | <div class="table-responsive" style="background: #fff;"> | 14 | |
| 16 | |||
| 17 | <table class="table"> | 15 | <table class="table"> |
| 18 | <thead> | 16 | <thead> |
| 19 | <tr> | 17 | <tr> |
| 20 | <th>No.of Attempts</th> | 18 | <th>No.of Attempts</th> |
| 21 | <th><?php echo $data['noOfAttempts']; ?> | 19 | <th>{{$noOfAttempts}} |
| 22 | <input type="hidden" name="noOfAttempts" value="<?php echo $data['noOfAttempts']; ?>"> | 20 | <input type="hidden" name="noOfAttempts" value="{{$noOfAttempts}}"> |
| 23 | </th> | 21 | </th> |
| 24 | </tr> | 22 | </tr> |
| 25 | <tr> | 23 | <tr> |
| 26 | <th>No.of Contacts</th> | 24 | <th>No.of Contacts</th> |
| 27 | <th><?php echo $data['noOfContacts']; ?> | 25 | <th>{{$noOfContacts}} |
| 28 | <input type="hidden" name="noOfContacts" value="<?php echo $data['noOfContacts']; ?>"> | 26 | <input type="hidden" name="noOfContacts" value="{{$noOfContacts}}"> |
| 29 | </th> | 27 | </th> |
| 30 | </tr> | 28 | </tr> |
| 31 | <tr> | 29 | <tr> |
| 32 | <th>Unique Contacts</th> | 30 | <th>Unique Contacts</th> |
| 33 | 31 | ||
| 34 | <th><?php echo $data['uniqueContacts']; ?> | 32 | <th>{{$uniqueContacts}} |
| 35 | <input type="hidden" name="uniqueContacts" value="<?php echo $data['uniqueContacts']; ?>"> | 33 | <input type="hidden" name="uniqueContacts" value="{{$uniqueContacts}}"> |
| 36 | </th> | 34 | </th> |
| 37 | </tr> | 35 | </tr> |
| 38 | <tr> | 36 | <tr> |
| 39 | <th>Income Achievement</th> | 37 | <th>Income Achievement</th> |
| 40 | <th><?php echo $data['totalIncome']; ?></th> | 38 | <th>{{$totalIncome}}</th> |
| 41 | </tr> | 39 | </tr> |
| 42 | 40 | ||
| 43 | <tr> | 41 | <tr> |
| ... | @@ -51,102 +49,60 @@ use App\Models\User; | ... | @@ -51,102 +49,60 @@ use App\Models\User; |
| 51 | <tbody> | 49 | <tbody> |
| 52 | <?php | 50 | <?php |
| 53 | //include(resource_path().'/views/layout/module/virtualchannel/VirtualFieldsArray.php'); | 51 | //include(resource_path().'/views/layout/module/virtualchannel/VirtualFieldsArray.php'); |
| 54 | $i=1; | 52 | foreach ($report as $key1 => $value1) { |
| 55 | foreach ($data['products'] as $key => $value) { | 53 | //print_r($key1); |
| 54 | $i=1; | ||
| 55 | foreach ($products as $key => $value) { | ||
| 56 | //print_r($value); | 56 | //print_r($value); |
| 57 | //print_r($ProductType); | 57 | //print_r($ProductType); |
| 58 | // foreach ($data['report'] as $key1 => $value1) { | 58 | //foreach ($report as $key1 => $value1) { |
| 59 | //print_r($value1); | 59 | //print_r($value1); |
| 60 | ?> | 60 | //if($value1->product_name != $value->name)continue; |
| 61 | <tr> | 61 | ?> |
| 62 | <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="<?php echo $value->productId; ?>"> | 62 | <tr> |
| 63 | <input type="hidden" name="products[<?= $i ?>][product]" value="<?php echo $value->name; ?>" ><?php echo $value->name; ?></td> | 63 | <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="{{$value->productId}}"> |
| 64 | <td><input type="number" name="products[<?= $i ?>][lg]" value="<?php //echo isset($value1)?$value1->lead_generated:"0"; ?>"></td> | 64 | <input type="hidden" name="products[<?= $i ?>][product]" value="{{ $value->name }} " >{{ $value->name }}</td> |
| 65 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lgAmt]" value="<?php // echo isset($value1)?$value1->lead_generated_amount:"0"; ?>"></td> | 65 | <?php //foreach ($report as $key1 => $value1) { |
| 66 | <td><input type="number" name="products[<?= $i ?>][lc]" value="<?php // echo isset($value1)?$value1->lead_closed:"0"; ?>"></td> | 66 | //print_r($value1); |
| 67 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lcAmt]" value="<?php //echo isset($value1)?$value1->lead_closed_amount:"0"; ?>"></td> | 67 | ?> |
| 68 | </tr> | 68 | <td><input type="number" name="products[<?= $i ?>][lg]" value="{{isset($value1->lead_generated)?$value1->lead_generated:'0'}}" $disabled></td> |
| 69 | <?php | 69 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lgAmt]" value="{{isset($value1->lead_generated_amount)?$value1->lead_generated_amount:'0'}}" $disabled></td> |
| 70 | <td><input type="number" name="products[<?= $i ?>][lc]" value="{{isset($value1->lead_closed)?$value1->lead_closed:'0'}}" $disabled></td> | ||
| 71 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lcAmt]" value="{{isset($value1->lead_closed_amount)?$value1->lead_closed_amount:'0'}}" $disabled></td> | ||
| 72 | </tr> | ||
| 73 | <?php | ||
| 74 | // } | ||
| 75 | $i++; | ||
| 76 | }} ?> | ||
| 70 | 77 | ||
| 71 | $i++; | 78 | @if($disabled == "") |
| 72 | } ?> | 79 | <tr> |
| 80 | <td><button type="submit" class="btn btn-primary" onclick='createOutputReport();return false;'>Save</button></td> | ||
| 81 | </tr> | ||
| 82 | @endif | ||
| 73 | 83 | ||
| 74 | <tr> | 84 | </tbody> |
| 75 | <td><button type="submit" class="btn btn-primary" onclick='createOutputReport();return false;'>Save</button></td></tr> | 85 | </table> |
| 76 | </tbody> | 86 | </div> |
| 77 | </table> | 87 | </form> |
| 78 | </div> | 88 | <script> |
| 79 | </form> | ||
| 80 | <?php } | ||
| 81 | if(Auth::user()->usertype == "Supervisor"){ ?> | ||
| 82 | <form class="form-horizontal" id="output-report-supervisor" name="output-report-supervisor"> | ||
| 83 | <div class="table-responsive" style="background: #fff;"> | ||
| 84 | <?php $supervisor = User::where('supervisor','=',Auth::user()->username)->get(); | ||
| 85 | // foreach($supervisor as $super){ | ||
| 86 | ?> | ||
| 87 | <br> | ||
| 88 | RM Code:<select id="abc" style="border:3px solid #efefef;"> | ||
| 89 | <option>All</option> | ||
| 90 | <?php foreach($supervisor as $super){ ?> | ||
| 91 | <option value="<?php echo $super->username; ?>"><?php echo $super->username; ?></option> | ||
| 92 | <?php } ?> | ||
| 93 | </select> | ||
| 94 | <table class="table"> | ||
| 95 | <thead> | ||
| 96 | <th></th> | ||
| 97 | <th>Username</th> | ||
| 98 | <!--<th>Date</th>--> | ||
| 99 | <th>Call Attempts</th> | ||
| 100 | <th>Call Contacts</th> | ||
| 101 | <th>Call Unique Contacts</th> | ||
| 102 | <th>Income</th> | ||
| 103 | <th>Product Name</th> | ||
| 104 | <th>Lead Generated</th> | ||
| 105 | <th>Lead Generated Amount</th> | ||
| 106 | <th>Lead Closed</th> | ||
| 107 | <th>Lead Closed Amount</th> | ||
| 108 | </thead> | ||
| 109 | <?php | ||
| 110 | $i=1; | ||
| 111 | foreach($data['output'] as $key => $value){ | ||
| 112 | //print_r($value); | ||
| 113 | ?> | ||
| 114 | <tr> | ||
| 115 | <td><?php echo $i; ?></td> | ||
| 116 | <td><?php echo $value->user_name;?></td> | ||
| 117 | <td><?php echo $value->call_attempts;?></td> | ||
| 118 | <td><?php echo $value->call_contacts;?></td> | ||
| 119 | <td><?php echo $value->call_unique_contacts;?></td> | ||
| 120 | <td><?php echo $value->income;?></td> | ||
| 121 | <td><?php echo $value->product_name;?></td> | ||
| 122 | <td><?php echo $value->lead_generated;?></td> | ||
| 123 | <td><?php echo $value->lead_generated_amount;?></td> | ||
| 124 | <td><?php echo $value->lead_closed;?></td> | ||
| 125 | <td><?php echo $value->lead_closed_amount;?></td> | ||
| 126 | </tr> | ||
| 127 | <?php $i++; } ?> | ||
| 128 | </table> | ||
| 129 | </div> | ||
| 130 | </form> | ||
| 131 | <?php } ?> | ||
| 132 | <script> | ||
| 133 | 89 | ||
| 134 | function createOutputReport() | 90 | function createOutputReport() |
| 135 | { | 91 | { |
| 136 | var putdata = $('#output-report').serialize(); | 92 | var putdata = $('#output-report').serialize(); |
| 137 | //console.log("--->"+putdata); | 93 | //console.log("--->"+putdata); |
| 138 | doAjax('outputreport?action=createOutputReport',putdata,'__fake__div__','ajax_create_output_report','singlethis','POST',function(retstr) | 94 | doAjax('outputreport?action=createOutputReport',putdata,'__fake__div__','ajax_create_output_report','singlethis','POST',function(retstr) |
| 139 | { | 95 | { |
| 140 | if(retstr.responseText.indexOf('Error')<0) | 96 | if(retstr.responseText.indexOf('Error')<0) |
| 141 | { | 97 | { |
| 142 | simpleNotification("success","topRight","User Created Successfully"); | 98 | simpleNotification("success","topRight","User Created Successfully"); |
| 143 | menuAction('outputreport/reportdata'); | 99 | menuAction('outputreport/reportdata'); |
| 144 | } | 100 | } |
| 145 | else | 101 | else |
| 146 | { | 102 | { |
| 147 | simpleNotification("error","topRight",retstr.responseText); | 103 | simpleNotification("error","topRight",retstr.responseText); |
| 148 | } | 104 | } |
| 149 | }); | 105 | }); |
| 150 | } | 106 | } |
| 151 | 107 | ||
| 152 | </script> | 108 | </script> | ... | ... |
-
Please register or sign in to post a comment