$r) {
$ind = $num - 1;
// determine values to be considered
$room_nights = $this->days;
$room_checkin = $this->first;
$room_checkout = $this->second;
$is_split_room = false;
if (!empty($this->split_stay) && isset($this->split_stay[$ind]) && $this->split_stay[$ind]['idroom'] == $r['id']) {
$room_nights = $this->split_stay[$ind]['nights'];
$room_checkin = $this->split_stay[$ind]['checkin_ts'];
$room_checkout = $this->split_stay[$ind]['checkout_ts'];
$is_split_room = true;
}
if ($is_package === true) {
$pkg_cost = $pkg['pernight_total'] == 1 ? ($pkg['cost'] * $days) : $pkg['cost'];
$pkg_cost = $pkg['perperson'] == 1 ? ($pkg_cost * ($arrpeople[$num]['adults'] > 0 ? $arrpeople[$num]['adults'] : 1)) : $pkg_cost;
$tmpimp = VikBooking::sayPackageMinusIva($pkg_cost, $pkg['idiva']);
$tmptotdue = VikBooking::sayPackagePlusIva($pkg_cost, $pkg['idiva']);
$base_cost = $pkg_cost;
} else {
$tmpimp = VikBooking::sayCostMinusIva($tars[$num][0]['cost'], $tars[$num][0]['idprice']);
$tmptotdue = VikBooking::sayCostPlusIva($tars[$num][0]['cost'], $tars[$num][0]['idprice']);
$base_cost = $tars[$num][0]['cost'];
}
$imp += $tmpimp;
$totdue += $tmptotdue;
if ($tmptotdue == $base_cost) {
$tot_taxes += ($base_cost - $tmpimp);
} else {
$tot_taxes += ($tmptotdue - $base_cost);
}
$saywithout = $tmpimp;
$saywith = $tmptotdue;
if (isset($selopt[$num]) && is_array($selopt[$num])) {
foreach ($selopt[$num] as $selo) {
$wop .= $num . "_" . $selo['id'] . ":" . $selo['quan'] . (array_key_exists('chageintv', $selo) ? '-'.$selo['chageintv'] : '') . ";";
$realcost = (intval($selo['perday']) == 1 ? ($selo['cost'] * $room_nights * $selo['quan']) : ($selo['cost'] * $selo['quan']));
if (!empty ($selo['maxprice']) && $selo['maxprice'] > 0 && $realcost > $selo['maxprice']) {
$realcost = $selo['maxprice'];
if (intval($selo['hmany']) == 1 && intval($selo['quan']) > 1) {
$realcost = $selo['maxprice'] * $selo['quan'];
}
}
if ($selo['perperson'] == 1) {
$realcost = $realcost * $arrpeople[$num]['adults'];
}
/**
* Trigger event to allow third party plugins to apply a custom calculation for the option/extra fee or tax.
*
* @since 1.17.7 (J) - 1.7.7 (WP)
*/
$custom_calc_booking = ['days' => $room_nights];
$custom_calc_booking_room = array_merge(($arrpeople[$num] ?? []), ['room_cost' => $base_cost]);
$custom_calculation = VBOFactory::getPlatform()->getDispatcher()->filter('onCalculateBookingOptionFeeCost', [$realcost, &$selo, $custom_calc_booking, $custom_calc_booking_room]);
if ($custom_calculation) {
$realcost = (float) $custom_calculation[0];
}
$optbeforetax = VikBooking::sayOptionalsMinusIva($realcost, $selo['idiva']);
$imp += $optbeforetax;
$tmpopr = VikBooking::sayOptionalsPlusIva($realcost, $selo['idiva']);
$totdue += $tmpopr;
if ($selo['is_citytax'] == 1) {
$tot_city_taxes += $optbeforetax;
} elseif ($selo['is_fee'] == 1) {
$tot_fees += $optbeforetax;
}
// VBO 1.11 - always calculate the amount of tax no matter if this is already a tax or a fee
if ($tmpopr == $realcost) {
$tot_taxes += ($realcost - $optbeforetax);
} else {
$tot_taxes += ($tmpopr - $realcost);
}
//
}
}
?>
roomindex) && !empty($this->roomindex[($num - 1)])) {
$room_feature = VikBooking::getRoomUnitDistinctiveFeature($r['params'], $this->roomindex[($num - 1)]);
if ($room_feature !== false) {
?>
".VikBooking::getPriceAttr($tars[$num][0]['idprice'], $vbo_tn).": ".$tars[$num][0]['attrdata'] : "");
}
?>
0 ? ", ".$arrpeople[$num]['children']." ".($arrpeople[$num]['children'] == 1 ? JText::translate('VBSEARCHRESCHILD') : JText::translate('VBSEARCHRESCHILDREN')) : ""); ?>
0 && $thisoptcost > $aop['maxprice']) {
$thisoptcost = $aop['maxprice'];
if (intval($aop['hmany']) == 1 && intval($aop['quan']) > 1) {
$thisoptcost = $aop['maxprice'] * $aop['quan'];
}
}
if ($aop['perperson'] == 1) {
$thisoptcost = $thisoptcost * $arrpeople[$num]['adults'];
}
/**
* Trigger event to allow third party plugins to apply a custom calculation for the option/extra fee or tax.
*
* @since 1.17.7 (J) - 1.7.7 (WP)
*/
$custom_calc_booking = ['days' => $room_nights];
$custom_calc_booking_room = array_merge(($arrpeople[$num] ?? []), ['room_cost' => ($base_cost ?? 0)]);
$custom_calculation = VBOFactory::getPlatform()->getDispatcher()->filter('onCalculateBookingOptionFeeCost', [$thisoptcost, &$aop, $custom_calc_booking, $custom_calc_booking_room]);
if ($custom_calculation) {
$thisoptcost = (float) $custom_calculation[0];
}
$optwithout = VikBooking::sayOptionalsMinusIva($thisoptcost, $aop['idiva']);
$optwith = VikBooking::sayOptionalsPlusIva($thisoptcost, $aop['idiva']);
$opttax = ($optwith - $optwithout);
?>
1 ? " (x ".$aop['quan'].")" : ""); ?>
1 && $num < $roomsnum) {
// we no longer need a separator between the rooms containers
}
}
// store Order Total in session for modules
$session->set('vikbooking_ordertotal', $totdue);
// coupon code
$origtotdue = $totdue;
$usedcoupon = false;
if (!empty($coupon)) {
// check min tot ord
$coupontotok = true;
if (strlen((string)$coupon['mintotord'])) {
if ($totdue < $coupon['mintotord']) {
$coupontotok = false;
}
}
if ($coupon['maxtotord'] > 0 && $totdue > $coupon['maxtotord']) {
$coupontotok = false;
}
if ($coupontotok) {
$usedcoupon = true;
if ($coupon['percentot'] == 1) {
// percent value
$minuscoupon = 100 - $coupon['value'];
/**
* We allow coupon codes to be applied on the entire reservation or as always just on the total minus mandatory taxes.
*
* @since 1.13.5 (J) - 1.3.5 (WP)
* @since 1.14.3 (J) - 1.4.3 (WP) we also exclude the amount of taxes beside the mandatory fees.
* @since 1.16.0 (J) - 1.6.0 (WP) taxes are proportionally calculated when coupon before tax.
* @since 1.16.8 (J) - 1.6.8 (WP) with coupon before taxes, discounted amount calculation is an equal subtration.
*/
$prev_totdue = $totdue;
$tot_net = ($totdue - $tot_taxes - $tot_city_taxes - $tot_fees);
$couponsave = ($coupon['excludetaxes'] ? $tot_net : $totdue) * $coupon['value'] / 100;
$totdue = ($coupon['excludetaxes'] ? $tot_net : $totdue) * $minuscoupon / 100;
$tot_taxes = $coupon['excludetaxes'] ? ($tot_taxes * ($tot_net - $couponsave) / $tot_net) : ($tot_taxes * $minuscoupon / 100);
$totdue += $coupon['excludetaxes'] ? ($tot_taxes + $tot_city_taxes + $tot_fees) : 0;
$couponsave = abs($prev_totdue - $totdue);
} else {
// total value
$couponsave = $coupon['value'];
$tax_prop = $tot_taxes * $coupon['value'] / $totdue;
$tot_taxes -= $tax_prop;
$tot_taxes = $tot_taxes < 0 ? 0 : $tot_taxes;
$totdue -= $coupon['value'];
$totdue = $totdue < 0 ? 0 : $totdue;
}
} else {
if ($coupon['maxtotord'] > 0 && $totdue > $coupon['maxtotord']) {
VikError::raiseWarning('', JText::translate('VBCOUPONINVMAXTOTORD'));
} else {
VikError::raiseWarning('', JText::translate('VBCOUPONINVMINTOTORD'));
}
}
if (!$usedcoupon) {
// reset the coupon value to allow again to submit a new coupon code
$coupon = [];
}
}
// inject extra information for tracker
VikBooking::getTracker()
->setExtraInfo('total', $totdue);
?>
'com_vikbooking',
'task' => 'oconfirm',
'Itemid' => (!empty($pitemid) ? $pitemid : null),
];
$coupon_rq_vals = JFactory::getApplication()->input->getArray();
foreach ($coupon_rq_vals as $rq_key => $rq_val) {
if ($rq_key == 'couponcode' || $rq_key == 'applyacoupon') {
continue;
}
if (!isset($coupon_res_vals[$rq_key])) {
$coupon_res_vals[$rq_key] = $rq_val;
}
}
$coupon_rm_link = JRoute::rewrite('index.php?' . http_build_query($coupon_res_vals), true);
?>
mod_booking) && $this->mod_booking['total'] > 0) {
//booking modification
$modbook_tot_diff = abs($this->mod_booking['total'] - $totdue);
$modbook_diff_op = $this->mod_booking['total'] <= $totdue ? '+' : '-';
?>
mod_booking['total']), $currencysymb, ['%s', '%s']); ?>