403Webshell
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/admin/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/admin/controllers/BookinghotelController.php
<?php 
/**
 * Class Hotel
 *
 * @name		Buy List Hotel
 * @author		Harpreet
 * @version 	1.0
 * @copyright 	Catabatic India Pvt Ltd
 * Handle Hotel Related function
 *
 */
class Admin_BookinghotelController extends Catabatic_ValidateAdmin {
    const CONST_SOURCE_ADMIN = 3;
    
    protected $intLoggedinUserId = '';
    protected $intLoggedinUserGroupSysId = '';
    protected $intLoggedinUserAgencySysId = '';
    protected $intLoggedinUserTrxCurrency = '';
    protected $InfoSourceSysId = '';
    
    
    public function init() {
        parent::init();
        $this->model = @$this->modelName ? new $this->modelName() : null;
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();

        $sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
        $this->intLoggedinUserId = $sessionLogin_user->intLoggedinUserId;
        $this->GRID_PER_PAGE_RECORD_COUNT = GRID_PER_PAGE_RECORD_COUNT;
        $this->InfoSourceSysId = self::CONST_SOURCE_ADMIN; // Source - Agent 
    }
    
    // Added By Pardeep Panchal...
    
    public function indexAction() {
        
        $objBuyHotel = new Travel_Model_TblBuyHotel();
        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
            $objBuyHotel->strCondition = "";
            $this->view->strHotelName = $strHotelName = trim($getData['hotel_name']);
            $this->view->strBookingDate = $strBookingDate = trim($getData['booking_date']);
            //$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 ICA.Title LIKE '%".$strHotelName."%'";
            }
            
            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 SUBSTRING(convert(varchar, TPA.CheckInTime, 120),0,11) = '".$strCheckInDate."'";
//            }
             
            if (!empty($intBookingStatus)) {
                $objBuyHotel->strCondition .= " AND TP.StatusType = '".$intBookingStatus."'";
            }
            
            
        }
        
        
        
        $arrHotelBookingList = $objBuyHotel->getHotelBookingList();
        
        $page = $this->_getParam('page', 1);
        $paginator = Zend_Paginator::factory($arrHotelBookingList);
        $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();
        
    }
   
    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...
   
}

Youez - 2016 - github.com/yon3zu
LinuXploit