| 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/v2.hellogtx.com/backup/application/controllers/ |
Upload File : |
<?php
/***************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name : FlightController.php
* File Desc. : Flight controller for First page front end
* Created By : Md Sabir <sabir@catpl.co.in>
* Created Date : 14 Feb 2020
* Updated Date : 17 Feb 2020
***************************************************************/
class FlightController extends Catabatic_ValidateCustomer
{
protected $objMdl;
protected $tablename;
protected $tablenameDestination;
protected $baseUrl;
protected $tollfreenumber;
protected $db = NULL;
protected $objHelperGeneral;
protected $per_page_record;
public $_session;
public $customerbookinglistAPIUrl;
public $uploadPakcagePath;
public $uploadDestinationPath;
public $dummyImagePackage;
public $dummyImageDestination;
public $myNamespace;
public function init()
{
parent::init();
$this->db = Zend_Db_Table::getDefaultAdapter();
$this->_helper->layout->disableLayout();
$this->_helper->_layout->setLayout('layout-flight')->setLayoutPath(APPLICATION_PATH . '/layouts/scripts');
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrap = $aConfig['bootstrap'];
$this->siteName = $BootStrap['siteName'];
$this->baseUrl = $BootStrap['siteUrl'];
$this->tollfreenumber = $BootStrap['tollfreenumber'];
$this->gtxagencysysid = $BootStrap['gtxagencysysid']; // get gtxagencysysid from application config
$this->gtxagentsysid = $BootStrap['gtxagentsysid']; // get gtxagentsysid from application config
$this->objMdl = new Admin_Model_CRUD();
$this->tablename = "tb_tbb2c_packages_master";
$this->tablenameTes = "tbl_testimonials";
$this->tablenameDestination = "tb_tbb2c_destinations";
$this->hotelTypeArr = ['Standard', 'Deluxe', 'Luxury'];
$this->objHelperGeneral = $this->_helper->General;
$this->per_page_record = 10;
$this->_session = new Zend_Session_Namespace('User');
$this->uploadPakcagePath = 'public/upload/tours/';
$this->uploadDestinationPath = 'public/upload/destinations/';
$this->dummyImagePackage = 'default-tour.jpg';
$this->dummyImageDestination = 'default-destination.jpg';
$this->enableCache = $BootStrap['enableCache'];
$this->packageTypeStatic = $BootStrap['packageTypeDynamic'];
$this->tableClients = 'tbl_accreditations_client';
$this->table = 'tbl_about_yit';
$this->tablePopularCity = 'tbl_popular_city';
$this->customerbookinglistAPIUrl = API_CUSTOMER_LIST; // from constant file
$this->currencyRates = API_AGENCY_CURRENCY_RATE; // from constant file
$this->GetIvKey = API_GET_IV_KEY; // from constant file
$this->AgencyDataAPI = API_GET_AGENCY_DATA; // from constant file
$this->myNamespace = new Zend_Session_Namespace('MypopSess'); // get user end infomations
// $this->_helper->layout->disableLayout();
// $this->_helper->_layout->setLayout('layout1')->setLayoutPath(APPLICATION_PATH.'/layouts/scripts');
$currencyType = $this->objMdl->selectOne('tbl_currency', ['*'], ['isActive' => 1, 'Title' => 'INR'], ['id' => 'ASC']);
$currency_rate = $this->objMdl->selectOne('tbl_currency_rate', ['*'], ['FCurrencyType' => 1, 'TCurrencyType' => $currencyType->CurrencyId, 'isActive' => 1], ['cid' => 'ASC']);
$this->CurrencyRate = $currency_rate->Rate;
$this->CurrencyTitle = $currencyType->Title;
$this->CurrencyId = $currencyType->CurrencyId;
//$_SERVER["DOCUMENT_ROOT"] = $_SERVER["DOCUMENT_ROOT"] . '/holidaybazaar';
}
public function indexAction()
{
//header("Access-Control-Allow-Origin: *");
$crud = new Admin_Model_CRUD();
Zend_Session::namespaceUnset('FlightBookingData');
Zend_Session::namespaceUnset('FlightBookingDataInbound');
Zend_Session::namespaceUnset('FlightFareQuoteSession');
Zend_Session::namespaceUnset('FlightFareQuoteSessionInb');
Zend_Session::namespaceUnset('FlightSearchUrl');
Zend_Session::namespaceUnset('FlightSearchGuard');
Zend_Session::namespaceUnset('CustomerSession');
Zend_Session::namespaceUnset('CustomerMemberSysIds');
Zend_Session::namespaceUnset('FlightBookingTicketSession');
Zend_Session::namespaceUnset('flight_booking_id');
Zend_Session::namespaceUnset('SelectedMealSessionNew');
Zend_Session::namespaceUnset('SelectedBaggSessionNew');
Zend_Session::namespaceUnset('SelectedMealSessionNewInb');
Zend_Session::namespaceUnset('SelectedBaggSessionNewInb');
Zend_Session::namespaceUnset('FlightBookingDataRoundInter');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$recentSearch = new Zend_Session_Namespace('recentSearch');
$existingOffer = $crud->rv_select_all($this->table, ['*'], ['IsMarkForDel' => 0], ['AboutId' => 'DESC']);
$DomesPopularCity = $crud->rv_select_all($this->tablePopularCity, ['*'], ['popularCityType' => 0, 'IsMarkForDel' => 0], ['AboutId' => 'DESC']);
$InterPopularCity = $crud->rv_select_all($this->tablePopularCity, ['*'], ['popularCityType' => 1, 'IsMarkForDel' => 0], ['AboutId' => 'DESC']);
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->recentSearch = $recentSearch->params;
$this->view->existingOffer = $existingOffer;
$this->view->DomesPopularCity = $DomesPopularCity;
$this->view->InterPopularCity = $InterPopularCity;
$this->_redirect('/');
//$apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetAgencyCurrency($this->gtxagencysysid);
//echo '<pre>';print_r($apiResponse);die;
$trendingTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1, 'IsFeatured' => 1], ['PkgSysId' => 'DESC'], 12);
foreach ($trendingTours as $key => $value) {
$destinationArr = explode(',', $value['Destinations']); // get the first destination only by extracting array
$LongJsonInfo = Zend_Json::decode($value['LongJsonInfo']);
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2B', $value['PackageType'], $value['PackageSubType']); // get default category
} else {
$categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2C', $value['PackageType'], $value['PackageSubType']); // get default category
}
//$categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2C', $value['PackageType'], $value['PackageSubType']); // get default category
if (trim($LongJsonInfo['package']['ImgThumbnail']) != '') {
$tourImage = $LongJsonInfo['package']['ImgThumbnail'];
} else {
$tourImage1 = explode(',', $value['Image']);
$tourImage = $this->baseUrl . 'public/upload/tours/' . $value['PkgSysId'] . '/images/medium/' . $tourImage1[0];
}
$defaultCategoryId = $categoryDetails['defaultCategoryId'];
$defaultCategory = $categoryDetails['defaultCategory'];
$defaultTourType = $categoryDetails['defaultTourType'];
$TPId = ($value['PackageType'] == $this->packageTypeStatic) ? $LongJsonInfo['package']['TPId'] : $categoryDetails['TPId'];
$MPType = (!empty($categoryDetails['MPType']) && ($categoryDetails['MPType'] != 'LowestCost')) ? array_search($categoryDetails['MPType'], unserialize(CONST_MEAL_PLAN_ARR)) : 0;
$tourTypeChar = ($defaultTourType == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
$priceArrJson = $categoryDetails['priceArrJson'];
$displayFinalPrice = $this->objHelperGeneral->getPackagePrice($defaultCategory, $tourTypeChar, $priceArrJson, true); // Param 4: true ( if calculate discounted price )
$toursFinal[] = [
'name' => $this->objHelperGeneral->trimContent($LongJsonInfo['package']['Name'], 15),
'nameF' => $LongJsonInfo['package']['Name'], // full name of package name
'img' => $tourImage,
'night' => $value['Nights'],
'price' => $this->objHelperGeneral->moneyFormatINR(round($displayFinalPrice)),
'star' => $value['StarRating'],
'Destination' => $value['Destinations'],
'PkgSysId' => $value['PkgSysId'],
'GTXPkgId' => $value['GTXPkgId'],
'defaultCategoryId' => $defaultCategoryId,
'defaultCategory' => $defaultCategory,
'tourtype' => $defaultTourType,
'TPId' => $TPId,
'PackageType' => $value['PackageType'],
'mp' => $MPType,
'Countries' => $value['Countries'],
'BookingValidUntil' => $value['BookingValidUntil'],
'Inclusions' => $LongJsonInfo['package']['Inclusions'],
];
}
// echo '<pre>';print_r($this->_session->session);die;
$this->view->baseUrl = $this->baseUrl;
$this->view->toursFinal = $toursFinal;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}
public function flightsearchdataAction()
{
$getData = $this->getRequest()->getParams();
$uri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
$uriExp = explode('?', $uri);
Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CreateSessionSearchParams($getData);
$FlightSearchGuard = new Zend_Session_Namespace('FlightSearchGuard');
$FlightSearchGuard->params = base64_encode($uriExp[1]); // Putting all form data to Session
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
$FlightSearchUrl->params = ($uriExp[1]); // Putting all form data to Session
$this->view->getData = $getData;
$this->_redirect('flight/flight-search?' . $uriExp[1]);
}
public function flightSearchAction()
{
$getData = $this->getRequest()->getParams();
$FlightSearchResults = new Zend_Session_Namespace('FlightSearchResults');
$this->view->getData = $getData;
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$recentSearch = new Zend_Session_Namespace('recentSearch');
$adultCount = $sessionFlightSearchParams->params['adults'];
$childCount = $sessionFlightSearchParams->params['child'];
$infantCount = $sessionFlightSearchParams->params['infant'];
$intMemberCount = $adultCount + $childCount + $infantCount;
$interNationalSearch = trim($sessionFlightSearchParams->params['interNationalSearch']);
$this->view->intMemberCount = $intMemberCount;
$this->view->interNationalSearch = $interNationalSearch;
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
// echo '<pre>';print_r($sessionFlightSearchParams->params);die;
}
public function getflightlogo($strAirlineCodeLogo)
{
$filePath = $_SERVER['DOCUMENT_ROOT'] . "/public/upload/AirlineLogo/";
if (file_exists($filePath . $strAirlineCodeLogo . ".gif")) {
$strAirlineLogo = $strAirlineCodeLogo . ".gif";
$filePath = $this->baseUrl . "public/upload/AirlineLogo/" . $strAirlineLogo;
} elseif (file_exists($filePath . $strAirlineCodeLogo . ".png")) {
$strAirlineLogo = $strAirlineCodeLogo . ".png";
$filePath = $this->baseUrl . "public/upload/AirlineLogo/" . $strAirlineLogo;
} elseif (file_exists($filePath . $strAirlineCodeLogo . ".jpg")) {
$strAirlineLogo = $strAirlineCodeLogo . ".jpg";
$filePath = $this->baseUrl . "public/upload/AirlineLogo/" . $strAirlineLogo;
} elseif (file_exists($filePath . $strAirlineCodeLogo . ".jpeg")) {
$strAirlineLogo = $strAirlineCodeLogo . ".jpeg";
$filePath = $this->baseUrl . "public/upload/AirlineLogo/" . $strAirlineLogo;
} else {
$filePath = $this->baseUrl . "public/upload/AirlineLogo/noimage.png";
}
return $filePath;
}
public function getMarkup($intCountryCode)
{
if ($intCountryCode) {
$this->postFields = "";
$this->postFields .= "&AgencySysId=$this->gtxagencysysid";
$this->postFields .= "&AgentSysId=$this->gtxagentsysid";
$this->postFields .= "&intCountryCode=$intCountryCode";
$model = new Gtxwebservices_Model_Webservices();
$result = $model->getMarkupAndServiceTax($this->postFields);
$response = json_decode($result, true);
return $response;
} else {
$data = array('status' => false, 'message' => 'Invalid country code');
return ($data);
}
}
public function getflightsearchAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$getData = $this->getRequest()->getParams();
$arrAirlineList = $this->getAirlineIdsAndCodeList();
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightSearchResults = new Zend_Session_Namespace('FlightSearchResults');
$intSourceCityId = trim($sessionFlightSearchParams->params['sourceCityId']);
$intDestinationCityId = trim($sessionFlightSearchParams->params['destinationCityId']);
$interNationalSearch = trim($sessionFlightSearchParams->params['interNationalSearch']);
$strFlightRoute = trim($sessionFlightSearchParams->params['route']);
$adultCount = $sessionFlightSearchParams->params['adults'];
$childCount = $sessionFlightSearchParams->params['child'];
$infantCount = $sessionFlightSearchParams->params['infant'];
$intMemberCount = $adultCount + $childCount + $infantCount;
$strFlightRoute = trim($sessionFlightSearchParams->params['route']);
$strDepatureDate = $sessionFlightSearchParams->params['departure_dates'];
$strReturnDate = $sessionFlightSearchParams->params['return_dates'];
$intCountryCode = $sessionFlightSearchParams->params['intCountryCode'];
$intTatalPaxCT = $adultCount + $childCount;
$getMarkup = $this->getMarkup($intCountryCode);
//echo '<pre>';
//print_r($this->CurrencyTitle);die('ddd');
//echo '<pre>';print_r($sessionFlightSearchParams->params);die;
$apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->searchApiFlights($sessionFlightSearchParams->params);
$strFilePath = "flight/FlightSearch/" . time() . "_demo_result_request.json";
Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, json_encode($apiResponse));
$intJourneyType = 1;
$intTripType = 1;
$arrInsertFlightData = [];
$arrAirlineName = [];
$FiltStopCount = [];
$FiltPriceRange = [];
$AttPriceRange = [];
$dddddddd = [];
$localFromDateTime = date("Y-m-d h:i", strtotime($strDepatureDate));
$localToDateTime = date("Y-m-d h:i", strtotime($strReturnDate));
// $str = file_get_contents($this->baseUrl . 'public/logs/flight/FlightSearch/demo_result_request.json');
// $apiResponse = json_decode($str, true);
// echo '<pre>';print_r($apiResponse['OutBoundFlightResults']);die;
$intResponseStatus = $apiResponse['ResponseStatus'];
$ONWARD = $apiResponse['OutBoundFlightResults'];
if ($intResponseStatus == 1) {
if ($ONWARD) {
foreach ($ONWARD as $key => $result) {
$SegmentInformation = $result['sI'];
$totalPriceList = current($result['totalPriceList']);
$IsRefundable = $totalPriceList['fd']['ADULT']['rT'];
$NoOfSeatAvailable = $totalPriceList['fd']['ADULT']['sR'];
$strFareClass = $totalPriceList['fd']['ADULT']['cB']; //Cabin Baggage
$IsMealIncludes = $totalPriceList['fd']['ADULT']['mI'];
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Check In Baggage
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if ($IsRefundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($IsRefundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$OriginSegments = current($SegmentInformation);
$DestinationSegments = end($SegmentInformation);
// echo '<pre>';print_r($DestinationSegments);echo '</pre>';
$arrSegments = [];
$FlyingMinutes = 0;
$TotalLAYOVERMinutes = 0;
$LAYOVERCityArr = [];
$PublishedFare = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
$intYQTaxToT = 0;
$intTotalOfferedForAllPax = 0;
$intBaseFareAllPax = 0;
$intTaxAllPax = 0;
if ($result['totalPriceList']) {
foreach ($result['totalPriceList'] as $kp => $price) {
$fareDetail = $price['fd'];
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($Refundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($Refundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$ADULT = $fareDetail['ADULT']['fC']; //fare Components
$CHILD = isset($fareDetail['CHILD']['fC']) ? $fareDetail['CHILD']['fC'] : []; //fare Components
$INFANT = isset($fareDetail['INFANT']['fC']) ? $fareDetail['INFANT']['fC'] : []; //fare Components
$ADULTafC = $fareDetail['ADULT']['afC']['TAF']; //additional fareComponents
$CHILDafC = isset($fareDetail['CHILD']['afC']['TAF']) ? $fareDetail['CHILD']['afC']['TAF'] : []; //additional fareComponents
$INFANTafC = isset($fareDetail['INFANT']['afC']['TAF']) ? $fareDetail['INFANT']['afC']['TAF'] : []; //additional fareComponents
$ADULTNCMTDS = isset($fareDetail['ADULT']['afC']['NCM']['TDS']) ? $fareDetail['ADULT']['afC']['NCM']['TDS'] : 0; //TDS
$CHILDNCMTDS = isset($fareDetail['CHILD']['afC']['NCM']['TDS']) ? $fareDetail['CHILD']['afC']['NCM']['TDS'] : 0; //TDS
$INFANTNCMTDS = isset($fareDetail['INFANT']['afC']['NCM']['TDS']) ? $fareDetail['INFANT']['afC']['NCM']['TDS'] : 0; //TDS
$AD_MF = isset($ADULTafC['MF']) ? $ADULTafC['MF'] : 0; //Management Fee
$AD_YQ = isset($ADULTafC['YQ']) ? $ADULTafC['YQ'] : 0; //Fuel Surcharge
$AD_AGST = isset($ADULTafC['AGST']) ? $ADULTafC['AGST'] : 0; //Airline GST Component
$AD_MFT = isset($ADULTafC['MFT']) ? $ADULTafC['MFT'] : 0; //Management Fee Tax
$AD_OT = isset($ADULTafC['OT']) ? $ADULTafC['OT'] : 0; //Other Charges
$AD_MU = isset($ADULTafC['MU']) ? $ADULTafC['MU'] : 0; //markup
$AD_YR = isset($ADULTafC['YR']) ? $ADULTafC['YR'] : 0; //Carrier Misc Fee
$CH_MF = isset($CHILDafC['MF']) ? $CHILDafC['MF'] : 0; //Management Fee
$CH_YQ = isset($CHILDafC['YQ']) ? $CHILDafC['YQ'] : 0; //Fuel Surcharge
$CH_AGST = isset($CHILDafC['AGST']) ? $CHILDafC['AGST'] : 0; //Airline GST Component
$CH_MFT = isset($CHILDafC['MFT']) ? $CHILDafC['MFT'] : 0; //Management Fee Tax
$CH_OT = isset($CHILDafC['OT']) ? $CHILDafC['OT'] : 0; //Other Charges
$CH_MU = isset($CHILDafC['MU']) ? $CHILDafC['MU'] : 0; //markup
$CH_YR = isset($CHILDafC['YR']) ? $CHILDafC['YR'] : 0; //Carrier Misc Fee
$IN_MF = isset($INFANTafC['MF']) ? $INFANTafC['MF'] : 0; //Management Fee
$IN_YQ = isset($INFANTafC['YQ']) ? $INFANTafC['YQ'] : 0; //Fuel Surcharge
$IN_AGST = isset($INFANTafC['AGST']) ? $INFANTafC['AGST'] : 0; //Airline GST Component
$IN_MFT = isset($INFANTafC['MFT']) ? $INFANTafC['MFT'] : 0; //Management Fee Tax
$IN_OT = isset($INFANTafC['OT']) ? $INFANTafC['OT'] : 0; //Other Charges
$IN_MU = isset($INFANTafC['MU']) ? $INFANTafC['MU'] : 0; //markup
$IN_YR = isset($INFANTafC['YR']) ? $INFANTafC['YR'] : 0; //Carrier Misc Fee
if ($kp == 0) {
$PublishedFare += (($ADULT['TF'] * $adultCount) + ($CHILD['TF'] * $childCount) + ($INFANT['TF'] * $infantCount)); //Total Fare
$BaseFare += (($ADULT['BF'] * $adultCount) + ($CHILD['BF'] * $childCount) + ($INFANT['BF'] * $infantCount)); //Base Fare
$Tax += (($ADULT['TAF'] * $adultCount) + ($CHILD['TAF'] * $childCount) + ($INFANT['TAF'] * $infantCount)); //Taxes and Fees
}
$PublishedFareIN = (($ADULT['TF'] * $adultCount) + ($CHILD['TF'] * $childCount) + ($INFANT['TF'] * $infantCount)); //Total Fare
$BaseFareIN = (($ADULT['BF'] * $adultCount) + ($CHILD['BF'] * $childCount) + ($INFANT['BF'] * $infantCount)); //Base Fare
$TaxIN = (($ADULT['TAF'] * $adultCount) + ($CHILD['TAF'] * $childCount) + ($INFANT['TAF'] * $infantCount)); //Taxes and Fees
$NetFare = (($ADULT['NF'] * $adultCount) + ($CHILD['NF'] * $childCount) + ($INFANT['NF'] * $infantCount)); //Taxes and Fees
$NetCommission = (($ADULT['NCM'] * $adultCount) + ($CHILD['NCM'] * $childCount) + ($INFANT['NCM'] * $infantCount)); //Taxes and Fees
//echo '<pre>';print_r(($ADULTafC));echo '</pre>';
$YQTax = (($AD_YQ * $adultCount) + ($CH_YQ * $childCount) + ($IN_YQ * $infantCount));
$OtherCharges = (($AD_OT * $adultCount) + ($CH_OT * $childCount) + ($IN_OT * $infantCount));
$ServiceFee = (($AD_MF * $adultCount) + ($CH_MF * $childCount) + ($IN_MF * $infantCount));
$ManagementFeeTax = (($AD_MFT * $adultCount) + ($CH_MFT * $childCount) + ($IN_MFT * $infantCount));
$AirlineGSTComponent = (($AD_AGST * $adultCount) + ($CH_AGST * $childCount) + ($IN_AGST * $infantCount));
$CarrierMiscFee = (($AD_YR * $adultCount) + ($CH_YR * $childCount) + ($IN_YR * $infantCount));
$MUFee = (($AD_MU * $adultCount) + ($CH_MU * $childCount) + ($IN_MU * $infantCount));
$TdsOnPLB = (($ADULTNCMTDS * $adultCount) + ($CHILDNCMTDS * $childCount) + ($INFANTNCMTDS * $infantCount));
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $OfferedFare,
'intCommissionEarned' => $CommissionEarned,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
);
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkupTripJack($markUpArr);
$AgencyMarkUp = $arrMarkUps['intAgencyFixMarkUp'];
$intGTXMarkUp = $arrMarkUps['intGTXMarkUp'];
$intFareWithGTXMarkUp = $arrMarkUps['intFareWithGTXMarkUp'];
$intOfferedFare = $arrMarkUps['intOfferedFare'];
if ($interNationalSearch == 1) {
$intGTXMarkUp = (($arrMarkUps['intGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnGTXMarkUp = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intAgencyFixMarkUp = (($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUp = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
} else {
$intGTXMarkUp = ($arrMarkUps['intGTXMarkUp'] * $intMemberCount);
$intSTaxOnGTXMarkUp = ($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount);
$intAgencyFixMarkUp = ($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount);
$intSTaxOnAgencyFixMarkUp = ($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount);
}
$intCommisionEarnedForAgency = $arrMarkUps['intCommisionEarnedForAgency'];
$intPLBEarnedForAgency = $arrMarkUps['intPLBEarnedForAgency'];
$intIncentiveEarnedForAgency = $arrMarkUps['intIncentiveEarnedForAgency'];
$intTotalEarningsForAgency = $arrMarkUps['intTotalEarningsForAgency'] + $intAgencyFixMarkUp;
$intGSTOnAgencyCommisionEarned = $arrMarkUps['intGSTOnAgencyCommisionEarned'];
$intGSTOnAgencyPLBEarned = $arrMarkUps['intGSTOnAgencyPLBEarned'];
$intGSTOnAgencyIncentiveEarned = $arrMarkUps['intGSTOnAgencyIncentiveEarned'];
$intTotalGSTAgencyEarnings = $intSTaxOnAgencyFixMarkUp + $intGSTOnAgencyCommisionEarned + $intGSTOnAgencyPLBEarned + $intGSTOnAgencyIncentiveEarned;
$intPublishedFare = $intOfferedFare + $intGTXMarkUp + $intAgencyFixMarkUp + $intCommisionEarnedForAgency + $intPLBEarnedForAgency + $intIncentiveEarnedForAgency + $intTotalGSTAgencyEarnings;
$intTotalDisCount = $CommissionEarned + $PLBEarned + $IncentiveEarned;
$intDiscountPerHead = $intTotalDisCount / $intTatalPaxCT;
$intDiscountPerHead = ($intDiscountPerHead * $adultCount);
$intBaseFareCal = ($ADULT['BF'] * $adultCount) - $intDiscountPerHead;
$intAdultFareOffered = $intBaseFareCal + ($ADULT['TAF'] * $adultCount);
$intTotalOfferedForAllPax = $intAdultFareOffered;
$intBaseFareAllPax = $intBaseFareCal;
if ($interNationalSearch == 1) {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
} else {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount));
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount));
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount));
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount));
}
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($intBaseFareCal);
$FareBreakdown[0]['BaseFare'] = ($ADULT['BF'] * $adultCount);
$FareBreakdown[0]['CommissionEarned'] = ($ADULT['NCM'] * $adultCount);
$FareBreakdown[0]['TDS'] = ($ADULTNCMTDS * $adultCount);
$FareBreakdown[0]['MF'] = ($AD_MF * $adultCount);
$FareBreakdown[0]['YQ'] = ($AD_YQ * $adultCount);
$FareBreakdown[0]['AGST'] = ($AD_AGST * $adultCount);
$FareBreakdown[0]['MFT'] = ($AD_MFT * $adultCount);
$FareBreakdown[0]['OT'] = ($AD_OT * $adultCount);
$FareBreakdown[0]['MU'] = ($AD_MU * $adultCount);
$FareBreakdown[0]['YR'] = ($AD_YR * $adultCount);
$FareBreakdown[0]['FixedMarkUp'] = $intAgencyFixMarkUpA;
$FareBreakdown[0]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpA;
$FareBreakdown[0]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[0]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[0]['intGTXMarkUp'] = $intGTXMarkUpA;
$FareBreakdown[0]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpA;
$FareBreakdown[0]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[0]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[0]['PGCharge'] = 0;
$FareBreakdown[0]['Baggage'] = isset($fareDetail['ADULT']['bI']['iB']) ? $fareDetail['ADULT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[0]['CabinBaggage'] = isset($fareDetail['ADULT']['bI']['cB']) ? $fareDetail['ADULT']['bI']['cB'] : []; //Cabin Baggage ;
if (isset($fareDetail['CHILD'])) {
$intDiscountPerHead = ($intDiscountPerHead * $childCount);
$intBaseFareCal = ($CHILD['BF'] * $childCount) - $intDiscountPerHead;
$intChildFareOffered = $intBaseFareCal + ($CHILD['TAF'] * $childCount);
$intBaseFareAllPax = $intBaseFareAllPax + $intBaseFareCal;
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intChildFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount) * $strFlightRoute);
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
} else {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount));
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount));
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount));
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount));
}
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($CHILD['BF'] * $childCount);
$FareBreakdown[1]['BaseFare'] = ($intBaseFareCal);
$FareBreakdown[1]['CommissionEarned'] = ($CHILD['NCM'] * $childCount);
$FareBreakdown[1]['TDS'] = ($CHILDNCMTDS * $childCount);
$FareBreakdown[1]['MF'] = ($CH_MF * $childCount);
$FareBreakdown[1]['YQ'] = ($CH_YQ * $childCount);
$FareBreakdown[1]['AGST'] = ($CH_AGST * $childCount);
$FareBreakdown[1]['MFT'] = ($CH_MFT * $childCount);
$FareBreakdown[1]['OT'] = ($CH_OT * $childCount);
$FareBreakdown[1]['MU'] = ($CH_MU * $childCount);
$FareBreakdown[1]['YR'] = ($CH_YR * $childCount);
$FareBreakdown[1]['FixedMarkUp'] = $intAgencyFixMarkUpC;
$FareBreakdown[1]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpC;
$FareBreakdown[1]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[1]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[1]['intGTXMarkUp'] = $intGTXMarkUpC;
$FareBreakdown[1]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpC;
$FareBreakdown[1]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[1]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[1]['PGCharge'] = 0;
$FareBreakdown[1]['Baggage'] = isset($fareDetail['CHILD']['bI']['iB']) ? $fareDetail['CHILD']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[1]['CabinBaggage'] = isset($fareDetail['CHILD']['bI']['cB']) ? $fareDetail['CHILD']['bI']['cB'] : []; //Cabin Baggage ;
}
if (isset($fareDetail['INFANT'])) {
$intInfantFareOffered = ($INFANT['BF'] * $infantCount) + ($INFANT['TAF'] * $infantCount);
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intInfantFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
} else {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount));
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount));
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount));
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount));
}
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['BaseFare'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['CommissionEarned'] = ($INFANT['NCM'] * $infantCount);
$FareBreakdown[2]['TDS'] = ($INFANTNCMTDS * $infantCount);
$FareBreakdown[2]['MF'] = ($IN_MF * $infantCount);
$FareBreakdown[2]['YQ'] = ($IN_YQ * $infantCount);
$FareBreakdown[2]['AGST'] = ($IN_AGST * $infantCount);
$FareBreakdown[2]['OT'] = ($IN_OT * $infantCount);
$FareBreakdown[2]['MFT'] = ($IN_MFT * $infantCount);
$FareBreakdown[2]['MU'] = ($IN_MU * $infantCount);
$FareBreakdown[2]['YR'] = ($IN_YR * $infantCount);
$FareBreakdown[2]['FixedMarkUp'] = $intAgencyFixMarkUpI;
$FareBreakdown[2]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpI;
$FareBreakdown[2]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[2]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[2]['intGTXMarkUp'] = $intGTXMarkUpI;
$FareBreakdown[2]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpI;
$FareBreakdown[2]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[2]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[2]['PGCharge'] = 0;
$FareBreakdown[2]['Baggage'] = isset($fareDetail['INFANT']['bI']['iB']) ? $fareDetail['INFANT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[2]['CabinBaggage'] = isset($fareDetail['INFANT']['bI']['cB']) ? $fareDetail['INFANT']['bI']['cB'] : []; //Cabin Baggage ;
}
//echo '<pre>';print_r($price);
$FairRulesArr[$kp] = array(
"Currency" => $this->CurrencyTitle, //$Currency,
"CurrencyRate" => $this->CurrencyRate, //$Currency,
"currencySysId" => $this->CurrencyId,
"BaseFare" => $BaseFareIN,
"Tax" => $TaxIN,
"YQTax" => $YQTax,
"OtherCharges" => $OtherCharges,
"Discount" => 0, //$Discount,
"ServiceFee" => $ServiceFee,
"ManagementFeeTax" => $ManagementFeeTax,
"AirlineGSTComponent" => $AirlineGSTComponent,
"CarrierMiscFee" => $CarrierMiscFee,
"MUFee" => $MUFee,
"intPublishedFare" => $PublishedFareIN,
"PublishedFare" => ($intPublishedFare * $this->CurrencyRate),
"OfferedFare" => $intPublishedFare,
"CommissionEarned" => $CommissionEarned,
"PLBEarned" => $PLBEarned,
"IncentiveEarned" => $IncentiveEarned,
"TdsOnPLB" => $TdsOnPLB,
"TdsOnIncentive" => 0,
"AdditionalTxnFeeOfrd" => 0,
"AdditionalTxnFeePub" => 0,
"Refundable" => $Refundable,
"IsRefundableTxt" => $IsRefundableTxt,
"PriceID" => $PriceID,
"IsGSTRequired" => $IsGSTRequired,
"fareIdentifier" => str_replace('_', ' ', $fareIdentifier),
"FareClass" => $fareDetail['ADULT']['cc'],
"FixedMarkUp" => $intAgencyFixMarkUp,
"GSTOnMarkUp" => $intSTaxOnAgencyFixMarkUp,
"CommEarned" => $intCommisionEarnedForAgency,
"GSTonComm" => $intGSTOnAgencyCommisionEarned,
"intGTXMarkUp" => $intGTXMarkUp,
"GTXMarkUpGST" => $intSTaxOnGTXMarkUp,
"FareBreakdown" => $FareBreakdown,
);
}
}
// echo '<pre>';print_r($FairRulesArr);
$TotalLAYOVERMinutes = 0;
if ($SegmentInformation) {
foreach ($SegmentInformation as $segments) {
//echo '<pre>';print_r($segments);
$duration = $segments['duration'];
$LAYOVERMinutes = $GroundTime = isset($segments['cT']) ? $segments['cT'] : 0;
$LAYOVERCity = $LAYOVERCityArr[] = isset($segments['cT']) ? $segments['aa']['city'] : '';
$FlyingMinutes += ($duration + $LAYOVERMinutes);
$TotalLAYOVERMinutes += $LAYOVERMinutes;
$FareClass = $totalPriceList['fd']['ADULT']['cB'];
$strBaggage = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $totalPriceList['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
$AirlineCode = $segments['fD']['aI']['code'];
$AirlineName = $segments['fD']['aI']['name'];
$FlightNumber = $segments['fD']['fN'];
$SegFlightNumber = $AirlineCode . "-" . $FlightNumber;
$originAirportName = $segments['da']['name'];
$originAirportCode = $segments['da']['code'];
$originCityName = $segments['da']['city'];
$originCountryName = $segments['da']['country'];
$originDepTime = $segments['dt'];
$destinationAirportName = $segments['aa']['name'];
$destinationAirportCode = $segments['aa']['code'];
$destinationCityName = $segments['aa']['city'];
$destinationCountryName = $segments['aa']['country'];
$destinationArrTime = $segments['at'];
$DepTerminal = isset($segments['da']['terminal']) ? $segments['da']['terminal'] : '';
$ArrTerminal = isset($segments['aa']['terminal']) ? $segments['aa']['terminal'] : '';
$filePath = $this->getflightlogo($AirlineCode);
$LAYOVERDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->MinutesToHours($LAYOVERMinutes);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($destinationArrTime);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($originDepTime);
$strDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($duration);
$arrSegments[] = array(
"originAirportName" => $originAirportName,
"destinationAirportName" => $destinationAirportName,
"originCityName" => $originCityName,
"originCountryName" => $originCountryName,
"destinationCityName" => $destinationCityName,
"destinationCountryName" => $destinationCountryName,
"destinationAirportCode" => $destinationAirportCode,
"destinationAirportCode" => $destinationAirportCode,
"destinationArrTime" => $destinationArrTime,
"SegFlightNumber" => $SegFlightNumber,
"AirlineCode" => $AirlineCode,
"AirlineName" => $AirlineName,
"FareClass" => $FareClass,
"originAirportCode" => $originAirportCode,
"originDepTime" => $originDepTime,
"TripIndicator" => '', //$TripIndicator,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsBaggage" => $IsBaggage,
"IsMealIncludes" => $IsMealIncludes,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"filePath" => $filePath,
);
//echo '<pre>';print_r($arrSegments);
}
}
$LAYOVERTime = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($TotalLAYOVERMinutes);
$AirlineCode = $OriginSegments['fD']['aI']['code'];
$FlightNumber = $OriginSegments['fD']['fN'];
$strFlightNumber = $AirlineCode . "-" . $FlightNumber;
$strAirlineName = $OriginSegments['fD']['aI']['name'];
$IsLCC = $OriginSegments['fD']['aI']['isLcc'];
$strSourceAirportCode = $OriginSegments['da']['code'];
$strDestinationAirportCode = $DestinationSegments['aa']['code'];
$Stops = $DestinationSegments['sN'];
if ($Stops == 0) {
$StopCountTxt = "Non-stop";
} else {
$StopCountTxt = $Stops . " Stop(s)";
}
$filePath = $this->getflightlogo($AirlineCode);
$FlightDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($FlyingMinutes);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($DestinationSegments['at']);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($OriginSegments['dt']);
$airlineSysId = !empty($arrAirlineList[$AirlineCode]) ? $arrAirlineList[$AirlineCode] : '0';
$arrInsertFlightData[$key]['FlightNumber'] = $strFlightNumber;
$arrInsertFlightData[$key]['AirlineName'] = $strAirlineName;
$arrInsertFlightData[$key]['AirlineCode'] = $AirlineCode;
$arrInsertFlightData[$key]['AirInvenSysId'] = 0;
$arrInsertFlightData[$key]['IsLCC'] = $IsLCC;
$arrInsertFlightData[$key]['IsMealIncludes'] = $IsMealIncludes;
$arrInsertFlightData[$key]['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$key]['IsRefundable'] = $IsRefundable;
$arrInsertFlightData[$key]['IsRefundableTxt'] = $IsRefundableTxt;
$arrInsertFlightData[$key]['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['AirlineSysId'] = $airlineSysId;
$arrInsertFlightData[$key]['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$key]['ArrivalTime'] = $strArrivalDtTime;
$arrInsertFlightData[$key]['TravelDate'] = $OriginSegments['dt'];
$arrInsertFlightData[$key]['LocalFromTime'] = str_replace('T', ' ', $OriginSegments['dt']);
$arrInsertFlightData[$key]['FromUTCTime'] = $OriginSegments['dt'];
$arrInsertFlightData[$key]['LocalToTime'] = str_replace('T', ' ', $DestinationSegments['at']);
$arrInsertFlightData[$key]['ToUTCTime'] = $DestinationSegments['at'];
$arrInsertFlightData[$key]['IsDirect'] = 0;
$arrInsertFlightData[$key]['FareClass'] = $strFareClass;
$arrInsertFlightData[$key]['LAYOVERCity'] = isset($LAYOVERCityArr[0]) ? $LAYOVERCityArr[0] : '';
$arrInsertFlightData[$key]['GroundTime'] = $TotalLAYOVERMinutes;
$arrInsertFlightData[$key]['LAYOVERDuration'] = $LAYOVERTime;
$arrInsertFlightData[$key]['FlyingMinutes'] = $FlyingMinutes;
$arrInsertFlightData[$key]['DepartureDateTxt'] = date('D, d M', strtotime($OriginSegments['dt']));
$arrInsertFlightData[$key]['ArrivalDateTxt'] = date('D, d M', strtotime($DestinationSegments['at']));
$arrInsertFlightData[$key]['FlightDuration'] = $FlightDuration;
$arrInsertFlightData[$key]['SourcePlaceSysId'] = $intSourceCityId;
$arrInsertFlightData[$key]['DestPlaceSysId'] = $intDestinationCityId;
$arrInsertFlightData[$key]['SourceAirportCode'] = $strSourceAirportCode;
$arrInsertFlightData[$key]['DestAirportCode'] = $strDestinationAirportCode;
// $arrInsertFlightData[$key]['AirportHaultMinutes'] = $AirportHaultMinutes;
$arrInsertFlightData[$key]['StopCount'] = $StopCountTxt;
$arrInsertFlightData[$key]['Stops'] = $Stops;
$arrInsertFlightData[$key]['NoOfSeatAvailable'] = $NoOfSeatAvailable;
$arrInsertFlightData[$key]['TotalFlightMembers'] = $intMemberCount;
$arrInsertFlightData[$key]['CurrencyType'] = $this->CurrencyId;
$arrInsertFlightData[$key]['PublishedFare'] = ($PublishedFare * $this->CurrencyRate); // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFareTxt'] = number_format(($PublishedFare * $this->CurrencyRate)); // As Discussed with GG
// $arrInsertFlightData[$key]['CommissionEarned'] = $CommissionEarned;
$arrInsertFlightData[$key]['ApiResultIndex'] = $ResultIndex;
$arrInsertFlightData[$key]['JourneyType'] = $intJourneyType;
$arrInsertFlightData[$key]['TripType'] = $intTripType;
$arrInsertFlightData[$key]['IsInternational'] = $interNationalSearch;
$arrInsertFlightData[$key]['logo'] = $filePath;
$arrInsertFlightData[$key]['FairRules'] = $FairRulesArr;
$arrInsertFlightData[$key]['Segments'] = $arrSegments;
$arrAirlineName[] = $AirlineCode . '-' . $strAirlineName;
$AttPriceRange[] = $PublishedFare;
$FiltStopCount[] = $StopCountTxt;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
//$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_AED), ($PublishedFare * $this->CurrencyRate));
//$arrInsertFlightData[$key]['FilterPrice'] = $FilterPrice;
}
}
$RoundTrip = $this->FlightDataRoundTripJack($apiResponse);
$dddddddd = array_merge($dddddddd, $RoundTrip['dddddddd']);
sort($dddddddd);
if (array_values(array_unique($dddddddd))) {
foreach (array_values(array_unique($dddddddd)) as $Fares) {
if ($this->CurrencyTitle == 'INR') {
$CONST_PRICE_RANGE = unserialize(CONST_PRICE_RANGE_5000);
} else {
$CONST_PRICE_RANGE = unserialize(CONST_PRICE_RANGE_AED);
}
$FiltPriceRange[] = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue($CONST_PRICE_RANGE, round($Fares));
}
}
$FiltPriceRangeU = (array_unique($FiltPriceRange));
$ArrPriceUnique = array_unique(array_filter(array_values(array_merge($FiltPriceRangeU, $RoundTrip['ArrPriceUnique']))));
$arrAirlineName = array_values(array_unique(array_merge($arrAirlineName, $RoundTrip['arrAirlineName'])));
$FiltStopCount = array_values(array_unique(array_merge($FiltStopCount, $RoundTrip['FiltStopCount'])));
$MinriceRange = (min(array_merge($AttPriceRange, $RoundTrip['AttPriceRange'])));
$MaxriceRange = (max(array_merge($AttPriceRange, $RoundTrip['AttPriceRange'])));
if ($interNationalSearch == 1 && $strFlightRoute == 2) {
$RoundInterTrip = $this->FlightDataRoundTripInternational($apiResponse);
$MinriceRange = (min($RoundInterTrip['AttPriceRange']));
$MaxriceRange = (max($RoundInterTrip['AttPriceRange']));
$data = array('outbound' => $RoundInterTrip['outbound'], 'inbound' => [], 'arrAirlineName' => $RoundInterTrip['arrAirlineName'], 'FiltStopCount' => $RoundInterTrip['FiltStopCount'], 'ArrPriceUnique' => $RoundInterTrip['ArrPriceUnique'], 'MinriceRange' => round($MinriceRange), 'MaxriceRange' => round($MaxriceRange));
// echo '<pre>';
// print_r($RoundInterTrip);
// echo '</pre>';
// die;
} else {
// echo '<pre>';
// print_r($arrInsertFlightData);
// echo '</pre>';
$data = array('outbound' => $arrInsertFlightData, 'inbound' => $RoundTrip['inbound'], 'arrAirlineName' => $arrAirlineName, 'FiltStopCount' => $FiltStopCount, 'ArrPriceUnique' => $ArrPriceUnique, 'MinriceRange' => round($MinriceRange), 'MaxriceRange' => round($MaxriceRange));
}
echo json_encode($data);
exit;
} else {
$data = array('outbound' => [], 'inbound' => [], 'arrAirlineName' => [], 'FiltStopCount' => [], 'ArrPriceUnique' => []);
echo json_encode($data);
}
}
public function FlightDataRoundTripJack($apiResponse)
{
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$intSourceCityId = trim($sessionFlightSearchParams->params['sourceCityId']);
$intDestinationCityId = trim($sessionFlightSearchParams->params['destinationCityId']);
$interNationalSearch = trim($sessionFlightSearchParams->params['interNationalSearch']);
$adultCount = $sessionFlightSearchParams->params['adults'];
$childCount = $sessionFlightSearchParams->params['child'];
$infantCount = $sessionFlightSearchParams->params['infant'];
$intMemberCount = $adultCount + $childCount + $infantCount;
$strFlightRoute = trim($sessionFlightSearchParams->params['route']);
$intCountryCode = $sessionFlightSearchParams->params['intCountryCode'];
$intTatalPaxCT = $adultCount + $childCount;
$getMarkup = $this->getMarkup($intCountryCode);
$arrAirlineList = $this->getAirlineIdsAndCodeList();
$intJourneyType = 2;
$intTripType = 1;
$arrInsertFlightData = [];
$arrAirlineName = [];
$FiltStopCount = [];
$FiltPriceRange = [];
$AttPriceRange = [];
$dddddddd = [];
$intResponseStatus = $apiResponse['ResponseStatus'];
$RETURN = $apiResponse['InBoundFlightResults'];
if ($intResponseStatus == 1) {
if ($RETURN) {
foreach ($RETURN as $key => $result) {
$SegmentInformation = $result['sI'];
$totalPriceList = current($result['totalPriceList']);
$IsRefundable = $totalPriceList['fd']['ADULT']['rT'];
$NoOfSeatAvailable = $totalPriceList['fd']['ADULT']['sR'];
$strFareClass = $totalPriceList['fd']['ADULT']['cB'];
$IsMealIncludes = $totalPriceList['fd']['ADULT']['mI'];
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB'];
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if ($IsRefundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($IsRefundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$OriginSegments = current($SegmentInformation);
$DestinationSegments = end($SegmentInformation);
$arrSegments = [];
$FlyingMinutes = 0;
$TotalLAYOVERMinutes = 0;
$LAYOVERCityArr = [];
$PublishedFare = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
if ($result['totalPriceList']) {
foreach ($result['totalPriceList'] as $kp => $price) {
$fareDetail = $price['fd'];
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($Refundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($Refundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$ADULT = $fareDetail['ADULT']['fC']; //fare Components
$CHILD = isset($fareDetail['CHILD']['fC']) ? $fareDetail['CHILD']['fC'] : []; //fare Components
$INFANT = isset($fareDetail['INFANT']['fC']) ? $fareDetail['INFANT']['fC'] : []; //fare Components
$ADULTafC = $fareDetail['ADULT']['afC']['TAF']; //additional fareComponents
$CHILDafC = isset($fareDetail['CHILD']['afC']['TAF']) ? $fareDetail['CHILD']['afC']['TAF'] : []; //additional fareComponents
$INFANTafC = isset($fareDetail['INFANT']['afC']['TAF']) ? $fareDetail['INFANT']['afC']['TAF'] : []; //additional fareComponents
$ADULTNCMTDS = isset($fareDetail['ADULT']['afC']['NCM']['TDS ']) ? $fareDetail['ADULT']['afC']['NCM']['TDS '] : 0; //TDS
$CHILDNCMTDS = isset($fareDetail['CHILD']['afC']['NCM']['TDS ']) ? $fareDetail['CHILD']['afC']['NCM']['TDS '] : 0; //TDS
$INFANTNCMTDS = isset($fareDetail['INFANT']['afC']['NCM']['TDS ']) ? $fareDetail['INFANT']['afC']['NCM']['TDS '] : 0; //TDS
$AD_MF = isset($ADULTafC['MF']) ? $ADULTafC['MF'] : 0; //Management Fee
$AD_YQ = isset($ADULTafC['YQ']) ? $ADULTafC['YQ'] : 0; //Fuel Surcharge
$AD_AGST = isset($ADULTafC['AGST']) ? $ADULTafC['AGST'] : 0; //Airline GST Component
$AD_MFT = isset($ADULTafC['MFT']) ? $ADULTafC['MFT'] : 0; //Management Fee Tax
$AD_OT = isset($ADULTafC['OT']) ? $ADULTafC['OT'] : 0; //Other Charges
$AD_MU = isset($ADULTafC['MU']) ? $ADULTafC['MU'] : 0; //markup
$AD_YR = isset($ADULTafC['YR']) ? $ADULTafC['YR'] : 0; //Carrier Misc Fee
$CH_MF = isset($CHILDafC['MF']) ? $CHILDafC['MF'] : 0; //Management Fee
$CH_YQ = isset($CHILDafC['YQ']) ? $CHILDafC['YQ'] : 0; //Fuel Surcharge
$CH_AGST = isset($CHILDafC['AGST']) ? $CHILDafC['AGST'] : 0; //Airline GST Component
$CH_MFT = isset($CHILDafC['MFT']) ? $CHILDafC['MFT'] : 0; //Management Fee Tax
$CH_OT = isset($CHILDafC['OT']) ? $CHILDafC['OT'] : 0; //Other Charges
$CH_MU = isset($CHILDafC['MU']) ? $CHILDafC['MU'] : 0; //markup
$CH_YR = isset($CHILDafC['YR']) ? $CHILDafC['YR'] : 0; //Carrier Misc Fee
$IN_MF = isset($INFANTafC['MF']) ? $INFANTafC['MF'] : 0; //Management Fee
$IN_YQ = isset($INFANTafC['YQ']) ? $INFANTafC['YQ'] : 0; //Fuel Surcharge
$IN_AGST = isset($INFANTafC['AGST']) ? $INFANTafC['AGST'] : 0; //Airline GST Component
$IN_MFT = isset($INFANTafC['MFT']) ? $INFANTafC['MFT'] : 0; //Management Fee Tax
$IN_OT = isset($INFANTafC['OT']) ? $INFANTafC['OT'] : 0; //Other Charges
$IN_MU = isset($INFANTafC['MU']) ? $INFANTafC['MU'] : 0; //markup
$IN_YR = isset($INFANTafC['YR']) ? $INFANTafC['YR'] : 0; //Carrier Misc Fee
if ($kp == 0) {
$PublishedFare += (($ADULT['TF'] * $adultCount) + ($CHILD['TF'] * $childCount) + ($INFANT['TF'] * $infantCount)); //Total Fare
$BaseFare += (($ADULT['BF'] * $adultCount) + ($CHILD['BF'] * $childCount) + ($INFANT['BF'] * $infantCount)); //Base Fare
$Tax += (($ADULT['TAF'] * $adultCount) + ($CHILD['TAF'] * $childCount) + ($INFANT['TAF'] * $infantCount)); //Taxes and Fees
}
$PublishedFareIN = (($ADULT['TF'] * $adultCount) + ($CHILD['TF'] * $childCount) + ($INFANT['TF'] * $infantCount)); //Total Fare
$BaseFareIN = (($ADULT['BF'] * $adultCount) + ($CHILD['BF'] * $childCount) + ($INFANT['BF'] * $infantCount)); //Base Fare
$TaxIN = (($ADULT['TAF'] * $adultCount) + ($CHILD['TAF'] * $childCount) + ($INFANT['TAF'] * $infantCount)); //Taxes and Fees
$NetFare = (($ADULT['NF'] * $adultCount) + ($CHILD['NF'] * $childCount) + ($INFANT['NF'] * $infantCount)); //Taxes and Fees
$NetCommission = (($ADULT['NCM'] * $adultCount) + ($CHILD['NCM'] * $childCount) + ($INFANT['NCM'] * $infantCount)); //Taxes and Fees
//echo '<pre>';print_r(($ADULTafC));
$YQTax = (($AD_YQ * $adultCount) + ($CH_YQ * $childCount) + ($IN_YQ * $infantCount));
$OtherCharges = (($AD_OT * $adultCount) + ($CH_OT * $childCount) + ($IN_OT * $infantCount));
$ServiceFee = (($AD_MF * $adultCount) + ($CH_MF * $childCount) + ($IN_MF * $infantCount));
$ManagementFeeTax = (($AD_MFT * $adultCount) + ($CH_MFT * $childCount) + ($IN_MFT * $infantCount));
$AirlineGSTComponent = (($AD_AGST * $adultCount) + ($CH_AGST * $childCount) + ($IN_AGST * $infantCount));
$CarrierMiscFee = (($AD_YR * $adultCount) + ($CH_YR * $childCount) + ($IN_YR * $infantCount));
$MUFee = (($AD_MU * $adultCount) + ($CH_MU * $childCount) + ($IN_MU * $infantCount));
$TdsOnPLB = (($ADULTNCMTDS * $adultCount) + ($CHILDNCMTDS * $childCount) + ($INFANTNCMTDS * $infantCount));
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $OfferedFare,
'intCommissionEarned' => $CommissionEarned,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
);
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkupTripJack($markUpArr);
$AgencyMarkUp = $arrMarkUps['intAgencyFixMarkUp'];
$intGTXMarkUp = $arrMarkUps['intGTXMarkUp'];
$intFareWithGTXMarkUp = $arrMarkUps['intFareWithGTXMarkUp'];
$intOfferedFare = $arrMarkUps['intOfferedFare'];
if ($interNationalSearch == 1) {
$intGTXMarkUp = (($arrMarkUps['intGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnGTXMarkUp = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intAgencyFixMarkUp = (($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUp = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
} else {
$intGTXMarkUp = ($arrMarkUps['intGTXMarkUp'] * $intMemberCount);
$intSTaxOnGTXMarkUp = ($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount);
$intAgencyFixMarkUp = ($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount);
$intSTaxOnAgencyFixMarkUp = ($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount);
}
$intCommisionEarnedForAgency = $arrMarkUps['intCommisionEarnedForAgency'];
$intPLBEarnedForAgency = $arrMarkUps['intPLBEarnedForAgency'];
$intIncentiveEarnedForAgency = $arrMarkUps['intIncentiveEarnedForAgency'];
$intTotalEarningsForAgency = $arrMarkUps['intTotalEarningsForAgency'] + $intAgencyFixMarkUp;
$intGSTOnAgencyCommisionEarned = $arrMarkUps['intGSTOnAgencyCommisionEarned'];
$intGSTOnAgencyPLBEarned = $arrMarkUps['intGSTOnAgencyPLBEarned'];
$intGSTOnAgencyIncentiveEarned = $arrMarkUps['intGSTOnAgencyIncentiveEarned'];
$intTotalGSTAgencyEarnings = $intSTaxOnAgencyFixMarkUp + $intGSTOnAgencyCommisionEarned + $intGSTOnAgencyPLBEarned + $intGSTOnAgencyIncentiveEarned;
$intPublishedFare = $intOfferedFare + $intGTXMarkUp + $intAgencyFixMarkUp + $intCommisionEarnedForAgency + $intPLBEarnedForAgency + $intIncentiveEarnedForAgency + $intTotalGSTAgencyEarnings;
$intTotalDisCount = $CommissionEarned + $PLBEarned + $IncentiveEarned;
$intDiscountPerHead = $intTotalDisCount / $intTatalPaxCT;
$intDiscountPerHead = ($intDiscountPerHead * $adultCount);
$intBaseFareCal = ($ADULT['BF'] * $adultCount) - $intDiscountPerHead;
$intAdultFareOffered = $intBaseFareCal + ($ADULT['TAF'] * $adultCount);
$intTotalOfferedForAllPax = $intAdultFareOffered;
$intBaseFareAllPax = $intBaseFareCal;
if ($interNationalSearch == 1) {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
} else {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount));
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount));
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount));
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount));
}
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($intBaseFareCal);
$FareBreakdown[0]['BaseFare'] = ($ADULT['BF'] * $adultCount);
$FareBreakdown[0]['CommissionEarned'] = ($ADULT['NCM'] * $adultCount);
$FareBreakdown[0]['TDS'] = ($ADULTNCMTDS * $adultCount);
$FareBreakdown[0]['MF'] = ($AD_MF * $adultCount);
$FareBreakdown[0]['YQ'] = ($AD_YQ * $adultCount);
$FareBreakdown[0]['AGST'] = ($AD_AGST * $adultCount);
$FareBreakdown[0]['MFT'] = ($AD_MFT * $adultCount);
$FareBreakdown[0]['OT'] = ($AD_OT * $adultCount);
$FareBreakdown[0]['MU'] = ($AD_MU * $adultCount);
$FareBreakdown[0]['YR'] = ($AD_YR * $adultCount);
$FareBreakdown[0]['FixedMarkUp'] = $intAgencyFixMarkUpA;
$FareBreakdown[0]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpA;
$FareBreakdown[0]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[0]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[0]['intGTXMarkUp'] = $intGTXMarkUpA;
$FareBreakdown[0]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpA;
$FareBreakdown[0]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[0]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[0]['PGCharge'] = 0;
$FareBreakdown[0]['Baggage'] = isset($fareDetail['ADULT']['bI']['iB']) ? $fareDetail['ADULT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[0]['CabinBaggage'] = isset($fareDetail['ADULT']['bI']['cB']) ? $fareDetail['ADULT']['bI']['cB'] : []; //Cabin Baggage ;
if (isset($fareDetail['CHILD'])) {
$intDiscountPerHead = ($intDiscountPerHead * $childCount);
$intBaseFareCal = ($CHILD['BF'] * $childCount) - $intDiscountPerHead;
$intChildFareOffered = $intBaseFareCal + ($CHILD['TAF'] * $childCount);
$intBaseFareAllPax = $intBaseFareAllPax + $intBaseFareCal;
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intChildFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount) * $strFlightRoute);
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
} else {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount));
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount));
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount));
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount));
}
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($CHILD['BF'] * $childCount);
$FareBreakdown[1]['BaseFare'] = ($intBaseFareCal);
$FareBreakdown[1]['CommissionEarned'] = ($CHILD['NCM'] * $childCount);
$FareBreakdown[1]['TDS'] = ($CHILDNCMTDS * $childCount);
$FareBreakdown[1]['MF'] = ($CH_MF * $childCount);
$FareBreakdown[1]['YQ'] = ($CH_YQ * $childCount);
$FareBreakdown[1]['AGST'] = ($CH_AGST * $childCount);
$FareBreakdown[1]['MFT'] = ($CH_MFT * $childCount);
$FareBreakdown[1]['OT'] = ($CH_OT * $childCount);
$FareBreakdown[1]['MU'] = ($CH_MU * $childCount);
$FareBreakdown[1]['YR'] = ($CH_YR * $childCount);
$FareBreakdown[1]['FixedMarkUp'] = $intAgencyFixMarkUpC;
$FareBreakdown[1]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpC;
$FareBreakdown[1]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[1]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[1]['intGTXMarkUp'] = $intGTXMarkUpC;
$FareBreakdown[1]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpC;
$FareBreakdown[1]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[1]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[1]['PGCharge'] = 0;
$FareBreakdown[1]['Baggage'] = isset($fareDetail['CHILD']['bI']['iB']) ? $fareDetail['CHILD']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[1]['CabinBaggage'] = isset($fareDetail['CHILD']['bI']['cB']) ? $fareDetail['CHILD']['bI']['cB'] : []; //Cabin Baggage ;
}
if (isset($fareDetail['INFANT'])) {
$intInfantFareOffered = ($INFANT['BF'] * $infantCount) + ($INFANT['TAF'] * $infantCount);
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intInfantFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
} else {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount));
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount));
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount));
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount));
}
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['BaseFare'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['CommissionEarned'] = ($INFANT['NCM'] * $infantCount);
$FareBreakdown[2]['TDS'] = ($INFANTNCMTDS * $infantCount);
$FareBreakdown[2]['MF'] = ($IN_MF * $infantCount);
$FareBreakdown[2]['YQ'] = ($IN_YQ * $infantCount);
$FareBreakdown[2]['AGST'] = ($IN_AGST * $infantCount);
$FareBreakdown[2]['OT'] = ($IN_OT * $infantCount);
$FareBreakdown[2]['MFT'] = ($IN_MFT * $infantCount);
$FareBreakdown[2]['MU'] = ($IN_MU * $infantCount);
$FareBreakdown[2]['YR'] = ($IN_YR * $infantCount);
$FareBreakdown[2]['FixedMarkUp'] = $intAgencyFixMarkUpI;
$FareBreakdown[2]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpI;
$FareBreakdown[2]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[2]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[2]['intGTXMarkUp'] = $intGTXMarkUpI;
$FareBreakdown[2]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpI;
$FareBreakdown[2]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[2]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[2]['PGCharge'] = 0;
$FareBreakdown[2]['Baggage'] = isset($fareDetail['INFANT']['bI']['iB']) ? $fareDetail['INFANT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[2]['CabinBaggage'] = isset($fareDetail['INFANT']['bI']['cB']) ? $fareDetail['INFANT']['bI']['cB'] : []; //Cabin Baggage ;
}
//echo '<pre>';print_r($price);
$FairRulesArr[$kp] = array(
"Currency" => $this->CurrencyTitle, //$Currency,
"CurrencyRate" => $this->CurrencyRate, //$Currency,
"currencySysId" => $this->CurrencyId,
"BaseFare" => $BaseFareIN,
"Tax" => $TaxIN,
"YQTax" => $YQTax,
"OtherCharges" => $OtherCharges,
"Discount" => 0, //$Discount,
"ServiceFee" => $ServiceFee,
"ManagementFeeTax" => $ManagementFeeTax,
"AirlineGSTComponent" => $AirlineGSTComponent,
"CarrierMiscFee" => $CarrierMiscFee,
"MUFee" => $MUFee,
"intPublishedFare" => $PublishedFareIN,
"PublishedFare" => ($intPublishedFare * $this->CurrencyRate),
"OfferedFare" => $intPublishedFare,
"CommissionEarned" => $CommissionEarned,
"PLBEarned" => $PLBEarned,
"IncentiveEarned" => $IncentiveEarned,
"TdsOnPLB" => $TdsOnPLB,
"TdsOnIncentive" => 0,
"AdditionalTxnFeeOfrd" => 0,
"AdditionalTxnFeePub" => 0,
"Refundable" => $Refundable,
"IsRefundableTxt" => $IsRefundableTxt,
"PriceID" => $PriceID,
"IsGSTRequired" => $IsGSTRequired,
"fareIdentifier" => str_replace('_', ' ', $fareIdentifier),
"FareClass" => $fareDetail['ADULT']['cc'],
"FixedMarkUp" => $intAgencyFixMarkUp,
"GSTOnMarkUp" => $intSTaxOnAgencyFixMarkUp,
"CommEarned" => $intCommisionEarnedForAgency,
"GSTonComm" => $intGSTOnAgencyCommisionEarned,
"intGTXMarkUp" => $intGTXMarkUp,
"GTXMarkUpGST" => $intSTaxOnGTXMarkUp,
"FareBreakdown" => $FareBreakdown,
);
}
}
if ($SegmentInformation) {
foreach ($SegmentInformation as $segments) {
//echo '<pre>';print_r($segments);
$duration = $segments['duration'];
$LAYOVERMinutes = $GroundTime = isset($segments['cT']) ? $segments['cT'] : 0;
$LAYOVERCity = $LAYOVERCityArr[] = isset($segments['cT']) ? $segments['aa']['city'] : '';
$FlyingMinutes += ($duration + $LAYOVERMinutes);
$TotalLAYOVERMinutes += $LAYOVERMinutes;
$FareClass = $totalPriceList['fd']['ADULT']['cB'];
$strBaggage = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $totalPriceList['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
$AirlineCode = $segments['fD']['aI']['code'];
$AirlineName = $segments['fD']['aI']['name'];
$FlightNumber = $segments['fD']['fN'];
$SegFlightNumber = $AirlineCode . "-" . $FlightNumber;
$originAirportName = $segments['da']['name'];
$originAirportCode = $segments['da']['code'];
$originCityName = $segments['da']['city'];
$originCountryName = $segments['da']['country'];
$originDepTime = $segments['dt'];
$destinationAirportName = $segments['aa']['name'];
$destinationAirportCode = $segments['aa']['code'];
$destinationCityName = $segments['aa']['city'];
$destinationCountryName = $segments['aa']['country'];
$destinationArrTime = $segments['at'];
$DepTerminal = isset($segments['da']['terminal']) ? $segments['da']['terminal'] : '';
$ArrTerminal = isset($segments['aa']['terminal']) ? $segments['aa']['terminal'] : '';
$filePath = $this->getflightlogo($AirlineCode);
$LAYOVERDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->MinutesToHours($LAYOVERMinutes);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($destinationArrTime);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($originDepTime);
$strDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($duration);
$arrSegments[] = array(
"originAirportName" => $originAirportName,
"destinationAirportName" => $destinationAirportName,
"originCityName" => $originCityName,
"originCountryName" => $originCountryName,
"destinationCityName" => $destinationCityName,
"destinationCountryName" => $destinationCountryName,
"destinationAirportCode" => $destinationAirportCode,
"destinationAirportCode" => $destinationAirportCode,
"destinationArrTime" => $destinationArrTime,
"SegFlightNumber" => $SegFlightNumber,
"AirlineCode" => $AirlineCode,
"AirlineName" => $AirlineName,
"FareClass" => $FareClass,
"originAirportCode" => $originAirportCode,
"originDepTime" => $originDepTime,
"TripIndicator" => '', //$TripIndicator,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsBaggage" => $IsBaggage,
"IsMealIncludes" => $IsMealIncludes,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"filePath" => $filePath,
);
}
}
$LAYOVERTime = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($TotalLAYOVERMinutes);
$AirlineCode = $OriginSegments['fD']['aI']['code'];
$FlightNumber = $OriginSegments['fD']['fN'];
$strFlightNumber = $AirlineCode . "-" . $FlightNumber;
$strAirlineName = $OriginSegments['fD']['aI']['name'];
$IsLCC = $OriginSegments['fD']['aI']['isLcc'];
$strSourceAirportCode = $OriginSegments['da']['code'];
$strDestinationAirportCode = $DestinationSegments['aa']['code'];
$Stops = $DestinationSegments['sN'];
if ($Stops == 0) {
$StopCountTxt = "Non-stop";
} else {
$StopCountTxt = $Stops . " Stop(s)";
}
$filePath = $this->getflightlogo($AirlineCode);
$FlightDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($FlyingMinutes);
//$FlightDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($FlyingMinutes);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($DestinationSegments['at']);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($OriginSegments['dt']);
$airlineSysId = !empty($arrAirlineList[$AirlineCode]) ? $arrAirlineList[$AirlineCode] : '0';
$arrInsertFlightData[$key]['FlightNumber'] = $strFlightNumber;
$arrInsertFlightData[$key]['AirlineName'] = $strAirlineName;
$arrInsertFlightData[$key]['AirlineCode'] = $AirlineCode;
// $arrInsertFlightData[$key]['AirInvenSysId'] = 0;
$arrInsertFlightData[$key]['IsLCC'] = $IsLCC;
$arrInsertFlightData[$key]['IsMealIncludes'] = $IsMealIncludes;
$arrInsertFlightData[$key]['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$key]['IsRefundable'] = $IsRefundable;
$arrInsertFlightData[$key]['IsRefundableTxt'] = $IsRefundableTxt;
$arrInsertFlightData[$key]['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['AirlineSysId'] = $airlineSysId;
$arrInsertFlightData[$key]['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$key]['ArrivalTime'] = $strArrivalDtTime;
$arrInsertFlightData[$key]['TravelDate'] = $OriginSegments['dt'];
$arrInsertFlightData[$key]['LocalFromTime'] = str_replace('T', ' ', $OriginSegments['dt']);
$arrInsertFlightData[$key]['FromUTCTime'] = $OriginSegments['dt'];
$arrInsertFlightData[$key]['LocalToTime'] = str_replace('T', ' ', $DestinationSegments['at']);
$arrInsertFlightData[$key]['ToUTCTime'] = $DestinationSegments['at'];
$arrInsertFlightData[$key]['IsDirect'] = 0;
$arrInsertFlightData[$key]['FareClass'] = $strFareClass;
// $arrInsertFlightData[$key]['DayLightSavingDiff'] = $DayLightSavingDiff;
$arrInsertFlightData[$key]['LAYOVERCity'] = isset($LAYOVERCityArr[0]) ? $LAYOVERCityArr[0] : '';
$arrInsertFlightData[$key]['GroundTime'] = $TotalLAYOVERMinutes;
$arrInsertFlightData[$key]['LAYOVERDuration'] = $LAYOVERTime;
$arrInsertFlightData[$key]['FlyingMinutes'] = $FlyingMinutes;
$arrInsertFlightData[$key]['DepartureDateTxt'] = date('D, d M', strtotime($OriginSegments['dt']));
$arrInsertFlightData[$key]['ArrivalDateTxt'] = date('D, d M', strtotime($DestinationSegments['at']));
$arrInsertFlightData[$key]['FlightDuration'] = $FlightDuration;
$arrInsertFlightData[$key]['SourcePlaceSysId'] = $intSourceCityId;
$arrInsertFlightData[$key]['DestPlaceSysId'] = $intDestinationCityId;
$arrInsertFlightData[$key]['SourceAirportCode'] = $strSourceAirportCode;
$arrInsertFlightData[$key]['DestAirportCode'] = $strDestinationAirportCode;
// $arrInsertFlightData[$key]['AirportHaultMinutes'] = $AirportHaultMinutes;
$arrInsertFlightData[$key]['StopCount'] = $StopCountTxt;
$arrInsertFlightData[$key]['Stops'] = $Stops;
$arrInsertFlightData[$key]['NoOfSeatAvailable'] = $NoOfSeatAvailable;
$arrInsertFlightData[$key]['TotalFlightMembers'] = $intMemberCount;
$arrInsertFlightData[$key]['CurrencyType'] = $this->CurrencyId;
$arrInsertFlightData[$key]['PublishedFare'] = ($PublishedFare * $this->CurrencyRate); // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFareTxt'] = number_format(($PublishedFare * $this->CurrencyRate)); // As Discussed with GG
// $arrInsertFlightData[$key]['CommissionEarned'] = $CommissionEarned;
$arrInsertFlightData[$key]['ApiResultIndex'] = $ResultIndex;
$arrInsertFlightData[$key]['JourneyType'] = $intJourneyType;
$arrInsertFlightData[$key]['TripType'] = $intTripType;
$arrInsertFlightData[$key]['IsInternational'] = $interNationalSearch;
$arrInsertFlightData[$key]['logo'] = $filePath;
$arrInsertFlightData[$key]['FairRules'] = $FairRulesArr;
$arrInsertFlightData[$key]['Segments'] = $arrSegments;
$arrAirlineName[] = $AirlineCode . '-' . $strAirlineName;
$AttPriceRange[] = $PublishedFare;
$FiltStopCount[] = $StopCountTxt;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
//$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_AED), ($PublishedFare * $this->CurrencyRate));
//$arrInsertFlightData[$key]['FilterPrice'] = $FilterPrice;
}
}
sort($dddddddd);
if (array_values(array_unique($dddddddd))) {
foreach (array_values(array_unique($dddddddd)) as $Fares) {
if ($this->CurrencyTitle == 'INR') {
$CONST_PRICE_RANGE = unserialize(CONST_PRICE_RANGE_5000);
} else {
$CONST_PRICE_RANGE = unserialize(CONST_PRICE_RANGE_AED);
}
$FiltPriceRange[] = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue($CONST_PRICE_RANGE, round($Fares));
}
}
$FiltPriceRangeU = (array_unique($FiltPriceRange));
$arrAirlineName = array_unique($arrAirlineName);
$FiltStopCount = array_unique($FiltStopCount);
$AttPriceRange = array_unique($AttPriceRange);
$data = array('inbound' => $arrInsertFlightData, 'dddddddd' => $dddddddd, 'arrAirlineName' => $arrAirlineName, 'FiltStopCount' => $FiltStopCount, 'ArrPriceUnique' => $FiltPriceRangeU, 'AttPriceRange' => $AttPriceRange);
return ($data);
} else {
return false;
}
}
public function FlightDataRoundTripInternational($apiResponse)
{
$intResponseStatus = !empty($apiResponse['ResponseStatus']) ? $apiResponse['ResponseStatus'] : '0';
if ($intResponseStatus == 1) {
$arrAirlineList = $this->getAirlineIdsAndCodeList();
// For getting All currency Array
$arrCurrencyList = $this->getCurrencyIdsAndSymbolList();
$arrAirlineList = $this->getAirlineIdsAndCodeList();
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$strFlightRoute = trim($sessionFlightSearchParams->params['route']);
$strTraceId = !empty($apiResponse['TraceId']) ? $apiResponse['TraceId'] : '';
$strDepatureDate = $sessionFlightSearchParams->params['departure_dates'];
$strReturnDate = !empty($sessionFlightSearchParams->params['return_dates']) ? $sessionFlightSearchParams->params['return_dates'] : '';
$interNationalSearch = trim($sessionFlightSearchParams->params['interNationalSearch']);
$strSourceAirportCode = $sessionFlightSearchParams->params['from'];
$strDestinationAirportCode = $sessionFlightSearchParams->params['to'];
$adultCount = $sessionFlightSearchParams->params['adults'];
$childCount = $sessionFlightSearchParams->params['child'];
$infantCount = $sessionFlightSearchParams->params['infant'];
$intMemberCount = $adultCount + $childCount + $infantCount;
$strFlightRoute = trim($sessionFlightSearchParams->params['route']);
$intCountryCode = $sessionFlightSearchParams->params['intCountryCode'];
$intTatalPaxCT = $adultCount + $childCount;
$getMarkup = $this->getMarkup($intCountryCode);
$intSourceCityId = trim($sessionFlightSearchParams->params['sourceCityId']);
$intDestinationCityId = trim($sessionFlightSearchParams->params['destinationCityId']);
$arrDepatureDate = explode("/", $strDepatureDate);
if (count($arrDepatureDate) > 0) {
$strDepatureDate = $arrDepatureDate[2] . "-" . $arrDepatureDate[1] . "-" . $arrDepatureDate[0];
}
if (!empty($strReturnDate)) {
$arrReturnDepatureDate = explode("/", $strReturnDate);
if (count($arrReturnDepatureDate) > 0) {
$strReturnDate = $arrReturnDepatureDate[2] . "-" . $arrReturnDepatureDate[1] . "-" . $arrReturnDepatureDate[0];
}
}
$localFromDateTime = date("Y-m-d h:i", strtotime($strDepatureDate));
$localToDateTime = date("Y-m-d h:i", strtotime($strReturnDate));
$arrCommonInsVariables = array(
'strTraceId' => $strTraceId,
'localFromDateTime' => $localFromDateTime,
'localToDateTime' => $localToDateTime,
'strSourceAirportCode' => $strSourceAirportCode,
'strDestinationAirportCode' => $strDestinationAirportCode,
'intMemberCount' => $intMemberCount,
'intSourceCityId' => $intSourceCityId,
'intDestinationCityId' => $intDestinationCityId,
'JourneyType' => 2, // For Round Trips API Search
'TripType' => 1,
'interNationalSearch' => isset($interNationalSearch) ? $interNationalSearch : 0
);
$strTraceId = $arrCommonInsVariables['strTraceId'];
$localFromDateTime = $arrCommonInsVariables['localFromDateTime'];
$localToDateTime = $arrCommonInsVariables['localToDateTime'];
$strSourceAirportCode = $arrCommonInsVariables['strSourceAirportCode'];
$strDestinationAirportCode = $arrCommonInsVariables['strDestinationAirportCode'];
$intMemberCount = $arrCommonInsVariables['intMemberCount'];
$intSourceCityId = $arrCommonInsVariables['intSourceCityId'];
$intDestinationCityId = $arrCommonInsVariables['intDestinationCityId'];
$intJourneyType = $arrCommonInsVariables['JourneyType'];
$intTripType = $arrCommonInsVariables['TripType'];
$interNationalSearch = isset($arrCommonInsVariables['interNationalSearch']) ? $arrCommonInsVariables['interNationalSearch'] : '0';
$DayLightSavingDiff = 0;
$AirportHaultMinutes = 0;
$arrInsertFlightData = [];
$arrAirlineName = [];
$FiltStopCount = [];
$DesFiltStopCount = [];
$AttPriceRange = [];
$FiltPriceRange = [];
$dddddddd = [];
// echo json_encode(current($apiResponse['OutBoundFlightResults']));die;
foreach ($apiResponse['OutBoundFlightResults'] as $key => $result) {
$SegmentInformation = $result['sI'];
$totalPriceList = $result['totalPriceList'];
$totalPriceList = current($result['totalPriceList']);
$IsRefundable = $totalPriceList['fd']['ADULT']['rT'];
$NoOfSeatAvailable = $totalPriceList['fd']['ADULT']['sR'];
$strFareClass = $totalPriceList['fd']['ADULT']['cB']; //Cabin Baggage
$IsMealIncludes = $totalPriceList['fd']['ADULT']['mI'];
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Check In Baggage
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if ($IsRefundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($IsRefundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$TempArr = [];
if ($SegmentInformation) {
$tp = 0;
foreach ($SegmentInformation as $k => $Segmentsss) {
$isReturnSegment = isset($Segmentsss['isRs']) ? $Segmentsss['isRs'] : false;
if (!$isReturnSegment) {
$TempArr['onward'][$k] = $Segmentsss;
} else {
$TempArr['return'][$k] = $Segmentsss;
}
}
}
//echo '<pre>';print_r($TempArr['onward']);
$OriginOnward = current($TempArr['onward']);
$DestinationOnward = end($TempArr['onward']);
$arrSegments = [];
$FlyingMinutes = 0;
$TotalLAYOVERMinutes = 0;
$LAYOVERCityArr = [];
$PublishedFare = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
if ($result['totalPriceList']) {
foreach ($result['totalPriceList'] as $kp => $price) {
$fareDetail = $price['fd'];
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($Refundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($Refundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$ADULT = $fareDetail['ADULT']['fC']; //fare Components
$CHILD = isset($fareDetail['CHILD']['fC']) ? $fareDetail['CHILD']['fC'] : []; //fare Components
$INFANT = isset($fareDetail['INFANT']['fC']) ? $fareDetail['INFANT']['fC'] : []; //fare Components
$ADULTafC = $fareDetail['ADULT']['afC']['TAF']; //additional fareComponents
$CHILDafC = isset($fareDetail['CHILD']['afC']['TAF']) ? $fareDetail['CHILD']['afC']['TAF'] : []; //additional fareComponents
$INFANTafC = isset($fareDetail['INFANT']['afC']['TAF']) ? $fareDetail['INFANT']['afC']['TAF'] : []; //additional fareComponents
$ADULTNCMTDS = isset($fareDetail['ADULT']['afC']['NCM']['TDS ']) ? $fareDetail['ADULT']['afC']['NCM']['TDS '] : 0; //TDS
$CHILDNCMTDS = isset($fareDetail['CHILD']['afC']['NCM']['TDS ']) ? $fareDetail['CHILD']['afC']['NCM']['TDS '] : 0; //TDS
$INFANTNCMTDS = isset($fareDetail['INFANT']['afC']['NCM']['TDS ']) ? $fareDetail['INFANT']['afC']['NCM']['TDS '] : 0; //TDS
$AD_MF = isset($ADULTafC['MF']) ? $ADULTafC['MF'] : 0; //Management Fee
$AD_YQ = isset($ADULTafC['YQ']) ? $ADULTafC['YQ'] : 0; //Fuel Surcharge
$AD_AGST = isset($ADULTafC['AGST']) ? $ADULTafC['AGST'] : 0; //Airline GST Component
$AD_MFT = isset($ADULTafC['MFT']) ? $ADULTafC['MFT'] : 0; //Management Fee Tax
$AD_OT = isset($ADULTafC['OT']) ? $ADULTafC['OT'] : 0; //Other Charges
$AD_MU = isset($ADULTafC['MU']) ? $ADULTafC['MU'] : 0; //markup
$AD_YR = isset($ADULTafC['YR']) ? $ADULTafC['YR'] : 0; //Carrier Misc Fee
$CH_MF = isset($CHILDafC['MF']) ? $CHILDafC['MF'] : 0; //Management Fee
$CH_YQ = isset($CHILDafC['YQ']) ? $CHILDafC['YQ'] : 0; //Fuel Surcharge
$CH_AGST = isset($CHILDafC['AGST']) ? $CHILDafC['AGST'] : 0; //Airline GST Component
$CH_MFT = isset($CHILDafC['MFT']) ? $CHILDafC['MFT'] : 0; //Management Fee Tax
$CH_OT = isset($CHILDafC['OT']) ? $CHILDafC['OT'] : 0; //Other Charges
$CH_MU = isset($CHILDafC['MU']) ? $CHILDafC['MU'] : 0; //markup
$CH_YR = isset($CHILDafC['YR']) ? $CHILDafC['YR'] : 0; //Carrier Misc Fee
$IN_MF = isset($INFANTafC['MF']) ? $INFANTafC['MF'] : 0; //Management Fee
$IN_YQ = isset($INFANTafC['YQ']) ? $INFANTafC['YQ'] : 0; //Fuel Surcharge
$IN_AGST = isset($INFANTafC['AGST']) ? $INFANTafC['AGST'] : 0; //Airline GST Component
$IN_MFT = isset($INFANTafC['MFT']) ? $INFANTafC['MFT'] : 0; //Management Fee Tax
$IN_OT = isset($INFANTafC['OT']) ? $INFANTafC['OT'] : 0; //Other Charges
$IN_MU = isset($INFANTafC['MU']) ? $INFANTafC['MU'] : 0; //markup
$IN_YR = isset($INFANTafC['YR']) ? $INFANTafC['YR'] : 0; //Carrier Misc Fee
// $PublishedFare += ($ADULT['TF'] + $CHILD['TF'] + $INFANT['TF']); //Total Fare
// $BaseFare += ($ADULT['BF'] + $CHILD['BF'] + $INFANT['BF']); //Base Fare
// $Tax += ($ADULT['TAF'] + $CHILD['TAF'] + $INFANT['TAF']); //Taxes and Fees
if ($kp == 0) {
$PublishedFare += (($ADULT['TF'] * $adultCount) + ($CHILD['TF'] * $childCount) + ($INFANT['TF'] * $infantCount)); //Total Fare
$BaseFare += (($ADULT['BF'] * $adultCount) + ($CHILD['BF'] * $childCount) + ($INFANT['BF'] * $infantCount)); //Base Fare
$Tax += (($ADULT['TAF'] * $adultCount) + ($CHILD['TAF'] * $childCount) + ($INFANT['TAF'] * $infantCount)); //Taxes and Fees
}
$PublishedFareIN = (($ADULT['TF'] * $adultCount) + ($CHILD['TF'] * $childCount) + ($INFANT['TF'] * $infantCount)); //Total Fare
$BaseFareIN = (($ADULT['BF'] * $adultCount) + ($CHILD['BF'] * $childCount) + ($INFANT['BF'] * $infantCount)); //Base Fare
$TaxIN = (($ADULT['TAF'] * $adultCount) + ($CHILD['TAF'] * $childCount) + ($INFANT['TAF'] * $infantCount)); //Taxes and Fees
$NetFare = (($ADULT['NF'] * $adultCount) + ($CHILD['NF'] * $childCount) + ($INFANT['NF'] * $infantCount)); //Taxes and Fees
$NetCommission = (($ADULT['NCM'] * $adultCount) + ($CHILD['NCM'] * $childCount) + ($INFANT['NCM'] * $infantCount)); //Taxes and Fees
//echo '<pre>';print_r(($ADULTafC));
$YQTax = (($AD_YQ * $adultCount) + ($CH_YQ * $childCount) + ($IN_YQ * $infantCount));
$OtherCharges = (($AD_OT * $adultCount) + ($CH_OT * $childCount) + ($IN_OT * $infantCount));
$ServiceFee = (($AD_MF * $adultCount) + ($CH_MF * $childCount) + ($IN_MF * $infantCount));
$ManagementFeeTax = (($AD_MFT * $adultCount) + ($CH_MFT * $childCount) + ($IN_MFT * $infantCount));
$AirlineGSTComponent = (($AD_AGST * $adultCount) + ($CH_AGST * $childCount) + ($IN_AGST * $infantCount));
$CarrierMiscFee = (($AD_YR * $adultCount) + ($CH_YR * $childCount) + ($IN_YR * $infantCount));
$MUFee = (($AD_MU * $adultCount) + ($CH_MU * $childCount) + ($IN_MU * $infantCount));
$TdsOnPLB = (($ADULTNCMTDS * $adultCount) + ($CHILDNCMTDS * $childCount) + ($INFANTNCMTDS * $infantCount));
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $OfferedFare,
'intCommissionEarned' => $CommissionEarned,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
);
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkupTripJack($markUpArr);
$AgencyMarkUp = $arrMarkUps['intAgencyFixMarkUp'];
$intGTXMarkUp = $arrMarkUps['intGTXMarkUp'];
$intFareWithGTXMarkUp = $arrMarkUps['intFareWithGTXMarkUp'];
$intOfferedFare = $arrMarkUps['intOfferedFare'];
if ($interNationalSearch == 1) {
$intGTXMarkUp = (($arrMarkUps['intGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnGTXMarkUp = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intAgencyFixMarkUp = (($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUp = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
} else {
$intGTXMarkUp = ($arrMarkUps['intGTXMarkUp'] * $intMemberCount);
$intSTaxOnGTXMarkUp = ($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount);
$intAgencyFixMarkUp = ($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount);
$intSTaxOnAgencyFixMarkUp = ($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount);
}
$intCommisionEarnedForAgency = $arrMarkUps['intCommisionEarnedForAgency'];
$intPLBEarnedForAgency = $arrMarkUps['intPLBEarnedForAgency'];
$intIncentiveEarnedForAgency = $arrMarkUps['intIncentiveEarnedForAgency'];
$intTotalEarningsForAgency = $arrMarkUps['intTotalEarningsForAgency'] + $intAgencyFixMarkUp;
$intGSTOnAgencyCommisionEarned = $arrMarkUps['intGSTOnAgencyCommisionEarned'];
$intGSTOnAgencyPLBEarned = $arrMarkUps['intGSTOnAgencyPLBEarned'];
$intGSTOnAgencyIncentiveEarned = $arrMarkUps['intGSTOnAgencyIncentiveEarned'];
$intTotalGSTAgencyEarnings = $intSTaxOnAgencyFixMarkUp + $intGSTOnAgencyCommisionEarned + $intGSTOnAgencyPLBEarned + $intGSTOnAgencyIncentiveEarned;
$intPublishedFare = $intOfferedFare + $intGTXMarkUp + $intAgencyFixMarkUp + $intCommisionEarnedForAgency + $intPLBEarnedForAgency + $intIncentiveEarnedForAgency + $intTotalGSTAgencyEarnings;
$intTotalDisCount = $CommissionEarned + $PLBEarned + $IncentiveEarned;
$intDiscountPerHead = $intTotalDisCount / $intTatalPaxCT;
$intDiscountPerHead = ($intDiscountPerHead * $adultCount);
$intBaseFareCal = ($ADULT['BF'] * $adultCount) - $intDiscountPerHead;
$intAdultFareOffered = $intBaseFareCal + ($ADULT['TAF'] * $adultCount);
$intTotalOfferedForAllPax = $intAdultFareOffered;
$intBaseFareAllPax = $intBaseFareCal;
if ($interNationalSearch == 1) {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
} else {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount));
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount));
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount));
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount));
}
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($intBaseFareCal);
$FareBreakdown[0]['BaseFare'] = ($ADULT['BF'] * $adultCount);
$FareBreakdown[0]['CommissionEarned'] = ($ADULT['NCM'] * $adultCount);
$FareBreakdown[0]['TDS'] = ($ADULTNCMTDS * $adultCount);
$FareBreakdown[0]['MF'] = ($AD_MF * $adultCount);
$FareBreakdown[0]['YQ'] = ($AD_YQ * $adultCount);
$FareBreakdown[0]['AGST'] = ($AD_AGST * $adultCount);
$FareBreakdown[0]['MFT'] = ($AD_MFT * $adultCount);
$FareBreakdown[0]['OT'] = ($AD_OT * $adultCount);
$FareBreakdown[0]['MU'] = ($AD_MU * $adultCount);
$FareBreakdown[0]['YR'] = ($AD_YR * $adultCount);
$FareBreakdown[0]['FixedMarkUp'] = $intAgencyFixMarkUpA;
$FareBreakdown[0]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpA;
$FareBreakdown[0]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[0]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[0]['intGTXMarkUp'] = $intGTXMarkUpA;
$FareBreakdown[0]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpA;
$FareBreakdown[0]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[0]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[0]['PGCharge'] = 0;
$FareBreakdown[0]['Baggage'] = isset($fareDetail['ADULT']['bI']['iB']) ? $fareDetail['ADULT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[0]['CabinBaggage'] = isset($fareDetail['ADULT']['bI']['cB']) ? $fareDetail['ADULT']['bI']['cB'] : []; //Cabin Baggage ;
if (isset($fareDetail['CHILD'])) {
$intDiscountPerHead = ($intDiscountPerHead * $childCount);
$intBaseFareCal = ($CHILD['BF'] * $childCount) - $intDiscountPerHead;
$intChildFareOffered = $intBaseFareCal + ($CHILD['TAF'] * $childCount);
$intBaseFareAllPax = $intBaseFareAllPax + $intBaseFareCal;
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intChildFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount) * $strFlightRoute);
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
} else {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount));
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount));
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount));
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount));
}
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($CHILD['BF'] * $childCount);
$FareBreakdown[1]['BaseFare'] = ($intBaseFareCal);
$FareBreakdown[1]['CommissionEarned'] = ($CHILD['NCM'] * $childCount);
$FareBreakdown[1]['TDS'] = ($CHILDNCMTDS * $childCount);
$FareBreakdown[1]['MF'] = ($CH_MF * $childCount);
$FareBreakdown[1]['YQ'] = ($CH_YQ * $childCount);
$FareBreakdown[1]['AGST'] = ($CH_AGST * $childCount);
$FareBreakdown[1]['MFT'] = ($CH_MFT * $childCount);
$FareBreakdown[1]['OT'] = ($CH_OT * $childCount);
$FareBreakdown[1]['MU'] = ($CH_MU * $childCount);
$FareBreakdown[1]['YR'] = ($CH_YR * $childCount);
$FareBreakdown[1]['FixedMarkUp'] = $intAgencyFixMarkUpC;
$FareBreakdown[1]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpC;
$FareBreakdown[1]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[1]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[1]['intGTXMarkUp'] = $intGTXMarkUpC;
$FareBreakdown[1]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpC;
$FareBreakdown[1]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[1]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[1]['PGCharge'] = 0;
$FareBreakdown[1]['Baggage'] = isset($fareDetail['CHILD']['bI']['iB']) ? $fareDetail['CHILD']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[1]['CabinBaggage'] = isset($fareDetail['CHILD']['bI']['cB']) ? $fareDetail['CHILD']['bI']['cB'] : []; //Cabin Baggage ;
}
if (isset($fareDetail['INFANT'])) {
$intInfantFareOffered = ($INFANT['BF'] * $infantCount) + ($INFANT['TAF'] * $infantCount);
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intInfantFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
} else {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount));
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount));
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount));
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount));
}
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['BaseFare'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['CommissionEarned'] = ($INFANT['NCM'] * $infantCount);
$FareBreakdown[2]['TDS'] = ($INFANTNCMTDS * $infantCount);
$FareBreakdown[2]['MF'] = ($IN_MF * $infantCount);
$FareBreakdown[2]['YQ'] = ($IN_YQ * $infantCount);
$FareBreakdown[2]['AGST'] = ($IN_AGST * $infantCount);
$FareBreakdown[2]['OT'] = ($IN_OT * $infantCount);
$FareBreakdown[2]['MFT'] = ($IN_MFT * $infantCount);
$FareBreakdown[2]['MU'] = ($IN_MU * $infantCount);
$FareBreakdown[2]['YR'] = ($IN_YR * $infantCount);
$FareBreakdown[2]['FixedMarkUp'] = $intAgencyFixMarkUpI;
$FareBreakdown[2]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpI;
$FareBreakdown[2]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[2]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[2]['intGTXMarkUp'] = $intGTXMarkUpI;
$FareBreakdown[2]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpI;
$FareBreakdown[2]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[2]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[2]['PGCharge'] = 0;
$FareBreakdown[2]['Baggage'] = isset($fareDetail['INFANT']['bI']['iB']) ? $fareDetail['INFANT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[2]['CabinBaggage'] = isset($fareDetail['INFANT']['bI']['cB']) ? $fareDetail['INFANT']['bI']['cB'] : []; //Cabin Baggage ;
}
//echo '<pre>';print_r($price);
$FairRulesArr[$kp] = array(
"Currency" => $this->CurrencyTitle, //$Currency,
"CurrencyRate" => $this->CurrencyRate, //$Currency,
"currencySysId" => $this->CurrencyId,
"BaseFare" => $BaseFareIN,
"Tax" => $TaxIN,
"YQTax" => $YQTax,
"OtherCharges" => $OtherCharges,
"Discount" => 0, //$Discount,
"ServiceFee" => $ServiceFee,
"ManagementFeeTax" => $ManagementFeeTax,
"AirlineGSTComponent" => $AirlineGSTComponent,
"CarrierMiscFee" => $CarrierMiscFee,
"MUFee" => $MUFee,
"intPublishedFare" => $PublishedFareIN,
"PublishedFare" => ($intPublishedFare * $this->CurrencyRate),
"OfferedFare" => $intPublishedFare,
"CommissionEarned" => $CommissionEarned,
"PLBEarned" => $PLBEarned,
"IncentiveEarned" => $IncentiveEarned,
"TdsOnPLB" => $TdsOnPLB,
"TdsOnIncentive" => 0,
"AdditionalTxnFeeOfrd" => 0,
"AdditionalTxnFeePub" => 0,
"Refundable" => $Refundable,
"IsRefundableTxt" => $IsRefundableTxt,
"PriceID" => $PriceID,
"IsGSTRequired" => $IsGSTRequired,
"fareIdentifier" => str_replace('_', ' ', $fareIdentifier),
"FareClass" => $fareDetail['ADULT']['cc'],
"FixedMarkUp" => $intAgencyFixMarkUp,
"GSTOnMarkUp" => $intSTaxOnAgencyFixMarkUp,
"CommEarned" => $intCommisionEarnedForAgency,
"GSTonComm" => $intGSTOnAgencyCommisionEarned,
"intGTXMarkUp" => $intGTXMarkUp,
"GTXMarkUpGST" => $intSTaxOnGTXMarkUp,
"FareBreakdown" => $FareBreakdown,
);
}
}
$TotalDurationReturn = 0;
$TotalDurationOnward = 0;
$TotalLAYOVERMinutes = 0;
if ($SegmentInformation) {
foreach ($SegmentInformation as $segments) {
//echo '<pre>';print_r($segments);
$duration = $segments['duration'];
$LAYOVERMinutes = $GroundTime = isset($segments['cT']) ? $segments['cT'] : 0;
$LAYOVERCity = $LAYOVERCityArr[] = isset($segments['cT']) ? $segments['aa']['city'] : '';
$FlyingMinutes += ($duration + $LAYOVERMinutes);
$TotalLAYOVERMinutes += $LAYOVERMinutes;
$FareClass = $totalPriceList['fd']['ADULT']['cB'];
$strBaggage = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $totalPriceList['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
$AirlineCode = $segments['fD']['aI']['code'];
$AirlineName = $segments['fD']['aI']['name'];
$FlightNumber = $segments['fD']['fN'];
$SegFlightNumber = $AirlineCode . "-" . $FlightNumber;
$originAirportName = $segments['da']['name'];
$originAirportCode = $segments['da']['code'];
$originCityName = $segments['da']['city'];
$originCountryName = $segments['da']['country'];
$originDepTime = $segments['dt'];
$destinationAirportName = $segments['aa']['name'];
$destinationAirportCode = $segments['aa']['code'];
$destinationCityName = $segments['aa']['city'];
$destinationCountryName = $segments['aa']['country'];
$destinationArrTime = $segments['at'];
if (isset($segments['isRs']) && $segments['isRs'] == true) {
$isReturnSegment = true;
$TotalDurationReturn += ($duration + $LAYOVERMinutes);
} else {
$isReturnSegment = false;
$TotalDurationOnward += ($duration + $LAYOVERMinutes);
}
$DepTerminal = isset($segments['da']['terminal']) ? $segments['da']['terminal'] : '';
$ArrTerminal = isset($segments['aa']['terminal']) ? $segments['aa']['terminal'] : '';
$filePath = $this->getflightlogo($AirlineCode);
$LAYOVERDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($LAYOVERMinutes);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($destinationArrTime);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($originDepTime);
$strDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($duration);
$arrSegments[] = array(
"isReturnSegment" => $isReturnSegment,
"originAirportName" => $originAirportName,
"destinationAirportName" => $destinationAirportName,
"originCityName" => $originCityName,
"originCountryName" => $originCountryName,
"destinationCityName" => $destinationCityName,
"destinationCountryName" => $destinationCountryName,
"destinationAirportCode" => $destinationAirportCode,
"destinationAirportCode" => $destinationAirportCode,
"destinationArrTime" => $destinationArrTime,
"SegFlightNumber" => $SegFlightNumber,
"AirlineCode" => $AirlineCode,
"AirlineName" => $AirlineName,
"FareClass" => $FareClass,
"originAirportCode" => $originAirportCode,
"originDepTime" => $originDepTime,
"TripIndicator" => '', //$TripIndicator,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsBaggage" => $IsBaggage,
"IsMealIncludes" => $IsMealIncludes,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"filePath" => $filePath,
);
}
}
$TotalLAYOVERMinutesO = 0;
$FlyingMinutesO = 0;
$LAYOVERCityArrO = [];
if ($TempArr['onward']) {
foreach ($TempArr['onward'] as $onwd) {
$duration = isset($segments['duration']) ? $segments['duration'] : 0;
$LAYOVERMinutes = $GroundTime = isset($onwd['cT']) ? $onwd['cT'] : 0;
$LAYOVERCity = $LAYOVERCityArrO[] = isset($onwd['cT']) ? $onwd['aa']['city'] : '';
$FlyingMinutesO += ($duration + $LAYOVERMinutes);
$TotalLAYOVERMinutesO += $LAYOVERMinutes;
}
}
//echo '<pre>';print_r($OriginOnward['dt'].$DestinationOnward['at']);echo '</pre>';
//echo $TotalLAYOVERMinutesO.'=='.$FlyingMinutesO.'<br>';
$LAYOVERTimeO = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($TotalLAYOVERMinutesO);
$AirlineCode = $OriginOnward['fD']['aI']['code'];
$FlightNumber = $OriginOnward['fD']['fN'];
//$strFlightNumber = $OriginOnward . "-" . $FlightNumber;
$strAirlineName = $OriginOnward['fD']['aI']['name'];
$OrFlightNumber = $AirlineCode . '-' . $FlightNumber;
$IsLCC = $OriginOnward['fD']['aI']['isLcc'];
$strSourceAirportCode = $OriginOnward['da']['code'];
$strDestinationAirportCode = $DestinationOnward['aa']['code'];
$airlineSysId = !empty($arrAirlineList[$AirlineCode]) ? $arrAirlineList[$AirlineCode] : '0';
$filePath = $this->getflightlogo($AirlineCode);
$FlightDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($TotalDurationOnward);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($DestinationOnward['at']);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($OriginOnward['dt']);
$Stops = $DestinationOnward['sN'];
if ($Stops == 0) {
$OrStopCountTxt = "Non-stop";
} else {
$OrStopCountTxt = $Stops . " Stop(s)";
}
$arrInsertFlightData[$key]['origin']['FlightNumber'] = $FlightNumber;
$arrInsertFlightData[$key]['origin']['AirlineName'] = $strAirlineName;
$arrInsertFlightData[$key]['origin']['AirlineCode'] = $AirlineCode;
$arrInsertFlightData[$key]['origin']['OrFlightNumber'] = $OrFlightNumber;
$arrInsertFlightData[$key]['origin']['AirInvenSysId'] = 0;
$arrInsertFlightData[$key]['origin']['IsLCC'] = $IsLCC;
$arrInsertFlightData[$key]['origin']['IsMealIncludes'] = $IsMealIncludes;
$arrInsertFlightData[$key]['origin']['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$key]['origin']['IsRefundable'] = $IsRefundable;
$arrInsertFlightData[$key]['origin']['IsRefundableTxt'] = $IsRefundableTxt;
$arrInsertFlightData[$key]['origin']['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['origin']['AirlineSysId'] = $airlineSysId;
$arrInsertFlightData[$key]['origin']['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$key]['origin']['ArrivalTime'] = $strArrivalDtTime;
$arrInsertFlightData[$key]['origin']['TravelDate'] = $OriginOnward['dt'];
$arrInsertFlightData[$key]['origin']['LocalFromTime'] = str_replace('T', ' ', $OriginOnward['dt']);
$arrInsertFlightData[$key]['origin']['FromUTCTime'] = $OriginOnward['dt'];
$arrInsertFlightData[$key]['origin']['LocalToTime'] = str_replace('T', ' ', $DestinationOnward['at']);
$arrInsertFlightData[$key]['origin']['ToUTCTime'] = $DestinationOnward['at'];
$arrInsertFlightData[$key]['origin']['IsDirect'] = 0;
$arrInsertFlightData[$key]['origin']['FareClass'] = $strFareClass;
$arrInsertFlightData[$key]['origin']['LAYOVERCity'] = isset($LAYOVERCityArrO[0]) ? $LAYOVERCityArrO[0] : '';
$arrInsertFlightData[$key]['origin']['GroundTime'] = $TotalLAYOVERMinutesO;
$arrInsertFlightData[$key]['origin']['LAYOVERDuration'] = $LAYOVERTimeO;
$arrInsertFlightData[$key]['origin']['FlyingMinutes'] = $FlyingMinutesO;
$arrInsertFlightData[$key]['origin']['DepartureDateTxt'] = date('D, d M', strtotime($OriginOnward['dt']));
$arrInsertFlightData[$key]['origin']['ArrivalDateTxt'] = date('D, d M', strtotime($DestinationOnward['at']));
$arrInsertFlightData[$key]['origin']['FlightDuration'] = $FlightDuration;
$arrInsertFlightData[$key]['origin']['SourcePlaceSysId'] = $intSourceCityId;
$arrInsertFlightData[$key]['origin']['DestPlaceSysId'] = $intDestinationCityId;
$arrInsertFlightData[$key]['origin']['SourceAirportCode'] = $strSourceAirportCode;
$arrInsertFlightData[$key]['origin']['DestAirportCode'] = $strDestinationAirportCode;
$arrInsertFlightData[$key]['origin']['StopCount'] = $OrStopCountTxt;
$arrInsertFlightData[$key]['origin']['Stops'] = $Stops;
$arrInsertFlightData[$key]['origin']['NoOfSeatAvailable'] = $NoOfSeatAvailable;
$arrInsertFlightData[$key]['origin']['TotalFlightMembers'] = $intMemberCount;
$arrInsertFlightData[$key]['origin']['CurrencyType'] = 1;
$arrInsertFlightData[$key]['origin']['JourneyType'] = 1;
$arrInsertFlightData[$key]['origin']['TripType'] = $intTripType;
$arrInsertFlightData[$key]['origin']['IsInternational'] = $interNationalSearch;
$arrInsertFlightData[$key]['origin']['logo'] = $filePath;
//// Rrturn variable
$TotalLAYOVERMinutesD = 0;
$FlyingMinutesD = 0;
$LAYOVERCityArrD = [];
if ($TempArr['return']) {
foreach ($TempArr['return'] as $onwd) {
$duration = $segments['duration'];
$LAYOVERMinutes = $GroundTime = isset($onwd['cT']) ? $onwd['cT'] : 0;
$LAYOVERCity = $LAYOVERCityArrD[] = isset($onwd['cT']) ? $onwd['aa']['city'] : '';
$FlyingMinutesD += ($duration + $LAYOVERMinutes);
$TotalLAYOVERMinutesD += $LAYOVERMinutes;
}
}
$OriginReturn = current($TempArr['return']);
$DestinationReturn = end($TempArr['return']);
$AirlineCode = $OriginReturn['fD']['aI']['code'];
$FlightNumber = $OriginReturn['fD']['fN'];
//$strFlightNumber = $OriginReturn . "-" . $FlightNumber;
$strAirlineName = $OriginReturn['fD']['aI']['name'];
$DeFlightNumber = $AirlineCode . '-' . $FlightNumber;
$IsLCC = $OriginReturn['fD']['aI']['isLcc'];
$strSourceAirportCode = $OriginReturn['da']['code'];
$strDestinationAirportCode = $DestinationReturn['aa']['code'];
$airlineSysId = !empty($arrAirlineList[$AirlineCode]) ? $arrAirlineList[$AirlineCode] : '0';
$filePath = $this->getflightlogo($AirlineCode);
$LAYOVERTimeD = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($TotalLAYOVERMinutesD);
$FlightDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($TotalDurationReturn);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($DestinationReturn['at']);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($OriginReturn['dt']);
//// end return variable.
$Stops = $DestinationReturn['sN'];
if ($Stops == 0) {
$DeStopCountTxt = "Non-stop";
} else {
$DeStopCountTxt = $Stops . " Stop(s)";
}
$arrInsertFlightData[$key]['destination']['FlightNumber'] = $FlightNumber;
$arrInsertFlightData[$key]['destination']['AirlineName'] = $strAirlineName;
$arrInsertFlightData[$key]['destination']['AirlineCode'] = $AirlineCode;
$arrInsertFlightData[$key]['destination']['DeFlightNumber'] = $DeFlightNumber;
$arrInsertFlightData[$key]['destination']['AirInvenSysId'] = 0;
$arrInsertFlightData[$key]['destination']['IsLCC'] = $IsLCC;
$arrInsertFlightData[$key]['destination']['IsMealIncludes'] = $IsMealIncludes;
$arrInsertFlightData[$key]['destination']['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$key]['destination']['IsRefundable'] = $IsRefundable;
$arrInsertFlightData[$key]['destination']['IsRefundableTxt'] = $IsRefundableTxt;
$arrInsertFlightData[$key]['destination']['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['destination']['AirlineSysId'] = $airlineSysId;
$arrInsertFlightData[$key]['destination']['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$key]['destination']['ArrivalTime'] = $strArrivalDtTime;
$arrInsertFlightData[$key]['destination']['TravelDate'] = $OriginReturn['dt'];
$arrInsertFlightData[$key]['destination']['LocalFromTime'] = str_replace('T', ' ', $OriginReturn['dt']);
$arrInsertFlightData[$key]['destination']['FromUTCTime'] = $OriginReturn['dt'];
$arrInsertFlightData[$key]['destination']['LocalToTime'] = str_replace('T', ' ', $DestinationReturn['at']);
$arrInsertFlightData[$key]['destination']['ToUTCTime'] = $DestinationReturn['at'];
$arrInsertFlightData[$key]['destination']['IsDirect'] = 0;
$arrInsertFlightData[$key]['destination']['FareClass'] = $strFareClass;
$arrInsertFlightData[$key]['destination']['LAYOVERCity'] = isset($LAYOVERCityArrD[0]) ? $LAYOVERCityArrD[0] : '';
$arrInsertFlightData[$key]['destination']['GroundTime'] = $TotalLAYOVERMinutesD;
$arrInsertFlightData[$key]['destination']['LAYOVERDuration'] = $LAYOVERTimeD;
$arrInsertFlightData[$key]['destination']['FlyingMinutes'] = $FlyingMinutesD;
$arrInsertFlightData[$key]['destination']['DepartureDateTxt'] = date('D, d M', strtotime($OriginReturn['dt']));
$arrInsertFlightData[$key]['destination']['ArrivalDateTxt'] = date('D, d M', strtotime($DestinationReturn['at']));
$arrInsertFlightData[$key]['destination']['FlightDuration'] = $FlightDuration;
$arrInsertFlightData[$key]['destination']['SourcePlaceSysId'] = $intSourceCityId;
$arrInsertFlightData[$key]['destination']['DestPlaceSysId'] = $intDestinationCityId;
$arrInsertFlightData[$key]['destination']['SourceAirportCode'] = $strSourceAirportCode;
$arrInsertFlightData[$key]['destination']['DestAirportCode'] = $strDestinationAirportCode;
$arrInsertFlightData[$key]['destination']['StopCount'] = $DeStopCountTxt;
$arrInsertFlightData[$key]['destination']['Stops'] = $Stops;
$arrInsertFlightData[$key]['destination']['NoOfSeatAvailable'] = $NoOfSeatAvailable;
$arrInsertFlightData[$key]['destination']['TotalFlightMembers'] = $intMemberCount;
$arrInsertFlightData[$key]['destination']['CurrencyType'] = 1;
$arrInsertFlightData[$key]['destination']['JourneyType'] = $intJourneyType;
$arrInsertFlightData[$key]['destination']['TripType'] = $intTripType;
$arrInsertFlightData[$key]['destination']['IsInternational'] = $interNationalSearch;
$arrInsertFlightData[$key]['destination']['logo'] = $filePath;
$arrInsertFlightData[$key]['AirlineName'] = $strAirlineName; // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFare'] = $PublishedFare; // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFareTxt'] = number_format($PublishedFare);
$arrInsertFlightData[$key]['ApiResultIndex'] = $ResultIndex;
$arrInsertFlightData[$key]['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['StopCount'] = $OrStopCountTxt;
$arrInsertFlightData[$key]['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$key]['IsRefundable'] = $IsRefundable;
$arrInsertFlightData[$key]['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$key]['SourcePlaceSysId'] = $arrCommonInsVariables['intSourceCityId'];
$arrInsertFlightData[$key]['DestPlaceSysId'] = $arrCommonInsVariables['intDestinationCityId'];
$arrInsertFlightData[$key]['SourceAirportCode'] = $arrCommonInsVariables['strSourceAirportCode'];
$arrInsertFlightData[$key]['DestAirportCode'] = $arrCommonInsVariables['strDestinationAirportCode'];
$arrInsertFlightData[$key]['LocalFromTime'] = isset($arrCommonInsVariables['localFromDateTime']) ? $arrCommonInsVariables['localFromDateTime'] : '';
$arrInsertFlightData[$key]['FromUTCTime'] = isset($arrCommonInsVariables['localFromDateTime']) ? $arrCommonInsVariables['localFromDateTime'] : '';
$arrInsertFlightData[$key]['LocalToTime'] = isset($arrCommonInsVariables['localToDateTime']) ? $arrCommonInsVariables['localToDateTime'] : '';
$arrInsertFlightData[$key]['ToUTCTime'] = isset($arrCommonInsVariables['localToDateTime']) ? $arrCommonInsVariables['localToDateTime'] : '';
$arrInsertFlightData[$key]['FairRules'] = $FairRulesArr;
$arrInsertFlightData[$key]['Segments'] = $arrSegments;
$arrInsertFlightData[$key]['arrCommonInsVariables'] = $arrCommonInsVariables;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
// $arrInsertFlightData[$key]['fffffffffffff'] = $arrFairRules;
//$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_AED), ($PublishedFare * $this->CurrencyRate));
$AttPriceRange[] = $PublishedFare;
$arrAirlineName[] = $AirlineCode . '-' . $strAirlineName;
$FiltStopCount[] = $OrStopCountTxt;
$DesFiltStopCount[] = $DeStopCountTxt;
$arrInsertFlightData[$key]['FilterPrice'] = $FilterPrice;
}
sort($dddddddd);
if (array_values(array_unique($dddddddd))) {
foreach (array_values(array_unique($dddddddd)) as $Fares) {
if ($this->CurrencyTitle == 'INR') {
$CONST_PRICE_RANGE = unserialize(CONST_PRICE_RANGE_5000);
} else {
$CONST_PRICE_RANGE = unserialize(CONST_PRICE_RANGE_AED);
}
$FiltPriceRange[] = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue($CONST_PRICE_RANGE, round($Fares));
}
}
// echo '<pre>';
// print_r($dddddddd);
// echo '</pre>';
$FiltPriceRangeU = (array_unique($FiltPriceRange));
$ArrPriceUnique = array_filter(array_values($FiltPriceRangeU));
$arrAirlineName = array_unique($arrAirlineName);
$FiltStopCount = array_unique($FiltStopCount);
$AttPriceRange = array_unique($AttPriceRange);
$data = array('outbound' => $arrInsertFlightData, 'arrAirlineName' => $arrAirlineName, 'FiltStopCount' => $FiltStopCount, 'ArrPriceUnique' => $ArrPriceUnique, 'AttPriceRange' => $AttPriceRange);
// echo '<pre>';print_r(($arrInsertFlightData));
// die;
return $data;
} else {
return false;
}
}
public function getflightfarerulesAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$getData = $this->getRequest()->getParams();
$apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetApiFlightsFareRulesTripJack($getData);
$this->view->apiResponse = $apiResponse;
$this->view->IsLCC = $getData['IsLCC'];
} else {
die('Page not found!');
}
}
public function bookNoowAction()
{
$post = json_decode(file_get_contents('php://input'), true);
$roundSelect = isset($post['roundSelect']) ? $post['roundSelect'] : 0;
$SingleSelect = isset($post['SingleSelect']) ? $post['SingleSelect'] : 0;
$Outbound = json_decode($post['Outbound'], true);
$Inbound = json_decode(($post['Inbound']) ? $post['Inbound'] : [], true);
//echo '<pre>';print_r($Outbound);
//echo '<pre>';print_r($Inbound);die;
$FairRules = [];
if ($Outbound['FairRules']) {
foreach ($Outbound['FairRules'] as $price) {
if ($price['PriceID'] == $SingleSelect) {
$FairRules = $price;
}
}
}
$Outbound['apiTraceId'] = $SingleSelect;
$Outbound['FairRules'] = $FairRules;
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataRoundInter = new Zend_Session_Namespace('FlightBookingDataRoundInter');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$FlightBookingData->params[0] = $Outbound; // Putting all form data to Session
$FlightBookingDataRoundInter->params[0] = $Outbound; // Putting all form data to Session
$apiTraceId = $SingleSelect;
if (!empty($Inbound)) {
$RoundFairRules = [];
if ($Inbound['FairRules']) {
foreach ($Inbound['FairRules'] as $price2) {
if ($price2['PriceID'] == $roundSelect) {
$RoundFairRules = $price2;
}
}
}
$Outbound['apiTraceId'] = $roundSelect;
$Inbound['FairRules'] = $RoundFairRules;
$FlightBookingData->params[1] = $Inbound; // Putting all form data to Session
$FlightBookingDataInbound->params = $Inbound; // Putting all form data to Session
$apiTraceId = $SingleSelect . ',' . $roundSelect;
}
//echo $apiTraceId;die('dd');
if ($FlightBookingData->params) {
$response = array('success' => true, 'message' => 'Plase wait...', 'url' => $this->baseUrl . 'flight/review/' . $apiTraceId);
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'Oops something went wrong', 'url' => '');
echo json_encode($response);
exit;
}
}
public function reviewAction()
{
$param = $this->getRequest()->getParams();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
//$FlightBookingDataRoundInter = new Zend_Session_Namespace('FlightBookingDataRoundInter');
$this->view->FlightSearchUrl = $FlightSearchUrl->params;
$class = $sessionFlightSearchParams->params['class'];
$this->view->traceId = $param['traceId'];
$this->view->param = $param;
$this->view->departure_date = $sessionFlightSearchParams->params['strDepatureDate'];
$this->view->return_dates = $sessionFlightSearchParams->params['strReturnDate'];
$this->view->class = $class;
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->CurrencyTitle = $this->CurrencyTitle;
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->FlightBookingData = $FlightBookingData->params;
$this->view->FlightBookingDataInbound = $FlightBookingDataInbound->params;
//echo '<pre>';print_r($FlightBookingDataRoundInter->params);die;
// echo '<pre>';print_r($param);
// die;
}
public function travellersAction()
{
$param = $this->getRequest()->getParams();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
$this->view->FlightSearchUrl = $FlightSearchUrl->params;
$class = $sessionFlightSearchParams->params['class'];
$this->view->traceId = $param['traceId'];
$this->view->departure_date = $sessionFlightSearchParams->params['strDepatureDate'];
$this->view->return_dates = $sessionFlightSearchParams->params['strReturnDate'];
$this->view->class = $class;
$this->view->param = $param;
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->CurrencyTitle = $this->CurrencyTitle;
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->FlightBookingData = $FlightBookingData->params;
$this->view->FlightBookingDataInbound = $FlightBookingDataInbound->params;
$objFlight = new Travel_Model_FlightMaster();
$GetCustomerData = $objFlight->GetCustomerData('tbl_customer', null, $this->_session->session['ContactNo1'], $this->_session->session['EmailId'], $this->gtxagencysysid);
$Customerdata = [];
if ($this->_session->session['CustomerSysId']) {
$Customerdata = $objFlight->CheckCustomer('tbl_customer', ['CustomerSysId' => $GetCustomerData['CustomerSysId']]);
}
$this->view->Customerdata = $Customerdata;
//echo '<pre>';print_r($Customerdata);
// echo '<pre>';print_r($FlightBookingData->params);
// die;
}
public function loadAddOnsAction()
{
$getData = $this->getRequest()->getParams();
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$flightSSRDetails = new Zend_Session_Namespace('flightSSRDetails');
$flightSSRDetailsInb = new Zend_Session_Namespace('flightSSRDetailsInb');
$ResponseInb = $flightSSRDetailsInb->params;
$Response = $flightSSRDetails->params;
$SSRArr = $Response;
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('CustomerSession' => $CustomerSession->params, 'SSRArr' => $SSRArr, 'SSRArrInb' => [], 'flightSSRDetails' => $flightSSRDetails->params, 'FlightBookingData' => $FlightBookingData->params, 'FlightBookingDataInbound' => $FlightBookingDataInbound->params));
$bodyText = $html->render('load-add-ons.phtml');
$response = array('success' => true, 'message' => 'Done', 'html' => $bodyText);
echo json_encode($response);
exit;
//print_r($getData);
}
public function searchcustomermemberAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$param = $this->getRequest()->getParams();
if (isset($param['CustomerSysId']) && $param['CustomerSysId'] > 0) {
$objFlight = new Travel_Model_FlightMaster();
$customerMember = $objFlight->GetFlightCustomerMember('tbl_customer_member', array('CustomerSysId' => $param['CustomerSysId']));
$customerMemberArr = [];
// echo '<pre>';print_r($customerMember);die;
if (!empty($customerMember)) {
foreach ($customerMember as $key => $member) {
$DOBm = explode('-', $member['DOB']);
if ($member['paxType'] == 1) {
$paxtype = 'Adult';
} elseif ($member['paxType'] == 2) {
$paxtype = 'Child';
} else {
$paxtype = 'Infant';
}
$PassportExpirym = ($member['PassportExpiry'] != '0000-00-00') ? date('d/m/Y', strtotime($member['PassportExpiry'])) : '';
$customerMemberArr[] = array(
'label' => $member['EmailId'] . '(' . $member['FirstName'] . ' ' . $member['LastName'] . ')',
'value' => $member['EmailId'],
'index' => $key + 2,
'CustomerMemberSysId' => $member['CustomerMemberSysId'],
'CustomerSysId' => $member['CustomerSysId'],
'Salutation' => $member['Salutation'],
'Relation' => $member['Relation'],
'Contacts' => $member['Contacts'],
'FirstName' => $member['FirstName'],
'LastName' => $member['LastName'],
'Address' => $member['Address'],
'CityTitle' => $member['CityTitle'],
'CitySysId' => $member['CitySysId'],
'CountrySysId' => $member['CountrySysId'],
'countryCode' => $member['countryCode'],
'PassportNo' => $member['PassportNo'],
'paxType' => $member['paxType'],
'paxTypeName' => $paxtype,
'PassportExpiry' => $PassportExpirym,
'dobday' => $DOBm[2],
'dobmonth' => $DOBm[1],
'dobyear' => $DOBm[0],
);
}
$response = array(
'label' => '',
'success' => true,
'CustomerSysId' => 0,
'customerMember' => $customerMemberArr,
);
echo json_encode($response);
exit;
} else {
$response = array(
'label' => '',
'success' => false,
'CustomerSysId' => 0,
'customerMember' => []
);
echo json_encode($response);
exit;
}
} else {
$response = array(
'label' => '',
'success' => false,
'CustomerSysId' => 0,
'customerMember' => []
);
echo json_encode($response);
exit;
}
}
}
public function searchcutomerAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getParams();
$ARR_CUSTOMER_RELATION = unserialize(ARR_CUSTOMER_RELATION);
$ARR_SALUTION = unserialize(ARR_SALUTION);
$ARR_SALUTION_CHILD = unserialize(ARR_SALUTION_CHILD);
$objFlight = new Travel_Model_FlightMaster();
$tbl_customer = $objFlight->SearchFlightCustomer('tbl_customer', $param);
$customerMemberArr = [];
//echo '<pre>';print_r($tbl_customer);die;
if ($tbl_customer) {
foreach ($tbl_customer as $value) {
$DOB = explode('-', $value['DOB']);
$customerMember = $objFlight->GetFlightCustomerMember('tbl_customer_member', array('CustomerSysId' => $value['CustomerSysId']));
if ($customerMember) {
foreach ($customerMember as $key => $member) {
$DOBm = explode('-', $member['DOB']);
if ($member['paxType'] == 1) {
$paxtype = 'Adult';
$SalutationTxt = $ARR_SALUTION[$member['Salutation']];
} elseif ($member['paxType'] == 2) {
$paxtype = 'Child';
$SalutationTxt = $ARR_SALUTION_CHILD[$member['Salutation']];
} else {
$paxtype = 'Infant';
$SalutationTxt = $ARR_SALUTION_CHILD[$member['Salutation']];
}
if (!empty($member['PassportExpiry'])) {
$PassportExpirym = ($member['PassportExpiry'] != '0000-00-00') ? date('d/m/Y', strtotime($member['PassportExpiry'])) : '';
} else {
$PassportExpirym = '';
}
if (!empty($member['passporIssue'])) {
$passporIssuem = ($member['passporIssue'] != '0000-00-00') ? date('d/m/Y', strtotime($member['passporIssue'])) : '';
} else {
$passporIssuem = '';
}
$customerMemberArr[$member['CustomerMemberSysId']] = array(
'label' => $member['EmailId'] . '(' . $member['FirstName'] . ' ' . $member['LastName'] . ')',
'value' => $member['EmailId'],
'index' => $key + 2,
'CustomerMemberSysId' => $member['CustomerMemberSysId'],
'CustomerSysId' => $member['CustomerSysId'],
'Salutation' => $member['Salutation'],
'SalutationTxt' => $SalutationTxt,
'Relation' => $member['Relation'],
'RelationTxt' => $ARR_CUSTOMER_RELATION[$member['Relation']],
'Contacts' => $member['Contacts'],
'FirstName' => $member['FirstName'],
'LastName' => $member['LastName'],
'Address' => $member['Address'],
'CityTitle' => $member['CityTitle'],
'CitySysId' => $member['CitySysId'],
'CountrySysId' => $member['CountrySysId'],
'countryCode' => $member['countryCode'],
'PassportNo' => $member['PassportNo'],
'paxType' => $member['paxType'],
'paxTypeName' => $paxtype,
'PassportExpiry' => $PassportExpirym,
'passporIssue' => $passporIssuem,
'dobday' => $DOBm[2],
'dobmonth' => $DOBm[1],
'dobyear' => $DOBm[0],
);
}
}
if (!empty($value['PassportExpiry'])) {
$PassportExpiry = ($value['PassportExpiry'] != '0000-00-00') ? date('d/m/Y', strtotime($value['PassportExpiry'])) : '';
} else {
$PassportExpiry = '';
}
if (!empty($value['passporIssue'])) {
$passporIssue = ($value['passporIssue'] != '0000-00-00') ? date('d/m/Y', strtotime($value['passporIssue'])) : '';
} else {
$passporIssue = '';
}
// $PassportExpiry = ($value['PassportExpiry'] != '0000-00-00')?date('d/m/Y',strtotime($value['PassportExpiry'])):'';
if ($value['paxType'] == 1) {
$paxtype = 'Adult';
$SalutationTxt = $ARR_SALUTION[$value['Salutation']];
} elseif ($value['paxType'] == 2) {
$paxtype = 'Child';
$SalutationTxt = $ARR_SALUTION_CHILD[$value['Salutation']];
} else {
$paxtype = 'Infant';
$SalutationTxt = $ARR_SALUTION_CHILD[$value['Salutation']];
}
$response[$member['CustomerSysId']] = $leadPax = array(
'label' => $value['EmailId'] . '(' . $value['FirstName'] . ' ' . $value['LastName'] . ')',
'value' => $value['EmailId'],
'CustomerSysId' => $value['CustomerSysId'],
'CustomerMemberSysId' => $value['CustomerSysId'],
'Salutation' => $value['Salutation'],
'SalutationTxt' => $SalutationTxt,
'Relation' => $value['Relation'],
'RelationTxt' => $ARR_CUSTOMER_RELATION[$value['Relation']],
'Contacts' => $value['Contacts'],
'FirstName' => $value['FirstName'],
'LastName' => $value['LastName'],
'Address' => $value['Address'],
'CityTitle' => $value['CityTitle'],
'CitySysId' => $value['CitySysId'],
'CountrySysId' => $value['CountrySysId'],
'countryCode' => $value['countryCode'],
'PassportNo' => $value['PassportNo'],
'paxType' => $value['paxType'],
'paxTypeName' => $paxtype,
'companyname' => $value['companyname'],
'gstnnumber' => $value['gstnnumber'],
'gstaddress' => $value['gstaddress'],
'gstcity' => $value['gstcity'],
'gststate' => $value['gststate'],
'gstpincode' => $value['gstpincode'],
'PassportExpiry' => $PassportExpiry,
'passporIssue' => $passporIssue,
'dobday' => $DOB[2],
'dobmonth' => $DOB[1],
'dobyear' => $DOB[0],
//'customerMember' => $customerMemberArr
);
}
$responseArray = [];
$array_merge = array_merge($response, $customerMemberArr);
if ($array_merge) {
foreach ($array_merge as $key => $val) {
if ($key == 0) {
$responseArray['_' . $val['CustomerSysId']] = $val;
} else {
$responseArray['_' . $val['CustomerMemberSysId']] = $val;
}
}
}
// echo '<pre>';print_r($responseArray);
// die;
//ksort($responseArray);
if (!empty($responseArray)) {
$array = array();
$array = array('success' => true, 'leadPax' => $leadPax, 'msg' => 'success', 'data' => $responseArray);
echo json_encode($array);
exit;
} else {
echo json_encode(array('success' => false, 'msg' => 'no record found', 'data' => $responseArray));
exit;
}
} else {
$response = array(
'success' => false,
'msg' => 'no record found',
'CustomerSysId' => 0,
'data' => []
);
echo json_encode($response);
exit;
}
} else {
die('Page not found');
}
// echo '<pre>';print_r($response);die;
}
public function genrateFlightQuery($post)
{
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$class = $sessionFlightSearchParams->params['class'];
$interNationalSearch = $sessionFlightSearchParams->params['interNationalSearch'];
$route = $sessionFlightSearchParams->params['route'];
$departureDates = $sessionFlightSearchParams->params['departure_date'];
$returnDate = $sessionFlightSearchParams->params['return_date'];
if (!empty($departureDates)) {
$arrDepartureDates = explode("/", $departureDates);
$departureDatesAD = $arrDepartureDates[2] . "-" . $arrDepartureDates[1] . "-" . $arrDepartureDates[0];
}
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$apiTraceId = $FlightBookingData->params['apiTraceId'];
$BookingData = $FlightBookingData->params;
// if ($FlightBookingDataInbound->params) {
// $BookingData[] = $FlightBookingDataInbound->params;
// }
$Segments_c = current($FlightBookingData->params);
$Segments_E = end($FlightBookingData->params);
$arrCurrentSegments1 = current($Segments_c['Segments']);
$arrEndSegments1 = end($Segments_c['Segments']);
//echo '<pre>';print_r($Segments);die;
$Mobile = $post['leadMobile'];
$emailId = $post['leadEmail'];
$adultCount = isset($sessionFlightSearchParams->params['adults']) ? $sessionFlightSearchParams->params['adults'] : 0;
$childCount = isset($sessionFlightSearchParams->params['childs']) ? $sessionFlightSearchParams->params['childs'] : 0;
$infantCount = isset($sessionFlightSearchParams->params['infants']) ? $sessionFlightSearchParams->params['infants'] : 0;
$SourcePlaceSysId = isset($sessionFlightSearchParams->params['sourceCityId']) ? $sessionFlightSearchParams->params['sourceCityId'] : '';
$DestinationPlacesSysId = isset($sessionFlightSearchParams->params['destinationCityId']) ? $sessionFlightSearchParams->params['destinationCityId'] : '';
$OriginCity = isset($arrCurrentSegments1['originCityName']) ? $arrCurrentSegments1['originCityName'] : '';
$Destcity = isset($arrEndSegments1['destinationCityName']) ? $arrEndSegments1['destinationCityName'] : '';
$originAirCode = isset($sessionFlightSearchParams->params['sourceCityAirportCode']) ? $sessionFlightSearchParams->params['sourceCityAirportCode'] : '';
$destinationAirCode = isset($sessionFlightSearchParams->params['destinationCityAirportCode']) ? $sessionFlightSearchParams->params['destinationCityAirportCode'] : '';
$departuredate = str_replace('T', ' ', $arrCurrentSegments1['originDepTime']);
$arrivaldate = str_replace('T', ' ', $arrEndSegments1['destinationArrTime']);
$FlightNumber = $FlightBookingData->params['FlightNumber'];
//$PublishedFare = $FlightBookingData->params['PublishedFare'];
$oneway_origin_text = isset($arrCurrentSegments1['originCityName']) ? $arrCurrentSegments1['originCityName'] : '';
$oneway_destination_text = isset($arrEndSegments1['destinationCityName']) ? $arrEndSegments1['destinationCityName'] : '';
$PublishedFare = 0;
$BaseAmount = 0;
$AgentCommisionEarned = 0;
$AgentCommisionEarnedGST = 0;
$AgencyMarkUp = 0;
$AgencyMarkUpGST = 0;
$GTXMarkUp = 0;
$GTXMarkUpGST = 0;
$FareSummary = [];
// $finalFareSummary = $this->getfinalFareSummary($FlightBookingData->params);
// $AgentCommisionEarned = ($finalFareSummary['CommEarned'] + $finalFareSummary['PLBEarned'] + $finalFareSummary['IncentiveEarned']);
// $AgentCommisionEarnedGST = ($finalFareSummary['GSTonComm'] + $finalFareSummary['GSTonPLB'] + $finalFareSummary['GSTonIncentive']);
// $AgencyMarkUp = $finalFareSummary['intAgencyFixMarkUp'];
// $AgencyMarkUpGST = $finalFareSummary['intSTaxOnAgencyFixMarkUp'];
// $GTXMarkUp = $finalFareSummary['intGTXMarkUp'];
// $BaseAmount = ($PublishedFare - ($AgentCommisionEarnedGST + $AgencyMarkUpGST + $AgentCommisionEarned + $AgencyMarkUp + $GTXMarkUp));
//echo '<pre>';print_r($BookingData);die;
if ($BookingData) {
foreach ($BookingData as $k => $booking) {
$finalFareSummary = $booking['FairRules'];
$PublishedFare += $booking['FairRules']['PublishedFare'];
$PublishedFareINT = $booking['FairRules']['PublishedFare'];
// $finalFareSummary = $this->getfinalFareSummary($booking);
$AgentCommisionEarned += ($finalFareSummary['CommEarned'] + $finalFareSummary['PLBEarned']);
$AgentCommisionEarnedINT = ($finalFareSummary['CommEarned'] + $finalFareSummary['PLBEarned']);
$AgentCommisionEarnedGST += ($finalFareSummary['GSTonComm'] + isset($finalFareSummary['GSTonPLB']) ? $finalFareSummary['GSTonPLB'] : 0);
$AgentCommisionEarnedGSTINT = ($finalFareSummary['GSTonComm'] + isset($finalFareSummary['GSTonPLB']) ? $finalFareSummary['GSTonPLB'] : 0);
$AgencyMarkUp += $finalFareSummary['FixedMarkUp'];
$AgencyMarkUpINT = $finalFareSummary['FixedMarkUp'];
$AgencyMarkUpGST += $finalFareSummary['GSTOnMarkUp'];
$AgencyMarkUpGSTINT = $finalFareSummary['GSTOnMarkUp'];
$GTXMarkUp += $finalFareSummary['intGTXMarkUp'];
$GTXMarkUpINT = $finalFareSummary['intGTXMarkUp'];
$BaseAmount += ($PublishedFareINT - ($AgentCommisionEarnedGSTINT + $AgencyMarkUpGSTINT + $AgentCommisionEarnedINT + $AgencyMarkUpINT + $GTXMarkUpINT));
$BaseAmountINT = ($PublishedFareINT - ($AgentCommisionEarnedGSTINT + $AgencyMarkUpGSTINT + $AgentCommisionEarnedINT + $AgencyMarkUpINT + $GTXMarkUpINT));
$FareSummary[$k] = array(
'PublishedFare' => $PublishedFareINT,
'AgentCommisionEarned' => $AgentCommisionEarnedINT,
'AgentCommisionEarnedGST' => $AgentCommisionEarnedGSTINT,
'AgencyMarkUp' => $AgencyMarkUpINT,
'AgencyMarkUpGST' => $AgencyMarkUpGSTINT,
'GTXMarkUp' => $GTXMarkUpINT,
'BaseAmount' => $BaseAmountINT,
);
}
}
// echo '<pre>';print_r($FareSummary);die;
$roomjson = array();
$roomjson[1]['Adult'] = $adultCount;
$roomjson[1]['Child'] = $childCount;
$roomjson[1]['Infant'] = $infantCount;
$roomjson[1]['bedtype'] = '';
$roomjson[1]['departuredate'] = $departureDates;
$roomjson[1]['returndate'] = $returnDate;
$roomjson[1]['fromaircode'] = $oneway_origin_text;
$roomjson[1]['toaircode'] = $oneway_destination_text;
$roomjson[1]['airclass'] = $class;
for ($c = 1; $c <= $childCount; $c++) {
$childsage = $infantCount;
$roomjson[$c]['Adult'] = $adultCount;
$roomjson[$c]['Child'] = $childCount;
$roomjson[$c]['Infant'] = $infantCount;
$roomjson[$c]['ChildAge_' . $c] = $childsage;
$roomjson[$c]['bedtype'] = '';
$roomjson[$c]['departuredate'] = $departureDates;
$roomjson[$c]['returndate'] = $returnDate;
$roomjson[$c]['fromaircode'] = $oneway_origin_text;
$roomjson[$c]['toaircode'] = $oneway_destination_text;
$roomjson[$c]['airclass'] = $class;
}
$RoomInfoJson = json_encode($roomjson);
$totalPassengers = $adultCount + $childCount + $infantCount;
$arrPax = [];
$passengerAddress = isset($post['passenger-address-1']) ? $post['passenger-address-1'] : '';
for ($i = 1; $i <= $totalPassengers; $i++) {
$paxType = $post['paxType-' . $i];
$firstName = $post['passenger-firstname-' . $i];
$lastName = $post['passenger-lastname-' . $i];
$relation = $post['relation-' . $i];
$salutation = $post['salution-' . $i];
$dateofbirth = $post['dateofbirth-' . $i];
$arrPax[] = [
"PassengerType" => $paxType,
"salutation" => $salutation,
"fname" => $firstName,
"lname" => $lastName,
"dob" => $dateofbirth,
"address" => $passengerAddress,
];
}
$jsonPaxDetails = json_encode($arrPax);
$jsonBookingData = json_encode($BookingData);
$this->postFields = "";
$this->postFields .= "&AgencySysId=$this->gtxagencysysid";
$this->postFields .= "&AgentSysId=$this->gtxagentsysid";
$this->postFields .= "&Email=" . $emailId;
$this->postFields .= "&mobile=" . $Mobile;
$this->postFields .= "&jsonPaxDetails=" . $jsonPaxDetails;
$this->postFields .= "&jsonBookingData=" . $jsonBookingData;
$this->postFields .= "&FareSummary=" . json_encode($FareSummary);
$this->postFields .= "&interNationalSearch=" . $interNationalSearch;
$this->postFields .= "&route=" . $route;
$this->postFields .= "&SourcePlaceSysId=" . $SourcePlaceSysId;
$this->postFields .= "&DestinationPlacesSysId=" . $DestinationPlacesSysId;
$this->postFields .= "&SourcePlaces=" . $OriginCity;
$this->postFields .= "&DestinationPlaces=" . $Destcity;
$this->postFields .= "&SourceAirportCode=" . $originAirCode;
$this->postFields .= "&DestAirportCode=" . $destinationAirCode;
$this->postFields .= "&FlightNumber=" . $FlightNumber;
$this->postFields .= "&departuredate=" . $departuredate;
$this->postFields .= "&arrivaldate=" . $arrivaldate;
$this->postFields .= "&AdultPax=" . $adultCount;
$this->postFields .= "&ChildPax=" . $childCount;
$this->postFields .= "&InfantPax=" . $infantCount;
$this->postFields .= "&Cities=" . $OriginCity . '-' . $Destcity;
$this->postFields .= "&IsHotelFromApi=1";
$this->postFields .= "&ICSourceSysId=7";
$this->postFields .= "&roominfojson=" . $RoomInfoJson;
$this->postFields .= "&AgentCommisionEarned=" . $AgentCommisionEarned;
$this->postFields .= "&AgentCommisionEarnedGST=" . $AgentCommisionEarnedGST;
$this->postFields .= "&AgencyMarkUp=" . $AgencyMarkUp;
$this->postFields .= "&AgencyMarkUpGST=" . $AgencyMarkUpGST;
$this->postFields .= ">XMarkUp=" . $GTXMarkUp;
$this->postFields .= ">XMarkUpGST=" . $GTXMarkUpGST;
$this->postFields .= "&BaseAmount=" . $BaseAmount;
$this->postFields .= "&PublishedFare=" . $PublishedFare;
//echo '<pre>';
//print_r($this->postFields);die;
$model = new Gtxwebservices_Model_Webservices();
$result = $model->genrateFlightQuery($this->postFields);
$response = json_decode($result, true);
//echo '<pre>';print_r($response);die;
Zend_Session::namespaceUnset('ResponseFlightQuery');
$ResponseFlightQuery = new Zend_Session_Namespace('ResponseFlightQuery');
$ResponseFlightQuery->params = $response;
return $response;
}
public function savePassengerDetailsAction()
{
if ($this->getRequest()->isPost()) {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$post = $this->getRequest()->getPost();
$objFlight = new Travel_Model_FlightMaster();
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$class = $sessionFlightSearchParams->params['class'];
$interNationalSearch = $sessionFlightSearchParams->params['interNationalSearch'];
$route = $sessionFlightSearchParams->params['route'];
$departureDates = $sessionFlightSearchParams->params['departure_date'];
$strDepatureDate = $sessionFlightSearchParams->params['strDepatureDate'];
$strReturnDate = $sessionFlightSearchParams->params['strReturnDate'];
$returnDate = $sessionFlightSearchParams->params['return_date'];
$traceId = $post['traceId'];
if (!empty($departureDates)) {
$arrDepartureDates = explode("/", $departureDates);
$departureDatesAD = $arrDepartureDates[2] . "-" . $arrDepartureDates[1] . "-" . $arrDepartureDates[0];
}
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$FlightBookingDataRoundInter = new Zend_Session_Namespace('FlightBookingDataRoundInter');
$apiTraceId = $FlightBookingData->params['apiTraceId'];
// $BookingData = [];
// $BookingData[] = $FlightBookingData->params;
// if ($FlightBookingDataInbound->params) {
// $BookingData[] = $FlightBookingDataInbound->params;
// }
$BookingData = $FlightBookingData->params;
$arrPlanAir = [];
$flight_booking_id_Arr = [];
$CustomerMembersSessionArr = [];
// echo '<pre>';
// $dffdfdfdf = $this->genrateFlightQuery($post);
// echo '<pre>';
// print_r($dffdfdfdf);
// die;
//$this->db->beginTransaction();
$this->ValidateSavePassenger($post, $BookingData);
//echo '<pre>';print_r($post);die;
try {
$this->objMdl->rv_delete('tbl_customer', array('apiTraceId = ?' => $post['traceId']));
$this->objMdl->rv_delete('tbl_customer_member', array('apiTraceId = ?' => $post['traceId']));
$param = array(
'leadMobile' => $post['leadMobile'],
'leadEmail' => $post['leadEmail'],
);
$tbl_customer = $objFlight->SearchFlightCustomer('tbl_customer', $param);
/*if (!empty($tbl_customer) && $post['CustomerSysId-1'] == '0') {
$response = array('succes' => false, 'msg' => "It's seems your account already registered with us!. so please search and select from saved travellers list.", 'index' => 'passenger-firstname-' . $i);
echo json_encode($response);
exit;
}*/
$adultCount = isset($sessionFlightSearchParams->params['adults']) ? $sessionFlightSearchParams->params['adults'] : 0;
$childCount = isset($sessionFlightSearchParams->params['childs']) ? $sessionFlightSearchParams->params['childs'] : 0;
$infantCount = isset($sessionFlightSearchParams->params['infants']) ? $sessionFlightSearchParams->params['infants'] : 0;
$oneway_origin_text = isset($sessionFlightSearchParams->params['sourceCityAirportCode']) ? $sessionFlightSearchParams->params['sourceCityAirportCode'] : '';
$oneway_destination_text = isset($sessionFlightSearchParams->params['destinationCityAirportCode']) ? $sessionFlightSearchParams->params['destinationCityAirportCode'] : '';
$leadMobile = isset($post['leadMobile']) ? $post['leadMobile'] : '';
$leadEmail = isset($post['leadEmail']) ? $post['leadEmail'] : '';
$countryCode = isset($post['countryCode']) ? $post['countryCode'] : '';
$companyname = isset($post['companyname']) ? $post['companyname'] : '';
$gstnnumber = isset($post['gstnnumber']) ? $post['gstnnumber'] : '';
$gstaddress = isset($post['gstaddress']) ? $post['gstaddress'] : '';
$gstcity = isset($post['gstcity']) ? $post['gstcity'] : '';
$gststate = isset($post['gststate']) ? $post['gststate'] : '';
$gstpincode = isset($post['gstpincode']) ? $post['gstpincode'] : '';
$CityTitle = isset($post['passenger-city-name-1']) ? $post['passenger-city-name-1'] : '';
$passengerCity = isset($post['passenger-city-1']) ? $post['passenger-city-1'] : '';
$CountrySysId = isset($post['passenger-country-1']) ? $post['passenger-country-1'] : '';
$passengerAddress = isset($post['passenger-address-1']) ? $post['passenger-address-1'] : '';
$accepttandc = isset($post['accepttandc']) ? $post['accepttandc'] : 0;
$isgstapply = isset($post['isgstapply']) ? $post['isgstapply'] : 0;
$countryCodeISO = isset($post['countryCodeISO']) ? $post['countryCodeISO'] : 0;
$roomjson = array();
$roomjson[1]['Adult'] = $adultCount;
$roomjson[1]['Child'] = $childCount;
$roomjson[1]['bedtype'] = '';
$roomjson[1]['departuredate'] = $departureDates;
$roomjson[1]['returndate'] = $returnDate;
$roomjson[1]['fromaircode'] = $oneway_origin_text;
$roomjson[1]['toaircode'] = $oneway_destination_text;
$roomjson[1]['airclass'] = $class;
for ($c = 1; $c <= $childCount; $c++) {
$childsage = $infantCount;
$roomjson[$c]['Adult'] = $adultCount;
$roomjson[$c]['Child'] = $childCount;
$roomjson[$c]['ChildAge_' . $c] = $childsage;
$roomjson[$c]['bedtype'] = '';
$roomjson[$c]['departuredate'] = $departureDates;
$roomjson[$c]['returndate'] = $returnDate;
$roomjson[$c]['fromaircode'] = $oneway_origin_text;
$roomjson[$c]['toaircode'] = $oneway_destination_text;
$roomjson[$c]['airclass'] = $class;
}
$RoomInfoJson = json_encode($roomjson);
$totalPassengers = $adultCount + $childCount + $infantCount;
$arrCustomer = array();
$ForCustomerSession = array();
$ForMemberSession = array();
$arrCustomerMembers = array();
$arrmembersId = array();
$key = 0;
for ($i = 1; $i <= $totalPassengers; $i++) {
$paxType = $post['paxType-' . $i];
$firstName = $post['passenger-firstname-' . $i];
$lastName = $post['passenger-lastname-' . $i];
$relation = $post['relation-' . $i];
$salutation = $post['salution-' . $i];
$add_travellerslist = isset($post['add_travellerslist-' . $i]) ? $post['add_travellerslist-' . $i] : 0;
//$getSalutation = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getSalutationByid($salutation);
$CustomerSysIdPost = $post['CustomerSysId-' . $i];
$IsExistcustomer = '';
if (!empty($CustomerSysIdPost) && $CustomerSysIdPost != '0') {
$IsExistcustomer = $objFlight->CheckCustomer('tbl_customer', array('CustomerSysId' => $CustomerSysIdPost));
//$IsExistMember = $objFlight->CheckMember('tbl_customer_member', array('CustomerMemberSysId' => $CustomerSysIdPost));
}
//echo '<pre>';print_r($IsExistcustomer);die;
$passengerPassportNo = isset($post['passportno-' . $i]) ? $post['passportno-' . $i] : '';
$passengerPassportExpiry = isset($post['passportnoexpiry-' . $i]) ? $post['passportnoexpiry-' . $i] : '00/00/0000';
$passporIssue = isset($post['passporIssue-' . $i]) ? $post['passporIssue-' . $i] : '00/00/0000';
if (!empty($passengerPassportExpiry)) {
$passengerPassportExpiry = explode("/", $passengerPassportExpiry);
$passengerPassportExpiry = $passengerPassportExpiry[2] . "-" . $passengerPassportExpiry[1] . "-" . $passengerPassportExpiry[0];
}
if (!empty($passporIssue)) {
$passporIssue = explode("/", $passporIssue);
$passporIssue = $passporIssue[2] . "-" . $passporIssue[1] . "-" . $passporIssue[0];
}
if (empty(trim($firstName))) {
$response = array('succes' => false, 'msg' => 'Please fill out all first name.', 'index' => 'passenger-firstname-' . $i);
echo json_encode($response);
exit;
}
if (empty(trim($lastName))) {
$response = array('succes' => false, 'msg' => 'Please fill out all last name.', 'index' => 'passenger-lastname-' . $i);
echo json_encode($response);
exit;
}
if (isset($post['dateofbirth-' . $i]) && !empty($post['dateofbirth-' . $i])) {
$dateofbirth = explode('/', $post['dateofbirth-' . $i]);
$dobday = $dateofbirth[0];
$dobmonth = $dateofbirth[1];
$dobyear = $dateofbirth[2];
$passengerDob = $dobyear . '-' . $dobmonth . '-' . $dobday;
} else {
$response = array('succes' => false, 'msg' => 'Please fill out all date of birth.', 'index' => 'dateofbirth-' . $i);
echo json_encode($response);
exit;
}
if (empty($dobday)) {
$response = array('succes' => false, 'msg' => 'Please select day.', 'index' => 'dobday' . $i);
echo json_encode($response);
exit;
}
if (empty($dobmonth)) {
$response = array('succes' => false, 'msg' => 'Please select month.', 'index' => 'dobmonth' . $i);
echo json_encode($response);
exit;
}
if (empty($dobyear)) {
$response = array('succes' => false, 'msg' => 'Please select year.', 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
if (!empty($paxType) && $paxType == 1) {
$AdultAge = date_diff(date_create($passengerDob), date_create($departureDatesAD))->y;
if ($AdultAge < 12) {
$response = array('succes' => false, 'msg' => "Adult age should be greater than 12 years. ", 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
}
if (!empty($paxType) && $paxType == 2) {
$childAge = date_diff(date_create($passengerDob), date_create($departureDatesAD))->y;
if ($childAge < 2 || $childAge >= 12) {
$response = array('succes' => false, 'msg' => "Child age should be 2 years or less than 12 years. ", 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
}
if (!empty($paxType) && $paxType == 3) {
$infantAge = date_diff(date_create($passengerDob), date_create($departureDatesAD))->y;
if ($infantAge >= 2) {
$response = array('succes' => false, 'msg' => "Infant age should be less than 2 years. ", 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
}
// if (empty(trim($passengerCity))) {
// $response = array('succes' => false, 'msg' => 'Please enter City.', 'index' => 'passenger-city-1');
// echo json_encode($response);
// exit;
// }
// if (empty(trim($passengerAddress))) {
// $response = array('succes' => false, 'msg' => 'Please enter Address.', 'index' => 'passenger-address-1');
// echo json_encode($response);
// exit;
// }
if (empty(trim($leadMobile))) {
$response = array('succes' => false, 'msg' => 'Please enter lead pax mobile.', 'index' => 'leadMobile');
echo json_encode($response);
exit;
}
if (empty(trim($leadEmail))) {
$response = array('succes' => false, 'msg' => 'Please enter lead pax email id.', 'index' => 'leadEmail');
echo json_encode($response);
exit;
}
if ($interNationalSearch == 1) {
if (empty(trim($passengerPassportNo))) {
$response = array('succes' => false, 'msg' => 'Please enter Passport No.', 'index' => 'passportno-' . $i);
echo json_encode($response);
exit;
}
if (empty($passengerPassportExpiry) && $passengerPassportExpiry != '0000-00-00') {
$response = array('succes' => false, 'msg' => 'Please enter Passport Expiry.', 'index' => 'passportnoexpiry-' . $i);
echo json_encode($response);
exit;
}
if (empty($passporIssue) && $passporIssue != '0000-00-00') {
$response = array('succes' => false, 'msg' => 'Please enter Passport Issue Date.', 'index' => 'passportnoexpiry-' . $i);
echo json_encode($response);
exit;
}
}
// if ($accepttandc == 0) {
// $response = array('succes' => false, 'msg' => 'please accept the terms and conditions', 'index' => 'accepttandc');
// echo json_encode($response);
// exit;
// }
// die;
$ForCustomerSession[$key]['CityTitle'] = $CityTitle;
if ($i == 1 && $relation == 0) {
$apiData = array(
"AgencySysId" => $this->gtxagencysysid,
"Salutation" => $salutation,
"EmailId" => $leadEmail,
"FirstName" => $firstName,
"LastName" => $lastName,
"CountryCode" => $countryCode,
"MobileNo" => $leadMobile,
);
$model = new Gtxwebservices_Model_Webservices();
$result = $model->CreateCustomer($apiData);
$apiCustomer = json_decode($result, true);
$arrCustomer = $ForCustomerSession[$key] = array(
'AgencySysId' => $this->gtxagencysysid,
'EmailId' => $leadEmail,
'Salutation' => $salutation,
//'Gender_Id' => 0,//$getSalutation['Gender_Id'],
'Relation' => $relation,
'Contacts' => $leadMobile,
'FirstName' => $firstName,
'LastName' => $lastName,
'Password' => '',
'IsPswExpire' => 0,
'CreatedByUserSysId' => $this->gtxagencysysid,
'DOB' => $passengerDob,
//'PassportNo' => $passengerPassportNo,
// 'PassportExpiry' => ($interNationalSearch == 1)?$passengerPassportExpiry:'',
'Address' => $passengerAddress,
'CityTitle' => $CityTitle,
'CitySysId' => $passengerCity,
'paxType' => $paxType,
'StateOrZoneSysId' => 0,
'CountrySysId' => $CountrySysId,
'countryCode' => $countryCode,
'RegisterDate' => Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss'),
'IsApproved' => 0,
'IsActive' => 1,
'IsMarkForDel' => '0',
);
if ($apiCustomer['status'] == 1) {
$arrCustomer['GTX_customerSysId'] = $apiCustomer['Message'];
}
// $this->postFields = "";
// $this->postFields .= "&AgencySysId=" . $this->gtxagencysysid;
// $this->postFields .= "&EmailId=" . $leadEmail;
// $this->postFields .= "&Contacts=" . $leadMobile;
// $this->postFields .= "&FirstName=" . $firstName;
// $this->postFields .= "&LastName=" . $lastName;
// $model = new Gtxwebservices_Model_Webservices();
// $result = $model->UpdateCustomer($this->postFields);
if ($isgstapply == 1) {
$arrCustomer['companyname'] = $ForCustomerSession[$key]['companyname'] = $companyname;
$arrCustomer['gstnnumber'] = $ForCustomerSession[$key]['gstnnumber'] = $gstnnumber;
$arrCustomer['gstaddress'] = $ForCustomerSession[$key]['gstaddress'] = $gstaddress;
$arrCustomer['gstcity'] = $ForCustomerSession[$key]['gstcity'] = $gstcity;
$arrCustomer['gststate'] = $ForCustomerSession[$key]['gststate'] = $gststate;
$arrCustomer['gstpincode'] = $ForCustomerSession[$key]['gstpincode'] = $gstpincode;
}
if ($interNationalSearch == 1) {
$arrCustomer['PassportNo'] = $ForCustomerSession[$key]['PassportNo'] = ($interNationalSearch == 1) ? $passengerPassportNo : '';
$arrCustomer['PassportExpiry'] = $ForCustomerSession[$key]['PassportExpiry'] = ($interNationalSearch == 1) ? $passengerPassportExpiry : '';
$arrCustomer['passporIssue'] = $ForCustomerSession[$key]['passporIssue'] = ($interNationalSearch == 1) ? $passporIssue : '';
}
// echo '<pre>';
// print_r($IsExistcustomer);
// die('dd');
if (!empty($IsExistcustomer)) {
$arrCustomer['modified'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$model = new Gtxwebservices_Model_Webservices();
$result = $model->UpdateCustomer($arrCustomer);
$apiCustomer = json_decode($result, true);
if ($apiCustomer['status'] == 1) {
$arrCustomer['GTX_customerSysId'] = $apiCustomer['Message'];
}
$where = "CustomerSysId = " . $CustomerSysIdPost; //exit;
$objFlight->UpdateFlightData('tbl_customer', $arrCustomer, $where);
$CustomerSysId = $CustomerSysIdPost;
} elseif ($add_travellerslist == 1 && empty($tbl_customer)) {
$arrCustomer['apiTraceId'] = $post['traceId'];
$arrCustomer['modified'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$arrCustomer['created'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$CustomerSysId = $objFlight->InsertFlightData('tbl_customer', $arrCustomer);
} else {
$arrCustomer['CustomerSysId'] = $tbl_customer[0]['CustomerSysId'];
$arrCustomer['apiTraceId'] = $post['traceId'];
$arrCustomer['modified'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$arrCustomer['created'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$CustomerSysId = $Isadultmem = $objFlight->InsertFlightData('tbl_customer_member', $arrCustomer);
}
$arrmembersId[] = $CustomerSysId;
$ForCustomerSession[$key]['CustomerSysId'] = $CustomerSysId;
$CustomerSysIdSession = new Zend_Session_Namespace('CustomerSysIdSession');
$LeadPaxSession = new Zend_Session_Namespace('LeadPaxSession');
$CustomerSysIdSession->params = $CustomerSysId;
$arrCustomer['CustomerSysId'] = $CustomerSysId;
$LeadPaxSession->params = $arrCustomer;
} else {
$IsExistMember = '';
if (!empty($CustomerSysIdPost) && $CustomerSysIdPost != '0') {
$IsExistMember = $objFlight->CheckMember('tbl_customer_member', array('CustomerMemberSysId' => $CustomerSysIdPost));
}
$arrCustomerMembers = $ForCustomerSession[$key] = array(
'AgencySysId' => $this->gtxagencysysid,
'CustomerSysId' => (!empty($CustomerSysId) && $Isadultmem == 0) ? $CustomerSysId : @$tbl_customer[0]['CustomerSysId'],
'EmailId' => $leadEmail,
'Salutation' => $salutation,
//'Gender_Id' => $getSalutation['Gender_Id'],
'Relation' => $relation,
'Contacts' => $leadMobile,
'FirstName' => $firstName,
'LastName' => $lastName,
'Password' => '',
'IsPswExpire' => 0,
'CreatedByUserSysId' => $this->gtxagencysysid,
'DOB' => $passengerDob,
//'PassportNo' => $passengerPassportNo,
// 'PassportExpiry' => ($interNationalSearch == 1)?$passengerPassportExpiry:'',
'Address' => $passengerAddress,
'CityTitle' => $CityTitle,
'CitySysId' => $passengerCity,
'paxType' => $paxType,
'StateOrZoneSysId' => 0,
'CountrySysId' => $CountrySysId,
'countryCode' => $countryCode,
'RegisterDate' => Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss'),
'IsApproved' => 0,
'IsActive' => 1,
'IsMarkForDel' => '0',
);
if ($isgstapply == 1) {
$arrCustomerMembers['companyname'] = $ForCustomerSession[$key]['companyname'] = $companyname;
$arrCustomerMembers['gstnnumber'] = $ForCustomerSession[$key]['gstnnumber'] = $gstnnumber;
$arrCustomerMembers['gstaddress'] = $ForCustomerSession[$key]['gstaddress'] = $gstaddress;
$arrCustomerMembers['gstcity'] = $ForCustomerSession[$key]['gstcity'] = $gstcity;
$arrCustomerMembers['gststate'] = $ForCustomerSession[$key]['gststate'] = $gststate;
$arrCustomerMembers['gstpincode'] = $ForCustomerSession[$key]['gstpincode'] = $gstpincode;
}
if ($interNationalSearch == 1) {
$arrCustomerMembers['PassportNo'] = $ForCustomerSession[$key]['PassportNo'] = ($interNationalSearch == 1) ? $passengerPassportNo : '';
$arrCustomerMembers['PassportExpiry'] = $ForCustomerSession[$key]['PassportExpiry'] = ($interNationalSearch == 1) ? $passengerPassportExpiry : '';
$arrCustomerMembers['passporIssue'] = $ForCustomerSession[$key]['passporIssue'] = ($interNationalSearch == 1) ? $passporIssue : '';
}
//$IsExistcustomer = $objFlight->CheckCustomer('tbl_customer', array('CustomerSysId' => $leadMobile, 'EmailId' => $leadEmail));
//$CustomerSysId = $CustomerSysIdPost;
if (!empty($IsExistMember)) {
$arrCustomerMembers['CustomerSysId'] = $ForCustomerSession[$key]['CustomerSysId'] = $IsExistMember['CustomerSysId'];
$arrCustomerMembers['modified'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$where = "CustomerMemberSysId = " . $CustomerSysIdPost; //exit;
$objFlight->UpdateFlightData('tbl_customer_member', $arrCustomerMembers, $where);
$CustomerMemberSysId = $CustomerSysIdPost;
if ($i == 1) {
$bookCustomerId = $CustomerSysIdPost;
}
} elseif ($add_travellerslist == 1) {
//$arrCustomerMembers['CustomerSysId'] = $ForCustomerSession[$key]['CustomerSysId'] = $IsExistcustomer['CustomerSysId'];
$arrCustomerMembers['apiTraceId'] = $post['traceId'];
$arrCustomerMembers['modified'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$arrCustomerMembers['created'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$CustomerMemberSysId = $bookCustomerId = $objFlight->InsertFlightData('tbl_customer_member', $arrCustomerMembers);
} else {
$CustomerMemberSysId = 0;
}
$ForCustomerSession[$key]['CustomerMemberSysId'] = $CustomerMemberSysId;
$arrCustomerMembers['CustomerMemberSysId'] = $CustomerMemberSysId;
$CustomerMembersSessionArr[] = $arrCustomerMembers;
$arrmembersId[] = $CustomerMemberSysId;
}
$ForCustomerSession[$key]['isgstapply'] = $isgstapply;
$ForCustomerSession[$key]['countryCodeISO'] = $countryCodeISO;
$key++;
}
// echo '<pre>';
// print_r($CustomerSysId);
// echo '<pre>';
// print_r($ForCustomerSession);
// die('s');
$this->objMdl->rv_delete('tbl_flight_booking', array('apiTraceId = ?' => $post['traceId']));
$this->objMdl->rv_delete('tbl_flight_booking_customer', array('apiTraceId = ?' => $post['traceId']));
$flight_booking_customer = [];
if ($interNationalSearch == 1 && $route == 2) {
$dataArrInter = $this->CreateInternationDataArr($FlightBookingDataRoundInter->params, !empty($CustomerSysId) ? $CustomerSysId : $bookCustomerId);
//echo '<pre>';print_r($dataArrInter);
//die;
$flight_booking_id = $flight_booking_id_Arr[] = $objFlight->InsertFlightData('tbl_flight_booking', $dataArrInter['origin']);
$dataArrInter['destination']['parent_id'] = $flight_booking_id;
$flight_booking_id = $flight_booking_id_Arr[] = $objFlight->InsertFlightData('tbl_flight_booking', $dataArrInter['destination']);
$flight_booking_customer[0] = $this->InsertFlightBookingCustomer($ForCustomerSession, $arrmembersId, $BookingData[0]);
$flight_booking_customer_id = new Zend_Session_Namespace('flight_booking_customer_id');
$flight_booking_customer_id->params = $flight_booking_customer;
} else {
if ($BookingData) {
foreach ($BookingData as $k => $value) {
//print_r($arrmembersId);die;
$arrPlanAir['AgencySysId'] = $this->gtxagencysysid;
$arrPlanAir['CustomerSysId'] = !empty($CustomerSysId) ? $CustomerSysId : $bookCustomerId;
$arrPlanAir['FlightNumber'] = $value['FlightNumber'];
$arrPlanAir['AirlineName'] = $value['AirlineName'];
$arrPlanAir['TravelDate'] = $value['TravelDate'];
$arrPlanAir['IsLCC'] = $value['IsLCC'];
$arrPlanAir['IsRefundable'] = ($value['IsRefundable']) ? $value['IsRefundable'] : 0;
$arrPlanAir['apiTraceId'] = $value['apiTraceId'];
$arrPlanAir['AirlineSysId'] = $value['AirlineSysId'];
$arrPlanAir['DepartureTime'] = $value['DepartureTime'];
$arrPlanAir['ArrivalTime'] = $value['ArrivalTime'];
$arrPlanAir['IsDirect'] = $value['IsDirect'];
$arrPlanAir['FareClass'] = $value['FareClass'];
$arrPlanAir['FlyingMinutes'] = $value['FlyingMinutes'];
$arrPlanAir['FlightDuration'] = $value['FlightDuration'];
$arrPlanAir['SourcePlaceSysId'] = $value['SourcePlaceSysId'];
$arrPlanAir['DestPlaceSysId'] = $value['DestPlaceSysId'];
$arrPlanAir['SourceAirportCode'] = $value['SourceAirportCode'];
$arrPlanAir['DestAirportCode'] = $value['DestAirportCode'];
$arrPlanAir['StopCount'] = $value['StopCount'];
$arrPlanAir['TotalFlightMembers'] = $value['TotalFlightMembers'];
$arrPlanAir['CurrencyType'] = $value['CurrencyType'];
$arrPlanAir['PublishedFare'] = $value['FairRules']['PublishedFare'];
$arrPlanAir['ApiResultIndex'] = $value['ApiResultIndex'];
$arrPlanAir['JourneyType'] = $value['JourneyType'];
$arrPlanAir['TripType'] = $value['TripType'];
$arrPlanAir['IsInternational'] = ($value['IsInternational']) ? $value['IsInternational'] : 0;
$arrPlanAir['logo'] = $value['logo'];
$arrPlanAir['Currency'] = $value['FairRules']['Currency'];
$arrPlanAir['BaseFare'] = $value['FairRules']['BaseFare'];
$arrPlanAir['Tax'] = $value['FairRules']['Tax'];
$arrPlanAir['YQTax'] = $value['FairRules']['YQTax'];
$arrPlanAir['OtherCharges'] = $value['FairRules']['OtherCharges'];
$arrPlanAir['Discount'] = $value['FairRules']['Discount'];
$arrPlanAir['ServiceFee'] = $value['FairRules']['ServiceFee'];
$arrPlanAir['OfferedFare'] = $value['FairRules']['PublishedFare'];
$arrPlanAir['status'] = 0;
$arrPlanAir['IsMarkForDel'] = 0;
$arrPlanAir['created_at'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$arrPlanAir['updated_at'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
// echo '<pre>';print_r($arrPlanAir);die;
if ($k == 0) {
$flight_booking_id = $flight_booking_id_Arr[] = $objFlight->InsertFlightData('tbl_flight_booking', $arrPlanAir);
} else {
$arrPlanAir['parent_id'] = $flight_booking_id;
$flight_booking_id = $flight_booking_id_Arr[] = $objFlight->InsertFlightData('tbl_flight_booking', $arrPlanAir);
}
$flight_booking_customer[$k] = $this->InsertFlightBookingCustomer($ForCustomerSession, $arrmembersId, $value);
}
$flight_booking_customer_id = new Zend_Session_Namespace('flight_booking_customer_id');
$flight_booking_customer_id->params = $flight_booking_customer;
}
}
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$CustomerSession->params = $ForCustomerSession;
$CustomerMembersSession = new Zend_Session_Namespace('CustomerMembersSession');
$CustomerMembersSession->params = $CustomerMembersSessionArr;
$sessionData = array('CustomerSysId' => $CustomerSysId, 'CustomerMemSysId' => $arrmembersId, 'flight_booking_id' => $flight_booking_id_Arr);
$CustomerMemberSysIds = new Zend_Session_Namespace('CustomerMemberSysIds');
$CustomerMemberSysIds->params = $sessionData;
//$this->genrateFlightQuery($post);
// print_r($post);die;
if ($flight_booking_customer) {
$genrateFlightQuery = $this->genrateFlightQuery($post);
$queryStatus = isset($genrateFlightQuery['status']) ? $genrateFlightQuery['status'] : 0;
if ($queryStatus == 0) {
$this->objMdl->rv_delete('tbl_customer', array('apiTraceId = ?' => $post['traceId']));
$this->objMdl->rv_delete('tbl_customer_member', array('apiTraceId = ?' => $post['traceId']));
$this->objMdl->rv_delete('tbl_flight_booking', array('apiTraceId = ?' => $post['traceId']));
$this->objMdl->rv_delete('tbl_flight_booking_customer', array('apiTraceId = ?' => $post['traceId']));
$response = array('succes' => false, 'msg' => 'This booking is not processed. Please contact to administrator.', 'index' => '');
echo json_encode($response);
exit;
}
//$this->db->commit();
$response = array('success' => true, 'msg' => 'Done', 'apiTraceId' => $traceId);
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'msg' => 'oops somehting went wrong.');
echo json_encode($response);
exit;
}
} catch (Exception $e) {
//$this->db->rollBack();
print_r($e->getMessage());
}
}
}
public function InsertFlightBookingCustomer($data, $arrmembersId, $arrPlain)
{
$objFlight = new Travel_Model_FlightMaster();
$flight_booking_customer = [];
$i = 0;
if ($data) {
foreach ($data as $k => $value) {
$baggage = $arrPlain['FairRules']['FareBreakdown'][$k];
$arrCustomerMembers = array(
'AgencySysId' => $this->gtxagencysysid,
'CustomerSysId' => $arrmembersId[$i],
'apiTraceId' => $arrPlain['apiTraceId'],
'EmailId' => $value['EmailId'],
'Salutation' => $value['Salutation'],
'Relation' => $value['Relation'],
'Contacts' => $value['Contacts'],
'FirstName' => $value['FirstName'],
'LastName' => $value['LastName'],
'Password' => $value['Password'],
'IsPswExpire' => $value['IsPswExpire'],
'CreatedByUserSysId' => $value['CreatedByUserSysId'],
'DOB' => $value['DOB'],
'PassportNo' => $value['PassportNo'],
'PassportExpiry' => $value['PassportExpiry'],
'Address' => $value['Address'],
'CityTitle' => $value['CityTitle'],
'CitySysId' => $value['CitySysId'],
'paxType' => $value['paxType'],
'StateOrZoneSysId' => $value['StateOrZoneSysId'],
'CountrySysId' => $value['CountrySysId'],
'countryCode' => $value['countryCode'],
'companyname' => $value['companyname'],
'gstnnumber' => $value['gstnnumber'],
'Baggage' => !empty($baggage['Baggage']) ? $baggage['Baggage'] : '',
'CabinBaggage' => !empty($baggage['CabinBaggage']) ? $baggage['CabinBaggage'] : '',
'RegisterDate' => Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss'),
'IsApproved' => 0,
'IsActive' => 1,
'IsMarkForDel' => '0',
);
//echo '<pre>';print_r($arrCustomerMembers);
//die;
$flight_booking_customer[$k] = $objFlight->InsertFlightData('tbl_flight_booking_customer', $arrCustomerMembers);
$i++;
}
return $flight_booking_customer;
}
}
public function CreateInternationDataArr($BookingData, $CustomerSysId)
{
$arrPlanAir = [];
$arrPlanAirDes = [];
$url = $this->baseUrl . "public/data/dynamic/flight_destinations.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$str = curl_exec($ch);
// $str = file_get_contents($this->baseUrl . 'public/data/dynamic/flight_destinations.json');
$Destinationjson = json_decode($str, true);
$arrCurrencyList = $this->getCurrencyIdsAndSymbolList();
$arrAirlineList = $this->getAirlineIdsAndCodeList();
if ($BookingData) {
foreach ($BookingData as $k => $val) {
$value = $val['origin'];
$filterByFrom = $value['SourceAirportCode'];
$filterByTo = $value['DestAirportCode'];
$arrSourceCityId_ = array_filter($Destinationjson, function ($var) use ($filterByFrom) {
return ($var['AirportCode'] == $filterByFrom);
});
$arrdestinationCityId_ = array_filter($Destinationjson, function ($var) use ($filterByTo) {
return ($var['AirportCode'] == $filterByTo);
});
$Currency = $value['FairRules']['Currency'];
$currencySysId = !empty($arrCurrencyList[$Currency]) ? $arrCurrencyList[$Currency] : '1';
$arrSourceCityId = array_values($arrSourceCityId_);
$arrdestinationCityId = array_values($arrdestinationCityId_);
if (count($value['Segments']) > 1) {
$IsDirect = '1';
} else {
$IsDirect = '0';
}
$FlyingMinutes = 0;
if (count($value['Segments']) > 0) {
foreach ($value['Segments'] as $segmentsResult) {
$FlyingMinutes = $FlyingMinutes + ((isset($segmentsResult['Duration']) ? $segmentsResult['Duration'] : 0) + (!empty($segmentsResult['GroundTime']) ? $segmentsResult['GroundTime'] : (isset($segmentsResult['AccumulatedDuration']) ? $segmentsResult['AccumulatedDuration'] : 0)));
}
}
$airlineSysId = !empty($arrAirlineList[$value['Segments'][0]['AirlineCode']]) ? $arrAirlineList[$value['Segments'][0]['AirlineCode']] : '0';
$arrPlanAir['AgencySysId'] = $this->gtxagencysysid;
$arrPlanAir['CustomerSysId'] = $CustomerSysId;
$arrPlanAir['FlightNumber'] = $value['OrFlightNumber'];
$arrPlanAir['AirlineName'] = $value['AirlineName'];
$arrPlanAir['TravelDate'] = $value['TravelDate'];
$arrPlanAir['IsLCC'] = $value['IsLCC'];
$arrPlanAir['IsRefundable'] = ($value['IsRefundable']) ? $value['IsRefundable'] : 0;
$arrPlanAir['apiTraceId'] = $val['FairRules']['PriceID'];
$arrPlanAir['AirlineSysId'] = $airlineSysId;
$arrPlanAir['DepartureTime'] = $value['DepartureTime'];
$arrPlanAir['ArrivalTime'] = $value['ArrivalTime'];
$arrPlanAir['IsDirect'] = $IsDirect;
$arrPlanAir['FareClass'] = $value['FareClass'];
$arrPlanAir['FlyingMinutes'] = $FlyingMinutes;
$arrPlanAir['FlightDuration'] = $value['FlightDuration'];
$arrPlanAir['SourcePlaceSysId'] = $arrSourceCityId[0]['CityID'];
$arrPlanAir['DestPlaceSysId'] = $arrdestinationCityId[0]['CityID'];
$arrPlanAir['SourceAirportCode'] = $value['SourceAirportCode'];
$arrPlanAir['DestAirportCode'] = $value['DestAirportCode'];
$arrPlanAir['StopCount'] = $value['StopCount'];
$arrPlanAir['TotalFlightMembers'] = $value['TotalFlightMembers'];
$arrPlanAir['CurrencyType'] = $currencySysId;
$arrPlanAir['PublishedFare'] = $val['FairRules']['PublishedFare'];
$arrPlanAir['ApiResultIndex'] = $val['FairRules']['PriceID'];
$arrPlanAir['JourneyType'] = $value['JourneyType'];
$arrPlanAir['TripType'] = $value['TripType'];
$arrPlanAir['IsInternational'] = ($value['IsInternational']) ? $value['IsInternational'] : 0;
$arrPlanAir['logo'] = $value['logo'];
$arrPlanAir['Currency'] = $val['FairRules']['Currency'];
$arrPlanAir['BaseFare'] = $val['FairRules']['BaseFare'];
$arrPlanAir['Tax'] = $val['FairRules']['Tax'];
$arrPlanAir['YQTax'] = $val['FairRules']['YQTax'];
$arrPlanAir['OtherCharges'] = $val['FairRules']['OtherCharges'];
$arrPlanAir['Discount'] = $val['FairRules']['Discount'];
$arrPlanAir['ServiceFee'] = $val['FairRules']['ServiceFee'];
$arrPlanAir['OfferedFare'] = $val['FairRules']['PublishedFare'];
$arrPlanAir['status'] = 0;
$arrPlanAir['IsMarkForDel'] = 0;
$arrPlanAir['created_at'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$arrPlanAir['updated_at'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$values = $val['destination'];
$filterByFrom = $values['SourceAirportCode'];
$filterByTo = $values['DestAirportCode'];
$arrSourceCityId_ = array_filter($Destinationjson, function ($var) use ($filterByFrom) {
return ($var['AirportCode'] == $filterByFrom);
});
$arrdestinationCityId_ = array_filter($Destinationjson, function ($var) use ($filterByTo) {
return ($var['AirportCode'] == $filterByTo);
});
$Currency = $values['FairRules']['Currency'];
$currencySysId = !empty($arrCurrencyList[$Currency]) ? $arrCurrencyList[$Currency] : '1';
$arrSourceCityId = array_values($arrSourceCityId_);
$arrdestinationCityId = array_values($arrdestinationCityId_);
if (count($values['Segments']) > 1) {
$IsDirect = '1';
} else {
$IsDirect = '0';
}
$FlyingMinutes = 0;
if (count($values['Segments']) > 0) {
foreach ($values['Segments'] as $segmentsResult) {
$FlyingMinutes = $FlyingMinutes + ((isset($segmentsResult['Duration']) ? $segmentsResult['Duration'] : 0) + (!empty($segmentsResult['GroundTime']) ? $segmentsResult['GroundTime'] : (isset($segmentsResult['AccumulatedDuration']) ? $segmentsResult['AccumulatedDuration'] : 0)));
}
}
$airlineSysId = !empty($arrAirlineList[$values['Segments'][0]['AirlineCode']]) ? $arrAirlineList[$values['Segments'][0]['AirlineCode']] : '0';
$arrPlanAirDes['AgencySysId'] = $this->gtxagencysysid;
$arrPlanAirDes['CustomerSysId'] = $CustomerSysId;
$arrPlanAirDes['FlightNumber'] = $values['DeFlightNumber'];
$arrPlanAirDes['AirlineName'] = $values['AirlineName'];
$arrPlanAirDes['TravelDate'] = $value['TravelDate'];
$arrPlanAirDes['IsLCC'] = $values['IsLCC'];
$arrPlanAirDes['IsRefundable'] = $values['IsRefundable'];
$arrPlanAirDes['apiTraceId'] = $val['FairRules']['PriceID'];
$arrPlanAirDes['AirlineSysId'] = $airlineSysId;
$arrPlanAirDes['DepartureTime'] = $values['DepartureTime'];
$arrPlanAirDes['ArrivalTime'] = $values['ArrivalTime'];
$arrPlanAirDes['IsDirect'] = $IsDirect;
$arrPlanAirDes['FareClass'] = $values['FareClass'];
$arrPlanAirDes['FlyingMinutes'] = $FlyingMinutes;
$arrPlanAirDes['FlightDuration'] = $values['FlightDuration'];
$arrPlanAirDes['SourcePlaceSysId'] = $arrSourceCityId[0]['CityID'];
$arrPlanAirDes['DestPlaceSysId'] = $arrdestinationCityId[0]['CityID'];
$arrPlanAirDes['SourceAirportCode'] = $values['SourceAirportCode'];
$arrPlanAirDes['DestAirportCode'] = $values['DestAirportCode'];
$arrPlanAirDes['StopCount'] = $values['StopCount'];
$arrPlanAirDes['TotalFlightMembers'] = $values['TotalFlightMembers'];
$arrPlanAirDes['CurrencyType'] = $currencySysId;
$arrPlanAirDes['PublishedFare'] = $val['FairRules']['PublishedFare'];
$arrPlanAirDes['ApiResultIndex'] = $val['FairRules']['PriceID'];
$arrPlanAirDes['JourneyType'] = $values['JourneyType'];
$arrPlanAirDes['TripType'] = $values['TripType'];
$arrPlanAirDes['IsInternational'] = ($values['IsInternational']) ? $values['IsInternational'] : 0;
$arrPlanAirDes['logo'] = $values['logo'];
$arrPlanAirDes['Currency'] = $val['FairRules']['Currency'];
$arrPlanAirDes['BaseFare'] = $val['FairRules']['BaseFare'];
$arrPlanAirDes['Tax'] = $val['FairRules']['Tax'];
$arrPlanAirDes['YQTax'] = $val['FairRules']['YQTax'];
$arrPlanAirDes['OtherCharges'] = $val['FairRules']['OtherCharges'];
$arrPlanAirDes['Discount'] = $val['FairRules']['Discount'];
$arrPlanAirDes['ServiceFee'] = $val['FairRules']['ServiceFee'];
$arrPlanAirDes['OfferedFare'] = $val['FairRules']['PublishedFare'];
$arrPlanAirDes['status'] = 0;
$arrPlanAirDes['IsMarkForDel'] = 0;
$arrPlanAirDes['created_at'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
$arrPlanAirDes['updated_at'] = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');
//echo '<pre>';print_r($arrPlanAir);
//echo '<pre>';print_r($arrPlanAirDes);
return array('origin' => $arrPlanAir, 'destination' => $arrPlanAirDes);
}
}
}
public function ValidateSavePassenger($post, $BookingData)
{
$objFlight = new Travel_Model_FlightMaster();
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$class = $sessionFlightSearchParams->params['class'];
$interNationalSearch = $sessionFlightSearchParams->params['interNationalSearch'];
$route = $sessionFlightSearchParams->params['route'];
$departureDates = $sessionFlightSearchParams->params['departure_date'];
$returnDate = $sessionFlightSearchParams->params['return_date'];
if (!empty($departureDates)) {
$arrDepartureDates = explode("/", $departureDates);
$departureDatesAD = $arrDepartureDates[2] . "-" . $arrDepartureDates[1] . "-" . $arrDepartureDates[0];
}
$param = array(
'leadMobile' => $post['leadMobile'],
'leadEmail' => $post['leadEmail'],
);
$tbl_customer = $objFlight->SearchFlightCustomer('tbl_customer', $param);
$RelationExist = isset($tbl_customer[0]['Relation']) ? $tbl_customer[0]['Relation'] : '';
/*if (!empty($tbl_customer) && $post['CustomerSysId-1'] == '0') {
$response = array('succes' => false, 'msg' => "It's seems your account already registered with us!. so please search and select from saved travellers list.", 'index' => 'passenger-firstname-' . $i);
echo json_encode($response);
exit;
}*/
//echo '<pre>';print_r($tbl_customer[0]['Relation']);
$adultCount = isset($sessionFlightSearchParams->params['adults']) ? $sessionFlightSearchParams->params['adults'] : 0;
$childCount = isset($sessionFlightSearchParams->params['childs']) ? $sessionFlightSearchParams->params['childs'] : 0;
$infantCount = isset($sessionFlightSearchParams->params['infants']) ? $sessionFlightSearchParams->params['infants'] : 0;
$oneway_origin_text = isset($sessionFlightSearchParams->params['sourceCityAirportCode']) ? $sessionFlightSearchParams->params['sourceCityAirportCode'] : '';
$oneway_destination_text = isset($sessionFlightSearchParams->params['destinationCityAirportCode']) ? $sessionFlightSearchParams->params['destinationCityAirportCode'] : '';
$leadMobile = isset($post['leadMobile']) ? $post['leadMobile'] : '';
$leadEmail = isset($post['leadEmail']) ? $post['leadEmail'] : '';
$countryCode = isset($post['countryCode']) ? $post['countryCode'] : '';
$companyname = isset($post['companyname']) ? $post['companyname'] : '';
$gstnnumber = isset($post['gstnnumber']) ? $post['gstnnumber'] : '';
$gstaddress = isset($post['gstaddress']) ? $post['gstaddress'] : '';
$gstcity = isset($post['gstcity']) ? $post['gstcity'] : '';
$gststate = isset($post['gststate']) ? $post['gststate'] : '';
$gstpincode = isset($post['gstpincode']) ? $post['gstpincode'] : '';
$CityTitle = isset($post['passenger-city-name-1']) ? $post['passenger-city-name-1'] : '';
$passengerCity = isset($post['passenger-city-1']) ? $post['passenger-city-1'] : '';
$CountrySysId = isset($post['passenger-country-1']) ? $post['passenger-country-1'] : '';
$passengerAddress = isset($post['passenger-address-1']) ? $post['passenger-address-1'] : '';
$accepttandc = isset($post['accepttandc']) ? $post['accepttandc'] : 0;
$isgstapply = isset($post['isgstapply']) ? $post['isgstapply'] : 0;
$totalPassengers = $adultCount + $childCount + $infantCount;
if (empty($leadMobile)) {
$response = array('succes' => false, 'msg' => 'Please enter mobile number.', 'index' => 'leadMobile');
echo json_encode($response);
exit;
}
if (strlen($leadMobile) != 10 && strlen($leadMobile) != 11) {
$response = array('succes' => false, 'msg' => 'Please enter a valid mobile number.', 'index' => 'leadMobile');
echo json_encode($response);
exit;
}
if (empty($leadEmail)) {
$response = array('succes' => false, 'msg' => 'Please enter Email ID.', 'index' => 'leadEmail');
echo json_encode($response);
exit;
}
if (!filter_var($leadEmail, FILTER_VALIDATE_EMAIL)) {
$msg = "Email address is not valid.";
$response = array('success' => false, 'msg' => $msg, 'index' => 'leadEmail');
echo json_encode($response);
exit;
}
//die('validate');
$key = 0;
$relation = [];
for ($i = 1; $i <= $totalPassengers; $i++) {
$paxType = $post['paxType-' . $i];
$firstName = $post['passenger-firstname-' . $i];
$lastName = $post['passenger-lastname-' . $i];
$relation[] = $post['relation-' . $i];
$salutation = $post['salution-' . $i];
//echo '<pre>';print_r($getSalutation);die;
$CustomerSysIdPost = $post['CustomerSysId-' . $i];
$IsExistcustomer = '';
if (!empty($CustomerSysIdPost) && $CustomerSysIdPost != '0') {
$IsExistcustomer = $objFlight->CheckCustomer('tbl_customer', array('CustomerSysId' => $CustomerSysIdPost));
}
// echo '<pre>';print_r($IsExistcustomer);die;
$passengerPassportNo = isset($post['passportno-' . $i]) ? $post['passportno-' . $i] : '00/00/0000';
$passengerPassportExpiry = isset($post['passportnoexpiry-' . $i]) ? $post['passportnoexpiry-' . $i] : '00/00/0000';
$passporIssue = isset($post['passporIssue-' . $i]) ? $post['passporIssue-' . $i] : '00/00/0000';
if (!empty($passengerPassportExpiry)) {
$passengerPassportExpiry = explode("/", $passengerPassportExpiry);
$passengerPassportExpiry = $passengerPassportExpiry[2] . "-" . $passengerPassportExpiry[1] . "-" . $passengerPassportExpiry[0];
}
if (!empty($passporIssue)) {
$passporIssue = explode("/", $passporIssue);
$passporIssue = $passporIssue[2] . "-" . $passporIssue[1] . "-" . $passporIssue[0];
}
if (empty(trim($firstName))) {
$response = array('succes' => false, 'msg' => 'Please fill out all first name.', 'index' => 'passenger-firstname-' . $i);
echo json_encode($response);
exit;
}
if (empty(trim($lastName))) {
$response = array('succes' => false, 'msg' => 'Please fill out all last name.', 'index' => 'passenger-lastname-' . $i);
echo json_encode($response);
exit;
}
if (isset($post['dateofbirth-' . $i]) && !empty($post['dateofbirth-' . $i])) {
$dateofbirth = explode('/', $post['dateofbirth-' . $i]);
$dobday = $dateofbirth[0];
$dobmonth = $dateofbirth[1];
$dobyear = $dateofbirth[2];
$passengerDob = $dobyear . '-' . $dobmonth . '-' . $dobday;
} else {
$response = array('succes' => false, 'msg' => 'Please fill out all date of birth.', 'index' => 'dateofbirth-' . $i);
echo json_encode($response);
exit;
}
if (empty($dobday)) {
$response = array('succes' => false, 'msg' => 'Please select day.', 'index' => 'dobday' . $i);
echo json_encode($response);
exit;
}
if (empty($dobmonth)) {
$response = array('succes' => false, 'msg' => 'Please select month.', 'index' => 'dobmonth' . $i);
echo json_encode($response);
exit;
}
if (empty($dobyear)) {
$response = array('succes' => false, 'msg' => 'Please select year.', 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
if (!empty($paxType) && $paxType == 1) {
$AdultAge = date_diff(date_create($passengerDob), date_create($departureDatesAD))->y;
if ($AdultAge < 12) {
$response = array('succes' => false, 'msg' => "Adult age should be greater than 12 years. ", 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
}
if (!empty($paxType) && $paxType == 2) {
$childAge = date_diff(date_create($passengerDob), date_create($departureDatesAD))->y;
if ($childAge < 2 || $childAge >= 12) {
$response = array('succes' => false, 'msg' => "Child age should be 2 years or less than 12 years. ", 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
}
if (!empty($paxType) && $paxType == 3) {
$infantAge = date_diff(date_create($passengerDob), date_create($departureDatesAD))->y;
if ($infantAge >= 2) {
$response = array('succes' => false, 'msg' => "Infant age should be less than 2 years. ", 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
}
if (empty(trim($passengerCity))) {
$response = array('succes' => false, 'msg' => 'Please enter City.', 'index' => 'passenger-city-1');
echo json_encode($response);
exit;
}
if (empty(trim($passengerAddress))) {
$response = array('succes' => false, 'msg' => 'Please enter Address.', 'index' => 'passenger-address-1');
echo json_encode($response);
exit;
}
if (empty(trim($leadMobile))) {
$response = array('succes' => false, 'msg' => 'Please enter lead pax mobile.', 'index' => 'leadMobile');
echo json_encode($response);
exit;
}
if (empty(trim($leadEmail))) {
$response = array('succes' => false, 'msg' => 'Please enter lead pax email id.', 'index' => 'leadEmail');
echo json_encode($response);
exit;
}
if ($interNationalSearch == 1) {
if (empty(trim($passengerPassportNo))) {
$response = array('succes' => false, 'msg' => 'Please enter Passport No.', 'index' => 'passportno-' . $i);
echo json_encode($response);
exit;
}
if (empty($passengerPassportExpiry) && $passengerPassportExpiry != '0000-00-00') {
$response = array('succes' => false, 'msg' => 'Please enter Passport Expiry.', 'index' => 'passportnoexpiry-' . $i);
echo json_encode($response);
exit;
}
if (empty($passporIssue) && $passporIssue != '0000-00-00') {
$response = array('succes' => false, 'msg' => 'Please enter Passport Issue Date.', 'index' => 'passportnoexpiry-' . $i);
echo json_encode($response);
exit;
}
}
if ($BookingData && $isgstapply == 0) {
foreach ($BookingData as $values) {
if ($values['IsGSTMandatory'] == 1) {
$response = array('succes' => false, 'msg' => 'GST mandatory for this flight.', 'index' => 'gstnnumber');
echo json_encode($response);
exit;
}
}
}
if ($isgstapply == 1) {
if (empty(trim($gstnnumber))) {
$response = array('succes' => false, 'msg' => 'Please enter GSTIN number.', 'index' => 'gstnnumber');
echo json_encode($response);
exit;
}
$is_valid_gstin = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->is_valid_gstin($gstnnumber);
if ($is_valid_gstin == 0) {
$response = array('succes' => false, 'msg' => 'Enter Valid GST Number', 'index' => 'gstnnumber');
echo json_encode($response);
exit;
}
if (empty(trim($companyname))) {
$response = array('succes' => false, 'msg' => 'Please enter company name.', 'index' => 'companyname');
echo json_encode($response);
exit;
}
if (empty(trim($gstaddress))) {
$response = array('succes' => false, 'msg' => 'Please enter GST address.', 'index' => 'gstaddress');
echo json_encode($response);
exit;
}
if (empty(trim($gstcity))) {
$response = array('succes' => false, 'msg' => 'Please enter GST city.', 'index' => 'gstcity');
echo json_encode($response);
exit;
}
if (empty(trim($gststate))) {
$response = array('succes' => false, 'msg' => 'Please enter GST state.', 'index' => 'gststate');
echo json_encode($response);
exit;
}
if (empty(trim($gstpincode))) {
$response = array('succes' => false, 'msg' => 'Please enter GST pincode.', 'index' => 'gstpincode');
echo json_encode($response);
exit;
}
}
// if ($accepttandc == 0) {
// $response = array('succes' => false, 'msg' => 'please accept the terms and conditions', 'index' => 'accepttandc');
// echo json_encode($response);
// exit;
// }
// die;
}
// if($RelationExist == 0){
// $RelationExist = (array)$RelationExist;
// $FinalRelation = array_merge($RelationExist,$relation);
// }else{
// $FinalRelation = $relation;
// }
// $indexes = array_keys(array_unique($FinalRelation), 0);
$array_count_values = array_count_values($relation);
$indexes = isset($array_count_values[0]) ? $array_count_values[0] : '';
// if ($indexes == 1 && $RelationExist == 0 && $post['CustomerSysId-1'] == 0) {
// $response = array('success' => false, 'msg' => 'Self relation should be unique.', 'index' => 'relation');
// echo json_encode($response);
// exit;
// }
//die;
// if(count($relation) < count($indexes)){
// $response = array('success' => false, 'msg' => 'Self relation should be unique.', 'index' => 'relation');
// echo json_encode($response);
// exit;
// }
if ($BookingData && $isgstapply == 0) {
foreach ($BookingData as $values) {
if ($values['FairRules']['IsGSTRequired'] == 1) {
$response = array('succes' => false, 'msg' => 'GST mandatory for this flight.', 'index' => 'gstnnumber');
echo json_encode($response);
exit;
}
}
}
if ($isgstapply == 1) {
if (empty(trim($gstnnumber))) {
$response = array('succes' => false, 'msg' => 'Please enter GSTIN number.', 'index' => 'gstnnumber');
echo json_encode($response);
exit;
}
$is_valid_gstin = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->is_valid_gstin($gstnnumber);
if ($is_valid_gstin == 0) {
$response = array('succes' => false, 'msg' => 'Enter Valid GST Number', 'index' => 'gstnnumber');
echo json_encode($response);
exit;
}
if (empty(trim($companyname))) {
$response = array('succes' => false, 'msg' => 'Please enter company name.', 'index' => 'companyname');
echo json_encode($response);
exit;
}
if (empty(trim($gstaddress))) {
$response = array('succes' => false, 'msg' => 'Please enter GST address.', 'index' => 'gstaddress');
echo json_encode($response);
exit;
}
if (empty(trim($gstcity))) {
$response = array('succes' => false, 'msg' => 'Please enter GST city.', 'index' => 'gstcity');
echo json_encode($response);
exit;
}
if (empty(trim($gststate))) {
$response = array('succes' => false, 'msg' => 'Please enter GST state.', 'index' => 'gststate');
echo json_encode($response);
exit;
}
if (empty(trim($gstpincode))) {
$response = array('succes' => false, 'msg' => 'Please enter GST pincode.', 'index' => 'gstpincode');
echo json_encode($response);
exit;
}
}
// print_r($FinalRelation);
// print_r($relation);
// print_r($indexes);
// die;
}
public function addOnnServiceAction()
{
$param = $this->getRequest()->getParams();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$CustomerMemberSysIds = new Zend_Session_Namespace('CustomerMemberSysIds');
$LeadPaxSession = new Zend_Session_Namespace('LeadPaxSession');
$CustomerMembersSession = new Zend_Session_Namespace('CustomerMembersSession');
$this->view->CustomerMemberSysIds = $CustomerMemberSysIds->params;
$this->view->LeadPaxSession = $LeadPaxSession->params;
$this->view->CustomerMembersSession = $CustomerMembersSession->params;
$this->view->CustomerSession = $CustomerSession->params;
$this->view->FlightSearchUrl = $FlightSearchUrl->params;
$class = $sessionFlightSearchParams->params['class'];
$this->view->traceId = $param['traceId'];
$this->view->departure_date = $sessionFlightSearchParams->params['strDepatureDate'];
$this->view->return_dates = $sessionFlightSearchParams->params['strReturnDate'];
$this->view->class = $class;
$this->view->param = $param;
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->CurrencyTitle = $this->CurrencyTitle;
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->FlightBookingData = $FlightBookingData->params;
$this->view->FlightBookingDataInbound = $FlightBookingDataInbound->params;
//$ResponseFlightQuery = new Zend_Session_Namespace('ResponseFlightQuery');
// echo '<pre>';print_r($sessionFlightSearchParams->params);
//echo '<pre>';
//print_r($ResponseFlightQuery->params);
//die;
}
public function updatefareAction()
{
$getData = $this->getRequest()->getParams();
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$SelectedMealSessionNew = new Zend_Session_Namespace('SelectedMealSessionNew');
$SelectedBaggSessionNew = new Zend_Session_Namespace('SelectedBaggSessionNew');
$SelectedMealSessionNewInb = new Zend_Session_Namespace('SelectedMealSessionNewInb');
$SelectedBaggSessionNewInb = new Zend_Session_Namespace('SelectedBaggSessionNewInb');
//echo '<pre>'; print_r($getData);echo '</pre>';die;
// Zend_Session::namespaceUnset('SelectedMealSessionNew');
// Zend_Session::namespaceUnset('SelectedBaggSessionNew');
// Zend_Session::namespaceUnset('SelectedMealSessionNewInb');
// Zend_Session::namespaceUnset('SelectedBaggSessionNewInb');
// die('ddd');
$CustomerSysId = $getData['CustomerSysId'];
$NewArray = false;
if ($getData['tripType'] == '1') {
if ($getData['actiontype'] == 'meal') {
if (!empty($SelectedMealSessionNew->params)) {
foreach ($SelectedMealSessionNew->params as $CustomerId => $val) {
if ($CustomerId == $CustomerSysId) {
$SelectedMealSessionNew->params[$CustomerId] = $getData['data'];
} else {
$NewArray = true;
$SelectedMealSessionNew->params[$CustomerId] = $val;
}
}
} else {
$SelectedMealSessionNew->params[$CustomerSysId] = $getData['data'];
}
if ($NewArray) {
$SelectedMealSessionNew->params[$CustomerSysId] = $getData['data'];
}
$Mealdata = $getData['data'];
} else {
/// Baggage
if (!empty($SelectedBaggSessionNew->params)) {
foreach ($SelectedBaggSessionNew->params as $CustomerId => $val) {
if ($CustomerId == $CustomerSysId) {
$SelectedBaggSessionNew->params[$CustomerId] = $getData['data'];
} else {
$NewArray = true;
$SelectedBaggSessionNew->params[$CustomerId] = $val;
}
}
} else {
$SelectedBaggSessionNew->params[$CustomerSysId] = $getData['data'];
}
if ($NewArray) {
$SelectedBaggSessionNew->params[$CustomerSysId] = $getData['data'];
}
$Baggdata = $getData['data'];
}
} elseif ($getData['tripType'] == '2') {
if ($getData['actiontype'] == 'meal') {
if (!empty($SelectedMealSessionNewInb->params)) {
foreach ($SelectedMealSessionNewInb->params as $CustomerId => $val) {
if ($CustomerId == $CustomerSysId) {
$SelectedMealSessionNewInb->params[$CustomerId] = $getData['data'];
} else {
$NewArray = true;
$SelectedMealSessionNewInb->params[$CustomerId] = $val;
}
}
} else {
$SelectedMealSessionNewInb->params[$CustomerSysId] = $getData['data'];
}
if ($NewArray) {
$SelectedMealSessionNewInb->params[$CustomerSysId] = $getData['data'];
}
$MealdataInb = $getData['data'];
} else {
/// Baggage
if (!empty($SelectedBaggSessionNewInb->params)) {
foreach ($SelectedBaggSessionNewInb->params as $CustomerId => $val) {
if ($CustomerId == $CustomerSysId) {
$SelectedBaggSessionNewInb->params[$CustomerId] = $getData['data'];
} else {
$NewArray = true;
$SelectedBaggSessionNewInb->params[$CustomerId] = $val;
}
}
} else {
$SelectedBaggSessionNewInb->params[$CustomerSysId] = $getData['data'];
}
if ($NewArray) {
$SelectedBaggSessionNewInb->params[$CustomerSysId] = $getData['data'];
}
$BaggdataInb = $getData['data'];
}
}
$BagPrice = 0;
$InbBagPrice = 0;
$MealPrice = 0;
$InbMealPrice = 0;
if ($SelectedBaggSessionNew->params) {
foreach ($SelectedBaggSessionNew->params as $val) {
$BagPrice += $val['Price'];
}
}
if ($SelectedMealSessionNew->params) {
foreach ($SelectedMealSessionNew->params as $val) {
$MealPrice += $val['Price'];
}
}
if ($SelectedMealSessionNewInb->params) {
foreach ($SelectedMealSessionNewInb->params as $val) {
$InbMealPrice += $val['Price'];
}
}
if ($SelectedBaggSessionNewInb->params) {
foreach ($SelectedBaggSessionNewInb->params as $val) {
$InbBagPrice += $val['Price'];
}
}
$MealFare = ($MealPrice + $InbMealPrice);
$BaggFare = ($BagPrice + $InbBagPrice);
$intNetPublishedFare = 0;
if ($FlightBookingData) {
foreach ($FlightBookingData->params as $value) {
$intNetPublishedFare += $value['FairRules']['PublishedFare'];
}
}
//echo '<pre>';print_r($SelectedMealSessionNewInb->params);
//echo '<pre>';print_r($SelectedBaggSessionNewInb->params);
$apiResponse = ($FlightBookingData->params);
$apiResponseInbound = ($FlightBookingDataInbound->params);
$Data = $apiResponse;
$DataInb = $apiResponseInbound;
$intPublishedFare = $Data['FairRules']['PublishedFare'];
$intPublishedFareInb = !empty($DataInb['FairRules']['PublishedFare']) ? $DataInb['Fare']['PublishedFare'] : 0;
$MobilePublishedFare = ($intNetPublishedFare + $MealFare + $BaggFare);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('apiResponse' => $FlightBookingData->params, 'apiResponseInbound' => $FlightBookingDataInbound->params, 'Mealdata' => $Mealdata, 'Baggdata' => $Baggdata, 'MealdataInb' => $MealdataInb, 'BaggdataInb' => $BaggdataInb, 'actiontype' => $getData['actiontype'], 'CurrencyTitle' => $this->CurrencyTitle, 'CurrencyRate' => $this->CurrencyRate));
$bodyText = $html->render('getflightfarequote.phtml');
$response = array('success' => true, 'message' => 'Done', 'MobilePublishedFare' => $MobilePublishedFare, 'html' => $bodyText);
echo json_encode($response);
exit;
//print_r($getData);
}
public function getflightfarequoteAction()
{
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$IsLCC = $FlightBookingData->params['IsLCC'];
$SessionPublishedFare = $FlightBookingData->params['PublishedFare'];
$SessionPublishedFareInb = isset($FlightBookingDataInbound->params['PublishedFare']) ? $FlightBookingDataInbound->params['PublishedFare'] : 0;
$SessionPublishedFare = ($SessionPublishedFare + $SessionPublishedFareInb);
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$route = $sessionFlightSearchParams->params['route'];
$interNationalSearch = $sessionFlightSearchParams->params['interNationalSearch'];
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$getData = $this->getRequest()->getParams();
//echo '<pre>';print_r($getData);die('d');
if ($getData['page'] != 'payment') {
Zend_Session::namespaceUnset('SelectedMealSessionNew');
Zend_Session::namespaceUnset('SelectedBaggSessionNew');
Zend_Session::namespaceUnset('SelectedMealSessionNewInb');
Zend_Session::namespaceUnset('SelectedBaggSessionNewInb');
Zend_Session::namespaceUnset('flightSSRDetailsInb');
Zend_Session::namespaceUnset('flightSSRDetails');
}
$apiResponseInbound = [];
$getQ = array(
'ApiResultIndex' => $getData['ApiResultIndex'],
'TraceId' => $getData['TraceId'],
'ApiResultIndexInb' => $getData['ApiResultIndexInb'],
'Inbound' => false,
);
$SSRData = array(
'ResultIndex' => $getData['ApiResultIndex'],
'TraceId' => $getData['TraceId'],
);
$apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetApiFlightsFareQuoteTripJack($getQ);
// $str = file_get_contents($this->baseUrl . 'public/logs/flight/FlightFareReview/Review_response.json');
// $apiResponse = json_decode($str, true);
if (!empty($getData['ApiResultIndexInb'])) {
$getQInb = array(
'ApiResultIndex' => $getData['ApiResultIndexInb'],
'TraceId' => $getData['ApiResultIndexInb'],
'Inbound' => true,
);
//$apiResponseInbound = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetApiFlightsFareQuoteTripJack($getQInb);
}
// $FlightFareQuoteSession = new Zend_Session_Namespace('FlightFareQuoteSession');
// $apiResponse = $FlightFareQuoteSession->params;
//$this->UpdateFlightBookingData($apiResponse,[]);
// echo '<pre>';print_r($apiResponse);die('d');
$ResponseStatus = $apiResponse['status']['success'];
$ErrorMessage = isset($apiResponse['errors'][0]['message']) ? $apiResponse['errors'][0]['message'] : '';
$ErrorMessageInb = isset($apiResponseInbound['errors'][0]['message']) ? $apiResponseInbound['errors'][0]['message'] : '';
$ResponseStatusInb = isset($apiResponseInbound['status']['success']) ? $apiResponseInbound['status']['success'] : 0;
if ($ResponseStatus == 1) {
$alerts = isset($apiResponse['alerts']) ? $apiResponse['alerts'] : '';
$this->UpdateFlightBookingData($apiResponse, $alerts);
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$newFare = 0;
$oldFare = 0;
$PublishedFare = 0;
$intPublishedFare = 0;
$Baggage = [];
$Meal = [];
if ($FlightBookingData->params) {
foreach ($FlightBookingData->params as $value) {
$newFare += $value['FairRules']['newFare'];
$PublishedFare += $value['FairRules']['newFare'];
$intPublishedFare += $value['FairRules']['PublishedFare'];
$oldFare += $value['FairRules']['oldFare'];
//echo '<pre>';print_r($value);die('d');
$Baggage[] = $value['Baggage'];
$Meal[] = $value['Meal'];
}
}
//echo '<pre>';print_r($Baggage);die('d');
$SSRArr = array('Meal' => $Meal, 'Baggage' => $Baggage, 'SeatPreference' => array());
$flightSSRDetails = new Zend_Session_Namespace('flightSSRDetails');
$flightSSRDetails->params = $SSRArr;
$FareChange = false;
if ($newFare != $oldFare) {
$FareChange = true;
}
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('apiResponse' => $FlightBookingData->params, 'apiResponseInbound' => [], 'CurrencyTitle' => $this->CurrencyTitle, 'CurrencyRate' => $this->CurrencyRate));
$bodyText = $html->render('getflightfarequote.phtml');
$response = array('success' => true, 'message' => 'Done', 'FareChange' => $FareChange, 'html' => $bodyText, 'intPublishedFare' => number_format(($intPublishedFare)), 'SSRArr' => $SSRArr, 'SSRArrInb' => []);
echo json_encode($response);
exit;
} elseif ($route == 2 && $ResponseStatus == 1 && $ResponseStatusInb == 1) {
$alerts = isset($apiResponseInbound['alerts']) ? $apiResponseInbound['alerts'] : '';
$this->UpdateFlightBookingData($apiResponseInbound, $alerts);
$FlightFareQuoteSessionInb = new Zend_Session_Namespace('FlightFareQuoteSessionInb');
$newFare = $PublishedFare = $FlightFareQuoteSessionInb->params['FairRules']['newFare'];
$oldFare = $FlightFareQuoteSessionInb->params['FairRules']['oldFare'];
$FareChange = false;
if ($newFare != $oldFare) {
$FareChange = true;
}
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('apiResponse' => $FlightBookingData->params, 'apiResponseInbound' => $FlightFareQuoteSessionInb->params, 'CurrencyTitle' => $this->CurrencyTitle, 'CurrencyRate' => $this->CurrencyRate));
$bodyText = $html->render('getflightfarequote.phtml');
$response = array('success' => true, 'message' => 'Done', 'FareChange' => $FareChange, 'html' => $bodyText, 'intPublishedFare' => number_format(($intPublishedFare)), 'SSRArr' => [], 'SSRArrInb' => []);
echo json_encode($response);
exit;
} elseif ($route == 2 && $ResponseStatus == 1 && $interNationalSearch == 1) {
} else {
$response = array('success' => false, 'message' => 'Onward-' . $ErrorMessage . ' Return-' . $ErrorMessageInb, 'FareChange' => false, 'html' => '');
echo json_encode($response);
exit;
}
echo '<pre>';
print_r($apiResponse);
die('d');
$SSRArrInb = array();
if (!empty($getData['ApiResultIndexInb'])) {
$getQInb = array(
'ApiResultIndex' => $getData['ApiResultIndexInb'],
'TraceId' => $getData['TraceId'],
'Inbound' => true,
);
$SSRDataInb = array(
'ResultIndex' => $getData['ApiResultIndexInb'],
'TraceId' => $getData['TraceId'],
);
$apiResponseInbound = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetApiFlightsFareQuote($getQInb);
$arrSSRInb = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->flightSSRDetails($SSRDataInb);
$ResponseInb = $arrSSRInb['Response'];
$flightSSRDetailsInb = new Zend_Session_Namespace('flightSSRDetailsInb');
$flightSSRDetailsInb->params = $ResponseInb;
$ResponseStatusInb = $ResponseInb['ResponseStatus'];
$ErrorMessageInb = $ResponseInb['Error']['ErrorMessage'];
if ($IsLCC == 1) {
$Baggage = $ResponseInb['Baggage'][0];
$MealDynamic = $ResponseInb['MealDynamic'][0];
$SSRArrInb = array('ResponseStatus' => $ResponseStatusInb, 'ErrorMessage' => $ErrorMessageInb, 'Meal' => $MealDynamic, 'Baggage' => $Baggage, 'SeatPreference' => array());
} else {
$Meal = $ResponseInb['Meal'];
$SeatPreference = $ResponseInb['SeatPreference'];
$SSRArrInb = array('ResponseStatus' => $ResponseStatusInb, 'ErrorMessage' => $ErrorMessageInb, 'Meal' => $Meal, 'Baggage' => array(), 'SeatPreference' => $SeatPreference);
}
}
// $str = file_get_contents($this->baseUrl.'public/logs/flight/flightSSR/flightSSR_response.json');
// $arrSSR = json_decode($str,true);
$arrSSR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->flightSSRDetails($SSRData);
$Response = $arrSSR['Response'];
$flightSSRDetails = new Zend_Session_Namespace('flightSSRDetails');
$flightSSRDetails->params = $Response;
$ResponseStatus = $Response['ResponseStatus'];
$ErrorMessage = $Response['Error']['ErrorMessage'];
if ($IsLCC == 1) {
$Baggage = $Response['Baggage'][0];
$MealDynamic = $Response['MealDynamic'][0];
$SSRArr = array('ResponseStatus' => $ResponseStatus, 'ErrorMessage' => $ErrorMessage, 'Meal' => $MealDynamic, 'Baggage' => $Baggage, 'SeatPreference' => array());
} else {
$Meal = $Response['Meal'];
$SeatPreference = $Response['SeatPreference'];
$SSRArr = array('ResponseStatus' => $ResponseStatus, 'ErrorMessage' => $ErrorMessage, 'Meal' => $Meal, 'Baggage' => array(), 'SeatPreference' => $SeatPreference);
}
$PublishedFare = ($apiResponse['Response']['Results']['Fare']['PublishedFare']);
$PublishedFareInb = isset($apiResponseInbound['Response']['Results']['Fare']['PublishedFare']) ? $apiResponseInbound['Response']['Results']['Fare']['PublishedFare'] : 0;
$PublishedFare = ($PublishedFare + $PublishedFareInb);
$ResponseStatus = $apiResponse['Response']['ResponseStatus'];
$ResponseStatusInb = $apiResponseInbound['Response']['ResponseStatus'];
$ErrorMessage = $apiResponse['Response']['Error']['ErrorMessage'];
$ErrorMessageInb = $apiResponseInbound['Response']['Error']['ErrorMessage'];
$Data = $apiResponse['Response']['Results'];
$intPublishedFare = $Data['Fare']['PublishedFare'];
if ($route == 1 && $ResponseStatus == 1) {
$FareChange = false;
if ($SessionPublishedFare != $PublishedFare) {
$FareChange = true;
}
// print_r($apiResponse);die('d');
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('apiResponse' => $apiResponse, 'apiResponseInbound' => []));
$bodyText = $html->render('getflightfarequote.phtml');
$response = array('success' => true, 'message' => 'Done', 'FareChange' => $FareChange, 'html' => $bodyText, 'intPublishedFare' => number_format($PublishedFare), 'SSRArr' => $SSRArr, 'SSRArrInb' => $SSRArrInb);
echo json_encode($response);
exit;
} elseif ($route == 2 && $ResponseStatus == 1 && $ResponseStatusInb == 1) {
$FareChange = false;
if ($SessionPublishedFare != $PublishedFare) {
$FareChange = true;
}
// print_r($apiResponse);die('d');
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('apiResponse' => $apiResponse, 'apiResponseInbound' => $apiResponseInbound));
$bodyText = $html->render('getflightfarequote.phtml');
$response = array('success' => true, 'message' => 'Done', 'FareChange' => $FareChange, 'html' => $bodyText, 'intPublishedFare' => number_format($PublishedFare), 'SSRArr' => $SSRArr, 'SSRArrInb' => $SSRArrInb);
echo json_encode($response);
exit;
} elseif ($route == 2 && $ResponseStatus == 1 && $interNationalSearch == 1) {
$FareChange = false;
if ($SessionPublishedFare != $PublishedFare) {
$FareChange = true;
}
// print_r($apiResponse);die('d');
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('apiResponse' => $apiResponse, 'apiResponseInbound' => []));
$bodyText = $html->render('getflightfarequote.phtml');
$response = array('success' => true, 'message' => 'Done', 'FareChange' => $FareChange, 'html' => $bodyText, 'intPublishedFare' => number_format($PublishedFare), 'SSRArr' => $SSRArr, 'SSRArrInb' => $SSRArrInb);
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'Onward-' . $ErrorMessage . ' Return-' . $ErrorMessageInb, 'FareChange' => false, 'html' => '');
echo json_encode($response);
exit;
}
} else {
die('Page not found!');
}
}
public function continueAcceptAction()
{
if ($this->getRequest()->isPost()) {
$response = array('success' => true, 'message' => 'Done');
echo json_encode($response);
exit;
$FlightFareQuoteSession = new Zend_Session_Namespace('FlightFareQuoteSession');
$FlightFareQuoteSessionInb = new Zend_Session_Namespace('FlightFareQuoteSessionInb');
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$BookingData = $FlightBookingData->params;
$BookingDataInb = !empty($FlightBookingDataInbound->params) ? $FlightBookingDataInbound->params : [];
// echo '<pre>';print_r($FlightFareQuoteSession->params);
// echo '<pre>';print_r($FlightFareQuoteSessionInb->params);
// die;
$arrCurrencyList = $this->getCurrencyIdsAndSymbolList();
if ($FlightFareQuoteSession->params) {
$apiResponse = $FlightFareQuoteSession->params;
$result = $apiRData = $apiResponse['Response']['Results'];
$Currency = $result['Fare']['Currency'];
$currencySysId = !empty($arrCurrencyList[$Currency]) ? $arrCurrencyList[$Currency] : '1';
$BaseFare = $result['Fare']['BaseFare'];
$Tax = $result['Fare']['Tax'];
$YQTax = $result['Fare']['YQTax'];
$AdditionalTxnFeeOfrd = $result['Fare']['AdditionalTxnFeeOfrd'];
$AdditionalTxnFeePub = $result['Fare']['AdditionalTxnFeePub'];
$OtherCharges = $result['Fare']['OtherCharges'];
$Discount = $result['Fare']['Discount'];
$PublishedFare = $result['Fare']['PublishedFare'];
$CommissionEarned = $result['Fare']['CommissionEarned'];
$PLBEarned = $result['Fare']['PLBEarned'];
$IncentiveEarned = $result['Fare']['IncentiveEarned'];
$OfferedFare = $result['Fare']['OfferedFare'];
$TdsOnCommission = $result['Fare']['TdsOnCommission'];
$TdsOnPLB = $result['Fare']['TdsOnPLB'];
$TdsOnIncentive = $result['Fare']['TdsOnIncentive'];
$ServiceFee = $result['Fare']['ServiceFee'];
$FareBreakdown = $result['FareBreakdown'];
$arrFairRules = array(
"Currency" => $Currency,
"currencySysId" => $currencySysId,
"BaseFare" => $BaseFare,
"Tax" => $Tax,
"YQTax" => $YQTax,
"AdditionalTxnFeeOfrd" => $AdditionalTxnFeeOfrd,
"AdditionalTxnFeePub" => $AdditionalTxnFeePub,
"OtherCharges" => $OtherCharges,
"Discount" => $Discount,
"ServiceFee" => $ServiceFee,
"PublishedFare" => $PublishedFare,
"CommissionEarned" => $CommissionEarned,
"PLBEarned" => $PLBEarned,
"IncentiveEarned" => $IncentiveEarned,
"OfferedFare" => $OfferedFare,
"TdsOnCommission" => $TdsOnCommission,
"TdsOnPLB" => $TdsOnPLB,
"TdsOnIncentive" => $TdsOnIncentive,
"FareBreakdown" => $FareBreakdown,
);
$BookingData['PublishedFare'] = $PublishedFare; // As Discussed with GG
$BookingData['PublishedFareTxt'] = number_format($PublishedFare); // As Discussed with GG
$BookingData['CommissionEarned'] = $CommissionEarned;
$BookingData['FairRules'] = $arrFairRules;
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingData->params = $BookingData;
if ($FlightFareQuoteSessionInb->params) {
//for return
$apiResponseInb = $FlightFareQuoteSessionInb->params;
$resultInb = $apiResponseInb['Response']['Results'];
$Currency = $resultInb['Fare']['Currency'];
$currencySysId = !empty($arrCurrencyList[$Currency]) ? $arrCurrencyList[$Currency] : '1';
$BaseFare = $resultInb['Fare']['BaseFare'];
$Tax = $resultInb['Fare']['Tax'];
$YQTax = $resultInb['Fare']['YQTax'];
$AdditionalTxnFeeOfrd = $resultInb['Fare']['AdditionalTxnFeeOfrd'];
$AdditionalTxnFeePub = $resultInb['Fare']['AdditionalTxnFeePub'];
$OtherCharges = $resultInb['Fare']['OtherCharges'];
$Discount = $resultInb['Fare']['Discount'];
$PublishedFare = $resultInb['Fare']['PublishedFare'];
$CommissionEarned = $resultInb['Fare']['CommissionEarned'];
$PLBEarned = $resultInb['Fare']['PLBEarned'];
$IncentiveEarned = $resultInb['Fare']['IncentiveEarned'];
$OfferedFare = $resultInb['Fare']['OfferedFare'];
$TdsOnCommission = $resultInb['Fare']['TdsOnCommission'];
$TdsOnPLB = $resultInb['Fare']['TdsOnPLB'];
$TdsOnIncentive = $resultInb['Fare']['TdsOnIncentive'];
$ServiceFee = $resultInb['Fare']['ServiceFee'];
$FareBreakdown = $resultInb['FareBreakdown'];
$arrFairRulesInb = array(
"Currency" => $Currency,
"currencySysId" => $currencySysId,
"BaseFare" => $BaseFare,
"Tax" => $Tax,
"YQTax" => $YQTax,
"AdditionalTxnFeeOfrd" => $AdditionalTxnFeeOfrd,
"AdditionalTxnFeePub" => $AdditionalTxnFeePub,
"OtherCharges" => $OtherCharges,
"Discount" => $Discount,
"ServiceFee" => $ServiceFee,
"PublishedFare" => $PublishedFare,
"CommissionEarned" => $CommissionEarned,
"PLBEarned" => $PLBEarned,
"IncentiveEarned" => $IncentiveEarned,
"OfferedFare" => $OfferedFare,
"TdsOnCommission" => $TdsOnCommission,
"TdsOnPLB" => $TdsOnPLB,
"TdsOnIncentive" => $TdsOnIncentive,
"FareBreakdown" => $FareBreakdown,
);
$BookingDataInb['PublishedFare'] = $PublishedFare; // As Discussed with GG
$BookingDataInb['PublishedFareTxt'] = number_format($PublishedFare); // As Discussed with GG
$BookingDataInb['CommissionEarned'] = $CommissionEarned;
$BookingDataInb['FairRules'] = $arrFairRulesInb;
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$FlightBookingDataInbound->params = $BookingDataInb;
}
$response = array('success' => true, 'message' => 'Done');
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'oops somehting went wrond');
echo json_encode($response);
exit;
}
}
}
public function UpdateFlightBookingData($data, $alerts)
{
$arrAirlineList = $this->getAirlineIdsAndCodeList();
$apiResponse = $data;
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightSearchGuard = new Zend_Session_Namespace('FlightSearchGuard');
$CurrentFlightSearchGuard = new Zend_Session_Namespace('CurrentFlightSearchGuard');
$FlightSearchResults = new Zend_Session_Namespace('FlightSearchResults');
$intSourceCityId = trim($sessionFlightSearchParams->params['sourceCityId']);
$intDestinationCityId = trim($sessionFlightSearchParams->params['destinationCityId']);
$interNationalSearch = trim($sessionFlightSearchParams->params['interNationalSearch']);
$strDepatureDate = $sessionFlightSearchParams->params['strDepatureDate'];
$strReturnDate = !empty($sessionFlightSearchParams->params['strReturnDate']) ? $sessionFlightSearchParams->params['strReturnDate'] : '';
$strSourceAirportCode = $sessionFlightSearchParams->params['from'];
$strDestinationAirportCode = $sessionFlightSearchParams->params['to'];
$adultCount = $sessionFlightSearchParams->params['adults'];
$childCount = $sessionFlightSearchParams->params['child'];
$infantCount = $sessionFlightSearchParams->params['infant'];
$intMemberCount = $adultCount + $childCount + $infantCount;
$intCountryCode = $sessionFlightSearchParams->params['intCountryCode'];
$strFlightRoute = trim($sessionFlightSearchParams->params['route']);
$intTatalPaxCT = $adultCount + $childCount;
$getMarkup = $this->getMarkup($intCountryCode);
$strTraceId = !empty($apiResponse['TraceId']) ? $apiResponse['TraceId'] : '';
$localFromDateTime = date("Y-m-d h:i", strtotime($strDepatureDate));
$localToDateTime = date("Y-m-d h:i", strtotime($strReturnDate));
$arrCommonInsVariables = array(
'strTraceId' => $strTraceId,
'localFromDateTime' => $localFromDateTime,
'localToDateTime' => $localToDateTime,
'strSourceAirportCode' => $strSourceAirportCode,
'strDestinationAirportCode' => $strDestinationAirportCode,
'intMemberCount' => $intMemberCount,
'intSourceCityId' => $intSourceCityId,
'intDestinationCityId' => $intDestinationCityId,
'JourneyType' => 2, // For Round Trips API Search
'TripType' => 1,
'interNationalSearch' => isset($interNationalSearch) ? $interNationalSearch : 0
);
$strTraceId = $arrCommonInsVariables['strTraceId'];
$localFromDateTime = $arrCommonInsVariables['localFromDateTime'];
$localToDateTime = $arrCommonInsVariables['localToDateTime'];
$strSourceAirportCode = $arrCommonInsVariables['strSourceAirportCode'];
$strDestinationAirportCode = $arrCommonInsVariables['strDestinationAirportCode'];
$intMemberCount = $arrCommonInsVariables['intMemberCount'];
$intSourceCityId = $arrCommonInsVariables['intSourceCityId'];
$intDestinationCityId = $arrCommonInsVariables['intDestinationCityId'];
$intJourneyType = $arrCommonInsVariables['JourneyType'];
$intTripType = $arrCommonInsVariables['TripType'];
$interNationalSearch = isset($arrCommonInsVariables['interNationalSearch']) ? $arrCommonInsVariables['interNationalSearch'] : '0';
$intTripType = 1;
$arrInsertFlightData = [];
$BaggageArr = [];
$MealArr = [];
$bookingId = $data['bookingId'];
$alerts = isset($data['alerts']) ? $data['alerts'] : [];
$isGSTMandatory = isset($data['conditions']['gst']['igm']) ? $data['conditions']['gst']['igm'] : false;
$arrInsertFlightBookingData = [];
if ($data['tripInfos']) {
foreach ($data['tripInfos'] as $key => $result) {
if ($key == 0) {
$intJourneyType = 1;
} else {
$intJourneyType = 2;
}
$BookingData = $FlightBookingData->params[$key];
$alertsFare = isset($alerts[$key]) ? $alerts[$key] : [];
$SegmentInformation = $result['sI'];
$totalPriceList = current($result['totalPriceList']);
$IsRefundable = $totalPriceList['fd']['ADULT']['rT'];
$NoOfSeatAvailable = $totalPriceList['fd']['ADULT']['sR'];
$strFareClass = $totalPriceList['fd']['ADULT']['cB'];
$IsMealIncludes = $totalPriceList['fd']['ADULT']['mI'];
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB'];
$strTraceId = $BookingData['FairRules']['PriceID'];
$ResultIndex = $BookingData['FairRules']['PriceID'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if ($IsRefundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($IsRefundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$OriginSegments = current($SegmentInformation);
$DestinationSegments = end($SegmentInformation);
$arrSegments = [];
$FlyingMinutes = 0;
$TotalLAYOVERMinutes = 0;
$LAYOVERCityArr = [];
$PublishedFare = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$newFare = isset($alertsFare['newFare']) ? $alertsFare['newFare'] : 0;
$oldFare = isset($alertsFare['oldFare']) ? $alertsFare['oldFare'] : 0;
$FareBreakdown = [];
$FairRulesArr = [];
if ($result['totalPriceList']) {
foreach ($result['totalPriceList'] as $price) {
$fareDetail = $price['fd'];
$Refundable = $fareDetail['ADULT']['rT'];
$fareIdentifier = $price['fareIdentifier'];
if ($Refundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($Refundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$ADULT = $fareDetail['ADULT']['fC']; //fare Components
$CHILD = isset($fareDetail['CHILD']['fC']) ? $fareDetail['CHILD']['fC'] : []; //fare Components
$INFANT = isset($fareDetail['INFANT']['fC']) ? $fareDetail['INFANT']['fC'] : []; //fare Components
$ADULTafC = $fareDetail['ADULT']['afC']['TAF']; //additional fareComponents
$CHILDafC = isset($fareDetail['CHILD']['afC']['TAF']) ? $fareDetail['CHILD']['afC']['TAF'] : []; //additional fareComponents
$INFANTafC = isset($fareDetail['INFANT']['afC']['TAF']) ? $fareDetail['INFANT']['afC']['TAF'] : []; //additional fareComponents
$ADULTNCMTDS = isset($fareDetail['ADULT']['afC']['NCM']['TDS']) ? $fareDetail['ADULT']['afC']['NCM']['TDS'] : 0; //TDS
$CHILDNCMTDS = isset($fareDetail['CHILD']['afC']['NCM']['TDS']) ? $fareDetail['CHILD']['afC']['NCM']['TDS'] : 0; //TDS
$INFANTNCMTDS = isset($fareDetail['INFANT']['afC']['NCM']['TDS']) ? $fareDetail['INFANT']['afC']['NCM']['TDS'] : 0; //TDS
$AD_MF = isset($ADULTafC['MF']) ? $ADULTafC['MF'] : 0; //Management Fee
$AD_YQ = isset($ADULTafC['YQ']) ? $ADULTafC['YQ'] : 0; //Fuel Surcharge
$AD_AGST = isset($ADULTafC['AGST']) ? $ADULTafC['AGST'] : 0; //Airline GST Component
$AD_MFT = isset($ADULTafC['MFT']) ? $ADULTafC['MFT'] : 0; //Management Fee Tax
$AD_OT = isset($ADULTafC['OT']) ? $ADULTafC['OT'] : 0; //Other Charges
$AD_MU = isset($ADULTafC['MU']) ? $ADULTafC['MU'] : 0; //markup
$AD_YR = isset($ADULTafC['YR']) ? $ADULTafC['YR'] : 0; //Carrier Misc Fee
$CH_MF = isset($CHILDafC['MF']) ? $CHILDafC['MF'] : 0; //Management Fee
$CH_YQ = isset($CHILDafC['YQ']) ? $CHILDafC['YQ'] : 0; //Fuel Surcharge
$CH_AGST = isset($CHILDafC['AGST']) ? $CHILDafC['AGST'] : 0; //Airline GST Component
$CH_MFT = isset($CHILDafC['MFT']) ? $CHILDafC['MFT'] : 0; //Management Fee Tax
$CH_OT = isset($CHILDafC['OT']) ? $CHILDafC['OT'] : 0; //Other Charges
$CH_MU = isset($CHILDafC['MU']) ? $CHILDafC['MU'] : 0; //markup
$CH_YR = isset($CHILDafC['YR']) ? $CHILDafC['YR'] : 0; //Carrier Misc Fee
$IN_MF = isset($INFANTafC['MF']) ? $INFANTafC['MF'] : 0; //Management Fee
$IN_YQ = isset($INFANTafC['YQ']) ? $INFANTafC['YQ'] : 0; //Fuel Surcharge
$IN_AGST = isset($INFANTafC['AGST']) ? $INFANTafC['AGST'] : 0; //Airline GST Component
$IN_MFT = isset($INFANTafC['MFT']) ? $INFANTafC['MFT'] : 0; //Management Fee Tax
$IN_OT = isset($INFANTafC['OT']) ? $INFANTafC['OT'] : 0; //Other Charges
$IN_MU = isset($INFANTafC['MU']) ? $INFANTafC['MU'] : 0; //markup
$IN_YR = isset($INFANTafC['YR']) ? $INFANTafC['YR'] : 0; //Carrier Misc Fee
$PublishedFare += ($ADULT['TF'] + $CHILD['TF'] + $INFANT['TF']); //Total Fare
$BaseFare += ($ADULT['BF'] + $CHILD['BF'] + $INFANT['BF']); //Base Fare
$Tax += ($ADULT['TAF'] + $CHILD['TAF'] + $INFANT['TAF']); //Taxes and Fees
$PublishedFareIN = (($ADULT['TF'] * $adultCount) + ($CHILD['TF'] * $childCount) + ($INFANT['TF'] * $infantCount)); //Total Fare
$BaseFareIN = (($ADULT['BF'] * $adultCount) + ($CHILD['BF'] * $childCount) + ($INFANT['BF'] * $infantCount)); //Base Fare
$TaxIN = (($ADULT['TAF'] * $adultCount) + ($CHILD['TAF'] * $childCount) + ($INFANT['TAF'] * $infantCount)); //Taxes and Fees
$NetFare = (($ADULT['NF'] * $adultCount) + ($CHILD['NF'] * $childCount) + ($INFANT['NF'] * $infantCount)); //Taxes and Fees
$NetCommission = (($ADULT['NCM'] * $adultCount) + ($CHILD['NCM'] * $childCount) + ($INFANT['NCM'] * $infantCount)); //Taxes and Fees
//echo '<pre>';print_r(($ADULTafC));
$YQTax = (($AD_YQ * $adultCount) + ($CH_YQ * $childCount) + ($IN_YQ * $infantCount));
$OtherCharges = (($AD_OT * $adultCount) + ($CH_OT * $childCount) + ($IN_OT * $infantCount));
$ServiceFee = (($AD_MF * $adultCount) + ($CH_MF * $childCount) + ($IN_MF * $infantCount));
$ManagementFeeTax = (($AD_MFT * $adultCount) + ($CH_MFT * $childCount) + ($IN_MFT * $infantCount));
$AirlineGSTComponent = (($AD_AGST * $adultCount) + ($CH_AGST * $childCount) + ($IN_AGST * $infantCount));
$CarrierMiscFee = (($AD_YR * $adultCount) + ($CH_YR * $childCount) + ($IN_YR * $infantCount));
$MUFee = (($AD_MU * $adultCount) + ($CH_MU * $childCount) + ($IN_MU * $infantCount));
$TdsOnPLB = (($ADULTNCMTDS * $adultCount) + ($CHILDNCMTDS * $childCount) + ($INFANTNCMTDS * $infantCount));
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $OfferedFare,
'intCommissionEarned' => $CommissionEarned,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
);
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkupTripJack($markUpArr);
$AgencyMarkUp = $arrMarkUps['intAgencyFixMarkUp'];
$intGTXMarkUp = $arrMarkUps['intGTXMarkUp'];
$intFareWithGTXMarkUp = $arrMarkUps['intFareWithGTXMarkUp'];
$intOfferedFare = $arrMarkUps['intOfferedFare'];
if ($interNationalSearch == 1) {
$intGTXMarkUp = (($arrMarkUps['intGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnGTXMarkUp = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount) * $strFlightRoute);
$intAgencyFixMarkUp = (($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUp = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount) * $strFlightRoute);
} else {
$intGTXMarkUp = ($arrMarkUps['intGTXMarkUp'] * $intMemberCount);
$intSTaxOnGTXMarkUp = ($arrMarkUps['intSTaxOnGTXMarkUp'] * $intMemberCount);
$intAgencyFixMarkUp = ($arrMarkUps['intAgencyFixMarkUp'] * $intMemberCount);
$intSTaxOnAgencyFixMarkUp = ($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $intMemberCount);
}
$intCommisionEarnedForAgency = $arrMarkUps['intCommisionEarnedForAgency'];
$intPLBEarnedForAgency = $arrMarkUps['intPLBEarnedForAgency'];
$intIncentiveEarnedForAgency = $arrMarkUps['intIncentiveEarnedForAgency'];
$intTotalEarningsForAgency = $arrMarkUps['intTotalEarningsForAgency'] + $intAgencyFixMarkUp;
$intGSTOnAgencyCommisionEarned = $arrMarkUps['intGSTOnAgencyCommisionEarned'];
$intGSTOnAgencyPLBEarned = $arrMarkUps['intGSTOnAgencyPLBEarned'];
$intGSTOnAgencyIncentiveEarned = $arrMarkUps['intGSTOnAgencyIncentiveEarned'];
$intTotalGSTAgencyEarnings = $intSTaxOnAgencyFixMarkUp + $intGSTOnAgencyCommisionEarned + $intGSTOnAgencyPLBEarned + $intGSTOnAgencyIncentiveEarned;
$intPublishedFare = $intOfferedFare + $intGTXMarkUp + $intAgencyFixMarkUp + $intCommisionEarnedForAgency + $intPLBEarnedForAgency + $intIncentiveEarnedForAgency + $intTotalGSTAgencyEarnings;
$intTotalDisCount = $CommissionEarned + $PLBEarned + $IncentiveEarned;
$intDiscountPerHead = $intTotalDisCount / $intTatalPaxCT;
$intDiscountPerHead = ($intDiscountPerHead * $adultCount);
$intBaseFareCal = ($ADULT['BF'] * $adultCount) - $intDiscountPerHead;
$intAdultFareOffered = $intBaseFareCal + ($ADULT['TAF'] * $adultCount);
$intTotalOfferedForAllPax = $intAdultFareOffered;
$intBaseFareAllPax = $intBaseFareCal;
if ($interNationalSearch == 1) {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount) * $strFlightRoute);
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount) * $strFlightRoute);
} else {
$intGTXMarkUpA = (($arrMarkUps['intGTXMarkUp'] * $adultCount));
$intSTaxOnGTXMarkUpA = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $adultCount));
$intAgencyFixMarkUpA = (($arrMarkUps['intAgencyFixMarkUp'] * $adultCount));
$intSTaxOnAgencyFixMarkUpA = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $adultCount));
}
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($intBaseFareCal);
$FareBreakdown[0]['BaseFare'] = ($ADULT['BF'] * $adultCount);
$FareBreakdown[0]['CommissionEarned'] = ($ADULT['NCM'] * $adultCount);
$FareBreakdown[0]['TDS'] = ($ADULTNCMTDS * $adultCount);
$FareBreakdown[0]['MF'] = ($AD_MF * $adultCount);
$FareBreakdown[0]['YQ'] = ($AD_YQ * $adultCount);
$FareBreakdown[0]['AGST'] = ($AD_AGST * $adultCount);
$FareBreakdown[0]['MFT'] = ($AD_MFT * $adultCount);
$FareBreakdown[0]['OT'] = ($AD_OT * $adultCount);
$FareBreakdown[0]['MU'] = ($AD_MU * $adultCount);
$FareBreakdown[0]['YR'] = ($AD_YR * $adultCount);
$FareBreakdown[0]['FixedMarkUp'] = $intAgencyFixMarkUpA;
$FareBreakdown[0]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpA;
$FareBreakdown[0]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[0]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[0]['intGTXMarkUp'] = $intGTXMarkUpA;
$FareBreakdown[0]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpA;
$FareBreakdown[0]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[0]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[0]['PGCharge'] = 0;
$FareBreakdown[0]['Baggage'] = isset($fareDetail['ADULT']['bI']['iB']) ? $fareDetail['ADULT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[0]['CabinBaggage'] = isset($fareDetail['ADULT']['bI']['cB']) ? $fareDetail['ADULT']['bI']['cB'] : []; //Cabin Baggage ;
if (isset($fareDetail['CHILD'])) {
$intDiscountPerHead = ($intDiscountPerHead * $childCount);
$intBaseFareCal = ($CHILD['BF'] * $childCount) - $intDiscountPerHead;
$intChildFareOffered = $intBaseFareCal + ($CHILD['TAF'] * $childCount);
$intBaseFareAllPax = $intBaseFareAllPax + $intBaseFareCal;
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intChildFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount) * $strFlightRoute);
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount) * $strFlightRoute);
} else {
$intGTXMarkUpC = (($arrMarkUps['intGTXMarkUp'] * $childCount));
$intSTaxOnGTXMarkUpC = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $childCount));
$intAgencyFixMarkUpC = (($arrMarkUps['intAgencyFixMarkUp'] * $childCount));
$intSTaxOnAgencyFixMarkUpC = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $childCount));
}
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($CHILD['BF'] * $childCount);
$FareBreakdown[1]['BaseFare'] = ($intBaseFareCal);
$FareBreakdown[1]['CommissionEarned'] = ($CHILD['NCM'] * $childCount);
$FareBreakdown[1]['TDS'] = ($CHILDNCMTDS * $childCount);
$FareBreakdown[1]['MF'] = ($CH_MF * $childCount);
$FareBreakdown[1]['YQ'] = ($CH_YQ * $childCount);
$FareBreakdown[1]['AGST'] = ($CH_AGST * $childCount);
$FareBreakdown[1]['MFT'] = ($CH_MFT * $childCount);
$FareBreakdown[1]['OT'] = ($CH_OT * $childCount);
$FareBreakdown[1]['MU'] = ($CH_MU * $childCount);
$FareBreakdown[1]['YR'] = ($CH_YR * $childCount);
$FareBreakdown[1]['FixedMarkUp'] = $intAgencyFixMarkUpC;
$FareBreakdown[1]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpC;
$FareBreakdown[1]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[1]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[1]['intGTXMarkUp'] = $intGTXMarkUpC;
$FareBreakdown[1]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpC;
$FareBreakdown[1]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[1]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[1]['PGCharge'] = 0;
$FareBreakdown[1]['Baggage'] = isset($fareDetail['CHILD']['bI']['iB']) ? $fareDetail['CHILD']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[1]['CabinBaggage'] = isset($fareDetail['CHILD']['bI']['cB']) ? $fareDetail['CHILD']['bI']['cB'] : []; //Cabin Baggage ;
}
if (isset($fareDetail['INFANT'])) {
$intInfantFareOffered = ($INFANT['BF'] * $infantCount) + ($INFANT['TAF'] * $infantCount);
$intTotalOfferedForAllPax = $intTotalOfferedForAllPax + $intInfantFareOffered;
if ($interNationalSearch == 1) {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount) * $strFlightRoute);
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount) * $strFlightRoute);
} else {
$intGTXMarkUpI = (($arrMarkUps['intGTXMarkUp'] * $infantCount));
$intSTaxOnGTXMarkUpI = (($arrMarkUps['intSTaxOnGTXMarkUp'] * $infantCount));
$intAgencyFixMarkUpI = (($arrMarkUps['intAgencyFixMarkUp'] * $infantCount));
$intSTaxOnAgencyFixMarkUpI = (($arrMarkUps['intSTaxOnAgencyFixMarkUp'] * $infantCount));
}
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['BaseFare'] = ($INFANT['BF'] * $infantCount);
$FareBreakdown[2]['CommissionEarned'] = ($INFANT['NCM'] * $infantCount);
$FareBreakdown[2]['TDS'] = ($INFANTNCMTDS * $infantCount);
$FareBreakdown[2]['MF'] = ($IN_MF * $infantCount);
$FareBreakdown[2]['YQ'] = ($IN_YQ * $infantCount);
$FareBreakdown[2]['AGST'] = ($IN_AGST * $infantCount);
$FareBreakdown[2]['OT'] = ($IN_OT * $infantCount);
$FareBreakdown[2]['MFT'] = ($IN_MFT * $infantCount);
$FareBreakdown[2]['MU'] = ($IN_MU * $infantCount);
$FareBreakdown[2]['YR'] = ($IN_YR * $infantCount);
$FareBreakdown[2]['FixedMarkUp'] = $intAgencyFixMarkUpI;
$FareBreakdown[2]['GSTOnMarkUp'] = $intSTaxOnAgencyFixMarkUpI;
$FareBreakdown[2]['CommEarned'] = $intCommisionEarnedForAgency;
$FareBreakdown[2]['GSTonComm'] = $intGSTOnAgencyCommisionEarned;
$FareBreakdown[2]['intGTXMarkUp'] = $intGTXMarkUpI;
$FareBreakdown[2]['GTXMarkUpGST'] = $intSTaxOnGTXMarkUpI;
$FareBreakdown[2]['AdditionalTxnFeeOfrd'] = 0;
$FareBreakdown[2]['AdditionalTxnFeePub'] = 0;
$FareBreakdown[2]['PGCharge'] = 0;
$FareBreakdown[2]['Baggage'] = isset($fareDetail['INFANT']['bI']['iB']) ? $fareDetail['INFANT']['bI']['iB'] : []; //Check In Baggage;
$FareBreakdown[2]['CabinBaggage'] = isset($fareDetail['INFANT']['bI']['cB']) ? $fareDetail['INFANT']['bI']['cB'] : []; //Cabin Baggage ;
}
//echo '<pre>';print_r($price);
$FairRulesArr = array(
"Currency" => $this->CurrencyTitle, //$Currency,
"CurrencyRate" => $this->CurrencyRate, //$Currency,
"currencySysId" => $this->CurrencyId,
"BaseFare" => $BaseFareIN,
"Tax" => $TaxIN,
"YQTax" => $YQTax,
"OtherCharges" => $OtherCharges,
"Discount" => 0, //$Discount,
"ServiceFee" => $ServiceFee,
"ManagementFeeTax" => $ManagementFeeTax,
"AirlineGSTComponent" => $AirlineGSTComponent,
"CarrierMiscFee" => $CarrierMiscFee,
"MUFee" => $MUFee,
"intPublishedFare" => $PublishedFareIN,
"PublishedFare" => $intPublishedFare,
"OfferedFare" => $intPublishedFare,
"CommissionEarned" => $CommissionEarned,
"PLBEarned" => $PLBEarned,
"IncentiveEarned" => $IncentiveEarned,
"TdsOnPLB" => $TdsOnPLB,
"TdsOnIncentive" => 0,
"AdditionalTxnFeeOfrd" => 0,
"AdditionalTxnFeePub" => 0,
"Refundable" => $Refundable,
"IsRefundableTxt" => $IsRefundableTxt,
"PriceID" => $strTraceId,
"fareIdentifier" => str_replace('_', ' ', $fareIdentifier),
"FareClass" => $fareDetail['ADULT']['cc'],
"newFare" => $newFare,
"oldFare" => $oldFare,
"FixedMarkUp" => $intAgencyFixMarkUp,
"GSTOnMarkUp" => $intSTaxOnAgencyFixMarkUp,
"CommEarned" => $intCommisionEarnedForAgency,
"GSTonComm" => $intGSTOnAgencyCommisionEarned,
"intGTXMarkUp" => $intGTXMarkUp,
"GTXMarkUpGST" => $intSTaxOnGTXMarkUp,
"FareBreakdown" => $FareBreakdown,
);
}
}
$BAGGAGE = isset($OriginSegments['ssrInfo']['BAGGAGE']) ? $OriginSegments['ssrInfo']['BAGGAGE'] : '';
$MEAL = isset($OriginSegments['ssrInfo']['MEAL']) ? $OriginSegments['ssrInfo']['MEAL'] : '';
if ($BAGGAGE) {
foreach ($BAGGAGE as $b => $bag) {
$Weight = str_replace('Excess Baggage - ', '', $bag['desc']);
$BaggageArr[$b]['Currency'] = 'INR';
$BaggageArr[$b]['key'] = $OriginSegments['id'];
$BaggageArr[$b]['Code'] = $bag['code'];
$BaggageArr[$b]['Price'] = isset($bag['amount']) ? $bag['amount'] : 0;
$BaggageArr[$b]['Weight'] = $Weight;
}
}
if ($MEAL) {
foreach ($MEAL as $m => $meals) {
$MealArr[$m]['Currency'] = 'INR';
$MealArr[$m]['key'] = $OriginSegments['id'];
$MealArr[$m]['Code'] = $meals['code'];
$MealArr[$m]['Price'] = isset($meals['amount']) ? $meals['amount'] : 0;
$MealArr[$m]['Description'] = $meals['desc'];
}
}
if ($SegmentInformation) {
foreach ($SegmentInformation as $segments) {
//echo '<pre>';print_r($segments);
$duration = $segments['duration'];
$LAYOVERMinutes = $GroundTime = isset($segments['cT']) ? $segments['cT'] : 0;
$LAYOVERCity = $LAYOVERCityArr[] = isset($segments['cT']) ? $segments['aa']['city'] : '';
$FlyingMinutes += ($duration + $LAYOVERMinutes);
$TotalLAYOVERMinutes += $LAYOVERMinutes;
$FareClass = $totalPriceList['fd']['ADULT']['cB'];
$strBaggage = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $totalPriceList['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
$AirlineCode = $segments['fD']['aI']['code'];
$AirlineName = $segments['fD']['aI']['name'];
$FlightNumber = $segments['fD']['fN'];
$SegFlightNumber = $AirlineCode . "-" . $FlightNumber;
$originAirportName = $segments['da']['name'];
$originAirportCode = $segments['da']['code'];
$originCityName = $segments['da']['city'];
$originCountryName = $segments['da']['country'];
$originDepTime = $segments['dt'];
$destinationAirportName = $segments['aa']['name'];
$destinationAirportCode = $segments['aa']['code'];
$destinationCityName = $segments['aa']['city'];
$destinationCountryName = $segments['aa']['country'];
$destinationArrTime = $segments['at'];
$DepTerminal = isset($segments['da']['terminal']) ? $segments['da']['terminal'] : '';
$ArrTerminal = isset($segments['aa']['terminal']) ? $segments['aa']['terminal'] : '';
$filePath = $this->getflightlogo($AirlineCode);
$LAYOVERDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->MinutesToHours($LAYOVERMinutes);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($destinationArrTime);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($originDepTime);
$strDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($duration);
$arrSegments[] = array(
"originAirportName" => $originAirportName,
"destinationAirportName" => $destinationAirportName,
"originCityName" => $originCityName,
"originCountryName" => $originCountryName,
"destinationCityName" => $destinationCityName,
"destinationCountryName" => $destinationCountryName,
"destinationAirportCode" => $destinationAirportCode,
"destinationAirportCode" => $destinationAirportCode,
"destinationArrTime" => $destinationArrTime,
"SegFlightNumber" => $SegFlightNumber,
"AirlineCode" => $AirlineCode,
"AirlineName" => $AirlineName,
"FareClass" => $FareClass,
"originAirportCode" => $originAirportCode,
"originDepTime" => $originDepTime,
"TripIndicator" => '', //$TripIndicator,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsBaggage" => $IsBaggage,
"IsMealIncludes" => $IsMealIncludes,
//"SegmentIndicator" => $SegmentIndicator,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"filePath" => $filePath,
);
//echo '<pre>';print_r($arrSegments);
}
}
$flightSSRDetails = new Zend_Session_Namespace('flightSSRDetails');
$flightSSRDetails->params['Baggage'] = $BaggageArr;
$flightSSRDetails->params['Meal'] = $MealArr;
$LAYOVERTime = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->MinutesToHours($TotalLAYOVERMinutes);
$AirlineCode = $OriginSegments['fD']['aI']['code'];
$FlightNumber = $OriginSegments['fD']['fN'];
$strFlightNumber = $AirlineCode . "-" . $FlightNumber;
$strAirlineName = $OriginSegments['fD']['aI']['name'];
$IsLCC = $OriginSegments['fD']['aI']['isLcc'];
$strSourceAirportCode = $OriginSegments['da']['code'];
$strDestinationAirportCode = $DestinationSegments['aa']['code'];
$Stops = $DestinationSegments['sN'];
if ($Stops == 0) {
$StopCountTxt = "Non-stop";
} else {
$StopCountTxt = $Stops . " Stop(s)";
}
$filePath = $this->getflightlogo($AirlineCode);
$FlightDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->CalculateHoursMinutes($OriginSegments['dt'], $DestinationSegments['at']);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($DestinationSegments['at']);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($OriginSegments['dt']);
$airlineSysId = !empty($arrAirlineList[$AirlineCode]) ? $arrAirlineList[$AirlineCode] : '0';
$arrInsertFlightData[$key]['bookingId'] = $bookingId;
$arrInsertFlightData[$key]['FlightNumber'] = $strFlightNumber;
$arrInsertFlightData[$key]['AirlineName'] = $strAirlineName;
$arrInsertFlightData[$key]['AirlineCode'] = $AirlineCode;
$arrInsertFlightData[$key]['AirInvenSysId'] = 0;
$arrInsertFlightData[$key]['IsLCC'] = $IsLCC;
$arrInsertFlightData[$key]['IsMealIncludes'] = $IsMealIncludes;
$arrInsertFlightData[$key]['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$key]['IsRefundable'] = $IsRefundable;
$arrInsertFlightData[$key]['IsRefundableTxt'] = $IsRefundableTxt;
$arrInsertFlightData[$key]['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['AirlineSysId'] = $airlineSysId;
$arrInsertFlightData[$key]['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$key]['ArrivalTime'] = $strArrivalDtTime;
$arrInsertFlightData[$key]['TravelDate'] = $OriginSegments['dt'];
$arrInsertFlightData[$key]['LocalFromTime'] = str_replace('T', ' ', $OriginSegments['dt']);
$arrInsertFlightData[$key]['FromUTCTime'] = $OriginSegments['dt'];
$arrInsertFlightData[$key]['LocalToTime'] = str_replace('T', ' ', $DestinationSegments['at']);
$arrInsertFlightData[$key]['ToUTCTime'] = $DestinationSegments['at'];
$arrInsertFlightData[$key]['IsDirect'] = 0;
$arrInsertFlightData[$key]['FareClass'] = $strFareClass;
$arrInsertFlightData[$key]['LAYOVERCity'] = isset($LAYOVERCityArr[0]) ? $LAYOVERCityArr[0] : '';
$arrInsertFlightData[$key]['GroundTime'] = $TotalLAYOVERMinutes;
$arrInsertFlightData[$key]['LAYOVERDuration'] = $LAYOVERTime;
$arrInsertFlightData[$key]['FlyingMinutes'] = $FlyingMinutes;
$arrInsertFlightData[$key]['DepartureDateTxt'] = date('D, d M', strtotime($OriginSegments['dt']));
$arrInsertFlightData[$key]['ArrivalDateTxt'] = date('D, d M', strtotime($DestinationSegments['at']));
$arrInsertFlightData[$key]['FlightDuration'] = $FlightDuration;
$arrInsertFlightData[$key]['SourcePlaceSysId'] = $intSourceCityId;
$arrInsertFlightData[$key]['DestPlaceSysId'] = $intDestinationCityId;
$arrInsertFlightData[$key]['SourceAirportCode'] = $strSourceAirportCode;
$arrInsertFlightData[$key]['DestAirportCode'] = $strDestinationAirportCode;
// $arrInsertFlightData[$key]['AirportHaultMinutes'] = $AirportHaultMinutes;
$arrInsertFlightData[$key]['StopCount'] = $StopCountTxt;
$arrInsertFlightData[$key]['Stops'] = $Stops;
$arrInsertFlightData[$key]['NoOfSeatAvailable'] = $NoOfSeatAvailable;
$arrInsertFlightData[$key]['TotalFlightMembers'] = $intMemberCount;
$arrInsertFlightData[$key]['CurrencyType'] = 1;
$arrInsertFlightData[$key]['PublishedFare'] = $PublishedFare; // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFareTxt'] = number_format($PublishedFare); // As Discussed with GG
// $arrInsertFlightData[$key]['CommissionEarned'] = $CommissionEarned;
$arrInsertFlightData[$key]['ApiResultIndex'] = $ResultIndex;
$arrInsertFlightData[$key]['JourneyType'] = $intJourneyType;
$arrInsertFlightData[$key]['TripType'] = $intTripType;
$arrInsertFlightData[$key]['IsInternational'] = $interNationalSearch;
$arrInsertFlightData[$key]['logo'] = $filePath;
$arrInsertFlightData[$key]['FairRules'] = $FairRulesArr;
//$arrInsertFlightData[$key]['Fare'] = $FairRulesArr;
$arrInsertFlightData[$key]['Segments'] = $arrSegments;
$arrInsertFlightData[$key]['Baggage'] = $BaggageArr;
$arrInsertFlightData[$key]['Meal'] = $MealArr;
$arrInsertFlightData[$key]['isGSTMandatory'] = $isGSTMandatory;
$arrInsertFlightData[$key]['strTraceId'] = $strTraceId;
// $arrInsertFlightData[$key]['SourcePlaceSysId'] = $arrCommonInsVariables['intSourceCityId'];
// $arrInsertFlightData[$key]['DestPlaceSysId'] = $arrCommonInsVariables['intDestinationCityId'];
// $arrInsertFlightData[$key]['SourceAirportCode'] = $arrCommonInsVariables['strSourceAirportCode'];
// $arrInsertFlightData[$key]['DestAirportCode'] = $arrCommonInsVariables['strDestinationAirportCode'];
// $arrInsertFlightData[$key]['LocalFromTime'] = isset($arrCommonInsVariables['localFromDateTime']) ? $arrCommonInsVariables['localFromDateTime'] : '';
// $arrInsertFlightData[$key]['FromUTCTime'] = isset($arrCommonInsVariables['localFromDateTime']) ? $arrCommonInsVariables['localFromDateTime'] : '';
// $arrInsertFlightData[$key]['LocalToTime'] = isset($arrCommonInsVariables['localToDateTime']) ? $arrCommonInsVariables['localToDateTime'] : '';
// $arrInsertFlightData[$key]['ToUTCTime'] = isset($arrCommonInsVariables['localToDateTime']) ? $arrCommonInsVariables['localToDateTime'] : '';
$arrInsertFlightData[$key]['arrCommonInsVariables'] = $arrCommonInsVariables;
$arrAirlineName[] = $AirlineCode . '-' . $strAirlineName;
$AttPriceRange[] = $PublishedFare;
$FiltStopCount[] = $StopCountTxt;
$arrInsertFlightData[$key]['FilterPrice'] = ''; //$FilterPrice;
}
}
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$Discount = 0;
$ServiceFee = 0;
$ManagementFeeTax = 0;
$AirlineGSTComponent = 0;
$CarrierMiscFee = 0;
$MUFee = 0;
$intPublishedFare = 0;
$PublishedFare = 0;
$OfferedFare = 0;
$AdditionalTxnFeeOfrd = 0;
$AdditionalTxnFeePub = 0;
$FixedMarkUp = 0;
$GSTOnMarkUp = 0;
$CommEarned = 0;
$GSTonComm = 0;
$intGTXMarkUp = 0;
$GTXMarkUpGST = 0;
$FareBreakdown = [];
$Segments = array();
$PublishedFareIntRound = 0;
if ($arrInsertFlightData) {
foreach ($arrInsertFlightData as $k => $result) {
$PublishedFareIntRound += $result['PublishedFare'];
$BaseFare += $result['FairRules']['BaseFare'];
$Tax += $result['FairRules']['Tax'];
$YQTax += $result['FairRules']['YQTax'];
$OtherCharges += $result['FairRules']['OtherCharges'];
$Discount += $result['FairRules']['Discount'];
$ServiceFee += $result['FairRules']['ServiceFee'];
$ManagementFeeTax += $result['FairRules']['ManagementFeeTax'];
$AirlineGSTComponent += $result['FairRules']['AirlineGSTComponent'];
$CarrierMiscFee += $result['FairRules']['CarrierMiscFee'];
$MUFee += $result['FairRules']['MUFee'];
$intPublishedFare += $result['FairRules']['intPublishedFare'];
$PublishedFare += $result['FairRules']['PublishedFare'];
$OfferedFare += $result['FairRules']['OfferedFare'];
$AdditionalTxnFeeOfrd += $result['FairRules']['AdditionalTxnFeeOfrd'];
$AdditionalTxnFeePub += $result['FairRules']['AdditionalTxnFeePub'];
$FixedMarkUp += $result['FairRules']['FixedMarkUp'];
$GSTOnMarkUp += $result['FairRules']['GSTOnMarkUp'];
$CommEarned += $result['FairRules']['CommEarned'];
$GSTonComm += $result['FairRules']['GSTonComm'];
$intGTXMarkUp += $result['FairRules']['intGTXMarkUp'];
$GTXMarkUpGST += $result['FairRules']['GTXMarkUpGST'];
foreach ($result['FairRules']['FareBreakdown'] as $id => $value) {
$FareBreakdown[$id]['Currency'] = $value['Currency'];
$FareBreakdown[$id]['PassengerType'] = $value['PassengerType'];
$FareBreakdown[$id]['PassengerCount'] = $value['PassengerCount'];
$FareBreakdown[$id]['TaxIN'] += $value['TaxIN'];
$FareBreakdown[$id]['BaseFareCal'] += $value['BaseFareCal'];
$FareBreakdown[$id]['BaseFare'] += $value['BaseFare'];
$FareBreakdown[$id]['CommissionEarned'] += $value['CommissionEarned'];
$FareBreakdown[$id]['TDS'] += $value['TDS'];
$FareBreakdown[$id]['MF'] += $value['MF'];
$FareBreakdown[$id]['YQ'] += $value['YQ'];
$FareBreakdown[$id]['AGST'] += $value['AGST'];
$FareBreakdown[$id]['MFT'] += $value['MFT'];
$FareBreakdown[$id]['OT'] += $value['OT'];
$FareBreakdown[$id]['MU'] += $value['MU'];
$FareBreakdown[$id]['YR'] += $value['YR'];
$FareBreakdown[$id]['FixedMarkUp'] += $value['FixedMarkUp'];
$FareBreakdown[$id]['GSTOnMarkUp'] += $value['GSTOnMarkUp'];
$FareBreakdown[$id]['CommEarned'] += $value['CommEarned'];
$FareBreakdown[$id]['GSTonComm'] += $value['GSTonComm'];
$FareBreakdown[$id]['intGTXMarkUp'] += $value['intGTXMarkUp'];
$FareBreakdown[$id]['GTXMarkUpGST'] += $value['GTXMarkUpGST'];
$FareBreakdown[$id]['AdditionalTxnFeeOfrd'] += $value['AdditionalTxnFeeOfrd'];
$FareBreakdown[$id]['AdditionalTxnFeePub'] += $value['AdditionalTxnFeePub'];
$FareBreakdown[$id]['PGCharge'] += $value['PGCharge'];
}
$Segments[] = $result['Segments'];
//echo '<pre>';print_r($result['Segments']);echo '</pre>';
}
}
//echo '<pre>';print_r($FareBreakdown);echo '</pre>';
$FareRulesArr = array(
//'FareRules'=>array(
'Currency' => $arrInsertFlightData[0]['FairRules']['Currency'],
'CurrencyRate' => $arrInsertFlightData[0]['FairRules']['CurrencyRate'],
'currencySysId' => $arrInsertFlightData[0]['FairRules']['currencySysId'],
'BaseFare' => $BaseFare,
'Tax' => $Tax,
'YQTax' => $YQTax,
'OtherCharges' => $OtherCharges,
'Discount' => $Discount,
'ServiceFee' => $ServiceFee,
'ManagementFeeTax' => $ManagementFeeTax,
'AirlineGSTComponent' => $AirlineGSTComponent,
'CarrierMiscFee' => $CarrierMiscFee,
'MUFee' => $MUFee,
'intPublishedFare' => $intPublishedFare,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $OfferedFare,
'AdditionalTxnFeeOfrd' => $AdditionalTxnFeeOfrd,
'AdditionalTxnFeePub' => $AdditionalTxnFeePub,
'FixedMarkUp' => $FixedMarkUp,
'GSTOnMarkUp' => $GSTOnMarkUp,
'CommEarned' => $CommEarned,
'GSTonComm' => $GSTonComm,
'intGTXMarkUp' => $intGTXMarkUp,
'GTXMarkUpGST' => $GTXMarkUpGST,
'FareBreakdown' => $FareBreakdown,
//)
);
$arrInsertFlightDataInt['bookingId'] = $arrInsertFlightData[0]['bookingId'];
$arrInsertFlightDataInt['FlightNumber'] = $arrInsertFlightData[0]['FlightNumber'];
$arrInsertFlightDataInt['AirlineName'] = $arrInsertFlightData[0]['AirlineName'];
$arrInsertFlightDataInt['AirlineCode'] = $arrInsertFlightData[0]['AirlineCode'];
$arrInsertFlightDataInt['AirInvenSysId'] = $arrInsertFlightData[0]['AirInvenSysId'];
$arrInsertFlightDataInt['IsLCC'] = $arrInsertFlightData[0]['IsLCC'];
$arrInsertFlightDataInt['IsMealIncludes'] = $arrInsertFlightData[0]['IsMealIncludes'];
$arrInsertFlightDataInt['IsBagIncludes'] = $arrInsertFlightData[0]['IsBagIncludes'];
$arrInsertFlightDataInt['IsRefundable'] = $arrInsertFlightData[0]['IsRefundable'];
$arrInsertFlightDataInt['IsRefundableTxt'] = $arrInsertFlightData[0]['IsRefundableTxt'];
$arrInsertFlightDataInt['apiTraceId'] = $arrInsertFlightData[0]['apiTraceId'];
$arrInsertFlightDataInt['strTraceId'] = $arrInsertFlightData[0]['apiTraceId'];
$arrInsertFlightDataInt['AirlineSysId'] = $arrInsertFlightData[0]['AirlineSysId'];
$arrInsertFlightDataInt['DepartureTime'] = $arrInsertFlightData[0]['DepartureTime'];
$arrInsertFlightDataInt['ArrivalTime'] = $arrInsertFlightData[0]['ArrivalTime'];
$arrInsertFlightDataInt['TravelDate'] = $arrInsertFlightData[0]['TravelDate'];
$arrInsertFlightDataInt['LocalFromTime'] = $arrInsertFlightData[0]['LocalFromTime'];
$arrInsertFlightDataInt['FromUTCTime'] = $arrInsertFlightData[0]['FromUTCTime'];
$arrInsertFlightDataInt['LocalToTime'] = $arrInsertFlightData[0]['LocalToTime'];
$arrInsertFlightDataInt['ToUTCTime'] = $arrInsertFlightData[0]['ToUTCTime'];
$arrInsertFlightDataInt['IsDirect'] = $arrInsertFlightData[0]['IsDirect'];
$arrInsertFlightDataInt['FareClass'] = $arrInsertFlightData[0]['FareClass'];
$arrInsertFlightDataInt['LAYOVERCity'] = $arrInsertFlightData[0]['LAYOVERCity'];
$arrInsertFlightDataInt['GroundTime'] = $arrInsertFlightData[0]['GroundTime'];
$arrInsertFlightDataInt['LAYOVERDuration'] = $arrInsertFlightData[0]['LAYOVERDuration'];
$arrInsertFlightDataInt['FlyingMinutes'] = $arrInsertFlightData[0]['FlyingMinutes'];
$arrInsertFlightDataInt['DepartureDateTxt'] = $arrInsertFlightData[0]['DepartureDateTxt'];
$arrInsertFlightDataInt['ArrivalDateTxt'] = $arrInsertFlightData[0]['ArrivalDateTxt'];
$arrInsertFlightDataInt['FlightDuration'] = $arrInsertFlightData[0]['FlightDuration'];
$arrInsertFlightDataInt['SourcePlaceSysId'] = $arrInsertFlightData[0]['SourcePlaceSysId'];
$arrInsertFlightDataInt['DestPlaceSysId'] = $arrInsertFlightData[0]['DestPlaceSysId'];
$arrInsertFlightDataInt['SourceAirportCode'] = $arrInsertFlightData[0]['SourceAirportCode'];
$arrInsertFlightDataInt['DestAirportCode'] = $arrInsertFlightData[0]['DestAirportCode'];
$arrInsertFlightDataInt['StopCount'] = $arrInsertFlightData[0]['StopCount'];
$arrInsertFlightDataInt['Stops'] = $arrInsertFlightData[0]['Stops'];
$arrInsertFlightDataInt['NoOfSeatAvailable'] = $arrInsertFlightData[0]['NoOfSeatAvailable'];
$arrInsertFlightDataInt['TotalFlightMembers'] = $arrInsertFlightData[0]['TotalFlightMembers'];
$arrInsertFlightDataInt['CurrencyType'] = $arrInsertFlightData[0]['CurrencyType'];
$arrInsertFlightDataInt['PublishedFare'] = $PublishedFareIntRound;
$arrInsertFlightDataInt['ApiResultIndex'] = $arrInsertFlightData[0]['ApiResultIndex'];
$arrInsertFlightDataInt['JourneyType'] = $arrInsertFlightData[0]['JourneyType'];
$arrInsertFlightDataInt['TripType'] = $arrInsertFlightData[0]['TripType'];
$arrInsertFlightDataInt['IsInternational'] = $arrInsertFlightData[0]['IsInternational'];
$arrInsertFlightDataInt['logo'] = $arrInsertFlightData[0]['logo'];
$arrInsertFlightDataInt['Fare'] = $FareRulesArr;
$arrInsertFlightDataInt['Segments'] = $Segments;
$arrCommonInsVariables = array(
'strTraceId' => $arrInsertFlightData[0]['apiTraceId'],
'localFromDateTime' => $arrInsertFlightData[0]['LocalFromTime'],
'localToDateTime' => $arrInsertFlightData[0]['LocalToTime'],
'strSourceAirportCode' => $strSourceAirportCode,
'strDestinationAirportCode' => $strDestinationAirportCode,
'intMemberCount' => $intMemberCount,
'intSourceCityId' => $intSourceCityId,
'intDestinationCityId' => $intDestinationCityId,
'JourneyType' => 2, // For Round Trips API Search
'TripType' => 1,
'interNationalSearch' => isset($interNationalSearch) ? $interNationalSearch : 0
);
$arrInsertFlightDataInt[0]['arrCommonInsVariables'] = $arrCommonInsVariables;
$arrInsertFlightData[0]['InternationalData'] = $arrInsertFlightDataInt;
//echo '<pre>';print_r(($arrInsertFlightDataInt));echo '</pre>';
// echo '<pre>';print_r(($arrInsertFlightData));echo '</pre>';
// die;
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
//$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$FlightBookingData->params = $arrInsertFlightData;
return $arrInsertFlightData;
//$FlightBookingDataInbound->params = $RoundTrip['inbound'][0];
//echo '<pre>';print_r($arrInsertFlightData[0]);die;
}
public function bookFlightAction()
{
$param = $this->getRequest()->getParams();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$this->view->CustomerSession = $CustomerSession->params;
$this->view->FlightSearchUrl = $FlightSearchUrl->params;
$class = $sessionFlightSearchParams->params['class'];
$route = $sessionFlightSearchParams->params['route'];
$interNationalSearch = $sessionFlightSearchParams->params['interNationalSearch'];
$this->view->traceId = $param['traceId'];
$this->view->departure_date = $sessionFlightSearchParams->params['strDepatureDate'];
$this->view->return_dates = $sessionFlightSearchParams->params['strReturnDate'];
$this->view->class = $class;
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->FlightBookingData = $FlightBookingData->params;
$this->view->FlightBookingDataInbound = $FlightBookingDataInbound->params;
$flight_booking_customer_id = new Zend_Session_Namespace('flight_booking_customer_id');
$booking_customer_id = $flight_booking_customer_id->params;
$CustomerMemberSysIds = new Zend_Session_Namespace('CustomerMemberSysIds');
$flight_booking_id = isset($CustomerMemberSysIds->params['flight_booking_id']) ? $CustomerMemberSysIds->params['flight_booking_id'] : 0;
$FlightBookingTicketArr = [];
$responseReturn = [];
$BookingData = [];
$BookingData = $FlightBookingData->params;
$ResponseFlightQuery = new Zend_Session_Namespace('ResponseFlightQuery');
$FlightQueryids = $ResponseFlightQuery->params;
$MasterTPSysId = $FlightQueryids['arrIds']['MasterTPSysId'];
$TPSysId = $FlightQueryids['arrIds']['TPSysId'];
$VersionId = $FlightQueryids['arrIds']['VersionId'];
//echo '<pre>';print_r($FlightQueryids);die;
$SelectedMealSessionNew = new Zend_Session_Namespace('SelectedMealSessionNew');
$SelectedBaggSessionNew = new Zend_Session_Namespace('SelectedBaggSessionNew');
$SelectedMealSessionNewInb = new Zend_Session_Namespace('SelectedMealSessionNewInb');
$SelectedBaggSessionNewInb = new Zend_Session_Namespace('SelectedBaggSessionNewInb');
$BagPrice = 0;
$InbBagPrice = 0;
$MealPrice = 0;
$InbMealPrice = 0;
if ($SelectedBaggSessionNew->params) {
foreach ($SelectedBaggSessionNew->params as $val) {
$BagPrice += $val['Price'];
}
}
if ($SelectedMealSessionNew->params) {
foreach ($SelectedMealSessionNew->params as $val) {
$MealPrice += $val['Price'];
}
}
if ($SelectedMealSessionNewInb->params) {
foreach ($SelectedMealSessionNewInb->params as $val) {
$InbMealPrice += $val['Price'];
}
}
if ($SelectedBaggSessionNewInb->params) {
foreach ($SelectedBaggSessionNewInb->params as $val) {
$InbBagPrice += $val['Price'];
}
}
$MealFare = ($MealPrice + $InbMealPrice);
$BaggFare = ($BagPrice + $InbBagPrice);
if ($this->getRequest()->isXmlHttpRequest() && $FlightBookingData->params) {
// echo '<pre>';print_r($InbBagPrice);
// die;
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getParams();
$IsLCC = false;
$BookingdataAPI = array(
'FlightBookingData' => $BookingData,
'sessionFlightSearchParams' => $sessionFlightSearchParams->params,
'CustomerSession' => $CustomerSession->params,
);
$Bookres = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->apiFlightTicketTripJack($BookingdataAPI);
//$str = file_get_contents($this->baseUrl . 'public/logs/flight/FlightTicket/FlightTicket_response.json');
//$Bookres = json_decode($str, true);
$BookStatus = $Bookres['status']['success'];
$BookErrorMessage = $Bookres['errors'][0]['message'];
if ($BookStatus == 1) {
$response = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->bookingDetailsTripJack($Bookres);
//$str = file_get_contents($this->baseUrl . 'public/logs/flight/BookingDetails/BookingDetails_response.json');
//$response = json_decode($str, true);
// $BookingData =$this->UpdateFlightBookingData($response,null);
$ResponseStatus = isset($response['status']['success']) ? $response['status']['success'] : '0';
$strTicketPNRLCC = isset($response['itemInfos']['AIR']['travellerInfos'][0]['pnrDetails']) ? $response['itemInfos']['AIR']['travellerInfos'][0]['pnrDetails'] : '';
$Passenger = isset($response['itemInfos']['AIR']['travellerInfos']) ? $response['itemInfos']['AIR']['travellerInfos'] : '';
$strBookingIdLCC = isset($response['order']['bookingId']) ? $response['order']['bookingId'] : '0';
$ErrorMessage = isset($response['errors'][0]['message']) ? $response['errors'][0]['message'] : '';
if ($interNationalSearch == 1 && $route == 2) {
$BookingDatadd = $BookingData[0]['InternationalData'];
$finalFareSummary = $BookingDatadd['Fare'];
$PublishedFareINT = $BookingDatadd['Fare']['PublishedFare'];
$AgentCommisionEarnedINT = ($finalFareSummary['CommEarned'] + $finalFareSummary['PLBEarned']);
$AgentCommisionEarnedGSTINT = ($finalFareSummary['GSTonComm'] + isset($finalFareSummary['GSTonPLB']) ? $finalFareSummary['GSTonPLB'] : 0);
$AgencyMarkUpINT = $finalFareSummary['FixedMarkUp'];
$AgencyMarkUpGSTINT = $finalFareSummary['GSTOnMarkUp'];
$GTXMarkUpINT = $finalFareSummary['intGTXMarkUp'];
$BaseAmountINT = ($PublishedFareINT - ($AgentCommisionEarnedGSTINT + $AgencyMarkUpGSTINT + $AgentCommisionEarnedINT + $AgencyMarkUpINT + $GTXMarkUpINT));
$FareSummaryInt = array(
'PublishedFare' => ($PublishedFareINT + $BaggFare + $MealFare),
'AgentCommisionEarned' => $AgentCommisionEarnedINT,
'AgentCommisionEarnedGST' => $AgentCommisionEarnedGSTINT,
'AgencyMarkUp' => $AgencyMarkUpINT,
'AgencyMarkUpGST' => $AgencyMarkUpGSTINT,
'GTXMarkUp' => $GTXMarkUpINT,
'BaseAmount' => ($BaseAmountINT + $BaggFare + $MealFare),
);
}
// echo '<pre>';
// print_r(($FareSummaryInt));
// die;
if ($BookingData) {
foreach ($BookingData as $k => $value) {
$finalFareSummary = $value['FairRules'];
$PublishedFareINT = $value['FairRules']['PublishedFare'];
if ($k == 0) {
$MealFare = $MealPrice;
$BaggFare = $BagPrice;
} else {
$MealFare = $InbMealPrice;
$BaggFare = $InbBagPrice;
}
// $finalFareSummary = $this->getfinalFareSummary($booking);
$AgentCommisionEarnedINT = ($finalFareSummary['CommEarned'] + $finalFareSummary['PLBEarned']);
$AgentCommisionEarnedGSTINT = ($finalFareSummary['GSTonComm'] + isset($finalFareSummary['GSTonPLB']) ? $finalFareSummary['GSTonPLB'] : 0);
$AgencyMarkUpINT = $finalFareSummary['FixedMarkUp'];
$AgencyMarkUpGSTINT = $finalFareSummary['GSTOnMarkUp'];
$GTXMarkUpINT = $finalFareSummary['intGTXMarkUp'];
$BaseAmountINT = ($PublishedFareINT - ($AgentCommisionEarnedGSTINT + $AgencyMarkUpGSTINT + $AgentCommisionEarnedINT + $AgencyMarkUpINT + $GTXMarkUpINT));
if ($interNationalSearch == 1 && $route == 2) {
$FareSummary = $FareSummaryInt;
} else {
$FareSummary = array(
'PublishedFare' => ($PublishedFareINT + $BaggFare + $MealFare),
'AgentCommisionEarned' => $AgentCommisionEarnedINT,
'AgentCommisionEarnedGST' => $AgentCommisionEarnedGSTINT,
'AgencyMarkUp' => $AgencyMarkUpINT,
'AgencyMarkUpGST' => $AgencyMarkUpGSTINT,
'GTXMarkUp' => $GTXMarkUpINT,
'BaseAmount' => ($BaseAmountINT + $BaggFare + $MealFare),
);
}
// echo '<pre>';
// print_r($FareSummary);
// die;
$UpdateFare[$k] = array(
'Price' => $BaseAmountINT,
'NetPrice' => $PublishedFareINT,
'AgencyMarkUp' => $AgencyMarkUpINT,
'AgentServiceTaxAmount' => $AgencyMarkUpGSTINT,
'MarkUp' => $AgentCommisionEarnedINT,
'AgentsCustomServiceTaxAmount' => $AgentCommisionEarnedGSTINT,
'GTXMarkup' => $GTXMarkUpINT,
'GTXServiceTaxAmount' => 0,
'TotalCost' => $PublishedFareINT,
'MealFare' => $MealFare,
'BaggFare' => $BaggFare,
);
//$segment = $value['Segments']['originAirportCode'] . '-' . $value['Segments']['destinationAirportCode'];
$FlightBookingTicketArr[] = $response;
$ResponseStatus = isset($response['status']['success']) ? $response['status']['success'] : '0';
$strTicketPNRLCC = isset($response['itemInfos']['AIR']['travellerInfos'][0]['pnrDetails']) ? $response['itemInfos']['AIR']['travellerInfos'][0]['pnrDetails'] : '';
$Passenger = isset($response['itemInfos']['AIR']['travellerInfos']) ? $response['itemInfos']['AIR']['travellerInfos'] : '';
$strBookingIdLCC = isset($response['order']['bookingId']) ? $response['order']['bookingId'] : '0';
$segment = [];
if ($value['Segments']) {
foreach ($value['Segments'] as $seg) {
$originAirportCode = $seg['originAirportCode'];
$destinationAirportCode = $seg['destinationAirportCode'];
$segment[] = $originAirportCode . '-' . $destinationAirportCode;
}
}
$objFlight = new Travel_Model_FlightMaster();
if ($ResponseStatus == 1) {
$update = array(
'API_Response' => json_encode($value),
'API_Response_Ticket' => json_encode($response),
'PNR_Number' => implode('-', $strTicketPNRLCC),
'BookingId' => $strBookingIdLCC,
'status' => 1,
);
$update['PublishedFare'] = $value['FairRules']['PublishedFare'];
$update['BaseFare'] = $value['FairRules']['BaseFare'];
$update['Tax'] = $value['FairRules']['Tax'];
$update['YQTax'] = $value['FairRules']['YQTax'];
$update['OtherCharges'] = $value['FairRules']['OtherCharges'];
$update['Discount'] = $value['FairRules']['Discount'];
$update['ServiceFee'] = $value['FairRules']['ServiceFee'];
$update['OfferedFare'] = $value['FairRules']['PublishedFare'];
//echo '<pre>';print_r($update);die;
$where = "id = " . $flight_booking_id[$k]; //exit;
$updated = $objFlight->UpdateFlightData('tbl_flight_booking', $update, $where);
try {
$responseArray = array(
'value' => $value,
'response' => $response
);
$this->postFieldss .= "&MasterTPSysId=" . $MasterTPSysId;
$this->postFieldss .= "&TPSysId=" . $TPSysId;
$this->postFieldss .= "&VersionId=" . $VersionId[$k];
$this->postFieldss .= "&XRefBookingId=" . $strBookingIdLCC;
$this->postFieldss .= "&APIBookingRes=" . json_encode($responseArray);
$this->postFieldss .= "&FareSummaryAir=" . json_encode($FareSummary);
$this->postFieldss .= "&UpdateFare=" . json_encode($UpdateFare);
$this->postFieldss .= "&ErrorCode=0";
$this->postFieldss .= "&IsBookingStatus=1";
//echo '<pre>';print_r($this->postFieldss);die;
$strFilePath = "flight/updateFlightBookingDetails/" . time() . "_update_request.json";
Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, $this->postFieldss);
$model = new Gtxwebservices_Model_Webservices();
$result = $model->updateFlightBookingDetails($this->postFieldss);
//echo '<pre>';print_r($result);die('api');
//echo '<pre>';print_r($result);
} catch (Exception $error) {
}
if ($Passenger) {
foreach ($Passenger as $pk => $pax) {
$TicketId = implode('-', $pax['pnrDetails']);
$TicketNumber = isset($pax['ticketNumberDetails']) ? implode('-', $pax['ticketNumberDetails']) : '';
$updatep = array(
'PNR_Number' => $TicketId,
'TicketId' => $TicketId,
'TicketNumber' => $TicketNumber,
'sectors' => implode('-', $segment),
'BookingId' => $strBookingIdLCC,
);
//echo '<pre>';print_r($updatep);
$wherep = "id = " . $booking_customer_id[0][$pk];
$objFlight->UpdateFlightData('tbl_flight_booking_customer', $updatep, $wherep);
}
}
if ($updated) {
$responseReturn[] = array('success' => true, 'message' => $ErrorMessage, 'IsLCC' => $value['IsLCC']);
}
} else {
$update = array(
'API_Response' => json_encode($response),
'API_Response_Ticket' => '',
);
$where = "id = " . $flight_booking_id[$k]; //exit;
$updated = $objFlight->UpdateFlightData('tbl_flight_booking', $update, $where);
$responseReturn[] = array('success' => false, 'message' => $ErrorMessage, 'IsLCC' => $value['IsLCC']);
}
}
if ($responseReturn && $ResponseStatus == 1) {
// Zend_Session::namespaceUnset('FlightBookingTicketSession');
$FlightBookingTicketSession = new Zend_Session_Namespace('FlightBookingTicketSession');
$FlightBookingTicketSession->params = $FlightBookingTicketArr;
$Return = array('success' => true, 'message' => 'done', 'IsLCC' => $IsLCC);
echo json_encode($Return);
exit;
} else {
$Return = array('success' => false, 'message' => 'failed', 'IsLCC' => $IsLCC);
echo json_encode($Return);
exit;
}
}
} else {
$Return = array('success' => false, 'message' => $BookErrorMessage, 'IsLCC' => $IsLCC);
echo json_encode($Return);
exit;
}
echo '<pre>';
print_r($response);
print_r($Bookres);
die('dd');
if ($responseReturn) {
// Zend_Session::namespaceUnset('FlightBookingTicketSession');
$FlightBookingTicketSession = new Zend_Session_Namespace('FlightBookingTicketSession');
$FlightBookingTicketSession->params = $FlightBookingTicketArr;
$Return = array('success' => true, 'message' => 'done', 'IsLCC' => $IsLCC);
echo json_encode($Return);
exit;
} else {
$Return = array('success' => false, 'message' => 'failed', 'IsLCC' => $IsLCC);
echo json_encode($Return);
exit;
}
}
}
public function bookingConfirmedAction()
{
Zend_Session::namespaceUnset('FlightBookingData');
Zend_Session::namespaceUnset('FlightBookingDataInbound');
Zend_Session::namespaceUnset('FlightFareQuoteSession');
Zend_Session::namespaceUnset('FlightSearchUrl');
Zend_Session::namespaceUnset('FlightSearchGuard');
Zend_Session::namespaceUnset('CustomerSession');
Zend_Session::namespaceUnset('CustomerMemberSysIds');
$param = $this->getRequest()->getParams();
$FlightBookingTicketSession = new Zend_Session_Namespace('FlightBookingTicketSession');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$CustomerSysIdSession = new Zend_Session_Namespace('CustomerSysIdSession');
//$this->view->CustomerSession = $CustomerSession->params;
$this->view->FlightBookingTicketSession = ($FlightBookingTicketSession->params[0]);
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$route = $sessionFlightSearchParams->params['route'];
$interNationalSearch = $sessionFlightSearchParams->params['interNationalSearch'];
$objFlight = new Travel_Model_FlightMaster();
$FlightBookingInb = [];
// if ($route == 2 && $interNationalSearch == 1) {
// $FlightBooking = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $FlightBookingTicketSession->params[0]['order']['bookingId'], 1);
//}else{
$FlightBooking = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $FlightBookingTicketSession->params[0]['order']['bookingId'], 1);
//}
//if ($route == 2 && $interNationalSearch == '') {
$FlightBookingInb = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $FlightBookingTicketSession->params[0]['order']['bookingId'], 2);
// }
$ResponseArr = [];
$ErrorMessageArr = [];
// $str = file_get_contents($this->baseUrl.'public/logs/flight/FlightTicket/1589491064_FlightTicket_response.json');
// $Bookres = json_decode($str,true);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('FlightBooking' => $FlightBooking, 'FlightBookingInb' => $FlightBookingInb, 'CurrencyRate' => $this->CurrencyRate, 'CurrencyTitle' => $this->CurrencyTitle, 'baseUrl' => $this->baseUrl));
$bodyText = $html->render('e-ticket.phtml');
$subject = 'Your Ticket Has Been Booked';
$Caption = 'Your Ticket Has Been Booked';
// echo $bodyText;die;
$contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
//echo '<pre>';print_r($contactDetail_mail);die;
$configs = [
'to' => trim($FlightBooking['passenger'][0]['EmailId']),
'fromName' => $this->siteName,
'fromEmail' => $contactDetail_mail['email'],
'subject' => $subject,
'bodyHtml' => $bodyText,
];
$returnmail = $this->objHelperGeneral->mailSentByElastice($configs, $Caption);
$response = json_decode($returnmail, true);
$this->view->FlightBooking = $FlightBooking;
$this->view->FlightBookingInb = $FlightBookingInb;
if ($FlightBookingTicketSession->params) {
} else {
$this->_redirect('flight');
}
// $Customerdata = $this->objMdl->rv_select_all('tbl_flight_booking', ['*'], ['CustomerSysId' => $CustomerDetails['CustomerSysId'],'IsMarkForDel'=>0]);
// echo '<pre>';print_r($Customerdata);
}
public function eTicketAction()
{
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$objFlight = new Travel_Model_FlightMaster();
$FlightBookingInb = [];
$FlightBooking = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 1);
$FlightBookingInb = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 2);
// echo '<pre>';print_r($param);
// die('s');
$this->view->FlightBooking = $FlightBooking;
$this->view->FlightBookingInb = $FlightBookingInb;
$this->view->baseUrl = $this->baseUrl;
}
public function invoiceAction()
{
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$objFlight = new Travel_Model_FlightMaster();
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
//echo '<pre>';print_r($getAgencyData);die;
$this->view->getAgencyData = $getAgencyData;
$FlightBookingInb = [];
$FlightBooking = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 1);
$FlightBookingInb = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 2);
// echo '<pre>';print_r($FlightBookingInb);
// die('s');
$this->view->FlightBooking = $FlightBooking;
$this->view->FlightBookingInb = $FlightBookingInb;
$this->view->baseUrl = $this->baseUrl;
}
public function payNowAction()
{
$param = $this->getRequest()->getParams();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$this->view->CustomerSession = $CustomerSession->params;
$this->view->FlightSearchUrl = $FlightSearchUrl->params;
$class = $sessionFlightSearchParams->params['class'];
$route = $sessionFlightSearchParams->params['route'];
$interNationalSearch = $sessionFlightSearchParams->params['interNationalSearch'];
$this->view->traceId = $param['traceId'];
$this->view->departure_date = $sessionFlightSearchParams->params['strDepatureDate'];
$this->view->return_dates = $sessionFlightSearchParams->params['strReturnDate'];
$this->view->class = $class;
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->FlightBookingData = $FlightBookingData->params;
$this->view->FlightBookingDataInbound = $FlightBookingDataInbound->params;
$flight_booking_customer_id = new Zend_Session_Namespace('flight_booking_customer_id');
$booking_customer_id = $flight_booking_customer_id->params;
$ResponseFlightQuery = new Zend_Session_Namespace('ResponseFlightQuery');
$FlightQueryids = $ResponseFlightQuery->params;
$MasterTPSysId = $FlightQueryids['arrIds']['MasterTPSysId'];
$TPSysId = $FlightQueryids['arrIds']['TPSysId'];
$VersionId = $FlightQueryids['arrIds']['VersionId'];
$CustomerMemberSysIds = new Zend_Session_Namespace('CustomerMemberSysIds');
$flight_booking_id = isset($CustomerMemberSysIds->params['flight_booking_id']) ? $CustomerMemberSysIds->params['flight_booking_id'] : 0;
$FlightBookingTicketArr = [];
$responseReturn = [];
$BookingData = [];
$BookingData = $FlightBookingData->params;
$this->view->AgentSysId = $this->gtxagentsysid;
$this->view->AgencySysId = $this->gtxagencysysid;
if ($this->getRequest()->isXmlHttpRequest() && $FlightBookingData->params) {
// $bookingId = array(
// 'TraceId' => $param['traceId'],
// );
// $apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetApiFlightsFareRulesTripJack($bookingId);
// echo $status = $apiResponse['status']['success'];
// echo '<pre>';print_r($apiResponse);die('sss');
$SelectedMealSessionNew = new Zend_Session_Namespace('SelectedMealSessionNew');
$SelectedBaggSessionNew = new Zend_Session_Namespace('SelectedBaggSessionNew');
$SelectedMealSessionNewInb = new Zend_Session_Namespace('SelectedMealSessionNewInb');
$SelectedBaggSessionNewInb = new Zend_Session_Namespace('SelectedBaggSessionNewInb');
$BagPrice = 0;
$InbBagPrice = 0;
$MealPrice = 0;
$InbMealPrice = 0;
if ($SelectedBaggSessionNew->params) {
foreach ($SelectedBaggSessionNew->params as $val) {
$BagPrice += $val['Price'];
}
}
if ($SelectedMealSessionNew->params) {
foreach ($SelectedMealSessionNew->params as $val) {
$MealPrice += $val['Price'];
}
}
if ($SelectedMealSessionNewInb->params) {
foreach ($SelectedMealSessionNewInb->params as $val) {
$InbMealPrice += $val['Price'];
}
}
if ($SelectedBaggSessionNewInb->params) {
foreach ($SelectedBaggSessionNewInb->params as $val) {
$InbBagPrice += $val['Price'];
}
}
$MealFare = ($MealPrice + $InbMealPrice);
$BaggFare = ($BagPrice + $InbBagPrice);
$TempData = array(
'BookingData' => $BookingData,
'sessionFlightSearchParams' => $sessionFlightSearchParams->params,
'FlightSearchUrl' => $FlightSearchUrl->params,
'CustomerSession' => $CustomerSession->params,
'ResponseFlightQuery' => $ResponseFlightQuery->params,
'SelectedMealSessionNew' => $SelectedMealSessionNew->params,
'SelectedBaggSessionNew' => $SelectedBaggSessionNew->params,
'SelectedBaggSessionNewInb' => $SelectedBaggSessionNewInb->params,
'SelectedMealSessionNewInb' => $SelectedMealSessionNewInb->params,
'flight_booking_customer_id' => $flight_booking_customer_id->params,
'CustomerMemberSysIds' => $CustomerMemberSysIds->params,
);
$insertArr = array(
'TraceId' => $param['traceId'],
'json_data' => json_encode($TempData),
'created_at' => Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss'),
);
$this->objMdl->rv_delete('tbl_temp_data', array('TraceId = ?' => $param['traceId']));
$objFlight = new Travel_Model_FlightMaster();
$objFlight->InsertFlightData('tbl_temp_data', $insertArr);
//echo '<pre>';print_r($TempData);die;
$PublishedFare = 0;
$agencyMarkUp = 0;
$gtxMarkup = 0;
$offerFare = 0;
$gtxMarkupGST = 0;
$agencyMarkUpGST = 0;
if ($BookingData) {
foreach ($BookingData as $amount) {
$PublishedFare += $amount['FairRules']['PublishedFare'];
$agencyMarkUp += $amount['FairRules']['FixedMarkUp'];
$gtxMarkup += $amount['FairRules']['intGTXMarkUp'];
$offerFare += $amount['FairRules']['OfferedFare'];
$gtxMarkupGST += $amount['FairRules']['GTXMarkUpGST'];
$agencyMarkUpGST += $amount['FairRules']['GSTOnMarkUp'];
}
}
$PublishedFare = ($PublishedFare + $BaggFare + $MealFare);
$markuparray['intAgentMarkUpAmount'] = 0;
$markuparray['intAgencyMarkUpAmount'] = round($agencyMarkUp);
$markuparray['intGTXMarkUpAmount'] = round($gtxMarkup);
$markuparray['intTotalAmount'] = round($offerFare);
$markuparray['intTax'] = 0;
$markuparray['intTotalGTXTaxAmount'] = 0;
$markuparray['GTXServiceTaxAmount'] = round($gtxMarkupGST);
$markuparray['AgentServiceTaxAmount'] = round($agencyMarkUpGST);
$markuparray['AgentsCustomServiceTaxAmount'] = 0;
$markuparray['Pax'] = 1;
$markuparray['TotalDiscount'] = 0;
$markuparray['CurrencyType'] = 1; //currency Id
$markuparray['MarketPlaceId'] = 2; //b2b or b2c
//echo "<pre>";print_r($param);exit;
$encryptMarkUpData = base64_encode(json_encode($markuparray));
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getParams();
$customerData = $CustomerSession->params[0];
$AgentSysId = $this->gtxagentsysid;
$AgencySysId = $this->gtxagencysysid;
$intTPSysId = json_encode([$TPSysId]);
$intCustSysId = $customerData['CustomerSysId'];
$firstName = $customerData['FirstName'];
$emailId = $customerData['EmailId'];
$mobileNumber = $customerData['Contacts'];
$lastInsertId = $param['traceId']; //base64_encode(implode(',', $flight_booking_id));
$guid = base64_encode(implode(',', $flight_booking_id)); //$param['traceId']; //$this->GUID();
$walletCode = $this->walletCode($AgentSysId, $guid, round($PublishedFare), $AgencySysId, $intTPSysId, $intCustSysId, $encryptMarkUpData);
$strReturnURL = $this->baseUrl . "flight/check-payment/" . ($lastInsertId);
echo json_encode(["success" => true, 'guid' => $guid, 'amount' => round($PublishedFare), 'walletCode' => $walletCode, 'stringData' => $encryptMarkUpData, 'strReturnURL' => $strReturnURL, 'TPSysId' => $intTPSysId, 'UserData' => ['name' => $firstName, 'email' => $emailId, 'mobile' => $mobileNumber, 'CustomerSysId' => $intCustSysId]]);
exit;
}
}
public function checkPaymentAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getParams();
$status = $this->getRequest()->getParam('status');
$GUID = $this->getRequest()->getParam('GUID');
$TrxId = $this->getRequest()->getParam('TrxId');
$error = $this->getRequest()->getParam('error');
$error_Message = $this->getRequest()->getParam('error_Message');
$id = $this->getRequest()->getParam('id');
$TrxId = explode(',', base64_decode($this->getRequest()->getParam('TrxId')));
$objFlight = new Travel_Model_FlightMaster();
$arrPayment = [
"error_Message" => $error_Message,
"error" => $error,
"GUID" => $GUID,
];
//echo "<pre>";print_r($param);die;
$temp_data = $this->objMdl->selectOne('tbl_temp_data', ['*'], ['TraceId' => $id], ['id' => 'ASC']);
$response = json_decode($temp_data['json_data'], true);
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingData->params = $response['BookingData'];
// if (isset($response['BookingData'][1]) && !empty($response['BookingData'][1])) {
// $FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
// $FlightBookingDataInbound->params = $response['BookingData'][1];
// }
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$sessionFlightSearchParams->params = $response['sessionFlightSearchParams'];
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
$FlightSearchUrl->params = $response['FlightSearchUrl'];
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$CustomerSession->params = $response['CustomerSession'];
$ResponseFlightQuery = new Zend_Session_Namespace('ResponseFlightQuery');
$ResponseFlightQuery->params = $response['ResponseFlightQuery'];
$SelectedMealSessionNew = new Zend_Session_Namespace('SelectedMealSessionNew');
$SelectedMealSessionNew->params = $response['SelectedMealSessionNew'];
$SelectedBaggSessionNew = new Zend_Session_Namespace('SelectedBaggSessionNew');
$SelectedBaggSessionNew->params = $response['SelectedBaggSessionNew'];
$SelectedBaggSessionNewInb = new Zend_Session_Namespace('SelectedBaggSessionNewInb');
$SelectedBaggSessionNewInb->params = $response['SelectedBaggSessionNewInb'];
$SelectedMealSessionNewInb = new Zend_Session_Namespace('SelectedMealSessionNewInb');
$SelectedMealSessionNewInb->params = $response['SelectedMealSessionNewInb'];
$flight_booking_customer_id = new Zend_Session_Namespace('flight_booking_customer_id');
$flight_booking_customer_id->params = $response['flight_booking_customer_id'];
$CustomerMemberSysIds = new Zend_Session_Namespace('CustomerMemberSysIds');
$CustomerMemberSysIds->params = $response['CustomerMemberSysIds'];
$ResponseFlightQuery = new Zend_Session_Namespace('ResponseFlightQuery');
$FlightQueryids = $ResponseFlightQuery->params;
$MasterTPSysId = $FlightQueryids['arrIds']['MasterTPSysId'];
$TPSysId = $FlightQueryids['arrIds']['TPSysId'];
$VersionId = $FlightQueryids['arrIds']['VersionId'];
// echo "<pre>";
// print_r($temp_data['json_data']);
// print_r($id);
// exit;
if ($id && $TrxId) {
if ($status == "Ok") {
$arrPayment['paymentStatus'] = 1;
foreach ($TrxId as $key => $flight_booking_id) {
$where = "id = " . $flight_booking_id; //exit;
$updated = $objFlight->UpdateFlightData('tbl_flight_booking', $arrPayment, $where);
}
if ($updated) {
$this->_redirect('flight/book-flight/' . $id);
}
} else if ($status == "C") {
// cancelled by User
$arrPayment['paymentStatus'] = 2;
foreach ($TrxId as $key => $flight_booking_id) {
$where = "id = " . $flight_booking_id; //exit;
$updated = $objFlight->UpdateFlightData('tbl_flight_booking', $arrPayment, $where);
try {
$this->postFields .= "&MasterTPSysId=" . $MasterTPSysId;
$this->postFields .= "&TPSysId=" . $TPSysId;
$this->postFields .= "&VersionId=" . $VersionId[$key];
$this->postFields .= "&XRefBookingId=''";
$this->postFields .= "&APIBookingRes=''";
$this->postFields .= "&ErrorCode=6";
$this->postFields .= "&IsBookingStatus=0";
$strFilePath = "flight/payment/" . time() . "_cancelbyuser_request.json";
Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, $this->postFields);
$model = new Gtxwebservices_Model_Webservices();
$result = $model->updateFlightBookingDetails($this->postFields);
} catch (Exception $error) {
}
}
if ($updated) {
$this->_redirect('flight/payment-failed/' . $id);
}
} else {
// payment failed case...
$arrPayment['paymentStatus'] = 3;
foreach ($TrxId as $key => $flight_booking_id) {
$where = "id = " . $flight_booking_id; //exit;
$updated = $objFlight->UpdateFlightData('tbl_flight_booking', $arrPayment, $where);
// try {
// $this->postFields .= "&MasterTPSysId=" . $MasterTPSysId;
// $this->postFields .= "&TPSysId=" . $TPSysId;
// $this->postFields .= "&VersionId=" . $VersionId[$key];
// $this->postFields .= "&XRefBookingId=''";
// $this->postFields .= "&APIBookingRes=''";
// $this->postFields .= "&ErrorCode=6";
// $this->postFields .= "&IsBookingStatus=0";
// $strFilePath = "flight/payment/" . time() . "_failed_request.json";
// Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, $this->postFields);
// $model = new Gtxwebservices_Model_Webservices();
// $result = $model->updateFlightBookingDetails($this->postFields);
// } catch (Exception $error) {
// }
}
//if ($updated) {
$this->_redirect('flight/payment-failed/' . $id);
//}
}
}
}
public function paymentFailedAction()
{
$param = $this->getRequest()->getParams();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$FlightSearchUrl = new Zend_Session_Namespace('FlightSearchUrl');
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$CustomerMemberSysIds = new Zend_Session_Namespace('CustomerMemberSysIds');
$LeadPaxSession = new Zend_Session_Namespace('LeadPaxSession');
$CustomerMembersSession = new Zend_Session_Namespace('CustomerMembersSession');
$this->view->CustomerMemberSysIds = $CustomerMemberSysIds->params;
$this->view->LeadPaxSession = $LeadPaxSession->params;
$this->view->CustomerMembersSession = $CustomerMembersSession->params;
$this->view->CustomerSession = $CustomerSession->params;
$this->view->FlightSearchUrl = $FlightSearchUrl->params;
$class = $sessionFlightSearchParams->params['class'];
$this->view->traceId = $param['id'];
$this->view->departure_date = $sessionFlightSearchParams->params['strDepatureDate'];
$this->view->return_dates = $sessionFlightSearchParams->params['strReturnDate'];
$this->view->class = $class;
$this->view->param = $param;
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->CurrencyTitle = $this->CurrencyTitle;
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->FlightBookingData = $FlightBookingData->params;
$this->view->FlightBookingDataInbound = $FlightBookingDataInbound->params;
//echo "<pre>";print_r($FlightBookingData->params);
//exit;
}
public function removebaggageAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$SelectedMealSessionNew = new Zend_Session_Namespace('SelectedMealSessionNew');
$SelectedBaggSessionNew = new Zend_Session_Namespace('SelectedBaggSessionNew');
$SelectedMealSessionNewInb = new Zend_Session_Namespace('SelectedMealSessionNewInb');
$SelectedBaggSessionNewInb = new Zend_Session_Namespace('SelectedBaggSessionNewInb');
$param = $this->getRequest()->getParams();
$CustomerSysId = $param['CustomerSysId'];
if ($param['segment'] == 1 && $param['type'] == 'Baggage') {
unset($SelectedBaggSessionNew->params[$CustomerSysId]);
}
if ($param['segment'] == 2 && $param['type'] == 'BaggageInb') {
unset($SelectedBaggSessionNewInb->params[$CustomerSysId]);
}
if ($param['segment'] == 1 && $param['type'] == 'Meal') {
unset($SelectedMealSessionNew->params[$CustomerSysId]);
}
if ($param['segment'] == 2 && $param['type'] == 'MealInb') {
unset($SelectedMealSessionNewInb->params[$CustomerSysId]);
}
$response = array('success' => true);
echo json_encode($response);
exit;
}
}
public function viewDetailsAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
//print_r($param);die;
$this->view->traceId = $param['traceId'];
$objFlight = new Travel_Model_FlightMaster();
$FlightBookingInb = [];
$FlightBooking = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['TraceId'], 1);
$FlightBookingInb = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['TraceId'], 2);
//echo '<pre>';print_r($FlightBooking);
//die('s');
$this->view->FlightBooking = $FlightBooking;
$this->view->FlightBookingInb = $FlightBookingInb;
$this->view->baseUrl = $this->baseUrl;
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->CurrencyTitle = $this->CurrencyTitle;
// echo '<pre>';print_r($param);
// echo '<pre>';print_r($BookingData);
// die;
}
}
public function viewDetailsPendingAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$this->view->traceId = $param['traceId'];
$objFlight = new Travel_Model_FlightMaster();
$BookingData = $objFlight->FlightBookingData('tbl_flight_booking', $param['TraceId'], $param['journeyType']);
$this->view->BookingData = $BookingData;
}
}
public function cancelTicketAction()
{
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$objFlight = new Travel_Model_FlightMaster();
$FlightBookingInb = [];
$FlightBooking = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 1);
$FlightBookingInb = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 2);
if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
$sectorsSelectors = $param['sectorsSelectors'];
$PaxDetails = $param['PaxDetails'];
$requestType = $param['requestType'];
$cRemarks = $param['cRemarks'];
$traceId = $param['traceId'];
$bookingId = $param['bookingId'];
$sectorsDates = $param['sectorsDates'];
$trips = [];
if ($sectorsSelectors) {
foreach ($sectorsSelectors as $key => $sec) {
$sectorEX = explode('-', $sec);
$dateEX = $sectorsDates[$key];
$paxArray = [];
if ($PaxDetails) {
foreach ($PaxDetails as $pax) {
$PaxDetailsEX = explode('-', $pax);
$paxArray[] = array(
'fn' => $PaxDetailsEX[0],
'ln' => $PaxDetailsEX[1]
);
}
}
$trips[] = array(
'src' => $sectorEX[0],
'dest' => $sectorEX[1],
'departureDate' => $dateEX,
'travellers' => $paxArray,
);
}
}
$data = array(
"bookingId" => $bookingId,
"type" => $requestType,
"remarks" => $cRemarks,
"trips" => $trips,
);
//echo '<pre>';print_r($data);die;
$AmendmentRequestData = new Zend_Session_Namespace('AmendmentRequestData');
$AmendmentRequestData->params = $data;
//$cancellationResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CancellationChargesRequest($data);
$ChangeResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetAmendmentCharges($data);
//$ChangeResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetSubmitAmendment($data);
//$AmendmentChargesSession = new Zend_Session_Namespace('AmendmentChargesSession');
//$ChangeResponse = $AmendmentChargesSession->params;
$intChangeRequestStatus = $ChangeResponse['status']['success'];
$trips = isset($ChangeResponse['trips']) ? $ChangeResponse['trips'] : '';
//echo '<pre>';print_r($ChangeResponse);
if ($intChangeRequestStatus == 1) {
$update = array(
"ChangeRequestRes" => json_encode($ChangeResponse),
"ChangeRequestStatus" => $intChangeRequestStatus,
"status" => ($requestType == 1) ? 6 : 7,
);
//$where = "BookingId = " . $bookingId;
$this->objMdl->rv_update('tbl_flight_booking', $update, ['BookingId=?' => $bookingId]);
//echo '<pre>';print_r($update);die;
//$updated = $objFlight->UpdateFlightData('tbl_flight_booking', $update, $where);
} else {
// $data = array(
// "status" => ($requestType == 1) ? 6 : 7,
// );
// $this->objMdl->rv_update('tbl_flight_booking', $data, ['BookingId=?' => $bookingId]);
//$where = "BookingId = " . $bookingId;
// $where = "BookingId = " . $bookingId; //exit;
//$updated = $objFlight->UpdateFlightData('tbl_flight_booking', $data, $where);
}
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('FlightBooking' => $FlightBooking, 'FlightBookingInb' => $FlightBookingInb, 'ChangeResponse' => $ChangeResponse, 'baseUrl' => $this->baseUrl, 'CurrencyTitle' => $this->CurrencyTitle, 'CurrencyRate' => $this->CurrencyRate));
$bodyText = $html->render('getcancelcharge.phtml');
$response = array('success' => true, 'msg' => 'Done', 'html' => $bodyText);
echo json_encode($response);
exit;
}
$this->view->FlightBooking = $FlightBooking;
$this->view->FlightBookingInb = $FlightBookingInb;
$this->view->baseUrl = $this->baseUrl;
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->CurrencyTitle = $this->CurrencyTitle;
$this->view->bookingId = $param['bookingId'];
// echo '<pre>';print_r($BookingData);die;
}
public function submitAmendmentAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$AmendmentRequestData = new Zend_Session_Namespace('AmendmentRequestData');
$data = $AmendmentRequestData->params;
$bookingId = $param['bookingId'];
$requestType = $param['requestType'];
$PaxDetails = $param['PaxDetails'];
// echo '<pre>';
// print_r($param);
// die;
$ChangeResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetSubmitAmendment($data);
//$SubmitAmendment = new Zend_Session_Namespace('SubmitAmendment');
//$ChangeResponse = $SubmitAmendment->params;
$intChangeRequestStatus = $ChangeResponse['status']['success'];
$strErrorMessage = $ChangeResponse['status']['httpStatus'];
if ($intChangeRequestStatus == 1) {
$update = array(
"ChangeRequestId" => ($ChangeResponse['amendmentId']),
);
$this->objMdl->rv_update('tbl_flight_booking', $update, ['BookingId=?' => $bookingId]);
if ($PaxDetails) {
foreach ($PaxDetails as $pax) {
$PaxDetailsEX = explode('-', $pax);
$whereArray = array(
'FirstName=?' => $PaxDetailsEX[0],
'LastName=?' => $PaxDetailsEX[1],
'BookingId=?' => $bookingId
);
$updatePax = array(
"ChangeRequestId" => $ChangeResponse['amendmentId'],
"ChangeRequestStatus" => ($requestType == 1) ? 6 : 7,
);
$this->objMdl->rv_update('tbl_flight_booking_customer', $updatePax, $whereArray);
}
}
$strMsg = "success. Your booking cancellation is Inprocess";
$redirect = true;
$response = array('success' => true, 'msg' => $strMsg, 'redirect' => $redirect);
echo json_encode($response);
exit;
} else {
$strMsg = "Oops! Your booking Can'nt be cancel right now please try again latter, Please contact administrator for more details";
$redirect = false;
$response = array('success' => true, 'msg' => $strErrorMessage, 'redirect' => $redirect);
echo json_encode($response);
exit;
}
}
}
public function amendmentDetailsAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$this->view->traceId = $param['amendmentId'];
$getMarkup = $this->getMarkup('IN');
$data = array(
"amendmentId" => $param['amendmentId'],
);
$ChangeResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetAmendmentDetails($data);
$this->view->ChangeResponse = $ChangeResponse;
$intMarkUp = 0;
if($getMarkup['status'] == 1){
if($getMarkup['arrAgencyMarkupsCancellation']){
foreach($getMarkup['arrAgencyMarkupsCancellation'] as $value){
if($value['SupplierType']==2 && $value['ServiceType']==1 && $value['MPType']==1 && $value['MPType']==1){
$intGTXMarkUpType = $value['MarkUpType'];
$MarkUp = $value['MarkUp'];
$intGTXMarkUpType = $value['MarkUpType'];
if ($intGTXMarkUpType == 1) { // For Flat
$intMarkUp += $MarkUp;
} else { // For Percentage
$intMarkUp += $MarkUp;//($intOfferedFare * $MarkUp) / 100;
}
}
}
}
}
$this->view->amendmentId = $param['amendmentId'];
$this->view->CancelMarkUp = $intMarkUp;
// $html = new Zend_View();
// $html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
// $html->assign(array('ChangeResponse' => $ChangeResponse));
// $bodyText = $html->render('amendment-details.phtml');
// $response = array('success' => true, 'message' => 'success', 'html' => $bodyText);
// echo json_encode($response);
// exit;
// echo '<pre>';
// print_r($ChangeResponse);
// echo '<pre>';
// print_r($getMarkup['arrAgencyMarkupsCancellation']);
// echo '</pre>';
// die;
}else{
die();
}
}
public function updateRefundAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$refundedamount = base64_decode(base64_decode($param['refundedamount']));
$amendmentId = $param['amendmentId'];
$data = array(
"status" => $param['Status'],
"RefundMode" => $param['RefundMode'],
"refundremarks" => $param['refundremarks'],
"refundedamount" => $refundedamount,
);
$whereArray = array(
'ChangeRequestId=?' => $amendmentId,
);
$rv_update = $this->objMdl->rv_update('tbl_flight_booking', $data, $whereArray);
if($rv_update){
$response = array('success' => true, 'msg' => 'Refund Update Successfully');
echo json_encode($response);
exit;
}else{
$response = array('success' => false, 'msg' => 'Unable to update. try again.');
echo json_encode($response);
exit;
}
}else{
die();
}
}
public function getAirlineIdsAndCodeList()
{
$url = $this->baseUrl . "public/data/dynamic/AirlineIdsAndCodeList.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$str = curl_exec($ch);
// $str = file_get_contents($this->baseUrl.'public/data/dynamic/AirlineIdsAndCodeList.json');
$response = json_decode($str, true);
return $response;
}
public function getCurrencyIdsAndSymbolList()
{
$url = $this->baseUrl . "public/data/dynamic/currency.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$str = curl_exec($ch);
// $str = file_get_contents($this->baseUrl.'public/data/dynamic/currency.json');
$response = json_decode($str, true);
return $response;
}
public function getCityIdsAndAirPortCodeList()
{
$url = $this->baseUrl . "public/data/dynamic/AirPortCodeList.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$str = curl_exec($ch);
// $str = file_get_contents($this->baseUrl.'public/data/dynamic/AirPortCodeList.json');
$response = json_decode($str, true);
return $response;
}
public function customerloginAction()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
if ($this->getRequest()->isPost()) {
$data = $request->getPost();
$this->_session->session = $data;
$this->_redirect('users/index/myprofile');
}
}
public function logoutAction()
{
$storage = new Zend_Session_Namespace('User');
$storage->unsetAll();
$this->_redirect('index');
}
/*
* writeSessionPopup is used to show the request a callback popup window after interval on landing page
*/
public function writeSessionPopupAction()
{
$myNamespace = new Zend_Session_Namespace('MypopSess');
$myNamespace->setPopup = true;
$myNamespace->session_time = time();
exit;
}
public function viewmoreAction()
{
$post = json_decode(file_get_contents('php://input'), true);
if ($post['item']) {
$PriceID = $post['PriceID'];
$FairRules = [];
if ($post['item']['FairRules']) {
foreach ($post['item']['FairRules'] as $price) {
if ($price['PriceID'] == $PriceID) {
$FairRules = $price;
}
}
}
$post['item']['FairRules'] = $FairRules;
$ArrayData[0] = $post['item'];
//echo '<pre>';print_r($ArrayData);
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->CurrencyTitle = $this->CurrencyTitle;
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('Data' => $ArrayData, 'DataInbound' => [], 'CurrencyRate' => $this->CurrencyRate, 'CurrencyTitle' => $this->CurrencyTitle));
$bodyText = $html->render('viewmore.phtml');
$response = array('success' => true, 'message' => 'success', 'html' => $bodyText);
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'failed', 'html' => '');
echo json_encode($response);
exit;
}
}
}