Sfoglia il codice sorgente

Add calculation claim for September

ifah
Siti Hajar Ibrahim 5 anni fa
parent
commit
1051ca38c4
1 ha cambiato i file con 231 aggiunte e 6 eliminazioni
  1. 231
    6
      app/Http/Controllers/DS/DealerController.php

+ 231
- 6
app/Http/Controllers/DS/DealerController.php Vedi File

@@ -2271,7 +2271,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_menglembu = array(); $count_ipoh = array();
$extra = 0; $basic_total = 0; $countAugustR = array(); $countAugustB = array(); $finalprice = 0;
$extra = 0; $basic_total = 0; $countAugustR = array(); $countAugustB = array();$countSeptemberR = array(); $countSeptemberB = array(); $finalprice = 0;

// if(($year == '2019' || $year == '2020') && ($month == '12' || $month == '01')){
// $dataDis = $this->returnDataR($company,'2019','12');
@@ -2778,7 +2778,8 @@ class DealerController extends Controller
}else if($year == '2020' && ($month == '08' || $month == '09' || $month == '10')){
$dataAugustR = $this->returnDataR($company,'2020','8');
$dataAugustB = $this->returnDataB($company,'2020','8');
$dataSeptember = $this->returnDataR($company,'2020','9');
$dataSeptemberR = $this->returnDataR($company,'2020','9');
$dataSeptemberB = $this->returnDataB($company,'2020','8');
$dataOctober = $this->returnDataR($company,'2020','10');

foreach ($dataAugustR as $key => $d) {
@@ -2793,11 +2794,9 @@ class DealerController extends Controller
}
// Store to combineData New Incentive August
foreach ($countAugustR as $key => $d) {
info('R '. $d['wo']. ' '. $d['submission']);
if(count($dataAugustR) >= 50){
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
if($d['contract'] == '12'){
info('Contract 12 '. $d['wo']. ' '. $d['submission']);
array_push($combineData, array(
'index' => $d['index'],
'contract' => $d['contract'],
@@ -2814,7 +2813,6 @@ class DealerController extends Controller
));

}else {
info('Contract 24 '. $d['wo']. ' '. $d['submission']);
if ($d['package']== 50){
$finalprice = 69;
$total = number_format(69 * 2.5 + 50, 2);
@@ -2908,7 +2906,6 @@ class DealerController extends Controller
}
// Store to combineData New Incentive August
foreach ($countAugustB as $key => $d) {
info('B ' . $d['wo']. ''. $d['submission']);
if(count($dataAugustB) >= 50){
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
if($d['contract'] == '12'){
@@ -3012,6 +3009,234 @@ class DealerController extends Controller
}
}
}

foreach ($dataSeptemberR as $key => $d) {
if((date('m/Y', strtotime($d['submission'])) == $month.'/'.$year) && date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020'){
$countSeptemberR[] = $d;
}else {
info ($d['wo'] . ' ' . $d['submission']);
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
$combineData[] = $d;
}
}
}
// Store to combineData New Incentive September
foreach ($countSeptemberR as $key => $d) {
if(count($dataSeptemberR) >= 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 {
if ($d['package']== 50){
$finalprice = 69;
$total = number_format(69 * 2.5 + 50, 2);
} elseif ($d['package']== 100){
$finalprice = 89;
$total = number_format(89 * 2.5 + 50, 2);
} elseif ($d['package']== 500){
$finalprice = 129;
$total = number_format(129 * 2.5 + 50, 2);
} else{
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.5 + 50, 2);
$finalprice = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])), 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' => 'RM '.$finalprice,
'incentives1' => '250% + RM50',
'incentives2' => $d['incentives2'],
'total' => 'RM '.$total,
'claim' => $d['claim'],
));
}
}
}else if(count($dataSeptemberR) < 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 {
if ($d['package']== 50){
$finalprice = 69;
$total = number_format(69 * 2.5, 2);
} elseif ($d['package']== 100){
$finalprice = 89;
$total = number_format(89 * 2.5, 2);
} elseif ($d['package']== 500){
$finalprice = 129;
$total = number_format(129 * 2.5, 2);
} else{
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.5, 2);
$finalprice = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])), 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' => 'RM '.$finalprice,
'incentives1' => '250%',
'incentives2' => $d['incentives2'],
'total' => 'RM '.$total,
'claim' => $d['claim'],
));
}
}
}
}

foreach ($dataSeptemberB as $key => $d) {
if(date('m/Y', strtotime($d['submission'])) == $month.'/'.$year){
if(date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020'){
$countSeptemberB[] = $d;
}
}else {
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
$combineData[] = $d;
}
}
}
// Store to combineData New Incentive September
foreach ($countSeptemberB as $key => $d) {
if(count($dataSeptemberB) >= 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 {
if ($d['package']== 50){
$finalprice = 89;
$total = number_format(89 * 2.5 + 50, 2);
} elseif ($d['package']== 100){
$finalprice = 119;
$total = number_format(119 * 2.5 + 50, 2);
} elseif ($d['package']== 300){
$finalprice = 179;
$total = number_format(179 * 2.5 + 50, 2);
} elseif ($d['package']== 500){
$finalprice = 249;
$total = number_format(249 * 2.5 + 50, 2);
} else{
$total = 1500;
$finalprice = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])), 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' => 'RM '.$finalprice,
'incentives1' => '250% + RM50',
'incentives2' => '',
'total' => 'RM '.$total,
'claim' => $d['claim'],
));
}
}
}else if(count($dataSeptemberB) < 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 {
if ($d['package']== 50){
$finalprice = 89;
$total = number_format(89 * 2.5, 2);
} elseif ($d['package']== 100){
$finalprice = 119;
$total = number_format(119 * 2.5, 2);
} elseif ($d['package']== 300){
$finalprice = 179;
$total = number_format(179 * 2.5, 2);
} elseif ($d['package']== 500){
$finalprice = 249;
$total = number_format(249 * 2.5, 2);
} else{
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.5, 2);
$finalprice = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])), 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' => 'RM '.$finalprice,
'incentives1' => '250%',
'incentives2' => '',
'total' => 'RM '.$total,
'claim' => $d['claim'],
));
}
}
}
}
}else{

Loading…
Annulla
Salva