public function convertSingleToArray($data) { $tableInfo = Utility::getTableInfo($data->getTableid()); $config = Utility::getConfig(); $code = ''; $value = ''; $desc = ''; if ($data->getCouponId() != -1) { $coupon = Utility::getCouponInfo($data->getCouponId()); // echo '<pre>'; // print_r($coupon); // echo '</pre>'; $code = $coupon->getCode(); if ($coupon->getReuse() == 1) { $code = $coupon->getDescription(); } $type = $coupon->getType(); if ($type == 0) { $value = 'Reduce :' . number_format($coupon->getValue()) . ' ' . $config['currency']; } else { $value = 'Reduce :' . $coupon->getValue() . '%'; } $desc = $coupon->getDescription(); } $userInfo = Utility::getUserInfo($data->getUserId()); $surtax = Utility::getSurTaxInfo($data->getSurtaxId()); if ($surtax) { $surtaxType = $surtax->getType(); $surtaxValue = $surtax->getValue(); } else { $surtaxType = 'Cash'; $surtaxValue = 0; } $taxType = Utility::convertSurtaxType($surtaxType); //print_r($coupon); $array = array(); $array['id'] = $data->getId(); $array['tableId'] = $tableInfo->getName(); $array['createDate'] = date('d/m/Y h:i:s', $data->getCreateDate()); $array['totalCost'] = number_format($data->getTotalCost()); $array['totalRealCost'] = number_format($data->getTotalRealCost()); $array['coupon'] = $code; $array['couponValue'] = $value; $array['couponDesc'] = $desc; $array['surtax'] = number_format($surtaxValue) . ' ' . $taxType; $array['userid'] = $userInfo->getUserName(); $array['status'] = $data->getStatus(); $array['customer_id'] = $data->getCustomerId(); $array['newDate'] = $data->getNewDate(); return $array; }