车险提成统计

dev
zhaocheng 5 years ago
parent c405c40505
commit 218364f3e2
  1. 46
      frontend/controllers/FinanceController.php
  2. 13
      frontend/views/finance/ticheng-jisuan.php

@ -6812,30 +6812,30 @@ class FinanceController extends \frontend\controllers\UserBaseController
} }
$yuangong_money_all += $yuangong_money; $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; $query1 = clone $query;
$sums = $query1->select([ $sums = $query1->select([
'sum_total1_clear' => 'sum(order_caiwi_t.total1_clear)', '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_yeji_ticheng' => 'sum(order_caiwi_t.yeji_ticheng)',
'sum_ticheng_money' => 'sum(order_caiwi_t.ticheng_money)', 'sum_ticheng_money' => 'sum(order_caiwi_t.ticheng_money)',
'sum_yuangong_money' => 'sum(order_caiwi_t.yuangong_money)', 'sum_yuangong_money' => 'sum(order_caiwi_t.yuangong_money)',
'sum_yewu_ticheng' => 'sum(order_caiwi_t.yewu_ticheng)',
])->asArray()->one(); ])->asArray()->one();
$query2 = clone $query; $query2 = clone $query;
// $gift_sums = $query2 $gift_sum = $query2
// ->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id") ->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id")
// ->leftJoin(GiftT::tableName(), "gift_t.id=order_t.gift_id") ->leftJoin(GiftT::tableName(), "gift_t.id=order_t.gift_id")
// ->groupBy('caiwu_t.id') ->where('order_gift_t.gift_type=1 && order_gift_t.is_free=2')
// ->select([ ->select([
// 'sum_no_free_gift' => 'sum(order_caiwi_t.total1_clear)', 'sum_gift' => 'sum(gift_t.price)',
// ])->asArray()->one(); ])->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(); $total = $query->count();
$query=$query->offset($offset)->limit($limit); $query=$query->offset($offset)->limit($limit);
@ -6881,14 +6881,14 @@ class FinanceController extends \frontend\controllers\UserBaseController
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$data['rows'][] = array( $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_total1_clear'],2)],
['基本提成合计', number_format($sums['sum_yuangong_money'],2)], ['基本提成合计', number_format($sums['sum_yeji_ticheng'],2)],
['加点提成合计', number_format($sums['sum_non_total1_dis'],2)], ['加点提成合计', number_format($sums['sum_ticheng_money'],2)],
['自费礼品合计', number_format($sums['sum_total1_dis'],2)], ['自费礼品合计', number_format($sums['$gift_sum'],2)],
['自费礼券合计', number_format($sums['sum_yuangong_money'] + $sums['sum_total1_dis'],2)], ['自费礼券合计', number_format($sums['$voucher_sum'],2)],
['自费减免合计', number_format($sums['sum_yuangong_money'] + $sums['sum_total1_dis'],2)], ['自费减免合计', number_format($sums['sum_yuangong_money'],2)],
['提成合计', number_format($sums['sum_yuangong_money'] + $sums['sum_total1_dis'],2)] ['提成合计', number_format($sums['sum_yewu_ticheng'],2)]
); );
return $data; return $data;
} }

@ -209,6 +209,19 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="18" class="text-center">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

Loading…
Cancel
Save