| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/application/controllers/ |
Upload File : |
<?php
/**
* Class BulkPackageController
*
* @name Bulk Package
* @author Praveen Kumar
* @created 18 Nov 2016
* @updated 18 Nov 2016
* @version 1.0
* @copyright Catabatic India Pvt Ltd
* Handle bulk package functions
*
*/
class BulkPackageController extends Catabatic_ValidateGtx {
const ADMIN_ID = 1;
const CONST_SOURCE_ADMIN = 3;
private $intLoggedinUserId = '';
private $intLoggedinUserGroupSysId = '';
private $intLoggedinUserAgencySysId = '';
private $intLoggedinUserTrxCurrency = '';
public $baseUrl = '';
public function init() {
parent::init();
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->siteUrl = $aConfig['bootstrap']['siteUrl'];
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$this->_newpkgmodelObj = new Travel_Model_Package_PackageModel();
//Zend_Session::rememberMe(60 * 60 * 24 * 7);
$sessionLogin_user->lock();
// unlocking read-only lock
$this->SupplierTypeSysId = 5;
$this->intLoggedinUserId = $sessionLogin_user->intLoggedinUserId;
$this->intLoggedinUserGroupSysId = $sessionLogin_user->intLoggedinUserGroupSysId;
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
$this->intLoggedinUserTrxCurrency = $sessionLogin_user->intLoggedinUserTrxCurrency;
$this->_crmcusttravelplan = new Travel_Model_CRM_CustomerTravelPlan();
if (!empty($this->intLoggedinUserAgencySysId)) {
$this->InfoSourceSysId = '2'; // Information Source is Agent //
}
if ($sessionLogin_user->isLocked()) {
$sessionLogin_user->unLock();
}
$this->_HtmlPurifier = new Zend_Filter_HtmlPurifier();
}
public function indexAction()
{
$objPackage = new Travel_Model_TblPackage();
//Get Currency List
$this->view->arrCurrencyTypes = $objPackage->getCurrencyList();
$packageThemeList = $objPackage->getPackageThemeList();
$this->view->packageThemeList = $packageThemeList;
$packageInclList = $objPackage->getPackageInclusionList();
$this->view->packageInclList = $packageInclList;
$objHotelRooms = new Travel_Model_TblHotelRooms();
$arrHotelRoomTypes = $objHotelRooms->getRoomTypes();
//echo "<pre>"; print_r($arrHotelRoomTypes);die;
$this->view->arrHotelRoomTypes = $arrHotelRoomTypes;
$objAgency = new Travel_Model_TblAgency();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$packageTncList = $objAgency->getAgencyTnCDetails($intLoggedinUserAgencySysId);
// echo '<pre>'; print_r($packageTncList); echo '</pre>';
$this->view->packageTncList = $packageTncList;
//For display message
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function saveBulkPackageAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if ($this->getRequest()->isPost()) {
$post = $this->getRequest()->getPost();
if ($post) {
// echo "<pre>"; print_r($post);die;
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$intLoggedinUserSysId = $this->intLoggedinUserId;
$currentDate = date('Y-m-d H:i:s');
$objPackage = new Travel_Model_TblPackage();
$packageThemeList = $objPackage->getPackageThemeList();
$packageInclList = $objPackage->getPackageInclusionList();
$fromcurrency = @$post['currency_type'];
$tocurrency = $this->intLoggedinUserTrxCurrency;
if(!empty(@$post['PackTypeMask']))
{
$thememask = '1';
$char = '';
for ($u = 0; $u < count($packageThemeList); $u++) {
$char = in_array(@$packageThemeList[$u]['PackType'], @$post['PackTypeMask']) ? '1' : '0';
$thememask.= $char;
}
} else {
$thememask = '0';
}
if(!empty(@$post['InclMask']))
{
$char = '';
$inclmask = '1';
for ($v = 0; $v < count($packageInclList); $v++) {
$char = in_array(@$packageInclList[$v]['InclId'], @$post['InclMask']) ? '1' : '0';
$inclmask.= $char;
}
} else {
$inclmask = '0';
}
$objBulkPackage = new Travel_Model_TblBulkPackage();
$travel_plan_details = $objBulkPackage->getTravelPlanLastId();
$TPSysId_last = @substr($travel_plan_details['TPSysId'],0,9);
// echo "<pre>"; print_r($travel_plan_details); die;
for ($j = 0; $j < count(@$post['hotelId']); $j++) {
//echo $j+1; echo "<br/>";
$increment_id = $j+1;
$hotelId = @$post['hotelId'][$j];
if($hotelId!='' && $hotelId>0)
{
$hotelKeyName = @$post['hotelKeyName'][$j];
$hotel_name_key = $this->sanitize_data_str($hotelKeyName);
$city_name_key = $this->sanitize_data_str(@$post['CityKeyName']);
$final_hotel_name_key = @substr($hotel_name_key,0,45);
$final_city_name_key = @substr($city_name_key,0,25);
$nightNo = @$post['nightNo'];
$dayNo = $nightNo + 1;
$tp_lastid_final = $TPSysId_last + $increment_id;
// $package_name = $nightNo.'N/'.$dayNo.'D - '.$final_hotel_name_key.'_'.$final_city_name_key.'_'.$tp_lastid_final;
$package_name = $hotelKeyName;
$hotelStar = (int) @$post['hidden_selected_hotel_star'][$j];
if($hotelStar<=3) {
$EconomyMask = 1;
} else if($hotelStar==4){
$EconomyMask = 2;
} else if($hotelStar==5) {
$EconomyMask = 3;
}
if(!empty($_FILES['fileField']['name']))
{
$upload = new Zend_File_Transfer_Adapter_Http();
$files = $upload->getFileInfo();
$db_file_name = $_FILES['fileField']['name'];
$file_ext = @end(explode(".",$_FILES['fileField']['name']));
$file_name = $this->sanitize_data_str($package_name).'.'.$file_ext;
$tmp_name = $_FILES['fileField']['tmp_name'];
//File Upload Directory Path
$upload_dir = "public/upload/package/";
$file_upload_dir = "\public\upload\package/";
$file_path = $_SERVER['DOCUMENT_ROOT'] .$file_upload_dir;
if(!is_dir($file_path)){
//Directory does not exist, so lets create it.
@mkdir($file_path, 0777, true);
}
$upload_file = $file_path.$file_name;
$db_upload_file = $this->siteUrl.$upload_dir.$file_name;
$toupload = @move_uploaded_file($tmp_name,$upload_file);
}
else {
$db_file_name = '';
$db_upload_file = '';
}
$roomType = @$post['roomType'][$j];
$strFromDate = @$post['from_date'][$j];
$strToDate = @$post['to_date'][$j];
$strPkgSellValidTill = @$post['PkgSellValidTill'][$j];
$StartDate = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->cal2Db($strFromDate,'d/m/y');
$ValidTill = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->cal2Db($strToDate,'d/m/y');
$PkgSellValidTill = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->cal2Db($strPkgSellValidTill,'d/m/y');
$Min_Price_Range = !empty(@$post['Min_Price_Range'][$j]) ? $post['Min_Price_Range'][$j] : '0';
$Max_Price_Range = !empty(@$post['Max_Price_Range'][$j]) ? $post['Max_Price_Range'][$j] : '0';
if($Min_Price_Range!='' && $Max_Price_Range!='')
{
$PriceRange = $Min_Price_Range.'-'.$Max_Price_Range;
} else {
$PriceRange =0;
}
$CostSO = !empty(@$post['CostSO'][$j]) ? $post['CostSO'][$j] : '0';
$ExNightCostSO = !empty(@$post['ExNightCostSO'][$j]) ? @$post['ExNightCostSO'][$j] : '0';
$CostDO = !empty(@$post['CostDO'][$j]) ? @$post['CostDO'][$j] : '0';
$ExNightCostDO = !empty(@$post['ExNightCostDO'][$j]) ? @$post['ExNightCostDO'][$j] : '0';
$CostTO = !empty(@$post['CostTO'][$j]) ? @$post['CostTO'][$j] : '0';
$ExNightCostTO = !empty(@$post['ExNightCostTO'][$j]) ? @$post['ExNightCostTO'][$j] : '0';
$CostExtraBed = !empty(@$post['CostExtraBed'][$j]) ? @$post['CostExtraBed'][$j] : '0';
$ExNightCostExtraBed = !empty(@$post['ExNightCostExtraBed'][$j]) ? @$post['ExNightCostExtraBed'][$j] :'0';
$CostWithoutBed = !empty(@$post['CostWithoutBed'][$j]) ? @$post['CostWithoutBed'][$j] : '0';
$ExNightCostWithoutBed = !empty(@$post['ExNightCostWithoutBed'][$j]) ? @$post['ExNightCostWithoutBed'][$j] : '0';
$taxtype = !empty(@$post['taxtype'][$j]) ? @$post['taxtype'][$j] : 'Included';
$taxValue = !empty(@$post['taxres'][$j]) ? @$post['taxres'][$j] : '0';
// echo $CostTO.'====='.$j.'</br>';
//Travel Plan Array
$flexiPackage = array('AgencySysId' => $intLoggedinUserAgencySysId,
'AgentSysId' => $intLoggedinUserSysId,
'SupplierSysId' => isset($post['supplier_type_id']) ? $post['supplier_type_id'] : '0',
'MetaKeywords'=>'',
'TPCode' => '0',
'PackRangeType' => '2',
'Title' => !empty($package_name) ? $package_name : '',
'MinPax' => !empty($post['minpax']) ? $post['minpax'] : '0',
'EconomyMask' => !empty($EconomyMask) ? $EconomyMask : '0',
'PackTypeMask' => @$thememask,
'InclCatMask' => '0',
'InclMask' => @$inclmask,
'ExclusionMask' => '0',
'PackSpecType' => '2',
'SeasonMask' => '0',
'GeoType' => '0',
'IsFixDatePlan' => '0',
'IsFixPlan' => '0',
'Details' => !empty($post['detail']) ? $post['detail'] : '',
'ImageTN' => '',
'ImgForList' => '',
'ImgeDetails' => '',
'StartDate' => @$StartDate,
'ValidTill' => @$ValidTill,
'PkgSellValidTill' => @$PkgSellValidTill,
'Price' => '0',
'CurrencyType' => !empty($tocurrency) ? $tocurrency : '1',
'DiscountMsg' => '',
'DiscountType' => !empty($post['discounttype']) ? $post['discounttype'] : '0',
'DiscountVal' => !empty($post['discountval']) ? $post['discountval'] : '0',
'NetPrice' => '0',
'MinPrice' => '0',
'PriceRange' => @$PriceRange,
'AdvBookingPercent' => !empty($post['advancerule']) ? $post['advancerule'] : '0',
'AdvBookingDays' => !empty($post['balancerule']) ? $post['balancerule'] : '0',
'Rating' => '0',
'URL' => '',
'TotalMinDays' => '0',
'TotalMaxDays' => '0',
'Hotels' => '',
'PopularPlaces' => '',
'Cities' => isset($post['CityKeyName']) ? $post['CityKeyName'] : '',
'Countries' => '',
'TravelInsurance' => '0',
'Readymade' => isset($post['Readymade']) ? $post['Readymade'] : '1',
'RefDocTitle' => $db_file_name,
'RefDocPath' => $db_upload_file,
'TemplatePckSysId' => '0',
'UpdateDate' => @$currentDate,
'CreateDate' => @$currentDate,
'ApproveDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1',
'IsAprooved' => '1'
);
//echo "<pre>"; print_r($flexiPackage); die;
//Add package data insert in travel plan
$intLastInsertId = $objPackage->addFlexiPackage($flexiPackage);
//Add data for days wise
for ($k = 0; $k < @$dayNo; $k++) {
//Travel Plan Itenary Array
$hotelItenaryDataArr = array(
'TPSysId' => @$intLastInsertId,
'Sequence' => $k+1,
'AgencySysId' => @$intLoggedinUserAgencySysId,
'Title' => @$package_name,
'Details' => isset($post['detail']) ? $post['detail'] : '0',
'InclMask' => @$inclmask,
'ExclusionMask' => '0',
'InclCatMask' => '0',
'PackInclMask' => @$thememask,
'PackTypeMask' => @$thememask,
'ImageTN' => '0',
'ImgForList' => '0',
'ImgeDetails' => '0',
'StartDate' => @$StartDate,
'EndDate' => @$ValidTill,
'Rating' => '0',
'TotalMinDays' => '0',
'TotalMaxDays' => '0',
'Hotels' => '0',
'PopularPlaces' => '0',
'CitySysId' => isset($post['CitySysId']) ? $post['CitySysId'] : '0',
'Cities' => isset($post['CityKeyName']) ? $post['CityKeyName'] : '',
'Countries' => isset($post['CountrySysId']) ? $post['CountrySysId'] : '0',
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1'
);
//echo "<pre>"; print_r($hotelItenaryDataArr);
$newInsertIdItenaryPlanId = $objPackage->addFlexiPackageIten($hotelItenaryDataArr);
//echo $newInsertIdItenaryPlanId;
//Travel Plan Places Array
$placesDataArr = array(
'TPSysId' => @$intLastInsertId,
'TPIntSysId' => @$newInsertIdItenaryPlanId,
'PlaceSysId' => isset($post['CitySysId']) ? $post['CitySysId'] : '0',
'AgencySysId' => @$intLoggedinUserAgencySysId,
'Sequence' => $k+1,
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1'
);
//echo "<pre>"; print_r($placesDataArr);
$placesId = $objPackage->insertData('TB_TravelPlan_Itenary_Places', $placesDataArr);
//Travel Itenary Accom Plan Array
$hotelDataArr = array(
'TPIntSysId' => @$newInsertIdItenaryPlanId,
'SeqId' => $k+1,
'AgencySysId' => @$intLoggedinUserAgencySysId,
'InvnItemSysId' => '0',
'AccoSysId' => @$hotelId,
'XrefInvtSysId' => '0',
'RoomType' => $roomType,
'RoomNumber' => '0',
'Title' => @$hotelKeyName,
'CheckInTime' => '00:00:00',
'CheckOutTime' => '00:00:00',
'XRefCityId' => isset($post['CitySysId']) ? $post['CitySysId'] : '0',
'FromDate' => @$StartDate,
'ToDate' => @$ValidTill,
'TotalPax' => '0',
'TotalNights' => '0',
'StarRating' => @$hotelStar,
'CurrencyType' => isset($post['currency_type']) ? $post['currency_type'] : '0',
'TotalCostGen' => '0',
'TotalCostSO' => '0',
'TotalCostDO' => '0',
'TotalCostTO' => '0',
'Discounts' => '0',
'Taxes' => '0',
'NetCost' => '0',
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1',
'IsSelectedOnPkg' => 1
);
//echo "<pre>"; print_r($hotelDataArr);
$hotId = $objPackage->insertData('TB_TravelPlan_Itenary_Accom', $hotelDataArr);
//Add acctivities and sightseeing for second day
if($k==1)
{
/** ****************Activity Array****************************** */
for ($q = 0; $q < count(@$post['act']); $q++) {
$rdtarr1 = array();
$rdtarr1 = explode("-", @$post['act'][$q]);
$resactid = @$rdtarr1[0];
$resacttitle = @$rdtarr1[1];
$ActDataArr = array(
'TPIntSysId' => @$newInsertIdItenaryPlanId,
'Sequence' => $q+1,
'AgencySysId' => @$intLoggedinUserAgencySysId,
'InvnItemSysId'=>'0',
'TPActivitySysId' => @$resactid,
'CurrencyType' => isset($post['currency_type']) ? $post['currency_type'] : '0',
'Title' => @$resacttitle,
'Type' => 'Included',
'CityId' => isset($post['CitySysId']) ? $post['CitySysId'] : '0',
'Cost' => '0',
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1'
);
//echo "<pre>"; print_r($ActDataArr);
$aId = $objPackage->insertData('TB_TravelPlan_Itenary_Events', $ActDataArr);
}
/******************Sightseeing Array*******************************/
for ($r = 0; $r < count(@$post['sight']); $r++) {
$sirdtarr1 = array();
$sirdtarr1 = explode("-", @$post['sight'][$r]);
$sstid = @$sirdtarr1[0];
$sstitle = @$sirdtarr1[1];
$sightseeingDataArr = array(
'InvnItemSysId' => @$newInsertIdItenaryPlanId,
'SeqId' => $r+1,
'XrefInvnItemSysId' => '0',
'SSSysId' => @$sstid,
'AgencySysId' => @$intLoggedinUserAgencySysId,
'Title' => @$sstitle,
'Type' => 'Included',
'CityId' => isset($post['CitySysId']) ? $post['CitySysId'] : '0',
'Cost' => '0',
'FromDate' => @$currentDate,
'ToDate' => @$currentDate,
'BookingType' => '0',
'Qty' => '0',
'IfAnyOffer' => '0',
'OfferMsg' => '0',
'OfferImage' => '0',
'IxFixedDateInven' => '0',
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDelete' => '0',
'IsActive' => '1'
);
//echo "<pre>"; print_r($sightseeingDataArr);
$ssId = $objPackage->insertData('TB_TravelPlan_SightSeeing', $sightseeingDataArr);
}
/******************TravelPlan Itenary Accom Extension Array*******************************/
$ItenaryAccomExtensionArr = array(
'TPIntSysId' => @$newInsertIdItenaryPlanId,
'SeqId' => '2',
'VersionId' => '0',
'AgencySysId' => @$intLoggedinUserAgencySysId,
'AccoSysId' => @$hotelId,
'RoomType' => @$roomType,
'RoomNumber' => '0',
'Title' => '',
'XRefCityId' => isset($post['CitySysId']) ? $post['CitySysId'] : '0',
'FromDate' => @$currentDate,
'ToDate' => @$currentDate,
'TotalPax' => '0',
'TotalNights' => @$nightNo,
'CurrencyType' => isset($post['currency_type']) ? $post['currency_type'] : '0',
'TotalCostSO' => @$ExNightCostSO,
'TotalCostDO' => @$ExNightCostDO,
'TotalCostTO' => @$ExNightCostTO,
'TotalCostWithBed' => @$ExNightCostExtraBed,
'TotalCostWithoutBed' => @$ExNightCostWithoutBed,
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1'
);
//echo "<pre>"; print_r($ItenaryAccomExtensionArr);
$accomExtenId = $objPackage->insertData('TB_TravelPlan_Itenary_Accom_Extension', $ItenaryAccomExtensionArr);
}
}
//end code for days wise data
/******************Terms & Conditions Array*******************************/
$tncdata = array(
'TPIntSysId' => @$intLastInsertId,
'AgencySysId' => @$intLoggedinUserAgencySysId,
'Inclusions' => !empty($post['Inclusions']) ? $post['Inclusions'] : '',
'Exclusions' => !empty($post['Exclusions']) ? $post['Exclusions'] : '',
'CancellationPolicy' => !empty($post['CancellationPolicy']) ? $post['CancellationPolicy'] : '',
'TravelBasics' => !empty($post['TravelBasics']) ? $post['TravelBasics'] : '',
'TermsAndConditions' => !empty($post['TermsnConditions']) ? $post['TermsnConditions'] : '',
'BookingTerms' => !empty($post['BookingTerms']) ? $post['BookingTerms'] : '',
'WhyUseUs' => !empty($post['WhyUseUs']) ? $post['WhyUseUs'] : '',
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1'
);
//echo "<pre>"; print_r($tncdata);
$tncId = $objPackage->insertData('TB_TravelPlan_Terms_Conditions', $tncdata);
/******************Travel Rate Array*******************************/
$travelRateArr = array(
'TPSysId' => @$intLastInsertId,
'StartDate' => @$StartDate,
'ValidTill' => @$ValidTill,
'MasterRefId' => '0',
'CurrencyType' => isset($post['currency_type']) ? $post['currency_type'] : '0',
'CostDO' => @$CostDO,
'CostSO' => @$CostSO,
'CostTO' => @$CostTO,
'CostExtraBed' => @$CostExtraBed,
'CostWithoutBed' => @$CostWithoutBed,
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1',
'IsAprooved' => '1'
);
//echo "<pre>"; print_r($travelRateArr);
$rateId = $objPackage->insertData('TB_TravelPlan_Rate', $travelRateArr);
/******************Travel Market Wise Rate Array*******************************/
for ($p = 0; $p < count(@$post['ComssnType']); $p++) {
$ComssnType = @$post['ComssnType'][$p];
$marketPlaceVal = $post['marketPlace'][$p];
$markettarr1 = array();
$markettarr1 = @explode("_", @$marketPlaceVal);
$marketPlaceId = @$markettarr1[0];
$marketPlaceName = @$markettarr1[1];
$markupValue = !empty($post['markup'][$p]) ? $post['markup'][$p] : 0;
if(@$markupValue>0)
{
$objPackage = new Travel_Model_TblPackage();
$exchangerate = $objPackage->currencyExchangeRate($fromcurrency, $tocurrency);
$CostSOnewRate = $this->_helper->Package->convertRatetoBaseCurrency($CostSO,$exchangerate);
$CostSOMarkup = $this->_helper->Package->calculateMarkUp($CostSOnewRate, $ComssnType, $markupValue);
$TotalCostSO = $CostSOnewRate + $CostSOMarkup;
$CostDOnewRate = $this->_helper->Package->convertRatetoBaseCurrency($CostDO,$exchangerate);
$CostDOMarkup = $this->_helper->Package->calculateMarkUp($CostDOnewRate, $ComssnType, $markupValue);
$TotalCostDO = $CostDOnewRate + $CostDOMarkup;
$CostTOnewRate = $this->_helper->Package->convertRatetoBaseCurrency($CostTO,$exchangerate);
$CostTOMarkup = $this->_helper->Package->calculateMarkUp($CostTOnewRate, $ComssnType, $markupValue);
$TotalCostTO = $CostTOnewRate + $CostTOMarkup;
$CostExtraBednewRate = $this->_helper->Package->convertRatetoBaseCurrency($CostExtraBed,$exchangerate);
$CostExtraBedMarkup = $this->_helper->Package->calculateMarkUp($CostExtraBednewRate, $ComssnType, $markupValue);
$TotalCostExtraBed = $CostExtraBednewRate + $CostExtraBedMarkup;
$CostWithoutBednewRate = $this->_helper->Package->convertRatetoBaseCurrency($CostWithoutBed,$exchangerate);
$CostWithoutBedMarkup = $this->_helper->Package->calculateMarkUp($CostWithoutBednewRate, $ComssnType, $markupValue);
$TotalCostWithoutBed = $CostWithoutBednewRate + $CostWithoutBedMarkup;
$travelMarketWiseRateArr = array(
'TPIntSysId' => @$intLastInsertId,
'AgencySysId' => @$intLoggedinUserAgencySysId,
'FromDate' => @$StartDate,
'ToDate' => @$ValidTill,
'CurrencyType' => isset($tocurrency) ? $tocurrency : '0',
'MarkType' => @$ComssnType,
'MarketPlaceId' => @$marketPlaceId,
'MarketPlace' => @$marketPlaceName,
'Permission' => '1',
'MarkPercent' => @$markupValue,
'CostPPSO' => @$TotalCostSO,
'CostPPDO' => @$TotalCostDO,
'CostPPTO' => @$TotalCostTO,
'CostExtraBed' => @$TotalCostExtraBed,
'CostChildWithoutBed' => @$TotalCostWithoutBed,
'Tax' => $taxtype,
'ExcludedPercent' => $taxValue,
'CreateDate' => @$currentDate,
'UpdateDate' => @$currentDate,
'IsMarkForDel' => '0',
'IsActive' => '1'
);
// echo "<pre>"; print_r($travelMarketWiseRateArr);
$marketwise_rateId = $objPackage->insertData('TB_TravelPlan_MarketWise_Rate', $travelMarketWiseRateArr);
}
}
}
} //reslastint
}
//Page redirection message display
$this->_helper->flashMessenger->addMessage("Bulk package saved successfully.");
$this->_helper->redirector('index', 'package', 'default');
}
}
public function getSupplierAutoSearchAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$strSupplierName = $this->getRequest()->getParam('term');
//echo $strFlightNo; exit;
$result = array();
$objSupplier = new Travel_Model_TblSupplier();
$AgentId = $this->intLoggedinUserId;
$SupplierTypeSysId = $this->SupplierTypeSysId;
$agencySysId = $this->intLoggedinUserAgencySysId;
$result = $objSupplier->getSupplierAutoSearchList($strSupplierName, $AgentId, '', $agencySysId);
//echo "<pre>";print_r($result);die;
echo $this->_helper->json($result);
exit;
}
}
public function sanitize_data_str($string)
{
$searchArr=array("iframe","script","document","write","alert","%","@","$",";","+","|","#","<",">",")","(","'","\'","/",",","and "," &","& ");
$input_data = strtolower($string);
$input_data = str_replace($searchArr,"",$input_data);
$input_data= str_replace(" ","_",$input_data);
//echo $input_data; die;
return $input_data;
}
public function getCityAutoSearchAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$strCityName = $this->getRequest()->getParam('term');
$strcountryId = $this->getRequest()->getParam('countryId');
$objCity = new Travel_Model_TblCity();
$result = $objCity->getAutoSuggestWithCountryName($strCityName, $strcountryId);
//echo "<pre>";print_r($result);die;
echo $this->_helper->json($result);
exit;
}
}
public function getSupplierCurrencytypeAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$SupplierSysId = $this->getRequest()->getParam('SupplierSysId');
$PrefCurrencyType = $this->getRequest()->getParam('PrefCurrencyType');
if($SupplierSysId!='' && $PrefCurrencyType!='')
{
$objCurrency = new Travel_Model_TblCurrency();
$arrCurrencyTypes = $objCurrency->getCurrencyTypes();
//echo "<pre>"; print_r($cityActArr);die;
$currencySelect='';
if(!empty($arrCurrencyTypes))
{
$currencySelect = '<script src="'.$this->siteUrl.'public/assets/js/pages/selectAjaxChildTagBulkPackage.js"></script>';
$currencySelect .= '<input type="hidden" name="ajaxdropdown_css" class="ajaxdropdown_css" id="ajaxdropdown_css_10" value="10" /><select id="select-ajax-child10" name="currency_type" class="demo-default select-ajax-child10 state" placeholder="Select Currency"><option value="">Select Currency</option>';
foreach($arrCurrencyTypes as $arrCurrency)
{
if($PrefCurrencyType==$arrCurrency['CurrencyType'])
{
$currencySelect .= '<option value="'.$arrCurrency['CurrencyType'].'" selected="selected">'.$arrCurrency['Symbol'].'</option>';
} else {
$currencySelect .= '<option value="'.$arrCurrency['CurrencyType'].'">'.$arrCurrency['Symbol'].'</option>';
}
}
$currencySelect .= '</select>';
}
}
echo $currencySelect;
exit;
}
}
public function getAgentActivitiesAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$cityId = $this->getRequest()->getParam('cityId');
$countryId = $this->getRequest()->getParam('countryId');
if($cityId!='' && $countryId!='')
{
$objPackage = new Travel_Model_TblPackage();
$cityActArr = $objPackage->getCityAllActivity($cityId,$this->intLoggedinUserAgencySysId);
// echo "<pre>"; print_r($cityActArr);die;
$activitiesSelect='';
if(!empty($cityActArr))
{
$activitiesSelect = '<script src="'.$this->siteUrl.'public/assets/js/pages/selectAjaxChildTag.js"></script>';
$activitiesSelect .= '<input type="hidden" name="ajaxdropdown_css" class="ajaxdropdown_css" value="1" /><select id="act" name="act[]" multiple class="demo-default select-ajax-child1 state"><option value="">Select Activities</option>';
foreach($cityActArr as $cityAct)
{
$activities_dts = $cityAct['ActivitySysId'].'-'.$cityAct['Title'];
$activitiesSelect .= '<option value="'.$activities_dts.'">'.$cityAct['Title'].'</option>';
}
$activitiesSelect .= '</select>';
} else {
//$activitiesSelect ='';
$activitiesSelect = '<script src="'.$this->siteUrl.'public/assets/js/pages/selectAjaxChildTag.js"></script>';
$activitiesSelect .= '<input type="hidden" name="ajaxdropdown_css" class="ajaxdropdown_css" value="1" /><select id="act" name="act[]" multiple class="demo-default select-ajax-child1 state"><option value="">Select Activities</option></select>';
}
}
echo $activitiesSelect;
exit;
}
}
public function getAgentSightseeingAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$cityId = $this->getRequest()->getParam('cityId');
$countryId = $this->getRequest()->getParam('countryId');
if($cityId!='' && $countryId!='')
{
$objPackage = new Travel_Model_TblPackage();
$citySSArr = $objPackage->getCityAllSightseeing($cityId,$this->intLoggedinUserAgencySysId);
// echo "<pre>"; print_r($citySSArr);die;
$sightseeingSelect='';
if(!empty($citySSArr))
{
$sightseeingSelect = '<script src="'.$this->siteUrl.'public/assets/js/pages/selectAjaxChildTag.js"></script>';
$sightseeingSelect .= '<input type="hidden" name="ajaxdropdown_css" class="ajaxdropdown_css" value="2" /><select id="sight" name="sight[]" multiple class="demo-default select-ajax-child2 state"><option value="">Select Sightseeing</option>';
foreach($citySSArr as $citysightseeing)
{
$sightseeing_dts = $citysightseeing['SSSysId'].'-'.$citysightseeing['Title'];
$sightseeingSelect .= '<option value="'.$sightseeing_dts.'">'.$citysightseeing['Title'].'</option>';
}
$sightseeingSelect .= '</select>';
}
else {
//$sightseeingSelect = '';
$sightseeingSelect = '<script src="'.$this->siteUrl.'public/assets/js/pages/selectAjaxChildTag.js"></script>';
$sightseeingSelect .= '<input type="hidden" name="ajaxdropdown_css" class="ajaxdropdown_css" value="2" /><select id="sight" name="sight[]" multiple class="demo-default select-ajax-child2 state"><option value="">Select Sightseeing</option></select>';
}
}
echo $sightseeingSelect;
exit;
}
}
public function addHotelDivAction() {
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$this->_helper->viewRenderer->setNoRender(true);
$max_fields = $this->getRequest()->getParam('max_fields');
$hotelDivCounter = $this->getRequest()->getParam('hotelDivCounter');
if($max_fields!="" && $hotelDivCounter!='')
{
if($max_fields >= $hotelDivCounter)
{
//echo "sdfds"; die;
$objHotelRooms = new Travel_Model_TblHotelRooms();
$arrHotelRoomTypes = $objHotelRooms->getRoomTypes();
//echo "<pre>"; print_r($arrHotelRoomTypes);die;
$this->view->arrHotelRoomTypes = $arrHotelRoomTypes;
$this->view->hotelDivCounter = $hotelDivCounter;
$this->render('ajaxHotelDetails');
}
}
}
}
public function addHotelMarkupDivAction() {
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$this->_helper->viewRenderer->setNoRender(true);
$max_fields = $this->getRequest()->getParam('max_fields');
$hotelMarkupDivCounter = $this->getRequest()->getParam('hotelMarkupDivCounter');
if($max_fields!="" && $hotelMarkupDivCounter!='')
{
if($max_fields >= $hotelMarkupDivCounter)
{
$this->view->hotelMarkupDivCounter = $hotelMarkupDivCounter;
$this->render('ajaxHotelMarkup');
}
}
}
}
public function autosuggestAction()
{
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
$arrResponse = array();
if($this->getRequest()->getParam("term")) {
$term = $this->getRequest()->getParam("term");
$CitySysIds = $this->getRequest()->getParam('CitySysIds');
$CountrySysId = $this->getRequest()->getParam('CountrySysId');
$objBulkPackage = new Travel_Model_TblBulkPackage();
$arrResponse = $objBulkPackage->getAutoSuggest($term, $CitySysIds, $CountrySysId, $this->intLoggedinUserAgencySysId);
//echo "<pre>"; print_r($arrResponse);die;
}
echo json_encode( $arrResponse );
}
public function manageMarkupAction()
{
/* Disable layout */
$this->_helper->layout->disableLayout();
$divId = $this->getRequest()->getParam('id');
$hotelId = $this->getRequest()->getParam('hotelId');
$this->view->divId = $divId;
$this->view->hotelId = $hotelId;
//echo $InvnItemSysId;
// $objActivities = new Travel_Model_TblActivities();
// $intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
// $arrActivitiesInventoryList = $objActivities->getActivitiesInventoryList($InvnItemSysId,$intLoggedinUserAgencySysId);
// //echo "<pre>";print_r($arrFlightInventoryList);die;
// $this->view->arrActivitiesInventoryList = $arrActivitiesInventoryList;
}
public function viewMarkupSettingGridAction()
{
/* Disable Layout */
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if($this->_request->isXmlHttpRequest()) {
$hotelId = $this->getRequest()->getParam('hotelId');
$MarkupSetting = $this->getRequest()->getParam('MarkupSetting');
$intAgencySysId = $this->intLoggedinUserAgencySysId;
if($MarkupSetting == 'markup') {
$objBulkPackage = new Travel_Model_TblBulkPackage();
$arrCustomizedMarkupList = $objBulkPackage->getAllHotelSupplementListByAgencyId($intAgencySysId, $hotelId);
//echo "<pre>"; print_r($arrCustomizedMarkupList);die;
$this->view->arrCustomizedMarkupList = $arrCustomizedMarkupList;
}
$this->view->MarkupSetting = $MarkupSetting;
$this->view->hotelId = $hotelId;
if($MarkupSetting == 'markup') {
$this->render('view-customize-markup-grid');
}
}
}
public function addCustomizedMarkupAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Call Bulk Package Model
$objBulkPackage = new Travel_Model_TblBulkPackage();
//Get Post form data
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
$hotelId = $this->getRequest()->getPost('hotelId');
// if(empty($hotelId) || empty($this->intLoggedinUserAgencySysId)) {
// throw new Exception('There has been an error, Please try again later');
// }
/* For Customize Markup Type */
if(!empty($post)) {
$supplementType = !empty($post['supplementType']) ? $post['supplementType'] : '0';
$supplementTitle = !empty($post['supplementTitle']) ? $post['supplementTitle'] : '';
$from_date = !empty($post['from_date']) ? $post['from_date'] : '';
$to_date = !empty($post['to_date']) ? $post['to_date'] : '0';
/* For Fixed Amount Markup Type */
} else {
throw new Exception('There has been an error, Please try again later');
}
$strFromDate = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->cal2Db($from_date,'d/m/y');
$strToDate = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->cal2Db($to_date,'d/m/y');
$currentDate = date('Y-m-d H:i:s');
$IsMarkForDel=0;
$IsActive =1;
if(empty($hotelId)) {
$response = array('success' => false, 'msg' => 'Please select hotel');
echo json_encode($response);
exit;
}
if($supplementType<=0) {
$response = array('success' => false, 'msg' => 'Please select type');
echo json_encode($response);
exit;
}
if(empty($supplementTitle)) {
$response = array('success' => false, 'msg' => 'Please enter title');
echo json_encode($response);
exit;
}
if($from_date=="__/__/____") {
$response = array('success'=> false, 'msg' => 'Please select from date');
echo json_encode($response);
exit;
}
if($to_date=="__/__/____") {
$response = array('success'=> false, 'msg' => 'Please select to date');
echo json_encode($response);
exit;
}
if($strFromDate>$strToDate) {
$response = array('success'=> false, 'msg' => 'Please select to date should be greater than from date');
echo json_encode($response);
exit;
}
/* Check if group settings already exists */
// $arrGroupPaxCountSettings = $objActivities->getActivitiesGroupList($InvnItemSysId, $PaxCount);
// if(!empty($arrGroupPaxCountSettings) > 0 ) {
// $response = array('success' => false, 'msg' => 'Pax has been already added.');
// echo json_encode($response);
// exit;
// }
$insert =
array(
'AccomSysId' => $hotelId,
'AgencySysId' => $this->intLoggedinUserAgencySysId,
'InfoType' => $supplementType,
'Title' => $supplementTitle,
'StartDate' => $strFromDate,
'EndDate' => $strToDate,
'Brief' => '',
'SurCharge' => '0',
'CurrencyType' => '0',
'UpdateDate' => $currentDate,
'CreateDate' => $currentDate,
'IsActive' => $IsActive,
'IsMarkForDel' => $IsMarkForDel
);
// echo "<pre>";
// print_r($insert);
// exit;
try {
$objBulkPackage->addMarkupSettings($insert);
$response = array('success' => true);
echo json_encode($response);
exit;
} catch( Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage() );
echo json_encode($response);
exit;
}
}
}
public function deleteCustomizedMarkupSettingAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$InvnItemSysId = $this->getRequest()->getParam('InvnItemSysId');
$objBulkPackage = new Travel_Model_TblBulkPackage();
$objBulkPackage->deleteCustomizedMarkupSetting($InvnItemSysId);
$response = array('success' => true);
echo json_encode($response);
exit;
}
}
}