updated
Showing
2 changed files
with
22 additions
and
10 deletions
| ... | @@ -100,12 +100,13 @@ class OutputReportController extends Controller | ... | @@ -100,12 +100,13 @@ class OutputReportController extends Controller |
| 100 | //if($dashboarduser->usertype == "User"){ | 100 | //if($dashboarduser->usertype == "User"){ |
| 101 | // output reports | 101 | // output reports |
| 102 | $products = DB::table('output_products') | 102 | $products = DB::table('output_products') |
| 103 | ->select('output_products.id as productId','output_products.name','output_products.status', 'output_report.product_id', 'output_report.id as reportId', 'output_report.lead_generated', 'output_report.lead_generated_amount', 'output_report.lead_closed' , 'output_report.lead_closed_amount' ) | 103 | ->select('id as productId','name','status') |
| 104 | ->leftJoin('output_report', 'output_products.id', '=', 'output_report.product_id') | ||
| 105 | ->where('status', '1') | 104 | ->where('status', '1') |
| 106 | ->orderBy('output_products.id') | 105 | ->orderBy('output_products.id') |
| 107 | ->get(); | 106 | ->get(); |
| 108 | 107 | $report = DB::table('output_report') | |
| 108 | ->where('user_id',Auth::user()->id) | ||
| 109 | ->get(); | ||
| 109 | // total income | 110 | // total income |
| 110 | $totalIncome = DB::select("select sum(income) as income from output_report where user_id=".Auth::user()->id); | 111 | $totalIncome = DB::select("select sum(income) as income from output_report where user_id=".Auth::user()->id); |
| 111 | 112 | ||
| ... | @@ -135,7 +136,7 @@ class OutputReportController extends Controller | ... | @@ -135,7 +136,7 @@ class OutputReportController extends Controller |
| 135 | } | 136 | } |
| 136 | //print_r($usersarray); | 137 | //print_r($usersarray); |
| 137 | $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get(); | 138 | $output = DB::table('output_report')->whereIn('user_id',$usersarray)->where('date','=',date("Y-m-d"))->orderBy('user_id')->get(); |
| 138 | return view("layout.module.outputreport.outputreport")->with('data', ['products' => $products, 'totalIncome' => $totalIncome[0]->income, 'noOfAttempts' => $noOfAttempts , 'noOfContacts' => $noOfContacts , 'uniqueContacts' => $uniqueContacts , 'output' => $output]); | 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]); |
| 139 | // } | 140 | // } |
| 140 | } | 141 | } |
| 141 | 142 | ... | ... |
| 1 | 1 | ||
| 2 | <?php | 2 | <?php |
| 3 | use App\Models\User; | 3 | use App\Models\User; |
| 4 | if(Auth::user()->id=="1" || Auth::user()->id=="90" || Auth::user()->id == "127"){ ?> | 4 | if(Auth::user()->id=="1"){ ?> |
| 5 | <div class="container"> | 5 | <div class="container"> |
| 6 | <div style="text-align:center"> | 6 | <div style="text-align:center"> |
| 7 | <h2>Output Report</h2> | 7 | <h2>Output Report</h2> |
| ... | @@ -55,15 +55,16 @@ use App\Models\User; | ... | @@ -55,15 +55,16 @@ use App\Models\User; |
| 55 | foreach ($data['products'] as $key => $value) { | 55 | foreach ($data['products'] as $key => $value) { |
| 56 | //print_r($value); | 56 | //print_r($value); |
| 57 | //print_r($ProductType); | 57 | //print_r($ProductType); |
| 58 | 58 | // foreach ($data['report'] as $key1 => $value1) { | |
| 59 | //print_r($value1); | ||
| 59 | ?> | 60 | ?> |
| 60 | <tr> | 61 | <tr> |
| 61 | <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="<?php echo $value->productId; ?>"> | 62 | <td> <input type="hidden" name="products[<?= $i ?>][productId]" value="<?php echo $value->productId; ?>"> |
| 62 | <input type="hidden" name="products[<?= $i ?>][product]" value="<?php echo $value->name; ?>" ><?php echo $value->name; ?></td> | 63 | <input type="hidden" name="products[<?= $i ?>][product]" value="<?php echo $value->name; ?>" ><?php echo $value->name; ?></td> |
| 63 | <td><input type="number" name="products[<?= $i ?>][lg]" value="<?php echo $value->lead_generated; ?>"></td> | 64 | <td><input type="number" name="products[<?= $i ?>][lg]" value="<?php //echo isset($value1)?$value1->lead_generated:"0"; ?>"></td> |
| 64 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lgAmt]" value="<?php echo $value->lead_generated_amount; ?>"></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 | <td><input type="number" name="products[<?= $i ?>][lc]" value="<?php echo $value->lead_closed; ?>"></td> | 66 | <td><input type="number" name="products[<?= $i ?>][lc]" value="<?php // echo isset($value1)?$value1->lead_closed:"0"; ?>"></td> |
| 66 | <td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lcAmt]" value="<?php echo $value->lead_closed_amount; ?>"></td> | 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 | </tr> | 68 | </tr> |
| 68 | <?php | 69 | <?php |
| 69 | 70 | ||
| ... | @@ -80,6 +81,16 @@ use App\Models\User; | ... | @@ -80,6 +81,16 @@ use App\Models\User; |
| 80 | if(Auth::user()->usertype == "Supervisor"){ ?> | 81 | if(Auth::user()->usertype == "Supervisor"){ ?> |
| 81 | <form class="form-horizontal" id="output-report-supervisor" name="output-report-supervisor"> | 82 | <form class="form-horizontal" id="output-report-supervisor" name="output-report-supervisor"> |
| 82 | <div class="table-responsive" style="background: #fff;"> | 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> | ||
| 83 | <table class="table"> | 94 | <table class="table"> |
| 84 | <thead> | 95 | <thead> |
| 85 | <th></th> | 96 | <th></th> | ... | ... |
-
Please register or sign in to post a comment