| @@ -2763,17 +2763,109 @@ class DealerController extends Controller | |||
| } | |||
| } | |||
| } | |||
| }else if($year == '2020' && ($month == '08' || $month == '09' || $month == '10')){ | |||
| $dataAugust = $this->returnDataR($company,'2020','8'); | |||
| $dataSeptember = $this->returnDataR($company,'2020','9'); | |||
| $dataOctober = $this->returnDataR($company,'2020','10'); | |||
| foreach ($dataAugust as $key => $d) { | |||
| if(date('d/m/Y', strtotime($d['activation'])) >= '12/8/2020'){ | |||
| $combineData[] = $d; | |||
| } | |||
| } | |||
| $dataR = $this->returnDataR($company,$year,$month); | |||
| foreach($dataR as $r){ | |||
| $combineData[] = $r; | |||
| } | |||
| // Store to combineData New Incentive August | |||
| foreach ($combineData as $key => $d) { | |||
| if(count($combineData) > 50){ | |||
| if(date('m/Y', strtotime($d['activation'])) == $month.'/'.$year){ | |||
| $dataB = $this->returnDataB($company,$year,$month); | |||
| 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.5 + 50, 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' => '250% + RM50', | |||
| 'incentives2' => $d['incentives2'], | |||
| 'total' => 'RM '.$total, | |||
| 'claim' => $d['claim'], | |||
| )); | |||
| } | |||
| } | |||
| foreach($dataB as $b){ | |||
| $combineData[] = $b; | |||
| }else if(count($combineData) < 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.5, 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' => '250% + RM50', | |||
| 'incentives2' => $d['incentives2'], | |||
| 'total' => 'RM '.$total, | |||
| 'claim' => $d['claim'], | |||
| )); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }else{ | |||
| $dataR = $this->returnDataR($company,$year,$month); | |||
| foreach($dataR as $r){ | |||
| $combineData[] = $r; | |||
| } | |||
| $dataB = $this->returnDataB($company,$year,$month); | |||
| foreach($dataB as $b){ | |||
| $combineData[] = $b; | |||
| } | |||
| } | |||
| $i = 0; | |||