403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/b2bzend/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/models/TblICAccomdation.php
<?php
/**
 * Class Agency
 * Description 	This model contains the functions related to Agency.
 * @name	Agency
 * @author	Ravi Khare
 * @version 	1.0
 * @copyright 	Catabatic Automation Pvt. Ltd.
 * Handle 	Agency Related function
 *
 */

class Travel_Model_TblICAccomdation {
    
    public $intAgencySysId = NULL;
    public $intMPType = NULL;
    public $intCustGrSysId = NULL;
    public $intMarkupType = NULL;
    private $db = NULL;
    
    public function __construct() {
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
        $this->db = Zend_Db_Table::getDefaultAdapter(); 
    }
    
    public function __destruct() {
        $this->db->closeConnection(); 
    }
   public function addRoomPriceApiToDB($ItemSysIds,$accomId,$currencyCd,$roomP,$pproundOff,$offeredP,$extraGustC,$tax){
        $now = date("Y-m-d H:i:s");
        $accomIds='';
        try{
       $sqlA="SELECT AccomSysId FROM TB_IC_Accomdation_StdCost where RTRIM(AccomSysId)=CAST(".$accomId." AS CHAR) AND ItemSysId='".$ItemSysIds."'";
               $retrAccomID= $this->db->query($sqlA)->fetchAll();
           //print_r($retrHtlCod);
           foreach ($retrAccomID as $val) {
          $accomIds = trim($val['AccomSysId']);
               
           } 
         //***********Get currency*******//
         $sql="SELECT CurrencyType FROM TB_Master_Currency where Symbol='".$currencyCd."'";
               $retCur= $this->db->query($sql)->fetchAll();
          foreach ($retCur as $valc) {
              $currencyType = trim($valc['CurrencyType']);
               
           } 
         if($accomIds!=''){
             
             $arrPrUp=array('SourceSysId'=>'0',
                            'CostCurrency'=>$currencyType,
                            'GenCost'=>$roomP,
                            'PerPaxCost'=>$roomP,
                            'DOccupCost'=>$pproundOff,
                            'SOccupCost'=>$offeredP,
                            'ExtraBedCost'=>$extraGustC,
                            'Tax'=>$tax,
                            'UpdateDate'=>$now
                           );   
                            $whereCon="AccomSysId='".$accomIds."' AND ItemSysId='".$ItemSysIds."'";
             
             
             $isUpdated = $this->db->update('TB_IC_Accomdation_StdCost', $arrPrUp, $whereCon);
             
             
         }else{
           //**************Insert Price in TB_IC_Accomdation_StdCost ************//           
            $arrPrice=array('AccomSysId'=>$accomId,
                            'ItemSysId'=>$ItemSysIds,
                            'SourceSysId'=>'0',
                            'CostCurrency'=>$currencyType,
                            'GenCost'=>$roomP,
                            'PerPaxCost'=>$roomP,
                            'DOccupCost'=>$pproundOff,
                            'SOccupCost'=>$offeredP,
                            'ExtraBedCost'=>$extraGustC,
                            'ExtraWOBedCost'=>'0',
                            'OtherCost'=>'0',
                            'Tax'=>$tax,
                            'AdditionalCharge'=>'0',
                            'ChargesDetails'=>'',
                            'Brief'=>'',
                            'IfAnyOffer'=>'1',
                            'OfferMsg'=>'0',
                            'OfferImage'=>'',
                            'CreateDate'=>$now,
                            'ApproveDate'=>$now,
                            'UpdateDate'=>$now,
                            'IsActive'=>'1',
                            'IsMarkForDelete'=>'0',
                            'IsApproved'=>'1' );   
                            $whereCon="AccomSysId=".$accomId;
                            
                    $arrPriceRoom=array('AccomSysId'=>$accomId,        //TB_IC_Accomdation_APIPrice
                        'ItemSysId'=>'',
                        'APISysId'=>'',
                        'HotelCode'=>'',
                        'TraceId'=>'',
                        'RoomCode'=>'',
                        'CurrencyType'=>'',
                        'RatingAtAPI'=>'',
                        'HotelTC'=>'',
                        'Price'=>'',
                        'Tax'=>'',
                        'ExtraGuestCharge'=>'',
                        'ChildCharge'=>'',
                        'Discount'=>'',
                        'PublishedPrice'=>'',
                        'OfferedPriceRoundedOff'=>'',
                        'AgentCommission'=>'',
                        'AgentMarkUp'=>'',
                        'ServiceTax'=>'',
                        'TDS'=>'',
                        'MaxPaxCount'=>'',
                        'Availability'=>'',
                        'TotalRoomCounts'=>'',
                        'UpdateDate'=>'',
                        'ApproveDate'=>'',
                        'ApproveBy'=>'',
                        'CreateDate'=>'',
                        'IsApproved'=>'',
                        'IsActive'=>'',
                        'IsMarkForDel'=>'');        
                            
               $this->db->insert('TB_IC_Accomdation_StdCost', $arrPrice);
           
                 
//**************Insert Price in TB_IC_Accomdation_StdCost ************// 
         }
         } catch (Exception $e) {
            die('There has been an error. ' . $e->getMessage());
        }
   
   }  
    public function addAccomodation() {
        set_time_limit(0);
        $sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
      
        $now = date("Y-m-d H:i:s");
        $updatesession = new Zend_Session_Namespace('updatesession');
       $updatesession->updatesessitime=$now;

      $sql="SELECT ShortName FROM TB_IC_Accomdation where CitySysId='".$_SESSION['SEARCH']['hidden_selected_hotel_cityid']."' AND ShortName IS NOT NULL ";
           $retrHtlCod= $this->db->query($sql)->fetchAll();
           //print_r($retrHtlCod);
           foreach ($retrHtlCod as $value) {
               $ShortNameArr[] = trim($value['ShortName']);
               
           } 
           //print_r($ShortNameArr);
       foreach ($_SESSION['HotelSearchResultFirstStep']['HotelSearchResult']['HotelResults'] as $val)
           {
           
           
           
            //***********Get currency*******//
         $sql="SELECT CurrencyType FROM TB_Master_Currency where Symbol='".$val['Price']['CurrencyCode']."'";
               $retCur= $this->db->query($sql)->fetchAll();
          foreach ($retCur as $valc) {
              $currencyType = trim($valc['CurrencyType']);
               
           } 
           ///
         if(in_array($val["HotelCode"],$ShortNameArr)){
             try {
              
               $record = array('ResultIndex' => $val['ResultIndex'],
                                'TraceId' => str_replace("'",'',trim($_SESSION['traceID'])),
                                'TokenId' => trim($_SESSION['authenticationtokenId']),
                                'CurrencyType'=>$currencyType,
                                'PropertyType'=>'1',
                                'EconomyType' => '1',
                                'CheckinTime' =>date('Y-m-d', strtotime(@$_SESSION['SEARCH']['chekInDate'])),
                                'CheckOutTime' =>date('Y-m-d', strtotime(@$_SESSION['SEARCH']['chekOutDate'])),
                                'MinPublishedFare'=>($val['Price']['PublishedPriceRoundedOff']/$_SESSION['SEARCH']['nights']),
                                "MinCommissionEarned"=>($val['Price']['OfferedPriceRoundedOff']/$_SESSION['SEARCH']['nights']),
                                'UpdateDate' => $now);
                  $whereCondition="RTRIM(ShortName)=CAST('".$val['HotelCode']."' AS CHAR) ";
              
               $isUpdated = $this->db->update('TB_IC_Accomdation', $record, $whereCondition);
               
               
               
//*************Room Data Insert Start**********               
             $sqlA="SELECT AccomSysId FROM TB_IC_Accomdation where RTRIM(ShortName)=CAST('$val[HotelCode]' AS CHAR)";
           
               $retrAccomID= $this->db->query($sqlA)->fetchAll();
           //print_r($retrHtlCod);
           foreach ($retrAccomID as $vala) {
               $accomId = trim($vala['AccomSysId']);
               
           } 
           
  
          //   $this->addhoteRoomApiToDB($currencyType,$accomId,$val['ResultIndex'],$val['HotelCode'], trim($_SESSION['authenticationtokenId']),str_replace("'",'',trim($_SESSION['traceID'])));
         
//**************Insert Price in TB_IC_Accomdation_StdCost************//                    
      //     $this->addhoteRoomApiToDB($accomId,$val['ResultIndex'],$val["HotelCode"],trim($_SESSION['authenticationtokenId']),str_replace("'",'',trim($_SESSION['traceID'])));
//*************Room Data Insert End**********       
        } catch (Exception $e) {
            die('There has been an error. ' . $e->getMessage());
        }
       
                  
           }else {
                   try {
                       
               $recordinst = array('IsAgentSpec' => '0',
                                'ICSourceSysId' => '0',
                                'Title' => trim($val['HotelName']),
                                'ResultIndex' => trim($val['ResultIndex']),
                                'TraceId' => trim($_SESSION['traceID']),
                                'TokenId' => trim($_SESSION['authenticationtokenId']),
                                'AliasAndMeta' => '',
                                'ShortName' => trim($val["HotelCode"]),
                                'PlaceSysId_XRef' => trim($val['ResultIndex']),
                                'Icon' => '',
                                'ThumnailImg' => '',
                                'DetailImg' => trim($val['HotelPicture']),
                                'Stars' => isset($val['TripAdvisor']['Rating'])?trim($val['TripAdvisor']['Rating']):'0',
                                'Rating' => isset($val['TripAdvisor']['Rating'])?trim($val['TripAdvisor']['Rating']):'0',
                                'Popularity' => '0',
                                'AwardRecognizations' => '',
                                'PropertyType' => '1',
                                'EconomyType' => '1',
                                'AccoAminitiesMask' => '',
                                'MaxPaxCount' => '0',
                                'RoomCounts' => '0',
                                'Brief' => trim($val['HotelDescription']),
                                'CheckinTime' => $_SESSION['SEARCH']['chekInDate'],
                                'CheckOutTime' =>$_SESSION['SEARCH']['chekOutDate'],
                                'CurrencyType'=>$currencyType,
                                'MinPublishedFare'=>($val['Price']['PublishedPriceRoundedOff']/$_SESSION['SEARCH']['nights']),
                                "MinCommissionEarned"=>($val['Price']['OfferedPriceRoundedOff']/$_SESSION['SEARCH']['nights']),
                                'IsDayLightApp' => '0',
                                'GeoLat' => trim($val['Latitude']),
                                'GeoLong' => trim($val['Longitude']),
                                'Address' => trim($val['HotelAddress']), 
                                'Location' => '',
                                'PinCode' => '',
                                'CitySysId' => $_SESSION['SEARCH']['hidden_selected_hotel_cityid'] ,
                                'ZoneSysId' => '0',
                                'ZoneType' => '0',
                                'StateSysId' => '0', 
                                'ContSysId' =>'0',
                                'PrimaryContact' => '0',
                                'SecondaryContact' => '0' ,
                                'OtherContacts' => '0',
                                'UpdateDate' => $now,
                                'ApproveDate' => $now, 
                                'ApproveBy' => '1',
                                'CreateDate' => $now,
                                'IsApproved' =>'1',
                                'IsActive' => '1',
                                'IsMarkForDel' => '0');
              // echo '<pre>';
             //print_r($recordinst) ;     
            $this->db->insert('TB_IC_Accomdation', $recordinst);
            $accomSysId=$this->db->lastInsertId('TB_IC_Accomdation');
            $arrayAwards=array('AccomSysId'=>$accomSysId,
                'Title'=>'TripAdvisor',
                'Seq'=>'1',
                'AwardURL'=>isset($val['TripAdvisor']['ReviewURL'])?$val['TripAdvisor']['ReviewURL']:' ',
                'Details'=>'TripAdvisor',
                'SponserBody'=>'',
                'Icon'=>'',
                'Imgage1'=>'',
                'Imgage2'=>'',
                'AwardDate'=>$now,
                'UpdateDate'=>$now,
                'ApproveDate'=>$now,
                'ApproveBy'=>'1',
                'CreateDate'=>$now,
                'IsApproved'=>'1',
                'IsActive'=>'1',
                'IsMarkForDel'=>'0');
                $this->db->insert('TB_IC_Accomdation_Awards', $arrayAwards);
                $this->db->lastInsertId('TB_IC_Accomdation_Awards');
               // $this->addRoomPriceApiToDB($accomSysId,$val['Price']['CurrencyCode'],$val['Price']['RoomPrice'],$val['Price']['PublishedPriceRoundedOff'],$val['Price']['OfferedPriceRoundedOff'],$val['Price']['ExtraGuestCharge'],$val['Price']['Tax']);
               // $this->addhoteRoomApiToDB($currencyType,$accomSysId,$val['ResultIndex'],$val['HotelCode'], trim($_SESSION['authenticationtokenId']),str_replace("'",'',trim($_SESSION['traceID'])));
                } catch (Exception $e) {
            die('There has been an error. ' . $e->getMessage());
            }
     
           }    
          
        }
        
        return ;

    }
    
   public function addhoteRoomApiToDB($currencyType,$accomId,$resultIndex,$hotelCode,$tokenid,$traceid){
       $now = date("Y-m-d H:i:s");
      
       $userip= $_SERVER['REMOTE_ADDR'];
       try{
       $objApi = new Travel_Model_ApiIntegration();
       $hotelInfo = $objApi->getHotelInfo($resultIndex, $hotelCode, $userip, $tokenid, $traceid);
      
       $hotelRoomD = $objApi->getHotelRoomDetail($userip, $tokenid, $traceid, $resultIndex, $hotelCode);
       }catch (Exception $e) {
            die('There has been an error. ' . $e->getMessage());
            }
       $aminityId='';
        if(!empty($hotelInfo['HotelInfoResult']['HotelDetails'])){
       try{

          $lat=$hotelInfo['HotelInfoResult']['HotelDetails']['Latitude'];
          $long=$hotelInfo['HotelInfoResult']['HotelDetails']['Longitude'];
          $loction='';
          //$loction=Zend_Controller_Action_HelperBroker::getStaticHelper('GetaddressLatLong')->latlongConversion($lat,$long);
        $arrayAc=array('Brief'=>$hotelInfo['HotelInfoResult']['HotelDetails']['Description'],
            'Stars'=>$hotelInfo['HotelInfoResult']['HotelDetails']['StarRating'],
            'UpdateDate'=>$now);
//       echo '<pre>'; print_r($arrayAc);
//       die();
            $whereC="AccomSysId='".$accomId."'";
            $this->db->update('TB_IC_Accomdation', $arrayAc, $whereC);
            
       }catch (Exception $e) {
            die('There has been an error. ' . $e->getMessage());
            }
//***************Create Aminity        
       /*foreach($hotelInfo['HotelInfoResult']['HotelDetails']['HotelFacilities'] as $facility){
        
        $sqlA="SELECT AmenitiesSysId FROM TB_IC_Accomodation_TBQ_Static_Amenities where Amenities='".$facility."'";
               $retrAminity= $this->db->query($sqlA)->fetchAll();
          if(!empty($retrAminity)){
           foreach ($retrAminity as $val) {
           $aminityId.= trim($val['AmenitiesSysId']).',';
              
               
           }
          }
          else{
               $sql="SELECT TOP 1 AmenitiesSysId FROM TB_IC_Accomodation_TBQ_Static_Amenities order by AmenitiesSysId DESC";
               $aminitySysId= $this->db->query($sql)->fetchAll();
          
           foreach ($aminitySysId as $val1) {
           $max= trim($val1['AmenitiesSysId']);
              $max++;
               
           }
               $arrayAminity=array('AmenitiesSysId'=>$max,'Amenities'=>$facility,'Cat'=>'');
              // $this->db->insert('TB_IC_Accomodation_TBQ_Static_Amenities', $arrayAminity);
              //  $aminityId.=$this->db->lastInsertId('TB_IC_Accomodation_TBQ_Static_Amenities');
                $aminityId.',';
               }
            
       }
        $aminity=substr($aminityId,0,-1);    
        $arrayTBQSTATIC=array('TBQSAccomSysId'=>$accomId,
           'MasterAccRef'=>'0',
           'CityId1'=>0,
           'TBBCityId'=>0,
           'BrandCode'=>'',
           'HotelCode'=>$hotelCode,
           'CountryCode'=>$currencyType,
           'TraceId'=>$traceid,
           'ResultIndex'=>$resultIndex,
           'Amenities'=>$aminity,
           'UpdateDate'=>$now,
           'ApproveDate'=>$now,
           'ApproveBy'=>'1',
           'CreateDate'=>$now,
           'IsApproved'=>'1',
           'IsActive'=>'1',
           'IsMarkForDel'=>'0');
       // $sql1="SELECT TBQSAccomSysId  FROM TB_IC_Accomdation_TBQ_Static where TBQSAccomSysId='".$accomId."'";
          //     $valExist= $this->db->query($sql1)->fetchAll();
            //   print_r($valExist);
          if(!empty($valExist)){
       
//           $whereCondition="TBQSAccomSysId='".$accomId."'";
//           $this->db->update('TB_IC_Accomdation_TBQ_Static', $arrayTBQSTATIC, $whereCondition);
//          
           
          }else{
             // echo 'inst';
            // $this->db->insert('TB_IC_Accomdation_TBQ_Static', $arrayTBQSTATIC);
            // $this->db->lastInsertId('TB_IC_Accomdation_TBQ_Static');
          }
       */    
           
      
//************************** TB_IC_Accomdation_Images *******************************//
            /* $sql2="SELECT AccomSysId  FROM TB_IC_Accomdation_Images where AccomSysId='".$accomId."'";
               $valExist1= $this->db->query($sql2)->fetchAll();
            if(empty($valExist1)){
                $seq=1;
            foreach($hotelInfo['HotelInfoResult']['HotelDetails']['Images'] as $images){
            $arrayImg=array('AccomSysId'=>$accomId,
                'Seq'=>$seq,
                'ImgType'=>'2',
                'TagTitle'=>'',
                'Details'=>$images,
                'UpdateDate'=>$now,
                'CreateDate'=>$now,
                'IsActive'=>'1',
                'IsMarkForDel'=>'0');
            
              
             //$this->db->insert('TB_IC_Accomdation_Images', $arrayImg);
             //$this->db->lastInsertId('TB_IC_Accomdation_Images');
             $seq++;
            }
            }*/
//*******         
//*********************** TB_IC_Accomdation_Room **************/  
 try{
 $traceid=$hotelRoomD['GetHotelRoomResult']['TraceId'];
if(isset($hotelRoomD['GetHotelRoomResult']['HotelRoomsDetails'])){
 foreach($hotelRoomD['GetHotelRoomResult']['HotelRoomsDetails']as $rooms){
               //***********Get currency*******//
         $sql="SELECT CurrencyType FROM TB_Master_Currency where Symbol='".$rooms['Price']['CurrencyCode']."'";
               $retCur= $this->db->query($sql)->fetchAll();
          foreach ($retCur as $valc) {
              $currencyType = trim($valc['CurrencyType']);
               
           }  
                $sqlR="SELECT RoomType  FROM TB_Master_RoomType where Title='".trim($rooms['RoomTypeName'])."'";
                $valExistRm= $this->db->query($sqlR)->fetchAll();
          if(empty($valExistRm)){
                   $arrayRoomType=array('RoomGrMask'=>'1',
                       'RoomGrMask'=>'1',
                       'Title'=>trim($rooms['RoomTypeName']),
                       'Icon'=>'1',
                       'UpdateDate'=>$now,
                       'CreateDate'=>$now,
                       'IsMarkForDel'=>'0',
                       'IsActive'=>'1'); 
                   $this->db->insert('TB_Master_RoomType', $arrayRoomType);
                   $roomT=$this->db->lastInsertId('TB_Master_RoomType');
            }else{
                    foreach($valExistRm as $roomTypes)
                        {
                        $roomT=$roomTypes['RoomType'];
                        }
                }
        $sqlRT="SELECT RoomType,ItemSysId  FROM TB_IC_Accomdation_Room where AccomSysId='".$accomId."' AND RoomIndex='".$rooms['RoomIndex']."'";
        $valExistRT= $this->db->query($sqlRT)->fetchAll();
        foreach($valExistRT as $ItemSys){
            $ItemSysId=$ItemSys['ItemSysId'];
        }
        if(empty($valExistRT)){
           
        $arrayRInsert=array('AccomSysId'=>$accomId,
          'SourceSysId'=>'1',
          'Title'=>'',
          'TokenId'=>$tokenid,
          'TraceId'=>$traceid,
          'RoomIndex'=>$rooms['RoomIndex'],
          'RoomType'=>$roomT,
          'EconomyType'=>'1',
          'Qty'=>'1',
          'CurrencyType'=>$currencyType,
          'PublishedFare'=>$rooms['Price']['PublishedPriceRoundedOff'],
          'BedType'=>'0',
          'PaxCount'=>'0',
          'IsPetAllow'=>'0',
          'Location'=>'',
          'MaxPetAllow'=>'0',
          'AllowChild'=>'0',
          'AllowInfant'=>'0',
          'MaxPaxCount'=>'0',
          'MaxAllowChild'=>'0',
          'MaxAllowInfant'=>'0',
          'MealPlanType'=>'0',
          'AminitiesMask'=>'',
          'InclustionOptionsMask'=>'',
          'OtherDetails'=>'',
          'RoomTypeCode'=>$rooms['RoomTypeCode'],
          'RatePlanCode'=>$rooms['RatePlanCode'],
          'RatePlanName'=>$rooms['RoomTypeName'],
          'LastCancellationDate'=>$rooms['LastCancellationDate'],
          'CancellationPolicy'=>$rooms['CancellationPolicy'],
          'UpdatedDate'=>$now,
          'CreateDate'=>$now,
          'ApproveDate'=>$now,
          'ApproveBy'=>'1',
          'IsDelete'=>'0',
          'IsActive'=>'1',
          'IsApproved'=>'1' );  
          $this->db->insert('TB_IC_Accomdation_Room', $arrayRInsert);
          $ItemSyId=$this->db->lastInsertId('TB_IC_Accomdation_Room');  
                    
         }else{
          $arrayRoom=array(
          'TokenId'=>$tokenid,
          'TraceId'=>$traceid,
          'RoomIndex'=>$rooms['RoomIndex'],
          'RoomType'=>$roomT,
          'CurrencyType'=>$currencyType,
          'PublishedFare'=>$rooms['Price']['PublishedPriceRoundedOff'],
          'RoomTypeCode'=>$rooms['RoomTypeCode'],
          'RatePlanCode'=>$rooms['RatePlanCode'],
          'RatePlanName'=>$rooms['RoomTypeName'],
          'LastCancellationDate'=>$rooms['LastCancellationDate'],
          'CancellationPolicy'=>$rooms['CancellationPolicy'],
          'UpdatedDate'=>$now );  
            $whereCon="AccomSysId='".$accomId."' AND RoomIndex='".$rooms['RoomIndex']."' AND ItemSysId='".$ItemSysId."'";
            $this->db->update('TB_IC_Accomdation_Room', $arrayRoom, $whereCon);
            }
            if(isset($ItemSysId)){
                $ItemSysIds=$ItemSysId;
            }else{
                 $ItemSysIds=$ItemSyId;
            }
       //************************ TB_IC_Accomdation_Room_CancellationPolicy ***********************
 $sqlRT="SELECT roomindex  FROM TB_IC_Accomdation_Room_CancellationPolicy where Accosysid='".$accomId."' AND roomindex='".$rooms['RoomIndex']."'";
                $valExistRT= $this->db->query($sqlRT)->fetchAll();
                if(empty($valExistRT)){
                    if(!empty($rooms['CancellationPolicies'])){
                $arrayCancelPlo=array(
                    'Accosysid'=>$accomId,
                    'ItemSysId'=>$ItemSysIds,
                    'roomindex'=>$rooms['RoomIndex'],
                    'ChargeType'=>$rooms['CancellationPolicies'][0]['ChargeType'],
                    'Currency'=>$currencyType,
                    'Charge'=>$rooms['CancellationPolicies'][0]['Charge'],
                    'Fromdate'=>$rooms['CancellationPolicies'][0]['FromDate'],
                    'Todate'=>$rooms['CancellationPolicies'][0]['ToDate'],
                    'createdOn'=>$now,
                    'UpdatedOn'=>$now,
                    'IsActive'=>'1',
                    'IsMarkForDel'=>'0' );
                   $this->db->insert('TB_IC_Accomdation_Room_CancellationPolicy', $arrayCancelPlo);
                   $this->db->lastInsertId('TB_IC_Accomdation_Room_CancellationPolicy');  
                    }
                }else{
                    if(!empty($rooms['CancellationPolicies'])){
                    $arrayCancelPlo=array(
                    'ItemSysId'=>$ItemSysIds,
                    'ChargeType'=>$rooms['CancellationPolicies'][0]['ChargeType'],
                    'Currency'=>$currencyType,
                    'Charge'=>$rooms['CancellationPolicies'][0]['Charge'],
                    'Fromdate'=>$rooms['CancellationPolicies'][0]['FromDate'],
                    'Todate'=>$rooms['CancellationPolicies'][0]['ToDate'],
                    'UpdatedOn'=>$now);
                    $whereCn="Accosysid='".$accomId."' AND roomindex='".$rooms['RoomIndex']."'";
                    $this->db->update('TB_IC_Accomdation_Room_CancellationPolicy', $arrayCancelPlo, $whereCn);
                    }
                    
                    }   
 //$this->addRoomPriceApiToDB($ItemSysIds,$accomId,$rooms['Price']['CurrencyCode'],$rooms['Price']['RoomPrice'],$rooms['Price']['PublishedPriceRoundedOff'],$rooms['Price']['OfferedPriceRoundedOff'],$rooms['Price']['ExtraGuestCharge'],$rooms['Price']['Tax']);
            }
 }
 }
 
   catch (Exception $e) {
            die('There has been an error. ' . $e->getMessage());
            }
        }
}


    public function getAccomodation($AccomSysId) {        
       $select = $this->db->select()
                ->from(array('TBICA'=>'TB_IC_Accomdation'),array('Title as HotelName', 'Address', 'Rating','Stars', 'AccoAminitiesMask','Brief as Details','DetailImg','ShortName','GeoLat','GeoLong'))
                ->where('AccomSysId =?', $AccomSysId);
        $result = $this->db->fetchRow($select);
        return $result;
       }
}

Youez - 2016 - github.com/yon3zu
LinuXploit