| 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/holidays.tripjack.com/application/modules/bookings/models/ |
Upload File : |
<?php
/**
* Class Package Master
* Description This model contains the basic activity functions needed for packages.
* @name Package Master
* @author Ravi Khare
* @version 1.0
* @copyright Catabatic Automation Pvt. Ltd.
* Handle Packate Related function
*
*/
class Bookings_Model_tblflightbooking extends Zend_Db_Table_Abstract
{
private $db = NULL;
/**
* Class Constructors
*/
public function __construct()
{
#initialize db adapter
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct()
{
$this->db->closeConnection();
}
public function getAgentBooking($AgencySysId, $post = null)
{
//print_r($post['AirlineName']);
try {
$select = $this->db->select();
$select->from(array('tbl' => "tbl_flight_booking"));
$select->joinLeft(array('tbl2' => 'tbl_customer'),'tbl.CustomerSysId = tbl2.CustomerSysId',array('tbl2.EmailId','tbl2.Contacts'));
if (isset($post['BookingId']) && !empty($post['BookingId'])) {
$select->where("tbl.BookingId = ?", $post['BookingId']);
}
if (isset($post['AirlineName']) && !empty($post['AirlineName'])) {
$select->where("tbl.AirlineName IN (?)", $post['AirlineName']);
}
if (isset($post['SourceAirportCode']) && !empty($post['SourceAirportCode'])) {
$select->where("tbl.SourceAirportCode = ?", $post['SourceAirportCode']);
}
if (isset($post['DestAirportCode']) && !empty($post['DestAirportCode'])) {
$select->where("tbl.DestAirportCode = ?", $post['DestAirportCode']);
}
if (isset($post['bookingDate']) && !empty($post['bookingDate']) && $post['bookingDate'] != '__/__/____') {
$bookingDate = explode("/", $post['bookingDate']);
if (count($bookingDate) > 0) {
$strbookingDate = $bookingDate[2] . "-" . $bookingDate[1] . "-" . $bookingDate[0];
$select->where("DATE(tbl.created_at) = ?", $strbookingDate);
}
}
if (isset($post['TravelDate']) && !empty($post['TravelDate']) && $post['TravelDate'] != '__/__/____') {
$TravelDate = explode("/", $post['TravelDate']);
if (count($TravelDate) > 0) {
$strTravelDate = $TravelDate[2] . "-" . $TravelDate[1] . "-" . $TravelDate[0];
$select->where("DATE(tbl.TravelDate) = ?", $strTravelDate);
}
}
if (isset($post['PNR_Number']) && !empty($post['PNR_Number'])) {
$select->where('tbl.PNR_Number LIKE ?', $post['PNR_Number'].'%');
}
if (isset($post['status']) && !empty($post['status'])) {
$select->where("tbl.status = ?", $post['status']);
}
if (isset($post['CustomerMobile']) && !empty($post['CustomerMobile'])) {
$select->where("tbl2.Contacts = ?", $post['CustomerMobile']);
}
if (isset($post['EmailId']) && !empty($post['EmailId'])) {
$select->where("tbl2.EmailId = ?", $post['EmailId']);
}
if (isset($post['JourneyType']) && ($post['JourneyType'] >= 0)) {
$select->where("tbl.IsInternational = ?", $post['JourneyType']);
}
if (isset($post['pnrstatus']) && ($post['pnrstatus'] == 'OFFER_FARE_WITHOUT_PNR')) {
$select->where("tbl.fareIdentifierSP = ?", $post['pnrstatus']);
}
$select->where("tbl.AgencySysId = ?", $AgencySysId);
$select->where("tbl.status IN(?)", array(1,22));
$select->where("tbl.IsMarkForDel = ?", '0');
$select->order("tbl.created_at DESC");
//echo $select;die;
$result = $this->db->fetchAll($select);
return $result;
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function getAgentBookingCheckin($AgencySysId, $post = null)
{
//print_r($post['AirlineName']);
try {
$select = $this->db->select();
$select->from(array('tbl' => "tbl_flight_booking"));
if (isset($post['BookingId']) && !empty($post['BookingId'])) {
$select->where("tbl.BookingId = ?", $post['BookingId']);
}
if (isset($post['AirlineName']) && !empty($post['AirlineName'])) {
$select->where("tbl.AirlineName IN (?)", $post['AirlineName']);
}
if (isset($post['SourceAirportCode']) && !empty($post['SourceAirportCode'])) {
$select->where("tbl.SourceAirportCode = ?", $post['SourceAirportCode']);
}
if (isset($post['DestAirportCode']) && !empty($post['DestAirportCode'])) {
$select->where("tbl.DestAirportCode = ?", $post['DestAirportCode']);
}
if (isset($post['bookingDate']) && !empty($post['bookingDate']) && $post['bookingDate'] != '__/__/____') {
$bookingDate = explode("/", $post['bookingDate']);
if (count($bookingDate) > 0) {
$strbookingDate = $bookingDate[2] . "-" . $bookingDate[1] . "-" . $bookingDate[0];
$select->where("DATE(tbl.created_at) = ?", $strbookingDate);
}
}
if (isset($post['TravelDate']) && !empty($post['TravelDate']) && $post['TravelDate'] != '__/__/____') {
$TravelDate = explode("/", $post['TravelDate']);
if (count($TravelDate) > 0) {
$strTravelDate = $TravelDate[2] . "-" . $TravelDate[1] . "-" . $TravelDate[0];
$select->where("DATE(tbl.TravelDate) = ?", $strTravelDate);
}
}
if (isset($post['PNR_Number']) && !empty($post['PNR_Number'])) {
$select->where('tbl.PNR_Number LIKE ?', $post['PNR_Number'].'%');
}
if (isset($post['status']) && !empty($post['status'])) {
$select->where("tbl.status = ?", $post['status']);
}
if (isset($post['CustomerMobile']) && !empty($post['CustomerMobile'])) {
$select->where("tbl2.Contacts = ?", $post['CustomerMobile']);
}
if (isset($post['EmailId']) && !empty($post['EmailId'])) {
$select->where("tbl2.EmailId = ?", $post['EmailId']);
}
if (isset($post['JourneyType']) && ($post['JourneyType'] >= 0)) {
$select->where("tbl.IsInternational = ?", $post['JourneyType']);
}
if (isset($post['pnrstatus']) && ($post['pnrstatus'] == 'OFFER_FARE_WITHOUT_PNR')) {
$select->where("tbl.fareIdentifierSP = ?", $post['pnrstatus']);
}
$TravelDate = date('Y-m-d');
$select->where("tbl.AgencySysId = ?", $AgencySysId);
$select->where("tbl.TravelDate = ?", $TravelDate);
$select->where("tbl.status != ?", 0);
$select->where("tbl.IsMarkForDel = ?", '0');
$select->order("tbl.created_at DESC");
//echo $select;die;
$result = $this->db->fetchAll($select);
return $result;
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function getAgentBookingAmendment($AgencySysId, $post = null)
{
//print_r($post['AirlineName']);
try {
$select = $this->db->select();
$select->from(array('tbl' => "tbl_flight_booking"));
if (isset($post['BookingId']) && !empty($post['BookingId'])) {
$select->where("tbl.BookingId = ?", $post['BookingId']);
}
if (isset($post['AirlineName']) && !empty($post['AirlineName'])) {
$select->where("tbl.AirlineName IN (?)", $post['AirlineName']);
}
if (isset($post['SourceAirportCode']) && !empty($post['SourceAirportCode'])) {
$select->where("tbl.SourceAirportCode = ?", $post['SourceAirportCode']);
}
if (isset($post['DestAirportCode']) && !empty($post['DestAirportCode'])) {
$select->where("tbl.DestAirportCode = ?", $post['DestAirportCode']);
}
if (isset($post['bookingDate']) && !empty($post['bookingDate']) && $post['bookingDate'] != '__/__/____') {
$bookingDate = explode("/", $post['bookingDate']);
if (count($bookingDate) > 0) {
$strbookingDate = $bookingDate[2] . "-" . $bookingDate[1] . "-" . $bookingDate[0];
$select->where("DATE(tbl.created_at) = ?", $strbookingDate);
}
}
if (isset($post['TravelDate']) && !empty($post['TravelDate']) && $post['TravelDate'] != '__/__/____') {
$TravelDate = explode("/", $post['TravelDate']);
if (count($TravelDate) > 0) {
$strTravelDate = $TravelDate[2] . "-" . $TravelDate[1] . "-" . $TravelDate[0];
$select->where("DATE(tbl.TravelDate) = ?", $strTravelDate);
}
}
if (isset($post['PNR_Number']) && !empty($post['PNR_Number'])) {
$select->where('tbl.PNR_Number LIKE ?', $post['PNR_Number'].'%');
}
if (isset($post['status']) && !empty($post['status'])) {
$select->where("tbl.status = ?", $post['status']);
}
if (isset($post['CustomerMobile']) && !empty($post['CustomerMobile'])) {
$select->where("tbl2.Contacts = ?", $post['CustomerMobile']);
}
if (isset($post['EmailId']) && !empty($post['EmailId'])) {
$select->where("tbl2.EmailId = ?", $post['EmailId']);
}
if (isset($post['JourneyType']) && ($post['JourneyType'] >= 0)) {
$select->where("tbl.IsInternational = ?", $post['JourneyType']);
}
if (isset($post['pnrstatus']) && ($post['pnrstatus'] == 'OFFER_FARE_WITHOUT_PNR')) {
$select->where("tbl.fareIdentifierSP = ?", $post['pnrstatus']);
}
$select->where("tbl.AgencySysId = ?", $AgencySysId);
//$select->where("tbl.status != ?", 0);
$select->where("tbl.status != ?", 1);
$select->where("tbl.IsMarkForDel = ?", '0');
$select->order("tbl.created_at DESC");
//echo $select;die;
$result = $this->db->fetchAll($select);
return $result;
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function getAgentHotelBooking($AgencySysId, $post = null)
{
//print_r($post['AirlineName']);
try {
$select = $this->db->select();
$select->from(array('tbl' => "tbl_hotel_booking"));
if (isset($post['BookingId']) && !empty($post['BookingId'])) {
$select->where("tbl.BookingId = ?", $post['BookingId']);
}
if (isset($post['bookingDate']) && !empty($post['bookingDate']) && $post['bookingDate'] != '__/__/____') {
$bookingDate = explode("/", $post['bookingDate']);
if (count($bookingDate) > 0) {
$strbookingDate = $bookingDate[2] . "-" . $bookingDate[1] . "-" . $bookingDate[0];
$select->where("DATE(tbl.created_at) = ?", $strbookingDate);
}
}
if (isset($post['CheckInDate']) && !empty($post['CheckInDate']) && $post['CheckInDate'] != '__/__/____') {
$CheckInDate = explode("/", $post['CheckInDate']);
if (count($CheckInDate) > 0) {
$strCheckInDate = $CheckInDate[2] . "-" . $CheckInDate[1] . "-" . $CheckInDate[0];
$select->where("DATE(tbl.CheckInDate) = ?", $strCheckInDate);
}
}
if (isset($post['status']) && !empty($post['status'])) {
$select->where("tbl.status = ?", $post['status']);
}
if (isset($post['cityName']) && !empty($post['cityName'])) {
$select->where("tbl.cityName = ?", $post['cityName']);
}
if (isset($post['CustomerDetails']) && !empty($post['CustomerDetails'])) {
$select->where("tbl.CustomerDetails = ?", $post['CustomerDetails']);
}
$select->where("tbl.AgencySysId = ?", $AgencySysId);
$select->where("tbl.status != ?", 0);
$select->where("tbl.IsMarkForDel = ?", '0');
$select->order("tbl.created_at DESC");
//echo $select;die;
$result = $this->db->fetchAll($select);
return $result;
} catch (Exception $e) {
echo $e->getMessage();
}
}
}