Browse Source

edit calculation for claim August

ifah
Siti Hajar Ibrahim 5 years ago
parent
commit
cd1c921c22
1 changed files with 44 additions and 60 deletions
  1. 44
    60
      app/Http/Controllers/DS/DealerController.php

+ 44
- 60
app/Http/Controllers/DS/DealerController.php View File



foreach ($dataAugustR as $key => $d) { foreach ($dataAugustR as $key => $d) {
if((date('m/Y', strtotime($d['submission'])) == $month.'/'.$year) && date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020'){ if((date('m/Y', strtotime($d['submission'])) == $month.'/'.$year) && date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020'){
$countAugustR[] = $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'){
$countAugustR[] = $d;
}
}else { }else {
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
if(date('d/m/Y', strtotime($d['activation'])) >= '11/8/2020'){
$countAugustR[] = $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'],


foreach ($dataAugustB as $key => $d) { foreach ($dataAugustB as $key => $d) {
if((date('m/Y', strtotime($d['submission'])) == $month.'/'.$year) && date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020'){ if((date('m/Y', strtotime($d['submission'])) == $month.'/'.$year) && date('d/m/Y', strtotime($d['submission'])) >= '11/8/2020'){
$countAugustB[] = $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'){
$countAugustR[] = $d;
}
}else { }else {
if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){
if(date('d/m/Y', strtotime($d['activation'])) >= '11/8/2020'){
$countAugustR[] = $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