| 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_CreditBalance {
public $intAgencySysId = NULL;
public $intId = NULL;
public $intMPType = NULL;
public $intCustGrSysId = NULL;
public $intMarkupType = NULL;
private $db = NULL;
public function __construct() {
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function __destruct() {
$this->db->closeConnection();
}
public function getCreditSysId($AgencySysId) {
$select = $this->db->select()->from(array("t1" => "TB_Agency_Credit"), array("CreditSysId", "IsActive"))
->where("t1.IsMarkForDel =?", 0)
->where("t1.AgencySysId =?", $AgencySysId);
$resultArray = $this->db->fetchAll($select);
return $resultArray;
}
public function getBnplCreditSysId($AgencySysId) {
$select = $this->db->select()->from(array("t1" => "TB_Agency_BNPL_Credit"), array("CreditSysId", "IsActive"))
->where("t1.IsMarkForDel =?", 0)
->where("t1.AgencySysId =?", $AgencySysId);
$resultArray = $this->db->fetchAll($select);
return $resultArray;
}
public function getBnplBalance($B2BAgencySysIdKey, $B2CAgencySysIdKey) {
$select = $this->db->select()->from(array("t1" => "TB_Agency_BNPL_Credit"), array("BalanceAmount", "CreditDate", "OutStandingAmount" => (new Zend_Db_Expr("CreditAmount - BalanceAmount"))))
->joinLeft(array('t2' => "TB_Agency"), "t1.AgencySysId = t2.AgencySysId", array())
->joinLeft(array('t4' => "TB_Agency"), "t4.AgencySysId = t2.MasterAgencySysId", array())
->where("t1.IsActive =?", 1)
->where("t1.IsMarkForDel =?", 0)
->where("t2.SecurityKey =?", $B2CAgencySysIdKey)
->where("t2.IsActive =?", 1)
->where("t2.IsMarkForDelete =?", 0)
->where("t4.SecurityKey =?", $B2BAgencySysIdKey)
->where("t2.IsCheckB2BWallet =?", 1)
->where("t4.IsVarified =?", 1)
->where("t4.IsActive =?", 1)
->where("t4.IsMarkForDelete =?", 0)
->where("t4.IsApproved =?", 1);
//echo $select; exit;
$resultArray = $this->db->fetchAll($select);
return $resultArray;
}
public function getBalance($B2BAgencySysIdKey, $B2CAgencySysIdKey) {
$select = $this->db->select()->from(array("t1" => "TB_Agency_Credit"), array("BalanceAmount", "CreditDate", "OutStandingAmount" => (new Zend_Db_Expr("CreditAmount - BalanceAmount"))))
->joinLeft(array('t2' => "TB_Agency"), "t1.AgencySysId = t2.AgencySysId", array())
->joinLeft(array('t4' => "TB_Agency"), "t4.AgencySysId = t2.MasterAgencySysId", array())
->where("t1.IsActive =?", 1)
->where("t1.IsMarkForDel =?", 0)
->where("t2.SecurityKey =?", $B2CAgencySysIdKey)
->where("t2.IsActive =?", 1)
->where("t2.IsMarkForDelete =?", 0)
->where("t4.SecurityKey =?", $B2BAgencySysIdKey)
->where("t2.IsCheckB2BWallet =?", 1)
->where("t4.IsVarified =?", 1)
->where("t4.IsActive =?", 1)
->where("t4.IsMarkForDelete =?", 0)
->where("t4.IsApproved =?", 1);
//echo $select; exit;
$resultArray = $this->db->fetchAll($select);
return $resultArray;
}
public function getBnplBalanceOtherInfo($B2BAgencySysIdKey, $B2CAgencySysIdKey) {
$select = $this->db->select()->from(array("t1" => "TB_Agency_BNPL_Credit"), array("BalanceAmount", "AgencySysId", "CreditAmount", ""))
->joinLeft(array('t2' => "TB_Agency"), "t1.AgencySysId = t2.AgencySysId", array())
->joinLeft(array('t4' => "TB_Agency"), "t4.AgencySysId = t2.MasterAgencySysId", array())
->where("t1.IsActive =?", 1)
->where("t1.IsMarkForDel =?", 0)
->where("t2.SecurityKey =?", $B2CAgencySysIdKey)
->where("t2.IsActive =?", 1)
->where("t2.IsMarkForDelete =?", 0)
->where("t4.SecurityKey =?", $B2BAgencySysIdKey)
->where("t4.IsB2bSite =?", 1)
->where("t2.IsCheckB2BWallet =?", 1)
->where("t4.IsVarified =?", 1)
->where("t4.IsActive =?", 1)
->where("t4.IsMarkForDelete =?", 0)
->where("t4.IsApproved =?", 1);
$resultArray = $this->db->fetchAll($select);
return $resultArray;
}
public function getBalanceOtherInfo($B2BAgencySysIdKey, $B2CAgencySysIdKey) {
$select = $this->db->select()->from(array("t1" => "TB_Agency_Credit"), array("BalanceAmount", "AgencySysId", "CreditAmount", ""))
->joinLeft(array('t2' => "TB_Agency"), "t1.AgencySysId = t2.AgencySysId", array())
->joinLeft(array('t4' => "TB_Agency"), "t4.AgencySysId = t2.MasterAgencySysId", array())
->where("t1.IsActive =?", 1)
->where("t1.IsMarkForDel =?", 0)
->where("t2.SecurityKey =?", $B2CAgencySysIdKey)
->where("t2.IsActive =?", 1)
->where("t2.IsMarkForDelete =?", 0)
->where("t4.SecurityKey =?", $B2BAgencySysIdKey)
->where("t4.IsB2bSite =?", 1)
->where("t2.IsCheckB2BWallet =?", 1)
->where("t4.IsVarified =?", 1)
->where("t4.IsActive =?", 1)
->where("t4.IsMarkForDelete =?", 0)
->where("t4.IsApproved =?", 1);
$resultArray = $this->db->fetchAll($select);
return $resultArray;
}
public function getAndCheckCreditHistory($RefrenceNo, $paymentMode,$CreditSysId) {
$select = $this->db->select()->from(array("t1" => "TB_Agency_Credit_History"), array("BalanceAmount", "AgencySysId", "CreditAmount", "TrxId"))
->where("t1.TrxType =?", 1)
->where("t1.RefrenceNo =?", $RefrenceNo)
->where("t1.PaymentMode =?", $paymentMode)
->where("t1.IsMarkForDel =?", 0)
->where("t1.IsCredit =?", 2)
->where("t1.CreditSysId =?",$CreditSysId)
->where("t1.IsActive =?", 1);
$resultArray = $this->db->fetchAll($select);
return $resultArray;
}
}