Esempio n. 1
0
 public function showRenewalscost()
 {
     $json = stripcslashes($this->_GET['cost']);
     $data = json_decode($json, TRUE);
     $CustomersProjectID = $data['CustoProID'];
     $versiontime = $data['version'];
     unset($data['CustoProID']);
     unset($data['version']);
     $where = "where CustomersProjectID={$CustomersProjectID}";
     //获取风信项目id
     $ProjectId = FENGXIN_ID;
     $where .= " and ProjectID={$ProjectId} and AgentID={$_SESSION['AgentID']}";
     $AgentModule = new AgentModule();
     $CustFuwuModule = new CustFuwuModule();
     $FuWuModule = new FuWuModule();
     //获取当前代理的等级
     $Agentinfo = $AgentModule->GetOneInfoByKeyID($_SESSION['AgentID']);
     $LevelID['AgentPriceID'] = $Agentinfo['FengXinAgentPriceID'];
     //获取该等级的折扣
     $AgentPriceModule = new AgentPriceModule();
     $CustProModule = new CustProModule();
     $AgentPriceinfo = $AgentPriceModule->GetOneInfoByArrayKeys($LevelID);
     $AgenDiscount = $AgentPriceinfo['AgenDiscount'];
     $CustProInfo = $CustProModule->GetInfoByWhere($where);
     if (!empty($CustProInfo)) {
         $cost = 0;
         $Endtime = date('Y-m-d', strtotime($CustProInfo['EndTime']));
         $PropertyModule = new PropertyModule();
         $PropertyInfo = $PropertyModule->GetOneInfoByKeyID($CustProInfo['GongNeng']);
         $MarketPrice = $PropertyInfo['MarketPrice'];
         if (strtotime($Endtime) < strtotime(date('Y-m-d'))) {
             $cost = (strtotime($versiontime) - strtotime(date('Y-m-d'))) / (3600 * 24) * $MarketPrice * $AgenDiscount / 365;
         } else {
             $cost = (strtotime($versiontime) - strtotime($Endtime)) / (3600 * 24) * $MarketPrice * $AgenDiscount / 365;
         }
         foreach ($data as $k => $v) {
             $FuWuInfo = $FuWuModule->GetOneInfoByKeyID($k);
             $FuWuPrice = $FuWuInfo['FuWuPrice'];
             $sql = "where CustomersProjectID={$CustomersProjectID} and FuWuID={$k}";
             $CustFuwuInfo = $CustFuwuModule->GetInfoByWhere($sql);
             //dd($CustFuwuInfo);
             $FuwuEndTime = date('Y-m-d', strtotime($CustFuwuInfo['EndTime']));
             if (strtotime($FuwuEndTime) < strtotime(date('Y-m-d'))) {
                 $cost += (strtotime($v) - strtotime(date('Y-m-d'))) / (3600 * 24) * $FuWuPrice * $AgenDiscount / 365;
             } else {
                 $cost += (strtotime($v) - strtotime($FuwuEndTime)) / (3600 * 24) * $FuWuPrice * $AgenDiscount / 365;
             }
         }
     }
     echo '此次续费将消费金额<span class="red font22">¥:' . round($cost) . '</span>';
     exit;
 }
Esempio n. 2
0
 public function Lists()
 {
     if ($this->_GET) {
         $ProjectID = _intval($this->_GET['ProjectID']);
         $this->ProjectID = $ProjectID;
         $PropertyModule = new PropertyModule();
         $ProjectModule = new ProjectModule();
         //产品下属性列表
         if ($ProjectID == 1) {
             $ModelClass = new ModelClassModule();
             $ModelClassLists = $ModelClass->GetListsAll();
             $this->ModelClassLists = $ModelClassLists;
             $this->Data = array_merge($PropertyModule->GetAllModelLists(), $PropertyModule->GetAllModelLists('tb_model_packages'));
             $ProjectInfo = $ProjectModule->GetOneInfoByKeyID($ProjectID);
             $this->ProjectInfo = $ProjectInfo;
             $NO = $this->_GET['NO'];
             if ($NO) {
                 $Model = $PropertyModule->GetOneInfoByNO($NO);
                 if (!$Model) {
                     $Model = $PropertyModule->GetOneInfoByNO($NO, 'PackagesNum', 'tb_model_packages');
                 }
                 $this->Model = $Model;
             }
             if ($this->_GET['State']) {
                 $this->State = $this->_GET['State'];
             } else {
                 $this->State = 0;
             }
         } else {
             $MysqlWhere = ' where ProjectID=' . $ProjectID . ' and ProjectPropertyParentID=0';
             $Data = $PropertyModule->GetProjectPropertyLists($MysqlWhere, 0, 100);
             foreach ($Data as $Key => $Value) {
                 $MysqlWhereTwo = ' where ProjectPropertyParentID=' . $Value['ProjectPropertyID'];
                 $Data[$Key]['Two'] = $PropertyModule->GetProjectPropertyLists($MysqlWhereTwo, 0, 100);
             }
             $this->Data = $Data;
             //一级产品属性
             $ParentMysqlWhere = ' where ProjectID=' . $ProjectID . ' and ProjectPropertyParentID=0';
             $ParentData = $PropertyModule->GetProjectPropertyLists($ParentMysqlWhere, 0, 100);
             $this->ParentData = $ParentData;
             //产品信息
             $ProjectInfo = $ProjectModule->GetOneInfoByKeyID($ProjectID);
             $this->ProjectInfo = $ProjectInfo;
             //产品属性信息
             $ProjectPropertyID = _intval($this->_GET['ProjectPropertyID']);
             if ($ProjectPropertyID > 0) {
                 $ProjectPropertyInfo = $PropertyModule->GetOneInfoByKeyID($ProjectPropertyID);
                 $this->MyFuWuString = ',' . $ProjectPropertyInfo['MyFuWu'] . ',';
                 $this->OtherFuWuString = ',' . $ProjectPropertyInfo['OtherFuWu'] . ',';
                 $this->ProjectPropertyInfo = $ProjectPropertyInfo;
             }
             //服务
             $FuWuModule = new FuWuModule();
             $this->FuWuList = $FuWuModule->SelectLists();
         }
     }
 }