|
|
|
@ -5154,12 +5154,20 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
|
$row['is_leave'] = $item->is_leave ? '已离职':''; |
|
|
|
|
$pay_info = $item->getPay($pay_date); |
|
|
|
|
$row['status_name'] = $pay_info ? $pay_info->getStatus($pay_info->status_id) : ''; |
|
|
|
|
$row['real_pay'] = $pay_info->base_real_pay; |
|
|
|
|
$row['should_pay'] = $pay_info->ticheng_real_pay; |
|
|
|
|
$row['is_show'] = ($pay_info->renshi_status_id > 0 && $pay_info->chuna_status_id > 0 && $pay_info->status_id != 7 && $pay_info->status_id != 8) ? 1 : 0; |
|
|
|
|
$row['real_pay'] = $pay_info ? $pay_info->base_real_pay : ''; |
|
|
|
|
$row['should_pay'] = $pay_info ? $pay_info->ticheng_real_pay : ''; |
|
|
|
|
$row['is_show'] = $pay_info && ($pay_info->renshi_status_id > 0 && $pay_info->chuna_status_id > 0 && $pay_info->status_id != 7 && $pay_info->status_id != 8) ? 1 : 0; |
|
|
|
|
$data['rows'][] = $row; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$pay_chexian = PayT::find() |
|
|
|
|
->where("pay_date='{$pay_date}'") |
|
|
|
|
->sum('ticheng_real_pay'); |
|
|
|
|
|
|
|
|
|
$data['rows'][] = array( |
|
|
|
|
['提成工资总额', number_format($pay_chexian,2)], |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -6789,53 +6797,33 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
|
if($insurer_type ==1){ |
|
|
|
|
$query->andWhere('caiwu_t.insurer_type=1'); |
|
|
|
|
} |
|
|
|
|
$items = $query->all(); |
|
|
|
|
$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; |
|
|
|
|
foreach($items as $index => $item) { |
|
|
|
|
$order_caiwu_info = $item->orderCaiwu; |
|
|
|
|
$order_info = $item->order; |
|
|
|
|
$total1_clear_all += $item->total_clear; |
|
|
|
|
$yewu_ticheng_all += $order_caiwu_info ? $order_caiwu_info->yewu_ticheng : 0; |
|
|
|
|
$yeji_ticheng_all += $order_caiwu_info ? $order_caiwu_info->yeji_ticheng : 0; |
|
|
|
|
$ticheng_money_all += $order_info ? $order_info->ticheng_money : 0; |
|
|
|
|
$lipin_all += $order_info ? $order_info->getGiftPrice(1,1) : 0; |
|
|
|
|
$liquan_all += $order_info ? $order_info->getGiftPrice(1,2) : 0; |
|
|
|
|
$yuangong_money = 0; |
|
|
|
|
if($order_info){ |
|
|
|
|
$yuangong_money = $order_info->yuangong_money>0?$order_info->yuangong_money:0; |
|
|
|
|
} |
|
|
|
|
$yuangong_money_all += $yuangong_money; |
|
|
|
|
} |
|
|
|
|
$query1 = clone $query; |
|
|
|
|
$sums = $query1->select([ |
|
|
|
|
'sum_total1_clear' => 'sum(order_caiwi_t.total1_clear)', |
|
|
|
|
'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(); |
|
|
|
|
$sums = $query1 |
|
|
|
|
->leftJoin(OrderCaiwuT::tableName(), "order_t.id=order_caiwu_t.order_id") |
|
|
|
|
->select([ |
|
|
|
|
'sum_total1_clear' => 'sum(order_t.total1_clear)', |
|
|
|
|
'sum_total2_clear' => 'sum(order_t.total2_clear)', |
|
|
|
|
'sum_yeji_ticheng' => 'sum(order_caiwu_t.yeji_ticheng)', |
|
|
|
|
'sum_ticheng_money' => 'sum(order_caiwu_t.ticheng_money)', |
|
|
|
|
'sum_yuangong_money' => 'sum(order_caiwu_t.yuangong_money)', |
|
|
|
|
'sum_yewu_ticheng' => 'sum(order_caiwu_t.yewu_ticheng)', |
|
|
|
|
])->asArray()->one(); |
|
|
|
|
$query2 = clone $query; |
|
|
|
|
$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") |
|
|
|
|
->leftJoin(GiftT::tableName(), "gift_t.id=order_gift_t.gift_id") |
|
|
|
|
->where('order_gift_t.gift_type=1 && order_gift_t.is_free=2') |
|
|
|
|
->select([ |
|
|
|
|
'sum_gift' => 'sum(gift_t.price)', |
|
|
|
|
])->one(); |
|
|
|
|
])->asArray()->one(); |
|
|
|
|
$query2 = clone $query; |
|
|
|
|
$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") |
|
|
|
|
->leftJoin(GiftT::tableName(), "gift_t.id=order_gift_t.gift_id") |
|
|
|
|
->where('order_gift_t.gift_type=2 && order_gift_t.is_free=2') |
|
|
|
|
->select([ |
|
|
|
|
'sum_gift' => 'sum(gift_t.price)', |
|
|
|
|
])->one(); |
|
|
|
|
])->asArray()->one(); |
|
|
|
|
|
|
|
|
|
$total = $query->count(); |
|
|
|
|
$query=$query->offset($offset)->limit($limit); |
|
|
|
@ -6885,8 +6873,8 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
|
['商业净保总额', number_format($sums['sum_total1_clear'],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($gift_sum['sum_gift'],2)], |
|
|
|
|
['自费礼券合计', number_format($voucher_sum['sum_gift'],2)], |
|
|
|
|
['自费减免合计', number_format($sums['sum_yuangong_money'],2)], |
|
|
|
|
['提成合计', number_format($sums['sum_yewu_ticheng'],2)] |
|
|
|
|
); |
|
|
|
@ -7403,6 +7391,9 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
|
|
|
|
|
|
$query = $query->offset($offset)->limit($limit); |
|
|
|
|
$items = $query->all(); |
|
|
|
|
$pay_chexian = PayOrderUserT::find() |
|
|
|
|
->where("pay_date='{$pay_date}'") |
|
|
|
|
->sum('real_pay'); |
|
|
|
|
|
|
|
|
|
$data = []; |
|
|
|
|
$data['total'] = $total; |
|
|
|
@ -7418,6 +7409,10 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
|
$data['rows'][] = $row; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$data['rows'][] = array( |
|
|
|
|
['提成工资总额', number_format($pay_chexian,2)], |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
@ -7609,7 +7604,6 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
|
|
|
|
|
|
$user_id = $this->my->id; |
|
|
|
|
// var_dump($user_id); |
|
|
|
|
$query = UserT::find() |
|
|
|
|
->leftJoin('pay_t','pay_t.user_id=user_t.id') |
|
|
|
|
->where('group_id>0 and is_delete=0'); |
|
|
|
@ -7650,8 +7644,17 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
|
$data['rows'][] = $row; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$pay_chexian = PayT::find() |
|
|
|
|
->where("pay_date='{$pay_date}'") |
|
|
|
|
->sum('ticheng_real_pay'); |
|
|
|
|
|
|
|
|
|
$data['rows'][] = array( |
|
|
|
|
['提成工资总额', number_format($pay_chexian,2)], |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 出纳工资-详情 |
|
|
|
|
* @return string |
|
|
|
|