403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/controllers/AddForexController.php
<?php

/*
 * Class AddForexController
 *
 * @name		AddForexController
 * @author		Neeraj
 * @version 	1.0
 * @copyright 	Catabatic India Pvt Ltd
 * Handle addForex Related function
 *
 */
class AddForexController extends Catabatic_ValidateGtx {

    const ADMIN_ID = 1;
    const CONST_SOURCE_ADMIN = 3;

    public $agencySysId;
    public $userSysId;

    public $baseUrl = '';
    public $_HtmlPurifier;
    public $objaddforex;

    public function init() {
        parent::init();
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
        $sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
        $this->userSysId = $sessionLogin_user->intLoggedinUserId;
        $this->agencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
        $this->roleID = $sessionLogin_user->UserRole;
        $this->ReportingToSysId = $sessionLogin_user->ReportingToSysId;
        $this->objaddforex = new Travel_Model_TblAddForex();
        $sessionLogin_user->lock();
        $this->_HtmlPurifier = new Zend_Filter_HtmlPurifier();
        if ($sessionLogin_user->isLocked()) {
            $sessionLogin_user->unLock();
        }
                
        $this->_agencyuserroleObj = new Travel_Model_TblAgencyUserRole();
        $this->_crmcustomerObj = new Travel_Model_CRM_Customer();

    }

    /* location list */
    public function serviceLocationAction() {
        if ($this->getRequest()->isPost()) {
            $param = $this->getRequest()->getParams();
            $searchArr = array();
            $searchArr['city'] = $param['city'];
            $searchArr['CityId'] = $param['city_id'];
        }
        $this->view->searchArr = $searchArr;
        $locatiolist = $this->objaddforex->getlocationlist($this->agencySysId,$searchArr);
        $page = $this->_getParam('page', 1);
        $paginator = Zend_Paginator::factory($locatiolist);
        $paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
        $paginator->setCurrentPageNumber($page);
        $this->view->paginator = $paginator;
    }
    /* add location */
    public function addLocationAction() {
        $id  = $this->getRequest()->getParam('id');
        if(!empty($id)){
            $this->view->locationDetails = $this->objaddforex->getlocationbyId($id);
        }
    }
    /* save and update location */
    public function saveupdatelocationAction(){
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer->setNoRender(true);
            if ($this->getRequest()->isPost()) {
                $param = $this->getRequest()->getParams();
                $id = isset($param['id']) && !empty($param['id'])? $param['id']:null;
                if(empty($param['city_id'])){
                    $returnResponse = array('success'=> false,'message'=>'Please Select City');
                    echo json_encode($returnResponse);
                    exit;
                }
                if(empty($param['PinCode'])){
                    $returnResponse = array('success'=> false,'message'=>'Please Add Pincode');
                    echo json_encode($returnResponse);
                    exit;
                }
                if(empty($param['mobile_number'])){
                    $returnResponse = array('success'=> false,'message'=>'Please Enter Mobile Number.');
                    echo json_encode($returnResponse);
                    exit;
                } 

                $checkcityDublicate = $this->objaddforex->checkcityDublicate($this->agencySysId,$param['city_id']);

                if(empty($id) && !empty($checkcityDublicate)){
                    $returnResponse = array('success'=> false,'message'=>'City Already Exists');
                    echo json_encode($returnResponse);
                    exit;
                }

                if(!empty($id)){
                    $UpdateArray = array(
                        'CountryCode' => $param['countrycode'],
                        'MobileNo' => $param['mobile_number'],
                        'PinCode' => $param['PinCode'],
                        'Address' => $param['Address'],
                        'UpdatedDate' => date("Y-m-d H:i:s")
                    );
                    $this->objaddforex->updateData('Tb_Agency_Service_Location',$UpdateArray,$id);
                    $returnResponse = array('success'=> true,'message'=>'City Updated Successfully.');
                       
                } else {
                        $locationArray = array(
                            'CityId' => $param['city_id'],
                            'StateId' => isset($param['state_id']) && !empty($param['state_id'])? $param['state_id']:null,
                            'CountryCode' => $param['countrycode'],
                            'MobileNo' => $param['mobile_number'],
                            'PinCode' => $param['PinCode'],
                            'Address' => $param['Address'],
                            'UpdatedDate' => date("Y-m-d H:i:s"),
                            'CreatedDate' => date("Y-m-d H:i:s"),
                            'IsActive' => 1,
                            'IsMarkForDelete' => 0,
                            'AgencySysId' => $this->agencySysId,
                            'AgentSysId' => $this->userSysId,
                        );
                    $this->objaddforex->insertData('Tb_Agency_Service_Location',$locationArray);
                    $returnResponse = array('success'=> true,'message'=>'City added Successfully.');
                }
               
                echo json_encode($returnResponse);
                exit;
            }
    }
    /* delete location */
    public function deletelocationAction(){
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);
        if ($this->getRequest()->isPost()) {
            $param = $this->getRequest()->getParams();
            $id = $param['id'];
            $UpdateArray = array(
                    'IsActive' => 0,
                    'IsMarkForDelete' => 1,
                    'UpdatedDate' => date("Y-m-d H:i:s"),

                );
                $this->objaddforex->updateData('Tb_Agency_Service_Location',$UpdateArray,$id);
                $returnResponse = array('success'=> true,'message'=>'City Deleted Successfully.');
                   
            }
            echo json_encode($returnResponse);
            exit;
    }
    /* get autosuggest city and state */
    public function autosuggestAction(){
        $this->_helper->viewRenderer->setNoRender(true);
        $this->_helper->layout->disableLayout();
        try {
            $arrResponse = array();
            if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
                $term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
                $countryId = $this->getRequest()->getParam("countryId") ? $this->getRequest()->getParam("countryId") : '';
                $condCity = "tbl.Title like '" . $term . "%'";
                if (isset($countryId) && !empty($countryId)) {
                    $condCity .= " AND tbl.ContSysId = " . $countryId . "";
                }
                $keyword = trim($condCity);
                $response = array();
                $objHotel = new Travel_Model_TblCity();
                $rowset = $objHotel->getCityListWithStateDetail($keyword);
                if (count($rowset) > 0) {
                    foreach ($rowset as $row) {
                        $response[] = array('TBBCityId' => $row['TBBCityId'], 'CityId' => $row['CityId'], 'CityName' => stripslashes($row['cityTitle']), 'label' => $row['cityTitle'] . '(' . $row['countryTitle'] . ')','StateId'=>$row['StateId'],'stateCode'=>$row['stateCode'],'stateTitle'=>$row['stateTitle'],'ContId' => $row['ContId'], 'countryCode' => trim($row['countryCode']), 'countryTitle' => trim($row['countryTitle']));
                    }
                }
            }
            echo json_encode($response);
            exit;
        } catch (Exception $e) {
            $response = array('success' => false, 'msg' => $e->getMessage());
            echo json_encode($response);
            exit;
        }

    }
    /* buy currency list */
    public function currenciesAction() {
        $getBuycurrecy = $this->objaddforex->getcurrecy($this->agencySysId,1);
        $this->view->getBuycurrecy = $getBuycurrecy;
    }
    /* sell currency list */
    public function sellCurrenciesAction() {
        $getSellcurrecy = $this->objaddforex->getcurrecy($this->agencySysId,2);
        $this->view->getSellcurrecy = $getSellcurrecy;
    }
    /* save and update currency */
    public function savecurrencyupdateforexAction(){
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);
        if ($this->getRequest()->isPost()) {
            $param = $this->getRequest()->getParams();
            $ids  = $param['ids'];
            $ForexType = $param['ForexType'];
            $baseCurrency = $param['baseCurrency'];
            $selectedCurrencySysId = $param['CurrencySysId'];
            $markupType = $param['markupType'];
            $CurrencyNoteCost = $param['CurrencyNoteCost'];
            $CurrencyNoteB2BMarkup = $param['CurrencyNoteB2BMarkup'];
            $CurrencyNoteB2CMarkup = $param['CurrencyNoteB2CMarkup'];

            $ForexCardCost = $param['ForexCardCost'];
            $ForexCardB2BMarkup = $param['ForexCardB2BMarkup'];
            $ForexCardB2CMarkup = $param['ForexCardB2CMarkup'];
            $selectedCurrencyArr = array();
            foreach($selectedCurrencySysId as $selectedCurrency){
                if(!empty($selectedCurrency)){
                    if(in_array($selectedCurrency,$selectedCurrencyArr)){
                    $return = array('success' => false, 'message' => "Duplicate Currency Not Allowed");
                    echo json_encode($return);
                    exit;
                    }
                    $selectedCurrencyArr[] = $selectedCurrency;
                }
            }
            $deleteArray = array('UpdatedDate' => date("Y-m-d H:i:s"),'IsActive' => 0,'IsMarkForDelete' => 1);
            $this->objaddforex->DeleteData($deleteArray,$this->agencySysId,$ForexType);
            foreach($selectedCurrencySysId as $key => $CurrencyIds){
                if(empty($CurrencyIds)){
                    $return = array('success' => false, 'message' => "Please Select Currency");
                    echo json_encode($return);
                    exit;
                }
                
                if(!empty($ids[$key])){
                    $currencyUpdateArray = array(
                        'FromCurrency' => ($ForexType == 1) ? $baseCurrency : $CurrencyIds,
                        'ToCurrency' => ($ForexType == 1) ? $CurrencyIds : $baseCurrency,
                        'MarkupType' => $markupType[$key],
                        'CurrencyNotesCost' => !empty($CurrencyNoteCost[$key])?$CurrencyNoteCost[$key]:null,
                        'CurrencyNotesB2cMarkup' =>!empty($CurrencyNoteB2CMarkup[$key])?$CurrencyNoteB2CMarkup[$key]:null,
                        'CurrencyNotesB2bMarkup' => !empty($CurrencyNoteB2BMarkup[$key])?$CurrencyNoteB2BMarkup[$key]:null,
                        'ForexCardCost' => !empty($ForexCardCost[$key])?$ForexCardCost[$key]:null,
                        'ForexCardB2cMarkup' => !empty($ForexCardB2CMarkup[$key])?$ForexCardB2CMarkup[$key]:null,
                        'ForexCardB2bMarkup' => !empty($ForexCardB2BMarkup[$key])?$ForexCardB2BMarkup[$key]:null,
                        'UpdatedDate' => date("Y-m-d H:i:s"),
                        'IsActive' => 1,
                        'IsMarkForDelete' => 0,
                        'AgencySysId' => $this->agencySysId,
                        'AgentSysId' => $this->userSysId,
                    );

                $this->objaddforex->updateData('Tb_Agency_Forex_Currency',$currencyUpdateArray,$ids[$key]);
                    
                } else{
                    $currencyArray = array(
                        'FromCurrency' => ($ForexType == 1) ? $baseCurrency : $CurrencyIds,
                        'ToCurrency' => ($ForexType == 1) ? $CurrencyIds : $baseCurrency,
                        'ForexType' => $ForexType,
                        'MarkupType' => $markupType[$key],
                        'CurrencyNotesCost' => !empty($CurrencyNoteCost[$key])?$CurrencyNoteCost[$key]:null,
                        'CurrencyNotesB2cMarkup' =>!empty($CurrencyNoteB2CMarkup[$key])?$CurrencyNoteB2CMarkup[$key]:null,
                        'CurrencyNotesB2bMarkup' => !empty($CurrencyNoteB2BMarkup[$key])?$CurrencyNoteB2BMarkup[$key]:null,
                        'ForexCardCost' => !empty($ForexCardCost[$key])?$ForexCardCost[$key]:null,
                        'ForexCardB2cMarkup' => !empty($ForexCardB2CMarkup[$key])?$ForexCardB2CMarkup[$key]:null,
                        'ForexCardB2bMarkup' => !empty($ForexCardB2BMarkup[$key])?$ForexCardB2BMarkup[$key]:null,
                        'UpdatedDate' => date("Y-m-d H:i:s"),
                        'CreatedDate' => date("Y-m-d H:i:s"),
                        'IsActive' => 1,
                        'IsMarkForDelete' => 0,
                        'AgencySysId' => $this->agencySysId,
                        'AgentSysId' => $this->userSysId,
                    );
                    $this->objaddforex->insertData('Tb_Agency_Forex_Currency',$currencyArray);
                }
            }
            $returnResponse = array('success'=> true,'message'=>'Record Updated Successfully.');
            echo json_encode($returnResponse);
            exit;
        }
    }
     public function forexBookingListAction() {
        $strUrlData = $this->view->strUrlData = $this->getRequest()->getParam('data');
        $arrUrlData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->dataDecode($strUrlData);

        $this->view->msg = !empty($arrUrlData['msg']) ? $arrUrlData['msg'] : '';
        $this->view->status = !empty($arrUrlData['status']) ? $arrUrlData['status'] : '';
        $this->view->TPSysIdReq = !empty($arrUrlData['TPSysId']) ? $arrUrlData['TPSysId'] : 0;
        $objPackageViewList = new Travel_Model_TblAgencyCustomerTrx();
        $getRoleDetail = $this->_agencyuserroleObj->getDataByRole($this->roleID);
        //echo print_r($getRoleDetail);die;
//        $objPackageViewList->ReportingToSysId = $this->ReportingToSysId;
        $getData = array();
        if ($this->getRequest()->getPost()) {
            $getData = $this->getRequest()->getPost();

            $proposalId = (isset($getData['proposalId']) && !empty($getData['proposalId'])) ? trim($getData['proposalId']) : 0;
            $proposalIdEx = explode('/', $proposalId);

            $getData = $this->_HtmlPurifier->filterArray($getData);
            $this->view->searchArr = $this->view->searchData = $getData;
            $getData['proposalId'] = (isset($proposalIdEx[2]) && !empty($proposalIdEx[2])) ? $proposalIdEx[2] : (int) $proposalIdEx[0];
            $getData['hidden_selected_hotel_cityid'] = (isset($getData['Destination']) && !empty($getData['Destination'])) ? (int) $getData['Destination'] : '';
        }
        $coupon_id = $this->_getParam('id', '');
        $filter = $this->_getParam('filter', 'today');
        $source = ($filter == 'coupon') ? 'overall' : $filter;
        $this->view->source = $source;
        switch ($source) {
            case 'overall': {
                    $currentDate = date("Y-m-d");
                    $fromDate = '2016-10-26';
                    break;
                }
            case 'last-month': {
                    $fromDate = date('Y-m-d', strtotime('first day of last month'));
                    $currentDate = date('Y-m-d', strtotime('last day of last month'));
                    break;
                }
            case 'current-month': {
                    $currentDate = date("Y-m-d");
                    $currentMonth = date("m");
                    $currentYear = date("Y");
                    $fromDate = "$currentYear-$currentMonth-01";
                    break;
                }
            case 'last-week': {
                    $previous_week = strtotime("-1 week +1 day");
                    $start_week = strtotime("last sunday midnight", $previous_week);
                    $end_week = strtotime("next saturday", $start_week);
                    $start_week = date("Y-m-d", $start_week);
                    $end_week = date("Y-m-d", $end_week);
                    $fromDate = $start_week;
                    $currentDate = $end_week;
                    break;
                }
            case 'current-week': {
                    $currentDate = date("Y-m-d");
                    if (date('D') != 'Mon') {
                        $fromDate = date('Y-m-d', strtotime('last Monday'));
                    } else {
                        $fromDate = date('Y-m-d');
                    }
                    break;
                }
            case 'today': {
                    $currentDate = date("Y-m-d");
                    $fromDate = date("Y-m-d");
                    break;
                }
            default: {
                    $currentDate = date("Y-m-d");
                    $fromDate = date("Y-m-d");
                    break;
                }
        }

        $update_from_date = $this->_request->getPost('from_date', NULL);
        $update_to_date = $this->_request->getPost('to_date', NULL);
        $from_date = $this->_request->getParam('from_date', NULL);
        $to_date = $this->_request->getParam('to_date', NULL);
        if ($update_from_date != NULL && $update_to_date != NULL) {
            $getData1 = array(
                'updatecurrentDate' => $update_to_date,
                'updatefromDate' => $update_from_date,
                'PlanType' => 7
            );
        } else if ($from_date != NULL && $to_date != NULL) {
            $getData1 = array(
                'currentDate' => $to_date,
                'fromDate' => $from_date,
                'PlanType' => 7
            );
        } else {
            $getData1 = array(
                'updatecurrentDate' => $currentDate,
                'updatefromDate' => $fromDate,
                 'PlanType' => 7
            );
        }
        $checkOutFromDate = $this->_request->getParam('from_checkout_date', NULL);
        $checkOutToDate = $this->_request->getParam('to_checkout_date', NULL);
        if ($checkOutFromDate != NULL && $checkOutToDate != NULL) {
            $getData1 = array(
                'ValidTillcurrentDate' => $checkOutToDate,
                'ValidTillfromDate' => $checkOutFromDate,
                'PlanType' => 7
            );
        }
        $getData = array_merge($getData, $getData1);
        if ($filter == 'coupon' && $coupon_id != '') {
            $this->COUPON_HISTORY_CODE_API = COUPON_HISTORY_CODE_API;
            $url = $this->COUPON_HISTORY_CODE_API . 'get-tpsysid/?MasterCouponId=' . $coupon_id;
            $CouponHistoryArray = $this->paymentMdl->getgtxapiinfo($url);
            $TPSysIdArray = array();
            if (isset($CouponHistoryArray['results']) && !empty($CouponHistoryArray['results'])) {
                foreach ($CouponHistoryArray['results'] as $key => $value) {
                    if ($value['TPSysID'] > 0) {
                        $TPSysIdArray[] = $value['TPSysID'];
                    }
                }
            }

            if (!empty($TPSysIdArray)) {
                $getData['TPSysIdArr'] = $TPSysIdArray;
            }
        }
        if (!empty($getData['agencyServicesFilter'])) {
            if ($getData['agencyServicesFilter'] == 1) {
                $getData['agencyServicesName'] = 'HotelVoucherStatus';
            }
            if ($getData['agencyServicesFilter'] == 2) {
                $getData['agencyServicesName'] = 'FlightVoucherStatus';
            }
            if ($getData['agencyServicesFilter'] == 3) {
                $getData['agencyServicesName'] = 'SightseeingVoucherStatus';
            }
            if ($getData['agencyServicesFilter'] == 4) {
                $getData['agencyServicesName'] = 'TransferVoucherStatus';
            }
            if ($getData['agencyServicesFilter'] == 5) {
                $getData['agencyServicesName'] = 'VisaVoucherStatus';
            }
            if ($getData['agencyServicesFilter'] == 6) {
                $getData['agencyServicesName'] = 'OtherVoucherStatus';
            }
        }



        if ($getRoleDetail['IsAdmin'] == true || $getRoleDetail['IsSuperAdmin'] == true) {
            $getData['UserSysId'] = '0';
            $customerBookingRecord = $objPackageViewList->getBookedForexDetail($this->agencySysId, $getData);
        } else {
            $getData['UserSysId'] = $this->intLoggedinUserId;
            $customerBookingRecord = $objPackageViewList->getBookedForexDetail($this->agencySysId, $getData);
        }
        $page = $this->_getParam('page', 1);
        $paginator = Zend_Paginator::factory($customerBookingRecord);
        $paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
        $paginator->setCurrentPageNumber($page);
        //         echo '<pre>';print_r($paginator); die;
        $this->view->paginator = $paginator;
        $TblCurrency = new Travel_Model_TblCurrency();
        $this->view->CurrencySymbol = $CurrencySymbol = $TblCurrency->getCurrencySymbolByIdsList();
        $this->_crmcustomerObj->ReportingToSysId = $this->ReportingToSysId;
        $getleadSource = $this->_crmcustomerObj->getLeadSourceByAgency($this->intLoggedinUserAgencySysId);
        $this->view->leadSourceList = $getleadSource;
        if ($getRoleDetail['IsAdmin'] == true || $getRoleDetail['IsAbleToManageTask'] == true || $getRoleDetail['IsSuperAdmin'] == true) {
            $agencyUser = $this->_crmcustomerObj->getAllAgencyUserList('', $this->agencySysId);
        } else {
            $agencyUser = $this->_crmcustomerObj->getAllAgencyUserList('', $this->agencySysId, $this->ReportingToSysId);
        }
        $this->view->agencyUser = $agencyUser;
    }

    public function getcurrencyautosuggestAction()
    {
        $this->_helper->viewRenderer->setNoRender(true);
        $this->_helper->layout->disableLayout();
    
        try {
            $response = [];
    
            $term = $this->getRequest()->getParam("term") ?: $this->getRequest()->getParam("query");
    
            if ($term) {
                $forextype = $this->getRequest()->getParam("forextype") ?: '';
                $baseCurrency = $this->getRequest()->getParam("baseCurrency") ?: '';
    
                $objCurrency = new Travel_Model_TblCurrency();
                $rowset = $objCurrency->getCurrencyAutosuggestList($term);
    
                if (count($rowset) > 0) {
                    foreach ($rowset as $row) {
                        $response[] = [
                            'CurrencySysId' => $row['CurrencySysId'],
                            'Title' => trim($row['Symbol']). ' '.trim($row['Title']),
                        ];
                    }
                }
            }
    
            echo json_encode($response);
            exit;
        } catch (Exception $e) {
            $response = ['success' => false, 'msg' => $e->getMessage()];
            echo json_encode($response);
            exit;
        }
    }
    


}

Youez - 2016 - github.com/yon3zu
LinuXploit