id(); $user = Staff::find($id); $email = $user->email; $marketdetail= Commission::where('contract','24')->where('formT','R')->orderBy('created_by','desc')->get(); $curr = Carbon::now()->getTimestamp(); $i = 0; $nested_data = array(); if(!empty($marketdetail)) { foreach ($marketdetail as $a) { $i++; $n1 = ''; $reg_time = $a->created_at; $expiry_date = $reg_time->addDays(3); $expiry_date = $expiry_date->getTimestamp(); if($curr < $expiry_date) { $n1 = "New/"; } array_push($nested_data, array( 'index' => $n1.$i, 'formT' => $a->formT, 'ranges' => $a->ranges, 'comm' => $a->comm, 'category' => $a->category, 'contract' => $a->contract, 'action' => $a->_id )); } } return \DataTables::of($nested_data)->make(true); } public function getCommissionListR12() { $id = Auth::guard('ms')->id(); $user = Staff::find($id); $email = $user->email; $marketdetail= Commission::where('contract','12')->where('formT','R')->orderBy('created_by','desc')->get(); $curr = Carbon::now()->getTimestamp(); $i = 0; $nested_data = array(); if(!empty($marketdetail)) { foreach ($marketdetail as $a) { $i++; $n1 = ''; $reg_time = $a->created_at; $expiry_date = $reg_time->addDays(3); $expiry_date = $expiry_date->getTimestamp(); if($curr < $expiry_date) { $n1 = "New/"; } array_push($nested_data, array( 'index' => $n1.$i, 'formT' => $a->formT, 'ranges' => $a->ranges, 'comm' => $a->comm, 'category' => $a->category, 'contract' => $a->contract, 'action' => $a->_id )); } } return \DataTables::of($nested_data)->make(true); } public function getCommissionListB24Low() { $id = Auth::guard('ms')->id(); $user = Staff::find($id); $email = $user->email; $marketdetail= Commission::where('contract','24')->where('formT','B')->where('packageR','10,30,50,100')->orderBy('created_by','desc')->get(); $curr = Carbon::now()->getTimestamp(); $i = 0; $nested_data = array(); if(!empty($marketdetail)) { foreach ($marketdetail as $a) { $i++; $n1 = ''; $reg_time = $a->created_at; $expiry_date = $reg_time->addDays(3); $expiry_date = $expiry_date->getTimestamp(); if($curr < $expiry_date) { $n1 = "New/"; } array_push($nested_data, array( 'index' => $n1.$i, 'packageR' => $a->packageR, 'ranges' => $a->ranges, 'comm' => $a->comm, 'category' => $a->category, 'contract' => $a->contract, 'action' => $a->_id )); } } return \DataTables::of($nested_data)->make(true); } public function getCommissionListB24High() { $id = Auth::guard('ms')->id(); $user = Staff::find($id); $email = $user->email; $marketdetail= Commission::where('contract','24')->where('formT','B')->orwhere('packageR','300')->orwhere('packageR','500')->orwhere('packageR','1')->orderBy('created_by','desc')->get(); $curr = Carbon::now()->getTimestamp(); $i = 0; $nested_data = array(); if(!empty($marketdetail)) { foreach ($marketdetail as $a) { $i++; $n1 = ''; $reg_time = $a->created_at; $expiry_date = $reg_time->addDays(3); $expiry_date = $expiry_date->getTimestamp(); if($curr < $expiry_date) { $n1 = "New/"; } array_push($nested_data, array( 'index' => $n1.$i, 'packageR' => $a->packageR, 'ranges' => $a->ranges, 'comm' => $a->comm, 'category' => $a->category, 'contract' => $a->contract, 'action' => $a->_id )); } } return \DataTables::of($nested_data)->make(true); } public function getCommissionListB12Low() { $id = Auth::guard('ms')->id(); $user = Staff::find($id); $email = $user->email; $marketdetail= Commission::where('contract','12')->where('formT','B')->where('packageR','10,30,50,100')->orderBy('created_by','desc')->get(); $curr = Carbon::now()->getTimestamp(); $i = 0; $nested_data = array(); if(!empty($marketdetail)) { foreach ($marketdetail as $a) { $i++; $n1 = ''; $reg_time = $a->created_at; $expiry_date = $reg_time->addDays(3); $expiry_date = $expiry_date->getTimestamp(); if($curr < $expiry_date) { $n1 = "New/"; } array_push($nested_data, array( 'index' => $n1.$i, 'packageR' => $a->packageR, 'ranges' => $a->ranges, 'comm' => $a->comm, 'category' => $a->category, 'contract' => $a->contract, 'action' => $a->_id )); } } return \DataTables::of($nested_data)->make(true); } //Function to get commission list (1 year) public function getCommissionListB12High() { $id = Auth::guard('ms')->id(); $user = Staff::find($id); $email = $user->email; $marketdetail= Commission::where('contract','12')->where('formT','B')->orwhere('packageR','300')->orwhere('packageR','500')->orwhere('packageR','1')->orderBy('created_by','desc')->get(); $curr = Carbon::now()->getTimestamp(); $i = 0; $nested_data = array(); if(!empty($marketdetail)) { foreach ($marketdetail as $a) { $i++; $n1 = ''; $reg_time = $a->created_at; $expiry_date = $reg_time->addDays(3); $expiry_date = $expiry_date->getTimestamp(); if($curr < $expiry_date) { $n1 = "New/"; } array_push($nested_data, array( 'index' => $n1.$i, 'packageR' => $a->packageR, 'ranges' => $a->ranges, 'comm' => $a->comm, 'category' => $a->category, 'contract' => $a->contract, 'action' => $a->_id )); } } return \DataTables::of($nested_data)->make(true); } }