| 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_TblGstRates {
protected $db = NULL;
protected $baseUrl = NULL;
protected $intLoggedinUserAgencySysId = NULL;
/* * ************************************ */
public function __construct() {
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
$this->db = Zend_Db_Table::getDefaultAdapter();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
}
public function __destruct() {
$this->db->closeConnection();
}
public function getGSTTypeAndRatesOld($intProductType, $intProductGeoType, $Taxon) {
$arrGSTProductGeography = array('ProductType', 'ProductTypeDesc', 'Taxon', 'TaxonDesc');
$arrGSTRates = array('TaxRate');
$select = $this->db->select();
$select->from(array('tb1' => "TB_Master_GST_ProductGeography"), $arrGSTProductGeography);
$select->joinLeft(array('tb2' => "TB_Master_GST_Rates"), "tb2.ProdGeoSysId = tb1.ProdGeoSysId", $arrGSTRates);
//$select->where($where);
$select->where("tb1.ProductType = ?", $intProductType);
$select->where("tb1.GeographyType = ?", $intProductGeoType);
$select->where("tb1.Taxon = ?", $Taxon);
$result = $this->db->fetchRow($select);
return $result;
}
public function getGSTTypeAndRates($intProductType, $TaxSysId, $taxableAmount = 0, $MarkUp = 0) { // Created By Mangal to get dynamic GST Rate 15/01/2020
$result = array();
if($TaxSysId > 0){
$select = $this->db->select()
->from(array('tb1' => "TB_Master_Agency_Tax_Settings"))
->joinLeft(array('tb2' => "TB_Master_TaxType"), "tb2.TaxType = tb1.Tax", array('Title as TaxTypeTitle'))
->where("tb1.TaxSysId=?", $TaxSysId)
->where("tb1.IsActive =?", 1)
->where("tb1.IsMarkForDel =?", 0);
$result = $this->db->fetchRow($select);
}
if (is_array($result) && !empty($result)) {
$TaxRate = isset($result['TaxPercentage'])?(float)$result['TaxPercentage']:0;
$TaxType = isset($result['TaxType'])?(int)$result['TaxType']:0;
$TaxTypeTitle = isset($result['TaxTypeTitle'])?$result['TaxTypeTitle']:'';
$IsDefaultId = isset($result['IsDefaultId'])?$result['IsDefaultId']:0;
if($TaxType == 3 && $IsDefaultId != 5 && $TaxRate == 0){
$TaxTypeTitle = '';
}
if ($TaxType == 1 && $taxableAmount > 0) {
$gstAmount = ((float)$taxableAmount * $TaxRate) / 100;
} elseif ($TaxType == 2 && $MarkUp > 0) {
$gstAmount = ((float)$MarkUp * $TaxRate) / 100;
} else {
$gstAmount = 0;
}
} else {
$TaxType = 0;
$TaxRate = 0;
$gstAmount = 0;
$TaxTypeTitle = '';
$IsDefaultId = 0;
}
return array('TaxType' => $TaxType, 'TaxRate' => $TaxRate, 'gstAmount' => $gstAmount, 'TaxTypeTitle' => $TaxTypeTitle, 'IsDefaultId' => $IsDefaultId);
}
public function getGSTMasterValue($intProductType, $intProductGeoType) {
$arrGSTProductGeography = array('ProductType', 'ProductTypeDesc', 'Taxon', 'TaxonDesc');
$arrGSTRates = array('TaxRate');
$select = $this->db->select();
$select->from(array('tb1' => "TB_Master_GST_ProductGeography"), $arrGSTProductGeography);
$select->joinLeft(array('tb2' => "TB_Master_GST_Rates"), "tb2.ProdGeoSysId = tb1.ProdGeoSysId", $arrGSTRates);
//$select->where($where);
$select->where("tb1.ProductType = ?", $intProductType);
$select->where("tb1.GeographyType = ?", $intProductGeoType);
$result = $this->db->fetchAll($select);
return $result;
}
}