|
|
|
@@ -220,4 +220,63 @@ class FormController extends BaseController |
|
|
|
return $this->sendResponse($data, 'Form deleted by specific company'); |
|
|
|
} |
|
|
|
|
|
|
|
/*********************************** |
|
|
|
/* API to get claimed data |
|
|
|
***********************************/ |
|
|
|
public function get_data_claim(){ |
|
|
|
|
|
|
|
$dateS = Carbon::createFromFormat('Y-m-d', '2019-01-01'); |
|
|
|
$start = $dateS->copy()->startOfDay(); |
|
|
|
$dateE = Carbon::createFromFormat('Y-m-d', '2019-12-31'); |
|
|
|
$end = $dateE->copy()->endOfDay(); |
|
|
|
|
|
|
|
$result = array(); |
|
|
|
$data = DealerClaim::with('Subscriber','Staff')->whereBetween('created_at', array($start, $end))->get(); |
|
|
|
|
|
|
|
if(count($data) > 0) { |
|
|
|
foreach($data as $f) { |
|
|
|
|
|
|
|
$name = ''; $contact_no = ''; $building = ''; |
|
|
|
$labelD = ''; |
|
|
|
|
|
|
|
if(!empty($f->dealer)){ |
|
|
|
$c = Company::find($f->dealer); |
|
|
|
$labelD = $c->name; |
|
|
|
}else{ |
|
|
|
$labelD = ""; |
|
|
|
} |
|
|
|
|
|
|
|
if(!empty($f->Subscriber)){ |
|
|
|
if($f->formT == 'R'){ |
|
|
|
$name = $f->Subscriber->name; |
|
|
|
$contact_no = $f->Subscriber->phone1; |
|
|
|
$building = $f->Subscriber->building_name; |
|
|
|
}else if($f->formT == 'B'){ |
|
|
|
$name = $f->Subscriber->company_name; |
|
|
|
$contact_no = $f->Subscriber->company_num; |
|
|
|
$building = $f->Subscriber->street; |
|
|
|
} |
|
|
|
|
|
|
|
array_push($result,array( |
|
|
|
"Dealer Name" => $labelD, |
|
|
|
// "Installer Name" => , |
|
|
|
// "Contractor Name" => , |
|
|
|
"Customer Name"=> $name, |
|
|
|
"Contact Number"=> $contact_no, |
|
|
|
"Completion Date" => $f->activated_dt, |
|
|
|
"Form Type" => $f->formT, |
|
|
|
"Package"=> $f->package, |
|
|
|
"WO No" => $f->wo, |
|
|
|
"DO No" => $f->docket, |
|
|
|
// "Service Type" => , |
|
|
|
"Building"=> $building, |
|
|
|
// "Rating" => , |
|
|
|
"Claim Amount" => $f->total_claim, |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return json_encode($result); |
|
|
|
} |
|
|
|
} |