| $pieces = explode(">", $c->ranges); | $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) { | if (strpos($c->ranges, '-') !== false) { | ||||
| $name = $customer->company_name; | $name = $customer->company_name; | ||||
| } | } | ||||
| $total = ''; | |||||
| if ($commV24 == '') { | |||||
| $total = $addRM24; | |||||
| } else { | |||||
| $total = number_format(($d['retail_price'] * $commV24) + floatval($addRM24), 2); | |||||
| } | |||||
| $final[] = array( | $final[] = array( | ||||
| 'index' => $d['formT'], | 'index' => $d['formT'], | ||||
| 'contract' => $d['contract'], | 'contract' => $d['contract'], | ||||
| 'package' => $d['package'], | 'package' => $d['package'], | ||||
| 'retail_price' => 'RM ' . $d['retail_price'], | 'retail_price' => 'RM ' . $d['retail_price'], | ||||
| 'incentives1' => $comm24, | 'incentives1' => $comm24, | ||||
| 'incentives2' => '', | |||||
| 'total' => 'RM ' . number_format($d['retail_price'] * $commV24, 2), | |||||
| 'incentives2' => $addRM24, | |||||
| 'total' => $total, | |||||
| 'claim' => $d['claim_dt'], | 'claim' => $d['claim_dt'], | ||||
| ); | ); | ||||
| } | } |