| 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/maxurtrip/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 $siteName;
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;
private $respHashKey;
private $aesResponseKey;
private $aesResponseIv;
private $SMSURL;
private $SMSMETHOD;
private $SMSAPIKEY;
private $SMSSENDER;
private $SMSFORMAT;
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->respHashKey = Catabatic_Helper::getRespHashKey();
$this->aesResponseKey = Catabatic_Helper::getAesResponseKey();
$this->aesResponseIv = Catabatic_Helper::getAesResponseIv();
$this->SMSURL = Catabatic_Helper::getSMSURL();
$this->SMSMETHOD = Catabatic_Helper::getSMSMETHOD();
$this->SMSAPIKEY = Catabatic_Helper::getSMSAPIKEY();
$this->SMSSENDER = Catabatic_Helper::getSMSSENDER();
$this->SMSFORMAT = Catabatic_Helper::getSMSFORMAT();
$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;
//$_SERVER["DOCUMENT_ROOT"] = $_SERVER["DOCUMENT_ROOT"] . '/holidaybazaar';
}
public function indexAction()
{
//die('test');
//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']);
foreach ($DomesPopularCity as $key => $value) {
if (trim($value['AboutImage']) != '') {
$flightImage1 = explode(',', $value['AboutImage']);
if ($flightImage1[0] != '') {
$flightImage = $this->baseUrl . 'public/upload/aboutyit/' . $value['AboutId'] . '/{size}/' . $flightImage1[0];
} else if ($flightImage1[1] != '') {
$flightImage = $this->baseUrl . 'public/upload/aboutyit/' . $value['AboutId'] . '/{size}/' . $flightImage1[1];
}
} else {
$flightImage = $Flight['package']['ImgThumbnail'];
}
$DomesPopularCity1[] = [
'AboutId' => $value['AboutId'],
'AboutImage' => $flightImage,
'price' => $value['price'],
'Fromcity' => $value['Fromcity'],
'Tocity' => $value['Tocity'],
'source' => $value['source'],
'destination' => $value['destination'],
'source_city' => $value['source_city'],
'destination_city' => $value['destination_city'],
'ContSysId1' => $value['ContSysId1'],
'ContSysId2' => $value['ContSysId2'],
'popularCityType' => $value['popularCityType'],
'AboutDescription' => $value['AboutDescription'],
'url' => $value['url'],
'opt' => $value['opt'],
'status' => $value['status'],
'isMarkForDel' => $value['isMarkForDel'],
];
}
foreach ($InterPopularCity as $key => $value) {
if (trim($value['AboutImage']) != '') {
$flightImage1 = explode(',', $value['AboutImage']);
if ($flightImage1[0] != '') {
$flightImage = $this->baseUrl . 'public/upload/aboutyit/' . $value['AboutId'] . '/{size}/' . $flightImage1[0];
} else if ($flightImage1[1] != '') {
$flightImage = $this->baseUrl . 'public/upload/aboutyit/' . $value['AboutId'] . '/{size}/' . $flightImage1[1];
}
} else {
$flightImage = $Flight['package']['ImgThumbnail'];
}
$InterPopularCity1[] = [
'AboutId' => $value['AboutId'],
'AboutImage' => $flightImage,
'price' => $value['price'],
'Fromcity' => $value['Fromcity'],
'Tocity' => $value['Tocity'],
'source' => $value['source'],
'destination' => $value['destination'],
'source_city' => $value['source_city'],
'destination_city' => $value['destination_city'],
'ContSysId1' => $value['ContSysId1'],
'ContSysId2' => $value['ContSysId2'],
'popularCityType' => $value['popularCityType'],
'AboutDescription' => $value['AboutDescription'],
'url' => $value['url'],
'opt' => $value['opt'],
'status' => $value['status'],
'isMarkForDel' => $value['isMarkForDel'],
];
}
$this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
$this->view->recentSearch = $recentSearch->params;
$this->view->existingOffer = $existingOffer;
$this->view->DomesPopularCity1 = $DomesPopularCity1;
$this->view->InterPopularCity1 = $InterPopularCity1;
$this->view->DomesPopularCity = $DomesPopularCity;
$this->view->InterPopularCity = $InterPopularCity;
//$apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetAgencyCurrency($this->gtxagencysysid);
//echo '<pre>';print_r($apiResponse);die;
$getPageDetail = $this->objMdl->rv_select_row('tbl_static_pages', ['*'], ['sid' => 195], ['sid' => 'desc']);
// echo"<pre>";print_r($getPageDetail);die;
$this->view->getPageDetail = $getPageDetail;
$destinatonTopdomest = $this->objMdl->rv_select_all($this->tablenameDestination, ['DesSysId', 'Title', 'Activities', 'Hotels', 'Tours', 'Image', 'DestDescription'], ['IsActive' => 1, 'IsFeatured' => 1, 'IsMarkForDel' => 0, 'countryIds' => 101], ['rand()' => ''], 8);
$destinatonTopArr = array();
foreach ($destinatonTopdomest as $topdesKey => $topdesValue) {
$desTitleValue = $topdesValue['Title'];
$whereCustom = ($desTitleValue) ? " ( Destinations LIKE '%{$desTitleValue}%' )" : "";
$tourResult = $this->objMdl->rv_select_row_where_custom($this->tablename, ['count(*) as totalCount'], ['IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1, 'ItemType' => 1], $whereCustom, [], '');
$destinatonTopArr[] = [
'DesSysId' => $topdesValue['DesSysId'],
'Title' => $topdesValue['Title'],
'Activities' => $topdesValue['Activities'],
'Hotels' => $topdesValue['Hotels'],
'Tours' => $topdesValue['Tours'],
'Image' => $topdesValue['Image'],
'DestDescription' => $topdesValue['DestDescription'],
'totalCount' => $tourResult['totalCount'],
];
}
$destinatonTopinetr = $this->objMdl->rv_select_all($this->tablenameDestination, ['DesSysId', 'Title', 'Activities', 'Hotels', 'Tours', 'Image', 'DestDescription'], ['IsActive' => 1, 'IsFeatured' => 1, 'IsMarkForDel' => 0, 'countryIds!' => 101], ['rand()' => ''], 8);
$destinatonTopArrInter = array();
foreach ($destinatonTopinetr as $topdesKeyint => $topdesValueint) {
$desTitleValue = $topdesValueint['Title'];
$whereCustom = ($desTitleValue) ? " ( Destinations LIKE '%{$desTitleValue}%' )" : "";
$tourResult = $this->objMdl->rv_select_row_where_custom($this->tablename, ['count(*) as totalCount'], ['IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1, 'ItemType' => 1], $whereCustom, [], '');
$destinatonTopArrInter[] = [
'DesSysId' => $topdesValueint['DesSysId'],
'Title' => $topdesValueint['Title'],
'Activities' => $topdesValue['Activities'],
'Hotels' => $topdesValueint['Hotels'],
'Tours' => $topdesValueint['Tours'],
'Image' => $topdesValueint['Image'],
'DestDescription' => $topdesValueint['DestDescription'],
'totalCount' => $tourResult['totalCount'],
];
}
$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->destinationsInt = $destinatonTopArrInter;
$this->view->destinations = $destinatonTopArr;
$this->view->toursFinal = $toursFinal;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}
public function flightsearchdataAction()
{
$getData = $this->getRequest()->getParams();
//echo"<pre>";print_r($getData);exit;
$uri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
$uriExp = explode('?', $uri);
//echo"<pre>";print_r($uriExp);exit;
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)
{
//die($this->gtxagentsysid);
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);
//echo"<pre>";print_r($result);die;
$response = json_decode($result, true);
return $response;
} else {
$data = array('status' => false, 'message' => 'Invalid country code');
return ($data);
}
}
public function array_searcher($AdditionalMarkup, $array)
{
$faretypeArr = $AdditionalMarkup['faretypeArr'];
$keys = [];
foreach ($array as $key => $value) {
$showhide_b2c = isset($AdditionalMarkup['finalArr'][$value['fareIdentifier']]['showhide_b2c']) ? $AdditionalMarkup['finalArr'][$value['fareIdentifier']]['showhide_b2c'] : 0;
$faretype = isset($AdditionalMarkup['finalArr'][$value['fareIdentifier']]['faretype']) ? $AdditionalMarkup['finalArr'][$value['fareIdentifier']]['faretype'] : '';
if (in_array($value['fareIdentifier'], $faretypeArr)) {
if ($showhide_b2c == 1) {
$keys[] = $value;
} else {
$keys[] = [];
}
} elseif ($value['fareIdentifier'] != $faretype) {
$keys[] = $value;
}
}
return $keys;
}
public function FlightDataMultiCity($apiResponse, $sessionFlightSearchParams, $getMarkup, $AdditionalMarkup)
{
$arrAirlineList = $this->getAirlineIdsAndCodeList();
$intSourceCityId = ($sessionFlightSearchParams['sourceCityId']);
$intDestinationCityId = ($sessionFlightSearchParams['destinationCityId']);
$interNationalSearch = trim($sessionFlightSearchParams['interNationalSearch']);
$strFlightRoute = trim($sessionFlightSearchParams['route']);
$adultCount = $sessionFlightSearchParams['adults'];
$childCount = $sessionFlightSearchParams['child'];
$infantCount = $sessionFlightSearchParams['infant'];
$intMemberCount = $adultCount + $childCount + $infantCount;
$strFlightRoute = trim($sessionFlightSearchParams['route']);
$strDepatureDate = $sessionFlightSearchParams['departure_dates'];
$strReturnDate = $sessionFlightSearchParams['return_dates'];
$intCountryCode = $sessionFlightSearchParams['intCountryCode'];
//echo"<pre>";print_r($intSourceCityId);
//echo"<pre>";print_r($sessionFlightSearchParams);
//die;
if (!empty(trim($interNationalSearch)) && trim($interNationalSearch) == 1) {
$this->FlightDataMultiCityInterNational($apiResponse, $sessionFlightSearchParams, $getMarkup, $AdditionalMarkup);
}
$intJourneyType = 1;
$intTripType = 1;
$arrInsertFlightData = [];
$arrAirlineName = [];
$FiltStopCount = [];
$FiltPriceRange = [];
$AttPriceRange = [];
$dddddddd = [];
$intResponseStatus = $apiResponse['ResponseStatus'];
$ONWARD = $apiResponse['OutBoundFlightResults'];
if ($intResponseStatus == 1) {
if ($ONWARD) {
foreach ($ONWARD as $keys => $tripInfos) {
foreach ($tripInfos as $key => $result) {
//echo"<pre>";print_r($result);die;
$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 = isset($totalPriceList['fd']['ADULT']['mI']) ? $totalPriceList['fd']['ADULT']['mI'] : false;
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Check In Baggage
$cabinbagInfo = $totalPriceList['fd']['ADULT']['bI']['cB']; ///Cabin Baggage
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if (!empty($cabinbagInfo)) {
$IscabinbagIncludes = true;
} else {
$IscabinbagIncludes = 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;
$PublishedFareReverse = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
$intYQTaxToT = 0;
$intTotalOfferedForAllPax = 0;
$intBaseFareAllPax = 0;
$intTaxAllPax = 0;
$array_searcher = $this->array_searcher($AdditionalMarkup, $result['totalPriceList']);
array_multisort($array_searcher);
if ($array_searcher) {
foreach ($array_searcher as $kp => $price) {
$fareDetail = $price['fd'];
//echo '<pre>';print_r(($fareDetail));echo '</pre>';
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
$AddMarkup = isset($AdditionalMarkup['finalArr'][$fareIdentifier]) ? $AdditionalMarkup['finalArr'][$fareIdentifier] : [];
$IsMealIncludes = $fareDetail['ADULT']['mI'];
$strBaggage = $price['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $price['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($fareIdentifier == 'TACTICAL' || $fareIdentifier == 'COUPON') {
$fareIdentifier = 'PROMO';
}
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
if (!empty($ADULT)) {
$PaxTypeCount = 1;
}
if (!empty($CHILD)) {
$PaxTypeCount = 2;
}
if (!empty($INFANT)) {
$PaxTypeCount = 3;
}
$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
$ADULTNCMTOT = isset($fareDetail['ADULT']['afC']['NCM']['OT']) ? $fareDetail['ADULT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$CHILDNCMTOT = isset($fareDetail['CHILD']['afC']['NCM']['OT']) ? $fareDetail['CHILD']['afC']['NCM']['OT'] : 0; //- Gross Commission
$INFANTNCMTOT = isset($fareDetail['INFANT']['afC']['NCM']['OT']) ? $fareDetail['INFANT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$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));
//$NetCommission = (($ADULTNCMTOT * $adultCount) + ($CHILDNCMTOT * $childCount) + ($INFANTNCMTOT * $infantCount));
//$PublishedFareIN = $NetFare;
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $NetFare,
'intCommissionEarned' => $CommissionEarned,
'TdsOnPLB' => $TdsOnPLB,
'MUFee' => $MUFee,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
//echo '<pre>';print_r(($markUpArr));echo '</pre>';
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArr);
if ($kp == 0) {
$PublishedFareReverse += ($arrMarkUps['PublishFare']);
}
//echo '<pre>';print_r(($arrMarkUps));echo '</pre>';
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($ADULT['TF'] * $adultCount),
'OfferedFare' => ($ADULT['NF'] * $adultCount),
'intCommissionEarned' => ($ADULT['NCM'] * $adultCount),
'TdsOnPLB' => ($ADULTNCMTDS * $adultCount),
'MUFee' => ($AD_MU * $adultCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $adultCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[0]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[0]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[0]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[0]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[0]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[0]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[0]['GSTonComm'] = 0;
$FareBreakdown[0]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[0]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($CHILD['TF'] * $childCount),
'OfferedFare' => ($CHILD['NF'] * $childCount),
'intCommissionEarned' => ($CHILD['NCM'] * $childCount),
'TdsOnPLB' => ($CHILDNCMTDS * $childCount),
'MUFee' => ($CH_MU * $childCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $childCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$FareBreakdown[1]['BaseFare'] = ($CHILD['BF'] * $childCount);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[1]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[1]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[1]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[1]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[1]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[1]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[1]['GSTonComm'] = 0;
$FareBreakdown[1]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[1]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($INFANT['TF'] * $infantCount),
'OfferedFare' => ($INFANT['NF'] * $infantCount),
'intCommissionEarned' => ($INFANT['NCM'] * $infantCount),
'TdsOnPLB' => ($INFANTNCMTDS * $infantCount),
'MUFee' => ($IN_MU * $infantCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $infantCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[2]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[2]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[2]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[2]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[2]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[2]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[2]['GSTonComm'] = 0;
$FareBreakdown[2]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[2]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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" => ceil($arrMarkUps['PublishFare'] * $this->CurrencyRate),
"OfferedFare" => $arrMarkUps['intOfferedFare'],
"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" => ucfirst(strtolower($fareDetail['ADULT']['cc'])),
"intTotalGST" => $arrMarkUps['intTotalGST'],
"apiMarkup" => $arrMarkUps['apiMarkup'],
"IntCommission" => $arrMarkUps['IntCommission'],
"apiTaxOnMarkup" => $arrMarkUps['apiTaxOnMarkup'],
"NoOfSeatAvailable" => $fareDetail['ADULT']['sR'],
"FixedMarkUp" => $arrMarkUps['IntAgencyFixMarkUp'],
"GSTOnMarkUp" => $arrMarkUps['IntTaxOnAgencyFixMarkUp'],
"CommEarned" => $arrMarkUps['intCommisionEarnedForAgency'],
"GSTonComm" => 0,
"intGTXMarkUp" => $arrMarkUps['intGTXMarkUp'],
"GTXMarkUpGST" => $arrMarkUps['intSTaxOnGTXMarkUp'],
"AddiMarkup" => $arrMarkUps['AddiMarkup'],
"AddiTaxOnMarkup" => $arrMarkUps['AddiTaxOnMarkup'],
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsMealIncludes" => $IsMealIncludes,
"FareBreakdown" => $FareBreakdown,
"arrMarkUps" => $arrMarkUps,
);
}
}
// echo '<pre>';print_r($FairRulesArr);
$TotalLAYOVERMinutes = 0;
$SegFlightNumberArr = [];
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)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
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,
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsMealIncludes" => $IsMealIncludes,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"filePath" => $filePath,
);
$SegFlightNumberArr[] = $SegFlightNumber;
//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';
if ($FairRulesArr) {
$arrInsertFlightData[$keys][$key]['FlightNumber'] = $strFlightNumber;
$arrInsertFlightData[$keys][$key]['SegFlightNumberArr'] = implode(', ', $SegFlightNumberArr);
$arrInsertFlightData[$keys][$key]['AirlineName'] = $strAirlineName;
$arrInsertFlightData[$keys][$key]['AirlineCode'] = $AirlineCode;
$arrInsertFlightData[$keys][$key]['AirInvenSysId'] = 0;
$arrInsertFlightData[$keys][$key]['IsLCC'] = $IsLCC;
$arrInsertFlightData[$keys][$key]['IsMealIncludes'] = $IsMealIncludes;
$arrInsertFlightData[$keys][$key]['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$keys][$key]['IsCabinBagIncludes'] = $IscabinbagIncludes;
$arrInsertFlightData[$keys][$key]['IsRefundable'] = $IsRefundable;
$arrInsertFlightData[$keys][$key]['IsRefundableTxt'] = $IsRefundableTxt;
$arrInsertFlightData[$keys][$key]['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$keys][$key]['AirlineSysId'] = $airlineSysId;
$arrInsertFlightData[$keys][$key]['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$keys][$key]['ArrivalTime'] = $strArrivalDtTime;
$arrInsertFlightData[$keys][$key]['TravelDate'] = $OriginSegments['dt'];
$arrInsertFlightData[$keys][$key]['LocalFromTime'] = str_replace('T', ' ', $OriginSegments['dt']);
$arrInsertFlightData[$keys][$key]['FromUTCTime'] = $OriginSegments['dt'];
$arrInsertFlightData[$keys][$key]['LocalToTime'] = str_replace('T', ' ', $DestinationSegments['at']);
$arrInsertFlightData[$keys][$key]['ToUTCTime'] = $DestinationSegments['at'];
$arrInsertFlightData[$keys][$key]['IsDirect'] = 0;
$arrInsertFlightData[$keys][$key]['FareClass'] = $strFareClass;
$arrInsertFlightData[$keys][$key]['LAYOVERCity'] = isset($LAYOVERCityArr[0]) ? $LAYOVERCityArr[0] : '';
$arrInsertFlightData[$keys][$key]['GroundTime'] = $TotalLAYOVERMinutes;
$arrInsertFlightData[$keys][$key]['LAYOVERDuration'] = $LAYOVERTime;
$arrInsertFlightData[$keys][$key]['FlyingMinutes'] = $FlyingMinutes;
$arrInsertFlightData[$keys][$key]['DepartureDateTxt'] = date('D, d M', strtotime($OriginSegments['dt']));
$arrInsertFlightData[$keys][$key]['ArrivalDateTxt'] = date('D, d M', strtotime($DestinationSegments['at']));
$arrInsertFlightData[$keys][$key]['FlightDuration'] = $FlightDuration;
$arrInsertFlightData[$keys][$key]['SourcePlaceSysId'] = $intSourceCityId[$keys];
$arrInsertFlightData[$keys][$key]['DestPlaceSysId'] = $intDestinationCityId[$keys];
$arrInsertFlightData[$keys][$key]['SourceAirportCode'] = $strSourceAirportCode;
$arrInsertFlightData[$keys][$key]['DestAirportCode'] = $strDestinationAirportCode;
$arrInsertFlightData[$keys][$key]['StopCount'] = $StopCountTxt;
$arrInsertFlightData[$keys][$key]['Stops'] = $Stops;
$arrInsertFlightData[$keys][$key]['NoOfSeatAvailable'] = $NoOfSeatAvailable;
$arrInsertFlightData[$keys][$key]['TotalFlightMembers'] = $intMemberCount;
$arrInsertFlightData[$keys][$key]['CurrencyType'] = $this->CurrencyId;
$arrInsertFlightData[$keys][$key]['PublishedFare'] = ($PublishedFareReverse * $this->CurrencyRate); // As Discussed with GG
$arrInsertFlightData[$keys][$key]['PublishedFareTxt'] = number_format(($PublishedFareReverse * $this->CurrencyRate)); // As Discussed with GG
$arrInsertFlightData[$keys][$key]['ApiResultIndex'] = $ResultIndex;
$arrInsertFlightData[$keys][$key]['JourneyType'] = $intJourneyType;
$arrInsertFlightData[$keys][$key]['TripType'] = $intTripType;
$arrInsertFlightData[$keys][$key]['IsInternational'] = $interNationalSearch;
$arrInsertFlightData[$keys][$key]['logo'] = $filePath;
$arrInsertFlightData[$keys][$key]['FairRules'] = $FairRulesArr;
$arrInsertFlightData[$keys][$key]['Segments'] = $arrSegments;
$arrAirlineName[$keys][] = $strAirlineName;
$AttPriceRange[$keys][] = $PublishedFareReverse;
$FiltStopCount[$keys][] = $StopCountTxt;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_5000), ($PublishedFare * $this->CurrencyRate));
$FilterDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strDepartureDtTime);
$FilterArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strArrivalDtTime);
//$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_AED), ($PublishedFare * $this->CurrencyRate));
//$arrInsertFlightData[$key]['FilterPrice'] = $FilterPrice;
if ($FilterPrice) {
$arrInsertFlightData[$keys][$key]['FilterPrice'] = $FilterPrice;
}
$arrInsertFlightData[$keys][$key]['FilterDepartureDtTime'] = $FilterDepartureDtTime;
$arrInsertFlightData[$keys][$key]['FilterArrivalDtTime'] = $FilterArrivalDtTime;
}
}
}
}
$arrAirlineName__ = [];
if ($arrAirlineName) {
foreach ($arrAirlineName as $key => $value) {
$arrAirlineName__[] = array_values(array_unique($value));
}
}
$FiltStopCount__ = [];
if ($FiltStopCount) {
foreach ($FiltStopCount as $key => $value) {
$FiltStopCount__[] = array_values(array_unique($value));
}
}
$AttPriceRange__ = [];
if ($AttPriceRange) {
foreach ($AttPriceRange as $key => $value) {
$MinriceRange = (min(array_values(array_unique($value))));
$MaxriceRange = (max(array_values(array_unique($value))));
$AttPriceRange__[] = ['MinriceRange' => floor($MinriceRange), 'MaxriceRange' => floor($MaxriceRange)];
}
}
$MinriceRange = (min($AttPriceRange));
$MaxriceRange = (max($AttPriceRange));
$MultiHead = [];
if ($sessionFlightSearchParams['source']) {
foreach ($sessionFlightSearchParams['source'] as $sk => $source_) {
$destination_ = isset($sessionFlightSearchParams['destination'][$sk]) ? explode(',', $sessionFlightSearchParams['destination'][$sk]) : '';
$source_ = isset($source_) ? explode(',', $source_) : '';
$departure_date_ = isset($sessionFlightSearchParams['departure_date'][$sk]) ? $sessionFlightSearchParams['departure_date'][$sk] : '';
$MultiHead[] = array(
'source' => $source_[0],
'destination' => $destination_[0],
'departure_date' => $departure_date_,
'dep_date' => date('d M Y', strtotime($departure_date_)),
);
}
}
// echo '<pre>';
// print_r($MultiHead);die('ddd');
sort($FiltStopCount__);
$data = array('outbound' => array_values($arrInsertFlightData), 'MultiHead' => $MultiHead, 'interNationalSearch' => $interNationalSearch, 'route' => $strFlightRoute, 'CurrencyTitle' => $this->CurrencyTitle, 'inbound' => [], 'arrAirlineName' => $arrAirlineName__, 'FiltStopCount' => $FiltStopCount__, 'ArrPriceUnique' => $AttPriceRange__, 'MinriceRange' => round($MinriceRange), 'MaxriceRange' => round($MaxriceRange));
echo json_encode($data);
exit;
} else {
$data = array('outbound' => [], 'inbound' => [], 'MultiHead' => [], 'interNationalSearch' => $interNationalSearch, 'route' => $strFlightRoute, 'CurrencyTitle' => $this->CurrencyTitle, 'arrAirlineName' => [], 'FiltStopCount' => [], 'ArrPriceUnique' => [], 'MinriceRange' => 0, 'MaxriceRange' => 0);
echo json_encode($data);
exit;
}
}
public function FlightDataMultiCityInterNational($apiResponse, $sessionFlightSearchParams, $getMarkup, $AdditionalMarkup)
{
$arrAirlineList = $this->getAirlineIdsAndCodeList();
$intSourceCityId = trim($sessionFlightSearchParams['sourceCityId']);
$intDestinationCityId = trim($sessionFlightSearchParams['destinationCityId']);
$interNationalSearch = trim($sessionFlightSearchParams['interNationalSearch']);
$strFlightRoute = trim($sessionFlightSearchParams['route']);
$adultCount = $sessionFlightSearchParams['adults'];
$childCount = $sessionFlightSearchParams['child'];
$infantCount = $sessionFlightSearchParams['infant'];
$intMemberCount = $adultCount + $childCount + $infantCount;
$strFlightRoute = trim($sessionFlightSearchParams['route']);
$source_city = isset($sessionFlightSearchParams['source_city']) ? $sessionFlightSearchParams['source_city'][0] : '';
$destination_city = isset($sessionFlightSearchParams['destination_city']) ? $sessionFlightSearchParams['destination_city'][0] : '';
$source = isset($sessionFlightSearchParams['source']) ? $sessionFlightSearchParams['source'][0] : '';
$destination = isset($sessionFlightSearchParams['destination']) ? $sessionFlightSearchParams['destination'][0] : '';
$sourceCityText = explode(',', $sessionFlightSearchParams['sourceCityText'][0]);
$destinationCityText = explode(',', $sessionFlightSearchParams['destinationCityText'][0]);
//echo '<pre>';print_r($sessionFlightSearchParams);die('ddd');
$MultiHead = [];
if ($sessionFlightSearchParams['source']) {
foreach ($sessionFlightSearchParams['source'] as $sk => $source_) {
$sourceCityAirportCode = isset($sessionFlightSearchParams['sourceCityAirportCode'][$sk]) ? $sessionFlightSearchParams['sourceCityAirportCode'][$sk] : '';
$destinationCityAirportCode = isset($sessionFlightSearchParams['destinationCityAirportCode'][$sk]) ? $sessionFlightSearchParams['destinationCityAirportCode'][$sk] : '';
$destination_ = isset($sessionFlightSearchParams['destination'][$sk]) ? explode(',', $sessionFlightSearchParams['destination'][$sk]) : '';
$source_ = isset($source_) ? explode(',', $source_) : '';
$departure_date_ = isset($sessionFlightSearchParams['departure_date'][$sk]) ? $sessionFlightSearchParams['departure_date'][$sk] : '';
$MultiHead[] = array(
'source' => $source_[0],
'destination' => $destination_[0],
'soCode' => $sourceCityAirportCode,
'deCode' => $destinationCityAirportCode,
'departure_date' => $departure_date_,
'dep_date' => date('d M Y', strtotime($departure_date_)),
);
}
}
$intJourneyType = 1;
$intTripType = 3;
$arrInsertFlightData = [];
$arrAirlineName = [];
$FiltStopCount = [];
$FiltPriceRange = [];
$AttPriceRange = [];
$dddddddd = [];
$FilterData = [];
$arrAirlineName = [];
$FiltStopCount = [];
$intResponseStatus = $apiResponse['ResponseStatus'];
$ONWARD = $apiResponse['OutBoundFlightResults'];
if ($intResponseStatus == 1) {
if ($ONWARD) {
foreach ($ONWARD as $keys => $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 = $IsMealIncludesTrue = isset($totalPriceList['fd']['ADULT']['mI']) ? $totalPriceList['fd']['ADULT']['mI'] : false;
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Check In Baggage
$cabinbagInfo = $totalPriceList['fd']['ADULT']['bI']['cB']; ///Cabin Baggage
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if (!empty($cabinbagInfo)) {
$IscabinbagIncludes = true;
} else {
$IscabinbagIncludes = false;
}
if ($IsRefundable == 0) {
$IsRefundableTxt = 'Non Refundable';
} elseif ($IsRefundable == 1) {
$IsRefundableTxt = 'Refundable';
} else {
$IsRefundableTxt = 'Partial Refundable';
}
$PublishedFare = 0;
$PublishedFareReverse = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
$intYQTaxToT = 0;
$intTotalOfferedForAllPax = 0;
$intBaseFareAllPax = 0;
$intTaxAllPax = 0;
$array_searcher = $this->array_searcher($AdditionalMarkup, $result['totalPriceList']);
array_multisort($array_searcher);
if ($array_searcher) {
foreach ($array_searcher as $kp => $price) {
$fareDetail = $price['fd'];
//echo '<pre>';print_r(($fareDetail));echo '</pre>';
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
$AddMarkup = isset($AdditionalMarkup['finalArr'][$fareIdentifier]) ? $AdditionalMarkup['finalArr'][$fareIdentifier] : [];
$IsMealIncludes = $fareDetail['ADULT']['mI'];
$strBaggage = $price['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $price['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($fareIdentifier == 'TACTICAL' || $fareIdentifier == 'COUPON') {
$fareIdentifier = 'PROMO';
}
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
if (!empty($ADULT)) {
$PaxTypeCount = 1;
}
if (!empty($CHILD)) {
$PaxTypeCount = 2;
}
if (!empty($INFANT)) {
$PaxTypeCount = 3;
}
$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
$ADULTNCMTOT = isset($fareDetail['ADULT']['afC']['NCM']['OT']) ? $fareDetail['ADULT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$CHILDNCMTOT = isset($fareDetail['CHILD']['afC']['NCM']['OT']) ? $fareDetail['CHILD']['afC']['NCM']['OT'] : 0; //- Gross Commission
$INFANTNCMTOT = isset($fareDetail['INFANT']['afC']['NCM']['OT']) ? $fareDetail['INFANT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$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));
//$NetCommission = (($ADULTNCMTOT * $adultCount) + ($CHILDNCMTOT * $childCount) + ($INFANTNCMTOT * $infantCount));
//$PublishedFareIN = $NetFare;
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $NetFare,
'intCommissionEarned' => $CommissionEarned,
'TdsOnPLB' => $TdsOnPLB,
'MUFee' => $MUFee,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
//echo '<pre>';print_r(($markUpArr));echo '</pre>';
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArr);
if ($kp == 0) {
$PublishedFareReverse += ($arrMarkUps['PublishFare']);
}
//echo '<pre>';print_r(($arrMarkUps));echo '</pre>';
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($ADULT['TF'] * $adultCount),
'OfferedFare' => ($ADULT['NF'] * $adultCount),
'intCommissionEarned' => ($ADULT['NCM'] * $adultCount),
'TdsOnPLB' => ($ADULTNCMTDS * $adultCount),
'MUFee' => ($AD_MU * $adultCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $adultCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[0]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[0]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[0]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[0]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[0]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[0]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[0]['GSTonComm'] = 0;
$FareBreakdown[0]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[0]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($CHILD['TF'] * $childCount),
'OfferedFare' => ($CHILD['NF'] * $childCount),
'intCommissionEarned' => ($CHILD['NCM'] * $childCount),
'TdsOnPLB' => ($CHILDNCMTDS * $childCount),
'MUFee' => ($CH_MU * $childCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $childCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$FareBreakdown[1]['BaseFare'] = ($CHILD['BF'] * $childCount);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[1]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[1]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[1]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[1]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[1]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[1]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[1]['GSTonComm'] = 0;
$FareBreakdown[1]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[1]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($INFANT['TF'] * $infantCount),
'OfferedFare' => ($INFANT['NF'] * $infantCount),
'intCommissionEarned' => ($INFANT['NCM'] * $infantCount),
'TdsOnPLB' => ($INFANTNCMTDS * $infantCount),
'MUFee' => ($IN_MU * $infantCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $infantCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[2]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[2]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[2]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[2]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[2]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[2]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[2]['GSTonComm'] = 0;
$FareBreakdown[2]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[2]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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" => ceil($arrMarkUps['PublishFare'] * $this->CurrencyRate),
"OfferedFare" => $arrMarkUps['intOfferedFare'],
"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" => ucfirst(strtolower($fareDetail['ADULT']['cc'])),
"intTotalGST" => $arrMarkUps['intTotalGST'],
"apiMarkup" => $arrMarkUps['apiMarkup'],
"IntCommission" => $arrMarkUps['IntCommission'],
"apiTaxOnMarkup" => $arrMarkUps['apiTaxOnMarkup'],
"NoOfSeatAvailable" => $fareDetail['ADULT']['sR'],
"FixedMarkUp" => $arrMarkUps['IntAgencyFixMarkUp'],
"GSTOnMarkUp" => $arrMarkUps['IntTaxOnAgencyFixMarkUp'],
"CommEarned" => $arrMarkUps['intCommisionEarnedForAgency'],
"GSTonComm" => 0,
"intGTXMarkUp" => $arrMarkUps['intGTXMarkUp'],
"GTXMarkUpGST" => $arrMarkUps['intSTaxOnGTXMarkUp'],
"AddiMarkup" => $arrMarkUps['AddiMarkup'],
"AddiTaxOnMarkup" => $arrMarkUps['AddiTaxOnMarkup'],
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsMealIncludes" => $IsMealIncludes,
"FareBreakdown" => $FareBreakdown,
"arrMarkUps" => $arrMarkUps,
);
}
}
$ArrivalArr = [];
$departureArr = [];
$arrSegments = [];
if ($SegmentInformation) {
foreach ($SegmentInformation as $k => $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)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
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,
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsMealIncludes" => $IsMealIncludes,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"ConectingTime" => isset($segments['cT']) ? $segments['cT'] : 0,
"SegmentNumber" => isset($segments['sN']) ? $segments['sN'] : false,
"filePath" => $filePath,
);
$Segmentsss = $segments;
$ConectingTime = isset($Segmentsss['cT']) ? $Segmentsss['cT'] : 0;
$SegmentNumber = isset($Segmentsss['sN']) ? $Segmentsss['sN'] : false;
if ($ConectingTime == 0 && $SegmentNumber == 1) {
$ArrivalArr[$k] = array(
'fD' => $Segmentsss['fD'],
'oB' => $Segmentsss['oB'],
'stops' => $Segmentsss['stops'],
'so' => $Segmentsss['so'],
'duration' => $Segmentsss['duration'],
//'da' => $Segmentsss['da'],
'aa' => $Segmentsss['aa'],
//'dt' => $Segmentsss['dt'],
'at' => $Segmentsss['at'],
'iand' => $Segmentsss['iand'],
'cT' => isset($Segmentsss['cT']) ? $Segmentsss['cT'] : 0,
'sN' => $Segmentsss['sN'],
);
} elseif ($ConectingTime == 0 && $SegmentNumber == 2) {
$ArrivalArr[$k] = array(
'fD' => $Segmentsss['fD'],
'oB' => $Segmentsss['oB'],
'stops' => $Segmentsss['stops'],
'so' => $Segmentsss['so'],
'duration' => $Segmentsss['duration'],
//'da' => $Segmentsss['da'],
'aa' => $Segmentsss['aa'],
//'dt' => $Segmentsss['dt'],
'at' => $Segmentsss['at'],
'iand' => $Segmentsss['iand'],
'cT' => isset($Segmentsss['cT']) ? $Segmentsss['cT'] : 0,
'sN' => $Segmentsss['sN'],
);
} elseif ($ConectingTime == 0 && $SegmentNumber == 3) {
$ArrivalArr[$k] = array(
'fD' => $Segmentsss['fD'],
'oB' => $Segmentsss['oB'],
'stops' => $Segmentsss['stops'],
'so' => $Segmentsss['so'],
'duration' => $Segmentsss['duration'],
//'da' => $Segmentsss['da'],
'aa' => $Segmentsss['aa'],
//'dt' => $Segmentsss['dt'],
'at' => $Segmentsss['at'],
'iand' => $Segmentsss['iand'],
'cT' => isset($Segmentsss['cT']) ? $Segmentsss['cT'] : 0,
'sN' => $Segmentsss['sN'],
);
} elseif ($ConectingTime == 0 && $SegmentNumber == 4) {
$ArrivalArr[$k] = array(
'fD' => $Segmentsss['fD'],
'oB' => $Segmentsss['oB'],
'stops' => $Segmentsss['stops'],
'so' => $Segmentsss['so'],
'duration' => $Segmentsss['duration'],
//'da' => $Segmentsss['da'],
'aa' => $Segmentsss['aa'],
//'dt' => $Segmentsss['dt'],
'at' => $Segmentsss['at'],
'iand' => $Segmentsss['iand'],
'cT' => isset($Segmentsss['cT']) ? $Segmentsss['cT'] : 0,
'sN' => $Segmentsss['sN'],
);
} elseif ($ConectingTime == 0 && $SegmentNumber == 0) {
$ArrivalArr[$k] = array(
'fD' => $Segmentsss['fD'],
'oB' => $Segmentsss['oB'],
'stops' => $Segmentsss['stops'],
'so' => $Segmentsss['so'],
'duration' => $Segmentsss['duration'],
//'da' => $Segmentsss['da'],
'aa' => $Segmentsss['aa'],
//'dt' => $Segmentsss['dt'],
'at' => $Segmentsss['at'],
'iand' => $Segmentsss['iand'],
'cT' => isset($Segmentsss['cT']) ? $Segmentsss['cT'] : 0,
'sN' => $Segmentsss['sN'],
);
}
if ($SegmentNumber == 0) { // departure
$departureArr[$k] = array(
'fD' => $Segmentsss['fD'],
'oB' => $Segmentsss['oB'],
'stops' => $Segmentsss['stops'],
'so' => $Segmentsss['so'],
'duration' => $Segmentsss['duration'],
'da' => $Segmentsss['da'],
//'aa' => $Segmentsss['aa'],
'dt' => $Segmentsss['dt'],
//'at' => $Segmentsss['at'],
'iand' => $Segmentsss['iand'],
'cT' => isset($Segmentsss['cT']) ? $Segmentsss['cT'] : 0,
'sN' => $Segmentsss['sN'],
);
}
}
}
$arrv = array_values($ArrivalArr);
$depa = array_values($departureArr);
$FlightData = [];
if ($depa) {
foreach ($depa as $sk => $depval) {
$arrival = isset($arrv[$sk]) ? $arrv[$sk] : '';
// echo '<pre>';
// print_r([$depval,$arrival]);
// echo '</pre>';
$LAYOVERMinutes = $GroundTime = isset($arrival['cT']) ? $depval['cT'] : 0;
$LAYOVERTimeO = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($LAYOVERMinutes);
if ($depval['cT']) {
$TotalDurationOnward = $FlyingMinutesO = ($depval['cT'] + $arrival['cT'] + $depval['duration'] + $arrival['duration']);
} else {
$TotalDurationOnward = $FlyingMinutesO = ($depval['duration']);
}
$FlightDuration = Zend_Controller_Action_HelperBroker::getStaticHelper('Flight')->convertMinutesToHoursFormat($TotalDurationOnward);
$strArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($arrival['at']);
$strDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getTimeFromApiString($depval['dt']);
$Stops = $arrival['sN'];
if ($Stops == 0) {
$OrStopCountTxt = "Non-stop";
} else {
$OrStopCountTxt = $Stops . " Stop(s)";
}
$AirlineCode = $depval['fD']['aI']['code'];
$FlightNumber = $depval['fD']['fN'];
$strAirlineName = $depval['fD']['aI']['name'];
$OrFlightNumber = $AirlineCode . '-' . $FlightNumber;
$IsLCC = $depval['fD']['aI']['isLcc'];
$strSourceAirportCode = $depval['da']['code'];
$strDestinationAirportCode = $arrival['aa']['code'];
$airlineSysId = !empty($arrAirlineList[$AirlineCode]) ? $arrAirlineList[$AirlineCode] : '0';
$filePath = $this->getflightlogo($AirlineCode);
$deFlightNumber = $arrival['fD']['aI']['code'] . '-' . $arrival['fD']['fN'];
if ($depval['cT']) {
$SegFlightNumberArr = [$OrFlightNumber, $deFlightNumber];
} else {
$SegFlightNumberArr = [$OrFlightNumber];
}
$FlightData[$sk]['FlightNumber'] = $FlightNumber;
$FlightData[$sk]['SegFlightNumberArr'] = implode(', ', $SegFlightNumberArr);
$FlightData[$sk]['AirlineName'] = $strAirlineName;
$FlightData[$sk]['AirlineCode'] = $AirlineCode;
$FlightData[$sk]['OrFlightNumber'] = $OrFlightNumber;
$FlightData[$sk]['AirInvenSysId'] = 0;
$FlightData[$sk]['IsLCC'] = $IsLCC;
$FlightData[$sk]['IsMealIncludes'] = $IsMealIncludes;
$FlightData[$sk]['IsBagIncludes'] = $IsBagIncludes;
$FlightData[$sk]['IsRefundable'] = $IsRefundable;
$FlightData[$sk]['IsRefundableTxt'] = $IsRefundableTxt;
//$FlightData[$sk]['SearchTraceId'] = $FlightTraceId;
$FlightData[$sk]['apiTraceId'] = $strTraceId;
$FlightData[$sk]['AirlineSysId'] = $airlineSysId;
$FlightData[$sk]['DepartureTime'] = $strDepartureDtTime;
$FlightData[$sk]['ArrivalTime'] = $strArrivalDtTime;
$FlightData[$sk]['TravelDate'] = $depval['dt'];
$FlightData[$sk]['LocalFromTime'] = str_replace('T', ' ', $depval['dt']);
$FlightData[$sk]['FromUTCTime'] = $depval['dt'];
$FlightData[$sk]['LocalToTime'] = str_replace('T', ' ', $arrival['at']);
$FlightData[$sk]['ToUTCTime'] = $arrival['at'];
$FlightData[$sk]['IsDirect'] = 0;
$FlightData[$sk]['FareClass'] = $strFareClass;
$FlightData[$sk]['LAYOVERCity'] = isset($LAYOVERCityArrO[0]) ? $LAYOVERCityArrO[0] : '';
$FlightData[$sk]['GroundTime'] = $LAYOVERMinutes;
$FlightData[$sk]['LAYOVERDuration'] = $LAYOVERTimeO;
$FlightData[$sk]['FlyingMinutes'] = $FlyingMinutesO;
$FlightData[$sk]['DepartureDateTxt'] = date('D, d M', strtotime($depval['dt']));
$FlightData[$sk]['ArrivalDateTxt'] = date('D, d M', strtotime($arrival['at']));
$FlightData[$sk]['FlightDuration'] = $FlightDuration;
$FlightData[$sk]['SourcePlaceSysId'] = $intSourceCityId;
$FlightData[$sk]['DestPlaceSysId'] = $intDestinationCityId;
$FlightData[$sk]['SourceAirportCode'] = $strSourceAirportCode;
$FlightData[$sk]['DestAirportCode'] = $strDestinationAirportCode;
$FlightData[$sk]['SourcePlaceName'] = $sourceCityText[0];
$FlightData[$sk]['DestPlaceName'] = $destinationCityText[0];
$FlightData[$sk]['StopCount'] = $OrStopCountTxt;
$FlightData[$sk]['Stops'] = $Stops;
$FlightData[$sk]['NoOfSeatAvailable'] = $NoOfSeatAvailable;
$FlightData[$sk]['TotalFlightMembers'] = $intMemberCount;
$FlightData[$sk]['CurrencyType'] = 1;
$FlightData[$sk]['JourneyType'] = 1;
$FlightData[$sk]['TripType'] = $intTripType;
$FlightData[$sk]['IsInternational'] = $interNationalSearch;
$FlightData[$sk]['strFlightRoute'] = $strFlightRoute;
$FlightData[$sk]['logo'] = $filePath;
$FilterDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strDepartureDtTime);
$FilterArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strArrivalDtTime);
$FlightData[$sk]['FilterDepartureDtTime'] = $FilterDepartureDtTime;
$FlightData[$sk]['FilterArrivalDtTime'] = $FilterArrivalDtTime;
$arrAirlineName[] = $strAirlineName;
$FiltStopCount[] = $OrStopCountTxt;
}
}
$arrInsertFlightData[$keys]['PublishedFare'] = ($PublishedFareReverse * $this->CurrencyRate);
$arrInsertFlightData[$keys]['AirlineName'] = $strAirlineName;
$arrInsertFlightData[$keys]['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$keys]['FlyingMinutes'] = $FlightDuration;
$arrInsertFlightData[$keys]['ArrivalTime'] = $strArrivalDtTime;
$arrInsertFlightData[$keys]['JourneyType'] = $intJourneyType;
$arrInsertFlightData[$keys]['TripType'] = $intTripType;
$arrInsertFlightData[$keys]['IsInternational'] = $interNationalSearch;
//$arrInsertFlightData[$keys]['ApiResultIndex'] = $ApiResultIndex;
//$arrInsertFlightData[$keys]['SearchTraceId'] = $FlightTraceId;
$arrInsertFlightData[$keys]['FairRules'] = $FairRulesArr;
$arrInsertFlightData[$keys]['Segments'] = $arrSegments;
$arrInsertFlightData[$keys]['FlightData'] = $FlightData;
$arrInsertFlightData[$keys]['MultiHead'] = $MultiHead;
$arrInsertFlightData[$keys]['IsBagIncludes'] = $IsBagIncludes;
$arrInsertFlightData[$keys]['IsMealIncludes'] = $IsMealIncludesTrue;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
}
}
$FiltStopCount = array_values(array_unique($FiltStopCount));
$arrAirlineName = array_values(array_unique($arrAirlineName));
$AttPriceRange__ = [];
$MinriceRange = (min($dddddddd));
$MaxriceRange = (max($dddddddd));
sort($FiltStopCount);
$data = array('outbound' => $arrInsertFlightData, 'inbound' => [], 'MultiHead' => $MultiHead, 'ReturnDateArr' => '', 'DepartDateArr' => '', 'source' => $source, 'destination' => $destination, 'source_city' => $source_city, 'destination_city' => $destination_city, 'interNationalSearch' => $interNationalSearch, 'route' => $strFlightRoute, 'CurrencyTitle' => $this->CurrencyTitle, 'arrAirlineName' => $arrAirlineName, 'FiltStopCount' => $FiltStopCount, 'ArrPriceUnique' => $AttPriceRange__, 'MinriceRange' => (round($MinriceRange)), 'MaxriceRange' => (round($MaxriceRange)));
echo json_encode($data);
exit;
} else {
$data = array('outbound' => [], 'inbound' => [], 'MultiHead' => [], 'source' => $source, 'destination' => $destination, 'source_city' => $source_city, 'destination_city' => $destination_city, 'route' => $strFlightRoute, 'interNationalSearch' => $interNationalSearch, 'arrAirlineName' => [], 'FiltStopCount' => [], 'ArrPriceUnique' => []);
echo json_encode($data);
exit;
}
echo '<pre>';
print_r($apiResponse);
die('ddd');
}
public function getflightsearchAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$CustomerSession->unsetAll();
$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);
$AdditionalMarkup = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAdditionalMarkup();
$faretypeArr = $AdditionalMarkup['faretypeArr'];
//echo '<pre>';print_r($AdditionalMarkup);die('ddd');
$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));
// $str = file_get_contents($this->baseUrl . 'public/logs/flight/FlightSearch/demo_result_request.json');
// $apiResponse = json_decode($str, true);
if ($strFlightRoute == 3) {
$this->FlightDataMultiCity($apiResponse, $sessionFlightSearchParams->params, $getMarkup, $AdditionalMarkup);
}
$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));
$intResponseStatus = $apiResponse['ResponseStatus'];
$ONWARD = $apiResponse['OutBoundFlightResults'];
if ($intResponseStatus == 1) {
if ($ONWARD) {
foreach ($ONWARD as $key => $result) {
//echo"<pre>";print_r($result);die;
$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 = isset($totalPriceList['fd']['ADULT']['mI']) ? $totalPriceList['fd']['ADULT']['mI'] : false;
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Check In Baggage
$cabinbagInfo = $totalPriceList['fd']['ADULT']['bI']['cB']; ///Cabin Baggage
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if (!empty($cabinbagInfo)) {
$IscabinbagIncludes = true;
} else {
$IscabinbagIncludes = 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;
$PublishedFareReverse = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
$intYQTaxToT = 0;
$intTotalOfferedForAllPax = 0;
$intBaseFareAllPax = 0;
$intTaxAllPax = 0;
$array_searcher = $this->array_searcher($AdditionalMarkup, $result['totalPriceList']);
array_multisort($array_searcher);
if ($array_searcher) {
foreach ($array_searcher as $kp => $price) {
$fareDetail = $price['fd'];
//echo '<pre>';print_r(($fareDetail));echo '</pre>';
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
$AddMarkup = isset($AdditionalMarkup['finalArr'][$fareIdentifier]) ? $AdditionalMarkup['finalArr'][$fareIdentifier] : [];
$IsMealIncludes = $fareDetail['ADULT']['mI'];
$strBaggage = $price['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $price['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($fareIdentifier == 'TACTICAL' || $fareIdentifier == 'COUPON') {
$fareIdentifier = 'PROMO';
}
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
if (!empty($ADULT)) {
$PaxTypeCount = 1;
}
if (!empty($CHILD)) {
$PaxTypeCount = 2;
}
if (!empty($INFANT)) {
$PaxTypeCount = 3;
}
$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
$ADULTNCMTOT = isset($fareDetail['ADULT']['afC']['NCM']['OT']) ? $fareDetail['ADULT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$CHILDNCMTOT = isset($fareDetail['CHILD']['afC']['NCM']['OT']) ? $fareDetail['CHILD']['afC']['NCM']['OT'] : 0; //- Gross Commission
$INFANTNCMTOT = isset($fareDetail['INFANT']['afC']['NCM']['OT']) ? $fareDetail['INFANT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$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));
//$NetCommission = (($ADULTNCMTOT * $adultCount) + ($CHILDNCMTOT * $childCount) + ($INFANTNCMTOT * $infantCount));
//$PublishedFareIN = $NetFare;
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $NetFare,
'intCommissionEarned' => $CommissionEarned,
'TdsOnPLB' => $TdsOnPLB,
'MUFee' => $MUFee,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
//echo '<pre>';print_r(($markUpArr));echo '</pre>';
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArr);
if ($kp == 0) {
$PublishedFareReverse += ($arrMarkUps['PublishFare']);
}
//echo '<pre>';print_r(($arrMarkUps));echo '</pre>';
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($ADULT['TF'] * $adultCount),
'OfferedFare' => ($ADULT['NF'] * $adultCount),
'intCommissionEarned' => ($ADULT['NCM'] * $adultCount),
'TdsOnPLB' => ($ADULTNCMTDS * $adultCount),
'MUFee' => ($AD_MU * $adultCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $adultCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[0]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[0]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[0]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[0]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[0]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[0]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[0]['GSTonComm'] = 0;
$FareBreakdown[0]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[0]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($CHILD['TF'] * $childCount),
'OfferedFare' => ($CHILD['NF'] * $childCount),
'intCommissionEarned' => ($CHILD['NCM'] * $childCount),
'TdsOnPLB' => ($CHILDNCMTDS * $childCount),
'MUFee' => ($CH_MU * $childCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $childCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$FareBreakdown[1]['BaseFare'] = ($CHILD['BF'] * $childCount);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[1]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[1]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[1]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[1]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[1]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[1]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[1]['GSTonComm'] = 0;
$FareBreakdown[1]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[1]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($INFANT['TF'] * $infantCount),
'OfferedFare' => ($INFANT['NF'] * $infantCount),
'intCommissionEarned' => ($INFANT['NCM'] * $infantCount),
'TdsOnPLB' => ($INFANTNCMTDS * $infantCount),
'MUFee' => ($IN_MU * $infantCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $infantCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[2]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[2]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[2]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[2]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[2]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[2]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[2]['GSTonComm'] = 0;
$FareBreakdown[2]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[2]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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" => ceil($arrMarkUps['PublishFare'] * $this->CurrencyRate),
"OfferedFare" => $arrMarkUps['intOfferedFare'],
"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" => ucfirst(strtolower($fareDetail['ADULT']['cc'])),
"intTotalGST" => $arrMarkUps['intTotalGST'],
"apiMarkup" => $arrMarkUps['apiMarkup'],
"IntCommission" => $arrMarkUps['IntCommission'],
"apiTaxOnMarkup" => $arrMarkUps['apiTaxOnMarkup'],
"NoOfSeatAvailable" => $fareDetail['ADULT']['sR'],
"FixedMarkUp" => $arrMarkUps['IntAgencyFixMarkUp'],
"GSTOnMarkUp" => $arrMarkUps['IntTaxOnAgencyFixMarkUp'],
"CommEarned" => $arrMarkUps['intCommisionEarnedForAgency'],
"GSTonComm" => 0,
"intGTXMarkUp" => $arrMarkUps['intGTXMarkUp'],
"GTXMarkUpGST" => $arrMarkUps['intSTaxOnGTXMarkUp'],
"AddiMarkup" => $arrMarkUps['AddiMarkup'],
"AddiTaxOnMarkup" => $arrMarkUps['AddiTaxOnMarkup'],
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsMealIncludes" => $IsMealIncludes,
// "FixedMarkUp" => $intAgencyFixMarkUp,
// "GSTOnMarkUp" => $intSTaxOnAgencyFixMarkUp,
// "CommEarned" => $intCommisionEarnedForAgency,
// "GSTonComm" => $intGSTOnAgencyCommisionEarned,
// "intGTXMarkUp" => $intGTXMarkUp,
// "GTXMarkUpGST" => $intSTaxOnGTXMarkUp,
"FareBreakdown" => $FareBreakdown,
"arrMarkUps" => $arrMarkUps,
);
}
}
// echo '<pre>';print_r($FairRulesArr);
$TotalLAYOVERMinutes = 0;
$SegFlightNumberArr = [];
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)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
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,
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsMealIncludes" => $IsMealIncludes,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"filePath" => $filePath,
);
$SegFlightNumberArr[] = $SegFlightNumber;
//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';
if ($FairRulesArr) {
$arrInsertFlightData[$key]['FlightNumber'] = $strFlightNumber;
$arrInsertFlightData[$key]['keyIndex'] = $key;
$arrInsertFlightData[$key]['SegFlightNumberArr'] = implode(', ', $SegFlightNumberArr);
$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]['IsCabinBagIncludes'] = $IscabinbagIncludes;
$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'] = ceil($PublishedFareReverse * $this->CurrencyRate); // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFareTxt'] = number_format(($PublishedFareReverse * $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[] = $PublishedFareReverse;
$FiltStopCount[] = $StopCountTxt;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_5000), ($PublishedFare * $this->CurrencyRate));
$FilterDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strDepartureDtTime);
$FilterArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strArrivalDtTime);
//$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_AED), ($PublishedFare * $this->CurrencyRate));
//$arrInsertFlightData[$key]['FilterPrice'] = $FilterPrice;
if ($FilterPrice) {
$arrInsertFlightData[$key]['FilterPrice'] = $FilterPrice;
}
$arrInsertFlightData[$key]['FilterDepartureDtTime'] = $FilterDepartureDtTime;
$arrInsertFlightData[$key]['FilterArrivalDtTime'] = $FilterArrivalDtTime;
$arrInsertFlightData[$key]['CombineTripInfo'] = [];
}
}
}
if ($interNationalSearch == 1 && ($strFlightRoute == 1)) {
foreach ($arrInsertFlightData as $k => $v) {
$new_arr[$v['PublishedFare']][] = $v;
}
$arrFlightData = [];
foreach ($arrInsertFlightData as $ke => $vl) {
$processedTripInfo = isset($new_arr[$vl['PublishedFare']]) ? $new_arr[$vl['PublishedFare']] : [];
$arrFlightData[$vl['PublishedFare']] = $vl;
$arrFlightData[$vl['PublishedFare']]['CombineTripInfo'] = $processedTripInfo;
}
} else {
$arrFlightData = [];
}
// echo '<pre>';
// print_r(json_encode(array_values($new_arr)));
// die;
$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'])));
$MinriceRange = (min($dddddddd) - 100);
$MaxriceRange = (max($dddddddd));
if ($interNationalSearch == 1 && $strFlightRoute == 2) {
$RoundInterTrip = $this->FlightDataRoundTripInternational($apiResponse);
$MinriceRange = (min($RoundInterTrip['AttPriceRange']));
$MaxriceRange = (max($RoundInterTrip['AttPriceRange']));
$data = array('outbound' => $RoundInterTrip['outbound'], 'CurrencyTitle' => $this->CurrencyTitle, 'outboundCombine' => array_values($RoundInterTrip['arrFlightData']), 'inbound' => [], 'interNationalSearch' => $interNationalSearch, 'route' => $strFlightRoute, 'arrAirlineName' => $RoundInterTrip['arrAirlineName'], 'FiltStopCount' => $RoundInterTrip['FiltStopCount'], 'ArrPriceUnique' => $RoundInterTrip['ArrPriceUnique'], 'MinriceRange' => round($MinriceRange), 'MaxriceRange' => round($MaxriceRange));
} else {
$data = array('outbound' => array_values($arrInsertFlightData), 'outboundCombine' => array_values($arrFlightData), 'interNationalSearch' => $interNationalSearch, 'route' => $strFlightRoute, 'CurrencyTitle' => $this->CurrencyTitle, 'inbound' => $RoundTrip['inbound'], 'arrAirlineName' => $arrAirlineName, 'FiltStopCount' => $FiltStopCount, 'ArrPriceUnique' => $ArrPriceUnique, 'MinriceRange' => round($MinriceRange), 'MaxriceRange' => round($MaxriceRange));
}
echo json_encode($data);
exit;
} else {
$data = array('outbound' => [], 'CurrencyTitle' => $this->CurrencyTitle, 'outboundCombine' => [], 'inbound' => [], 'interNationalSearch' => $interNationalSearch, 'route' => $strFlightRoute, 'arrAirlineName' => [], 'FiltStopCount' => [], 'ArrPriceUnique' => [], 'MinriceRange' => 0, 'MaxriceRange' => 0);
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);
$AdditionalMarkup = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAdditionalMarkup();
$faretypeArr = $AdditionalMarkup['faretypeArr'];
$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']; //NoOfSeatAvailable
$strFareClass = $totalPriceList['fd']['ADULT']['cB']; ///Cabin Baggage
$IsMealIncludes = $totalPriceList['fd']['ADULT']['mI'];
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Check In Baggage
$cabinbagInfo = $totalPriceList['fd']['ADULT']['bI']['cB']; ///Cabin Baggage
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if (!empty($cabinbagInfo)) {
$IscabinbagIncludes = true;
} else {
$IscabinbagIncludes = 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;
$PublishedFareReverse = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
$array_searcher = $this->array_searcher($AdditionalMarkup, $result['totalPriceList']);
array_multisort($array_searcher);
if ($array_searcher) {
foreach ($array_searcher as $kp => $price) {
$fareDetail = $price['fd'];
//echo '<pre>';print_r(($fareDetail));echo '</pre>';
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
$AddMarkup = isset($AdditionalMarkup['finalArr'][$fareIdentifier]) ? $AdditionalMarkup['finalArr'][$fareIdentifier] : [];
$IsMealIncludes = $IsMealIncludes = $price['fd']['ADULT']['mI'];
$strBaggage = $price['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $price['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($fareIdentifier == 'SME') {
$IsGSTRequired = true;
} else {
$IsGSTRequired = false;
}
if ($fareIdentifier == 'TACTICAL' || $fareIdentifier == 'COUPON') {
$fareIdentifier = 'PROMO';
}
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
if (!empty($ADULT)) {
$PaxTypeCount = 1;
}
if (!empty($CHILD)) {
$PaxTypeCount = 2;
}
if (!empty($INFANT)) {
$PaxTypeCount = 3;
}
$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
$ADULTNCMTOT = isset($fareDetail['ADULT']['afC']['NCM']['OT']) ? $fareDetail['ADULT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$CHILDNCMTOT = isset($fareDetail['CHILD']['afC']['NCM']['OT']) ? $fareDetail['CHILD']['afC']['NCM']['OT'] : 0; //- Gross Commission
$INFANTNCMTOT = isset($fareDetail['INFANT']['afC']['NCM']['OT']) ? $fareDetail['INFANT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$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));
//$NetCommission = (($ADULTNCMTOT * $adultCount) + ($CHILDNCMTOT * $childCount) + ($INFANTNCMTOT * $infantCount));
//$PublishedFareIN = $NetFare;
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $NetFare,
'intCommissionEarned' => $CommissionEarned,
'TdsOnPLB' => $TdsOnPLB,
'MUFee' => $MUFee,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
//echo '<pre>';print_r(($markUpArr));echo '</pre>';
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArr);
if ($kp == 0) {
$PublishedFareReverse += ($arrMarkUps['PublishFare']);
}
//echo '<pre>';print_r(($arrMarkUps));echo '</pre>';
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($ADULT['TF'] * $adultCount),
'OfferedFare' => ($ADULT['NF'] * $adultCount),
'intCommissionEarned' => ($ADULT['NCM'] * $adultCount),
'TdsOnPLB' => ($ADULTNCMTDS * $adultCount),
'MUFee' => ($AD_MU * $adultCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $adultCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[0]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[0]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[0]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[0]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[0]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[0]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[0]['GSTonComm'] = 0;
$FareBreakdown[0]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[0]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($CHILD['TF'] * $childCount),
'OfferedFare' => ($CHILD['NF'] * $childCount),
'intCommissionEarned' => ($CHILD['NCM'] * $childCount),
'TdsOnPLB' => ($CHILDNCMTDS * $childCount),
'MUFee' => ($CH_MU * $childCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $childCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$FareBreakdown[1]['BaseFare'] = ($CHILD['BF'] * $childCount);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[1]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[1]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[1]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[1]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[1]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[1]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[1]['GSTonComm'] = 0;
$FareBreakdown[1]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[1]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($INFANT['TF'] * $infantCount),
'OfferedFare' => ($INFANT['NF'] * $infantCount),
'intCommissionEarned' => ($INFANT['NCM'] * $infantCount),
'TdsOnPLB' => ($INFANTNCMTDS * $infantCount),
'MUFee' => ($IN_MU * $infantCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $infantCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[2]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[2]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[2]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[2]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[2]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[2]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[2]['GSTonComm'] = 0;
$FareBreakdown[2]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[2]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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" => ceil($arrMarkUps['PublishFare'] * $this->CurrencyRate),
"OfferedFare" => $arrMarkUps['intOfferedFare'],
"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),
"NoOfSeatAvailable" => $fareDetail['ADULT']['sR'],
"FareClass" => ucfirst(strtolower($fareDetail['ADULT']['cc'])),
"intTotalGST" => $arrMarkUps['intTotalGST'],
"apiMarkup" => $arrMarkUps['apiMarkup'],
"IntCommission" => $arrMarkUps['IntCommission'],
"apiTaxOnMarkup" => $arrMarkUps['apiTaxOnMarkup'],
"FixedMarkUp" => $arrMarkUps['IntAgencyFixMarkUp'],
"GSTOnMarkUp" => $arrMarkUps['IntTaxOnAgencyFixMarkUp'],
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"CommEarned" => $arrMarkUps['intCommisionEarnedForAgency'],
"GSTonComm" => 0,
"intGTXMarkUp" => $arrMarkUps['intGTXMarkUp'],
"GTXMarkUpGST" => $arrMarkUps['intSTaxOnGTXMarkUp'],
"AddiTaxOnMarkup" => $arrMarkUps['AddiTaxOnMarkup'],
"AddiMarkup" => $arrMarkUps['AddiMarkup'],
// "FixedMarkUp" => $intAgencyFixMarkUp,
// "GSTOnMarkUp" => $intSTaxOnAgencyFixMarkUp,
// "CommEarned" => $intCommisionEarnedForAgency,
// "GSTonComm" => $intGSTOnAgencyCommisionEarned,
// "intGTXMarkUp" => $intGTXMarkUp,
// "GTXMarkUpGST" => $intSTaxOnGTXMarkUp,
"FareBreakdown" => $FareBreakdown,
"arrMarkUps" => $arrMarkUps,
);
}
}
$SegFlightNumberArr = [];
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 = $segments['fd']['ADULT']['cB'];
$strBaggage = $segments['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $segments['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
if (!empty($strBaggage)) {
$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,
"IsBaggage" => $IsBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"Baggage" => $strBaggage,
"IsCabinBaggage" => $IscabinbagIncludes,
"CabinBaggage" => $strCabinBaggage,
"IsMealIncludes" => $IsMealIncludes,
"Duration" => $duration,
"GroundTime" => $GroundTime,
"NoOfSeatAvailable" => $NoOfSeatAvailable,
"strDepartureDtTime" => $strDepartureDtTime,
"strArrivalDtTime" => $strArrivalDtTime,
"FlightDuration" => $strDuration,
"LAYOVERDuration" => $LAYOVERDuration,
"LAYOVERCity" => $LAYOVERCity,
"DepTerminal" => $DepTerminal,
"ArrTerminal" => $ArrTerminal,
"filePath" => $filePath,
);
$SegFlightNumberArr[] = $SegFlightNumber;
}
}
$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';
if (!empty($FairRulesArr)) {
$arrInsertFlightData[$key]['keyIndex'] = $key;
$arrInsertFlightData[$key]['FlightNumber'] = $strFlightNumber;
$arrInsertFlightData[$key]['SegFlightNumberArr'] = implode(', ', $SegFlightNumberArr);
$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'] = ($PublishedFareReverse * $this->CurrencyRate); // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFareTxt'] = number_format(($PublishedFareReverse * $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[] = $PublishedFareReverse;
$FiltStopCount[] = $StopCountTxt;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
$FilterDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strDepartureDtTime);
$FilterArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strArrivalDtTime);
$arrInsertFlightData[$key]['FilterDepartureDtTime'] = $FilterDepartureDtTime;
$arrInsertFlightData[$key]['FilterArrivalDtTime'] = $FilterArrivalDtTime;
//$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' => array_values($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'] : '';
//echo"<pre>";print_r($sessionFlightSearchParams);die;
$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);
$AdditionalMarkup = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAdditionalMarkup();
$faretypeArr = $AdditionalMarkup['faretypeArr'];
$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 = isset($totalPriceList['fd']['ADULT']['mI']) ? $totalPriceList['fd']['ADULT']['mI'] : false;
$bagInfo = $totalPriceList['fd']['ADULT']['bI']['iB']; ///Check In Baggage
$strCabinBaggage = $totalPriceList['fd']['ADULT']['bI']['cB']; ///Cabin Baggage
$strTraceId = $totalPriceList['id'];
$ResultIndex = $totalPriceList['id'];
if (!empty($bagInfo)) {
$IsBagIncludes = true;
} else {
$IsBagIncludes = false;
}
if (!empty($strCabinBaggage)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = 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;
$PublishedFareReverse = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
$array_searcher = $this->array_searcher($AdditionalMarkup, $result['totalPriceList']);
array_multisort($array_searcher);
if ($array_searcher) {
foreach ($array_searcher as $kp => $price) {
$fareDetail = $price['fd'];
//echo '<pre>';print_r($fareDetail);echo '</pre>';
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
$AddMarkup = isset($AdditionalMarkup['finalArr'][$fareIdentifier]) ? $AdditionalMarkup['finalArr'][$fareIdentifier] : [];
$IsMealIncludes = $IsMealIncludes = $price['fd']['ADULT']['mI'];
$strBaggage = $price['fd']['ADULT']['bI']['iB']; ///Checking Baggage
$strCabinBaggage = $price['fd']['ADULT']['bI']['cB']; ////Cabin Baggage
if (!empty($strCabinBaggage)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
if (!empty($strCabinBaggage)) {
$IsBaggage = true;
} else {
$IsBaggage = false;
}
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
if (!empty($ADULT)) {
$PaxTypeCount = 1;
}
if (!empty($CHILD)) {
$PaxTypeCount = 2;
}
if (!empty($INFANT)) {
$PaxTypeCount = 3;
}
$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
$ADULTNCMTOT = isset($fareDetail['ADULT']['afC']['NCM']['OT']) ? $fareDetail['ADULT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$CHILDNCMTOT = isset($fareDetail['CHILD']['afC']['NCM']['OT']) ? $fareDetail['CHILD']['afC']['NCM']['OT'] : 0; //- Gross Commission
$INFANTNCMTOT = isset($fareDetail['INFANT']['afC']['NCM']['OT']) ? $fareDetail['INFANT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$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));
//$NetCommission = (($ADULTNCMTOT * $adultCount) + ($CHILDNCMTOT * $childCount) + ($INFANTNCMTOT * $infantCount));
//$PublishedFareIN = $NetFare;
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $NetFare,
'intCommissionEarned' => $CommissionEarned,
'TdsOnPLB' => $TdsOnPLB,
'MUFee' => $MUFee,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
//echo '<pre>';print_r(($markUpArr));echo '</pre>';
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArr);
if ($kp == 0) {
$PublishedFareReverse += ($arrMarkUps['PublishFare']);
}
//echo '<pre>';print_r(($arrMarkUps));echo '</pre>';
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($ADULT['TF'] * $adultCount),
'OfferedFare' => ($ADULT['NF'] * $adultCount),
'intCommissionEarned' => ($ADULT['NCM'] * $adultCount),
'TdsOnPLB' => ($ADULTNCMTDS * $adultCount),
'MUFee' => ($AD_MU * $adultCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $adultCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[0]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[0]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[0]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[0]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[0]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[0]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[0]['GSTonComm'] = 0;
$FareBreakdown[0]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[0]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($CHILD['TF'] * $childCount),
'OfferedFare' => ($CHILD['NF'] * $childCount),
'intCommissionEarned' => ($CHILD['NCM'] * $childCount),
'TdsOnPLB' => ($CHILDNCMTDS * $childCount),
'MUFee' => ($CH_MU * $childCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $childCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$FareBreakdown[1]['BaseFare'] = ($CHILD['BF'] * $childCount);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[1]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[1]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[1]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[1]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[1]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[1]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[1]['GSTonComm'] = 0;
$FareBreakdown[1]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[1]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($INFANT['TF'] * $infantCount),
'OfferedFare' => ($INFANT['NF'] * $infantCount),
'intCommissionEarned' => ($INFANT['NCM'] * $infantCount),
'TdsOnPLB' => ($INFANTNCMTDS * $infantCount),
'MUFee' => ($IN_MU * $infantCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $infantCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[2]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[2]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[2]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[2]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[2]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[2]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[2]['GSTonComm'] = 0;
$FareBreakdown[2]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[2]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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" => ceil($arrMarkUps['PublishFare'] * $this->CurrencyRate),
"OfferedFare" => $arrMarkUps['intOfferedFare'],
"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" => ucfirst(strtolower($fareDetail['ADULT']['cc'])),
"NoOfSeatAvailable" => $fareDetail['ADULT']['sR'],
"intTotalGST" => $arrMarkUps['intTotalGST'],
"apiMarkup" => $arrMarkUps['apiMarkup'],
"IntCommission" => $arrMarkUps['IntCommission'],
"apiTaxOnMarkup" => $arrMarkUps['apiTaxOnMarkup'],
"FixedMarkUp" => $arrMarkUps['IntAgencyFixMarkUp'],
"GSTOnMarkUp" => $arrMarkUps['IntTaxOnAgencyFixMarkUp'],
"CommEarned" => $arrMarkUps['intCommisionEarnedForAgency'],
"GSTonComm" => 0,
"intGTXMarkUp" => $arrMarkUps['intGTXMarkUp'],
"GTXMarkUpGST" => $arrMarkUps['intSTaxOnGTXMarkUp'],
"AddiMarkup" => $arrMarkUps['AddiMarkup'],
"AddiTaxOnMarkup" => $arrMarkUps['AddiTaxOnMarkup'],
"FareBreakdown" => $FareBreakdown,
"IsMealIncludes" => $IsMealIncludes,
"Baggage" => $strBaggage,
"CabinBaggage" => $strCabinBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"IsBaggage" => $IsBaggage,
"arrMarkUps" => $arrMarkUps,
);
}
}
$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)) {
$IsCabinBaggage = true;
} else {
$IsCabinBaggage = false;
}
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,IsCabinBaggage,IsBaggage,Baggage,CabinBaggage
"IsBaggage" => $IsBaggage,
"Baggage" => $strBaggage,
"IsCabinBaggage" => $IsCabinBaggage,
"CabinBaggage" => $strCabinBaggage,
"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 = [];
$OnwdFlightNumberArr = [];
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;
$AirlineCode = $onwd['fD']['aI']['code'];
$FlightNumber = $onwd['fD']['fN'];
$OnwdFlightNumber = $AirlineCode . "-" . $FlightNumber;
$OnwdFlightNumberArr[] = $OnwdFlightNumber;
//echo '<pre>';print_r($onwd);
}
}
// 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)";
}
if (!empty($FairRulesArr)) {
$arrInsertFlightData[$key]['origin']['keyIndex'] = $key;
$arrInsertFlightData[$key]['origin']['FlightNumber'] = $FlightNumber;
$arrInsertFlightData[$key]['origin']['SegFlightNumberArr'] = implode(', ', $OnwdFlightNumberArr);
$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']['IsCabinBagIncludes'] = $IsCabinBagIncludes;
$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 = [];
$OnwdFlightNumberArr = [];
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;
$AirlineCode = $onwd['fD']['aI']['code'];
$FlightNumber = $onwd['fD']['fN'];
$OnwdFlightNumber = $AirlineCode . "-" . $FlightNumber;
$OnwdFlightNumberArr[] = $OnwdFlightNumber;
}
}
$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']['SegFlightNumberArr'] = implode(', ', $OnwdFlightNumberArr);
$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']['IsCabinBagIncludes'] = $IsCabinBagIncludes;
$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'] = $PublishedFareReverse; // As Discussed with GG
$arrInsertFlightData[$key]['PublishedFareTxt'] = number_format($PublishedFareReverse);
$arrInsertFlightData[$key]['ApiResultIndex'] = $ResultIndex;
$arrInsertFlightData[$key]['apiTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['FairRules'] = $FairRulesArr;
$arrInsertFlightData[$key]['Segments'] = $arrSegments;
$arrInsertFlightData[$key]['DepartureTime'] = $strDepartureDtTime;
$arrInsertFlightData[$key]['StopCount'] = $OrStopCountTxt;
$arrInsertFlightData[$key]['keyIndex'] = $key;
if ($FairRulesArr) {
foreach ($FairRulesArr as $Fare) {
$dddddddd[] = $Fare['PublishedFare'];
}
}
$FilterDepartureDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strDepartureDtTime);
$FilterArrivalDtTime = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_DEPARTURETIME), $strArrivalDtTime);
$arrInsertFlightData[$key]['FilterDepartureDtTime'] = $FilterDepartureDtTime;
$arrInsertFlightData[$key]['FilterArrivalDtTime'] = $FilterArrivalDtTime;
// $arrInsertFlightData[$key]['fffffffffffff'] = $arrFairRules;
//$FiltPriceRange[] = $FilterPrice = Zend_Controller_Action_HelperBroker::getStaticHelper("General")->getRangeByValue(unserialize(CONST_PRICE_RANGE_AED), ($PublishedFare * $this->CurrencyRate));
$AttPriceRange[] = $PublishedFareReverse;
$arrAirlineName[] = $AirlineCode . '-' . $strAirlineName;
$FiltStopCount[] = $OrStopCountTxt;
//$DesFiltStopCount[] = $DeStopCountTxt;
//$arrInsertFlightData[$key]['FilterPrice'] = $FilterPrice;
}
}
foreach ($arrInsertFlightData as $k => $v) {
$new_arr[$v['FairRules'][0]['PublishedFare']][] = $v;
}
$arrFlightData = [];
foreach ($arrInsertFlightData as $ke => $vl) {
$processedTripInfo = isset($new_arr[$vl['FairRules'][0]['PublishedFare']]) ? $new_arr[$vl['FairRules'][0]['PublishedFare']] : [];
$arrFlightData[$vl['FairRules'][0]['PublishedFare']] = $vl;
$arrFlightData[$vl['FairRules'][0]['PublishedFare']]['CombineTripInfo'] = $processedTripInfo;
}
//echo '<pre>';
//print_r(json_encode($arrFlightData));
//echo '</pre>';
//die;
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_filter(array_values($FiltPriceRangeU));
$arrAirlineName = array_unique($arrAirlineName);
$FiltStopCount = array_unique($FiltStopCount);
$AttPriceRange = array_unique($AttPriceRange);
//krsort($ArrPriceUnique);
$data = array('outbound' => array_values($arrInsertFlightData), 'arrFlightData' => $arrFlightData, 'arrAirlineName' => $arrAirlineName, 'FiltStopCount' => $FiltStopCount, 'ArrPriceUnique' => $FiltPriceRangeU, 'AttPriceRange' => $AttPriceRange);
return $data;
} else {
return false;
}
}
public function getflightfarerulesAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$getData = $this->getRequest()->getParams();
$sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams');
$intCountryCode = $sessionFlightSearchParams->params['intCountryCode'];
$adultCount = $sessionFlightSearchParams->params['adults'];
$childCount = $sessionFlightSearchParams->params['child'];
$infantCount = $sessionFlightSearchParams->params['infant'];
$interNationalSearch = trim($sessionFlightSearchParams->params['interNationalSearch']);
$intMemberCount = $adultCount + $childCount + $infantCount;
$intMarkUp = $this->getCancelCharge($intCountryCode);
// $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;
// }
// }
// }
// }
// }
// echo "<pre>";
// print_r($getData);
// die;
$apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetApiFlightsFareRulesTripJack($getData);
// echo "<pre>";
// print_r($apiResponse);
// die;
$this->view->apiResponse = $apiResponse;
$this->view->getData = $getData;
$this->view->intMarkUp = ($intMarkUp * $intMemberCount);
$this->view->IsLCC = $getData['IsLCC'];
$this->view->interNationalSearch = $interNationalSearch;
} else {
die('Page not found!');
}
}
public function getCancelCharge($intCountryCode)
{
if ($intCountryCode) {
$getMarkup = $this->getMarkup($intCountryCode);
$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;
}
}
}
}
}
return $intMarkUp;
} else {
$data = array('status' => false, 'message' => 'Invalid request');
return ($data);
}
}
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;
//echo"<pre>";print_r($Outbound);die;
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/travellers/' . $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');
//echo"<pre>";print_r($FlightBookingData->params);die;
if ($FlightBookingData->params[0]['FairRules']['IsGSTRequired']) {
$isgstsmondatory = 'mondatory';
} else {
$isgstsmondatory = 'optional';
}
if ($FlightBookingData->params[0]['isDobAdult']) {
$dobadult = "required";
}
if ($FlightBookingData->params[0]['isDobChild']) {
$dobchild = "required";
}
if ($FlightBookingData->params[0]['isDobInfant']) {
$dobinfant = "required";
}
$this->view->dobadult = $dobadult;
$this->view->dobchild = $dobchild;
$this->view->dobinfant = $dobinfant;
$this->view->isgstsmondatory = $isgstsmondatory;
$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);
//echo"<pre>";print_r($GetCustomerData);die;
$Customerdata = [];
if ($this->_session->session['CustomerSysId']) {
$Customerdata = $this->objMdl->selectOne('tbl_customer', ['*'], ['GTX_customerSysId' => $this->_session->session['CustomerSysId'], 'IsMarkForDel' => 0, 'IsActive' => 1]);
//$Customerdata = $objFlight->CheckCustomer('tbl_customer', ['CustomerSysId' => $GetCustomerData['CustomerSysId']]);
}
$this->view->Customerdata = $Customerdata;
$this->view->loginuserdata = $this->_session->session;
$CountryCode = $this->getCountryCodeList();
$this->view->CountryCode = $CountryCode;
// echo '<pre>';print_r($Customerdata);
// echo '<pre>';print_r($this->_session->session);
// 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;
// echo "<pre>"; print_r($flightSSRDetails); die('test');
$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));
//echo "<pre>"; print_r($SSRArr); die('test');
$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'],
'PassportNation' => $member['PassportNation'],
'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,
'companyname' => $value['companyname'],
'gstnnumber' => $value['gstnnumber'],
'gstaddress' => $value['gstaddress'],
'gstemail' => $value['gstemail'],
'gststate' => $value['gststate'],
'gstphone' => $value['gstphone'],
'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)
{
//echo"<pre>";print_r($post);die;
$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 .= "&leadsource=Website";
$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];
}
if (!empty($returnDate)) {
$arrreturnDates = explode("/", $returnDate);
$returnDatesAD = $arrreturnDates[2] . "-" . $arrreturnDates[1] . "-" . $arrreturnDates[0];
}
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingDataInbound = new Zend_Session_Namespace('FlightBookingDataInbound');
$FlightBookingDataRoundInter = new Zend_Session_Namespace('FlightBookingDataRoundInter');
$apiTraceId = $FlightBookingData->params['apiTraceId'];
$isDobAdult = $FlightBookingData->params[0]['isDobAdult'];
$isDobChild = $FlightBookingData->params[0]['isDobChild'];
$isDobInfant = $FlightBookingData->params[0]['isDobInfant'];
//echo"<pre>";print_r($FlightBookingData->params[0]['isDobAdult']);die;
// $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);
//$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']));
if (!empty($this->_session->session)) {
$param = array(
'leadMobile' => $this->_session->session['ContactNo1'],
'leadEmail' => $this->_session->session['EmailId'],
);
} else {
$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'] : 0;
$passengerCity = isset($post['passenger-city-1']) ? $post['passenger-city-1'] : 0;
$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] ? $post['relation-' . $i] : 0;
$salutation = $post['salution-' . $i];
$add_travellerslist = 1; //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';
$passporNation = isset($post['PassportNationality-' . $i]) ? $post['PassportNationality-' . $i] : '';
if (!empty($passengerPassportExpiry)) {
$passengerPassportExpiry = explode("/", $passengerPassportExpiry);
if (isset($passengerPassportExpiry[2])) {
$passengerPassportExpiry = $passengerPassportExpiry[2] . "-" . $passengerPassportExpiry[1] . "-" . $passengerPassportExpiry[0];
} else {
$passengerPassportExpiry = $passengerPassportExpiry[0];
}
}
if (!empty($passporIssue)) {
$passporIssue = explode("/", $passporIssue);
if (isset($passporIssue[2])) {
$passporIssue = $passporIssue[2] . "-" . $passporIssue[1] . "-" . $passporIssue[0];
} else {
$passporIssue = $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($salutation)) {
$response = array('succes' => false, 'msg' => 'Please Select Title', 'index' => 'salution-' . $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;
}
//$isDobAdult,$isDobInfant,$isDobChild
//die($paxType);
if ($paxType == 1) {
if ($isDobAdult) {
if (isset($post['dateofbirth-' . $i]) && !empty($post['dateofbirth-' . $i])) {
$dateofbirth = explode('/', $post['dateofbirth-' . $i]);
if (isset($dateofbirth[2])) {
$dobday = $dateofbirth[0];
$dobmonth = $dateofbirth[1];
$dobyear = $dateofbirth[2];
$passengerDob = $dobyear . '-' . $dobmonth . '-' . $dobday;
} else {
$passengerDob = $dateofbirth[0];
}
} elseif (isset($post['dateofbirth-' . $i]) && empty($post['dateofbirth-' . $i])) {
$response = array('succes' => false, 'msg' => 'Please fill out all date of birth.', 'index' => 'dateofbirth-' . $i);
echo json_encode($response);
exit;
}
}
}
if ($paxType == 2) {
if ($isDobChild) {
if (isset($post['dateofbirth-' . $i]) && !empty($post['dateofbirth-' . $i])) {
$dateofbirth = explode('/', $post['dateofbirth-' . $i]);
if (isset($dateofbirth[2])) {
$dobday = $dateofbirth[0];
$dobmonth = $dateofbirth[1];
$dobyear = $dateofbirth[2];
$passengerDob = $dobyear . '-' . $dobmonth . '-' . $dobday;
} else {
$passengerDob = $dateofbirth[0];
}
} elseif (isset($post['dateofbirth-' . $i]) && empty($post['dateofbirth-' . $i])) {
$response = array('succes' => false, 'msg' => 'Please fill out all date of birth.', 'index' => 'dateofbirth-' . $i);
echo json_encode($response);
exit;
}
}
}
if ($paxType == 3) {
if ($isDobInfant) {
if (isset($post['dateofbirth-' . $i]) && !empty($post['dateofbirth-' . $i])) {
$dateofbirth = explode('/', $post['dateofbirth-' . $i]);
if (isset($dateofbirth[2])) {
$dobday = $dateofbirth[0];
$dobmonth = $dateofbirth[1];
$dobyear = $dateofbirth[2];
$passengerDob = $dobyear . '-' . $dobmonth . '-' . $dobday;
} else {
$passengerDob = $dateofbirth[0];
}
} elseif (isset($post['dateofbirth-' . $i]) && empty($post['dateofbirth-' . $i])) {
$response = array('succes' => false, 'msg' => 'Please fill out all date of birth.', 'index' => 'dateofbirth-' . $i);
echo json_encode($response);
exit;
}
}
}
if (isset($dobday) && empty($dobday)) {
$response = array('succes' => false, 'msg' => 'Please select day.', 'index' => 'dobday' . $i);
echo json_encode($response);
exit;
}
if (isset($dobmonth) && empty($dobmonth)) {
$response = array('succes' => false, 'msg' => 'Please select month.', 'index' => 'dobmonth' . $i);
echo json_encode($response);
exit;
}
if (isset($dobyear) && empty($dobyear)) {
$response = array('succes' => false, 'msg' => 'Please select year.', 'index' => 'dobyear' . $i);
echo json_encode($response);
exit;
}
if (isset($passengerDob)) {
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 (isset($passengerDob)) {
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($returnDate)) {
$lasttraveldate = $returnDatesAD;
} else {
$lasttraveldate = $departureDatesAD;
}
if (isset($passengerDob)) {
if (!empty($paxType) && $paxType == 3) {
$infantAge = date_diff(date_create($passengerDob), date_create($lasttraveldate))->y;
if ($infantAge >= 2) {
$response = array('succes' => false, 'msg' => "Infant age should be less than 2 years as on travel date " . $lasttraveldate, 'index' => 'dobyear' . $i);
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($passporNation))) {
$response = array('succes' => false, 'msg' => 'Please Select Nation', 'index' => 'PassportNationality-' . $i);
echo json_encode($response);
exit;
}
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['PassportNation'] = $ForCustomerSession[$key]['PassportNation'] = ($interNationalSearch == 1) ? $passporNation : '';
$arrCustomer['PassportExpiry'] = $ForCustomerSession[$key]['PassportExpiry'] = ($interNationalSearch == 1) ? $passengerPassportExpiry : '';
$arrCustomer['passporIssue'] = $ForCustomerSession[$key]['passporIssue'] = ($interNationalSearch == 1) ? $passporIssue : '';
}
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));
}
$CustomerSysId = (!empty($CustomerSysId) && $Isadultmem == 0) ? $CustomerSysId : @$tbl_customer[0]['CustomerSysId'];
$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['PassportNation'] = $ForCustomerSession[$key]['PassportNation'] = ($interNationalSearch == 1) ? $passporNation : '';
$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++;
}
$this->objMdl->rv_delete('tbl_flight_booking', array('apiTraceId IN(?)' => explode(',',$post['traceId'])));
$this->objMdl->rv_delete('tbl_flight_booking_customer', array('apiTraceId IN(?)' => explode(',',$post['traceId'])));
$flight_booking_customer = [];
if ($interNationalSearch == 1 && $route == 2) {
$dataArrInter = $this->CreateInternationDataArr($FlightBookingDataRoundInter->params, !empty($CustomerSysId) ? $CustomerSysId : $bookCustomerId);
$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 {
// echo "<pre>";
// print_r($BookingData);
// die;
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['AgentCommisionEarned'] = $value['FairRules']['CommEarned'];
$arrPlanAir['AgentCommisionEarnedGST'] = $value['FairRules']['GSTonComm'];
$arrPlanAir['AgencyMarkUp'] = $value['FairRules']['apiMarkup'];
$arrPlanAir['AgencyMarkUpGST'] = $value['FairRules']['GSTOnMarkUp'];
$arrPlanAir['GTXMarkUp'] = $value['FairRules']['intGTXMarkUp'];
$arrPlanAir['GTXMarkUpGST'] = $value['FairRules']['GTXMarkUpGST'];
$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);
//
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 IN(?)' => explode(',',$post['traceId'])));
$this->objMdl->rv_delete('tbl_flight_booking_customer', array('apiTraceId IN(?)' => explode(',',$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();
$arrData = array(
'FlightBookingData' => $BookingData,
'flight_booking_id_Arr' => $flight_booking_id_Arr,
'CustomerMemberSysIds' => $sessionData,
'CustomerSession' => $ForCustomerSession,
'CustomerMembersSessionArr' => $CustomerMembersSessionArr,
'CustomerSysId' => $CustomerSysId,
'CustomerMemSysId' => $arrmembersId,
'flight_booking_customer' => $flight_booking_customer,
'SearchTraceId' => $post['FlightTraceId'],
'sessionFlightSearchParams' => $sessionFlightSearchParams->params,
'genrateFlightQuery' => $genrateFlightQuery,
'sessionData' => $sessionData,
);
$tempData = array(
'TraceId' => $post['traceId'],
'json_data' => json_encode($arrData),
);
$objFlight->deleteFlightTempData($post['traceId']);
$objFlight->insertFlightTempData($tempData);
$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'],
'PassportNation' => $value['PassportNation'],
'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);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$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['OfferedFare'] = $val['FairRules']['PublishedFare'];
$arrPlanAir['AgentCommisionEarned'] = $val['FairRules']['CommEarned'];
$arrPlanAir['AgentCommisionEarnedGST'] = $val['FairRules']['GSTonComm'];
$arrPlanAir['AgencyMarkUp'] = $val['FairRules']['FixedMarkUp'];
$arrPlanAir['AgencyMarkUpGST'] = $val['FairRules']['GSTOnMarkUp'];
$arrPlanAir['GTXMarkUp'] = $val['FairRules']['intGTXMarkUp'];
$arrPlanAir['GTXMarkUpGST'] = $val['FairRules']['GTXMarkUpGST'];
$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['AgentCommisionEarned'] = $val['FairRules']['CommEarned'];
$arrPlanAirDes['AgentCommisionEarnedGST'] = $val['FairRules']['GSTonComm'];
$arrPlanAirDes['AgencyMarkUp'] = $val['FairRules']['FixedMarkUp'];
$arrPlanAirDes['AgencyMarkUpGST'] = $val['FairRules']['GSTOnMarkUp'];
$arrPlanAirDes['GTXMarkUp'] = $val['FairRules']['intGTXMarkUp'];
$arrPlanAirDes['GTXMarkUpGST'] = $val['FairRules']['GTXMarkUpGST'];
$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 saveGstDetailsAction()
{
if ($this->getRequest()->isPost()) {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$post = $this->getRequest()->getPost();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$CustomerMemberSysIds = new Zend_Session_Namespace('CustomerMemberSysIds');
$flight_booking_id = isset($CustomerMemberSysIds->params['flight_booking_id']) ? $CustomerMemberSysIds->params['flight_booking_id'] : 0;
$CustomerData = $CustomerSession->params;
$BookingData = $FlightBookingData->params;
$objFlight = new Travel_Model_FlightMaster();
$companyname = isset($post['companyname']) ? $post['companyname'] : '';
$gstnnumber = isset($post['gstnnumber']) ? $post['gstnnumber'] : '';
$gstaddress = isset($post['gstaddress']) ? $post['gstaddress'] : '';
$gstemail = isset($post['gstemail']) ? $post['gstemail'] : '';
$gststate = isset($post['gststate']) ? $post['gststate'] : '';
$gstphone = isset($post['gstphone']) ? $post['gstphone'] : '';
$isgstapply = isset($post['isgstapply']) ? $post['isgstapply'] : 0;
$traceId = $post['traceId'];
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($gstemail))) {
$response = array('succes' => false, 'msg' => 'Please enter registered email.', 'index' => 'gstemail');
echo json_encode($response);
exit;
}
if (!filter_var($gstemail, FILTER_VALIDATE_EMAIL)) {
$msg = "GST Email address is not valid.";
$response = array('success' => false, 'msg' => $msg, 'index' => 'gstemail');
echo json_encode($response);
exit;
}
if (empty(trim($gstphone))) {
$response = array('succes' => false, 'msg' => 'Please enter registered phone number.', 'index' => 'gstphone');
echo json_encode($response);
exit;
}
if (strlen(trim($gstphone)) != 10 && strlen(trim($gstphone)) != 11) {
$response = array('succes' => false, 'msg' => 'Please enter a valid GST phone number.', 'index' => 'gstphone');
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;
}
}
$CustomerData[0]['gstnnumber'] = $gstnnumber;
$CustomerData[0]['companyname'] = $companyname;
$CustomerData[0]['gstemail'] = $gstemail;
$CustomerData[0]['gstphone'] = $gstphone;
$CustomerData[0]['gstaddress'] = $gstaddress;
$CustomerData[0]['gststate'] = $gststate;
if ($flight_booking_id) {
$update = array(
'gstnnumber' => $gstnnumber,
'companyname' => $companyname,
'gstemail' => $gstemail,
'gstphone' => $gstphone,
'gstaddress' => $gstaddress,
'gststate' => $gststate,
);
foreach ($flight_booking_id as $booking_id) {
$where = "id = " . $booking_id; //exit;
$objFlight->UpdateFlightData('tbl_flight_booking', $update, $where);
}
}
$CustomerSession->params = $CustomerData;
$response = array('success' => true, 'msg' => 'Done', 'apiTraceId' => $traceId);
echo json_encode($response);
exit;
}
}
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];
}
if (!empty($returnDate)) {
$arrreturnDates = explode("/", $returnDate);
$returnDatesAD = $arrreturnDates[2] . "-" . $arrreturnDates[1] . "-" . $arrreturnDates[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'] : 'Noida';
$CountrySysId = isset($post['passenger-country-1']) ? $post['passenger-country-1'] : '';
$passengerAddress = isset($post['passenger-address-1']) ? $post['passenger-address-1'] : 'Noida Sector 64';
$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] ? $post['relation-' . $i] : 'Other';
$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($passengerDob)) {
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 (isset($passengerDob)) {
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($returnDate)) {
$lasttraveldate = $returnDatesAD;
} else {
$lasttraveldate = $departureDatesAD;
}
if (isset($passengerDob)) {
if (!empty($paxType) && $paxType == 3) {
$infantAge = date_diff(date_create($passengerDob), date_create($lasttraveldate))->y;
if ($infantAge >= 2) {
$response = array('succes' => false, 'msg' => "Infant age should be less than 2 years as on travel date " . $lasttraveldate, 'index' => 'dobyear' . $i);
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()
{
header('Access-Control-Allow-Origin: ' . $this->baseUrl . '');
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$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');
////######################### New Code###########################
$key = $getData['data']['key'];
$Code = $getData['data']['Code'];
$Baggage = [];
$Meal = [];
if ($FlightBookingData->params) {
foreach ($FlightBookingData->params as $value) {
$Baggage[] = $value['Baggage'];
$Meal[] = $value['Meal'];
}
}
if ($Meal) {
foreach ($Meal as $ml) {
if ($ml) {
foreach ($ml as $mlv) {
if ($Code == $mlv['Code'] && $key == $mlv['key']) {
//$mlv['check'] = 'pppp';
$getData['data'] = $mlv;
}
}
}
}
}
if ($Baggage) {
foreach ($Baggage as $bg) {
if ($bg) {
foreach ($bg as $bgv) {
if ($Code == $bgv['Code'] && $key == $bgv['key']) {
$bgv['check'] = 'pppp';
$getData['data'] = $bgv;
}
}
}
}
}
////######################### New Code###########################
//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);
//echo"<pre>";print_r($BaggFare);die;
$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' => number_format(ceil($MobilePublishedFare), 2), 'html' => $bodyText);
echo json_encode($response);
exit;
//print_r($getData);
} else {
die('Page not found');
}
}
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();
Zend_Session::namespaceUnset('FlightSeatSession');
Zend_Session::namespaceUnset('selectedSeatSession');
// echo '<pre>';print_r($FlightBookingData->params);die;
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);
// echo '<pre>';print_r($apiResponse);die('d');
$ResponseStatus = $apiResponse['status']['success'];
$ErrorMessage = isset($apiResponse['errors'][0]['message']) ? $apiResponse['errors'][0]['message'] : '';
try {
if ($ResponseStatus == 1) {
$alerts = isset($apiResponse['alerts']) ? $apiResponse['alerts'] : '';
$this->UpdateFlightBookingData($apiResponse, $alerts);
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
//echo '<pre>';print_r($FlightBookingData->params); die;
$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'];
}
}
$SSRArr = array('Meal' => $Meal, 'Baggage' => $Baggage, 'SeatPreference' => array());
$flightSSRDetails = new Zend_Session_Namespace('flightSSRDetails');
$flightSSRDetails->params = $SSRArr;
$FareChange = false;
if ($newFare != $oldFare) {
$FareChange = true;
}
// echo '<pre>';print_r($FlightBookingData->params);
$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(ceil($intPublishedFare)), 'SSRArr' => $SSRArr, 'SSRArrInb' => [], 'apiResponse' => $FlightBookingData->params);
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => $ErrorMessage, 'FareChange' => false, 'html' => '');
echo json_encode($response);
exit;
}
} catch (Exception $e) {
//$this->db->rollBack();
print_r($e->getMessage());
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);
$AdditionalMarkup = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAdditionalMarkup();
$faretypeArr = $AdditionalMarkup['faretypeArr'];
//echo"<pre>";print_r($apiResponse);die;
$strTraceId = !empty($apiResponse['TraceId']) ? $apiResponse['TraceId'] : '';
if ($interNationalSearch == 1 && $strFlightRoute == 2) {
$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' => $strFlightRoute,
'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';
$isGSTMandatory = isset($data['conditions']['gst']['igm']) ? $data['conditions']['gst']['igm'] : false;
$isDobAdult = isset($data['conditions']['dob']['adobr']) ? $data['conditions']['dob']['adobr'] : false;
$isDobChild = isset($data['conditions']['dob']['cdobr']) ? $data['conditions']['dob']['cdobr'] : false;
$isDobInfant = isset($data['conditions']['dob']['idobr']) ? $data['conditions']['dob']['idobr'] : false;
$isSeatAppli = isset($data['conditions']['isa']) ? $data['conditions']['isa'] : false;
$bookingId = $data['bookingId'];
if ($data['tripInfos']) {
$alerts = isset($data['alerts']) ? $data['alerts'] : [];
$IsPassMandatory = isset($data['conditions']['pcs']['pm']) ? $data['conditions']['pcs']['pm'] : false;
$IsPassExpiry = isset($data['conditions']['pcs']['pped']) ? $data['conditions']['pcs']['pped'] : false;
$IsPassIssue = isset($data['conditions']['pcs']['pid']) ? $data['conditions']['pcs']['pid'] : false;
$IsPassDateOfBirth = isset($data['conditions']['pcs']['dobe']) ? $data['conditions']['pcs']['dobe'] : false;
$isGSTMandatory = isset($data['conditions']['gst']['igm']) ? $data['conditions']['gst']['igm'] : false;
$isDobAdult = isset($data['conditions']['dob']['adobr']) ? $data['conditions']['dob']['adobr'] : false;
$isDobChild = isset($data['conditions']['dob']['cdobr']) ? $data['conditions']['dob']['cdobr'] : false;
$isDobInfant = isset($data['conditions']['dob']['idobr']) ? $data['conditions']['dob']['idobr'] : false;
$TempArr['onward'] = $data['tripInfos'][0];
$TempArr['return'] = $data['tripInfos'][1];
$totalPriceListArr = array_merge($TempArr['onward']['totalPriceList'], $TempArr['return']['totalPriceList']);
$SegmentInformation = array_merge($TempArr['onward']['sI'], $TempArr['return']['sI']);
$totalPriceList = current($totalPriceListArr);
$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';
}
$arrSegments = [];
$FlyingMinutes = 0;
$TotalLAYOVERMinutes = 0;
$LAYOVERCityArr = [];
$PublishedFare = 0;
$OfferedFare = 0;
$PublishedFareINT = 0;
$intTotalGST = 0;
$apiMarkup = 0;
$IntCommission = 0;
$apiTaxOnMarkup = 0;
$IntAgencyFixMarkUp = 0;
$IntTaxOnAgencyFixMarkUp = 0;
$intCommisionEarnedForAgency = 0;
$intGTXMarkUp = 0;
$intSTaxOnGTXMarkUp = 0;
$intTdsOnPLB = 0;
$intCommissionEarned = 0;
$intPublishedFare = 0;
$intMUFee = 0;
$intCarrierMiscFee = 0;
$intAirlineGSTComponent = 0;
$intManagementFeeTax = 0;
$intServiceFee = 0;
$intOtherCharges = 0;
$intYQTax = 0;
$intTaxIN = 0;
$intBaseFareIN = 0;
$intnewFare = 0;
$intoldFare = 0;
$BaseFare = 0;
$Tax = 0;
$YQTax = 0;
$OtherCharges = 0;
$ServiceFee = 0;
$FareBreakdown = [];
$FairRulesArr = [];
$arrMarkUpsArray = [];
foreach ($data['tripInfos'] as $key => $result) {
if ($key == 0) {
$intJourneyType = 1;
} else {
$intJourneyType = 2;
}
$BookingData = $FlightBookingData->params[$key];
$alertsFare = isset($alerts[$key]) ? $alerts[$key] : [];
$newFare = isset($alertsFare['newFare']) ? $alertsFare['newFare'] : 0;
$oldFare = isset($alertsFare['oldFare']) ? $alertsFare['oldFare'] : 0;
$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;
$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(
"segmentid" => $segments['id'],
"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]['IsPassMandatory'] = $IsPassMandatory;
$arrInsertFlightData[$key]['IsPassExpiry'] = $IsPassExpiry;
$arrInsertFlightData[$key]['IsPassIssue'] = $IsPassIssue;
$arrInsertFlightData[$key]['IsPassDateOfBirth'] = $IsPassDateOfBirth;
$arrInsertFlightData[$key]['isGSTMandatory'] = $isGSTMandatory;
$arrInsertFlightData[$key]['isDobAdult'] = $isDobAdult;
$arrInsertFlightData[$key]['isDobChild'] = $isDobChild;
$arrInsertFlightData[$key]['isDobInfant'] = $isDobInfant;
$arrInsertFlightData[$key]['isSeatAppli'] = $isSeatAppli;
$arrInsertFlightData[$key]['strTraceId'] = $strTraceId;
$arrInsertFlightData[$key]['arrCommonInsVariables'] = $arrCommonInsVariables;
$arrAirlineName[] = $AirlineCode . '-' . $strAirlineName;
$AttPriceRange[] = $PublishedFare;
$FiltStopCount[] = $StopCountTxt;
$arrInsertFlightData[$key]['FilterPrice'] = ''; //$FilterPrice;
}
$Segments = [];
if ($totalPriceListArr) {
foreach ($totalPriceListArr as $kp => $price) {
//echo"<pre>";print_r($price);die;
$fareDetail = $price['fd'];
$alertsFare = isset($alerts[$kp]) ? $alerts[$kp] : [];
$newFare = isset($alertsFare['newFare']) ? $alertsFare['newFare'] : 0;
$oldFare = isset($alertsFare['oldFare']) ? $alertsFare['oldFare'] : 0;
//echo '<pre>';print_r(($fareDetail));echo '</pre>';
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
$AddMarkup = isset($AdditionalMarkup['finalArr'][$fareIdentifier]) ? $AdditionalMarkup['finalArr'][$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
$ADULTNCMTOT = isset($fareDetail['ADULT']['afC']['NCM']['OT']) ? $fareDetail['ADULT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$CHILDNCMTOT = isset($fareDetail['CHILD']['afC']['NCM']['OT']) ? $fareDetail['CHILD']['afC']['NCM']['OT'] : 0; //- Gross Commission
$INFANTNCMTOT = isset($fareDetail['INFANT']['afC']['NCM']['OT']) ? $fareDetail['INFANT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$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));
//$NetCommission = (($ADULTNCMTOT * $adultCount) + ($CHILDNCMTOT * $childCount) + ($INFANTNCMTOT * $infantCount));
//$PublishedFareIN = $NetFare;
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $NetFare,
'intCommissionEarned' => $CommissionEarned,
'TdsOnPLB' => $TdsOnPLB,
'MUFee' => $MUFee,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
//echo '<pre>';print_r(($markUpArr));echo '</pre>';
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArr);
$arrMarkUpsArray[] = $arrMarkUps;
//echo '<pre>';print_r(($arrMarkUps));echo '</pre>';
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($ADULT['TF'] * $adultCount),
'OfferedFare' => ($ADULT['NF'] * $adultCount),
'intCommissionEarned' => ($ADULT['NCM'] * $adultCount),
'TdsOnPLB' => ($ADULTNCMTDS * $adultCount),
'MUFee' => ($AD_MU * $adultCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $adultCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] += ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] += ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['intTotalGST'] += $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[0]['apiMarkup'] += $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[0]['IntCommission'] += $arrMarkUpsBR['IntCommission'];
$FareBreakdown[0]['apiTaxOnMarkup'] += $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[0]['FixedMarkUp'] += $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[0]['GSTOnMarkUp'] += $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[0]['CommEarned'] += $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[0]['GSTonComm'] += 0;
$FareBreakdown[0]['intGTXMarkUp'] += $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[0]['GTXMarkUpGST'] += $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($CHILD['TF'] * $childCount),
'OfferedFare' => ($CHILD['NF'] * $childCount),
'intCommissionEarned' => ($CHILD['NCM'] * $childCount),
'TdsOnPLB' => ($CHILDNCMTDS * $childCount),
'MUFee' => ($CH_MU * $childCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $childCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] += ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] += ($arrMarkUpsBR['BaseFareCal']);
$FareBreakdown[1]['BaseFare'] += ($CHILD['BF'] * $childCount);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['intTotalGST'] += $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[1]['apiMarkup'] += $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[1]['IntCommission'] += $arrMarkUpsBR['IntCommission'];
$FareBreakdown[1]['apiTaxOnMarkup'] += $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[1]['FixedMarkUp'] += $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[1]['GSTOnMarkUp'] += $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[1]['CommEarned'] += $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[1]['GSTonComm'] += 0;
$FareBreakdown[1]['intGTXMarkUp'] += $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[1]['GTXMarkUpGST'] += $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($INFANT['TF'] * $infantCount),
'OfferedFare' => ($INFANT['NF'] * $infantCount),
'intCommissionEarned' => ($INFANT['NCM'] * $infantCount),
'TdsOnPLB' => ($INFANTNCMTDS * $infantCount),
'MUFee' => ($IN_MU * $infantCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $infantCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] += ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] += ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['intTotalGST'] += $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[2]['apiMarkup'] += $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[2]['IntCommission'] += $arrMarkUpsBR['IntCommission'];
$FareBreakdown[2]['apiTaxOnMarkup'] += $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[2]['FixedMarkUp'] += $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[2]['GSTOnMarkUp'] += $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[2]['CommEarned'] += $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[2]['GSTonComm'] += 0;
$FareBreakdown[2]['intGTXMarkUp'] += $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[2]['GTXMarkUpGST'] += $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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 ;
}
$PublishedFareINT += ($arrMarkUps['PublishFare'] * $this->CurrencyRate);
$OfferedFare += $arrMarkUps['intOfferedFare'];
$intTotalGST += $arrMarkUps['intTotalGST'];
$apiMarkup += $arrMarkUps['apiMarkup'];
$IntCommission += $arrMarkUps['IntCommission'];
$apiTaxOnMarkup += $arrMarkUps['apiTaxOnMarkup'];
$IntAgencyFixMarkUp += $arrMarkUps['IntAgencyFixMarkUp'];
$IntTaxOnAgencyFixMarkUp += $arrMarkUps['IntTaxOnAgencyFixMarkUp'];
$intCommisionEarnedForAgency += $arrMarkUps['intCommisionEarnedForAgency'];
$intGTXMarkUp += $arrMarkUps['intGTXMarkUp'];
$intSTaxOnGTXMarkUp += $arrMarkUps['intSTaxOnGTXMarkUp'];
$AddiTaxOnMarkup += $arrMarkUps['AddiTaxOnMarkup'];
$AddiMarkup += $arrMarkUps['AddiMarkup'];
$intTdsOnPLB += $TdsOnPLB;
$intCommissionEarned += $CommissionEarned;
$intPublishedFare += $PublishedFareIN;
$intMUFee += $MUFee;
$intCarrierMiscFee += $CarrierMiscFee;
$intAirlineGSTComponent += $AirlineGSTComponent;
$intManagementFeeTax += $ManagementFeeTax;
$intServiceFee += $ServiceFee;
$intOtherCharges += $OtherCharges;
$intYQTax += $YQTax;
$intTaxIN += $TaxIN;
$intBaseFareIN += $BaseFareIN;
$intnewFare += $newFare;
$intoldFare += $oldFare;
$seg = $arrInsertFlightData[$kp]['Segments'];
//echo '<pre>';print_r($seg);echo '</pre>';
$Segments[] = $seg;
}
$FairRulesArr = array(
"Currency" => $this->CurrencyTitle, //$Currency,
"CurrencyRate" => $this->CurrencyRate, //$Currency,
"currencySysId" => $this->CurrencyId,
"BaseFare" => $intBaseFareIN,
"Tax" => $intTaxIN,
"YQTax" => $intYQTax,
"OtherCharges" => $intOtherCharges,
"Discount" => 0, //$Discount,
"ServiceFee" => $intServiceFee,
"ManagementFeeTax" => $intManagementFeeTax,
"AirlineGSTComponent" => $intAirlineGSTComponent,
"CarrierMiscFee" => $intCarrierMiscFee,
"MUFee" => $intMUFee,
"intPublishedFare" => $intPublishedFare,
"PublishedFare" => ($PublishedFareINT * $this->CurrencyRate),
"OfferedFare" => $OfferedFare,
"CommissionEarned" => $intCommissionEarned,
"PLBEarned" => $PLBEarned,
"IncentiveEarned" => $IncentiveEarned,
"TdsOnPLB" => $intTdsOnPLB,
"TdsOnIncentive" => 0,
"AdditionalTxnFeeOfrd" => 0,
"AdditionalTxnFeePub" => 0,
"Refundable" => $Refundable,
"IsRefundableTxt" => $IsRefundableTxt,
"PriceID" => $PriceID,
"IsGSTRequired" => $IsGSTRequired,
"isDobAdult" => $isDobAdult,
"isDobChild" => $isDobChild,
"isDobInfant" => $isDobInfant,
"fareIdentifier" => str_replace('_', ' ', $fareIdentifier),
"FareClass" => $fareDetail['ADULT']['cc'],
"AddiMarkup" => $AddiMarkup,
"AddiTaxOnMarkup" => $AddiTaxOnMarkup,
"intTotalGST" => $intTotalGST,
"apiMarkup" => $apiMarkup,
"IntCommission" => $IntCommission,
"apiTaxOnMarkup" => $apiTaxOnMarkup,
"FixedMarkUp" => $IntAgencyFixMarkUp,
"GSTOnMarkUp" => $IntTaxOnAgencyFixMarkUp,
"CommEarned" => $intCommisionEarnedForAgency,
"GSTonComm" => 0,
"intGTXMarkUp" => $intGTXMarkUp,
"GTXMarkUpGST" => $intSTaxOnGTXMarkUp,
"newFare" => $intnewFare,
"oldFare" => $intoldFare,
"FareBreakdown" => $FareBreakdown,
);
}
}
$arrInsertFlightData[0]['FairRules'] = $FairRulesArr;
$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'] = $FairRulesArr['PublishedFare'];
$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'] = $FairRulesArr;
$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($arrInsertFlightData);
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingData->params = $arrInsertFlightData;
return $arrInsertFlightData;
} else {
$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' => $strFlightRoute,
'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 = $strFlightRoute;
$arrInsertFlightData = [];
$BaggageArr = [];
$MealArr = [];
$bookingId = $data['bookingId'];
$alerts = isset($data['alerts']) ? $data['alerts'] : [];
$isGSTMandatory = isset($data['conditions']['gst']['igm']) ? $data['conditions']['gst']['igm'] : false;
$isDobAdult = isset($data['conditions']['dob']['adobr']) ? $data['conditions']['dob']['adobr'] : false;
$isDobChild = isset($data['conditions']['dob']['cdobr']) ? $data['conditions']['dob']['cdobr'] : false;
$isDobInfant = isset($data['conditions']['dob']['idobr']) ? $data['conditions']['dob']['idobr'] : false;
$isSeatAppli = isset($data['conditions']['isa']) ? $data['conditions']['isa'] : 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] : [];
$newFare = isset($alertsFare['newFare']) ? $alertsFare['newFare'] : 0;
$oldFare = isset($alertsFare['oldFare']) ? $alertsFare['oldFare'] : 0;
$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;
$FareBreakdown = [];
$FairRulesArr = [];
array_multisort($result['totalPriceList']);
if ($result['totalPriceList']) {
foreach ($result['totalPriceList'] as $kp => $price) {
$fareDetail = $price['fd'];
//echo '<pre>';print_r(($fareDetail));echo '</pre>';
$Refundable = $fareDetail['ADULT']['rT'];
$PriceID = $price['id'];
$fareIdentifier = $price['fareIdentifier'];
$AddMarkup = isset($AdditionalMarkup['finalArr'][$fareIdentifier]) ? $AdditionalMarkup['finalArr'][$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
$ADULTNCMTOT = isset($fareDetail['ADULT']['afC']['NCM']['OT']) ? $fareDetail['ADULT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$CHILDNCMTOT = isset($fareDetail['CHILD']['afC']['NCM']['OT']) ? $fareDetail['CHILD']['afC']['NCM']['OT'] : 0; //- Gross Commission
$INFANTNCMTOT = isset($fareDetail['INFANT']['afC']['NCM']['OT']) ? $fareDetail['INFANT']['afC']['NCM']['OT'] : 0; //- Gross Commission
$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));
//$NetCommission = (($ADULTNCMTOT * $adultCount) + ($CHILDNCMTOT * $childCount) + ($INFANTNCMTOT * $infantCount));
//$PublishedFareIN = $NetFare;
$PublishedFare = $PublishedFareIN;
$CommissionEarned = $NetCommission;
$PLBEarned = 0; //$result['Fare']['PLBEarned'];
$IncentiveEarned = 0; //$result['Fare']['IncentiveEarned'];
$OfferedFare = $PublishedFareIN;
$markUpArr = array(
'getMarkup' => $getMarkup,
'PublishedFare' => $PublishedFare,
'OfferedFare' => $NetFare,
'intCommissionEarned' => $CommissionEarned,
'TdsOnPLB' => $TdsOnPLB,
'MUFee' => $MUFee,
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $intMemberCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
//echo '<pre>';print_r(($markUpArr));echo '</pre>';
$arrMarkUps = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArr);
//echo '<pre>';print_r(($arrMarkUps));echo '</pre>';
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($ADULT['TF'] * $adultCount),
'OfferedFare' => ($ADULT['NF'] * $adultCount),
'intCommissionEarned' => ($ADULT['NCM'] * $adultCount),
'TdsOnPLB' => ($ADULTNCMTDS * $adultCount),
'MUFee' => ($AD_MU * $adultCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $adultCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[0]['Currency'] = 'INR';
$FareBreakdown[0]['PassengerType'] = 1;
$FareBreakdown[0]['PassengerCount'] = $adultCount;
$FareBreakdown[0]['TaxIN'] = ($ADULT['TAF'] * $adultCount);
$FareBreakdown[0]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
//$FareBreakdown[0]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[0]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[0]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[0]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[0]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[0]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[0]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[0]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[0]['GSTonComm'] = 0;
$FareBreakdown[0]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[0]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($CHILD['TF'] * $childCount),
'OfferedFare' => ($CHILD['NF'] * $childCount),
'intCommissionEarned' => ($CHILD['NCM'] * $childCount),
'TdsOnPLB' => ($CHILDNCMTDS * $childCount),
'MUFee' => ($CH_MU * $childCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $childCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[1]['Currency'] = 'INR';
$FareBreakdown[1]['PassengerType'] = 2;
$FareBreakdown[1]['PassengerCount'] = $childCount;
$FareBreakdown[1]['TaxIN'] = ($CHILD['TAF'] * $childCount);
$FareBreakdown[1]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$FareBreakdown[1]['BaseFare'] = ($CHILD['BF'] * $childCount);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
//$FareBreakdown[1]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[1]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[1]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[1]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[1]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[1]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[1]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[1]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[1]['GSTonComm'] = 0;
$FareBreakdown[1]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[1]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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'])) {
$markUpArrBR = array(
'getMarkup' => $getMarkup,
'PublishedFare' => ($INFANT['TF'] * $infantCount),
'OfferedFare' => ($INFANT['NF'] * $infantCount),
'intCommissionEarned' => ($INFANT['NCM'] * $infantCount),
'TdsOnPLB' => ($INFANTNCMTDS * $infantCount),
'MUFee' => ($IN_MU * $infantCount),
'intPLBEarned' => $PLBEarned,
'intIncentiveEarned' => $IncentiveEarned,
'intMemberCount' => $infantCount,
'intFlightRoute' => $strFlightRoute,
'interNationalSearch' => $interNationalSearch,
'AddMarkup' => $AddMarkup,
);
$arrMarkUpsBR = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->calculateMarkup($markUpArrBR);
$FareBreakdown[2]['Currency'] = 'INR';
$FareBreakdown[2]['PassengerType'] = 3;
$FareBreakdown[2]['PassengerCount'] = $infantCount;
$FareBreakdown[2]['TaxIN'] = ($INFANT['TAF'] * $infantCount);
$FareBreakdown[2]['BaseFareCal'] = ($arrMarkUpsBR['BaseFareCal']);
$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]['AddiTaxOnMarkup'] = ($arrMarkUpsBR['AddiTaxOnMarkup'] / $PaxTypeCount);
//$FareBreakdown[2]['AddiMarkup'] = ($arrMarkUpsBR['AddiMarkup'] / $PaxTypeCount);
$FareBreakdown[2]['intTotalGST'] = $arrMarkUpsBR['intTotalGST'];
$FareBreakdown[2]['apiMarkup'] = $arrMarkUpsBR['apiMarkup'];
$FareBreakdown[2]['IntCommission'] = $arrMarkUpsBR['IntCommission'];
$FareBreakdown[2]['apiTaxOnMarkup'] = $arrMarkUpsBR['apiTaxOnMarkup'];
$FareBreakdown[2]['FixedMarkUp'] = $arrMarkUpsBR['IntAgencyFixMarkUp'];
$FareBreakdown[2]['GSTOnMarkUp'] = $arrMarkUpsBR['IntTaxOnAgencyFixMarkUp'];
$FareBreakdown[2]['CommEarned'] = $arrMarkUpsBR['intCommisionEarnedForAgency'];
$FareBreakdown[2]['GSTonComm'] = 0;
$FareBreakdown[2]['intGTXMarkUp'] = $arrMarkUpsBR['intGTXMarkUp'];
$FareBreakdown[2]['GTXMarkUpGST'] = $arrMarkUpsBR['intSTaxOnGTXMarkUp'];
$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" => ($arrMarkUps['PublishFare'] * $this->CurrencyRate),
"OfferedFare" => $arrMarkUps['intOfferedFare'],
"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'],
"intTotalGST" => $arrMarkUps['intTotalGST'],
"apiMarkup" => $arrMarkUps['apiMarkup'],
"IntCommission" => $arrMarkUps['IntCommission'],
"apiTaxOnMarkup" => $arrMarkUps['apiTaxOnMarkup'],
"FixedMarkUp" => $arrMarkUps['IntAgencyFixMarkUp'],
"GSTOnMarkUp" => $arrMarkUps['IntTaxOnAgencyFixMarkUp'],
"CommEarned" => $arrMarkUps['intCommisionEarnedForAgency'],
"GSTonComm" => 0,
"intGTXMarkUp" => $arrMarkUps['intGTXMarkUp'],
"GTXMarkUpGST" => $arrMarkUps['intSTaxOnGTXMarkUp'],
"newFare" => $newFare,
"oldFare" => $oldFare,
"FareBreakdown" => $FareBreakdown,
"arrMarkUps" => $arrMarkUps,
);
}
}
$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(
"segmentid" => $segments['id'],
"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]['isDobAdult'] = $isDobAdult;
$arrInsertFlightData[$key]['isDobChild'] = $isDobChild;
$arrInsertFlightData[$key]['isDobInfant'] = $isDobInfant;
$arrInsertFlightData[$key]['isSeatAppli'] = $isSeatAppli;
$arrInsertFlightData[$key]['strTraceId'] = $strTraceId;
$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;
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingData->params = $arrInsertFlightData;
return $arrInsertFlightData;
}
}
public function getseatpageAction()
{
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$this->view->FlightBookingData = $FlightBookingData;
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('FlightBookingData' => $FlightBookingData->params, 'CurrencyTitle' => $this->CurrencyTitle, 'CurrencyRate' => $this->CurrencyRate));
$bodyText = $html->render('getseatpage.phtml');
$response = array('success' => true, 'message' => 'Done', 'html' => $bodyText);
echo json_encode($response);
exit;
//echo '<pre>';print_r($getData);die;
}
public function seatmapAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$getData = $this->getRequest()->getParams();
$segmentid = $getData['segmentid'];
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$bookingId = $FlightBookingData->params[0]['bookingId'];
$data = ['bookingId' => $bookingId];
//Zend_Session::namespaceUnset('FlightSeatSession');die('d');
$FlightSeatSession = new Zend_Session_Namespace('FlightSeatSession');
if (empty($FlightSeatSession->params)) {
$apiResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetSeatMapFlightsTripJack($data);
} else {
$apiResponse = $FlightSeatSession->params;
}
// echo '<pre>';
// print_r($apiResponse);
// die('test');
// echo '</pre>';
$SegmentsArr = [];
if ($FlightBookingData->params) {
foreach ($FlightBookingData->params as $Datass) {
if ($Datass['Segments']) {
foreach ($Datass['Segments'] as $keys => $value) {
$SegmentsArr[$value['segmentid']] = $value;
}
}
}
}
$this->view->apiResponse = $apiResponse;
$this->view->segmentid = $segmentid;
$this->view->SegmentsArr = $SegmentsArr;
$this->view->baseUrl = $this->baseUrl;
$this->view->CustomerSession = $CustomerSession->params;
$this->view->CurrencyTitle = $this->CurrencyTitle;
} else {
die('Page not found!');
}
}
public function continuewithseatmapAction()
{
header('Access-Control-Allow-Origin: ' . $this->baseUrl . '');
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$this->_helper->layout->disableLayout();
$getData = $this->getRequest()->getParams();
//echo"<pre>";print_r($getData);die;
//Zend_Session::namespaceUnset('selectedSeatSession');die;
$segmentid = $getData['segmentid'];
$seatArray = $getData['seatArray'];
$paxTypeArr = $getData['paxTypeArr'];
$CustomerSysIdArray = $getData['CustomerSysIdArray'];
$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');
$CustomerSession = new Zend_Session_Namespace('CustomerSession');
$selectedSeatSession = new Zend_Session_Namespace('selectedSeatSession');
$bookingId = $FlightBookingData->params[0]['bookingId'];
$data = ['bookingId' => $bookingId];
$FlightSeatSession = new Zend_Session_Namespace('FlightSeatSession');
$tripSeat = $FlightSeatSession->params['tripSeatMap']['tripSeat'];
$value = $tripSeat[$segmentid];
$sInfo = $value['sInfo'];
$items = [];
foreach ($sInfo as $k => $val) {
$items[$val['seatNo']] = array(
'seatNo' => $val['seatNo'],
'amount' => $val['amount'],
'isBooked' => $val['isBooked'],
'isLegroom' => isset($val['isLegroom']) ? $val['isLegroom'] : 0,
'code' => $val['code'],
'isAisle' => isset($val['isAisle']) ? $val['isAisle'] : 0,
);
}
$selectedSeat = [];
$SelectedSegment = [];
if ($CustomerSysIdArray) {
foreach ($CustomerSysIdArray as $keys => $CustomerSysId) {
$seatNo = $seatArray[$keys];
$paxType = $paxTypeArr[$keys];
$SelectedSegment[] = $paxType . ':' . $seatNo;
foreach ($sInfo as $k => $val) {
if ($val['seatNo'] == $seatNo) {
$selectedSeat[$segmentid][$CustomerSysId] = $val;
}
}
}
}
//echo '<pre>';print_r(implode(', ',$SelectedSegment));die;
if (!empty($selectedSeatSession->params)) {
foreach ($selectedSeatSession->params as $segid => $value) {
$index = 0;
if ($segid == $segmentid) {
foreach ($value as $CustomerId => $val) {
$seatNo = $seatArray[$index];
$itemsdata = $items[$seatNo];
if (trim($val['seatNo']) == trim($seatNo)) {
$selectedSeatSession->params[$segmentid][$CustomerId] = $val;
} else {
$selectedSeatSession->params[$segmentid][$CustomerId] = $itemsdata;
}
$index++;
}
} else {
if ($CustomerSysIdArray) {
foreach ($CustomerSysIdArray as $keys => $CustomerSysId) {
$seatNo = $seatArray[$keys];
foreach ($sInfo as $k => $val) {
if ($val['seatNo'] == $seatNo) {
$selectedSeatSession->params[$segmentid][$CustomerSysId] = $val;
}
}
}
}
}
}
} else {
$selectedSeatSession->params = $selectedSeat;
}
$BagPrice = 0;
$InbBagPrice = 0;
$MealPrice = 0;
$InbMealPrice = 0;
$SeatPrice = 0;
if ($SelectedBaggSessionNew->params) {
foreach ($SelectedBaggSessionNew->params as $values) {
$BagPrice += $values['Price'];
}
}
if ($SelectedMealSessionNew->params) {
foreach ($SelectedMealSessionNew->params as $values) {
$MealPrice += $values['Price'];
}
}
if ($SelectedMealSessionNewInb->params) {
foreach ($SelectedMealSessionNewInb->params as $val) {
$InbMealPrice += $val['Price'];
}
}
if ($SelectedBaggSessionNewInb->params) {
foreach ($SelectedBaggSessionNewInb->params as $val) {
$InbBagPrice += $val['Price'];
}
}
if ($selectedSeatSession->params) {
foreach ($selectedSeatSession->params as $values) {
foreach ($values as $val) {
$SeatPrice += $val['amount'];
}
}
}
//echo"<pre>";print_r($SeatPrice);die;
$MealFare = ($MealPrice + $InbMealPrice);
$BaggFare = ($BagPrice + $InbBagPrice);
$intNetPublishedFare = 0;
if ($FlightBookingData) {
foreach ($FlightBookingData->params as $value) {
$intNetPublishedFare += $value['FairRules']['PublishedFare'];
}
}
// echo '<pre>';print_r($BaggFare);
// echo '<pre>';print_r($MealFare);
// echo '<pre>';print_r($SeatPrice);
$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 + $SeatPrice);
//echo"<pre>";print_r($MobilePublishedFare);die;
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('apiResponse' => $FlightBookingData->params, 'apiResponseInbound' => $FlightBookingDataInbound->params, 'CurrencyTitle' => $this->CurrencyTitle, 'CurrencyRate' => $this->CurrencyRate));
$bodyText = $html->render('getflightfarequote.phtml');
$response = array('success' => true, 'message' => 'Done', 'SelectedSegment' => implode(', ', $SelectedSegment), 'MobilePublishedFare' => number_format(ceil($MobilePublishedFare), 2), 'html' => $bodyText);
echo json_encode($response);
exit;
} else {
die('Page not found!');
}
}
public function bookFlightAction()
{
//die('wait....');
$param = $this->getRequest()->getParams();
if ($param) {
$code = $this->getRequest()->getParam('code', NULL);
$traceId = $this->getRequest()->getParam('traceId', NULL);
if ($code != NULL && $traceId != NULL) {
$transactionResponse = new Travel_Model_TransactionResponse();
$transactionResponse->setRespHashKey($this->respHashKey);
$transactionResponse->setResponseEncypritonKey($this->aesResponseKey);
$transactionResponse->setSalt($this->aesResponseIv);
$returnPerameter = $transactionResponse->decryptResponseIntoArray($code);
$checkVal = $transactionResponse->validateResponse($returnPerameter);
if ($checkVal == true) {
$status = $returnPerameter["f_code"];
$decodePerameter = Zend_Json::decode(base64_decode($returnPerameter["udf9"]), true);
$idEncypted = $decodePerameter[5];
$encryptedData = new Travel_Model_AtomAES();
$id = $encryptedData->decrypt($idEncypted, SECURITYKEY, SECURITYKEY);
if ($status == 'Ok' && $id == trim($traceId)) {
$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->code = $code;
$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;
$objFlight = new Travel_Model_FlightMaster();
if ($route == 2) {
$bookTrace = explode(',', $param['traceId']);
$bookTraceId = $bookTrace[0];
} else {
$bookTraceId = $param['traceId'];
}
$CheckPaymentSTatus = $objFlight->CheckPaymentSTatus('tbl_flight_booking', $bookTraceId);
$paymentStatus = isset($CheckPaymentSTatus['paymentStatus']) ? $CheckPaymentSTatus['paymentStatus'] : 0;
if (empty($flight_booking_id)) {
$this->_redirect('flight/travellers/' . $param['traceId']);
}
if ($paymentStatus != 1) {
$this->_redirect('flight/add-onn-service/' . $param['traceId']);
}
$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'];
$TrxId = $FlightQueryids['arrIds']['TrxId'];
$SelectedMealSessionNew = new Zend_Session_Namespace('SelectedMealSessionNew');
$SelectedBaggSessionNew = new Zend_Session_Namespace('SelectedBaggSessionNew');
$SelectedMealSessionNewInb = new Zend_Session_Namespace('SelectedMealSessionNewInb');
$SelectedBaggSessionNewInb = new Zend_Session_Namespace('SelectedBaggSessionNewInb');
$selectedSeatSession = new Zend_Session_Namespace('selectedSeatSession');
$BagPrice = 0;
$InbBagPrice = 0;
$MealPrice = 0;
$InbMealPrice = 0;
$SeatPrice = 0;
if ($SelectedBaggSessionNew->params) {
foreach ($SelectedBaggSessionNew->params as $values) {
foreach ($values as $val) {
$BagPrice += $val['Price'];
}
}
}
if ($SelectedMealSessionNew->params) {
foreach ($SelectedMealSessionNew->params as $values) {
foreach ($values as $val) {
$MealPrice += $val['Price'];
}
}
}
$MealFare = ($MealPrice + $InbMealPrice);
$BaggFare = ($BagPrice + $InbBagPrice);
if ($this->getRequest()->isXmlHttpRequest() && $FlightBookingData->params) {
$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);
$BookStatus = $Bookres['status']['success'];
$BookErrorMessage = $Bookres['errors'][0]['message'];
if ($BookStatus == 1) {
$response = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->bookingDetailsTripJack($Bookres);
$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) {
$MealFare_Int = ($MealPrice + $InbMealPrice);
$BaggFare_Int = ($BagPrice + $InbBagPrice);
$SeatPriceInt = 0;
if ($selectedSeatSession->params) {
foreach ($selectedSeatSession->params as $values) {
foreach ($values as $val) {
$SeatPriceInt += $val['amount'];
}
}
}
$SeatFare_Int = ($SeatPriceInt);
$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 - $AgentCommisionEarnedINT);
$FareSummaryInt = array(
'PublishedFare' => ($PublishedFareINT + $BaggFare_Int + $MealFare_Int + $SeatFare_Int),
'AgentCommisionEarned' => $AgentCommisionEarnedINT,
'AgentCommisionEarnedGST' => $AgentCommisionEarnedGSTINT,
'AgencyMarkUp' => $AgencyMarkUpINT,
'AgencyMarkUpGST' => $AgencyMarkUpGSTINT,
'GTXMarkUp' => $GTXMarkUpINT,
'BaseAmount' => ($BaseAmountINT + $BaggFare_Int + $MealFare_Int + $SeatFare_Int),
);
}
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;
}
$SeatPrice = 0;
if ($value['Segments']) {
foreach ($value['Segments'] as $seg) {
if (!empty($selectedSeatSession->params) && isset($selectedSeatSession->params[$seg['segmentid']]) && !empty($selectedSeatSession->params[$seg['segmentid']])) {
$selectedSeat = $selectedSeatSession->params[$seg['segmentid']];
foreach ($selectedSeat as $val) {
$SeatPrice += $val['amount'];
}
}
}
}
$SeatFare = $SeatPrice;
$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));
$BaseAmountINT = ($PublishedFareINT - $AgentCommisionEarnedINT);
if ($interNationalSearch == 1 && $route == 2) {
$FareSummary = $FareSummaryInt;
} else {
$FareSummary = array(
'PublishedFare' => ($PublishedFareINT + $BaggFare + $MealFare + $SeatFare),
'AgentCommisionEarned' => $AgentCommisionEarnedINT,
'AgentCommisionEarnedGST' => $AgentCommisionEarnedGSTINT,
'AgencyMarkUp' => $AgencyMarkUpINT,
'AgencyMarkUpGST' => $AgencyMarkUpGSTINT,
'GTXMarkUp' => $GTXMarkUpINT,
'BaseAmount' => ($BaseAmountINT + $BaggFare + $MealFare + $SeatFare),
);
}
$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,
'SeatFare' => $SeatFare,
);
//$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),
'FlightQueryids' => json_encode($FlightQueryids),
'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
);
$postFieldArray = array(
'MasterTPSysId' => $MasterTPSysId,
'TPSysId' => $TPSysId,
'TrxId' => $TrxId,
'VersionId' => $VersionId[$k],
'XRefBookingId' => $strBookingIdLCC,
'APIBookingRes' => json_encode($responseArray),
'FareSummaryAir' => json_encode($FareSummary),
'UpdateFare' => json_encode($UpdateFare),
'Passenger' => json_encode($Passenger),
'ErrorCode' => 0,
'IsBookingStatus' => 1,
);
//echo '<pre>';print_r($postFieldArray);
$strFilePath = "flight/updateFlightBookingDetails/" . time() . "_update_request.json";
Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, $postFieldArray);
$model = new Gtxwebservices_Model_Webservices();
$result = $model->updateFlightBookingDetails($postFieldArray);
//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;
}
}
}
}
} else {
die('Please contact to administrator');
}
} else {
die('Bad Request');
}
}
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');
if ($FlightBooking['data']['IsInternational'] == 1) {
$intCountryCode = 'INT';
} else {
$intCountryCode = 'IN';
}
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
$intMarkUp = $this->getMarkup($intCountryCode);
$arrAgencyUserDetail = isset($intMarkUp['arrAgencyUserDetail']) ? $intMarkUp['arrAgencyUserDetail'] : '';
$this->view->arrAgencyUserDetail = $arrAgencyUserDetail;
$this->view->getAgencyData = $getAgencyData;
$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 = [];
//$InvoiceNumber = $objFlight->FlightBookingDataTripJack('tbl_invoice', $param['bookingId']);
$FlightBooking = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 1);
$FlightBookingInb = $objFlight->FlightBookingDataTripJack('tbl_flight_booking', $param['bookingId'], 2);
$InvoiceNumber = $this->objMdl->rv_select_row('tbl_invoice', ['*'], ['Booking_Id' => $param['bookingId']], []);
//echo '<pre>';print_r($InvoiceNumber); die('s');
$gstnumber = $FlightBooking['data']['gstnnumber'];
//echo '<pre>';print_r($gstnumber);
// die('s');
$sitename = $this->siteName;
$this->view->gstnumber = $gstnumber;
$this->view->siteName = $sitename;
$this->view->InvoiceNumber = $InvoiceNumber;
$this->view->FlightBooking = $FlightBooking;
$this->view->FlightBookingInb = $FlightBookingInb;
$this->view->baseUrl = $this->baseUrl;
}
public function makepaymentAction()
{
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getPost();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$apiTraceId = $FlightBookingData->params[0]['apiTraceId'];
$data = new Travel_Model_FlightMaster();
$temp_data = $this->objMdl->selectOne('tbl_temp_data', ['*'], ['TraceId' => $param['apiTraceId']], ['id' => 'ASC']);
$arrUrlData = json_decode($temp_data['json_data'], true);
$CustomerSession = $arrUrlData['CustomerSession'];
$flight_booking_id_Arr = $arrUrlData['flight_booking_id_Arr'];
$verifying = isset($param['verifying']) ? $param['verifying'] : '';
if (!empty($verifying) && $verifying == 'true' && $this->getRequest()->isXmlHttpRequest()) {
$checkFlightOTP = $data->CheckPaymentSTatus('tbl_flight_booking', $apiTraceId);
// echo '<pre>';
// print_r($param);
// print_r($checkFlightOTP);
// die('s');
$OTPNumber = isset($param['OTPNumber']) ? $param['OTPNumber'] : '';
if ($checkFlightOTP['generateOTP'] == $OTPNumber) {
$update = array(
'generateOTP' => 1,
);
if ($flight_booking_id_Arr) {
foreach ($flight_booking_id_Arr as $valid) {
$where = "id = '" . $valid . "'";
$data->UpdateFlightData('tbl_flight_booking', $update, $where);
}
}
$response = array('success' => true, 'paynow' => true);
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'Invalid otp', 'paynow' => false);
echo json_encode($response);
exit;
}
}
$generateNumericOTP = $this->generateNumericOTP(6);
$update = array(
'generateOTP' => $generateNumericOTP,
);
if ($flight_booking_id_Arr) {
foreach ($flight_booking_id_Arr as $valid) {
$where = "id = '" . $valid . "'";
$data->UpdateFlightData('tbl_flight_booking', $update, $where);
}
}
$MobileNumber = $CustomerSession[0]['countryCode'] . $CustomerSession[0]['Contacts'];
//
$message = "Hi,\nUse $generateNumericOTP as OTP (One Time Password) to verify your mobile number. Do not share this OTP with anyone for security reason.\nThanks\n$this->siteName\nTRVCRM";
if ($MobileNumber) {
$this->postFields = "";
$this->postFields .= "&method=$this->SMSMETHOD";
$this->postFields .= "&api_key=$this->SMSAPIKEY";
$this->postFields .= "&sender=$this->SMSSENDER";
$this->postFields .= "&message=$message";
$this->postFields .= "&format=$this->SMSFORMAT";
$this->postFields .= "&to=" . substr($MobileNumber, -10);
$postURL = $this->SMSURL;
$resultVal = $data->sendSmsDetails($postURL, $this->postFields, array('AgencySysId' => 1), $this->IsSMSApi, $param['TraceId']);
$hidePhoneNumberDigit = $this->hidePhoneNumberDigit($MobileNumber, 1);
echo json_encode(["success" => true, 'message' => 'success', 'hidePhoneNumberDigit' => $hidePhoneNumberDigit]);
exit;
} else {
echo json_encode(["success" => false, 'message' => 'Unbale to pay please contact with our support team.']);
exit;
}
}
}
public function generateNumericOTP($n)
{
$generator = "1357902468";
$result = "";
for ($i = 1; $i <= $n; $i++) {
$result .= substr($generator, (rand() % (strlen($generator))), 1);
}
// Return result
return $result;
}
public function hidePhoneNumberDigit($phone, $type = 0)
{
$result = substr($phone, 0, 3);
$result .= "****";
$result .= substr($phone, 9, 4);
if ($type == 1) {
return $result;
} else {
return $phone;
}
}
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');
$selectedSeatSession = new Zend_Session_Namespace('selectedSeatSession');
$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;
//echo '<pre>';print_r($ResponseFlightQuery->params);die('sss');
if ($this->getRequest()->isXmlHttpRequest() && $FlightBookingData->params) {
$objFlight = new Travel_Model_FlightMaster();
$SelectedMealSessionNew = new Zend_Session_Namespace('SelectedMealSessionNew');
$SelectedBaggSessionNew = new Zend_Session_Namespace('SelectedBaggSessionNew');
$SelectedMealSessionNewInb = new Zend_Session_Namespace('SelectedMealSessionNewInb');
$SelectedBaggSessionNewInb = new Zend_Session_Namespace('SelectedBaggSessionNewInb');
$selectedSeatSession = new Zend_Session_Namespace('selectedSeatSession');
$apiTraceId = $FlightBookingData->params[0]['apiTraceId'];
$checkFlightOTP = $objFlight->CheckPaymentSTatus('tbl_flight_booking', $apiTraceId);
$generateOTP = isset($checkFlightOTP['generateOTP']) ? $checkFlightOTP['generateOTP'] : 0;
if ($generateOTP != 1) {
echo json_encode(["success" => false, 'redirect' => true, 'message' => 'OTP not verified. contact with our support team.']);
exit;
}
$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'];
}
}
$SeatPrice = 0;
if ($selectedSeatSession->params) {
foreach ($selectedSeatSession->params as $values) {
foreach ($values as $val) {
$SeatPrice += $val['amount'];
}
}
}
$MealFare = ($MealPrice + $InbMealPrice);
$BaggFare = ($BagPrice + $InbBagPrice);
$TempData = array(
'BookingData' => $BookingData,
'flight_booking_id_Arr' => $flight_booking_id,
'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,
'selectedSeatSession' => $selectedSeatSession->params,
'_sessiondata' => $this->_session->session,
);
//echo'<pre>';print_r($TempData);die;
$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 + $SeatPrice);
$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));
$encryptedData = new Travel_Model_AtomAES();
$lastInsertId = $encryptedData->encrypt($lastInsertId, SECURITYKEY, SECURITYKEY);
$FLBookingID = base64_encode(implode(',', $flight_booking_id)); //$param['traceId']; //$this->GUID();
$guid = $this->GUID();
$walletCode = $this->walletCode($AgentSysId, $guid, ceil($PublishedFare), $AgencySysId, $intTPSysId, $intCustSysId, $encryptMarkUpData);
$strReturnURL = $this->baseUrl . "flight/check-payment";
echo json_encode(["success" => true, 'guid' => $guid, 'amount' => ceil($PublishedFare), 'walletCode' => $walletCode, 'stringData' => $encryptMarkUpData, 'strReturnURL' => $strReturnURL, 'lastInsertId' => $lastInsertId, 'FLBookingID' => $FLBookingID, '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()->getPost();
//Write Request Logs starts...
$strFilePath = "payment/log/" . date('Y-m-d-H-i-s') . "_response.json";
Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, json_encode($param));
if (!empty($param)) {
$transactionResponse = new Travel_Model_TransactionResponse();
$transactionResponse->setRespHashKey($this->respHashKey);
$transactionResponse->setResponseEncypritonKey($this->aesResponseKey);
$transactionResponse->setSalt($this->aesResponseIv);
$returnPerameter = $transactionResponse->decryptResponseIntoArray($param['encdata']);
$checkVal = $transactionResponse->validateResponse($returnPerameter);
if ($checkVal == true) {
$status = $returnPerameter["f_code"];
$mer_txn = $returnPerameter["mer_txn"];
$decodePerameter = Zend_Json::decode(base64_decode($returnPerameter["udf9"]), true);
$id = $decodePerameter[5];
$TrxId = $decodePerameter[6];
$TrxId = explode(',', base64_decode($TrxId));
$GUID = $returnPerameter['mmp_txn'];
$error = $returnPerameter['error'];
$error_Message = $returnPerameter['desc'];
$objFlight = new Travel_Model_FlightMaster();
$arrPayment = [
"error_Message" => $error_Message,
"error" => $mer_txn,
"GUID" => $GUID,
];
$encryptedData = new Travel_Model_AtomAES();
$id = $encryptedData->decrypt($id, SECURITYKEY, SECURITYKEY);
$temp_data = $this->objMdl->selectOne('tbl_temp_data', ['*'], ['TraceId' => $id], ['id' => 'ASC']);
$response = json_decode($temp_data['json_data'], true);
//echo "<pre>";print_r($returnPerameter);die;
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$FlightBookingData->params = $response['BookingData'];
$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'];
$selectedSeatSession = new Zend_Session_Namespace('selectedSeatSession');
$selectedSeatSession->params = $response['selectedSeatSession'];
$user = new Zend_Session_Namespace('User');
$user->session = $response['_sessiondata'];
$bookingidd = $response['BookingData'][0]['bookingId'];
$ResponseFlightQuery = new Zend_Session_Namespace('ResponseFlightQuery');
$FlightQueryids = $ResponseFlightQuery->params;
$MasterTPSysId = $FlightQueryids['arrIds']['MasterTPSysId'];
$TPSysId = $FlightQueryids['arrIds']['TPSysId'];
$VersionId = $FlightQueryids['arrIds']['VersionId'];
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);
}
$this->genrateinvoice($bookingidd);
if ($updated) {
$this->_redirect('flight/book-flight/' . $id . '/' . $param['encdata']);
}
} elseif ($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);
}
//if ($updated) {
$this->_redirect('flight/payment-failed/' . $id);
//}
}
}
} else {
echo 'Please contact to administrator';
exit;
}
} else {
die('Bad Request');
}
}
public function paymentFailedAction()
{
$param = $this->getRequest()->getParams();
//echo"<pre>";print_r($param);die;
$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'];
//echo"<pre>";print_r($param['id']);die;
$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;
}
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();
//echo"<pre>";print_r($param);die;
$this->view->traceId = $param['TraceId'];
$objFlight = new Travel_Model_FlightMaster();
$searchtrace = array('apiTraceId' => $param['TraceId']);
//echo $param['TraceId'];exit;
$FlightBookingInb = [];
$FlightBooking = $objFlight->PeningFlightBookingDataTripJack('tbl_flight_booking', $param['TraceId'], 1);
$FlightBookingInb = $objFlight->PeningFlightBookingDataTripJack('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($FlightBooking); die('trst');
//echo '<pre>';print_r($BookingData);
// die;
}
}
public function viewDetailsPendingAction()
{
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 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" => 'CANCELLATION', //$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'];
//
}
public function submitAmendmentAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
//$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
//echo"<pre>";print_r($getAgencyData);die;
$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'];
$objFlight = new Travel_Model_FlightMaster();
$ChangeResponse = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->GetSubmitAmendment($data);
//$SubmitAmendment = new Zend_Session_Namespace('SubmitAmendment');
//$ChangeResponse = $SubmitAmendment->params;
//echo"<pre>";print_r($ChangeResponse);die;
$intChangeRequestStatus = $ChangeResponse['status']['success'];
$strErrorMessage = $ChangeResponse['status']['httpStatus'];
//$FlightBooking = $objFlight->FlightCancelDataTripJack('tbl_flight_booking', $param['bookingId'], $ChangeResponse['amendmentId']);
//echo"<pre>";print_r($FlightBooking);die;
if ($intChangeRequestStatus == 1) {
$update = array(
"ChangeRequestId" => ($ChangeResponse['amendmentId']),
"status" => ($requestType == 1) ? 6 : 7,
);
$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);
}
}
//echo"<pre>";print_r($PaxDetails);die;
$FlightBooking = $objFlight->FlightCancelDataTripJack('tbl_flight_booking', $param['bookingId'], $ChangeResponse['amendmentId']);
//echo"<pre>";print_r($FlightBooking);die;
if (!empty($FlightBooking['data'])) {
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
//echo"<pre>";print_r($getAgencyData);die;
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/flight/');
$html->assign(array('FlightBooking' => $FlightBooking, 'param' => $param, 'bookingId' => $param['bookingId'], 'getAgencyData' => $getAgencyData, 'CurrencyRate' => $this->CurrencyRate, 'CurrencyTitle' => $this->CurrencyTitle, 'baseUrl' => $this->baseUrl));
$bodyText = $html->render('cancelmailer.phtml');
$contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
$subject = 'Cancellation request received - ' . $param['bookingId'];
$Caption = 'Cancellation request received - ' . $param['bookingId'];
$configs = [
'to' => trim($FlightBooking['passenger'][0]['EmailId']),
'fromName' => $this->siteName,
'fromEmail' => $contactDetail_mail['email'],
'subject' => $subject,
'bodyHtml' => $bodyText,
];
$returnmail = $this->objHelperGeneral->mailSentByElastice($configs, $Caption);
}
$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);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$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);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$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);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$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;
}
}
public function farebreackupmobileAction()
{
$this->_helper->layout->disableLayout();
$param = $this->getRequest()->getParams();
$FlightBookingData = new Zend_Session_Namespace('FlightBookingData');
$this->view->CurrencyRate = $this->CurrencyRate;
$this->view->FlightBookingData = $FlightBookingData->params;
}
public function getCountryCodeList()
{
$url = $this->baseUrl . "public/data/static/country.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$str = curl_exec($ch);
// $str = file_get_contents($this->baseUrl.'public/data/dynamic/AirPortCodeList.json');
$response = json_decode($str, true);
return $response;
}
public function getsetcityAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$flightsourcedestin = $this->objMdl->rv_select_all('tbl_flight', ['*'], ['IsActive' => 1, 'isMarkForDel' => 0], ['order_by' => 'ASC'], 20);
// echo "<pre>";
// echo ($flightsourcedestin);
// die;
$array = array();
foreach ($flightsourcedestin as $key => $flightcode) {
$data = json_decode($flightcode['city_json'], true);
$explode = explode(',', $data['label']);
$explodenew = explode('(', $explode[1]);
$finalair = explode('-', $explodenew[0]);
if (isset($finalair[1])) {
$airportsname = $finalair[1];
} else {
$airportsname = $finalair[0];
}
$dataenc['AirportCode'] = $data['AirportCode'];
$dataenc['CityID'] = $data['CityID'];
$dataenc['ContSysId'] = $data['ContSysId'];
$dataenc['ICAO'] = $data['ICAO'];
$dataenc['CountryCode'] = $data['CountryCode'];
$dataenc['DO'] = $data['DO'];
$dataenc['cn'] = $data['cn'];
$dataenc['label'] = $data['label'];
$array[] = $dataenc;
}
$arrContextOptions = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
);
//echo "<pre>"; print_r($arrContextOptions); die('test43543www');
$str = file_get_contents($this->baseUrl . 'public/data/dynamic/flight_destinations.json', false, stream_context_create($arrContextOptions));
// echo "<pre>";
// echo ($arrContextOptions);
// die('test');
$array2 = json_decode($str, true);
$finalArray = array_merge($array, $array2);
$input = $this->multi_unique($finalArray);
$response = json_encode(array_values($input));
echo $response;
//echo "<pre>"; print_r($finalArray); die('test43543www');
exit;
}
public function multi_unique($array)
{
foreach ($array as $k => $na) {
$new[$k] = serialize($na);
}
$uniq = array_unique($new);
foreach ($uniq as $k => $ser) {
$new1[$k] = unserialize($ser);
}
return ($new1);
}
public function genrateinvoice($bookingId)
{
//$bookingId;
$objFlight = new Travel_Model_FlightMaster();
$invoicedata = $objFlight->getInvoice('tbl_invoice');
$prein = $invoicedata['InvoiceNumber'];
$array = explode('-', $prein);
$number = 000000;
$invnumber = $number + $array[1] + 1;
$nub = sprintf("%06d", $invnumber);
$inv = "INV-" . $nub;
//echo"<pre>";print_r($inv);die;
$arrinvoice['InvoiceNumber'] = $inv;
$arrinvoice['Booking_Id'] = $bookingId;
$response = $objFlight->InsertFlightData('tbl_invoice', $arrinvoice);
//echo"<pre>";print_r($response);die;
return $response;
}
}