Your Name 2 lat temu
rodzic
commit
bcb485a1d6

+ 14 - 0
service/bill/database/cash.php

@@ -327,5 +327,19 @@ return array
             'type' => 'one',
             'col' => 'sum(cash) as total',
         ),
+        'getwsCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-cdate', '>='),
+                'end' => array('yes-cdate', '<='),
+                'status' => array('yes', 'in'),
+                'type' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(yue) as total',
+        ),
     ),
 );

+ 186 - 0
service/bill/database/cash_up_stat.php

@@ -0,0 +1,186 @@
+<?php
+
+$config = array
+(
+    # 表名
+    'name' => 'cash_up_stat',
+    # 显示给用户看的名称
+    'lang' => '财务应付报表',
+    'order' => -10,
+
+    # 数据结构 不同的字段放这里
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'list'        => true,
+        ),
+
+        'day'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '日期',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+            'search'    => 'day',
+            'search_button' => array
+            (
+                'sum' => 'cash,xc_cash,ws_cash,df_cash',
+                'option' => array(
+                    'day' => '按天',
+                    'week' => '按周',
+                    'month' => '按月',
+                ),
+                'group' => '',
+            ),
+            'order'     => 'desc',
+            'list'      => 'Dever::showDay("{day}")',
+        ),
+
+        'cash'        => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '应付金额',
+            'default'   => '0',
+            'desc'      => '应付金额',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+        ),
+
+        'xc_cash'        => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '现存余额',
+            'default'   => '0',
+            'desc'      => '现存余额',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+        ),
+
+        'ws_cash'        => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '未审核提现',
+            'default'   => '0',
+            'desc'      => '未审核提现',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+        ),
+
+        'df_cash'        => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '已审核待发放提现',
+            'default'   => '0',
+            'desc'      => '已审核待发放提现',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+        ),
+
+        // 'zt_cash'        => array
+        // (
+        //     'type'      => 'float-11,2',
+        //     'name'      => '直推佣金',
+        //     'default'   => '0',
+        //     'desc'      => '直推佣金',
+        //     'match'     => 'is_numeric',
+        //     'search'    => 'order',
+        //     'list'      => true,
+        // ),
+
+        // 'sc_cash'        => array
+        // (
+        //     'type'      => 'float-11,2',
+        //     'name'      => '市场培训费',
+        //     'default'   => '0',
+        //     'desc'      => '市场培训费',
+        //     'match'     => 'is_numeric',
+        //     'search'    => 'order',
+        //     'list'      => true,
+        // ),
+
+        // 'hd_cash'        => array
+        // (
+        //     'type'      => 'float-11,2',
+        //     'name'      => '活动佣金',
+        //     'default'   => '0',
+        //     'desc'      => '活动佣金',
+        //     'match'     => 'is_numeric',
+        //     'search'    => 'order',
+        //     'list'      => true,
+        // ),
+
+        // 'sd_cash'        => array
+        // (
+        //     'type'      => 'float-11,2',
+        //     'name'      => '市场培训费',
+        //     'default'   => '0',
+        //     'desc'      => '市场培训费',
+        //     'match'     => 'is_numeric',
+        //     'search'    => 'order',
+        //     'list'      => true,
+        // ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '数据状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '发布时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            //'search'  => 'date',
+            //'list'        => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        'insert' => false,
+        'edit' => false,
+        'delete' => false,
+        'num' => false,
+        'excel' => true,
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        'list' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start_day' => array('yes-day', '>='),
+                'end_day' => array('yes-day', '<='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('time' => 'desc', 'cdate' => 'desc'),
+            'page' => array(20, 'list'),
+            'group' => 'day',//cash,daili_cash,soft_cash,goods_cash,zt_cash,sc_cash
+            'col' => '*,min(day) as time, sum(cash) as cash, sum(xc_cash) as xc_cash, sum(ws_cash) as ws_cash, sum(df_cash) as df_cash',
+        ),
+    ),
+);
+
+return $config;

+ 54 - 1
service/bill/database/tixian.php

@@ -2,7 +2,8 @@
 
 $status = array
 (
-    1 => '待发放',
+    -1 => '未审核待发放',
+    1 => '已审核待发放',
     2 => '已发放',
 );
 
@@ -345,5 +346,57 @@ return array
             'type' => 'one',
             'col' => '*',
         ),
+        'gettxCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-cdate', '>='),
+                'end' => array('yes-cdate', '<='),
+                'status' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(cash) as total',
+        ),
+        'getdfCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-cdate', '>='),
+                'end' => array('yes-cdate', '<='),
+                'status' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(cash) as total',
+        ),
+         'getwsCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-cdate', '>='),
+                'end' => array('yes-cdate', '<='),
+                'bill-cash-status' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'mid as mid',
+        ),
+        'upStatus' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'status' =>'yes',
+                'bill-cash-status'=>'yes',
+            ),
+        ),
     ),
 );

+ 6 - 1
service/bill/lib/Cash.php

@@ -222,7 +222,12 @@ class Cash
                 
             }
         }
-
+         $button[] = array
+        (
+            'type' => 'link',
+            'link' => Dever::url('project/database/list?project=bill&table=cash&menu=bill&search_option_state=1', 'manage'),
+            'name' => '返回上一页',
+        );
         $head = array
         (
             'name' => '基本信息',

+ 55 - 0
service/bill/lib/Cron.php

@@ -356,4 +356,59 @@ class Cron
             }
         }
     }
+    #财务应付报表:
+    #应付金额 = 现存余额 + 未审核提现 + 已审核待发放提现
+     public function cash_up_api()
+    {
+        $num = Dever::input('num', 1);
+        $start = Dever::input('start', date('Y-m-d', strtotime('-'.$num.' day')));
+        $end = Dever::input('end', date('Y-m-d'));
+
+        $start = Dever::maketime($start . ' 00:00:00');
+        $end = Dever::maketime($end . ' 23:59:59');
+        $day = intval(($end - $start)/86400);
+        
+        for($i=0; $i<=$day; $i++) {
+            $where = array();
+            $where['start'] = $start + 86400*$i;
+            $where['end'] = $start + 86400*$i + 86399;
+            $data = array();
+            $data['day'] = $where['start'];
+            $info = Dever::db('bill/cash_up_stat')->find($data);
+            /*
+             现存余额=tixian.php下的cash
+             未审核提现=cash下的status=1,type=11
+             已审核待发放提现=tixian.php下的status=1,cash
+             */
+            #现存余额
+            $data['xc_cash']=0;
+            $cash=Dever::db('bill/tixian')->gettxCash($where);
+            if($cash){
+                $data['xc_cash']=$cash['total'];
+            }
+            #未审核提现
+            $where['bill-cash-status']=1;
+            $data['ws_cash']=0;
+            $tixian=Dever::db('bill/tixian')->getwsCash($where);
+            if($tixian){
+                $where['status']=1;
+                $where['type']=11;
+                $where['mid']=$tixian['mid'];
+                $cash=Dever::db('bill/cash')->getwsCash($where);
+                $data['ws_cash']=$cash['total'];
+            }
+            #已审核待发放提现
+            $data['df_cash']=0;
+            $where['status']=1;
+            $cash=Dever::db('bill/tixian')->getdfCash($where);
+            $data['cash'] = $data['xc_cash'] + $data['ws_cash'] + $data['df_cash'];
+
+            if (!$info) {
+                Dever::db('bill/cash_up_stat')->insert($data);
+            } else {
+                $data['where_id'] = $info['id'];
+                Dever::db('bill/cash_up_stat')->update($data);
+            }
+        }
+    }
 }

+ 9 - 1
service/bill/lib/Manage.php

@@ -31,6 +31,7 @@ class Manage
     	Dever::config('base')->hook = true;
         $audit = Dever::param('audit', $data);
         if ($audit > 1) {
+            #已审核
         	if ($audit == 2) {
 	        	Dever::db('bill/cash')->update(array('where_id' => $id, 'status' => 2, 'operdate' => time()));
 	        	$info = Dever::db('bill/cash')->find($id);
@@ -38,8 +39,15 @@ class Manage
 	        		$where['where_id'] = $info['mid'];
 	        		$where['cash'] = $info['cash'];
 	        		Dever::db('agent/member')->upCash($where);
-	        	}
+	        	}elseif ($info && $info['type'] == 11) {
+                    $tixian = Dever::db('bill/tixian')->find($info['type_id']);
+                    $where['where_id'] = $tixian['id'];
+                    $where['status'] = 1;
+                    $where['bill-cash-status'] =2;
+                    Dever::db('bil/tixian')->upStatus($where);
+                }
 	        } else {
+                #作废
 	        	Dever::db('bill/cash')->update(array('where_id' => $id, 'status' => 3, 'operdate' => time()));
 	        	$info = Dever::db('bill/cash')->find($id);
 	        	if ($info && $info['type'] == 11) {

+ 1 - 1
service/bill/lib/Tixian.php

@@ -22,7 +22,7 @@ class Tixian
     		$data['bankname'] = $bankname;
     		$data['card'] = $card;
             $data['sign'] = $sign;
-            $data['status'] = 1;
+            $data['status'] = -1;
     		return Dever::db('bill/tixian')->insert($data);
         }