create blade excel files
This commit is contained in:
@@ -20,11 +20,57 @@ class ProvinceReport implements FromView, ShouldAutoSize, WithEvents, WithDrawin
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$data = $this->data;
|
||||
return view('v3.AccidentReceipt.ProvinceReport', [
|
||||
'data' => $data['data'],
|
||||
'fromDate' => $data['fromDate'],
|
||||
'ToDate' => $data['ToDate'],
|
||||
$inputData = $this->data;
|
||||
$reportData =$inputData['report'];
|
||||
|
||||
foreach ($inputData['cities'] as $city) {
|
||||
|
||||
$existingCity = array_search($city->id, array_column($inputData['data'], 'city_id'));
|
||||
|
||||
if ($existingCity) {
|
||||
$activities[] = [
|
||||
'name' => $city->name_fa,
|
||||
'tedade' => $reportData['data'][$existingCity]->tedade,
|
||||
'police_rah' => $reportData['data'][$existingCity]->police_rah,
|
||||
'gozaresh_gasht' => $reportData['data'][$existingCity]->gozaresh_gasht,
|
||||
'kol_sabt_shode' => $reportData['data'][$existingCity]->kol_sabt_shode,
|
||||
'vasel_shode' => $reportData['data'][$existingCity]->vasel_shode ?? 0,
|
||||
'vasel_shode_bimeh' => $reportData['data'][$existingCity]->vasel_shode_bimeh ?? 0,
|
||||
'vasel_shode_daghi' => $reportData['data'][$existingCity]->vasel_shode_daghi ?? 0,
|
||||
'vasel_shode_final' => $reportData['data'][$existingCity]->vasel_shode_final ?? 0,
|
||||
];
|
||||
} else {
|
||||
$activities[] = [
|
||||
'name' => $city->name_fa,
|
||||
'tedade' => "",
|
||||
'police_rah' => "",
|
||||
'gozaresh_gasht' => "",
|
||||
'kol_sabt_shode' => "",
|
||||
'vasel_shode' => "",
|
||||
'vasel_shode_bimeh' => "",
|
||||
'vasel_shode_daghi' => "",
|
||||
'vasel_shode_final' => "",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$activities[] = [
|
||||
'name' => 'استانی',
|
||||
'tedade' => $reportData['data'][-1]->tedade,
|
||||
'police_rah' => $reportData['data'][-1]->police_rah,
|
||||
'gozaresh_gasht' => $reportData['data'][-1]->gozaresh_gasht,
|
||||
'kol_sabt_shode' => $reportData['data'][-1]->kol_sabt_shode,
|
||||
'vasel_shode' => $reportData['data'][-1]->vasel_shode ?? 0,
|
||||
'vasel_shode_bimeh' => $reportData['data'][-1]->vasel_shode_bimeh ?? 0,
|
||||
'vasel_shode_daghi' => $reportData['data'][-1]->vasel_shode_daghi ?? 0,
|
||||
'vasel_shode_final' => $reportData['data'][-1]->vasel_shode_final ?? 0,
|
||||
];
|
||||
|
||||
|
||||
return view('v3.Reports.AccidentReceipt.ProvinceReport', [
|
||||
'data' => $activities,
|
||||
'fromDate' => $reportData['fromDate'],
|
||||
'toDate' => $reportData['toDate'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user