diff --git a/frontend/controllers/FinanceController.php b/frontend/controllers/FinanceController.php index 95d9ce0..c47d899 100644 --- a/frontend/controllers/FinanceController.php +++ b/frontend/controllers/FinanceController.php @@ -6812,30 +6812,30 @@ class FinanceController extends \frontend\controllers\UserBaseController } $yuangong_money_all += $yuangong_money; } - - $yewu_ticheng_all = 0; - $total1_clear_all = 0; - $yeji_ticheng_all = 0; - $ticheng_money_all = 0; - $lipin_all = 0; - $liquan_all = 0; - $yuangong_money_all = 0; $query1 = clone $query; $sums = $query1->select([ 'sum_total1_clear' => 'sum(order_caiwi_t.total1_clear)', - 'sum_yewu_ticheng' => 'sum(order_caiwi_t.yewu_ticheng)', + 'sum_total2_clear' => 'sum(order_caiwi_t.total2_clear)', 'sum_yeji_ticheng' => 'sum(order_caiwi_t.yeji_ticheng)', 'sum_ticheng_money' => 'sum(order_caiwi_t.ticheng_money)', 'sum_yuangong_money' => 'sum(order_caiwi_t.yuangong_money)', + 'sum_yewu_ticheng' => 'sum(order_caiwi_t.yewu_ticheng)', ])->asArray()->one(); $query2 = clone $query; -// $gift_sums = $query2 -// ->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id") -// ->leftJoin(GiftT::tableName(), "gift_t.id=order_t.gift_id") -// ->groupBy('caiwu_t.id') -// ->select([ -// 'sum_no_free_gift' => 'sum(order_caiwi_t.total1_clear)', -// ])->asArray()->one(); + $gift_sum = $query2 + ->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id") + ->leftJoin(GiftT::tableName(), "gift_t.id=order_t.gift_id") + ->where('order_gift_t.gift_type=1 && order_gift_t.is_free=2') + ->select([ + 'sum_gift' => 'sum(gift_t.price)', + ])->one(); + $voucher_sum = $query2 + ->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id") + ->leftJoin(GiftT::tableName(), "gift_t.id=order_t.gift_id") + ->where('order_gift_t.gift_type=2 && order_gift_t.is_free=2') + ->select([ + 'sum_gift' => 'sum(gift_t.price)', + ])->one(); $total = $query->count(); $query=$query->offset($offset)->limit($limit); @@ -6881,14 +6881,14 @@ class FinanceController extends \frontend\controllers\UserBaseController $data['rows'][] = $row; } $data['rows'][] = array( - ['保费总额', number_format($sums['sum_total1'],2)], + ['保费总额', number_format($sums['sum_total1_clear'] + $sums['sum_total2_clear'],2)], ['商业净保总额', number_format($sums['sum_total1_clear'],2)], - ['基本提成合计', number_format($sums['sum_yuangong_money'],2)], - ['加点提成合计', number_format($sums['sum_non_total1_dis'],2)], - ['自费礼品合计', number_format($sums['sum_total1_dis'],2)], - ['自费礼券合计', number_format($sums['sum_yuangong_money'] + $sums['sum_total1_dis'],2)], - ['自费减免合计', number_format($sums['sum_yuangong_money'] + $sums['sum_total1_dis'],2)], - ['提成合计', number_format($sums['sum_yuangong_money'] + $sums['sum_total1_dis'],2)] + ['基本提成合计', number_format($sums['sum_yeji_ticheng'],2)], + ['加点提成合计', number_format($sums['sum_ticheng_money'],2)], + ['自费礼品合计', number_format($sums['$gift_sum'],2)], + ['自费礼券合计', number_format($sums['$voucher_sum'],2)], + ['自费减免合计', number_format($sums['sum_yuangong_money'],2)], + ['提成合计', number_format($sums['sum_yewu_ticheng'],2)] ); return $data; } diff --git a/frontend/views/finance/ticheng-jisuan.php b/frontend/views/finance/ticheng-jisuan.php index fb6762d..7c18356 100644 --- a/frontend/views/finance/ticheng-jisuan.php +++ b/frontend/views/finance/ticheng-jisuan.php @@ -209,6 +209,19 @@ use \common\libs\MyLib; o['offset'] = params['offset']; o['limit'] = params['limit']; return o; + }, + responseHandler: function (res) { + var totals = res.rows.pop(); + var html = ''; + $.each(totals,function (i,d) { + html += '
' + + ''+ d[0] +':' + + ''+ d[1] +'' + + '
' + }); + html += ''; + $('#listTable').append(html); + return res; } }); return false;