function getpriceJsonAction() { $unitIDs = $this->_getParam('ids'); $start_datetime = $this->_getParam('start_datetime'); $end_datetime = $this->_getParam('end_datetime'); $adults = $this->_getParam("adults", 1); $children = $this->_getParam("children", 0); $infants = $this->_getParam("infants", 0); $persons = new RM_Reservation_Persons(array("adults" => $adults, "children" => $children, "infants" => $infants)); $unitsDAO = new RM_Units(); $stardateObj = new RM_Date(strtotime($start_datetime)); $enddateObj = new RM_Date(strtotime($end_datetime)); $periodObj = new RM_Reservation_Period($stardateObj, $enddateObj); $priceSystem = RM_Environment::getInstance()->getPriceSystem(); $units = explode(",", $unitIDs); $taxSystem = RM_Environment::getInstance()->getTaxSystem(); $tax = 0; foreach ($units as $uid) { $unitObj = $unitsDAO->get($uid); $information = new RM_Prices_Information($unitObj, $periodObj, $persons); try { $subtotal = $subtotal + $priceSystem->getTotalUnitPrice($information); } catch (Exception $e) { // no return needed } $tax += $taxSystem->calculateTotalTax($unitObj, $subtotal); } // get currency symbol $config = new RM_Config(); $currency_symbol = $config->get('rm_config_currency_symbol'); // calculate the total $total = $subtotal + $tax; return array('data' => '{ data: [{ info: "Subtotal", value: "' . $currency_symbol['rm_config_currency_symbol'] . ' ' . $subtotal . '" },{ info: "Tax", value: "' . $currency_symbol['rm_config_currency_symbol'] . ' ' . $tax . '" },{ info: "Total", value: "' . $currency_symbol['rm_config_currency_symbol'] . ' ' . $total . '" }] }', 'encoded' => true); }
public function getConfigValues() { // config values to be exposed to js $filter = ' rm_config_admin_help_panel_enable, rm_config_calendar_startday, rm_config_dateformat '; $config = new RM_Config(); $configValues = $config->get($filter); $configResult = array(); foreach ($configValues as $index => $value) { $configResult[] = "'" . $index . "':'" . $value . "'"; } return "RM.Config={" . implode(',', $configResult) . "}"; }