Your Name 2 년 전
부모
커밋
e979801b74

+ 56 - 0
service/agent/database/member_agreement.php

@@ -448,5 +448,61 @@ return array
             'page' => array(10, 'list'),
             'col' => 'id,mid,agreement_id,status,qdate,role,name,area,agreement_name',
         ),
+        'getNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-qdate', '>='),
+                'fend' => array('yes-qdate', '<='),
+                'agreement_id' => 6,
+                'status' => array('yes','='),
+                'state' => 1,
+            ),
+            'type' => 'count',
+            'col' => '*',
+        ),
+        'getNoNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-cdate', '>='),
+                'fend' => array('yes-cdate', '<='),
+                'status' => array('yes','!='),
+                'agreement_id' => 6,
+                'state' => 1,
+            ),
+            'type' => 'count',
+            'col' => '*',
+        ),
+        'getPrice' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-qdate', '>='),
+                'fend' => array('yes-qdate', '<='),
+                'status' => array('yes', '='),
+                'agreement_id' => 6,
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(price) as total',
+        ),
+        'getNoPrice' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-qdate', '>='),
+                'fend' => array('yes-qdate', '<='),
+                'status' => array('yes', '!='),
+                'agreement_id' => 6,
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(price) as total',
+        ),
     ),
 );

+ 41 - 0
service/agent/database/order.php

@@ -885,7 +885,48 @@ return array
             'type' => 'one',
             'col' => 'sum(soft_cash) as total',
         ),
+        'getSoftNoCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-cdate', '>='),
+                'fend' => array('yes-cdate', '<='),
+                'status' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(soft_cash) as total',
+        ),
 
+        'getSoftNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-fdate', '>='),
+                'fend' => array('yes-fdate', '<='),
+                'soft_cash' => array('yes', '>='),
+                'status' => array('yes','in'),
+                'state' => 1,
+            ),
+            'type' => 'count',
+            'col' => '*',
+        ),
+        'getSoftNoNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-cdate', '>='),
+                'fend' => array('yes-cdate', '<='),
+                'soft_cash' => array('yes', '>='),
+                'status' => array('yes','!='),
+                'state' => 1,
+            ),
+            'type' => 'count',
+            'col' => '*',
+        ),
         'getGoodsCash' => array
         (
             # 匹配的正则或函数 选填项

+ 55 - 0
service/agent/database/soft_cash.php

@@ -369,6 +369,61 @@ return array
             'col' => 'sum(price) as total',
         ),
 
+        'getSoftCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-zdate', '>='),
+                'fend' => array('yes-zdate', '<='),
+                'status' => array('yes', 'in'),
+                'role' =>'yes',
+                'mid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(cash) as total',
+        ),
+        'getSoftNoCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-zdate', '>='),
+                'fend' => array('yes-zdate', '<='),
+                'status' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(cash) as total',
+        ),
+        'getSoftNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-zdate', '>='),
+                'fend' => array('yes-zdate', '<='),
+                'status' => array('yes','in'),
+                'state' => 1,
+            ),
+            'type' => 'count',
+            'col' => '*',
+        ),
+        'getSoftNoNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-cdate', '>='),
+                'fend' => array('yes-cdate', '<='),
+                'status' => array('yes','!='),
+                'state' => 1,
+            ),
+            'type' => 'count',
+            'col' => '*',
+        ),
+
         'getExcelAll' => array
         (
             # 匹配的正则或函数 选填项

+ 2 - 0
service/mail/assets/pc/html/option_grant.html

@@ -53,6 +53,7 @@ td {
               </tr>
           </thead>
             <tbody>
+            <{if(isset($data)):}>
               <{foreach($data as $k => $v):}>
                 <tr>
                   <td><{$v['name']}></td>
@@ -64,6 +65,7 @@ td {
                   <td><{$v['ck_num']}></td>
                 </tr>
                   <{endforeach}>
+                  <{endif}>
           </tbody> 
       </table>
 	</div>

+ 2 - 0
service/mail/assets/pc/html/option_nopay.html

@@ -53,6 +53,7 @@ td {
               </tr>
           </thead>
             <tbody>
+            <{if(isset($data)):}>
               <{foreach($data as $k => $v):}>
                 <tr>
                   <td><{$v['name']}></td>
@@ -64,6 +65,7 @@ td {
                   <td><{$v['option_price']}></td>
                 </tr>
                   <{endforeach}>
+                  <{endif}>
           </tbody> 
       </table>
 	</div>

+ 2 - 1
service/mail/assets/pc/html/qiquan.html

@@ -20,7 +20,8 @@
 {
   width:100px;
 }
-h5 {
+h3 {
+  margin-top: 10px;
     margin-bottom: 10px;
 }
 th {

+ 110 - 0
service/mail/assets/pc/html/soft_cash.html

@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>软件服务费统计</title>
+<meta name="renderer" content="webkit">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<meta name="apple-mobile-web-app-status-bar-style" content="black"> 
+<meta name="apple-mobile-web-app-capable" content="yes">
+<meta name="format-detection" content="telephone=no">
+<link rel="stylesheet" type="text/css" href="../script/lib/layui/css/layui.css" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script src="../script/lib/echarts/echarts.common.min.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+<style>
+.dever-upload-pic
+{
+  width:100px;
+}
+h5 {
+    margin-bottom: 10px;
+}
+td {
+  color: black;
+}
+</style>
+
+</head>
+<body>
+<div class="layui-container">
+<div class="layui-card">
+     <blockquote class="layui-elem-quote"><input type="text" value="<{$start}> ~ <{$end}>" autocomplete="off" id="date" class="layui-input" style="width: auto;display: inline;" placeholder="选择日期"><a href="javascript:;" class="layui-btn" id="search">搜索</a></blockquote>
+
+  <!-- <div class="layui-card-header" style="font-size: 20px"><{$day['time']}></div> -->
+  
+  <div class="layui-card-body">
+     
+     
+     
+    <table class="table layui-table layui-table-body" id="table">
+          <thead id="list-thead">
+              <tr>
+                <th data-priority="1">状态</th>
+                <th data-priority="1">已确认数量</th>
+                <th data-priority="1">未确认数量</th>
+                <th data-priority="1">数量总计</th>
+                <th data-priority="1">已确认软件服务费</th>
+                <th data-priority="1">未确认软件服务费</th>
+                <th data-priority="1">软件服务费总计</th>
+              </tr>
+          </thead>
+            <tbody>
+                <tr>
+                  <td>签署合同</td>
+                  <td><{$a_num}></td>
+                  <td><{$a_nonum}></td>
+                  <td><{$a_totalnum}></td>
+                  <td><{$a_price}></td>
+                  <td><{$a_noprice}></td>
+                  <td><{$total_price}></td>
+                </tr>
+                <tr>
+                  <td>软件服务费</td>
+                  <td><{$num}></td>
+                  <td><{$no_num}></td>
+                  <td><{$total_num}></td>
+                  <td><{$money}></td>
+                  <td><{$no_money}></td>
+                  <td><{$total_money}></td>
+                </tr>
+          </tbody> 
+      </table>
+	</div>
+	</div>
+</div>
+</div>
+      
+
+</div>
+<script>
+layui.use(['form','element', 'layer', 'jquery', 'laydate'], function(){
+  var form = layui.form;
+  var laydate = layui.laydate;
+  laydate.render({
+    elem: '#date',
+    range: '~'
+  });
+});
+
+function search()
+{
+  var date = $('#date').val();
+  if (date) {
+    var s = date.split(' ~ ');
+  } else {
+    var s = [];
+    s[0] = '';
+    s[1] = '';
+  }
+  location.href = config.host + 'lib/manage.soft_cash&start=' + s[0] + '&end=' + s[1];
+}
+$('#search').click(function() {
+  search();
+})
+</script>
+</body>
+</html>

+ 92 - 52
service/mail/lib/Manage.php

@@ -377,20 +377,27 @@ class Manage
         $rest = array();
         $rest['start'] = date('Y-m-d',$start);
         $rest['end'] = date('Y-m-d',$end);
+        $rest['data'] = array();
         $data = Dever::db('agent/order')->getAll($where);
-        foreach($data as $k => $v){
-            #单独购买的软件服务费
-            $cash = Dever::db('agent/soft_cash')->getTotal(array('fstart'=>$start,'fend'=>$end,'mid'=>$v['mid']));
-             $data[$k]['buy_cash'] = $cash['total'];
-             $option = Dever::db('agent/soft_cash')->getPrice(array('fstart'=>$start,'fend'=>$end,'mid'=>$v['mid']));
-             $data[$k]['y_price'] = $option['total'];
-        }
-        $rest['data'] = $data;
-        if($type == 1){
-            return $rest['data'];
+        if($data){
+            foreach($data as $k => $v){
+                #单独购买的软件服务费
+                $cash = Dever::db('agent/soft_cash')->getTotal(array('fstart'=>$start,'fend'=>$end,'mid'=>$v['mid']));
+                 $data[$k]['buy_cash'] = $cash['total'];
+                 $option = Dever::db('agent/soft_cash')->getPrice(array('fstart'=>$start,'fend'=>$end,'mid'=>$v['mid']));
+                 $data[$k]['y_price'] = $option['total'];
+            }
+            $rest['data'] = $data;
+            if($type == 1){
+                return $rest['data'];
+            }else{
+                return Dever::render('option_nopay', $rest);
+            }
         }else{
             return Dever::render('option_nopay', $rest);
         }
+        
+        
     }
     #代理商期权待交付导出
     public function out_option_nopay_api(){
@@ -487,47 +494,80 @@ class Manage
             Dever::excelExport($body, $header, $file);
         }
     }
-    // #城市数据统计
-    // public function city_api(){
-    //     // $provice = Dever::input('provice');
-    //     // $city = Dever::input('city');
-    //     $area = Dever::input('area');
-    //     $role = Dever::input('role');
-    //     $start = Dever::input('start');
-    //     $end = Dever::input('end');
-    //     $where = array();
-    //     // if($provice){
-    //     //     $where['provice'] = $provice;
-    //     // }
-    //     // if($city){
-    //     //     $where['city'] = $city;
-    //     // }
-    //      if($area){
-    //         $where['area'] = $area;
-    //     }
-    //     if($role){
-    //         $where['role'] = $role;
-    //     }
+    #软件服务费数据统计
+    public function soft_cash_api(){
+        $start = Dever::input('start');
+        $end = Dever::input('end');
+        $where = array();
+        if($start && $end){
+            $where['fstart'] = strtotime($start);
+            $where['fend'] = strtotime($end);
+        }else{
+            $where['fstart']=Dever::maketime(date('Y-m-01') . ' 00:00:00');
+            $where['fend'] = strtotime(date('Y-m-d 23:59:59',
+                strtotime(date('Y-m-01')."+1 month - 1 day")));
+        }
+        $where['state'] = 1;
+        $data = array();
+        $data['start'] = date('Y-m-d',$where['fstart']);
+        $data['end'] = date('Y-m-d',$where['fend']);
+        #软件服务费的已确认数量
+        $where['soft_cash']=1;
+        $where['status'] = 4;
+        $order = Dever::db('agent/order')->getSoftNum($where);
+        $where['status'] = 3;
+        $soft_cash = Dever::db('agent/soft_cash')->getSoftNum($where);
+        $data['num'] = $order + $soft_cash;
+        #软件服务费未确认的数量
+        $where['status'] = 4;
+        $order = Dever::db('agent/order')->getSoftNoNum($where);
+        $where['status'] = 3;
+        $soft_cash = Dever::db('agent/soft_cash')->getSoftNoNum($where);
+        $data['no_num'] = $order + $soft_cash;
+        #总数量
+        $data['total_num'] = $data['num'] + $data['no_num'];
+        
+        #已确认软件服务费
+        $where['status'] = 4;
+        $order = Dever::db('agent/order')->getSoftCash($where);
+        $where['status'] = 3;
+        $soft_cash = Dever::db('agent/soft_cash')->getSoftCash($where);
+        $data['money'] = $order['total'] + $soft_cash['total'];
+        #未确认软件服务费
+        $where['status'] = 4;
+        $order = Dever::db('agent/order')->getSoftNoCash($where);
+        $where['status'] = 3;
+        $soft_cash = Dever::db('agent/soft_cash')->getSoftNoCash($where);
+        $data['no_money'] = $order['total'] + $soft_cash['total'];
+        #总钱数
+        $data['total_money'] = $data['money'] + $data['no_money'];
+        #合同已确认数量:
+        $where['status'] = 2;
+        $data['a_num'] = Dever::db('agent/member_agreement')->getNum($where);
+        #合同未确认数量:
+        $where['status'] = 2;
+        $data['a_nonum'] = Dever::db('agent/member_agreement')->getNoNum($where);
+        $data['a_totalnum'] = $data['a_num'] + $data['a_nonum'];
+        #合同已确认软件服务费
+        $where['status'] = 2;
+        $price = Dever::db('agent/member_agreement')->getPrice($where);
+        if($price['total']){
+            $data['a_price'] = $price['total'];
+        }else{
+            $data['a_price'] = 0;
+        }
         
-    //     if($start && $end){
-    //         $where['start'] = strtotime($start);
-    //         $where['end'] = strtotime($end);
-    //     }else{
-    //         $where['start']=Dever::maketime(date('Y-m-01') . ' 00:00:00');
-    //         $where['end'] = strtotime(date('Y-m-d 23:59:59',
-    //             strtotime(date('Y-m-01')."+1 month - 1 day")));
-    //     }
-    //     $data = Dever::db('agent/order')->getAll($where);
-    //     $rest = array();
-    //     foreach($data as $k => $v){
-    //         $data[$k]['area_name'] = Dever::load("area/api.string", $v['area']);
-    //         $role = Dever::db('setting/role')->find($v['role']);
-    //         $data[$k]['role_name'] = $role['name'];
-    //     }
-    //     $rest['role'] = Dever::db('setting/role')->find();
-    //     $rest['start'] = date('Y-m-d',$where['start']);
-    //     $rest['end'] = date('Y-m-d',$where['end']); 
-    //     $rest['data'] = $data;
-    //     return Dever::render('city', $rest);
-    // }
+        #合同未确认软件服务费
+        $where['status'] = 2;
+        $noprice = Dever::db('agent/member_agreement')->getNoPrice($where);
+        if($noprice['total']){
+            $data['a_noprice'] = $noprice['total'];
+        }else{
+            $data['a_noprice'] = 0;
+        }
+        
+        #总钱数
+        $data['total_price'] = $data['a_price'] + $data['a_noprice'];
+        return Dever::render('soft_cash', $data);
+    }
 }