modified output report
Showing
2 changed files
with
31 additions
and
22 deletions
| ... | @@ -57,10 +57,11 @@ class OutputReportController extends Controller | ... | @@ -57,10 +57,11 @@ class OutputReportController extends Controller |
| 57 | 57 | ||
| 58 | $outputReport = OutputReport::firstOrCreate( | 58 | $outputReport = OutputReport::firstOrCreate( |
| 59 | array( | 59 | array( |
| 60 | 'product_id' => $value['productId'] | 60 | 'product_id' => $value['productId'], |
| 61 | 'user_id' => Auth::user()->id | ||
| 61 | ) | 62 | ) |
| 62 | ); | 63 | ); |
| 63 | $outputReport->user_id = Auth::user()->id; | 64 | //$outputReport->user_id = Auth::user()->id; |
| 64 | $outputReport->user_name = Auth::user()->username; | 65 | $outputReport->user_name = Auth::user()->username; |
| 65 | $outputReport->date = date("Y-m-d"); | 66 | $outputReport->date = date("Y-m-d"); |
| 66 | $outputReport->call_attempts = $request->input('noOfAttempts'); | 67 | $outputReport->call_attempts = $request->input('noOfAttempts'); |
| ... | @@ -113,6 +114,26 @@ class OutputReportController extends Controller | ... | @@ -113,6 +114,26 @@ class OutputReportController extends Controller |
| 113 | $report = DB::table('output_report') | 114 | $report = DB::table('output_report') |
| 114 | ->where('user_id',Auth::user()->id) | 115 | ->where('user_id',Auth::user()->id) |
| 115 | ->get(); | 116 | ->get(); |
| 117 | |||
| 118 | |||
| 119 | $outputReport = array(); | ||
| 120 | foreach ($products as $pkey => $pvalue) { | ||
| 121 | |||
| 122 | $outputReport[$pvalue->productId] = array('name' => $pvalue->name, 'productId' => $pvalue->productId); | ||
| 123 | |||
| 124 | foreach ($report as $key => $value) { | ||
| 125 | |||
| 126 | if($value->product_id == $pvalue->productId){ | ||
| 127 | $outputReport[$value->product_id]['lead_generated'] = $value->lead_generated; | ||
| 128 | $outputReport[$value->product_id]['lead_generated_amount'] = $value->lead_generated_amount; | ||
| 129 | $outputReport[$value->product_id]['lead_closed'] = $value->lead_closed; | ||
| 130 | $outputReport[$value->product_id]['lead_closed_amount'] = $value->lead_closed_amount; | ||
| 131 | |||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | } | ||
| 136 | |||
| 116 | // total income | 137 | // total income |
| 117 | $totalIncome = DB::select("select sum(income) as income from output_report where user_id=".Auth::user()->id); | 138 | $totalIncome = DB::select("select sum(income) as income from output_report where user_id=".Auth::user()->id); |
| 118 | 139 | ||
| ... | @@ -144,7 +165,7 @@ class OutputReportController extends Controller | ... | @@ -144,7 +165,7 @@ class OutputReportController extends Controller |
| 144 | $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get(); | 165 | $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get(); |
| 145 | 166 | ||
| 146 | $data['disabled'] = $disabled; | 167 | $data['disabled'] = $disabled; |
| 147 | $data['products'] = $products; | 168 | $data['products'] = $outputReport; |
| 148 | $data['totalIncome'] = $totalIncome[0]->income; | 169 | $data['totalIncome'] = $totalIncome[0]->income; |
| 149 | $data['noOfAttempts'] = $noOfAttempts; | 170 | $data['noOfAttempts'] = $noOfAttempts; |
| 150 | $data['noOfContacts'] = $noOfContacts; | 171 | $data['noOfContacts'] = $noOfContacts; | ... | ... |
| ... | @@ -48,32 +48,20 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?> | ... | @@ -48,32 +48,20 @@ if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?> |
| 48 | </thead> | 48 | </thead> |
| 49 | <tbody> | 49 | <tbody> |
| 50 | <?php | 50 | <?php |
| 51 | //include(resource_path().'/views/layout/module/virtualchannel/VirtualFieldsArray.php'); | ||
| 52 | foreach ($report as $key1 => $value1) { | ||
| 53 | //print_r($key1); | ||
| 54 | $i=1; | 51 | $i=1; |
| 55 | foreach ($products as $key => $value) { | 52 | foreach ($products as $key => $value) { |
| 56 | //print_r($value); | ||
| 57 | //print_r($ProductType); | ||
| 58 | //foreach ($report as $key1 => $value1) { | ||
| 59 | //print_r($value1); | ||
| 60 | //if($value1->product_name != $value->name)continue; | ||
| 61 | ?> | 53 | ?> |
| 62 | <tr> | 54 | <tr> |
| 63 | <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="{{$value->productId}}"> | 55 | <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="{{$value['productId']}}"> |
| 64 | <input type="hidden" name="products[<?= $i ?>][product]" value="{{ $value->name }} " >{{ $value->name }}</td> | 56 | <input type="hidden" name="products[<?= $i ?>][product]" value="{{ $value['name'] }} " >{{ $value['name'] }}</td> |
| 65 | <?php //foreach ($report as $key1 => $value1) { | 57 | <td><input type="number" name="products[<?= $i ?>][lg]" value="{{isset($value['lead_generated'])?$value['lead_generated']:'0'}}" $disabled></td> |
| 66 | //print_r($value1); | 58 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lgAmt]" value="{{isset($value['lead_generated_amount'])?$value['lead_generated_amount']:'0'}}" $disabled></td> |
| 67 | ?> | 59 | <td><input type="number" name="products[<?= $i ?>][lc]" value="{{isset($value['lead_closed'])?$value['lead_closed']:'0'}}" $disabled></td> |
| 68 | <td><input type="number" name="products[<?= $i ?>][lg]" value="{{isset($value1->lead_generated)?$value1->lead_generated:'0'}}" $disabled></td> | 60 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lcAmt]" value="{{isset($value['lead_closed_amount'])?$value['lead_closed_amount']:'0'}}" $disabled></td> |
| 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> | 61 | </tr> |
| 73 | <?php | 62 | <?php |
| 74 | // } | ||
| 75 | $i++; | 63 | $i++; |
| 76 | }} ?> | 64 | } ?> |
| 77 | 65 | ||
| 78 | @if($disabled == "") | 66 | @if($disabled == "") |
| 79 | <tr> | 67 | <tr> | ... | ... |
-
Please register or sign in to post a comment