| 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 : |
<?php
class Travel_Model_AgencyLeads {
private $db = NULL;
public function __construct() {
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
$this->db = Zend_Db_Table::getDefaultAdapter();
$this->_custtravelObj = new Travel_Model_TblCustomerTravelPlan();
$this->_dbObj = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct() {
$this->db->closeConnection();
}
public function GetLeadList($agencySysID, $getData = NULL) {
$whereCondition = " (tbl.AgencySysId = '$agencySysID') AND (tbl.StatusType IN (1, 2) ) ";
if (!empty($getData['leadFor'])) {
$whereCondition .= " AND tbl.PlanType = $getData[leadFor]";
} else {
$whereCondition .= " AND (tbl.PlanType IN (1, 2, 5) )";
}
if (!empty($getData['queryId'])) {
$tpSysIdArr = explode('/', $getData['queryId']);
$whereCondition .= " AND tbl.TPSysId = $tpSysIdArr[2]";
}
if (!empty($getData['Destination'])) {
$cityIds = $getData['Destination'];
$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) ";
}
$travel = array('TPSysId', 'StatusType', 'RoomInfoJson', 'StartDate', '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','RoomMemInfoJson','AdultPax as adultsinHotel','XRefCityId', 'ChildPax as childsinHotel');
$customer_details = array("(RTRIM(LTRIM(tb7.FirstName)) + ' ' + RTRIM(LTRIM(tb7.LastName))) as FullName", 'CRMCustSysId');
$leadAgent_owner = array('FirstName as OwnerAgentFirstName','LastName as OwnerAgentLastName');
$select = $this->_dbObj->select();
$select->from(array('tbl' => "TB_Agency_Customer_TravelPlan"), $travel);
$select->joinLeft(array('tb2' => "TB_Agency_Customer_TravelPlan_Itenary"), "tbl.TPSysId = tb2.TPSysId", $travel_itenary);
$select->joinLeft(array('tb3' => "TB_Agency_Customer_TravelPlan_Air"), "tb2.TPIntSysId = tb3.TPIntSysId", $travel_air);
$select->joinLeft(array('tb4' => "TB_Agency_Customer_TravelPlan_Accom"), "tb2.TPIntSysId = tb4.TPIntSysId", $travel_accom);
$select->joinLeft(array('tb6' => "TB_Agency_User"), "tbl.AgentSysId = tb6.UserSysId" , $leadAgent_owner);
$select->joinLeft(array('tb7' => "TB_Agency_Customer"), "tbl.CustomerSysId = tb7.CustomerSysId", $customer_details);
$select->where($whereCondition);
$select->order("tbl.TPSysId DESC");
$result = $this->_dbObj->fetchAll($select);
return $result;
}
//if ($leadlist['PlanType'] == 1) {
//echo $leadlist['SourceAirportCode'] . '-' . $leadlist['DestAirportCode'];
//} if ($leadlist['PlanType'] == 2) {
//echo $leadlist['hotelCityTitle'];
//} if ($leadlist['PlanType'] == 5) {
//echo $leadlist['DestinationPlaces'];
//}
}