Browse Source

download pdf for ptype

ifah
Siti Hajar Ibrahim 4 years ago
parent
commit
410603662f

+ 65
- 1
app/Http/Controllers/DS/MarketingController.php View File

@@ -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 );
}

+ 3
- 1
resources/views/market/claim_list.blade.php View File

@@ -282,8 +282,10 @@

else if($('#fbyear').val() != 'null' && $('#fbmonth').val() != 'null' && $('#fbapps').val() != 'null' && $('#fbptype').val() != 'null')
{
var link = origin+'/marketing/download/claim/'+company+'/'+$('#fbyear').val()+'/'+$('#fbmonth').val()+'/'+$('#fbapps').val()+'/'+$('#fbptype').val()+'/pdf';
table.ajax.url( origin+'/marketing/agent/filter/'+company+'/'+$('#fbyear').val()+'/'+$('#fbmonth').val()+'/'+$('#fbapps').val()+'/'+$('#fbptype').val() ).load();
$('#link1').hide();
$('#link1').show();
$('#link1').html('<li><a target="_blank" href="'+link+'" title=""><span class="icos-download"></span>Download PDF</a></li>');
}

else if($('#fbyear').val() == 'null' && $('#fbmonth').val() == 'null' && $('#fbapps').val() == 'null' && $('#fbptype').val() != 'null')

Loading…
Cancel
Save