| public function get_data_form(Request $request){ | public function get_data_form(Request $request){ | ||||
| $dateS = Carbon::createFromFormat('Y-m-d', '2019-01-01'); | |||||
| $dateS = Carbon::createFromFormat('Y-m-d', '2020-01-01'); | |||||
| $start = $dateS->copy()->startOfDay(); | $start = $dateS->copy()->startOfDay(); | ||||
| $dateE = Carbon::createFromFormat('Y-m-d', '2020-08-31'); | $dateE = Carbon::createFromFormat('Y-m-d', '2020-08-31'); | ||||
| $end = $dateE->copy()->endOfDay(); | $end = $dateE->copy()->endOfDay(); |
| } | } | ||||
| function createWorkID($limit){ | function createWorkID($limit){ | ||||
| $number = WorkOrder::select('id','wo')->orderBy('created_at','DESC')->first(); | |||||
| $numberOnly = str_replace('WO-','',$number->wo); | |||||
| $numberOnly++; | |||||
| return $numberOnly; | |||||
| $allowedNumbers = range(0, 9); | $allowedNumbers = range(0, 9); | ||||
| shuffle($allowedNumbers); | shuffle($allowedNumbers); | ||||
| $digits = array_rand($allowedNumbers, $limit); | $digits = array_rand($allowedNumbers, $limit); | ||||
| return redirect('/contractor/work-order/list'); | return redirect('/contractor/work-order/list'); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } |
| return substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, $limit); | return substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, $limit); | ||||
| } | } | ||||
| function createWorkID($limit){ | |||||
| function createWorkID($limit) { | |||||
| $number = WorkOrder::select('id','wo')->orderBy('created_at','DESC')->first(); | |||||
| $numberOnly = str_replace('WO-','',$number->wo); | |||||
| $numberOnly++; | |||||
| return $numberOnly; | |||||
| $allowedNumbers = range(0, 9); | $allowedNumbers = range(0, 9); | ||||
| shuffle($allowedNumbers); | shuffle($allowedNumbers); | ||||
| $digits = array_rand($allowedNumbers, $limit); | $digits = array_rand($allowedNumbers, $limit); | ||||
| return 'false'; | return 'false'; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } |
| $nested_data = array(); | $nested_data = array(); | ||||
| if($type == 'null' && $building == 'null' && $dealer == 'null'){ | if($type == 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(500)->get(); | |||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(2000)->get(); | |||||
| }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | ||||
| }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ | ||||
| $nested_data = array(); | $nested_data = array(); | ||||
| if($type == 'null' && $building == 'null' && $dealer == 'null'){ | if($type == 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->get(); | |||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(2000)->get(); | |||||
| }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | ||||
| }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ | ||||
| $nested_data = array(); | $nested_data = array(); | ||||
| if($type == 'null' && $building == 'null' && $dealer == 'null'){ | if($type == 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->get(); | |||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(2000)->get(); | |||||
| }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building == 'null' && $dealer == 'null'){ | ||||
| $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | $form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); | ||||
| }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ | }else if($type != 'null' && $building != 'null' && $dealer == 'null'){ |
| } | } | ||||
| function createWorkID($limit){ | function createWorkID($limit){ | ||||
| $number = WorkOrder::select('id','wo')->orderBy('created_at','DESC')->first(); | |||||
| $numberOnly = str_replace('WO-','',$number->wo); | |||||
| $numberOnly++; | |||||
| return $numberOnly; | |||||
| $allowedNumbers = range(0, 9); | $allowedNumbers = range(0, 9); | ||||
| shuffle($allowedNumbers); | shuffle($allowedNumbers); | ||||
| $digits = array_rand($allowedNumbers, $limit); | $digits = array_rand($allowedNumbers, $limit); | ||||
| return redirect()->to('/customer-service/work-order/add/schedule/secured/'.$wo.'/'. $su_id); | return redirect()->to('/customer-service/work-order/add/schedule/secured/'.$wo.'/'. $su_id); | ||||
| } | } | ||||
| } | |||||
| } |
| $destinationPath = 'document/'.$su_id; | $destinationPath = 'document/'.$su_id; | ||||
| // create folder/dir if not exist | // create folder/dir if not exist | ||||
| info(public_path()); | |||||
| if(!File::exists(public_path().'/'.$destinationPath)){ | if(!File::exists(public_path().'/'.$destinationPath)){ | ||||
| File::makeDirectory(public_path().'/'.$destinationPath,0777,true); | File::makeDirectory(public_path().'/'.$destinationPath,0777,true); | ||||
| } | } | ||||
| } | } | ||||
| return view('email.invoiceb', compact ('form', 'product')); | return view('email.invoiceb', compact ('form', 'product')); | ||||
| } | } | ||||
| } | |||||
| } |
| $destinationPath = 'document/'.$su_id; | $destinationPath = 'document/'.$su_id; | ||||
| // create folder/dir if not exist | // create folder/dir if not exist | ||||
| if(!File::exists(public_path().'/'.$destinationPath)){ | |||||
| info(public_path()); | |||||
| if(!File::exists(public_path().'/'.$destinationPath)){ | |||||
| File::makeDirectory(public_path().'/'.$destinationPath,0777,true); | File::makeDirectory(public_path().'/'.$destinationPath,0777,true); | ||||
| } | } | ||||
| public function handle(Docket $docket) | public function handle(Docket $docket) | ||||
| { | { | ||||
| $note = ''; | $note = ''; | ||||
| if(isset($this->request['Note'])){ | |||||
| $mac_router =''; | |||||
| $type_testing =''; | |||||
| if(isset($this->request['Note']) || ($this->request['mac_router']) || ($this->request['type_testing'])){ | |||||
| $note = $this->request['Note']; | $note = $this->request['Note']; | ||||
| $mac_router = $this->request['mac_router']; | |||||
| $type_testing = $this->request['type_testing']; | |||||
| } | } | ||||
| $docket->work_order_id = $this->request['wo']; | $docket->work_order_id = $this->request['wo']; | ||||
| $docket->installer_id = $this->staff; | $docket->installer_id = $this->staff; | ||||
| $docket->end_job = Carbon::now()->toDateTimeString(); | $docket->end_job = Carbon::now()->toDateTimeString(); | ||||
| $docket->router_serial_number = $this->request['router_serial_number']; | $docket->router_serial_number = $this->request['router_serial_number']; | ||||
| $docket->mac_router = $this->request['mac_router']; | |||||
| $docket->mac_router = $mac_router; | |||||
| $docket->cable_read = $this->request['cable_read']; | $docket->cable_read = $this->request['cable_read']; | ||||
| $docket->condition = $this->request['condition']; | $docket->condition = $this->request['condition']; | ||||
| $docket->type_testing = $type_testing; | |||||
| $docket->Note = $note; | $docket->Note = $note; | ||||
| $docket->Rating1 = $this->request['Rating1']; | $docket->Rating1 = $this->request['Rating1']; | ||||
| $docket->Rating2 = $this->request['Rating2']; | $docket->Rating2 = $this->request['Rating2']; | ||||
| $docket->Rating3 = $this->request['Rating3']; | $docket->Rating3 = $this->request['Rating3']; | ||||
| $docket->moden_sn = $this->request['modem_sn']; | |||||
| $docket->type_testing = $this->request['type_testing']; | |||||
| $docket->modem_sn = $this->request['modem_sn']; | |||||
| $docket->customer_signature = $this->signature; | $docket->customer_signature = $this->signature; | ||||
| $work_order = WorkOrder::where('wo',$this->request['wo'])->first(); | $work_order = WorkOrder::where('wo',$this->request['wo'])->first(); |
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| </table> | </table> | ||||
| @if ($ext1 !="pdf" && $ext2 !="pdf" && $ext3 !="pdf" && $ext4 !="pdf" && $ext5 != "pdf" && $ext6 !="pdf") | |||||
| @if($form->back_ic != "" && $form->front_ic != "") | @if($form->back_ic != "" && $form->front_ic != "") | ||||
| <!-- <div class="page-break"></div> --> | <!-- <div class="page-break"></div> --> | ||||
| <table border="0" cellpadding="0" cellspacing="0" width="100%"> | <table border="0" cellpadding="0" cellspacing="0" width="100%"> | ||||
| @endif | @endif | ||||
| </table> | </table> | ||||
| @endif | @endif | ||||
| @endif | |||||
| </body> | </body> | ||||
| </html> | </html> |