| 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/CRM/ |
Upload File : |
<?php
/*
* Catabatic Technology Pvt. Ltd.
* File Name :AgencyCustomerReqSupplierOnCall.php
* File Description :Manage to SupplierOnCall Operation
* Created By : Er Amit Kumar Dubey
* Created Date: 29-Dec-2016
*/
class Travel_Model_CRM_AgencyCustomerReqSupplierOnCall {
protected $_dbObj;
protected $_agencysuppcallObj;
public function __construct() {
$this->_agencysuppcallObj = new Travel_Model_TblAgencyCustomerReqSupplierOnCall();
$this->_dbObj = Zend_Db_Table::getDefaultAdapter();
}
public function addReqSupplierOnCall(array $data) {
$this->_agencysuppcallObj->insert($data);
$lastID = $this->_dbObj->lastInsertId();
return $lastID;
}
public function UpdateReqSupplierOnCall(array $data, $where=NULL){
$this->_agencysuppcallObj->update($data, $where);
}
public function GetSupplierLeadList($agencySysID, $getData = NULL){
$whereCondition = " (tb1.AgencySysId = '$agencySysID') ";
if (!empty($getData['queryId'])) {
$tpSysIdArr = explode('/', $getData['queryId']);
$whereCondition .= " AND tb1.TPSysId = $tpSysIdArr[2]";
}
if (!empty($getData['Destination'])) {
$cityIds = $getData['Destination'];
// $conD = (count($getData['Destination']) == 1 ) ? " = '$cityIds' " : " IN ( $cityIds ) ";
$flightCities = " tb3.DestPlaceSysId = '$cityIds'";
$hotelCities = " XRefCityId = '$cityIds' ";
$packageCities = " DestinationPlaces like '$cityIds,%' or DestinationPlaces like '%,$cityIds,%' or DestinationPlaces like '%,$cityIds' ";
$whereCondition .= " AND ($packageCities OR $hotelCities OR $flightCities) ";
}
$travelSupplier = array('ReqSupplierOnCall','IsSupAvalOnCall', 'SupplierSysId','OnCallSupRate', 'OnCallSupRooms', 'OnCallSupRateFrom', 'OnCallSupRateTo', 'OnCallSupRateValidTill', 'OnCallSupRemarks', 'CreatedOn', 'UpdatedOn');
$travel = array('TPSysId', 'StatusType', 'RoomInfoJson', 'StartDate', 'ValidTill', 'PlanBookingId', 'AgencySysId', 'PlanType', 'CustomerSysId', 'CreateDate', 'Price', 'NetPrice', 'MinPax', 'DestinationPlacesSysId', 'DestinationPlaces');
$travel_itenary = array('TPIntSysId as itenaryID');
$travel_air = array('AdultPax', 'ChildPax', 'InfentPax', 'DestPlaceSysId','SourceAirportCode', 'DestAirportCode');
$travel_accom = array('Title as hotelCityTitle','AdultPax as adultsinHotel','XRefCityId','AccoSysId', 'ChildPax as childsinHotel');
$customer_details = array('FullName', 'CRMCustSysId');
$leadAgent_owner = array('FirstName as OwnerAgentFirstName','LastName as OwnerAgentLastName');
$accom_details = array('Title as hotelName','ShortName','ResultIndex','TokenId','TraceId','CurrencyType','MinPublishedFare','Address as hotelAddress','Rating as AccomRating','Stars');
$accomMpRoom_details = array('Title as InvHotelRoomType');
$select = $this->_dbObj->select();
$select->from(array('tb1' => "TB_Agency_Customer_ReqSupplierOnCall"), $travelSupplier);
$select->joinLeft(array('tb2' => "TB_Agency_Customer_TravelPlan"), "tb2.TPSysId = tb1.TPSysId", $travel);
$select->joinLeft(array('tb3' => "TB_Agency_Customer_TravelPlan_Itenary"), "tb2.TPSysId = tb3.TPSysId", $travel_itenary);
$select->joinLeft(array('tb4' => "TB_Agency_Customer_TravelPlan_Air"), "tb3.TPIntSysId = tb4.TPIntSysId", $travel_air);
$select->joinLeft(array('tb5' => "TB_Agency_Customer_TravelPlan_Accom"), "tb3.TPIntSysId = tb5.TPIntSysId", $travel_accom);
$select->joinLeft(array('tb6' => "TB_IC_Accomdation"), "tb6.AccomSysId = tb5.AccoSysId" , $accom_details);
$select->joinLeft(array('tb7' => "TB_MP_Inventory_Accom"), "tb6.AccomSysId = tb7.XRefAccoSysId" , $accomMpRoom_details);
$select->where($whereCondition);
//$select->where("tb1.TPSysId > ?", 0);
$select->order("tb1.ReqSupplierOnCall DESC");
//echo $select;
$result = $this->_dbObj->fetchAll($select);
return $result;
}
public function ChkRecordExist($TPSysId,$ItemSysId,$TPIntSysId=null){
$travelSupplier = array('ReqSupplierOnCall','IsSupAvalOnCall','ItemSysId','SupplierSysId','OnCallSupRate', 'OnCallSupRooms', 'OnCallSupRateFrom', 'OnCallSupRateTo', 'OnCallSupRateValidTill', 'OnCallSupRemarks', 'CreatedOn', 'UpdatedOn','EmailText');
$select = $this->_dbObj->select();
$select->from(array('tbl' => "TB_Agency_Customer_ReqSupplierOnCall"),$travelSupplier);
$select->joinLeft(array('tb2' => 'TB_IC_Supplier'), "tbl.SupplierSysId = tb2.SupplierSysId", array('SupplierName'));
if(isset($TPIntSysId) && !empty($TPIntSysId)){
$select->where('tbl.TPIntSysId = ?', $TPIntSysId);
}
$select->where('tbl.TPSysId = ?', $TPSysId);
$select->where('tbl.ItemSysId = ?', $ItemSysId);
//$select->where('tbl.SupplierSysId = ?', $SupplierSysId);
//$ReqSupplierOnCall?$select->where('tbl.ReqSupplierOnCall = ?', $ReqSupplierOnCall):'';
$select->where("tbl.IsActive = ?", 1);
$select->where("tbl.IsMarkForDel = ?", 0);
$result = $this->_dbObj->fetchAll($select);
return $result;
}
public function updateData($table, $data, $where) {
$this->_dbObj->update($table, $data, $where);
}
public function insertData($table, $data) {
$this->_dbObj->insert($table, $data);
return $this->_dbObj->lastInsertId();
}
}