| @@ -979,9 +979,23 @@ class DealerController extends Controller | |||
| $pieces = explode(">", $c->ranges); | |||
| if ($countD24 > intval($pieces[1])) { | |||
| $commV24 = floatval($c->comm) / 100; | |||
| $comm24 = $c->comm . '%'; | |||
| if ($countD24 >= intval($pieces[1])) { | |||
| if (strpos($c->comm, 'RM') !== false) { | |||
| $comm24 = '+ ' . $c->comm; | |||
| $commV24 = ''; | |||
| $addRM24 = $c->comm; | |||
| } else { | |||
| $comms = explode("RM", $c->comm); | |||
| if (!empty($comms[1])) { | |||
| $comm24 = 'RM ' . $comms[1]; | |||
| $commV24 = floatval($comms[1]); | |||
| } else { | |||
| if ($comms[0] != '') { | |||
| $comm24 = $comms[0] . '%'; | |||
| $commV24 = floatval($comms[0]) / 100; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| if (strpos($c->ranges, '-') !== false) { | |||
| @@ -1071,6 +1085,13 @@ class DealerController extends Controller | |||
| $name = $customer->company_name; | |||
| } | |||
| $total = ''; | |||
| if ($commV24 == '') { | |||
| $total = $addRM24; | |||
| } else { | |||
| $total = number_format(($d['retail_price'] * $commV24) + floatval($addRM24), 2); | |||
| } | |||
| $final[] = array( | |||
| 'index' => $d['formT'], | |||
| 'contract' => $d['contract'], | |||
| @@ -1082,8 +1103,8 @@ class DealerController extends Controller | |||
| 'package' => $d['package'], | |||
| 'retail_price' => 'RM ' . $d['retail_price'], | |||
| 'incentives1' => $comm24, | |||
| 'incentives2' => '', | |||
| 'total' => 'RM ' . number_format($d['retail_price'] * $commV24, 2), | |||
| 'incentives2' => $addRM24, | |||
| 'total' => $total, | |||
| 'claim' => $d['claim_dt'], | |||
| ); | |||
| } | |||