Browse Source

calculate dealer Sept

ifah
Siti Hajar Ibrahim 5 years ago
parent
commit
20978395e0
1 changed files with 45 additions and 62 deletions
  1. 45
    62
      app/Http/Controllers/DS/DealerController.php

+ 45
- 62
app/Http/Controllers/DS/DealerController.php View File



foreach ($dataSeptemberR as $key => $d) { foreach ($dataSeptemberR as $key => $d) {
if(((date('m/Y', strtotime($d['submission'])) == '08/2020') && (date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020')) || (date('m/Y', strtotime($d['submission'])) == $month.'/'.$year)){ if(((date('m/Y', strtotime($d['submission'])) == '08/2020') && (date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020')) || (date('m/Y', strtotime($d['submission'])) == $month.'/'.$year)){
info($d['submission']);
$countSeptemberR[] = $d;
if($d['contract'] == '24'){
if ($d['package']== 50){
$d['retail_price'] = 69;
} elseif ($d['package']== 100){
$d['retail_price'] = 89;
} elseif ($d['package']== 500){
$d['retail_price'] = 129;
}
}

if(date('d/m/Y', strtotime($d['activation'])) >= '11/8/2020'){
$countSeptemberR[] = $d;
}
}else { }else {
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
if(date('d/m/Y', strtotime($d['activation'])) >= '11/8/2020'){
$countSeptemberR[] = $d;
}else {
$combineData[] = $d; $combineData[] = $d;
} }
} }
)); ));


}else { }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);
}
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.5 + 50, 2);
array_push($combineData, array( array_push($combineData, array(
'index' => $d['index'], 'index' => $d['index'],
'contract' => $d['contract'], 'contract' => $d['contract'],
'name' => $d['name'], 'name' => $d['name'],
'address' => $d['address'], 'address' => $d['address'],
'package' => $d['package'], 'package' => $d['package'],
'retail_price' => 'RM '.$finalprice,
'retail_price' => $d['retail_price'],
'incentives1' => '250% + RM50', 'incentives1' => '250% + RM50',
'incentives2' => $d['incentives2'], 'incentives2' => $d['incentives2'],
'total' => 'RM '.$total, 'total' => 'RM '.$total,
'claim' => $d['claim'], 'claim' => $d['claim'],
)); ));
}else { }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);
}
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.5, 2);
array_push($combineData, array( array_push($combineData, array(
'index' => $d['index'], 'index' => $d['index'],
'contract' => $d['contract'], 'contract' => $d['contract'],
'name' => $d['name'], 'name' => $d['name'],
'address' => $d['address'], 'address' => $d['address'],
'package' => $d['package'], 'package' => $d['package'],
'retail_price' => 'RM '.$finalprice,
'retail_price' => $d['retail_price'],
'incentives1' => '250%', 'incentives1' => '250%',
'incentives2' => $d['incentives2'], 'incentives2' => $d['incentives2'],
'total' => 'RM '.$total, 'total' => 'RM '.$total,


foreach ($dataSeptemberB as $key => $d) { foreach ($dataSeptemberB as $key => $d) {
if(((date('m/Y', strtotime($d['submission'])) == '08/2020') && (date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020')) || (date('m/Y', strtotime($d['submission'])) == $month.'/'.$year)){ if(((date('m/Y', strtotime($d['submission'])) == '08/2020') && (date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020')) || (date('m/Y', strtotime($d['submission'])) == $month.'/'.$year)){
$countSeptemberB[] = $d;
if($d['contract'] == '24'){
if ($d['package']== 50){
$d['retail_price'] = 89;
} elseif ($d['package']== 100){
$d['retail_price'] = 119;
} elseif ($d['package']== 300){
$d['retail_price'] = 179;
} elseif ($d['package']== 500){
$d['retail_price'] = 249;
}
}

if(date('d/m/Y', strtotime($d['activation'])) >= '11/8/2020'){
$countSeptemberB[] = $d;
}
}else { }else {
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
if(date('d/m/Y', strtotime($d['activation'])) >= '11/8/2020'){
$countSeptemberB[] = $d;
}else {
$combineData[] = $d; $combineData[] = $d;
} }
} }
)); ));


}else { }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{
if ($d['package']== 1){
$total = 1500; $total = 1500;
$finalprice = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])), 2);
} else{
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.5 + 50, 2);
} }
array_push($combineData, array( array_push($combineData, array(
'index' => $d['index'], 'index' => $d['index'],
'name' => $d['name'], 'name' => $d['name'],
'address' => $d['address'], 'address' => $d['address'],
'package' => $d['package'], 'package' => $d['package'],
'retail_price' => 'RM '.$finalprice,
'retail_price' => $d['retail_price'],
'incentives1' => '250% + RM50', 'incentives1' => '250% + RM50',
'incentives2' => '', 'incentives2' => '',
'total' => 'RM '.$total, 'total' => 'RM '.$total,
'claim' => $d['claim'], 'claim' => $d['claim'],
)); ));
}else { }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);
if ($d['package']== 1){
$total = 1500;
} else{ } else{
$total = number_format(floatval(str_replace("RM ", "" , $d['retail_price'])) * 2.5, 2); $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( array_push($combineData, array(
'index' => $d['index'], 'index' => $d['index'],
'name' => $d['name'], 'name' => $d['name'],
'address' => $d['address'], 'address' => $d['address'],
'package' => $d['package'], 'package' => $d['package'],
'retail_price' => 'RM '.$finalprice,
'retail_price' => $d['retail_price'],
'incentives1' => '250%', 'incentives1' => '250%',
'incentives2' => '', 'incentives2' => '',
'total' => 'RM '.$total, 'total' => 'RM '.$total,

Loading…
Cancel
Save