财务项合计,差利润统计

dev
zhaocheng 5 years ago
parent 218364f3e2
commit 8f42d2e07d
  1. 85
      frontend/controllers/FinanceController.php
  2. 13
      frontend/views/finance/chuna-gongzi-list.php
  3. 13
      frontend/views/finance/gongzi-all-list.php
  4. 13
      frontend/views/finance/pay2-list.php
  5. 2
      frontend/views/finance/ticheng-jisuan.php
  6. 2
      frontend/views/insurer/office-mng-edit.php

@ -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

@ -125,6 +125,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 = '<tfoot><tr><td colspan="8" class="">';
$.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;

@ -128,6 +128,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 = '<tfoot><tr><td colspan="8" class="">';
$.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;

@ -128,6 +128,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 = '<tfoot><tr><td colspan="8" class="">';
$.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;

@ -212,7 +212,7 @@ use \common\libs\MyLib;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="18" class="text-center">';
var html = '<tfoot><tr><td colspan="33" class="">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +

@ -227,7 +227,7 @@ use common\models\PriceT;
<?php
foreach($insurer_company2_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $order_info->company_id)
if($item->id == $order_info->company2_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}

Loading…
Cancel
Save