| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/application/controllers/ |
Upload File : |
<?php
/**
* Class Hotel
*
* @name Buy List Hotel
* @author Harpreet
* @version 1.0
* @copyright Catabatic India Pvt Ltd
* Handle Hotel Related function
*
*/
class BookinghotelController extends Catabatic_ValidateGtx {
private $intLoggedinUserId = '';
private $intLoggedinUserGroupSysId = '';
private $intLoggedinUserAgencySysId = '';
private $intLoggedinUserTrxCurrency = '';
private $InfoSourceSysId = '';
public $baseUrl = '';
public $url = 'http://api.tektravels.com/SharedServices/SharedData.svc/rest/Authenticate';
public $urlHotel = 'http://api.tektravels.com/BookingEngineService_Hotel/hotelservice.svc/rest/GetHotelResult/';
public $userIp = '180.151.8.18';
public $user = "tripshows";
public $pass = "tripshows@123";
public $clientID = 'apiintegration';
public function init() {
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
$this->_crmcusttravelplan = new Travel_Model_CRM_CustomerTravelPlan();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$this->intLoggedinUserId = $sessionLogin_user->intLoggedinUserId;
$this->intLoggedinUserGroupSysId = $sessionLogin_user->intLoggedinUserGroupSysId;
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
$this->intLoggedinUserTrxCurrency = $sessionLogin_user->intLoggedinUserTrxCurrency;
if (!empty($this->intLoggedinUserAgencySysId)) {
$this->InfoSourceSysId = '2'; /* Information Source is Agent */
}
if (empty($this->intLoggedinUserId)) {
$this->_redirect('/login/');
}
}
// Added By Pardeep Panchal...
public function indexAction() {
$objBuyHotel = new Travel_Model_TblBuyHotel();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$ReportingToSysId = $sessionLogin_user->ReportingToSysId;
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$this->view->searchArr = $this->searchArr = $getData;
$objBuyHotel->strCondition = "";
$this->view->proposalId = $proposalId = isset($getData['proposalId']) ? trim($getData['proposalId']) : '';
$this->view->customername = $customername = isset($getData['customername']) ? trim($getData['customername']) : '';
$this->view->customermobile = $customermobile = isset($getData['customermobile']) ? trim($getData['customermobile']) : '';
$this->view->customeremail = $customeremail = isset($getData['customeremail']) ? trim($getData['customeremail']) : '';
$this->view->strHotelName = $strHotelName = trim($getData['hotel_name']);
$this->view->destination = $destination = trim($getData['destination']);
$this->view->destinationId = $destinationId = trim($getData['destinationId']);
$this->view->strCheckInDate = $strCheckInDate = trim($getData['checkIn_date']);
$this->view->intBookingStatus = $intBookingStatus = trim($getData['booking_status']);
$objBuyHotel->strCondition .= " 1=1 ";
if (!empty($strHotelName)) {
$objBuyHotel->strCondition .= " AND TPA.Title LIKE '%" . $strHotelName . "%'";
}
if (!empty($proposalId)) {
$objBuyHotel->strCondition .= " AND TP.TPSysId = " . (int) $proposalId;
}
if (!empty($destination)) {
$destinationStr = explode('(', $destination);
$destination = trim($destinationStr[0]);
$objBuyHotel->strCondition .= " AND TP.Cities LIKE '%" . $destination . "%'";
}
if (isset($this->searchArr['customername']) && !empty($this->searchArr['customername'])) {
$objBuyHotel->strCondition .= " AND (TAC.FirstName LIKE '%" . $this->searchArr['customername'] . "%' OR TAC.LastName LIKE '%" . $this->searchArr['customername'] . "%')";
}
if (isset($this->searchArr['customermobile']) && !empty($this->searchArr['customermobile'])) {
$objBuyHotel->strCondition .= " AND TAC.Contacts = '" . $this->searchArr['customermobile'] . "'";
}
if (isset($this->searchArr['customeremail']) && !empty($this->searchArr['customeremail'])) {
$objBuyHotel->strCondition .= " AND TAC.EmailId = '" . $this->searchArr['customeremail'] . "'";
}
// if (!empty($strBookingDate)) {
// $strBookingDate = date("Y-m-d", strtotime($strBookingDate));
// $objBuyHotel->strCondition .= " AND SUBSTRING(convert(varchar, TRX.TrxDate, 120),0,11) = '" . $strBookingDate . "'";
// }
if (!empty($strCheckInDate)) {
$strCheckInDate = date("Y-m-d", strtotime($strCheckInDate));
$objBuyHotel->strCondition .= " AND CONVERT(date, TPA.FromDate) = '" . $strCheckInDate . "'";
}
if (!empty($intBookingStatus)) {
$objBuyHotel->strCondition .= " AND TP.StatusType = '" . $intBookingStatus . "'";
}
}
$this->view->source = $source = $this->_getParam('filter', 'today');
switch ($source) {
case 'overall': {
$currentDate = date("Y-m-d");
$fromDate = '2016-10-26';
break;
}
case 'last-month': {
$fromDate = date('Y-m-d', strtotime('first day of last month'));
$currentDate = date('Y-m-d', strtotime('last day of last month'));
break;
}
case 'current-month': {
$currentDate = date("Y-m-d");
$currentMonth = date("m");
$currentYear = date("Y");
$fromDate = "$currentYear-$currentMonth-01";
break;
}
case 'last-week': {
$previous_week = strtotime("-1 week +1 day");
$start_week = strtotime("last sunday midnight", $previous_week);
$end_week = strtotime("next saturday", $start_week);
$start_week = date("Y-m-d", $start_week);
$end_week = date("Y-m-d", $end_week);
$fromDate = $start_week;
$currentDate = $end_week;
break;
}
case 'current-week': {
$currentDate = date("Y-m-d");
if (date('D') != 'Mon') {
$fromDate = date('Y-m-d', strtotime('last Monday'));
} else {
$fromDate = date('Y-m-d');
}
break;
}
case 'yesterday': {
$yesterday = date("Y-m-d", strtotime("-1 day"));
$fromDate = $currentDate = $yesterday;
break;
}
case 'today': {
$currentDate = date("Y-m-d");
$fromDate = date("Y-m-d");
break;
}
default: {
$currentDate = date("Y-m-d");
$fromDate = date("Y-m-d");
break;
}
}
$getData = array();
$this->view->from_date = $from_date = $this->_request->getParam('from_date', NULL);
$this->view->to_date = $to_date = $this->_request->getParam('to_date', NULL);
if ($from_date != NULL && $to_date != NULL) {
$getData = array(
'currentDate' => $to_date,
'fromDate' => $from_date
);
$objBuyHotel->strCondition1 = $getData;
} else {
$getData = array(
'currentDate' => $currentDate,
'fromDate' => $fromDate
);
$objBuyHotel->strCondition1 = $getData;
}
if ($sessionLogin_user->IsSuperAdmin == True || $sessionLogin_user->IsAdmin == True) {
$arrHotelBookingList = $objBuyHotel->getHotelBookingList();
} else {
$arrHotelBookingList = $objBuyHotel->getHotelBookingList($ReportingToSysId);
}
if ($sessionLogin_user->IsSuperAdmin == True || $sessionLogin_user->IsAdmin == True) {
$arrOnlyHotelBookingList = $objBuyHotel->getOnlyHotelPackageBookingList();
} else {
$arrOnlyHotelBookingList = $objBuyHotel->getOnlyHotelPackageBookingList($ReportingToSysId);
}
$arrOnlyHotelBookingListArr = array();
foreach ($arrHotelBookingList as $hKey1 => $hVal1) {
$APIBookingRes = json_decode($hVal1['APIBookingRes'], 1);
$hotelname = isset($hVal1['hotelName']) ? $hVal1['hotelName'] : (isset($APIBookingRes['hotelname']) ? $APIBookingRes['hotelname'] : '');
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']] = $hVal1;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['hotelName'] = $hotelname;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['Title'] = isset($hVal1['cityTitle']) ? $hVal1['cityTitle'] : '';
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['NetCost'] = isset($hVal1['NetCost']) ? $hVal1['NetCost'] : 0;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['isOnlyHotelPackage'] = 0;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['TotalAmountPaid'] = isset($hVal1['PaidAmount']) ? $hVal1['PaidAmount'] : 0;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['IsFromAPI'] = isset($hVal1['IsFromAPI']) ? $hVal1['IsFromAPI'] : 0;
// echo "<pre>";
// print_r($APIBookingRes);
}
// die;
$checkHotelName = array();
foreach ($arrOnlyHotelBookingList as $hKey => $hVal) {
if (!empty($hVal['FromDate'])) {
$checkHotelName[$hVal['TPSysId']][] = (isset($hVal['hotelName']) && trim($hVal['hotelName']) != '') ? ($hVal['hotelName']) : trim($hVal['Title']);
$arrOnlyHotelBookingListArr[$hVal['TPSysId']] = $hVal;
$arrOnlyHotelBookingListArr[$hVal['TPSysId']]['hotelName'] = implode(',<br>', array_unique($checkHotelName[$hVal['TPSysId']]));
$arrOnlyHotelBookingListArr[$hVal['TPSysId']]['Title'] = $hVal['cityTitle'];
$arrOnlyHotelBookingListArr[$hVal['TPSysId']]['NetCost'] = $hVal['NetPrice'];
$arrOnlyHotelBookingListArr[$hVal['TPSysId']]['isOnlyHotelPackage'] = 1;
$objPkgBooking = new Travel_Model_TblPackageBooking();
$amountPaid = $objPkgBooking->getAmountPaidForProposalByTPSysId($hVal['TPSysId']);
$arrOnlyHotelBookingListArr[$hVal['TPSysId']]['TotalAmountPaid'] = $amountPaid['TotalAmountPaid'];
$arrOnlyHotelBookingListArr[$hVal['TPSysId']]['IsFromAPI'] = $hVal['IsFromAPI'];
}
}
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($arrOnlyHotelBookingListArr);
$paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
$paginator->setCurrentPageNumber($page);
$this->view->controller = $this;
$this->view->arrHotelBookingList = $paginator;
$this->view->messages = $this->_helper->flashMessenger->getMessages();
$TblCurrency = new Travel_Model_TblCurrency();
$this->view->CurrencySymbol = $CurrencySymbol = $TblCurrency->getCurrencySymbolByIdsList();
}
public function viewHotelBookingAction() {
//$intCustomerSysId = base64_decode($this->getRequest()->getParam("cid"));
$intTPSysId = base64_decode($this->getRequest()->getParam("tid"));
$objBuyHotel = new Travel_Model_TblBuyHotel();
$arrHotelBookingDetails = $objBuyHotel->viewHotelBookingDetails($intTPSysId);
$this->view->arrHotelBookingDetails = $arrHotelBookingDetails;
$intCustomerSysId = $arrHotelBookingDetails[0]['CustomerSysId'];
if (!empty($intCustomerSysId)) {
$arrTrevllerDetails = $objBuyHotel->GetAgencyCustomerDetailsForBooking($intCustomerSysId, $intTPSysId);
//echo "<pre>";print_r($arrHotelBookingDetails);
$this->view->arrTrevllerDetails = $arrTrevllerDetails;
}
}
public function viewAndCancelHotelBookingAction() {
//print_r($_REQUEST);
if (!$this->getRequest()->isXmlHttpRequest()) {
$intTPSysId = base64_decode($this->getRequest()->getParam("tid"));
$objBuyHotel = new Travel_Model_TblBuyHotel();
$arrHotelBookingDetails = $objBuyHotel->viewHotelBookingDetails($intTPSysId);
$intSupplierSysId = $this->view->intSupplierSysId = $arrHotelBookingDetails[0]['SupplierSysId'];
$intTotalAmount = $arrHotelBookingDetails[0]['NetCost'];
// $intAgentMarkUpAmount = $arrHotelBookingDetails[0]['additionalMarkUp'];
// $intAgencyMarkUpAmount = $arrHotelBookingDetails[0]['AgencyMarkUp'];
// $intGTXMarkUpAmount = $arrHotelBookingDetails[0]['GTXMarkup'];
// $intTax = $arrHotelBookingDetails[0]['Taxes'];
//
// $intXServiceTaxAmount = $arrHotelBookingDetails[0]['XServiceTaxAmount'];
// $intGTXServiceTaxAmount = $arrHotelBookingDetails[0]['GTXServiceTaxAmount'];
// $intAgentServiceTaxAmount = $arrHotelBookingDetails[0]['AgentServiceTaxAmount'];
// $intAgentsCustomServiceTaxAmount = $arrHotelBookingDetails[0]['AgentsCustomServiceTaxAmount'];
$strXRefBookingId = $arrHotelBookingDetails[0]['XRefBookingId'];
$arrXRefBookingId = explode("/", $strXRefBookingId);
$strBookingId = $arrXRefBookingId[0];
$strBookingRef = $arrXRefBookingId[1];
$arrBookingResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Hotel")->getHotelBookingDetails($strBookingId, $strBookingRef, $intSupplierSysId);
//echo "<pre>"; print_r($arrBookingResponse);
if ($intSupplierSysId == '4') {
$this->view->arrCancellationPolicy = $arrCancellationPolicy = isset($arrBookingResponse['hotel']['booking_items'][0]['cancellation_policy']) ? $arrBookingResponse['hotel']['booking_items'][0]['cancellation_policy'] : array();
} else if ($intSupplierSysId == '3') {
$this->view->arrCancellationPolicy = $arrCancellationPolicy = isset($arrBookingResponse['GetBookingDetailResult']['HotelRoomsDetails'][0]['CancellationPolicies']) ? $arrBookingResponse['GetBookingDetailResult']['HotelRoomsDetails'][0]['CancellationPolicies'] : array();
}
$this->view->arrHotelBookingDetails = $arrHotelBookingDetails;
$this->view->intCustomerSysId = $intCustomerSysId = $arrHotelBookingDetails[0]['CustomerSysId'];
if (!empty($intCustomerSysId)) {
$arrTrevllerDetails = $objBuyHotel->GetAgencyCustomerDetailsForBooking($intCustomerSysId, $intTPSysId);
//echo "<pre>";print_r($arrTrevllerDetails);
$this->view->arrTrevllerDetails = $arrTrevllerDetails;
}
}
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$requestType = $this->getRequest()->getParam("requestType");
$intCustomerSysId = $this->getRequest()->getParam("cid");
$intTPSysId = $this->getRequest()->getParam("tid");
if (!empty($requestType) && $requestType == "cancelBooking") {
$strCancelRemarks = $this->getRequest()->getParam("cRemarks");
if (empty($strCancelRemarks)) {
$response = array('success' => false, 'msg' => 'Please enter cancellation comments.');
echo json_encode($response);
exit;
}
$objBuyHotel = new Travel_Model_TblBuyHotel();
$res = $objBuyHotel->viewHotelBookingDetails($intTPSysId);
$TPIntSysId = !empty($res[0]['TPIntSysId']) ? $res[0]['TPIntSysId'] : '';
//echo "<pre>";print_r($res);exit;
$strXRefBookingId = !empty($res[0]['XRefBookingId']) ? $res[0]['XRefBookingId'] : '';
$intSourceSysId = !empty($res[0]['SupplierSysId']) ? $res[0]['SupplierSysId'] : '';
if (!empty($res)) {
if (!empty($intSourceSysId) && $intSourceSysId == 3) {
$API_SOURCE_ID = 3;
} else if (!empty($intSourceSysId) && $intSourceSysId == 4) {
$API_SOURCE_ID = 4;
}
if (!empty($strXRefBookingId)) {
$data = array(
"API_SOURCE_ID" => $API_SOURCE_ID,
"BOOKING_REFERENCE_ID" => $strXRefBookingId,
"CANCELLATION_REMARKS" => $strCancelRemarks
);
//echo "<pre>"; print_r($data); exit;
$cancellationResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Hotel")->cancelHotelBooking($data);
//echo "<pre>"; print_r($cancellationResponse); exit;
if ($API_SOURCE_ID == 4) {
$strStatus = @$cancellationResponse['status'];
$strErrors = @$cancellationResponse['errors'];
$strErrorsCode = @$cancellationResponse['errors'][0]['code'];
if ($strStatus == "confirmed") {
$data = array(
"XRefCancellationlId" => isset($cancellationResponse['cancellation_reference']) ? $cancellationResponse['cancellation_reference'] : '',
"APICancellationRes" => json_encode($cancellationResponse)
);
$objBuyHotel->updateCancellationResponse($data, $TPIntSysId);
$data = array(
"StatusType" => "10"
);
$objBuyHotel->updateBookingStatus($data, $intTPSysId);
$strCancellationReference = $cancellationResponse['cancellation_reference'];
$strCancellationCurrency = $cancellationResponse['cancellation_charges']['currency'];
$strCancellationBookingAmount = $cancellationResponse['cancellation_charges']['amount'];
$strCancelDate = $cancellationResponse['cancel_date'];
$strBookingCurrency = $cancellationResponse['booking_price']['currency'];
$strBookingAmount = $cancellationResponse['booking_price']['amount'];
$arrCancellationResponse = array(
'strCancellationReference' => $strCancellationReference,
'strCancellationCurrency' => $strCancellationCurrency,
'strCancellationBookingAmount' => $strCancellationBookingAmount,
'strCancelDate' => $strCancelDate,
'strBookingCurrency' => $strBookingCurrency,
'strBookingAmount' => $strBookingAmount
);
$strCancellationResponse = base64_encode(json_encode($arrCancellationResponse));
$response = array('success' => true, 'msg' => 'Your booking has been cancelled.', 'apiResponse' => $strCancellationResponse, 'redirect' => true);
echo json_encode($response);
exit;
} else if (!empty($strErrors)) {
if ($strErrorsCode == "2003") {
$data = array(
"StatusType" => "10"
);
} else {
$data = array(
"StatusType" => "11"
);
}
//echo "<pre>"; print_r($data); exit;
$objBuyHotel->updateBookingStatus($data, $intTPSysId);
$strMsg = $strErrors[0]['messages'][0];
$arrCancellationResponse = array();
$strCancellationResponse = base64_encode(json_encode($arrCancellationResponse));
$response = array('success' => true, 'msg' => $strMsg, 'apiResponse' => $strCancellationResponse, 'redirect' => true);
echo json_encode($response);
exit;
}
} else if ($API_SOURCE_ID == 3) {
$intResponseStatus = $cancellationResponse['HotelChangeRequestStatusResult']['ResponseStatus'];
$intChangeRequestId = $cancellationResponse['HotelChangeRequestStatusResult']['ChangeRequestId'];
$intChangeRequestStatus = $cancellationResponse['HotelChangeRequestStatusResult']['ChangeRequestStatus'];
$intErrorCode = $cancellationResponse['HotelChangeRequestStatusResult']['Error']['ErrorCode'];
$strErrorMessage = $cancellationResponse['HotelChangeRequestStatusResult']['Error']['ErrorMessage'];
if ($intChangeRequestStatus == 1) {
$data = array(
"StatusType" => "10"
);
$objBuyHotel->updateBookingStatus($data, $intTPSysId);
$strMsg = "Your booking has been cancelled.";
$redirect = true;
} else if ($intChangeRequestStatus == 2) {
$data = array(
"StatusType" => "9"
);
$objBuyHotel->updateBookingStatus($data, $intTPSysId);
$strMsg = "Your booking cancellation is Inprocess";
$redirect = true;
} else {
$strMsg = "Oops! Your booking Can'nt be cancelled right now please try again latter, Please contact administrator for more details";
$redirect = false;
}
if ($intResponseStatus == 1 && $intErrorCode == 0) {
$response = array('success' => true, 'msg' => $strMsg, 'apiResponse' => $cancellationResponse, 'redirect' => $redirect);
echo json_encode($response);
exit;
} else {
$response = array('success' => true, 'msg' => $strErrorMessage, 'apiResponse' => $cancellationResponse, 'redirect' => $redirect);
echo json_encode($response);
exit;
}
}
}
} else {
$response = array('success' => false, 'msg' => 'Oops! Your booking Can\'nt be cancelled right now please try again latter,Please contact administrator for more details. ');
echo json_encode($response);
exit;
}
exit;
}
}
}
public function viewHotelBookingVocherAction() {
$this->_helper->layout->disableLayout();
$intTPSysId = base64_decode($this->getRequest()->getParam("tid"));
$objBuyHotel = new Travel_Model_TblBuyHotel();
$arrHotelBookingDetails = $objBuyHotel->viewHotelBookingVoucher($intTPSysId);
$this->view->arrHotelBookingDetails = $arrHotelBookingDetails;
$intCustomerSysId = $arrHotelBookingDetails[0]['CustomerSysId'];
if (!empty($intCustomerSysId)) {
$arrTrevllerDetails = $objBuyHotel->GetAgencyCustomerDetailsForBooking($intCustomerSysId, $intTPSysId);
//echo "<pre>";print_r($arrHotelBookingDetails);
$this->view->arrTrevllerDetails = $arrTrevllerDetails;
}
}
public function viewHotelBookingCustomerInvoiceAction() {
$this->_helper->layout->disableLayout();
$intTPSysId = base64_decode($this->getRequest()->getParam("tid"));
$objBuyHotel = new Travel_Model_TblBuyHotel();
$arrHotelBookingDetails = $objBuyHotel->viewHotelBookingVoucher($intTPSysId);
//echo "<pre>";print_r($arrHotelBookingDetails);exit;
$this->view->arrHotelBookingDetails = $arrHotelBookingDetails;
$intCustomerSysId = $arrHotelBookingDetails[0]['CustomerSysId'];
if (!empty($intCustomerSysId)) {
$arrTrevllerDetails = $objBuyHotel->GetAgencyCustomerDetailsForBooking($intCustomerSysId, $intTPSysId);
//echo "<pre>";print_r($arrTrevllerDetails);
$this->view->arrTrevllerDetails = $arrTrevllerDetails;
}
}
public function processCancellationRefundAction() {
$this->view->intCustomerSysId = $intCustomerSysId = base64_decode($this->getRequest()->getParam("cid"));
$this->view->intTPSysId = $intTPSysId = base64_decode($this->getRequest()->getParam("tid"));
$arrApiRes = base64_decode($this->getRequest()->getParam("apires"));
$arrApiRes = json_decode($arrApiRes, true);
if (!empty($arrApiRes)) {
$strCancellationReference = $arrApiRes['strCancellationReference'];
$strCancellationCurrency = $arrApiRes['strCancellationCurrency'];
$strCancellationBookingAmount = "350"; //$arrApiRes['strCancellationBookingAmount'];
$strCancelDate = $arrApiRes['strCancelDate'];
$strBookingCurrency = $arrApiRes['strBookingCurrency'];
$strBookingAmount = $arrApiRes['strBookingAmount'];
$intRefundAmount = $strBookingAmount - $strCancellationBookingAmount;
} else {
$strCancellationReference = 0;
$strCancellationCurrency = 0;
$strCancellationBookingAmount = 0;
$strCancelDate = 0;
$strBookingCurrency = 0;
$strBookingAmount = 0;
$intRefundAmount = 0;
}
// echo "<pre>";
// print_r($arrApiRes);
// exit;
$objBuyHotel = new Travel_Model_TblBuyHotel();
$arrResult = $objBuyHotel->viewHotelBookingDetails($intTPSysId);
$strFirstName = $arrResult[0]['FirstName'];
$intTotalPax = $arrResult[0]['AdultPax'] + $arrResult[0]['ChildPax'];
$intTotalAmount = $arrResult[0]['NetCost'];
$intAgentMarkUpAmount = $arrResult[0]['additionalMarkUp'];
$intAgencyMarkUpAmount = $arrResult[0]['AgencyMarkUp'];
$intGTXMarkUpAmount = $arrResult[0]['GTXMarkup'];
$intTax = $arrResult[0]['Taxes'];
$intXServiceTaxAmount = $arrResult[0]['XServiceTaxAmount'];
$intGTXServiceTaxAmount = $arrResult[0]['GTXServiceTaxAmount'];
$intAgentServiceTaxAmount = $arrResult[0]['AgentServiceTaxAmount'];
$intAgentsCustomServiceTaxAmount = $arrResult[0]['AgentsCustomServiceTaxAmount'];
echo "<pre>";
print_r($arrResult);
exit;
// refund data
$this->view->strBookingCancelUrl = "/payment/booking-cancellation";
$this->view->intLoggedinUserId = $this->intLoggedinUserId;
$this->view->intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$this->view->strReturnURL = "/bookinghotel/view-and-cancel-hotel-booking/cid/" . base64_encode($intCustomerSysId) . "/tid/" . base64_encode($intTPSysId);
$this->view->intPlanType = "2";
$this->view->strTrxType = "C";
$this->view->guid = $this->GUID();
$arrPriceAndMarkups = array(
"intAgentMarkUpAmount" => $intAgentMarkUpAmount,
"intAgencyMarkUpAmount" => $intAgencyMarkUpAmount,
"intGTXMarkUpAmount" => $intGTXMarkUpAmount,
"intTotalAmount" => $intTotalAmount,
"intTax" => $intXServiceTaxAmount,
"GTXServiceTaxAmount" => $intGTXServiceTaxAmount,
"AgentServiceTaxAmount" => $intAgentServiceTaxAmount,
"AgentsCustomServiceTaxAmount" => $intAgentsCustomServiceTaxAmount,
"Pax" => $intTotalPax,
"CancellationCharge" => $strCancellationBookingAmount,
"SupplierSourceStr" => "API",
);
// echo $intRefundAmount;
// echo "<pre>";print_r($arrPriceAndMarkups);exit;
$strPriceAndMarkups = json_encode($arrPriceAndMarkups);
$this->view->stringData = $strStringData = $this->getEnc($strPriceAndMarkups);
$this->view->walletCode = $this->walletCode($this->intLoggedinUserAgencySysId, $this->view->guid, $intRefundAmount, $this->intLoggedinUserId, $intTPSysId, $intCustomerSysId, $strStringData);
$this->view->intCancellationId = $strCancellationReference;
$this->view->firstname = $strFirstName;
$this->view->refundAmount = $intRefundAmount;
$this->view->intTpSysId = $intTPSysId;
$this->view->intCustomerSysId = $intCustomerSysId;
// refund data ends
}
// Added By Pardeep Panchal Ends...
public function hotelBookingRequestAction() {
$objBuyHotel = new Travel_Model_TblBuyHotel();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$ReportingToSysId = $sessionLogin_user->ReportingToSysId;
$arrHotelBookingList = $objBuyHotel->getHotelBookingList('', '', 'Request');
$arrOnlyHotelBookingListArr = array();
foreach ($arrHotelBookingList as $hKey1 => $hVal1) {
$APIBookingRes = json_decode($hVal1['APIBookingRes'], 1);
$hotelname = isset($hVal1['hotelName']) ? $hVal1['hotelName'] : (isset($APIBookingRes['hotelname']) ? $APIBookingRes['hotelname'] : '');
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']] = $hVal1;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['hotelName'] = $hotelname;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['Title'] = isset($hVal1['cityTitle']) ? $hVal1['cityTitle'] : '';
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['NetCost'] = isset($hVal1['NetCost']) ? $hVal1['NetCost'] : 0;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['isOnlyHotelPackage'] = 0;
$arrOnlyHotelBookingListArr[$hVal1['TPSysId']]['TotalAmountPaid'] = isset($hVal1['PaidAmount']) ? $hVal1['PaidAmount'] : 0;
// echo "<pre>";
// print_r($APIBookingRes);
}
// echo "<pre>";print_r($arrOnlyHotelBookingListArr);die;
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($arrOnlyHotelBookingListArr);
$paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
$paginator->setCurrentPageNumber($page);
$this->view->controller = $this;
$this->view->arrHotelBookingList = $paginator;
$TblCurrency = new Travel_Model_TblCurrency();
$this->view->CurrencySymbol = $CurrencySymbol = $TblCurrency->getCurrencySymbolByIdsList();
}
public function emailToSupplierAction() {
$objMarkup = new Markup_Model_Markup();
$TblPackage = new Travel_Model_TblPackage();
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$TPSysId = (isset($getData['TPSysId'])) ? $getData['TPSysId'] : 0;
$type = (isset($getData['type'])) ? $getData['type'] : 1;
if ($TPSysId > 0) {
$InvHotelDetails = $this->_crmcusttravelplan->GetTravelPlanCustomerInvHotelDetails($TPSysId, 0);
/* For Inv Hotel */
$ARR_SALUTION = unserialize(ARR_SALUTION);
$InvHotelDetailsArray = array();
foreach ($InvHotelDetails as $key => $value) {
$InvHotelDetailsArray['TPSysId'] = $value['TPSysId'];
$InvHotelDetailsArray['MasterTPSysId'] = $value['MasterTPSysId'];
$InvHotelDetailsArray['PlanBookingId'] = $value['PlanBookingId'];
$InvHotelDetailsArray['AgencySysId'] = $value['AgencySysId'];
$InvHotelDetailsArray['CustomerSysId'] = $value['CustomerSysId'];
$InvHotelDetailsArray['PlanType'] = $value['PlanType'];
$InvHotelDetailsArray['HotelSupplierSysId'] = $value['HotelSupplierSysId'];
$InvHotelDetailsArray['HotelSupplierName'] = $value['HotelSupplierName'];
$InvHotelDetailsArray['SupplierDesignation'] = $value['SupplierDesignation'];
$InvHotelDetailsArray['SourcePlaces'] = $value['SourcePlaces'];
$InvHotelDetailsArray['SourcePlaceSysId'] = $value['SourcePlaceSysId'];
$InvHotelDetailsArray['StartDate'] = $value['StartDate'];
$InvHotelDetailsArray['ValidTill'] = $value['ValidTill'];
$InvHotelDetailsArray['hotelFromDate'] = $value['hotelFromDate'];
$InvHotelDetailsArray['hotelToDate'] = $value['hotelToDate'];
$InvHotelDetailsArray['hotelTotalNights'] = $value['hotelTotalNights'];
$InvHotelDetailsArray['TotalCost'] = $value['TotalCost'];
$InvHotelDetailsArray['Price'] = $value['Price'];
$InvHotelDetailsArray['NetPrice'] = $value['NetPrice'];
$InvHotelDetailsArray['Symbol'] = $value['Symbol'];
$InvHotelDetailsArray['RoomInfoJson'] = $value['RoomInfoJson'];
$InvHotelDetailsArray['hotelName'] = $value['hotelName'];
$InvHotelDetailsArray['Cities'] = $value['Cities'];
$InvHotelDetailsArray['SpecialRequest'] = $value['SpecialRequest'];
$InvHotelDetailsArray['AccoSysId'] = $value['AccoSysId'];
$InvHotelDetailsArray['EmailId'] = $value['EmailId'];
$InvHotelDetailsArray['Contacts'] = $value['Contacts'];
$InvHotelDetailsArray['FirstName'] = $value['FirstName'];
$InvHotelDetailsArray['Salutation'] = $value['Salutation'];
$InvHotelDetailsArray['LastName'] = $value['LastName'];
$InvHotelDetailsArray['hotelAddress'] = $value['hotelAddress'];
$InvHotelDetailsArray['PrimaryContactNo'] = $value['PrimaryContactNo'];
$InvHotelDetailsArray['DisplayName'] = $value['DisplayName'];
$InvHotelDetailsArray['B2bDisplayName'] = ($value['IsB2BProposal'] == 1) ? $value['DisplayName'] : '';
$InvHotelDetailsArray['CustomerDetails'] = trim(trim($ARR_SALUTION[$value['Salutation']]) . ' ' . trim($value['FirstName']) . ' ' . trim($value['LastName']));
$RoomFromDateN = $value['RoomFromDate']->format('Y-m-d');
$RoomToDateN = $value['RoomToDate']->format('Y-m-d');
$datetime1 = new DateTime($RoomFromDateN);
$datetime2 = new DateTime($RoomToDateN);
$interval = $datetime1->diff($datetime2);
$totalNights = (int) $interval->format('%a');
$RoomFromDate = $value['RoomFromDate']->format('d M y');
$RoomToDate = $value['RoomToDate']->format('d M y');
$InvHotelDetailsArray['RoomDetail'][$RoomFromDateN]['RoomFromDate'] = $RoomFromDate;
$InvHotelDetailsArray['RoomDetail'][$RoomFromDateN]['RoomToDate'] = $RoomToDate;
$InvHotelDetailsArray['RoomDetail'][$RoomFromDateN]['RoomNights'] = $totalNights;
$InvHotelDetailsArray['RoomDetail'][$RoomFromDateN]['RoomDetail'][$value['MappingSysId']] = [
'RoomTitle' => trim($value['EconomyTypeTitle']),
'MealPlanTitle' => trim($value['MealPlanTypeTitle']),
'Adult' => trim($value['Adult']),
'Child' => trim($value['Child']),
'Infent' => trim($value['Infent']),
'RoomFromDate' => $RoomFromDate,
'RoomToDate' => $RoomToDate,
];
$InvHotelDetailsArray['MemberList'][$value['MemberSysId']]['MEMBERTitle'] = trim($ARR_SALUTION[$value['MEMBERTitle']]);
$InvHotelDetailsArray['MemberList'][$value['MemberSysId']]['MEMBERFirstName'] = trim($value['MEMBERFirstName']);
$InvHotelDetailsArray['MemberList'][$value['MemberSysId']]['MEMBERLastName'] = trim($value['MEMBERLastName']);
// echo "<pre>";print_r($InvHotelDetailsArray);die;
}
$whereSupport = array(
'AgencySysId' => $InvHotelDetails[0]['AgencySysId'],
'PlanType' => 2,
);
$hotelTotalNights = ($InvHotelDetailsArray['hotelTotalNights'] > 1) ? $InvHotelDetailsArray['hotelTotalNights'] . ' Nights' : $InvHotelDetailsArray['hotelTotalNights'] . 'Night';
$hotelFromDate = $InvHotelDetailsArray['hotelFromDate']->format('d M');
$Cities = $InvHotelDetailsArray['Cities'];
$DisplayName = ($_SESSION['sessionLogin_user']['agencyDetails']['DisplayName']) ? trim($_SESSION['sessionLogin_user']['agencyDetails']['DisplayName']) : '';
if ($type == 3) {
$Subject = ' Hotel Booking for ' . ($hotelTotalNights) . ' on ' . $hotelFromDate . ' for ' . $Cities . ' from ' . $DisplayName . ' - Payment Requested';
} else {
$Subject = ' Hotel Booking for ' . ($hotelTotalNights) . ' on ' . $hotelFromDate . ' for ' . $Cities . ' from ' . $DisplayName;
}
$getSupportContactData = $objMarkup->getAgencyUserDetail($whereSupport);
$PlanTypeArr = array(11, 10);
$addonsData = $TblPackage->getTravelPlanAddonServicesMultipleIds($InvHotelDetailsArray['AgencySysId'], $TPSysId, $PlanTypeArr);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/bookinghotel/');
$html->assign('InvHotelDetailsArray', $InvHotelDetailsArray);
$html->assign('getSupportContactData', $getSupportContactData);
$html->assign('addonsData', $addonsData);
$html->assign('Subject', $Subject);
$html->assign('type', $type);
echo $bodyText = $html->render('email-to-supplier.phtml');
exit;
}
}
}
public function sendEmailToSupplierAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$TblSupplier = new Travel_Model_TblSupplier();
$TPSysId = $getData['TPSysId'];
$HotelSPSysId = $getData['HotelSPSysId'];
$bodyText = $getData['EmailContent'];
$DisplayName = ($_SESSION['sessionLogin_user']['agencyDetails']['DisplayName']) ? trim($_SESSION['sessionLogin_user']['agencyDetails']['DisplayName']) : '';
$PrimaryEmail = ($_SESSION['sessionLogin_user']['agencyDetails']['PrimaryEmail']) ? trim($_SESSION['sessionLogin_user']['agencyDetails']['PrimaryEmail']) : '';
if ($HotelSPSysId > 0) {
$CustomerDetails = $TblSupplier->getSupplierById($HotelSPSysId);
} else {
$getTravelPlanDetailsByTPSysId = $this->_crmcusttravelplan->getTravelPlanDetailsByTPSysId($TPSysId, 'Query');
$CustomerDetails = $getTravelPlanDetailsByTPSysId[0];
}
$emailId = $CustomerDetails['EmailId'];
$emailData = array('fromEmail' => $PrimaryEmail, 'fromName' => $DisplayName, 'subject' => $getData['Subject'], 'to' => array(trim($emailId)), 'bodyHtml' => $bodyText, 'bodyText' => '');
$arrEmailStatisticsType = array_keys(unserialize(ARR_EMAIL_STATISTICS_TYPE));
$arrEmailStatistics = array(
"TPSysId" => $TPSysId,
"TypeSysId" => 1, // 1 For Email 2 For SMS
"AgencySysId" => 0,
"AgentSysId" => 0,
"Title" => $bodyText,
"Source" => $arrEmailStatisticsType[2], // 3 For Resend proposal
"Status" => 0,
"RefSysId" => "",
"RefSysStatus" => "",
"CreateDate" => date('Y-m-d H:i:s')
);
$emailsent = $this->mailSentByElastice($emailData, $arrEmailStatistics, 0, 0);
if ($emailsent) {
echo json_encode(array('status' => true, 'message' => 'Email to supplier sent successfully.'));
exit;
} else {
echo json_encode(array('status' => false, 'message' => 'Error!!!!'));
exit;
}
} else {
echo json_encode(array('status' => false, 'message' => 'Error!!!!'));
exit;
}
}
}