| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/application/admin/controllers/ |
Upload File : |
<?php
/**
* Class Activities
* @name Activities
* @author Praveen Kumar
* @version 1.0
* @copyright Catabatic India Pvt Ltd
* Handle Activities Related function
*
*/
class Admin_ActivitiesController extends Catabatic_ValidateAdmin
{
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');
//Zend_Session::rememberMe(60 * 60 * 24 * 7);
$sessionLogin_user->lock();
#get session variable
$this->SupplierTypeSysId = 5;
$this->InfoSourceSysId = '2'; // Information Source is Agent //
$this->intLoggedinUserRole = $sessionLogin_user->UserRole;
$this->intLoggedinUserId = 1;
$this->intLoggedinUserGroupSysId = $sessionLogin_user->intLoggedinUserGroupSysId;
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
$this->intLoggedinUserTrxCurrency = $sessionLogin_user->intLoggedinUserTrxCurrency;
$this->view->intLoggedinUserRole = $sessionLogin_user->UserRole;
//File Upload Directory Path
$this->upload_dir = "/public/assets/images/Activity/";
$this->file_path = $_SERVER['DOCUMENT_ROOT'] . $this->upload_dir;
// unlocking read-only lock
if ($sessionLogin_user->isLocked()) {
$sessionLogin_user->unLock();
}
}
public function indexAction()
{
$objActivities = new Travel_Model_TblActivities();
//Get City List
$cityList = $objActivities->getInventoryCityList($this->intLoggedinUserAgencySysId);
$this->view->cityList = $cityList;
//Get Activities Group Type List
$this->view->arrActivitiesGroupTypeList = $objActivities->getAllActivityGroupTypeList();
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
//Get Supplier List
$supplierList = $objActivities->getSuppliersList($cityId='', $this->intLoggedinUserId);
$this->view->supplierList = $supplierList;
//Start Search Code
$searchArr = array();
$getData = array();
if($this->getRequest()->isPost())
{
$getData = $this->getRequest()->getPost();
if(!empty($getData))
{
if(@$getData['cityId']!=0)
{
$DestinationId = @$getData['cityId'];
} else {
$DestinationId = "";
}
if(@$getData['ActivityGroupType']!=0)
{
$ActivityGroupType = @$getData['ActivityGroupType'];
} else {
$ActivityGroupType = "";
}
if(@$getData['ActivityType']!=0)
{
$ActivityType = @$getData['ActivityType'];
} else {
$ActivityType = "";
}
if(@$getData['supplierId']!=0)
{
$supplierId = $getData['supplierId'];
} else {
$supplierId = "";
}
if(@$getData['ActivityName']!="")
{
$ActivityName = $getData['ActivityName'];
} else {
$ActivityName = "";
}
$searchArr = array(
'cityId'=>$DestinationId,
'ActivityGroupType'=>$ActivityGroupType,
'ActivityType'=>$ActivityType,
'supplierId'=>$supplierId,
'ActivityName'=>$ActivityName
);
}
} else {
$DestinationId = $this->_getParam('cityId');
$ActivityGroupType = $this->_getParam('ActivityGroupType');
$ActivityType = $this->_getParam('ActivityType');
$supplierId = $this->_getParam('supplierId');
$ActivityName = $this->_getParam('ActivityName');
if($DestinationId!=0)
{
$DestinationId = $DestinationId;
} else {
$DestinationId = "";
}
if($ActivityGroupType!=0)
{
$ActivityGroupType = $ActivityGroupType;
} else {
$ActivityGroupType = "";
}
if($ActivityType!=0)
{
$ActivityType = $ActivityType;
} else {
$ActivityType = "";
}
if($supplierId!=0)
{
$supplierId = $supplierId;
} else {
$supplierId = "";
}
if($ActivityName!="")
{
$ActivityName = $ActivityName;
} else {
$ActivityName = "";
}
$searchArr = array(
'cityId'=>$DestinationId,
'ActivityGroupType'=>$ActivityGroupType,
'ActivityType'=>$ActivityType,
'supplierId'=>$supplierId,
'ActivityName'=>$ActivityName
);
}
//echo "<pre>"; print_r($searchArr);
$objActivities->searchArr = $searchArr;
$this->view->searchArr = $searchArr;
//Agency Id
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$ActivitiesList = $objActivities->getAllActivitiesList($intLoggedinUserAgencySysId);
//echo "<pre>"; print_r($ActivitiesList); die;
//$this->view->activitiesList = $ActivitiesList;
$page=$this->_getParam('page',1);
$paginator = Zend_Paginator::factory($ActivitiesList);
$paginator->setCurrentPageNumber($this->getRequest()->getParam('page')); // page number
$perPage = $paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT); // number of items to show per page
$this->view->paginator = $paginator;
$this->view->totalrec = $paginator->getTotalItemCount();
//For display message
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function manageActivitiesAction()
{
$objActivities = new Travel_Model_TblActivities();
//Agency Id
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
//Get City List
$cityList = $objActivities->getActivitiesCityList($intLoggedinUserId);
$this->view->cityList = $cityList;
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
$this->view->arrCategoryTypeList = $objActivities->getAllActivityGroupTypeList();
//Start Search Code
$searchArr = array();
$getData = array();
if($this->getRequest()->isPost())
{
$getData = $this->getRequest()->getPost();
if(!empty($getData))
{
if(@$getData['cityId']!=0)
{
$DestinationId = @$getData['cityId'];
} else {
$DestinationId = "";
}
if(@$getData['ActivityType']!=0)
{
$ActivityType = @$getData['ActivityType'];
} else {
$ActivityType = "";
}
if(@$getData['ActivityName']!="")
{
$ActivityName = $getData['ActivityName'];
} else {
$ActivityName = "";
}
if(@$getData['AgencyName']!="")
{
$AgencyName = $getData['AgencyName'];
} else {
$AgencyName = "";
}
$searchArr = array(
'cityId'=>$DestinationId,
'ActivityType'=>$ActivityType,
'ActivityName'=>$ActivityName,
'AgencyName'=>$AgencyName
);
}
} else {
$DestinationId = $this->_getParam('cityId');
$ActivityType = $this->_getParam('ActivityType');
$ActivityName = $this->_getParam('ActivityName');
$AgencyName = $this->_getParam('AgencyName');
if($DestinationId!=0)
{
$DestinationId = $DestinationId;
} else {
$DestinationId = "";
}
if($ActivityType!=0)
{
$ActivityType = $ActivityType;
} else {
$ActivityType = "";
}
if($ActivityName!="")
{
$ActivityName = $ActivityName;
} else {
$ActivityName = "";
}
$searchArr = array(
'cityId'=>$DestinationId,
'ActivityType'=>$ActivityType,
'ActivityName'=>$ActivityName,
'AgencyName'=>$AgencyName
);
}
// echo "<pre>"; print_r($searchArr);
$objActivities->searchActivitiesArr = $searchArr;
$this->view->searchArr = $searchArr;
//echo $this->InfoSourceSysId;
$ActivitiesList = $objActivities->getAllManageActivitiesListAdmin($country_id = null,$city_id = null);
// echo "<pre>"; print_r($ActivitiesList); die;
//$this->view->activitiesList = $ActivitiesList;
$page=$this->_getParam('page',1);
$paginator = Zend_Paginator::factory($ActivitiesList);
$paginator->setCurrentPageNumber($this->getRequest()->getParam('page')); // page number
$perPage = $paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT); // number of items to show per page
$this->view->paginator = $paginator;
$this->view->totalrec = $paginator->getTotalItemCount();
//For display message
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function mappingactivitiesAction()
{
$objActivities = new Travel_Model_TblActivities();
//Agency Id
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
//Get City List
$cityList = $objActivities->getActivitiesCityList($intLoggedinUserId);
$this->view->cityList = $cityList;
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
$this->view->arrCategoryTypeList = $objActivities->getAllActivityGroupTypeList();
//Start Search Code
$id = explode('_',$this->getRequest()->getParam('id'));
$country_id = base64_decode(isset($id[0])?$id[0]:'');
$city_id = base64_decode(isset($id[1])?$id[1]:'');
$agencyId = base64_decode(isset($id[2])?$id[2]:'');
$this->view->country_id = $country_id;
$this->view->city_id = $city_id;
$this->view->agencyId = $agencyId;
$searchArr = array();
$getData = array();
if($this->getRequest()->isPost())
{
$getData = $this->getRequest()->getPost();
if(!empty($getData))
{
if(@$getData['cityId']!=0)
{
$DestinationId = @$getData['cityId'];
} else {
$DestinationId = "";
}
if(@$getData['ActivityType']!=0)
{
$ActivityType = @$getData['ActivityType'];
} else {
$ActivityType = "";
}
if(@$getData['ActivityName']!="")
{
$ActivityName = $getData['ActivityName'];
} else {
$ActivityName = "";
}
$searchArr = array(
'cityId'=>$DestinationId,
'ActivityType'=>$ActivityType,
'ActivityName'=>$ActivityName
);
}
} else {
$DestinationId = $this->_getParam('cityId');
$ActivityType = $this->_getParam('ActivityType');
$ActivityName = $this->_getParam('ActivityName');
if($DestinationId!=0)
{
$DestinationId = $DestinationId;
} else {
$DestinationId = "";
}
if($ActivityType!=0)
{
$ActivityType = $ActivityType;
} else {
$ActivityType = "";
}
if($ActivityName!="")
{
$ActivityName = $ActivityName;
} else {
$ActivityName = "";
}
$searchArr = array(
'cityId'=>$DestinationId,
'ActivityType'=>$ActivityType,
'ActivityName'=>$ActivityName
);
}
// echo "<pre>"; print_r($searchArr);
$objActivities->searchActivitiesArr = $searchArr;
$this->view->searchArr = $searchArr;
//echo $this->InfoSourceSysId;
$ActivitiesList = $objActivities->getAllManageActivitiesListMapMaster($country_id,$city_id);
$ActivitiesListAgency = $objActivities->getAllManageActivitiesListAgency($agencyId,$country_id,$city_id);
//echo "<pre>"; print_r($ActivitiesList); echo "</pre>"; die;
//$this->view->activitiesList = $ActivitiesList;
$page=$this->_getParam('page',1);
$paginator = Zend_Paginator::factory($ActivitiesList);
$paginator->setCurrentPageNumber($this->getRequest()->getParam('page')); // page number
$perPage = $paginator->setItemCountPerPage(5000); // number of items to show per page
$this->view->paginator = $paginator;
$this->view->ActivitiesListAgency = $ActivitiesListAgency;
$this->view->totalrec = $paginator->getTotalItemCount();
//For display message
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function addActivitiesInventoryAction()
{
//echo "exit"; exit;
//Get Currency List
$objCurrency = new Travel_Model_TblCurrency();
$this->view->arrCurrencyTypes = $objCurrency->getCurrencyTypes();
//Get Supplier List
$objSupplier = new Travel_Model_TblSupplier();
$this->view->arrSupplierTypes = $objSupplier->getSupplierTypes();
//For display message
$this->view->messages = $this->_helper->flashMessenger->getMessages();
if(@$this->intLoggedinUserId == ADMIN_ID)
{
$this->render('add-activities-inventory-admin');
}
}
public function viewActivitiesInventoryBulkFormAction() {
$this->_helper->layout->setLayout('newLayout');
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Get Currency List
$objCurrency = new Travel_Model_TblCurrency();
$this->view->arrCurrencyTypes = $objCurrency->getCurrencyTypes();
//Get Country List
$objCountry = new Travel_Model_TblCountry();
$this->view->arrCountryList = $objCountry->getCountryList();
//Get Activity Inc Type List
$objActivities = new Travel_Model_TblActivities();
$this->view->arrActivityInclypeList = $objActivities->getAllActivityInclypeList();
//Get Booking Type List
$this->view->arrBookingTypeList = $objActivities->getAllBookingTypeList();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryList = $objActivities->getAllActivitiesInventoryList($intLoggedinUserAgencySysId);
$this->view->activitiesInventoryCountList = count($arrActivitiesInventoryList);
}
}
public function viewActivitiesInventoryBulkEditFormAction() {
$this->_helper->layout->setLayout('newLayout');
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$InvnItemSysId = base64_decode($this->getRequest()->getParam('InvnItemSysId'));
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryDetails = $objActivities->getActivitiesInventoryDetailsList($InvnItemSysId, $intLoggedinUserAgencySysId);
$FromDateTimeObj = (array) $arrActivitiesInventoryDetails['FromDate'];
$from_date_time = date("d/m/Y",strtotime($FromDateTimeObj['date']));
$ToDateTimeObj = (array) $arrActivitiesInventoryDetails['ToDate'];
$to_date_time = date("d/m/Y",strtotime($ToDateTimeObj['date']));
$arrActivitiesInventoryDetailsArr = array('FromDateFormat'=>$from_date_time,'ToDateFormat'=>$to_date_time);
$arrActivitiesInventoryDetailsArrFinal = array();
$arrActivitiesInventoryDetailsArrFinal = @array_merge($arrActivitiesInventoryDetails,$arrActivitiesInventoryDetailsArr);
$this->view->arrActivitiesInventoryDetails = $arrActivitiesInventoryDetailsArrFinal;
//echo "<pre>"; print_r($arrActivitiesInventoryDetailsArrFinal);die;
}
}
public function viewActivitiesInventoryIndividualFormAction() {
$this->_helper->layout->setLayout('newLayout');
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Get Country List
$objCountry = new Travel_Model_TblCountry();
$this->view->arrCountryList = $objCountry->getCountryList();
//Get Activities Group Type List
$objActivities = new Travel_Model_TblActivities();
$this->view->arrActivitiesGroupTypeList = $objActivities->getAllActivityGroupTypeList();
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
//Get Difficulty Type List
$this->view->arrDifficultyTypeList = $objActivities->getAllDifficultyTypeList();
}
}
public function getCityDetailsListAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Get Post form data
$post = $this->getRequest()->getPost();
//Get Country List
$str_city = '';
if($post['countryId']!=0)
{
$objCity = new Travel_Model_TblCity();
$objCity->intContSysId = $post['countryId'];
$arrCityList = $objCity->getCityList();
if(!empty($arrCityList)>0)
{
foreach($arrCityList as $arrCity)
{
$str_city .= '<option value="'.$arrCity['CityId'].'">'.$arrCity['Title'].'</option>';
}
} else {
$str_city = '<option value="0">Select</option>';
}
} else {
$str_city = '<option value="0">Select</option>';
}
echo $str_city;
exit;
}
}
public function savemappingAction(){
$this->_helper->layout->disableLayout();
if($this->getRequest()->isPost()){
$post = $this->getRequest()->getPost();
$objActivities = new Travel_Model_TblActivities();
$arrDetailsadmin = $objActivities->getManageActivitiesDetailsMap($post['admin']);
if($post['agent']){ $arragentName = array();
foreach ($post['agent'] as $value) {
$result = $objActivities->getManageActivitiesDetailsMap($value);
$arragentName[] = $result['ActivityName'];
}
}
//echo "<pre>";print_r($arrDetailsadmin);die;
$arrDetailsadmin['synonyms'] = ($arrDetailsadmin['synonyms'] !=null)?trim($arrDetailsadmin['synonyms']).',':'';
$arrDetailsagent = ($arragentName)?implode(',',$arragentName):'';
$getsynonyms = $arrDetailsadmin['synonyms'].$arrDetailsadmin['ActivityName'].','.$arrDetailsagent;
$synonymsex = explode(',',$getsynonyms);
$synonyms = (implode(',',array_unique($synonymsex)));
$insertadmin =
array(
'synonyms' => $synonyms,
'IsApproved' => 1,
);
$admin = $objActivities->updateActivitiesDetails($post['admin'], $insertadmin);
if($post['agent']){
foreach ($post['agent'] as $value) {
$result = $objActivities->getManageActivitiesDetailsMap($value);
$insert =
array(
'synonyms' => $result['ActivityName'],
'IsApproved' => 0,
'IsMapped' => 1,
);
$agent = $objActivities->updateActivitiesDetails($result['ActivitySysId'], $insert);
}
}
try {
if($admin && $agent){
$response = array('success' => true, 'msg' => 'Mapping Successfully.' );
echo json_encode($response);
exit;
}
} catch( Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage() );
echo json_encode($response);
exit;
}
}
}
public function saveActivitiesAction()
{
$this->_helper->layout->disableLayout();
if($this->getRequest()->isPost())
{
$post = $this->getRequest()->getPost();
$objActivities = new Travel_Model_TblActivities();
//echo "<pre>";print_r($post); die;
/* For activities */
if(!empty($post)) {
$ActivitySysId = isset($post['ActivitySysId']) ? $post['ActivitySysId'] : '0';
$ContId = isset($post['ContId']) ? $post['ContId'] : '';
$CitySysId = isset($post['CitySysId']) ? $post['CitySysId'] : '0';
$ActivityGroupType = isset($post['ActivityGroupType']) ? implode(',',$post['ActivityGroupType']) : '';
$ActivityType = isset($post['ActivityType']) ? implode(',',$post['ActivityType']) : '';
$ActivityName = isset($post['ActivityName']) ? $post['ActivityName'] : '';
$Duration = isset($post['Duration']) ? $post['Duration'] : '0';
$difficulty_level = isset($post['difficulty_level']) ? $post['difficulty_level'] : '';
$OperatingTime1 = isset($post['OperatingTime_1']) ? $post['OperatingTime_1'] : '';
$OperatingTime2 = isset($post['OperatingTime_2']) ? $post['OperatingTime_2'] : '';
$OperatingTime3 = isset($post['OperatingTime_3']) ? $post['OperatingTime_3'] : '';
$season_month = isset($post['season_month']) ? $post['season_month'] : '';
$season_day = isset($post['season_day']) ? $post['season_day'] : '';
$age_group = isset($post['AgeGroup']) ? $post['AgeGroup'] : '';
$Popularity = isset($post['Popularity']) ? $post['Popularity'] : '';
$things_to_carry = isset($post['things_to_carry']) ? @implode(",",@$post['things_to_carry']) : '0';
$IsTransferInc = isset($post['Transfers']) ? $post['Transfers'] : '0';
$pick_drop = isset($post['pick_drop']) ? $post['pick_drop'] : '';
$details = isset($post['details']) ? $post['details'] : '';
$address = isset($post['Address']) ? $post['Address'] : '';
$latitude = isset($post['latitude']) ? $post['latitude'] : '0';
$longitude = isset($post['longitude']) ? $post['longitude'] : '0';
$ActivityNameArr = array(); $ActivityGroupNameArr = array();
if(!empty($post['ActivityGroupType'])){
foreach ($post['ActivityGroupType'] as $GroupType) {
$ActivityGroupNameArr[] = isset($GroupType)?$objActivities->getActivityGroupName($GroupType):'0';
}
}
if(!empty($post['ActivityType'])){
foreach ($post['ActivityType'] as $value) {
$ActivityNameArr[] = isset($value)?$objActivities->getActivityName($value):'0';
}
}
$ActivityGroupTypeName = isset($ActivityGroupNameArr) ? json_encode($ActivityGroupNameArr) : '';
$ActivityTypeName = isset($ActivityNameArr) ? json_encode($ActivityNameArr) : '';
}
//print_r($ActivityGroupTypeName);
//print_r($ActivityTypeName);
//die;
if(!empty($OperatingTime1) && empty($OperatingTime2) && empty($OperatingTime3))
{
$OperatingTime = array($OperatingTime1);
}
else {
$OperatingTime = $OperatingTime1;
}
if(!empty($OperatingTime1) && !empty($OperatingTime2))
{
$OperatingTime = array($OperatingTime1, $OperatingTime2);
}
if(!empty($OperatingTime1) && !empty($OperatingTime2) && !empty($OperatingTime3))
{
$OperatingTime = array($OperatingTime1, $OperatingTime2, $OperatingTime3);
}
if(!empty($OperatingTime))
{
$time_slots = json_encode($OperatingTime);
} else {
$time_slots = '';
}
if(!empty($age_group))
{
$StartAgeYr = $age_group[0];
$EndAgeYr = $age_group[1];
} else {
$StartAgeYr = 0;
$EndAgeYr = 0;
}
$arrActivitiesDetails = $objActivities->getManageActivitiesDetails($ActivitySysId, @$intLoggedinUserId);
$UpdateDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$CreateDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
//Fixed variables
$ICSourceSysId = $this->InfoSourceSysId;
$StartPlaceSysId = 0;
$EndPlaceSysId = 0;
$AliasAndMeta = "";
$ActivityIncMask=0;
$DurationInMin=0;
$MinPax =0;
$MaxPax = 0;
$LeanMonthMask="1000000000000";
$SilentMonthMask="1000000000000";
if($arrActivitiesDetails['IsKidAllowed']!="")
{
$IsKidAllowed = $arrActivitiesDetails['IsKidAllowed'];
} else {
$IsKidAllowed = 0;
}
if($arrActivitiesDetails['IsTeenAllowed']!="")
{
$IsTeenAllowed = $arrActivitiesDetails['IsTeenAllowed'];
} else {
$IsTeenAllowed = 0;
}
if($arrActivitiesDetails['IsAdultAllowed']!="")
{
$IsAdultAllowed = $arrActivitiesDetails['IsAdultAllowed'];
} else {
$IsAdultAllowed = 0;
}
if($arrActivitiesDetails['IsPetAllowed']!="")
{
$IsPetAllowed = $arrActivitiesDetails['IsPetAllowed'];
} else {
$IsPetAllowed = 0;
}
if($arrActivitiesDetails['IsTrxAllowed']!="")
{
$IsTrxAllowed = $arrActivitiesDetails['IsTrxAllowed'];
} else {
$IsTrxAllowed = 0;
}
if($arrActivitiesDetails['IsPickAllowed']!="")
{
$IsPickAllowed = $arrActivitiesDetails['IsPickAllowed'];
} else {
$IsPickAllowed = 0;
}
$Rating=0;
if($arrActivitiesDetails['AwardRecognizations']!="" && $arrActivitiesDetails['AwardRecognizations']!=0)
{
$AwardRecognizations = $arrActivitiesDetails['AwardRecognizations'];
} else {
$AwardRecognizations = "";
}
if($arrActivitiesDetails['BookingType']!="")
{
$BookingType = $arrActivitiesDetails['BookingType'];
} else {
$BookingType = 0;
}
if($arrActivitiesDetails['StartLocalTime']!="")
{
$StartLocalTime = $arrActivitiesDetails['StartLocalTime'];
} else {
$StartLocalTime = $CreateDate;
}
if($arrActivitiesDetails['EndLocalTime']!="")
{
$EndLocalTime = $arrActivitiesDetails['EndLocalTime'];
} else {
$EndLocalTime = $CreateDate;
}
$IsDayLightApp =0;
// if($arrActivitiesDetails['latitude']!="" && $arrActivitiesDetails['latitude']!=0)
// {
// $latitude = $arrActivitiesDetails['latitude'];
// } else {
// $latitude = 0;
// }
// if($arrActivitiesDetails['longitude']!="" && $arrActivitiesDetails['longitude']!=0)
// {
// $longitude = $arrActivitiesDetails['longitude'];
// } else {
// $longitude = 0;
// }
$PinCode="";
$ZoneSysId =0;
$ZoneType=0;
$StateSysId=0;
if($arrActivitiesDetails['PrimaryContact']!="" && $arrActivitiesDetails['PrimaryContact']!=0)
{
$PrimaryContact = $arrActivitiesDetails['PrimaryContact'];
} else {
$PrimaryContact = "";
}
if($arrActivitiesDetails['SecondaryContact']!="" && $arrActivitiesDetails['SecondaryContact']!=0)
{
$SecondaryContact = $arrActivitiesDetails['SecondaryContact'];
} else {
$SecondaryContact = "";
}
if($arrActivitiesDetails['OtherContacts']!="" && $arrActivitiesDetails['OtherContacts']!=0)
{
$OtherContacts = $arrActivitiesDetails['OtherContacts'];
} else {
$OtherContacts = "";
}
$ApproveBy = $this->intLoggedinUserId;
$ApproveDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
/* Check if connecting flight already exists */
// $arrFlightConnecting = $objFlight->getCustomizedMarkups($InvnItemSysId,$this->intLoggedinUserId );
//
// if(count($arrFlightConnecting) > 0 ) {
// $response = array('success' => false, 'msg' => 'Connecting flight of the selected airlines has already been added.');
// echo json_encode($response);
// exit;
// }
if($ActivitySysId!="" && $ActivitySysId!=0)
{
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
if(!empty($_FILES['activitiesIcon']['name'])){
$unique = substr(time(), 0,5);
$upload = new Zend_File_Transfer_Adapter_Http();
$files = $upload->getFileInfo();
$file_name = $unique.'_'.$_FILES['activitiesIcon']['name'];
$imagename = $this->siteUrl.$this->upload_dir.$file_name;
$tmp_name = $_FILES['activitiesIcon']['tmp_name'];
//Remove file
if(!empty($arrActivitiesDetails))
{
$Icon = trim($arrActivitiesDetails['Icon']);
if($Icon!="No File" && $Icon!="")
{
$imagename_edit = $Icon;
}
@unlink($imagename_edit);
}
$toupload = @move_uploaded_file($tmp_name,$this->file_path.$file_name);
}
else
{
if(!empty($arrActivitiesDetails))
{
if($arrActivitiesDetails['Icon']!="")
{
$imagename = $arrActivitiesDetails['Icon'];
}
} else
{
$imagename = 'No File';
}
}
$AgentSysId = $arrActivitiesDetails['AgentSysId'];
$IsAgentSpec = $arrActivitiesDetails['IsAgentSpec'];
$IsApproved = $arrActivitiesDetails['IsApproved'];
$IsActive = $arrActivitiesDetails['IsActive'];
$IsMarkForDel = $arrActivitiesDetails['IsMarkForDel'];
} else {
if(!empty($_FILES['activitiesIcon']['name'])){
$unique = substr(time(), 0,5);
$upload = new Zend_File_Transfer_Adapter_Http();
$files = $upload->getFileInfo();
$file_name = $unique.'_'.$_FILES['activitiesIcon']['name'];
$imagename = $this->siteUrl.$this->upload_dir.$file_name;
$tmp_name = $_FILES['activitiesIcon']['tmp_name'];
$toupload = @move_uploaded_file($tmp_name,$this->file_path.$file_name);
}
else
{
$imagename = 'No File';
}
if($this->intLoggedinUserRole!=1)
{
$AgentSysId = $this->intLoggedinUserAgencySysId;
$IsAgentSpec = 1;
$IsApproved = 0;
$IsActive = 1;
$IsMarkForDel = 0;
} else {
$AgentSysId = 0;
$IsAgentSpec = 0;
$IsApproved = 1;
$IsActive = 1;
$IsMarkForDel = 0;
}
}
if(!empty($Duration))
{
$DurationDays = $Duration[0];
$DurationMin = $Duration[1];
} else {
$DurationDays = 0;
$DurationMin = 0;
}
//create season masking
if(!empty($season_month))
{
$season_month_arr = unserialize(SEASON_MONTH);
$seasonMonthMasking = $objActivities->setMasking($season_month, $season_month_arr);
} else {
$seasonMonthMasking = "1000000000000";
}
//Days of week Masking
if(!empty($season_day))
{
$season_day_arr = unserialize(SEASON_DAYS);
$seasonDaysMasking = $objActivities->setMasking($season_day, $season_day_arr);
} else {
$seasonDaysMasking = "10000000";
}
//Added by pooja
if ($ActivitySysId == "" && $ActivitySysId == 0) {
$insert['AgentSysId'] = $AgentSysId;
}
//end
$insert =
array(
'IsAgentSpec' => $IsAgentSpec,
'AgentSysId' => $AgentSysId,
'ICSourceSysId' => $ICSourceSysId,
'StartPlaceSysId' => $StartPlaceSysId,
'EndPlaceSysId' => $EndPlaceSysId,
'Title' => $ActivityName,
'WriteUp' => $details,
'DifficultyLevel' => $difficulty_level,
'AliasAndMeta' => $AliasAndMeta,
'ActivityGrType' => $ActivityGroupType,
'ActivityType' => $ActivityType,
'ActivityGrTypeName' => $ActivityGroupTypeName,
'ActivityTypeName' => $ActivityTypeName,
'ActivityIncMask' => $ActivityIncMask,
'DurationInMin' => $DurationDays,
'DurationStr' => $DurationMin,
'Icon' => $imagename,
'ThumnailImg' => $imagename,
'DetailImg' => $imagename,
'MinPax' => $MinPax,
'MaxPax' => $MaxPax,
'PeakMothMask' => $seasonMonthMasking,
'LeanMonthMask' => $LeanMonthMask,
'SilentMonthMask' => $SilentMonthMask,
'IsTransferInc' => $IsTransferInc,
'IsKidAllowed' => $IsKidAllowed,
'IsTeenAllowed' => $IsTeenAllowed,
'IsAdultAllowed' => $IsAdultAllowed,
'IsPetAllowed' => $IsPetAllowed,
'IsTrxAllowed' => $IsTrxAllowed,
'IsPickAllowed' => $IsPickAllowed,
'StartAgeYr' => $StartAgeYr,
'EndAgeYr' => $EndAgeYr,
'Rating' => $Rating,
'Popularity' => $Popularity,
'ThingsToCarry' => $things_to_carry,
'AwardRecognizations' => $AwardRecognizations,
'BookingType' => $BookingType,
'DifficultyType' => 0,
'DaysWeekMask' => $seasonDaysMasking,
'StartLocalTime' => $StartLocalTime,
'EndLocalTime' => $EndLocalTime,
'TimeSlots' => $time_slots,
'IsDayLightApp' => $IsDayLightApp,
'Address' => $address,
'latitude' => $latitude,
'longitude' => $longitude,
'PinCode' => $PinCode,
'CitySysId' => $CitySysId,
'ZoneSysId' => $ZoneSysId,
'ZoneType' => $ZoneType,
'StateSysId' => $StateSysId,
'ContSysId' => $ContId,
'PickUpLocation' => $pick_drop,
'PrimaryContact' => $PrimaryContact,
'SecondaryContact' => $SecondaryContact,
'OtherContacts' => $OtherContacts,
'UpdateDate' => $UpdateDate,
'ApproveDate' => $ApproveDate,
'ApproveBy' => $ApproveBy,
'CreateDate' => $CreateDate,
'IsApproved' => $IsApproved,
'IsActive' => $IsActive,
'IsMarkForDel' => $IsMarkForDel
);
// echo "<pre>";
// print_r($insert);
// exit;
try {
if($ActivitySysId!="" && $ActivitySysId!=0)
{
$objActivities->updateActivitiesDetails($ActivitySysId, $insert);
$this->_helper->flashMessenger->addMessage("Activities saved successfully.");
if($post['IsFromPackage']){
$this->_helper->redirector('view-flexi-final-package-readymade','package','admin',array('id'=>$post['IsFromPackage']));
} else {
$this->_helper->redirector('manage-activities', 'activities', 'admin');
}
} else {
$objActivities->addActivitiesDetails($insert);
$this->_helper->flashMessenger->addMessage("Activities saved successfully.");
$this->_helper->redirector('add-activities-inventory', 'activities', 'admin');
}
} catch( Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage() );
echo json_encode($response);
exit;
}
}
}
public function saveActivitiesMasterAction()
{
$this->_helper->layout->disableLayout();
if($this->getRequest()->isPost())
{
$post = $this->getRequest()->getPost();
$objActivities = new Travel_Model_TblActivities();
// echo "<pre>";
// print_r($post);
// die('fdfdf');
/* For activities */
if(!empty($post)) {
$ActivitySysId = isset($post['ActivitySysId']) ? $post['ActivitySysId'] : '0';
$ContId = isset($post['ContId']) ? $post['ContId'] : '';
$CitySysId = isset($post['CitySysId']) ? $post['CitySysId'] : '0';
$ActivityGroupType = isset($post['ActivityGroupType']) ? implode(',',$post['ActivityGroupType']) : '';
$ActivityType = isset($post['ActivityType']) ? implode(',',$post['ActivityType']) : '';
$ActivityName = isset($post['ActivityName']) ? $post['ActivityName'] : '';
$Duration = isset($post['Duration']) ? $post['Duration'] : '0';
$difficulty_level = isset($post['difficulty_level']) ? $post['difficulty_level'] : '';
$OperatingTime1 = isset($post['OperatingTime_1']) ? $post['OperatingTime_1'] : '';
$OperatingTime2 = isset($post['OperatingTime_2']) ? $post['OperatingTime_2'] : '';
$OperatingTime3 = isset($post['OperatingTime_3']) ? $post['OperatingTime_3'] : '';
$season_month = isset($post['season_month']) ? $post['season_month'] : '';
$season_day = isset($post['season_day']) ? $post['season_day'] : '';
$age_group = isset($post['AgeGroup']) ? $post['AgeGroup'] : '';
$Popularity = isset($post['Popularity']) ? $post['Popularity'] : '';
$things_to_carry = isset($post['things_to_carry']) ? @implode(",",@$post['things_to_carry']) : '0';
$IsTransferInc = isset($post['Transfers']) ? $post['Transfers'] : '0';
$pick_drop = isset($post['pick_drop']) ? $post['pick_drop'] : '';
$details = isset($post['details']) ? $post['details'] : '';
$address = isset($post['Address']) ? $post['Address'] : '';
$latitude = isset($post['latitude']) ? $post['latitude'] : '0';
$longitude = isset($post['longitude']) ? $post['longitude'] : '0';
$ICSourceSysId = isset($post['ICSourceSysId']) ? $post['ICSourceSysId'] : '0';
$ActivityNameArr = array(); $ActivityGroupNameArr = array();
if(!empty($post['ActivityGroupType'])){
foreach ($post['ActivityGroupType'] as $GroupType) {
$ActivityGroupNameArr[] = isset($GroupType)?$objActivities->getActivityGroupName($GroupType):'0';
}
}
if(!empty($post['ActivityType'])){
foreach ($post['ActivityType'] as $value) {
$ActivityNameArr[] = isset($value)?$objActivities->getActivityName($value):'0';
}
}
$ActivityGroupTypeName = isset($ActivityGroupNameArr) ? json_encode($ActivityGroupNameArr) : '';
$ActivityTypeName = isset($ActivityNameArr) ? json_encode($ActivityNameArr) : '';
}
if(!empty($OperatingTime1) && empty($OperatingTime2) && empty($OperatingTime3))
{
$OperatingTime = array($OperatingTime1);
}
else {
$OperatingTime = $OperatingTime1;
}
if(!empty($OperatingTime1) && !empty($OperatingTime2))
{
$OperatingTime = array($OperatingTime1, $OperatingTime2);
}
if(!empty($OperatingTime1) && !empty($OperatingTime2) && !empty($OperatingTime3))
{
$OperatingTime = array($OperatingTime1, $OperatingTime2, $OperatingTime3);
}
if(!empty($OperatingTime))
{
$time_slots = json_encode($OperatingTime);
} else {
$time_slots = '';
}
if(!empty($age_group))
{
$StartAgeYr = $age_group[0];
$EndAgeYr = $age_group[1];
} else {
$StartAgeYr = 0;
$EndAgeYr = 0;
}
$arrActivitiesDetails = $objActivities->getManageActivitiesDetails($ActivitySysId, @$intLoggedinUserId);
$UpdateDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$CreateDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
//Fixed variables
$StartPlaceSysId = 0;
$EndPlaceSysId = 0;
$AliasAndMeta = "";
$ActivityIncMask=0;
$DurationInMin=0;
$MinPax =0;
$MaxPax = 0;
$LeanMonthMask="1000000000000";
$SilentMonthMask="1000000000000";
if($arrActivitiesDetails['IsKidAllowed']!="")
{
$IsKidAllowed = $arrActivitiesDetails['IsKidAllowed'];
} else {
$IsKidAllowed = 0;
}
if($arrActivitiesDetails['IsTeenAllowed']!="")
{
$IsTeenAllowed = $arrActivitiesDetails['IsTeenAllowed'];
} else {
$IsTeenAllowed = 0;
}
if($arrActivitiesDetails['IsAdultAllowed']!="")
{
$IsAdultAllowed = $arrActivitiesDetails['IsAdultAllowed'];
} else {
$IsAdultAllowed = 0;
}
if($arrActivitiesDetails['IsPetAllowed']!="")
{
$IsPetAllowed = $arrActivitiesDetails['IsPetAllowed'];
} else {
$IsPetAllowed = 0;
}
if($arrActivitiesDetails['IsTrxAllowed']!="")
{
$IsTrxAllowed = $arrActivitiesDetails['IsTrxAllowed'];
} else {
$IsTrxAllowed = 0;
}
if($arrActivitiesDetails['IsPickAllowed']!="")
{
$IsPickAllowed = $arrActivitiesDetails['IsPickAllowed'];
} else {
$IsPickAllowed = 0;
}
$Rating=0;
if($arrActivitiesDetails['AwardRecognizations']!="" && $arrActivitiesDetails['AwardRecognizations']!=0)
{
$AwardRecognizations = $arrActivitiesDetails['AwardRecognizations'];
} else {
$AwardRecognizations = "";
}
if($arrActivitiesDetails['BookingType']!="")
{
$BookingType = $arrActivitiesDetails['BookingType'];
} else {
$BookingType = 0;
}
if($arrActivitiesDetails['StartLocalTime']!="")
{
$StartLocalTime = $arrActivitiesDetails['StartLocalTime'];
} else {
$StartLocalTime = $CreateDate;
}
if($arrActivitiesDetails['EndLocalTime']!="")
{
$EndLocalTime = $arrActivitiesDetails['EndLocalTime'];
} else {
$EndLocalTime = $CreateDate;
}
$IsDayLightApp =0;
// if($arrActivitiesDetails['latitude']!="" && $arrActivitiesDetails['latitude']!=0)
// {
// $latitude = $arrActivitiesDetails['latitude'];
// } else {
// $latitude = 0;
// }
// if($arrActivitiesDetails['longitude']!="" && $arrActivitiesDetails['longitude']!=0)
// {
// $longitude = $arrActivitiesDetails['longitude'];
// } else {
// $longitude = 0;
// }
$PinCode="";
$ZoneSysId =0;
$ZoneType=0;
$StateSysId=0;
if($arrActivitiesDetails['PrimaryContact']!="" && $arrActivitiesDetails['PrimaryContact']!=0)
{
$PrimaryContact = $arrActivitiesDetails['PrimaryContact'];
} else {
$PrimaryContact = "";
}
if($arrActivitiesDetails['SecondaryContact']!="" && $arrActivitiesDetails['SecondaryContact']!=0)
{
$SecondaryContact = $arrActivitiesDetails['SecondaryContact'];
} else {
$SecondaryContact = "";
}
if($arrActivitiesDetails['OtherContacts']!="" && $arrActivitiesDetails['OtherContacts']!=0)
{
$OtherContacts = $arrActivitiesDetails['OtherContacts'];
} else {
$OtherContacts = "";
}
$ApproveBy = $this->intLoggedinUserId;
$ApproveDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
if($ActivitySysId!="" && $ActivitySysId!=0)
{
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
if(!empty($_FILES['activitiesIcon']['name'])){
$unique = substr(time(), 0,5);
$upload = new Zend_File_Transfer_Adapter_Http();
$files = $upload->getFileInfo();
$file_name = $unique.'_'.$_FILES['activitiesIcon']['name'];
$imagename = $this->siteUrl."/public/upload/city/" . $CitySysId . "/activities/".$file_name;
$tmp_name = $_FILES['activitiesIcon']['tmp_name'];
$originalThumbFolder = $_SERVER["DOCUMENT_ROOT"] . "/public/upload/city/" . $CitySysId . "/activities";
/* Create directory if not exists */
if (!file_exists($originalThumbFolder)) {
@mkdir($originalThumbFolder, 0777, true);
}
//Remove file
if(!empty($arrActivitiesDetails))
{
$Icon = trim($arrActivitiesDetails['Icon']);
if($Icon!="No File" && $Icon!="")
{
$imagename_edit = $Icon;
}
@unlink($imagename_edit);
}
$toupload = @move_uploaded_file($tmp_name,$originalThumbFolder.'/'.$file_name);
}
else
{
if(!empty($arrActivitiesDetails))
{
if($arrActivitiesDetails['Icon']!="")
{
$imagename = $arrActivitiesDetails['Icon'];
}
} else
{
$imagename = 'No File';
}
}
// $AgentSysId = $arrActivitiesDetails['AgentSysId'];
// $IsAgentSpec = $arrActivitiesDetails['IsAgentSpec'];
// $IsApproved = $arrActivitiesDetails['IsApproved'];
// $IsActive = $arrActivitiesDetails['IsActive'];
// $IsMarkForDel = $arrActivitiesDetails['IsMarkForDel'];
} else {
if(!empty($_FILES['activitiesIcon']['name'])){
$unique = substr(time(), 0,5);
$upload = new Zend_File_Transfer_Adapter_Http();
$files = $upload->getFileInfo();
$file_name = $unique.'_'.$_FILES['activitiesIcon']['name'];
$imagename = $this->siteUrl."/public/upload/city/" . $CitySysId . "/activities/".$file_name;
$tmp_name = $_FILES['activitiesIcon']['tmp_name'];
$originalThumbFolder = $_SERVER["DOCUMENT_ROOT"] . "/public/upload/city/" . $CitySysId . "/activities";
/* Create directory if not exists */
if (!file_exists($originalThumbFolder)) {
@mkdir($originalThumbFolder, 0777, true);
}
$toupload = @move_uploaded_file($tmp_name,$originalThumbFolder.'/'.$file_name);
}
else
{
$imagename = 'No File';
}
// if($this->intLoggedinUserRole!=1)
// {
// $AgentSysId = $this->intLoggedinUserAgencySysId;
// $IsAgentSpec = 1;
// $IsApproved = 0;
// $IsActive = 1;
// $IsMarkForDel = 0;
// } else {
// $AgentSysId = 0;
// $IsAgentSpec = 0;
// $IsApproved = 1;
// $IsActive = 1;
// $IsMarkForDel = 0;
// }
}
//create season masking
if(!empty($season_month))
{
$season_month_arr = unserialize(SEASON_MONTH);
$seasonMonthMasking = $objActivities->setMasking($season_month, $season_month_arr);
} else {
$seasonMonthMasking = "1000000000000";
}
//Days of week Masking
if(!empty($season_day))
{
$season_day_arr = unserialize(SEASON_DAYS);
$seasonDaysMasking = $objActivities->setMasking($season_day, $season_day_arr);
} else {
$seasonDaysMasking = "10000000";
}
//Added by pooja
if ($ActivitySysId == "" && $ActivitySysId == 0) {
$insert['AgentSysId'] = $AgentSysId;
}
//end
if(!empty($Duration))
{
$DurationDays = $Duration[0];
$DurationMin = $Duration[1];
} else {
$DurationDays = 0;
$DurationMin = 0;
}
$insert =
array(
'IsAgentSpec' => 0,
'ICSourceSysId' => 0,
'StartPlaceSysId' => $StartPlaceSysId,
'EndPlaceSysId' => $EndPlaceSysId,
'Title' => $ActivityName,
'WriteUp' => $details,
'DifficultyLevel' => $difficulty_level,
'AliasAndMeta' => $AliasAndMeta,
'ActivityGrType' => $ActivityGroupType,
'ActivityType' => $ActivityType,
'ActivityGrTypeName' => $ActivityGroupTypeName,
'ActivityTypeName' => $ActivityTypeName,
'ActivityIncMask' => $ActivityIncMask,
'DurationInMin' => $DurationDays,
'DurationStr' => $DurationMin,
'Icon' => $imagename,
'ThumnailImg' => $imagename,
'DetailImg' => $imagename,
'MinPax' => $MinPax,
'MaxPax' => $MaxPax,
'PeakMothMask' => $seasonMonthMasking,
'LeanMonthMask' => $LeanMonthMask,
'SilentMonthMask' => $SilentMonthMask,
'IsTransferInc' => $IsTransferInc,
'IsKidAllowed' => $IsKidAllowed,
'IsTeenAllowed' => $IsTeenAllowed,
'IsAdultAllowed' => $IsAdultAllowed,
'IsPetAllowed' => $IsPetAllowed,
'IsTrxAllowed' => $IsTrxAllowed,
'IsPickAllowed' => $IsPickAllowed,
'StartAgeYr' => $StartAgeYr,
'EndAgeYr' => $EndAgeYr,
'Rating' => $Rating,
'Popularity' => $Popularity,
'ThingsToCarry' => $things_to_carry,
'AwardRecognizations' => $AwardRecognizations,
'BookingType' => $BookingType,
'DifficultyType' => 0,
'DaysWeekMask' => $seasonDaysMasking,
'StartLocalTime' => $StartLocalTime,
'EndLocalTime' => $EndLocalTime,
'TimeSlots' => $time_slots,
'IsDayLightApp' => $IsDayLightApp,
'Address' => $address,
'latitude' => $latitude,
'longitude' => $longitude,
'PinCode' => $PinCode,
'CitySysId' => $CitySysId,
'ZoneSysId' => $ZoneSysId,
'ZoneType' => $ZoneType,
'StateSysId' => $StateSysId,
'ContSysId' => $ContId,
'PickUpLocation' => $pick_drop,
'PrimaryContact' => $PrimaryContact,
'SecondaryContact' => $SecondaryContact,
'OtherContacts' => $OtherContacts,
'UpdateDate' => $UpdateDate,
'ApproveDate' => $ApproveDate,
'ApproveBy' => $ApproveBy,
'IsApproved' => 1,
'IsActive' => 1
);
// echo "<pre>";
// print_r($insert);
// die('ddd');
try {
if($ActivitySysId!="" && $ActivitySysId!=0)
{
$objActivities->updateActivitiesDetails($ActivitySysId, $insert);
$this->_helper->flashMessenger->addMessage("Activities saved successfully.");
if($post['IsFromPackage']){
$this->_helper->redirector('view-flexi-final-package-readymade','package','admin',array('id'=>$post['IsFromPackage']));
} else {
$this->_helper->redirector('mappingactivities', 'activities', 'admin',array('id'=>base64_encode($ContId).'_'.base64_encode($CitySysId).'_'.base64_encode($ICSourceSysId)));
}
} else {
$objActivities->addActivitiesDetails($insert);
$this->_helper->flashMessenger->addMessage("Activities saved successfully.");
$this->_helper->redirector('add-activities-inventory', 'activities', 'admin');
}
} catch( Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage() );
echo json_encode($response);
exit;
}
}
}
public function addSupplierAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
//Get Country List
$objCountry = new Travel_Model_TblCountry();
$this->view->arrCountryList = $objCountry->getCountryList();
}
public function saveSupplierAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Get Post form data
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
$currentDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$SupplierName = $this->getRequest()->getPost('SupplierName') ? $this->getRequest()->getPost('SupplierName') : '';
$ContactPerson = $this->getRequest()->getPost('ContactPerson') ? $this->getRequest()->getPost('ContactPerson') : '';
$Designation = $this->getRequest()->getPost('Designation') ? $this->getRequest()->getPost('Designation') : '';
$ContactNo = $this->getRequest()->getPost('ContactNo') ? $this->getRequest()->getPost('ContactNo') : '';
$EmailId = $this->getRequest()->getPost('EmailId') ? $this->getRequest()->getPost('EmailId') : '';
$Address = $this->getRequest()->getPost('Address') ? $this->getRequest()->getPost('Address') : '';
$ContId = $this->getRequest()->getPost('ContId') ? $this->getRequest()->getPost('ContId') : '';
$CitySysId = $this->getRequest()->getPost('CitySysId') ? $this->getRequest()->getPost('CitySysId') : '';
$SupplierTypeSysId = $this->SupplierTypeSysId;
$FacilityMask = 0;
$PrefCurrencyType = 1;
$StateId =0;
$PlaceSysId =0;
$IsCreatedByAgent = 1;
$AgentSysId = $this->intLoggedinUserId;
$UpdatedDate = $currentDate;
$CreateDate = $currentDate;
$ApproveDate = '';
$IsApproved =0;
$IsDelete = 0;
$IsActive = 1;
if(empty($post) || empty($this->intLoggedinUserId)) {
throw new Exception('There has been an error, Please try again later');
}
$insert =
array(
'SupplierTypeSysId' => $SupplierTypeSysId,
'FacilityMask' => $FacilityMask,
'SupplierName' => $SupplierName,
'ContactPerson' => $ContactPerson,
'PrefCurrencyType' => $PrefCurrencyType,
'Designation' => $Designation,
'ContactNo' => $ContactNo,
'EmailId' => $EmailId,
'Address' => $Address,
'CitySysId' => $CitySysId,
'ContId' => $ContId,
'StateId' => $StateId,
'PlaceSysId' => $PlaceSysId,
'IsCreatedByAgent' => $IsCreatedByAgent,
'AgentSysId' => $AgentSysId,
'PlaceSysId' => $PlaceSysId,
'UpdatedDate' => $UpdatedDate,
'CreateDate' => $CreateDate,
'ApproveDate' => $ApproveDate,
'IsApproved' => $IsApproved,
'IsDelete' => $IsDelete,
'IsActive' => $IsActive
);
// echo "<pre>";
// print_r($insert);
// exit;
try {
//Call Supplier Model
$objSupplier = new Travel_Model_TblSupplier();
$lastInsertId = $objSupplier->addSupplier($insert);
$arrSupplierList = $objSupplier->getSupplierList($lastInsertId);
$response = array('success' => 'Supplier saved successfully.', 'supplier_list'=>$arrSupplierList);
echo json_encode($response);
exit;
} catch( Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage() );
echo json_encode($response);
exit;
}
}
}
public function getCountryAutoSearchAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$strCountryName = $this->getRequest()->getParam('term');
$objActivities = new Travel_Model_TblActivities();
$result = $objActivities->getCountryList($strCountryName);
//echo "<pre>";print_r($result);die;
// if(count($result) != 1) {
// throw new Exception('There has been a technical error. Please try again later.');
// }
echo $this->_helper->json($result);
exit;
}
}
public function getCityAutoSearchAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$strCityName = $this->getRequest()->getParam('term');
$strcountryId = $this->getRequest()->getParam('countryId');
$objActivities = new Travel_Model_TblActivities();
$result = $objActivities->getCityList($strCityName, $strcountryId);
//echo "<pre>";print_r($result);die;
// if(count($result) != 1) {
// throw new Exception('There has been a technical error. Please try again later.');
// }
echo $this->_helper->json($result);
exit;
}
}
public function getActivitiesAutoSearchAction() {
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
$strActivitiesName = $this->getRequest()->getParam('term');
$strcountryId = $this->getRequest()->getParam('countryId');
$strCitySysId = $this->getRequest()->getParam('CitySysId');
$AgentSysId = $this->intLoggedinUserAgencySysId;
$objActivities = new Travel_Model_TblActivities();
$rowset = $objActivities->getActivitiesList($AgentSysId, $strActivitiesName,$strcountryId,$strCitySysId);
//echo "<pre>";print_r($result);die;
if(!empty($rowset)){
foreach($rowset as $row) {
$response[] = array('ActivitySysId'=>$row['ActivitySysId'],'value' => $row['Title'], 'label' => $row['Title']);
}
} else {
$response[] = array('ActivitySysId'=>0,'value' => 'Add New Activity' , 'label' => 'Add New Activity');
}
echo $this->_helper->json($response);
exit;
}
}
public function addActivitiesAction()
{
$this->_helper->layout->disableLayout();
//Get Country List
$objCountry = new Travel_Model_TblCountry();
$this->view->arrCountryList = $objCountry->getCountryList();
//Get Activities Group Type List
$objActivities = new Travel_Model_TblActivities();
$this->view->arrActivitiesGroupTypeList = $objActivities->getAllActivityGroupTypeList();
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
//Get Difficulty Type List
$this->view->arrDifficultyTypeList = $objActivities->getAllDifficultyTypeList();
}
public function saveActivitiesInventoryAction() {
$this->_helper->layout->disableLayout();
$this->_helper->flashMessenger->addMessage("Activities Inventory saved successfully.");
$this->_helper->redirector('index', 'activities', 'admin');
}
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;
$result = $objSupplier->getSupplierAutoSearchList($strSupplierName, $AgentId);
//echo "<pre>";print_r($result);die;
// if(count($result) != 1) {
// throw new Exception('There has been a technical error. Please try again later.');
// }
echo $this->_helper->json($result);
exit;
}
}
public function saveInventoryAction() {
/* Disable layout */
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
/* If ajax request */
if ($this->_request->isXmlHttpRequest()) {
$post = $this->getRequest()->getPost();
//echo "<pre>"; print_r($post);
$objActivities = new Travel_Model_TblActivities();
$objAgency = new Travel_Model_TblAgency();
$ContId = !empty($post['ContId']) ? $post['ContId'] : '0';
$CitySysId = !empty($post['CitySysId']) ? $post['CitySysId'] : '0';
$InvnItemSysId = !empty($post['InvnItemSysId']) ? $post['InvnItemSysId'] : '0';
$activity_name = !empty($post['activity_name']) ? $post['activity_name'] : '';
$activity_id = !empty($post['activity_id']) ? $post['activity_id'] : '0';
$inclusions_id = !empty(@$post['inclusions_id']) ? @implode(",",@$post['inclusions_id']) : '';
$transfers = !empty($post['transfers']) ? $post['transfers'] : '0';
$from_date = !empty($post['activities_from_date']) ? $post['activities_from_date'] : '';
$to_date = !empty($post['activities_to_date']) ? $post['activities_to_date'] : '';
$currency_type = !empty($post['currency_type']) ? $post['currency_type'] : '';
$adult_cost_natives = !empty($post['activities_adult_cost_natives']) ? $post['activities_adult_cost_natives'] : '0';
$kids_cost_natives = !empty($post['activities_kids_cost_natives']) ? $post['activities_kids_cost_natives'] : '0';
$adult_cost_foreigners = !empty($post['activities_adult_cost_foreigners']) ? $post['activities_adult_cost_foreigners'] : '0';
$kids_cost_foreigners = !empty($post['activities_kids_cost_foreigners']) ? $post['activities_kids_cost_foreigners'] : '0';
$booking_type = !empty($post['booking_type']) ? $post['booking_type'] : '';
$supplier_type = !empty($post['supplier_type']) ? $post['supplier_type'] : '';
$supplier_type_id = !empty($post['supplier_type_id']) ? $post['supplier_type_id'] : '';
$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 = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$intLoggedinUserId = $this->intLoggedinUserId;
$agencyDetails = $objAgency->getAgencyUserList($intLoggedinUserAgencySysId);
if($this->intLoggedinUserTrxCurrency!=0)
{
$TrxCurrency = $this->intLoggedinUserTrxCurrency;
} else {
$TrxCurrency = $agencyDetails['TrxCurrency'];
}
if($ContId==0) {
$response = array('success'=> false, 'msg' => 'Please select country');
echo json_encode($response);
exit;
}
if($CitySysId==0) {
$response = array('success'=> false, 'msg' => 'Please select city');
echo json_encode($response);
exit;
}
if($activity_id==0) {
$response = array('success'=> false, 'msg' => 'Please enter activity name');
echo json_encode($response);
exit;
}
if(empty(@$inclusions_id)) {
$response = array('success'=> false, 'msg' => 'Please select inclusions');
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;
}
if(empty($adult_cost_natives)) {
$response = array('success'=> false, 'msg' => 'Please enter native adult cost');
echo json_encode($response);
exit;
}
// if(empty($kids_cost_natives)) {
// $response = array('success'=> false, 'msg' => 'Please enter native kids cost');
// echo json_encode($response);
// exit;
// }
if(empty($adult_cost_foreigners)) {
$response = array('success'=> false, 'msg' => 'Please enter foreigners adult cost');
echo json_encode($response);
exit;
}
// if(empty($kids_cost_foreigners)) {
// $response = array('success'=> false, 'msg' => 'Please enter foreigners kids cost');
// echo json_encode($response);
// exit;
// }
if($booking_type==0) {
$response = array('success'=> false, 'msg' => 'Please select booking type');
echo json_encode($response);
exit;
}
if($supplier_type=="" || $supplier_type_id==0)
{
$response = array('success'=> false, 'msg' => 'Please enter supplier name');
echo json_encode($response);
exit;
}
//echo "<pre>"; print_r($post);die;
//Get Sipplier Masking
if($supplier_type_id!="" && $supplier_type_id!=0)
{
$objSupplier = new Travel_Model_TblSupplier();
$supplierDetails = $objSupplier->getSupplierList($supplier_type_id);
$supplierMasking = $supplierDetails['Services'];
//Get Old Masking Array
$SupplierServicesArrDB = $objSupplier->getSupplierServices(); //Get Supplier Services
$servicesMaskingArr = $objSupplier->getMasking($supplierMasking, $SupplierServicesArrDB, 'SupplierSerSysId');
$ActivitiesSupplierTypeSysIdArr = array($this->SupplierTypeSysId);
$newMaskingArr = array_unique(array_merge($servicesMaskingArr,$ActivitiesSupplierTypeSysIdArr));
//Set new masking string
$supplierServicesNewMasking = $objSupplier->setMasking($newMaskingArr, $SupplierServicesArrDB, 'SupplierSerSysId');
//echo $supplierServicesNewMasking; die;
//Update Masking
$supplierMaskingUpdateArr = array('Services'=>$supplierServicesNewMasking);
$objSupplier->updateSupplier($supplierMaskingUpdateArr, $supplier_type_id);
}
//Insert data array
$insertData = array('InventoryType' => '2','XRef'=>$activity_id,'AgencySysId' => $intLoggedinUserAgencySysId,'SupplierSysId' => $supplier_type_id,'FromDate' => $strFromDate, 'ToDate' => $strToDate,
'BookingType'=>$booking_type, 'inclusions'=>$inclusions_id ,'IsTransferInc'=>$transfers, 'IsPickDropInc'=>0,'PurchasedQty' => 0,'PublishQty' => 0, 'BlockQty' =>'0', 'SoldQty' => '0','ReturnQty' => '0', 'NetInHandQty' => 0,
'CostCurrency' => $currency_type, 'TotalCostNativeAdult'=>$adult_cost_natives,'TotalCostNativeChild'=>$kids_cost_natives,'TotalCostForeignerAdult'=>$adult_cost_foreigners,'TotalCostForeignerChild'=>$kids_cost_foreigners,
'TrxCurrency' => $TrxCurrency, 'SaleAmtNativeChild' => 0, 'SaleAmtNativeAdult' => '0','SaleAmtForeignerChild' => 0, 'SaleAmtForeignerAdult'=>0 ,'Brief' => '', 'IfAnyOffer' => '0', 'OfferMsg' => '', 'OfferImage' => '',
'TCInfo' => '', 'TCDocPath'=>'', 'IxFixedDateInven' => '0', 'CreatorSysId' => $intLoggedinUserId, 'ApproveDate' => $currentDate, 'CreateDate' => $currentDate,
'UpdateDate' => $currentDate, 'IsActive' => '1', 'IsMarkForDelete' => 0, 'IsApproved' => '1'
);
//echo "<pre>";print_r($insertData); die;
$intLastInsertId = $objActivities->addActivitiesInventory($insertData);
//$intLastInsertId = 1;
$response = array('success'=>true,'intLastInsertId' => $intLastInsertId);
echo json_encode($response);
exit;
}
}
public function viewActivitiesInventoryTableAction()
{
/* Disable layout */
$this->_helper->layout->disableLayout();
//$this->view->headScript()->appendFile('/public/assets/css/style.css');
//$this->view->headScript()->appendFile('/public/assets/css/bootstrap.min.css');
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryList = $objActivities->getAllActivitiesInventoryList($intLoggedinUserAgencySysId);
$this->view->arrActivitiesInventoryList = $arrActivitiesInventoryList;
// echo "<pre>";
// print_r($arrActivitiesInventoryList);
// exit;
}
public function manageGroupAction()
{
/* Disable layout */
$this->_helper->layout->disableLayout();
$InvnItemSysId = $this->getRequest()->getParam('id');
$key = $this->getRequest()->getParam('key');
//echo "dsbfsjdugf sid";
//echo $InvnItemSysId;
//die;
$this->view->key = $key;
$this->view->InvnItemSysId = $InvnItemSysId;
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
//echo $InvnItemSysId;
$objActivities = new Travel_Model_TblActivities();
$arrActivitiesInventoryList = $objActivities->getActivitiesInventoryList($InvnItemSysId, $intLoggedinUserAgencySysId);
//echo "<pre>";print_r($arrActivitiesInventoryList);die;
if(count($arrActivitiesInventoryList) <> 1 ) {
throw new Exception('There has been an error, Please try again later');
}
}
public function manageMarkupAction()
{
/* Disable layout */
$this->_helper->layout->disableLayout();
$InvnItemSysId = $this->getRequest()->getParam('id');
$key = $this->getRequest()->getParam('key');
$popupType = $this->getRequest()->getParam('popupType');
//echo "dsbfsjdugf sid";
//echo $InvnItemSysId;
//die;
$this->view->key = $key;
$this->view->popupType = $popupType;
$this->view->InvnItemSysId = $InvnItemSysId = $this->getRequest()->getParam('id');
//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;
if(count($arrActivitiesInventoryList) <> 1 ) {
throw new Exception('There has been an error, Please try again later');
}
}
public function managePoliciesAction() {
/* Disable layout */
$this->_helper->layout->disableLayout();
$key = $this->getRequest()->getParam('key');
$popupType = $this->getRequest()->getParam('popupType');
$this->view->key = $key;
$this->view->popupType = $popupType;
$this->view->InvnItemSysId = $InvnItemSysId = $this->getRequest()->getParam('id');
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryList = $objActivities->getActivitiesInventoryList($InvnItemSysId, $intLoggedinUserAgencySysId);
//echo "<pre>";print_r($arrFlightInventoryList);die;
if(count($arrActivitiesInventoryList) <> 1 ) {
throw new Exception('There has been an error, Please try again later');
}
}
public function viewMarkupSettingGridAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if($this->_request->isXmlHttpRequest()) {
$objAgency = new Travel_Model_TblAgency();
$InvnItemSysId = $this->getRequest()->getParam('InvnItemSysId');
$MarkupSetting = $this->getRequest()->getParam('MarkupSetting');
$intAgencySysId = $this->intLoggedinUserAgencySysId;
$objActivities = new Travel_Model_TblActivities();
$arrActivitiesInventoryList = $objActivities->getActivitiesInventoryList($InvnItemSysId, $intAgencySysId);
//echo "<pre>";print_r($arrFlightInventoryList);die;
if(count($arrActivitiesInventoryList) <> 1 ) {
throw new Exception('There has been an error, Please try again later');
}
if($MarkupSetting == 'STANDARD') {
$this->view->arrActivitiesInventoryList = $arrActivitiesInventoryList;
$this->view->agencyDetails = $objAgency->getAgencyUserList($intAgencySysId);
//For Natives
//echo $intAgencySysId;
$arrStandardMarkups = $objActivities->getStandardMarkupsActivities($intAgencySysId);
//echo "<pre>"; print_r($arrStandardMarkups);die;
$this->view->arrStandardNativesMarkups = $arrStandardMarkups;
//For Natives
//$arrStandardForeignersMarkups = $objActivities->getStandardMarkupsActivities($intAgencySysId, $cost_markup='2');
//echo "<pre>"; print_r($arrStandardForeignersMarkups);die;
//$this->view->arrStandardForeignersMarkups = $arrStandardForeignersMarkups;
} else if($MarkupSetting == 'CUSTOMIZE') {
$this->view->arrActivitiesInventoryList = $arrActivitiesInventoryList;
$this->view->agencyDetails = $objAgency->getAgencyUserList($intAgencySysId);
//For Natives
$this->view->arrActivitiesNativesAllocMarketPlaces = $objActivities->getActivitiesMarketPlacesByAgencySysId($InvnItemSysId,$intAgencySysId,$cost_markup='1');
//For Foreigners
$this->view->arrActivitiesForeignersAllocMarketPlaces = $objActivities->getActivitiesMarketPlacesByAgencySysId($InvnItemSysId,$intAgencySysId,$cost_markup='2');
//For Natives
$arrCustomizedMarkups = $objActivities->getCustomizedMarkups($InvnItemSysId,$MPType='', $intAgencySysId, $cost_markup='1');
//echo "<pre>"; print_r($arrCustomizedMarkups);die;
$this->view->arrCustomizedNativesMarkups = $arrCustomizedMarkups;
//For Foreigners
$arrForeignersCustomizedMarkups = $objActivities->getCustomizedMarkups($InvnItemSysId,$MPType='', $intAgencySysId, $cost_markup='2');
//echo "<pre>"; print_r($arrCustomizedMarkups);die;
$this->view->arrForeignersCustomizedMarkups = $arrForeignersCustomizedMarkups;
} else if($MarkupSetting == 'STANDARDPOLICIES') {
$this->view->arrStandardMarkupsPolicies = $objActivities->getStandardMarkupsPolicies($InvnItemSysId);
} else if($MarkupSetting == 'CUSTOMIZEPOLICIES') {
$this->view->arrCustomizedMarkupPolicies = $objActivities->getCustomizedMarkupsPolicies($InvnItemSysId);
} else if($MarkupSetting == 'GROUP') {
$this->view->arrCustomizedGroupList = $objActivities->getActivitiesGroupList($InvnItemSysId);
} else {
throw new Exception('Markup settings not found.');
}
$this->view->InvnItemSysId = $InvnItemSysId;
$this->view->MarkupSetting = $MarkupSetting;
$this->view->arrMarketPlaces = Zend_Controller_Action_HelperBroker::getStaticHelper('B2B')->getMarketPlaces();
$this->view->arrPermissions = Zend_Controller_Action_HelperBroker::getStaticHelper('B2B')->getPermissions();
if($MarkupSetting == 'STANDARD') {
$this->render('view-standard-fixed-amount-grid');
} else if($MarkupSetting == 'CUSTOMIZE') {
$this->render('view-customize-fixed-amount-grid');
} else if($MarkupSetting == 'STANDARDPOLICIES') {
$this->render('view-standard-fixed-policies-grid');
} else if($MarkupSetting == 'CUSTOMIZEPOLICIES') {
$this->render('view-customize-fixed-policies-grid');
} else if($MarkupSetting == 'GROUP') {
$this->render('view-customize-group-grid');
}
}
}
public function calculateNetsalepriceCustomizedMarkupAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Get Post form data
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
$cost = $post['cost'];
$markup = $post['markup'];
$tax = $post['tax'];
$discount = $post['discount'];
if($cost)
{
$formDataValFinal = $cost;
}
if($markup!=0)
{
$formDataValFinal = $formDataValFinal + $markup;
}
if($tax!=0)
{
$formDataValFinal = $formDataValFinal + $tax;
}
if($discount!=0)
{
$formDataValFinal = $formDataValFinal - $discount;
} else {
$formDataValFinal = $formDataValFinal;
}
$discountPrice = 0;
$response = array('success' => true, 'netSalePrice' => $formDataValFinal,'discountPrice' => $discountPrice);
echo json_encode($response);
exit;
}
}
public function addCustomizedGroupAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Call Activities Model
$objActivities = new Travel_Model_TblActivities();
//Get Post form data
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
$InvnItemSysId = $this->getRequest()->getPost('InvnItemSysId');
if(empty($InvnItemSysId) || empty($this->intLoggedinUserId)) {
throw new Exception('There has been an error, Please try again later');
}
/* For Customize Markup Type */
if(!empty($post)) {
$PaxCount = !empty($post['PaxCount']) ? $post['PaxCount'] : '0';
$TotalCostNativeAdult = !empty($post['TotalCostNativeAdult']) ? $post['TotalCostNativeAdult'] : '0';
$TotalCostNativeChild = !empty($post['TotalCostNativeChild']) ? $post['TotalCostNativeChild'] : '0';
$TotalCostForeignerAdult = !empty($post['TotalCostForeignerChild']) ? $post['TotalCostForeignerChild'] : '0';
$TotalCostForeignerChild = !empty($post['TotalCostForeignerAdult']) ? $post['TotalCostForeignerAdult'] : '0';
$objAgency = new Travel_Model_TblAgency();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$agencyDetails = $objAgency->getAgencyUserList($intLoggedinUserAgencySysId);
//echo "<pre>"; print_r($agencyDetails);die;
if(!empty($agencyDetails))
{
$TrxCurrency = $agencyDetails['TrxCurrency'];
} else {
$TrxCurrency = 1;
}
$SaleAmtNativeChild = 0;
$SaleAmtNativeAdult =0;
$SaleAmtForeignerChild=0;
$SaleAmtForeignerAdult=0;
$TCInfo='';
$TCDocPath='';
$currentDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$IsApproved =0;
$IsMarkForDel=0;
$IsActive =1;
/* For Fixed Amount Markup Type */
} else {
throw new Exception('There has been an error, Please try again later');
}
if(empty($PaxCount)) {
$response = array('success' => false, 'msg' => 'Please enter pax.');
echo json_encode($response);
exit;
}
if($PaxCount<=0) {
$response = array('success' => false, 'msg' => 'Please enter pax should be greater than zero');
echo json_encode($response);
exit;
}
if(empty($TotalCostNativeAdult)) {
$response = array('success' => false, 'msg' => 'Please enter native adult cost.');
echo json_encode($response);
exit;
}
if($TotalCostNativeAdult<=0) {
$response = array('success' => false, 'msg' => 'Please enter native adult cost should be greater than zero');
echo json_encode($response);
exit;
}
if(empty($TotalCostNativeChild)) {
$response = array('success' => false, 'msg' => 'Please enter native kids cost.');
echo json_encode($response);
exit;
}
if($TotalCostNativeChild<=0) {
$response = array('success' => false, 'msg' => 'Please enter native kids cost should be greater than zero');
echo json_encode($response);
exit;
}
if(empty($TotalCostForeignerAdult)) {
$response = array('success' => false, 'msg' => 'Please enter foreigners adult cost.');
echo json_encode($response);
exit;
}
if($TotalCostForeignerAdult<=0) {
$response = array('success' => false, 'msg' => 'Please enter foreigners adult cost should be greater than zero');
echo json_encode($response);
exit;
}
if(empty($TotalCostForeignerChild)) {
$response = array('success' => false, 'msg' => 'Please enter foreigners kids cost.');
echo json_encode($response);
exit;
}
if($TotalCostForeignerChild<=0) {
$response = array('success' => false, 'msg' => 'Please enter foreigners kids cost should be greater than zero');
echo json_encode($response);
exit;
}
/* Check if group settings already exists */
$arrGroupPaxCountSettings = $objActivities->getActivitiesGroupList($InvnItemSysId, $PaxCount);
if(!empty($arrGroupPaxCountSettings)) {
$response = array('success' => false, 'msg' => 'Pax has been already added.');
echo json_encode($response);
exit;
}
$insert =
array(
'InvnItemSysId' => $InvnItemSysId,
'PaxCount' => $PaxCount,
'TotalCostNativeAdult' => $TotalCostNativeAdult,
'TotalCostNativeChild' => $TotalCostNativeChild,
'TotalCostForeignerChild' => $TotalCostForeignerChild,
'TotalCostForeignerAdult' => $TotalCostForeignerAdult,
'TrxCurrency' => $TrxCurrency,
'SaleAmtNativeChild' => $SaleAmtNativeChild,
'SaleAmtNativeAdult' => $SaleAmtNativeAdult,
'SaleAmtForeignerChild' => $SaleAmtForeignerChild,
'SaleAmtForeignerAdult' => $SaleAmtForeignerAdult,
'TCInfo' => $TCInfo,
'TCDocPath' => $TCDocPath,
'CreateDate' => $currentDate,
'UpdateDate' => $currentDate,
'IsApproved' => $IsApproved,
'IsMarkForDelete' => $IsMarkForDel,
'IsActive' => $IsActive
);
// echo "<pre>";
// print_r($insert);
// exit;
try {
$objActivities->addGroupSettings($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 deleteCustomizedGroupSettingAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$InvnItemSysId = $this->getRequest()->getParam('InvnItemSysId');
$PaxVal = $this->getRequest()->getParam('PaxVal');
$objActivities = new Travel_Model_TblActivities();
$objActivities->deleteCustomizedGroupSetting($InvnItemSysId, $PaxVal);
$response = array('success' => true);
echo json_encode($response);
exit;
}
}
public function addCustomizedMarkupAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Call Activities Model
$objActivities = new Travel_Model_TblActivities();
//Get Post form data
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
$currentDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$intMarkupType = $post['markupType'];
$InvnItemSysId = $this->getRequest()->getPost('InvnItemSysId');
if(empty($InvnItemSysId) || empty($intMarkupType) || empty($this->intLoggedinUserId)) {
throw new Exception('There has been an error, Please try again later');
}
/* For Customize Markup Type */
if($intMarkupType == 'CUSTOMIZE') {
$cost_markup = !empty($post['cost_markup']) ? $post['cost_markup'] : '1';
$MarPlace = !empty($post['customized-fixed-amount-market-place']) ? $post['customized-fixed-amount-market-place'] : '0';
$Permission = !empty($post['customized-fixed-amount-permissions']) ? $post['customized-fixed-amount-permissions'] : '0';
$Cost_adult = !empty($post['customized-fixed-amount-cost-adult']) ? $post['customized-fixed-amount-cost-adult'] : 0;
$Cost_kids = !empty($post['customized-fixed-amount-cost-kids']) ? $post['customized-fixed-amount-cost-kids'] : 0;
$Markup_adult = !empty($post['customized-fixed-amount-markup-adult']) ? $post['customized-fixed-amount-markup-adult'] : 0;
$Markup_kids = !empty($post['customized-fixed-amount-markup-kids']) ? $post['customized-fixed-amount-markup-kids'] : 0;
$tax = !empty($post['customized-fixed-amount-tax']) ? $post['customized-fixed-amount-tax'] : 0;
$Discount_adult = !empty($post['customized-fixed-amount-discount-adult']) ? $post['customized-fixed-amount-discount-adult'] : 0;
$Discount_kids = !empty($post['customized-fixed-amount-discount-kids']) ? $post['customized-fixed-amount-discount-kids'] : 0;
$DiscountAmount_adult = !empty($post['customized-fixed-amount-discount-price-adult']) ? $post['customized-fixed-amount-discount-price-adult'] : 0;
$DiscountAmount_kids = !empty($post['customized-fixed-amount-discount-price-kids']) ? $post['customized-fixed-amount-discount-price-kids'] : 0;
$message = !empty($post['customized-fixed-amount-message']) ? $post['customized-fixed-amount-message'] : '';
$netsale_price_adult = !empty($post['customized-fixed-amount-netsale_price-adult']) ? $post['customized-fixed-amount-netsale_price-adult'] : 0;
$netsale_price_kids = !empty($post['customized-fixed-amount-netsale_price-kids']) ? $post['customized-fixed-amount-netsale_price-kids'] : 0;
/* For Fixed Amount Markup Type */
} else {
throw new Exception('There has been an error, Please try again later');
}
if(empty($MarPlace)) {
$response = array('success' => false, 'msg' => 'Please select market place');
echo json_encode($response);
exit;
}
if($Permission=="") {
$response = array('success' => false, 'msg' => 'Please select permission');
echo json_encode($response);
exit;
}
if(empty($Cost_adult)) {
$response = array('success' => false, 'msg' => 'Please enter cost');
echo json_encode($response);
exit;
}
// if($Markup_adult=="") {
// $response = array('success' => false, 'msg' => 'Please enter adult markup');
// echo json_encode($response);
// exit;
// }
// if($Markup_kids=="") {
// $response = array('success' => false, 'msg' => 'Please enter kids markup');
// echo json_encode($response);
// exit;
// }
// if($tax=="") {
// $response = array('success' => false, 'msg' => 'Please enter tax');
// echo json_encode($response);
// exit;
// }
// if($message=="") {
// $response = array('success' => false, 'msg' => 'Please enter mesage');
// echo json_encode($response);
// exit;
// }
$CustGrSysId = $this->intLoggedinUserGroupSysId;
$AgencySysId = $this->intLoggedinUserAgencySysId;
$MaxQntToSale = '0';
$Currency = '0';
$MarkUpType = $cost_markup;
$MarkUpNativeAdult = $Markup_adult;
$MarkUpNativeChild = $Markup_kids;
$MarkUpForeignerAdult = '0';
$MarkUpForeignerChild = '0';
$DiscountType = '0';
$DiscountMsg = $message;
$DiscountNativeAdult = $Discount_adult;
$DiscountNativeChild = $Discount_kids;
$DiscountForeignerAdult = '0';
$DiscountForeignerChild = '0';
$NetPriceNativeAdult = $netsale_price_adult;
$NetPriceNativeChild = $netsale_price_kids;
$NetPriceForeignerAdult = '0';
$NetPriceForeignerChild = '0';
$IsPublish = '0';
$PublishDate = '0';
$Details = '';
$RateRuleSysId = '0';
$TCDocSysId = '0';
$ValidTill = $currentDate;
$CreateDate = $currentDate;
$UpdateDate = $currentDate;
$IsMarkForDel = '0';
$IsActive = $Permission;
/* Check if markup settings already exists */
$arrMarkupSettings = $objActivities->getCustomizedMarkups($InvnItemSysId, $MarPlace, $this->intLoggedinUserAgencySysId, $cost_markup );
if(!empty($arrMarkupSettings)) {
$response = array('success' => false, 'msg' => 'Markup settings of the selected Market Place has already been added.');
echo json_encode($response);
exit;
}
$insert =
array(
'InvnItemSysId' => $InvnItemSysId,
'MPType' => $MarPlace,
'CustGrSysId' => $CustGrSysId,
'AgencySysId' => $AgencySysId,
'MaxQntToSale' => $MaxQntToSale,
'Currency' => $Currency,
'MarkUpType' => $MarkUpType,
'TaxPer' => $tax,
'MarkUpNativeAdult' => $MarkUpNativeAdult,
'MarkUpNativeChild' => $MarkUpNativeChild,
'MarkUpForeignerAdult' => $MarkUpForeignerAdult,
'MarkUpForeignerChild' => $MarkUpForeignerChild,
'DiscountType' => $DiscountType,
'DiscountMsg' => $DiscountMsg,
'DiscountNativeAdult' => $DiscountNativeAdult,
'DiscountNativeChild' => $DiscountNativeChild,
'DiscountForeignerAdult' => $DiscountForeignerAdult,
'DiscountForeignerChild' => $DiscountForeignerChild,
'NetPriceNativeAdult' => $NetPriceNativeAdult,
'NetPriceNativeChild' => $NetPriceNativeChild,
'NetPriceForeignerAdult' => $NetPriceForeignerAdult,
'NetPriceForeignerChild' => $NetPriceForeignerChild,
'IsPublish' => $IsPublish,
'PublishDate' => $PublishDate,
'Details' => $Details,
'RateRuleSysId' => $RateRuleSysId,
'TCDocSysId' => $TCDocSysId,
'ValidTill' => $ValidTill,
'CreateDate' => $CreateDate,
'UpdateDate' => $UpdateDate,
'IsMarkForDel' => $IsMarkForDel,
'IsActive' => $IsActive
);
// echo "<pre>";
// print_r($insert);
// exit;
try {
$objActivities->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 addCustomizedMarkupForeignersAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Call Activities Model
$objActivities = new Travel_Model_TblActivities();
//Get Post form data
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
$currentDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$intMarkupType = $post['markupType-foreigners'];
$InvnItemSysId = $this->getRequest()->getPost('InvnItemSysId');
if(empty($InvnItemSysId) || empty($intMarkupType) || empty($this->intLoggedinUserId)) {
throw new Exception('There has been an error, Please try again later');
}
/* For Customize Markup Type */
if($intMarkupType == 'CUSTOMIZE') {
$cost_markup = !empty($post['cost_markup_foreigners']) ? $post['cost_markup_foreigners'] : '1';
$MarPlace = !empty($post['customized-fixed-amount-market-place-foreigners']) ? $post['customized-fixed-amount-market-place-foreigners'] : '0';
$Permission = !empty($post['customized-fixed-amount-permissions-foreigners']) ? $post['customized-fixed-amount-permissions-foreigners'] : '0';
$Cost_adult = !empty($post['customized-fixed-amount-cost-foreigners-adult']) ? $post['customized-fixed-amount-cost-foreigners-adult'] : 0;
$Cost_kids = !empty($post['customized-fixed-amount-cost-foreigners-kids']) ? $post['customized-fixed-amount-cost-foreigners-kids'] : 0;
$Markup_adult = !empty($post['customized-fixed-amount-markup-foreigners-adult']) ? $post['customized-fixed-amount-markup-foreigners-adult'] : 0;
$Markup_kids = !empty($post['customized-fixed-amount-markup-foreigners-kids']) ? $post['customized-fixed-amount-markup-foreigners-kids'] : 0;
$tax = !empty($post['customized-fixed-amount-tax-foreigners']) ? $post['customized-fixed-amount-tax-foreigners'] : 0;
$Discount_adult = !empty($post['customized-fixed-amount-discount-foreigners-adult']) ? $post['customized-fixed-amount-discount-foreigners-adult'] : 0;
$Discount_kids = !empty($post['customized-fixed-amount-discount-foreigners-kids']) ? $post['customized-fixed-amount-discount-foreigners-kids'] : 0;
$DiscountAmount_adult = !empty($post['customized-fixed-amount-discount-price-foreigners-adult']) ? $post['customized-fixed-amount-discount-price-foreigners-adult'] : 0;
$DiscountAmount_kids = !empty($post['customized-fixed-amount-discount-price-foreigners-kids']) ? $post['customized-fixed-amount-discount-price-foreigners-kids'] : 0;
$message = !empty($post['customized-fixed-amount-message-foreigners']) ? $post['customized-fixed-amount-message-foreigners'] : '';
$netsale_price_adult = !empty($post['customized-fixed-amount-netsale_price-foreigners-adult']) ? $post['customized-fixed-amount-netsale_price-foreigners-adult'] : 0;
$netsale_price_kids = !empty($post['customized-fixed-amount-netsale_price-foreigners-kids']) ? $post['customized-fixed-amount-netsale_price-foreigners-kids'] : 0;
/* For Fixed Amount Markup Type */
} else {
throw new Exception('There has been an error, Please try again later');
}
if(empty($MarPlace)) {
$response = array('success' => false, 'msg' => 'Please select market place');
echo json_encode($response);
exit;
}
if($Permission=="") {
$response = array('success' => false, 'msg' => 'Please select permission');
echo json_encode($response);
exit;
}
if(empty($Cost_adult)) {
$response = array('success' => false, 'msg' => 'Please enter cost');
echo json_encode($response);
exit;
}
// if($Markup_adult=="") {
// $response = array('success' => false, 'msg' => 'Please enter adult markup');
// echo json_encode($response);
// exit;
// }
// if($Markup_kids=="") {
// $response = array('success' => false, 'msg' => 'Please enter kids markup');
// echo json_encode($response);
// exit;
// }
// if($tax=="") {
// $response = array('success' => false, 'msg' => 'Please enter tax');
// echo json_encode($response);
// exit;
// }
// if($message=="") {
// $response = array('success' => false, 'msg' => 'Please enter mesage');
// echo json_encode($response);
// exit;
// }
$CustGrSysId = $this->intLoggedinUserGroupSysId;
$AgencySysId = $this->intLoggedinUserAgencySysId;
$MaxQntToSale = '0';
$Currency = '0';
$MarkUpType = $cost_markup;
$MarkUpNativeAdult = '0';
$MarkUpNativeChild = '0';
$MarkUpForeignerAdult = $Markup_adult;
$MarkUpForeignerChild = $Markup_kids;
$DiscountType = '0';
$DiscountMsg = $message;
$DiscountNativeAdult = '0';
$DiscountNativeChild = '0';
$DiscountForeignerAdult = $Discount_adult;
$DiscountForeignerChild = $Discount_kids;
$NetPriceNativeAdult = '0';
$NetPriceNativeChild = '0';
$NetPriceForeignerAdult = $netsale_price_adult;
$NetPriceForeignerChild = $netsale_price_kids;
$IsPublish = '0';
$PublishDate = '0';
$Details = '';
$RateRuleSysId = '0';
$TCDocSysId = '0';
$ValidTill = $currentDate;
$CreateDate = $currentDate;
$UpdateDate = $currentDate;
$IsMarkForDel = '0';
$IsActive = $Permission;
/* Check if markup settings already exists */
$arrMarkupSettings = $objActivities->getCustomizedMarkups($InvnItemSysId, $MarPlace, $this->intLoggedinUserAgencySysId, $cost_markup );
if(!empty($arrMarkupSettings)) {
$response = array('success' => false, 'msg' => 'Markup settings of the selected Market Place has already been added.');
echo json_encode($response);
exit;
}
$insert =
array(
'InvnItemSysId' => $InvnItemSysId,
'MPType' => $MarPlace,
'CustGrSysId' => $CustGrSysId,
'AgencySysId' => $AgencySysId,
'MaxQntToSale' => $MaxQntToSale,
'Currency' => $Currency,
'MarkUpType' => $MarkUpType,
'TaxPer' => $tax,
'MarkUpNativeAdult' => $MarkUpNativeAdult,
'MarkUpNativeChild' => $MarkUpNativeChild,
'MarkUpForeignerAdult' => $MarkUpForeignerAdult,
'MarkUpForeignerChild' => $MarkUpForeignerChild,
'DiscountType' => $DiscountType,
'DiscountMsg' => $DiscountMsg,
'DiscountNativeAdult' => $DiscountNativeAdult,
'DiscountNativeChild' => $DiscountNativeChild,
'DiscountForeignerAdult' => $DiscountForeignerAdult,
'DiscountForeignerChild' => $DiscountForeignerChild,
'NetPriceNativeAdult' => $NetPriceNativeAdult,
'NetPriceNativeChild' => $NetPriceNativeChild,
'NetPriceForeignerAdult' => $NetPriceForeignerAdult,
'NetPriceForeignerChild' => $NetPriceForeignerChild,
'IsPublish' => $IsPublish,
'PublishDate' => $PublishDate,
'Details' => $Details,
'RateRuleSysId' => $RateRuleSysId,
'TCDocSysId' => $TCDocSysId,
'ValidTill' => $ValidTill,
'CreateDate' => $CreateDate,
'UpdateDate' => $UpdateDate,
'IsMarkForDel' => $IsMarkForDel,
'IsActive' => $IsActive
);
// echo "<pre>";
// print_r($insert);
// exit;
try {
$objActivities->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');
$MPType = $this->getRequest()->getParam('MPType');
$MarkUpType = $this->getRequest()->getParam('MarkUpType');
$objActivities = new Travel_Model_TblActivities();
$objActivities->deleteCustomizedMarkupSetting($InvnItemSysId, $MPType, $this->intLoggedinUserAgencySysId, $MarkUpType);
$response = array('success' => true);
echo json_encode($response);
exit;
}
}
public function addCustomizedMarkupPoliciesAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
//Call Activities Model
$objActivities = new Travel_Model_TblActivities();
//Get Post form data
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
$intMarkupType = $post['markupType'];
$InvnItemSysId = $this->getRequest()->getPost('InvnItemSysId');
if(empty($InvnItemSysId) || empty($this->intLoggedinUserId)) {
throw new Exception('There has been an error, Please try again later');
}
/* For Customize Markup Type */
if($intMarkupType == 'CUSTOMIZEPOLICIES') {
$MarPolicies = isset($post['markup_setting_customize_policies']) ? $post['markup_setting_customize_policies'] : '0';
/* For Fixed Amount Markup Type */
} else {
throw new Exception('There has been an error, Please try again later');
}
if(empty($MarPolicies)) {
$response = array('success' => false, 'msg' => 'Please enter Markup Policies.');
echo json_encode($response);
exit;
}
/* Check if markup settings already exists */
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryList = $objActivities->getActivitiesInventoryList($InvnItemSysId, $intLoggedinUserAgencySysId);
if(!empty($arrActivitiesInventoryList)) {
$update =
array(
'TCInfo' => $MarPolicies
);
try {
$objActivities->editMarkupPoliciesSettings($update,$InvnItemSysId);
$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 updateActivitiesSaleAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$InvnItemSysId = $this->getRequest()->getParam('InvnItemSysId');
$actionValue = $this->getRequest()->getParam('actionValue');
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryList = $objActivities->getActivitiesInventoryList($InvnItemSysId, $intLoggedinUserAgencySysId);
if(count($arrActivitiesInventoryList) <> 1 ) {
throw new Exception('There has been an error, Please try again later');
}
$objActivities->updateActivitiesSaleInventory($InvnItemSysId, $actionValue, $intLoggedinUserAgencySysId);
$response = array('success' => true);
echo json_encode($response);
exit;
}
}
public function editActivitiesDetailsAction()
{
$this->_helper->layout->disableLayout();
if($this->getRequest()->isPost())
{
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
/* For activities */
if(!empty($post)) {
$InvnItemSysId = isset($post['InvnItemSysId']) ? $post['InvnItemSysId'] : '';
$from_date = isset($post['from_date']) ? $post['from_date'] : '';
$to_date = isset($post['to_date']) ? $post['to_date'] : '0';
$adult_cost_natives = isset($post['adult_cost_natives']) ? $post['adult_cost_natives'] : '';
$kids_cost_natives = isset($post['kids_cost_natives']) ? $post['kids_cost_natives'] : '';
$adult_cost_foreigners = isset($post['adult_cost_foreigners']) ? $post['adult_cost_foreigners'] : '';
$kids_cost_foreigners = isset($post['kids_cost_foreigners']) ? $post['kids_cost_foreigners'] : '0';
$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');
}
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;
}
$update =
array(
'FromDate' => $strFromDate,
'ToDate' => $strToDate,
'TotalCostNativeAdult' => $adult_cost_natives,
'TotalCostNativeChild' => $kids_cost_natives,
'TotalCostForeignerAdult' => $adult_cost_foreigners,
'TotalCostForeignerChild' => $kids_cost_foreigners
);
// echo "<pre>";
// print_r($update);
// exit;
try {
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$objActivities->updateActivitiesInventoryDetails($update, $InvnItemSysId, $intLoggedinUserAgencySysId);
$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 copyActivitiesDetailsAction()
{
$this->_helper->layout->disableLayout();
if($this->getRequest()->isPost())
{
$post = $this->getRequest()->getPost();
// echo "<pre>";
// print_r($post);
// exit;
/* For activities */
if(!empty($post)) {
$InvnItemSysId = isset($post['InvnItemSysId']) ? $post['InvnItemSysId'] : '';
$from_date = isset($post['from_date']) ? $post['from_date'] : '';
$to_date = isset($post['to_date']) ? $post['to_date'] : '0';
$adult_cost_natives = isset($post['adult_cost_natives']) ? $post['adult_cost_natives'] : '';
$kids_cost_natives = isset($post['kids_cost_natives']) ? $post['kids_cost_natives'] : '';
$adult_cost_foreigners = isset($post['adult_cost_foreigners']) ? $post['adult_cost_foreigners'] : '';
$kids_cost_foreigners = isset($post['kids_cost_foreigners']) ? $post['kids_cost_foreigners'] : '0';
$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');
}
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;
}
$update =
array(
'FromDate' => $strFromDate,
'ToDate' => $strToDate,
'TotalCostNativeAdult' => $adult_cost_natives,
'TotalCostNativeChild' => $kids_cost_natives,
'TotalCostForeignerAdult' => $adult_cost_foreigners,
'TotalCostForeignerChild' => $kids_cost_foreigners
);
// echo "<pre>";
// print_r($update);
// exit;
try {
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$intNewInvnItemSysId = $objActivities->cloneMPInventoryActivities($update, $InvnItemSysId);
$response = array('success' => true, 'intLastInsertId' => $intNewInvnItemSysId);
echo json_encode($response);
exit;
} catch( Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage() );
echo json_encode($response);
exit;
}
}
}
public function getActivitiesInventoryDetailAction() {
$this->_helper->layout->setLayout('newLayout');
/* Disable Layout */
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$InvnItemSysId = $this->getRequest()->getParam('InvnItemSysId');
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryDetails = $objActivities->getActivitiesInventoryDetailsList($InvnItemSysId, $intLoggedinUserAgencySysId);
$FromDateTimeObj = (array) $arrActivitiesInventoryDetails['FromDate'];
$from_date_time = date("d/m/Y",strtotime($FromDateTimeObj['date']));
$ToDateTimeObj = (array) $arrActivitiesInventoryDetails['ToDate'];
$to_date_time = date("d/m/Y",strtotime($ToDateTimeObj['date']));
$arrActivitiesInventoryDetailsArr = array('FromDateFormat'=>$from_date_time,'ToDateFormat'=>$to_date_time);
$arrActivitiesInventoryDetailsArrFinal = array();
$arrActivitiesInventoryDetailsArrFinal = @array_merge($arrActivitiesInventoryDetails,$arrActivitiesInventoryDetailsArr);
//echo "<pre>"; print_r($arrActivitiesInventoryDetailsArrFinal); die;
echo json_encode($arrActivitiesInventoryDetailsArrFinal);
exit;
}
}
public function deleteActivitiesAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
$InvnItemSysId = base64_decode($this->getRequest()->getParam('id'));
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryList = $objActivities->getActivitiesInventoryList($InvnItemSysId);
// if(count($arrActivitiesInventoryList) <> 1 ) {
// throw new Exception('There has been an error, Please try again later');
// }
$objActivities->deleteActivitiesInventory($InvnItemSysId, $intLoggedinUserAgencySysId);
$this->_helper->flashMessenger->addMessage("Activities Inventory deleted successfully.");
$this->_helper->redirector('index', 'activities', 'admin');
}
public function viewDetailsAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
$InvnItemSysId = $this->getRequest()->getParam('id');
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryDetails = $objActivities->getInventoryDetails($InvnItemSysId, $intLoggedinUserAgencySysId);
//echo "<pre>"; print_r($arrActivitiesInventoryDetails);die;
$this->view->arrActivitiesInventoryDetails = $arrActivitiesInventoryDetails;
}
public function viewManageActivitiesDetailsAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
$ActivitySysId = $this->getRequest()->getParam('id');
$objActivities = new Travel_Model_TblActivities();
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
$objThings = new Cityprofiling_Model_TblCityprofiling();
$this->view->arrThingsToCarryList=$objThings->getThingsToCarryList();
$arrActivitiesDetails = $objActivities->getManageActivitiesDetails($ActivitySysId, $intLoggedinUserId);
//echo "<pre>"; print_r($arrActivitiesInventoryDetails);die;
$this->view->arrActivitiesDetails = $arrActivitiesDetails;
}
public function viewEditActivitiesDetailsAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
$ActivitySysId = $this->getRequest()->getParam('id');
//echo $InvnItemSysId;
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
$objActivities = new Travel_Model_TblActivities();
$arrActivitiesDetails = $objActivities->getManageActivitiesDetails($ActivitySysId, $intLoggedinUserId);
//echo "<pre>"; print_r($arrActivitiesDetails);die;
//Get Country List
$objCountry = new Travel_Model_TblCountry();
$arrCountryList = $objCountry->getCountryList();
//echo "<pre>"; print_r($arrCountryList);die;
$this->view->arrCountryList = $arrCountryList;
$objThings = new Cityprofiling_Model_TblCityprofiling();
$this->view->arrThingsToCarryList=$objThings->getThingsToCarryList();
//Get City List
$objCity = new Travel_Model_TblCity();
$objCity->intContSysId = $arrActivitiesDetails['ContSysId'];
$cityList = $objCity->getCityList();
//echo "<pre>"; print_r($cityList);die;
$this->view->cityList = $cityList;
//Get Activities Group Type List
$this->view->arrActivitiesGroupTypeList = $objActivities->getAllActivityGroupTypeList();
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
//Get Difficulty Type List
$this->view->arrDifficultyTypeList = $objActivities->getAllDifficultyTypeList();
$this->view->arrActivitiesDetails = $arrActivitiesDetails;
$season_month_arr = unserialize(SEASON_MONTH);
$seasonMonthMasking = $objActivities->getMasking($arrActivitiesDetails['PeakMothMask'], $season_month_arr);
$this->view->seasonMonthMasking = $seasonMonthMasking;
//echo "<pre>"; print_r($seasonMonthMasking);die;
$season_day_arr = unserialize(SEASON_DAYS);
$seasonDaysMasking = $objActivities->getMasking($arrActivitiesDetails['DaysWeekMask'], $season_day_arr);
$this->view->seasonDaysMasking = $seasonDaysMasking;
$this->view->IsFromPackage = @$this->getRequest()->getParam('package');
}
public function viewEditActivitiesDetailsMasterAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
$ActivitySysId = $this->getRequest()->getParam('id');
$ICSourceSysId = $this->getRequest()->getParam('ICSourceSysId');
$this->view->ICSourceSysId = $ICSourceSysId;
//echo $ICSourceSysId; die;
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
$objActivities = new Travel_Model_TblActivities();
$arrActivitiesDetails = $objActivities->getManageActivitiesDetails($ActivitySysId, $intLoggedinUserId);
//echo "<pre>"; print_r($arrActivitiesDetails);die;
//Get Country List
$objCountry = new Travel_Model_TblCountry();
$arrCountryList = $objCountry->getCountryList();
//echo "<pre>"; print_r($arrCountryList);die;
$this->view->arrCountryList = $arrCountryList;
$objThings = new Cityprofiling_Model_TblCityprofiling();
$this->view->arrThingsToCarryList=$objThings->getThingsToCarryList();
//Get City List
$objCity = new Travel_Model_TblCity();
$objCity->intContSysId = $arrActivitiesDetails['ContSysId'];
$cityList = $objCity->getCityList();
//echo "<pre>"; print_r($cityList);die;
$this->view->cityList = $cityList;
//Get Activities Group Type List
$this->view->arrActivitiesGroupTypeList = $objActivities->getAllActivityGroupTypeList();
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
//Get Difficulty Type List
$this->view->arrDifficultyTypeList = $objActivities->getAllDifficultyTypeList();
$this->view->arrActivitiesDetails = $arrActivitiesDetails;
$season_month_arr = unserialize(SEASON_MONTH);
$seasonMonthMasking = $objActivities->getMasking($arrActivitiesDetails['PeakMothMask'], $season_month_arr);
$this->view->seasonMonthMasking = $seasonMonthMasking;
//echo "<pre>"; print_r($seasonMonthMasking);die;
$season_day_arr = unserialize(SEASON_DAYS);
$seasonDaysMasking = $objActivities->getMasking($arrActivitiesDetails['DaysWeekMask'], $season_day_arr);
$this->view->seasonDaysMasking = $seasonDaysMasking;
$this->view->IsFromPackage = @$this->getRequest()->getParam('package');
}
public function searchAction()
{
$objCity = new Travel_Model_TblCity();
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
//Get City List
$CityList = $objCity->getCityList();
//echo "<pre>"; print_r($CityList); die;
$this->view->cityList = $CityList;
}
public function searchResultAction()
{
$objCity = new Travel_Model_TblCity();
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
//Get Activities Type List
$this->view->arrActivitiesTypeList = $objActivities->getAllActivityTypeList();
//Get City List
$CityList = $objCity->getCityList();
//echo "<pre>"; print_r($CityList); die;
$this->view->cityList = $CityList;
if($this->getRequest()->isPost())
{
$getData = $this->getRequest()->getPost();
if(!empty($getData))
{
$DestinationId = implode(",",@$getData['DestinationId']);
$ActivitiesTypeId = implode(",",@$getData['ActivitiesTypeId']);
$tour_date = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->cal2Db($getData['tour_date'],'d/m/y');
$searchArr = array(
'DestinationId'=>$DestinationId,
'tour_date'=>$tour_date,
'no_of_pax'=>$getData['no_of_pax'],
'no_of_adults'=>$getData['no_of_adults'],
'no_of_children'=>$getData['no_of_children'],
'age_of_children'=>$getData['age_of_children'],
'ActivitiesTypeId'=>$ActivitiesTypeId,
);
$objActivities = new Travel_Model_TblActivities();
$resultActivities = $objActivities->getAllActivitiesSearchList($intLoggedinUserAgencySysId,$searchArr);
$this->view->resultActivities = $resultActivities;
//echo "<pre>";print_r($searchArr);die;
} else {
echo "Test";die;
}
}
}
public function searchDetailsAction() {
/* Disable Layout */
$this->_helper->layout->disableLayout();
$InvnItemSysId = $this->getRequest()->getParam('id');
$objActivities = new Travel_Model_TblActivities();
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$arrActivitiesInventoryDetails = $objActivities->getInventoryDetails($InvnItemSysId, $intLoggedinUserAgencySysId);
//echo "<pre>"; print_r($arrActivitiesInventoryDetails);die;
$this->view->arrActivitiesInventoryDetails = $arrActivitiesInventoryDetails;
}
public function deactivateAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$ActivitySysId = $this->getRequest()->getParam('id');
$statusValue = '0';
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
$isDeactive = $objActivities->setActiveDeactive($ActivitySysId, $statusValue);
$message = @$isDeactive ? "Activity deactivated successfully." : "Activity deactivation failed.";
$this->_helper->flashMessenger->addMessage($message);
$this->_helper->redirector('manage-activities', 'activities', 'admin');
}
public function activateAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$ActivitySysId = $this->getRequest()->getParam('id');
$statusValue = '1';
if($this->intLoggedinUserRole!=1)
{
$intLoggedinUserId = $this->intLoggedinUserAgencySysId;
} else {
$intLoggedinUserId = "";
}
$isActive = $objActivities->setActiveDeactive($ActivitySysId, $statusValue);
$message = @$isActive ? "Activity activated successfully." : "Activity activation failed.";
$this->_helper->flashMessenger->addMessage($message);
$this->_helper->redirector('manage-activities', 'activities', 'admin');
}
public function deactivateInventoryAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$InvnItemSysId = $this->getRequest()->getParam('id');
$statusValue = '0';
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$isDeactive = $objActivities->setActiveDeactiveInventory($InvnItemSysId, $intLoggedinUserAgencySysId, $statusValue);
$message = @$isDeactive ? "Activity inventory deactivated successfully." : "Activity inventory deactivation failed.";
$this->_helper->flashMessenger->addMessage($message);
$this->_helper->redirector('index', 'activities', 'admin');
}
public function activateInventoryAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$InvnItemSysId = $this->getRequest()->getParam('id');
$statusValue = '1';
$intLoggedinUserAgencySysId = $this->intLoggedinUserAgencySysId;
$isActive = $objActivities->setActiveDeactiveInventory($InvnItemSysId, $intLoggedinUserAgencySysId, $statusValue);
$message = @$isActive ? "Activity inventory activated successfully." : "Activity inventory activation failed.";
$this->_helper->flashMessenger->addMessage($message);
$this->_helper->redirector('index', 'activities', 'admin');
}
public function getSearchSupplierActivitiesAction() {
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$cityId = $this->getRequest()->getParam('cityId');
if($cityId!="" && $cityId!="0")
{
$searchSupplierSelect = '';
$objActivities = new Travel_Model_TblActivities();
$intSearchSupplierList = $objActivities->getSuppliersList($cityId,$this->intLoggedinUserId);
if(!empty($intSearchSupplierList))
{
$searchSupplierSelect = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script>';
$searchSupplierSelect .= '<select id="supplierId" name="supplierId" class="demo-default select-ajax-country" placeholder="Select Supplier"><option value="0">Select Supplier</option>';
foreach($intSearchSupplierList as $intSearchSupplier)
{
$searchSupplierSelect .= '<option value="'.$intSearchSupplier['SupplierSysId'].'">'.$intSearchSupplier['SupplierName'].'</option>';
}
$searchSupplierSelect .= '</select>';
} else {
$searchSupplierSelect = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script><select id="supplierId" name="supplierId" class="demo-default select-ajax-country" placeholder="Select Supplier"><option value="0">Select Supplier</option></select>';
}
} else {
$searchSupplierSelect = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script><select id="supplierId" name="supplierId" class="demo-default select-ajax-country" placeholder="Select Supplier"><option value="0">Select Supplier</option></select>';
}
echo $searchSupplierSelect;
exit;
}
}
public function getActivitiesTypeListAction() {
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$ActivitiesGrTypeId = $this->getRequest()->getParam('ActivitiesGrTypeId');
$ActivitiesGrType = $this->getRequest()->getParam('ActivitiesGrType');
$Mode = $this->getRequest()->getParam('Mode');
if($ActivitiesGrType=="page" && $Mode=="add")
{
$nameId = "ActivityTypeId";
} else if($ActivitiesGrType=="popup" && $Mode=="add") {
$nameId = "popupActivityType";
} else if($ActivitiesGrType=="popup" && $Mode=="edit") {
$nameId = "ActivityTypeId";
}
if($ActivitiesGrTypeId!="" && $ActivitiesGrTypeId!="0")
{
$activitiesSelect = '';
$objActivities = new Travel_Model_TblActivities();
$intActivitiesTypeList = $objActivities->getActivitiesTypeListByActivitiesGroupId($ActivitiesGrTypeId);
if(!empty($intActivitiesTypeList))
{
$activitiesSelect = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script>';
$activitiesSelect .= '<select id="'.$nameId.'" name="ActivityType" class="demo-default select-ajax-country" placeholder="Select Activity Type"><option value="0">Select Activity Type</option>';
foreach($intActivitiesTypeList as $intActivitiesType)
{
$activitiesSelect .= '<option value="'.$intActivitiesType['ActivityType'].'">'.$intActivitiesType['Title'].'</option>';
}
$activitiesSelect .= '</select>';
} else {
$activitiesSelect = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script><select id="ActivityType" name="ActivityType" class="demo-default select-ajax-country" placeholder="Select Activity Type"><option value="0">Select Activity Type</option></select>';
}
} else {
$activitiesSelect = '<script src="/public/assets/js/pages/selectAjaxTag.js"></script><select id="ActivityType" name="ActivityType" class="demo-default select-ajax-country" placeholder="Select Activity Type"><option value="0">Select Activity Type</option></select>';
}
echo $activitiesSelect;
exit;
}
}
/**
* Disapprove Hotel Action.
*/
public function disapprovedAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$ActivitySysId = base64_decode($this->getRequest()->getParam('id'));
$approveDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$updateArr = array('ApproveDate' =>$approveDate, 'ApproveBy' =>$this->intLoggedinUserId, 'IsApproved' =>'0');
$isDisapprove = $objActivities->setApproveDisapprove(" ActivitySysId=$ActivitySysId", "TB_IC_Activity", $updateArr);
$message = @$isDisapprove ? "Activity disapproved successfully." : "Activity disapproved failed.";
$this->_helper->flashMessenger->addMessage($message);
if(@$isDisapprove)
{
if($this->intLoggedinUserRole==1)
{
$this->_helper->redirector('manage-activities', 'activities', 'admin');
}
}
}
/**
* Approve Hotel Action.
*/
public function approvedAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$ActivitySysId = base64_decode($this->getRequest()->getParam('id'));
$approveDate = Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss');
$updateArr = array('ApproveDate' =>$approveDate, 'ApproveBy' =>$this->intLoggedinUserId, 'IsApproved' =>'1');
$isApprove = $objActivities->setApproveDisapprove(" ActivitySysId=$ActivitySysId", "TB_IC_Activity", $updateArr);
$message = @$isApprove ? "Activity approved successfully." : "Activity approved failed.";
$this->_helper->flashMessenger->addMessage($message);
if(@$isApprove)
{
if($this->intLoggedinUserRole==1)
{
$this->_helper->redirector('manage-activities', 'activities', 'admin');
}
}
}
/**
* Stop Sale Hotel Action.
*/
public function stopSaleAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$InvnItemSysId = base64_decode($this->getRequest()->getParam('id'));
$isDeactive = $objActivities->setSaleStartStop(" InvnItemSysId=$InvnItemSysId", "TB_MP_Inventory_Activity",0);
$message = @$isDeactive ? "Activities inventory sale stop successfully." : "Activities inventory sale stop failed.";
$this->_helper->flashMessenger->addMessage($message);
if(@$isDeactive)
{
$this->_helper->redirector('index', 'activities', 'admin');
}
}
/**
* Start Sale Hotel Action.
*/
public function startSaleAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$objActivities = new Travel_Model_TblActivities();
$InvnItemSysId = base64_decode($this->getRequest()->getParam('id'));
$isActive = $objActivities->setSaleStartStop(" InvnItemSysId=$InvnItemSysId", "TB_MP_Inventory_Activity",1);
$message = @$isActive ? "Activities inventory sale start successfully." : "Activities inventory sale start failed.";
$this->_helper->flashMessenger->addMessage($message);
if(@$isActive)
{
$this->_helper->redirector('index', 'activities', 'admin');
}
}
public function getOperatingTimeDivAction() {
$this->_helper->layout->disableLayout();
if($this->_request->isXmlHttpRequest()) {
$max_fields = $this->getRequest()->getParam('max_fields');
$srt = $this->getRequest()->getParam('srt');
$OperatingTimeCounter = $this->getRequest()->getParam('OperatingTimeCounter');
$div_str = '';
if($max_fields!="" && $srt!="0")
{
for($i=2;$i<=$srt; $i++)
{
if($OperatingTimeCounter<$srt)
{
if($OperatingTimeCounter==0)
{
$div_str = '<script src="/public/assets/js/pages/pickerTool.js"></script><div class="remove_field_div" id="opt_time_remove_2"><div class="col-md-4"><div class="form-group"><label class="col-md-12 no-padding">Operating Time</label><div class="col-md-12 no-padding"><div class="col-md-2 col-sm-2 col-xs-2 no-padding" style="line-height:34px;">From</div><div class="col-md-3 col-sm-3 col-xs-3"><input type="text" id="OperatingStTime_2" name="OperatingTime_2[]" value="" class="form-control whbg timePickerOnly" style="padding-left:3px; padding-right:3px;"></div><div class="col-md-2 col-sm-2 col-xs-2 no-padding text-right" style="line-height:34px">To</div><div class="col-md-3 col-sm-3 col-xs-3"><input type="text" id="OperatingEndTime_2" name="OperatingTime_2[]" value="" class="form-control whbg timePickerOnly" style="padding-left:3px; padding-right:3px;"></div><div class="col-md-2 col-sm-2 col-xs-2 no-padding"><button type="button" data-original-title="Delete" onclick="deleteOpTimeDiv(2);" id="delete_operating_time" class="btn btn-xs btn-danger tooltipLink" data-toggle="tooltip" data-placement="top" title=""><i class="fa fa-trash-o"></i></button></div></div></div></div></div>';
}
else if($OperatingTimeCounter==1)
{
$div_str = '<script src="/public/assets/js/pages/pickerTool.js"></script><div class="remove_field_div" id="opt_time_remove_3"><div class="col-md-4"><div class="form-group"><label class="col-md-12 no-padding">Operating Time</label><div class="col-md-12 no-padding"><div class="col-md-2 col-sm-2 col-xs-2 no-padding" style="line-height:34px;">From</div><div class="col-md-3 col-sm-3 col-xs-3"><input type="text" id="OperatingStTime_3" name="OperatingTime_3[]" value="" class="form-control whbg timePickerOnly" style="padding-left:3px; padding-right:3px;"></div><div class="col-md-2 col-sm-2 col-xs-2 no-padding text-right" style="line-height:34px">To</div><div class="col-md-3 col-sm-3 col-xs-3"><input type="text" id="OperatingEndTime_3" name="OperatingTime_3[]" value="" class="form-control whbg timePickerOnly" style="padding-left:3px; padding-right:3px;"></div><div class="col-md-2 col-sm-2 col-xs-2 no-padding"><button type="button" data-original-title="Delete" onclick="deleteOpTimeDiv(3);" id="delete_operating_time" class="btn btn-xs btn-danger tooltipLink" data-toggle="tooltip" data-placement="top" title=""><i class="fa fa-trash-o"></i></button></div></div></div></div></div>';
}
}
}
}
else if($max_fields=1 && $OperatingTimeCounter==1)
{
$div_str = '<script src="/public/assets/js/pages/pickerTool.js"></script><div class="remove_field_div" id="opt_time_remove_3"><div class="col-md-4"><div class="form-group"><label class="col-md-12 no-padding">Operating Time</label><div class="col-md-12 no-padding"><div class="col-md-2 col-sm-2 col-xs-2 no-padding" style="line-height:34px;">From</div><div class="col-md-3 col-sm-3 col-xs-3"><input type="text" id="OperatingStTime_3" name="OperatingTime_3[]" value="" class="form-control whbg timePickerOnly" style="padding-left:3px; padding-right:3px;"></div><div class="col-md-2 col-sm-2 col-xs-2 no-padding text-right" style="line-height:34px">To</div><div class="col-md-3 col-sm-3 col-xs-3"><input type="text" id="OperatingEndTime_3" name="OperatingTime_3[]" value="" class="form-control whbg timePickerOnly" style="padding-left:3px; padding-right:3px;"></div><div class="col-md-2 col-sm-2 col-xs-2 no-padding"><button type="button" data-original-title="Delete" onclick="deleteOpTimeDiv(3);" id="delete_operating_time" class="btn btn-xs btn-danger tooltipLink" data-toggle="tooltip" data-placement="top" title=""><i class="fa fa-trash-o"></i></button></div></div></div></div></div>';
}
echo $div_str;
exit;
}
}
}