rabin hace 3 años
padre
commit
34d408d600

+ 1 - 1
service/option/database/bill_duifu.php

@@ -148,7 +148,7 @@ return array
             'desc'      => '兑付价值',
             'match'     => 'is_numeric',
             //'update'    => 'text',
-            'list'      => '"-{cash}"',
+            'list'      => '"{cash}"',
             'list_order' => 5,
         ),
 

+ 26 - 1
service/option/database/cash.php

@@ -126,6 +126,17 @@ return array
             'list'      => true,
         ),
 
+        'zuofei'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '作废额度',
+            'default'   => '0.00',
+            'desc'      => '作废额度',
+            'match'     => 'is_numeric',
+            //'update'    => 'text',
+            'list'      => true,
+        ),
+
         'fafang'      => array
         (
             'type'      => 'decimal-11,2',
@@ -205,7 +216,7 @@ return array
             ),
             'group' => 'type',
             'order' => array('daijiaofu_date' => 'desc', 'id' => 'desc'),
-            'col' => '*,sum(daijiaofu) as daijiaofu, sum(jiaofu) as jiaofu, sum(fafang) as fafang, sum(duifu) as duifu|type',
+            'col' => '*,sum(daijiaofu) as daijiaofu, sum(jiaofu) as jiaofu, sum(fafang) as fafang, sum(duifu) as duifu, sum(zuofei) as zuofei|type',
         ),
 
         'upCash_daijiaofu' => array
@@ -249,6 +260,20 @@ return array
             ),
         ),
 
+        'upCash_zuofei' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'cash' => array('yes-zuofei', '+='),
+                'jiaofu' => array('yes', '-='),
+            ),
+        ),
+
         'upCash_duifu' => array
         (
             'type' => 'update',

+ 3 - 0
service/option/database/member.php

@@ -27,8 +27,11 @@ if ($search_auth <= 2) {
     (
         //'list' => array('查看详情', '"cash&mid={id}&page_type=1&search_audit=-1"'),
         'fast_add' => array('期权价值交付', 'push_cash&search_option_aid={aid}&search_option_mid={id}&search_option_company_id={company_id}&type=1'),
+        'fast_add2' => array('期权价值作废', 'push_cash&search_option_aid={aid}&search_option_mid={id}&search_option_company_id={company_id}&type=10'),
         'fast_add1' => array('期权价值发放', 'push_cash&search_option_aid={aid}&search_option_mid={id}&search_option_company_id={company_id}&type=2'),
+        'br3' => array('<br />'),
         'list1' => array('交付记录', '"bill_jiaofu&search_option_main=2&search_option_aid={aid}&search_option_mid={id}&top_table=account"'),
+        'list4' => array('作废记录', '"bill_zuofei&search_option_main=2&search_option_aid={aid}&search_option_mid={id}&top_table=account"'),
         'list2' => array('发放记录', '"bill_fafang&search_option_main=2&search_option_aid={aid}&search_option_mid={id}&top_table=account"'),
         'list3' => array('兑付记录', '"bill_duifu&search_option_main=2&search_option_aid={aid}&search_option_mid={id}&top_table=account"'),
     );

+ 6 - 1
service/option/database/push_cash.php

@@ -10,12 +10,17 @@ if ($option_type == 1) {
         return Dever::load('option/lib/manage')->getQiquan($company_id, '交付');
     };
     $stype = 'jiaofu';
+} elseif ($option_type == 10) {
+    $type = function() use($company_id) {
+        return Dever::load('option/lib/manage')->getQiquan($company_id, '作废');
+    };
+    $stype = 'zuofei';
 } else {
     $type = function() use($company_id) {
         return Dever::load('option/lib/manage')->getQiquan($company_id, '发放');
     };
     $stype = 'fafang';
-}
+} 
 
 $status = array
 (

+ 14 - 6
service/option/lib/Account.php

@@ -216,7 +216,7 @@ class Account
 
             if ($cash) {
                 $table = array();
-                $table['head'] = array('账户类型', '待交付', '已交付总额', '已发放', '未发放', '已兑付');
+                $table['head'] = array('账户类型', '待交付', '未发放', '已作废', '已发放', '已兑付');
                 $table['body'] = array();
 
                 foreach ($cash as $k => $v) {
@@ -226,10 +226,11 @@ class Account
                     (
                         $cash_type[$v['type']]['name'],
                         $v['daijiaofu'],
-                        $total,
-                        //$v['jiaofu'],
-                        $v['fafang'],
+                        //$total,
                         $v['jiaofu'],
+                        $v['zuofei'],
+                        $v['fafang'],
+                        //$v['jiaofu'],
                         $v['duifu'],
                     );
                 }
@@ -320,6 +321,13 @@ class Account
             'name' => '期权交付记录',
         );
 
+        $button[1]['btn'][] = array
+        (
+            'type' => 'link',
+            'link' => Dever::url('project/database/list?project=option&table=bill_zuofei&search_option_aid='.$option_aid.'', 'manage'),
+            'name' => '期权作废记录',
+        );
+
         $button[1]['btn'][] = array
         (
             'type' => 'link',
@@ -468,7 +476,7 @@ class Account
     public function getCashInfo($id, $mid)
     {
         $table = array();
-        $table['head'] = array('账户类型', '待交付', '未发放', '已发放', '已兑付');
+        $table['head'] = array('账户类型', '待交付', '未发放', '已作废', '已发放', '已兑付');
         $table['body'] = array();
 
         $member = Dever::db('option/member')->find($mid);
@@ -483,7 +491,7 @@ class Account
                         $data = $cash[$v['id']];
                         $table['body'][$k] = array
                         (
-                            $v['name'], $data['daijiaofu'], $data['jiaofu'], $data['fafang'], $data['duifu']
+                            $v['name'], $data['daijiaofu'], $data['jiaofu'], $data['zuofei'], $data['fafang'], $data['duifu']
                         );
                     }
                 }

+ 26 - 1
service/option/lib/Cash.php

@@ -13,7 +13,11 @@ class Cash
         $prefix = ucwords(substr($table, 0, 1));
         if ($stype == 'duifu') {
             $table = 'duifu';
-            $cash = -1*$cash;
+            //$cash = -1*$cash;
+        }
+        if ($stype == 'zuofei') {
+            $table = 'zuofei';
+            //$cash = -1*$cash;
         }
 
         return array($table, $cash, $cash_type, $prefix);
@@ -79,6 +83,17 @@ class Cash
                             $data['status'] = 2;
                         }
                     }
+                } elseif ($table == 'zuofei') {
+                    $data['yue'] = $cash_info[$col] + $cash;
+                    $data['status'] = 1;
+                    if ($cash_info['jiaofu'] < $cash) {
+                        if ($alert) {
+                            Dever::alert('交付期权价值不足作废');
+                        } else {
+                            return false;
+                            $data['status'] = 2;
+                        }
+                    }
                 } else {
                     $col = 'dai' . $table;
                     $data['status'] = 2;
@@ -87,6 +102,11 @@ class Cash
                 $data['cash'] = $cash;
                 $data['desc'] = $desc;
                 $data['clear'] = true;
+                $admin = Dever::load('manage/auth.info');
+                if ($admin && $admin['id']) {
+                    $data['audit_admin'] = $admin['id'];
+                }
+                
                 $state = Dever::db('option/bill_' . $table)->insert($data);
 
                 if ($state && $cash_info) {
@@ -106,6 +126,11 @@ class Cash
                         if ($data['status'] == 2) {
                             $update['fafang'] = 0;
                         }
+                    } elseif ($table == 'zuofei') {
+                        $update['jiaofu'] = $cash;
+                        if ($data['status'] == 2) {
+                            $update['jiaofu'] = 0;
+                        }
                     } else {
                         $update['daijiaofu_date'] = time();
                     }