|
|
@@ -499,7 +499,7 @@ class DealerController extends Controller |
|
|
|
|
|
|
|
$dataR = array(); $dataB = array(); $combineData = array(); |
|
|
|
|
|
|
|
$count_cyberjaya = array(); $count_jasin = array(); |
|
|
|
$count_cyberjaya = array(); $count_jasin = array(); $count_ayerKeroh = array(); $count_alorGajah = array(); $count_menglembu = array(); $count_ipoh = array(); |
|
|
|
$extra = 0; $basic_total = 0; $totals = 0; |
|
|
|
|
|
|
|
if($year!='null' && $month!='null' && $app=='null'){ |
|
|
@@ -520,6 +520,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -535,6 +551,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -559,6 +591,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -574,6 +622,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -641,6 +705,26 @@ class DealerController extends Controller |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_ayerKeroh) > 50){ |
|
|
|
$balance = count($count_ayerKeroh) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_alorGajah) > 50){ |
|
|
|
$balance = count($count_alorGajah) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_menglembu) > 50){ |
|
|
|
$balance = count($count_menglembu) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_ipoh) > 50){ |
|
|
|
$balance = count($count_ipoh) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_jasin) > 10){ |
|
|
|
$balance = count($count_jasin) - 10; |
|
|
|
$extra += $balance * 50; |
|
|
@@ -652,6 +736,26 @@ class DealerController extends Controller |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_ayerKeroh) > 50){ |
|
|
|
$balance = count($count_ayerKeroh) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_alorGajah) > 50){ |
|
|
|
$balance = count($count_alorGajah) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_menglembu) > 50){ |
|
|
|
$balance = count($count_menglembu) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_ipoh) > 50){ |
|
|
|
$balance = count($count_ipoh) - 50; |
|
|
|
$extra += $balance * 50; |
|
|
|
} |
|
|
|
|
|
|
|
if(count($count_jasin) > 20){ |
|
|
|
$balance = count($count_jasin) - 20; |
|
|
|
$extra += $balance * 50; |
|
|
@@ -1817,6 +1921,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -1832,6 +1952,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -1868,6 +2004,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -1883,6 +2035,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -2084,7 +2252,7 @@ class DealerController extends Controller |
|
|
|
|
|
|
|
if($year!='null' && $month!='null' && $app=='null'){ |
|
|
|
|
|
|
|
$count_cyberjaya = array(); $count_jasin = array(); $count_ayerKeroh = array(); $count_alorGajah = array(); |
|
|
|
$count_cyberjaya = array(); $count_jasin = array(); $count_ayerKeroh = array(); $count_alorGajah = array(); $count_menglembu = array(); $count_ipoh = array(); |
|
|
|
$extra = 0; $basic_total = 0; $totals = 0; |
|
|
|
|
|
|
|
// if(($year == '2019' || $year == '2020') && ($month == '12' || $month == '01')){ |
|
|
@@ -2117,13 +2285,23 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){ |
|
|
@@ -2140,12 +2318,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($dataJune as $key => $d) { |
|
|
@@ -2156,12 +2344,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($dataJuly as $key => $d) { |
|
|
@@ -2172,12 +2370,22 @@ class DealerController extends Controller |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Menglembu') !== false) { |
|
|
|
$count_menglembu[] = $d; |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($d['address'], 'Ipoh') !== false) { |
|
|
|
$count_ipoh[] = $d; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Store to combineData New Incentives Cyberjaya |
|
|
@@ -2241,6 +2449,127 @@ class DealerController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Store to combineData New Incentives Menglembu |
|
|
|
foreach ($count_menglembu as $key => $d) { |
|
|
|
if(count($count_menglembu) > 50){ |
|
|
|
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){ |
|
|
|
|
|
|
|
if($d['contract'] == '12'){ |
|
|
|
array_push($combineData, array( |
|
|
|
'index' => $d['index'], |
|
|
|
'contract' => $d['contract'], |
|
|
|
'wo' => $d['wo'], |
|
|
|
'activation' => $d['activation'], |
|
|
|
'name' => $d['name'], |
|
|
|
'address' => $d['address'], |
|
|
|
'package' => $d['package'], |
|
|
|
'retail_price' => $d['retail_price'], |
|
|
|
'incentives1' => $d['incentives1'], |
|
|
|
'incentives2' => $d['incentives2'], |
|
|
|
'total' => $d['total'], |
|
|
|
'claim' => $d['claim'], |
|
|
|
)); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.3, 2); |
|
|
|
array_push($combineData, array( |
|
|
|
'index' => $d['index'], |
|
|
|
'contract' => $d['contract'], |
|
|
|
'wo' => $d['wo'], |
|
|
|
'activation' => $d['activation'], |
|
|
|
'name' => $d['name'], |
|
|
|
'address' => $d['address'], |
|
|
|
'package' => $d['package'], |
|
|
|
'retail_price' => $d['retail_price'], |
|
|
|
'incentives1' => '230%', |
|
|
|
'incentives2' => $d['incentives2'], |
|
|
|
'total' => 'RM '.$total, |
|
|
|
'claim' => $d['claim'], |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else if(count($count_menglembu) < 50){ |
|
|
|
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){ |
|
|
|
array_push($combineData, array( |
|
|
|
'index' => $d['index'], |
|
|
|
'contract' => $d['contract'], |
|
|
|
'wo' => $d['wo'], |
|
|
|
'activation' => $d['activation'], |
|
|
|
'name' => $d['name'], |
|
|
|
'address' => $d['address'], |
|
|
|
'package' => $d['package'], |
|
|
|
'retail_price' => $d['retail_price'], |
|
|
|
'incentives1' => $d['incentives1'], |
|
|
|
'incentives2' => $d['incentives2'], |
|
|
|
'total' => $d['total'], |
|
|
|
'claim' => $d['claim'], |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Store to combineData New Incentives Ipoh |
|
|
|
foreach ($count_ipoh as $key => $d) { |
|
|
|
if(count($count_ipoh) > 50){ |
|
|
|
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){ |
|
|
|
|
|
|
|
if($d['contract'] == '12'){ |
|
|
|
array_push($combineData, array( |
|
|
|
'index' => $d['index'], |
|
|
|
'contract' => $d['contract'], |
|
|
|
'wo' => $d['wo'], |
|
|
|
'activation' => $d['activation'], |
|
|
|
'name' => $d['name'], |
|
|
|
'address' => $d['address'], |
|
|
|
'package' => $d['package'], |
|
|
|
'retail_price' => $d['retail_price'], |
|
|
|
'incentives1' => $d['incentives1'], |
|
|
|
'incentives2' => $d['incentives2'], |
|
|
|
'total' => $d['total'], |
|
|
|
'claim' => $d['claim'], |
|
|
|
)); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.3, 2); |
|
|
|
array_push($combineData, array( |
|
|
|
'index' => $d['index'], |
|
|
|
'contract' => $d['contract'], |
|
|
|
'wo' => $d['wo'], |
|
|
|
'activation' => $d['activation'], |
|
|
|
'name' => $d['name'], |
|
|
|
'address' => $d['address'], |
|
|
|
'package' => $d['package'], |
|
|
|
'retail_price' => $d['retail_price'], |
|
|
|
'incentives1' => '230%', |
|
|
|
'incentives2' => $d['incentives2'], |
|
|
|
'total' => 'RM '.$total, |
|
|
|
'claim' => $d['claim'], |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else if(count($count_ipoh) < 50){ |
|
|
|
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){ |
|
|
|
array_push($combineData, array( |
|
|
|
'index' => $d['index'], |
|
|
|
'contract' => $d['contract'], |
|
|
|
'wo' => $d['wo'], |
|
|
|
'activation' => $d['activation'], |
|
|
|
'name' => $d['name'], |
|
|
|
'address' => $d['address'], |
|
|
|
'package' => $d['package'], |
|
|
|
'retail_price' => $d['retail_price'], |
|
|
|
'incentives1' => $d['incentives1'], |
|
|
|
'incentives2' => $d['incentives2'], |
|
|
|
'total' => $d['total'], |
|
|
|
'claim' => $d['claim'], |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// Store to combineData New Incentives Ayer Keroh |
|
|
|
foreach ($count_ayerKeroh as $key => $d) { |
|
|
|
if(count($count_ayerKeroh) > 50){ |
|
|
@@ -2305,7 +2634,7 @@ class DealerController extends Controller |
|
|
|
} |
|
|
|
// Store to combineData New Incentives Alor Gajah |
|
|
|
foreach ($count_alorGajah as $key => $d) { |
|
|
|
if(count($count_alorGajah) > 20){ |
|
|
|
if(count($count_alorGajah) > 50){ |
|
|
|
|
|
|
|
if($d['contract'] == '12'){ |
|
|
|
|
|
|
@@ -2346,7 +2675,7 @@ class DealerController extends Controller |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if(count($count_alorGajah) < 20){ |
|
|
|
}else if(count($count_alorGajah) < 50){ |
|
|
|
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){ |
|
|
|
array_push($combineData, array( |
|
|
|
'index' => $d['index'], |