瀏覽代碼

edit api data

ifah
Siti Hajar Ibrahim 5 年之前
父節點
當前提交
211e371f00
共有 1 個檔案被更改,包括 39 行新增51 行删除
  1. 39
    51
      app/Http/Controllers/Api/FormController.php

+ 39
- 51
app/Http/Controllers/Api/FormController.php 查看文件



public function get_data_form(Request $request){ public function get_data_form(Request $request){


$dateS = Carbon::createFromFormat('Y-m-d', $request->startDate);
$dateS = Carbon::createFromFormat('Y-m-d', '2020-01-01');
$start = $dateS->copy()->startOfDay(); $start = $dateS->copy()->startOfDay();
$dateE = Carbon::createFromFormat('Y-m-d', $request->endDate);
$dateE = Carbon::createFromFormat('Y-m-d', '2020-07-16');
$end = $dateE->copy()->endOfDay(); $end = $dateE->copy()->endOfDay();


$result = array(); $result = array();
$address = $f->Subscriber->postcode. ' , '.$f->Subscriber->city. ' , '.$f->Subscriber->state; $address = $f->Subscriber->postcode. ' , '.$f->Subscriber->city. ' , '.$f->Subscriber->state;
} }


$woD = '-'; $woId = 'none'; $natureWork = ''; $doId = ''; $woRate=""; $installerId="";
$woD = '-'; $woId = 'none'; $natureWork = ''; $doId = ''; $woRate=""; $installer_name="";
if(!empty($f->WorkOrder)){ if(!empty($f->WorkOrder)){
$woId = $f->WorkOrder->wo; $woId = $f->WorkOrder->wo;
$natureWork = $f->WorkOrder->nature_work; $natureWork = $f->WorkOrder->nature_work;
$doId = $f->WorkOrder->docket_id; $doId = $f->WorkOrder->docket_id;
$installer = StaffDetail::where('_id',$f->WorkOrder->installer_id)->get();
foreach($installer as $installer) {
$installer_name = $installer->name;
}
if(!empty($f->WorkOrder->Docket)){ if(!empty($f->WorkOrder->Docket)){
$woD = $f->WorkOrder->Docket->end_job; $woD = $f->WorkOrder->Docket->end_job;
$woRate = $f->WorkOrder->Docket->Rating1;
// $installerId = $f->WordOrder->Docket->installer_id;

// array_push($result,array(
// 'type_application' => $f->type_application,
// "type_service" => $f->type_service,
// "customer_name"=> $name,
// "contact_no"=> $contact_no,
// "unit_no"=>$f->Subscriber->unit_no,
// "building"=>$building,
// "street"=>$address,
// "submitted_date" => $f->created_at->toDateTimeString(),
// "package_contract" => $f->PackageDetail->contract,
// "package_name" => $f->PackageDetail->name,
// 'dealer' => $labelD,
// 'wo' => $woId,
// 'activated_date' => $woD,
// ));
$woRate = $f->WorkOrder->Docket->Rating1;
} }
} }
// array_push($result,array(
// 'type_application' => $f->type_application,
// "type_service" => $f->type_service,
// "customer_name"=> $name,
// "contact_no"=> $contact_no,
// "unit_no"=>$f->Subscriber->unit_no,
// "building"=>$building,
// "street"=>$address,
// "submitted_date" => $f->created_at->toDateTimeString(),
// "package_contract" => $f->PackageDetail->contract,
// "package_name" => $f->PackageDetail->name,
// 'dealer' => $labelD,
// 'wo' => $woId,
// 'activated_date' => $woD,
// ));
array_push($result,array( array_push($result,array(
// 'Installer' => $installerId,
'Dealer Name' => $labelD,
"Customer Name"=> $name,
"Contact Number"=> $contact_no,
'Completion Date' => $woD,
'Type Application' => $f->type_application,
"Form Type" => $f->type_service,
"Package"=> $f->PackageDetail->contract,
"WO No" => $woId,
"DO No" => $doId,
"Service Type" => $f->PackageDetail->name,
"Building"=>$building,
"Rating" => $woRate,
// "Claim Amount" => $amount_claim,
));
'type_application' => $f->type_application,
"type_service" => $f->type_service,
"customer_name"=> $name,
"contact_no"=> $contact_no,
"unit_no"=>$f->Subscriber->unit_no,
"building"=>$building,
"street"=>$address,
"submitted_date" => $f->created_at->toDateTimeString(),
"package_contract" => $f->PackageDetail->contract,
"package_name" => $f->PackageDetail->name,
'dealer' => $labelD,
'wo' => $woId,
'activated_date' => $woD,
'installer_name' => $installer_name,
));
// array_push($result,array(
// // 'Installer' => $installerId,
// 'Dealer Name' => $labelD,
// "Customer Name"=> $name,
// "Contact Number"=> $contact_no,
// 'Completion Date' => $woD,
// 'Type Application' => $f->type_application,
// "Form Type" => $f->type_service,
// "Package"=> $f->PackageDetail->contract,
// "WO No" => $woId,
// "DO No" => $doId,
// "Service Type" => $f->PackageDetail->name,
// "Building"=>$building,
// "Rating" => $woRate,
// // "Claim Amount" => $amount_claim,
// ));
} }


} }

Loading…
取消
儲存