Siti Hajar Ibrahim 5 years ago
parent
commit
4fb177ca46
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      app/Http/Controllers/CustomerService/CustomerController.php

+ 7
- 6
app/Http/Controllers/CustomerService/CustomerController.php View File

@@ -30,6 +30,11 @@ class CustomerController extends Controller
}

function createWorkID($limit){
$number = WorkOrder::select('id','wo')->orderBy('wo','DESC')->first();
$numberOnly = str_replace('WO-','',$number->wo);
$numberOnly++;
return $numberOnly;

$allowedNumbers = range(0, 9);
shuffle($allowedNumbers);
$digits = array_rand($allowedNumbers, $limit);
@@ -102,6 +107,7 @@ class CustomerController extends Controller
$q->where('building_name', $building)->get();
}],'PackageDetail','WorkOrder')->where('type_service',$type)->where('company_id',$dealer)->orderBy('created_at', 'desc')->get();
}
if(!empty($form)){
foreach ($form as $key => $f) {
if(empty($f->WorkOrder)){
@@ -124,7 +130,6 @@ class CustomerController extends Controller
}else{
$labelD = "";
}

if(!empty($f->Subscriber)){
if($f->Subscriber->street != ''){
$street = $f->Subscriber->street;
@@ -132,12 +137,11 @@ class CustomerController extends Controller

$wo = '';
if($f->status_email == 'verified'){

$work_order = '';
if($f->type_application == 'R'){

do {
$work_order = 'WO-'.$this->createWorkID(4);
} while (WorkOrder::where("wo", "=", $work_order)->first() instanceof WorkOrder);

$wo = $work_order.'/'.$f->Subscriber->subscriber_id;
@@ -149,11 +153,9 @@ class CustomerController extends Controller
}

}else if($f->type_application == 'B'){

do {
$work_order = 'WO-'.$this->createWorkID(4);
} while (WorkOrder::where("wo", "=", $work_order)->first() instanceof WorkOrder);

$wo = $work_order.'/'.$f->Subscriber->subscriber_id;
$cov = Coverage::where('building_name',$f->Subscriber->building_name)->where('Type','B')->first();
if(!empty($cov)){
@@ -202,7 +204,6 @@ class CustomerController extends Controller
}else if($f->PackageDetail->voice_fee == ''){
$nP = '-';
}

array_push($nested_data, array(
'formT' => $n1.$i.$f->type_application,
'type' => $f->type_service,

Loading…
Cancel
Save