ordersrooms; $ord = $this->ord; $all_rooms = $this->all_rooms; $customer = $this->customer; $dbo = JFactory::getDbo(); $vbo_app = VikBooking::getVboApplication(); $vbo_app->loadSelect2(); $vbo_app->loadDatePicker(); // availability helper $av_helper = VikBooking::getAvailabilityInstance(); // room stay dates in case of split stay (or modified room nights) $room_stay_dates = []; $js_cal_def_vals = []; $room_stay_records = []; if ($ord['split_stay']) { if ($ord['status'] == 'confirmed') { $room_stay_dates = $av_helper->loadSplitStayBusyRecords($ord['id']); } else { $room_stay_dates = VBOFactory::getConfig()->getArray('split_stay_' . $ord['id'], []); } // immediately count the number of nights of stay for each split room foreach ($room_stay_dates as $sps_r_k => $sps_r_v) { if (!empty($sps_r_v['checkin_ts']) && !empty($sps_r_v['checkout_ts'])) { // overwrite values for compatibility with non-confirmed bookings $sps_r_v['checkin'] = $sps_r_v['checkin_ts']; $sps_r_v['checkout'] = $sps_r_v['checkout_ts']; } $sps_r_v['nights'] = $av_helper->countNightsOfStay($sps_r_v['checkin'], $sps_r_v['checkout']); // overwrite the whole array $room_stay_dates[$sps_r_k] = $sps_r_v; } } elseif (!$ord['split_stay'] && !$ord['closure'] && $ord['roomsnum'] > 1 && $ord['days'] > 1 && $ord['status'] == 'confirmed') { // load the occupied stay dates for each room in case they were modified $room_stay_records = $av_helper->loadSplitStayBusyRecords($ord['id']); } $pgoto = VikRequest::getString('goto', '', 'request'); $currencysymb = VikBooking::getCurrencySymb(true); $nowdf = VikBooking::getDateFormat(true); if ($nowdf == "%d/%m/%Y") { $rit = date('d/m/Y', $ord['checkin']); $con = date('d/m/Y', $ord['checkout']); $df = 'd/m/Y'; $juidf = 'dd/mm/yy'; } elseif ($nowdf == "%m/%d/%Y") { $rit = date('m/d/Y', $ord['checkin']); $con = date('m/d/Y', $ord['checkout']); $df = 'm/d/Y'; $juidf = 'mm/dd/yy'; } else { $rit = date('Y/m/d', $ord['checkin']); $con = date('Y/m/d', $ord['checkout']); $df = 'Y/m/d'; $juidf = 'yy/mm/dd'; } $datesep = VikBooking::getDateSeparator(true); // stay dates details $checkin_info = getdate($ord['checkin']); $checkout_info = getdate($ord['checkout']); $ritho = ''; $conho = ''; $ritmi = ''; $conmi = ''; for ($i = 0; $i < 24; $i++) { $ritho .= "\n"; $conho .= "\n"; } for ($i = 0; $i < 60; $i++) { $ritmi .= "\n"; $conmi .= "\n"; } if (is_array($ord)) { $pcheckin = $ord['checkin']; $pcheckout = $ord['checkout']; $secdiff = $pcheckout - $pcheckin; $daysdiff = $secdiff / 86400; if (is_int($daysdiff)) { if ($daysdiff < 1) { $daysdiff = 1; } } else { if ($daysdiff < 1) { $daysdiff = 1; } else { $sum = floor($daysdiff) * 86400; $newdiff = $secdiff - $sum; $maxhmore = VikBooking::getHoursMoreRb() * 3600; if ($maxhmore >= $newdiff) { $daysdiff = floor($daysdiff); } else { $daysdiff = ceil($daysdiff); } } } } $otachannel = ''; $otachannel_name = ''; $otachannel_bid = ''; $otacurrency = ''; if (!empty($ord['channel'])) { $channelparts = explode('_', $ord['channel']); $otachannel = array_key_exists(1, $channelparts) && strlen($channelparts[1]) > 0 ? $channelparts[1] : ucwords($channelparts[0]); $otachannel_name = $otachannel; $otachannel_bid = $otachannel.(!empty($ord['idorderota']) ? ' - Booking ID: '.$ord['idorderota'] : ''); if (strstr($otachannel, '.') !== false) { $otaccparts = explode('.', $otachannel); $otachannel = $otaccparts[0]; } $otacurrency = !empty($ord['chcurrency']) ? $ord['chcurrency'] : ''; } $status_type = ''; if (!empty($ord['type'])) { $status_type = JText::translate('VBO_BTYPE_' . strtoupper($ord['type'])); if (!strcasecmp($ord['type'], 'overbooking')) { $status_type = '' . $status_type . ''; } $status_type .= ' / '; } if ($ord['status'] == "confirmed") { $saystaus = '' . $status_type . JText::translate('VBCONFIRMED') . ''; } elseif ($ord['status']=="standby") { $saystaus = '' . $status_type . JText::translate('VBSTANDBY') . ''; } else { $saystaus = '' . $status_type . JText::translate('VBCANCELLED') . ''; } //Package or custom rate $is_package = !empty($ord['pkg']) ? true : false; $is_cust_cost = false; foreach ($ordersrooms as $kor => $or) { if ($is_package !== true && !empty($or['cust_cost']) && $or['cust_cost'] > 0.00) { $is_cust_cost = true; break; } } $ivas = array(); $wiva = ""; $jstaxopts = ''; $q = "SELECT * FROM `#__vikbooking_iva`;"; $dbo->setQuery($q); $dbo->execute(); if ($dbo->getNumRows() > 0) { $ivas = $dbo->loadAssocList(); $wiva = "\n"; } // room switching $switching = false; $switcher = ''; if (is_array($ord) && count($all_rooms) > 1 && (!empty($ordersrooms[0]['idtar']) || $is_package || $is_cust_cost)) { $switching = true; $occ_rooms = array(); foreach ($all_rooms as $r) { $rkey = $r['fromadult'] < $r['toadult'] ? $r['fromadult'].' - '.$r['toadult'] : $r['toadult']; $occ_rooms[$rkey][] = $r; } $switcher = ''."\n"; } $canDo = JFactory::getUser(); JText::script('VBPEDITBUSYEXTRACOSTS'); JText::script('VBDASHBOOKINGID'); JText::script('VBPVIEWORDERSONE'); JText::script('VBEDITORDERTHREE'); JText::script('VBDAYS'); JText::script('VBEDITORDERADULTS'); JText::script('VBEDITORDERCHILDREN'); JText::script('VBPEDITBUSYADDEXTRAC'); JText::script('VBO_CONF_RM_OVERBOOKING_FLAG'); ?>