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/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/models/TblRewardPoints.php
<?php

class Travel_Model_TblRewardPoints extends Zend_Db_Table_Abstract {

    private $db = NULL;

    public function __construct() {
        $this->db = Zend_Db_Table::getDefaultAdapter();
    }

    public function __destruct() {
        $this->db->closeConnection();
    }

    public function addRewardsPoints($AgencySysId, $MasterAgencySysId, $points, $UserSysId, $pointsPersentage, $SalesValue, $Remark = '', $type = 1, $TPSysId = null) {
        $paymentMdl = new Payment_Model_Payment();
        $customerTravelPlan = new Travel_Model_CRM_CustomerTravelPlan();
        $checkArrayData = array();
        if ($type == 2) {
            $TPSysId = 0;
            $checkArrayData = $customerTravelPlan->checkAgencyRewardPoints($AgencySysId, $MasterAgencySysId);
        } else {
            $checkArrayData = $customerTravelPlan->checkAgencyRewardPoints($AgencySysId, $MasterAgencySysId, $TPSysId);
        }
        if (empty($checkArrayData)) {
            $getRewardsPoints = $paymentMdl->getDetailsByUniqueId("TB_Agency_Reward_Points", "AgencySysId", $AgencySysId);
            if (isset($getRewardsPoints['BalancePoints'])) {
                $updateRewardsData = array('BalancePoints' => new Zend_Db_Expr("BalancePoints + $points"));
                $whereRewards = array('RewardPointsSysId =?' => $getRewardsPoints['RewardPointsSysId']);
                $paymentMdl->updateTable("TB_Agency_Reward_Points", $updateRewardsData, $whereRewards);
                $rewardsPointsid = $getRewardsPoints['RewardPointsSysId'];
            } else {
                $insertRewardPointsData = array(
                    "AgencySysId" => $AgencySysId,
                    "MasterAgencySysId" => $MasterAgencySysId,
                    "Title" => 'Reward_' . $AgencySysId,
                    "CurrencyType" => 1,
                    "BalancePoints" => $points,
                    "CreateDate" => date("Y-m-d H:i:s"),
                    "UpdateDate" => date("Y-m-d H:i:s"),
                    "IsMarkForDel" => 0,
                    "IsActive" => 1
                );
                $rewardsPointsid = $paymentMdl->insertTable("TB_Agency_Reward_Points", $insertRewardPointsData);
            }
            $getRewardsPointsArray = $paymentMdl->getDetailsByUniqueId("TB_Agency_Reward_Points", "AgencySysId", $AgencySysId);
            $insertRewardHistoryPointsData = array(
                "AgencySysId" => $AgencySysId,
                "MasterAgencySysId" => $MasterAgencySysId,
                "RewardPointsSysId" => $rewardsPointsid,
                "CreditPoints" => $points,
                "PointsPercentage" => $pointsPersentage,
                "ProposalId" => $TPSysId,
                "SalesValue" => $SalesValue,
                "CurrencyType" => 1,
                "AgentSysId" => $UserSysId,
                "Remark" => $Remark,
                "TrxType" => 1,
                "BalancePoints" => (int) $getRewardsPointsArray['BalancePoints'],
                "CreateDate" => date("Y-m-d H:i:s"),
                "UpdateDate" => date("Y-m-d H:i:s"),
                "IsMarkForDel" => 0,
                "IsActive" => 1
            );
            $paymentMdl->insertTable("TB_Agency_Reward_Points_History", $insertRewardHistoryPointsData);
            return array("status" => true, "message" => "Record saved");
        } else {
            return array("status" => false, "message" => "Record already exist");
        }
    }

    public function updateRewardsPointsStatus($AgencySysId, $MasterAgencySysId, $UserSysId, $isActive = 0) {
        $paymentMdl = new Payment_Model_Payment();
        $getRewardsPoints = $paymentMdl->getDetailsByUniqueId("TB_Agency_Reward_Points", "AgencySysId", $AgencySysId);
        if (isset($getRewardsPoints['BalancePoints'])) {
            $updateRewardsData = array('IsActive' => $isActive, 'IsMarkForDel' => 0, 'UpdateDate' => date("Y-m-d H:i:s"));
            $whereRewards = array('RewardPointsSysId =?' => $getRewardsPoints['RewardPointsSysId']);
            $paymentMdl->updateTable("TB_Agency_Reward_Points", $updateRewardsData, $whereRewards);
            $rewardsPointsid = $getRewardsPoints['RewardPointsSysId'];
        } else {
            $insertRewardPointsData = array(
                "AgencySysId" => $AgencySysId,
                "MasterAgencySysId" => $MasterAgencySysId,
                "Title" => 'Reward_' . $AgencySysId,
                "CurrencyType" => 1,
                "BalancePoints" => 0,
                "CreateDate" => date("Y-m-d H:i:s"),
                "UpdateDate" => date("Y-m-d H:i:s"),
                "IsMarkForDel" => 0,
                "IsActive" => 1
            );
            $rewardsPointsid = $paymentMdl->insertTable("TB_Agency_Reward_Points", $insertRewardPointsData);
        }
        $insertRewardHistoryPointsData = array(
            "AgencySysId" => $AgencySysId,
            "MasterAgencySysId" => $MasterAgencySysId,
            "RewardPointsSysId" => $rewardsPointsid,
            "CreditPoints" => 0,
            "PointsPercentage" => 1,
            "ProposalId" => 0,
            "SalesValue" => 0,
            "CurrencyType" => 1,
            "AgentSysId" => $UserSysId,
            "Remark" => "Welcome",
            "TrxType" => 1,
            "BalancePoints" => 0,
            "CreateDate" => date("Y-m-d H:i:s"),
            "UpdateDate" => date("Y-m-d H:i:s"),
            "IsMarkForDel" => 0,
            "IsActive" => 1
        );
        $paymentMdl->insertTable("TB_Agency_Reward_Points_History", $insertRewardHistoryPointsData);
        return true;
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit