| 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/modules/bus/models/ |
Upload File : |
<?php
/* Zend Framework
* @category Zend
* @package Zend_Controller_Action
* @copyright Copyright (c) 2008-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version 1.0
* @author Pardeep Panchal <pardeep@catpl.co.in>
* Create Date 20-09-2017
* Update Date 20-09-2017
* *************************************************************
*/
class Bus_Model_Bus extends Zend_Db_Table_Abstract {
public $strCondition;
public $db;
public function __construct() {
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct() {
$this->db->closeConnection();
}
public function insertTable($table, $data) {
$dbtable = new Zend_Db_Table("$table");
return $dbtable->insert($data);
}
public function updateTable($table, $editData, $where) {
$dbtable = new Zend_Db_Table("$table");
$dbtable->update($editData, $where);
}
public function deleteRow($tbl, $where) {
$dbtable = new Zend_Db_Table($tbl);
$dbtable->delete($where);
}
public function checkBusInventory($TPSysId, $BusSysId, $Fromdate, $SeatNo) {
$select = $this->db->select();
$select->from(array('tb1' => "TB_Bus"), array(""));
$select->joinLeft(array('tb2' => "TB_Bus_Layouts"), "tb1.LayoutType = tb2.BusLayoutsId", array(""));
$select->joinLeft(array('tb3' => "Tb_Bus_Seats"), "tb2.BusLayoutsId = tb3.BusLayoutsId", array("BusSeatsId"));
$select->where("tb1.BusId =?", $BusSysId);
$select->where("tb3.BusSeatsId IN (?)", $SeatNo);
$select->where("tb1.IsActive =?", 1);
$select->where("tb1.IsMarkForDelete =?", 0);
$result = $this->db->fetchAll($select);
$newseatnoarray = array();
$i = 0;
foreach ($result as $seatArr) {
$newseatnoarray[$i] = $seatArr["BusSeatsId"];
$i++;
}
$CreditArray = array("SeatId");
$select1 = $this->db->select();
$select1->from(array('tb1' => "TB_TravelPlan_Bus_Seats"), $CreditArray);
$select1->where("tb1.IsActive =?", 1);
$select1->where("tb1.IsMarkForDelete =?", 0);
$select1->where("tb1.TPSysId =?", $TPSysId);
$select1->where("tb1.InventoryDate =?", $Fromdate);
$select1->where("tb1.SeatId IN (?)", $SeatNo);
$select1->where("tb1.Status !=?", 0);
$result1 = $this->db->fetchAll($select1);
$status = false;
sort($SeatNo);
sort($newseatnoarray);
if (empty($result1)) {
if ($SeatNo == $newseatnoarray) {
$status = true;
}
}
return $status;
}
public function getBusRoute($BusRouteSysId) {
$select = $this->db->select();
$select->from(array('tb1' => "TB_Agency_Transport_Bus_Route"), array("StartCitySysId", "EndCitySysId"));
$select->where("tb1.BusRouteSysId =?", $BusRouteSysId);
$select->where("tb1.IsActive =?", 1);
$select->where("tb1.IsMarkForDel =?", 0);
$result = $this->db->fetchRow($select);
return $result;
}
}