From af541bfaceb28be4a5fb3608f2ff264dc76f8fd5 Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Wed, 18 Dec 2019 13:51:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=BB=9F=E8=AE=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/FinanceController.class.php | 46 +++ .../Admin/View/Finance/payTypeStatistics.html | 346 ++++++++++++++++++ 2 files changed, 392 insertions(+) create mode 100644 Application/Admin/View/Finance/payTypeStatistics.html diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 5100aeab6..b2d8a3452 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -976,4 +976,50 @@ class FinanceController extends ThinkController $this->ajaxReturn($data,'json'); } + + /** + *充值方式统计 + */ + public function payTypeStatistics() + { + $cashStatistics = M('spend', 'tab_') + ->field('pay_way,SUM(pay_amount) AS pay_amount') + ->where(['pay_status' => 1]) + ->group('pay_way') + ->select(); + foreach ($cashStatistics as $key => $value) { + $cashStatistics[$key]['pay_type'] = getPayType($value['pay_way']); + $cashStatistics[$key]['balance'] = '0.00'; + } + $cashStatistics = array_column($cashStatistics, null, 'pay_way'); +// dd($cashStatistics); + $deposit = M('deposit', 'tab_')->where([ + 'deposit' => 2, + 'pay_status' => 1, + 'pay_way' => ['gt', 0], + ])->field('pay_way, SUM(pay_amount) AS balance') + ->group('pay_way') + ->select(); + foreach ($deposit as $key => $value) { + if (!array_key_exists($value['pay_way'], $cashStatistics)) { + $cashStatistics[$value['pay_way']] = $value; + $cashStatistics[$value['pay_way']]['pay_amount'] = '0.00'; + $cashStatistics[$value['pay_way']]['pay_type'] = getPayType($value['pay_way']); + } + $cashStatistics[$value['pay_way']]['balance'] = $value['balance']; + } + foreach ($cashStatistics as $key => $value) { + $cashStatistics[$key]['total'] = $value['pay_amount'] + $value['balance'];//添加列表合计 + } + //底部总计 + $all_pay_amount = array_sum(array_column($cashStatistics, 'pay_amount'));//现金充值总计 + $all_balance = array_sum(array_column($cashStatistics, 'balance'));//平台币充值总计 + $all_total = array_sum(array_column($cashStatistics, 'total'));//合计总计 + $this->assign('all_pay_amount', $all_pay_amount); + $this->assign('all_balance', $all_balance); + $this->assign('all_total', $all_total); + $this->assign('data', $cashStatistics); + $this->display(); + } + } \ No newline at end of file diff --git a/Application/Admin/View/Finance/payTypeStatistics.html b/Application/Admin/View/Finance/payTypeStatistics.html new file mode 100644 index 000000000..ac2e2d7d6 --- /dev/null +++ b/Application/Admin/View/Finance/payTypeStatistics.html @@ -0,0 +1,346 @@ + + + + + + + + + + + +
+ + +
+ +
+ + - +
+ + +
+
+ + +
+ 搜索 + + 导出 +
+ + + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
充值方式现金充值平台币充值合计
aOh! 暂时还没有内容!
{$data.pay_type}{$data.pay_amount}{$data.balance}0{$data.total}0
总计{$all_pay_amount}0{$all_balance}0{$all_total}0
+
+
+
+ + {$_page|default=''} +
+
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + +