| 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/controllers/ |
Upload File : |
<?php
/**
* Class MISC
*
* @name MISC
* @author Prashant
* @version 1.0
* @copyright Catabatic India Pvt Ltd
* Handle MISC Related function
*
*/
class MiscController extends Catabatic_ValidateGtx {
public function init() {
parent::init();
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->markupMdl = new Markup_Model_Markup();
$this->objCurrency = new Travel_Model_TblCurrency();
$this->objSupplier = new Travel_Model_TblSupplier();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$this->intLoggedinUserId = $sessionLogin_user->intLoggedinUserId;
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
}
public function indexAction(){
$getData = '';
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$this->view->searchArr = $getData;
}
$this->view->miscdetails = $this->markupMdl->getDetailsForMisc($this->intLoggedinUserAgencySysId,$this->intLoggedinUserId,$getData);
}
public function addMiscItemAction(){
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getParams();
$dateTime = date('Y-m-d H:i:s');
$MiscItemSysId = isset($postData['MiscItemSysId'])?$postData['MiscItemSysId']:'';
$arrayData = array(
'SacCodeSysId' => !empty(($postData['SacCodeSysId']))? $postData['SacCodeSysId']:1,
'Title' => trim($postData['Title']),
'Description' => trim($postData['Description']),
'SupplierSysId' => !empty(($postData['supplier_type_id']))? $postData['supplier_type_id']:null,
'CurrencySysId' => !empty(($postData['CurrencySysId']))? $postData['CurrencySysId']:1,
'IsTaxable' => !empty(($postData['IsTaxable']))? $postData['IsTaxable']:0,
'TaxSysId' => !empty(($postData['IsTaxable']))? $postData['TaxSysId']:0,
'Cost' => !empty(($postData['Cost']))? $postData['Cost']:0,
'MarkupType' => !empty(($postData['MarkupType']))? $postData['MarkupType']:1,
'B2CMarkup' => !empty(($postData['B2CMarkup']))? $postData['B2CMarkup']:0,
'B2BMarkup' => !empty(($postData['B2BMarkup']))? $postData['B2BMarkup']:0,
'PriceType' => $postData['PriceType'],
'IsInfant' => isset($postData['PriceType']) && ($postData['PriceType']==2) ? (isset($postData['IsInfant'])?1:0):0,
'UpdateDate' => $dateTime,
'IsActive' => !empty(($postData['IsActive']))? $postData['IsActive']:0,
'IsMarkForDel' => 0,
);
try {
if(!empty($MiscItemSysId)){ // Update Misc
$where = array('MiscItemSysId =?'=> $MiscItemSysId);
$this->markupMdl->updateTable("Tb_Ic_Misc_Items", $arrayData,$where);
$response = ['success' => true, 'message' => 'Updated Successfully'];
} else { // insert Misc
$arrayData['AgentSysId'] = $this->intLoggedinUserId;
$arrayData['ICSourceSysId'] = $this->intLoggedinUserAgencySysId;
$arrayData['CreateDate'] = $dateTime;
$this->markupMdl->insertTable("Tb_Ic_Misc_Items", $arrayData);
$response = ['success' => true, 'message' => 'Added Successfully'];
}
} catch (Exception $e) {
$response = ['success' => false, 'message' => $e->getMessage()];
}
echo json_encode($response);
exit();
}
if($this->getRequest()->getParam('id')>0){
$miscId = $this->getRequest()->getParam('id');
$this->view->arrMiscItemDetails = $this->markupMdl->getDetailsByMiscId($miscId,$this->intLoggedinUserAgencySysId);
}
$this->view->arrSacCode = $this->markupMdl->getDetailsForSacCode();
$this->view->arrCurrencyTypes = $this->objCurrency->getCurrencyTypes();
$this->view->arrSupplierTypes = $this->objSupplier->getSupplierTypes();
$this->view->getTaxSettingDetail = $this->markupMdl->getTaxSettingDetail("TB_Master_Agency_Tax_Settings", $this->intLoggedinUserAgencySysId, 0, 0, 5, 0);
}
public function deleteMiscItemAction(){
$this->_helper->layout->disableLayout();
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getParams();
$MiscItemSysId = $postData['id'];
$dateTime = date('Y-m-d H:i:s');
$updatedata = array(
'UpdateDate' => $dateTime,
'IsActive' => 0,
'IsMarkForDel' => 1,
);
try {
$where = array('MiscItemSysId =?'=> $MiscItemSysId);
$this->markupMdl->updateTable("Tb_Ic_Misc_Items", $updatedata,$where);
$response['success'] = true;
$response['message'] = 'Delete Successfully';
} catch (Exception $e) {
$response['success'] = false;
$response['message'] = $e->getMessage();
}
echo json_encode($response);
exit();
}
}
public function addAddonItemsAction(){
$this->view->getTaxSettingDetail = $this->markupMdl->getTaxSettingDetail("TB_Master_Agency_Tax_Settings", $this->intLoggedinUserAgencySysId, 0, 0, 5, 0);
}
}