|
|
@@ -3772,6 +3772,66 @@ class MarketingController extends Controller |
|
|
|
}],'Staff')->where('formT', 'B')->where('dealer',$company)->where('activated_my',$month.'/'.$year)->orderBy('activated_dt','DESC')->get(); |
|
|
|
} |
|
|
|
|
|
|
|
} else if($year!='null' && $month!='null' && $app!='null' && $ptype!='null'){ |
|
|
|
|
|
|
|
if($app == 'Residential'){ |
|
|
|
$dataClaim = DealerClaim::with(['Subscriber' => function($q) { |
|
|
|
$q->with('Form'); |
|
|
|
}],'Staff')->where('formT', 'R')->where('dealer',$company)->where('activated_my',$month.'/'.$year)->where('projectT',$ptype)->orderBy('activated_dt','DESC')->get(); |
|
|
|
|
|
|
|
if(($year == '2019' || $year == '2020') && ($month == '12' || $month == '01')){ |
|
|
|
|
|
|
|
foreach ($dataClaim as $key => $d) { |
|
|
|
if(date('d/m/Y', strtotime($d->activated_dt)) >= '12/12/2019' && |
|
|
|
date('d/m/Y', strtotime($d->activated_dt)) <= '31/01/2020'){ |
|
|
|
if (strpos($d['address'], 'Cyberjaya') !== false) { |
|
|
|
$count_cyberjaya[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Jasin') !== false) { |
|
|
|
$count_jasin[] = $d; |
|
|
|
} |
|
|
|
if (strpos($d['address'], 'Ayer Keroh') !== false) { |
|
|
|
$count_ayerKeroh[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Alor Gajah') !== false) { |
|
|
|
$count_alorGajah[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else if($year == '2020' && ($month == '04' || $month == '05' || $month == '06' || $month == '07')){ |
|
|
|
|
|
|
|
foreach ($dataClaim as $key => $d) { |
|
|
|
if(date('d/m/Y', strtotime($d->activated_dt)) >= '27/04/2020' && |
|
|
|
date('d/m/Y', strtotime($d->activated_dt)) <= '31/07/2020'){ |
|
|
|
if (strpos($d['address'], 'Cyberjaya') !== false) { |
|
|
|
$count_cyberjaya[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Jasin') !== false) { |
|
|
|
$count_jasin[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ayer Keroh') !== false) { |
|
|
|
$count_ayerKeroh[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Alor Gajah') !== false) { |
|
|
|
$count_alorGajah[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if($app == 'Business'){ |
|
|
|
$dataClaim = DealerClaim::with(['Subscriber' => function($q) { |
|
|
|
$q->with('Form'); |
|
|
|
}],'Staff')->where('formT', 'B')->where('dealer',$company)->where('activated_my',$month.'/'.$year)->where('projectT',$ptype)->orderBy('activated_dt','DESC')->get(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(!empty($dataClaim)){ |
|
|
@@ -3877,7 +3937,11 @@ class MarketingController extends Controller |
|
|
|
|
|
|
|
$pdf = PDF::loadView('pdf.agent-claim', compact('final', 'month', 'year','com','basic_total','extra','totals', 'invoice_no')); |
|
|
|
$pdf->setPaper('A4', 'landscape'); |
|
|
|
$pdfName = preg_replace('/\s+/', '-', $com->name).'-'.$month.'-'.$year.'.pdf'; |
|
|
|
if($ptype!=null){ |
|
|
|
$pdfName = preg_replace('/\s+/', '-', $com->name).'-'.$app.'-'.$ptype.'-'.$month.'-'.$year.'.pdf'; |
|
|
|
}else{ |
|
|
|
$pdfName = preg_replace('/\s+/', '-', $com->name).'-'.$app.'-'.$month.'-'.$year.'.pdf'; |
|
|
|
} |
|
|
|
|
|
|
|
return $pdf->download( $pdfName ); |
|
|
|
} |