feature: 工资管理
This commit is contained in:
parent
c7ee06d512
commit
60960debe7
|
|
@ -43,13 +43,29 @@ class Detail extends Backend
|
|||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
|
||||
$items = Db::name('salary_item')->field('id,name')->select();
|
||||
$items = Db::name('salary_item')->field('id,attr,name')->select();
|
||||
|
||||
$salaryItem = [];
|
||||
foreach ($items as $item) {
|
||||
$idAttr[$item['id']] = $item['attr'];
|
||||
if ($item['attr'] == 'JXKHJL') {
|
||||
$salaryItem[] = [
|
||||
'id' => 'jx_total',
|
||||
'name' => '绩效提成',
|
||||
];
|
||||
}
|
||||
$salaryItem[] = [
|
||||
'id' => 'item_' . $item['id'],
|
||||
'name' => $item['name'],
|
||||
];
|
||||
}
|
||||
$salaryItem[] = [
|
||||
'id' => 'total',
|
||||
'name' => '总计',
|
||||
];
|
||||
|
||||
$month = date('Y-m-01');
|
||||
|
||||
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
|
||||
|
||||
|
|
@ -89,6 +105,7 @@ class Detail extends Backend
|
|||
|
||||
|
||||
foreach ($adminIds as $adminId) {
|
||||
$attrValue = [];
|
||||
foreach ($items as $item) {
|
||||
|
||||
$res[$adminId]['admin_id'] = $adminId;
|
||||
|
|
@ -99,11 +116,20 @@ class Detail extends Backend
|
|||
|
||||
if (isset($queryRes[$adminId][$item['id']])) {
|
||||
$res[$adminId][$itemKey] = $this->clean_number($queryRes[$adminId][$item['id']]);
|
||||
$attrValue[$idAttr[$item['id']]] = $queryRes[$adminId][$item['id']];
|
||||
continue;
|
||||
}
|
||||
|
||||
$attrValue[$item['attr']] = 0;
|
||||
$res[$adminId][$itemKey] = 0;
|
||||
}
|
||||
|
||||
|
||||
$jxTotal = ($attrValue['ZWJX'] - $attrValue['YYCB']) * $attrValue['TD'];
|
||||
|
||||
$res[$adminId]['jx_total'] = $this->clean_number($jxTotal);
|
||||
$res[$adminId]['total'] = $this->clean_number(($attrValue['JBGZ'] + $attrValue['JBBZ'] + $attrValue['GWJT'] + $jxTotal + $attrValue['JXKHJL'] + $attrValue['QQ'])
|
||||
- ($attrValue['SBJ'] + $attrValue['BX'] + $attrValue['KK'] + $attrValue['CDWDK']));
|
||||
}
|
||||
|
||||
$res = array_values($res);
|
||||
|
|
@ -115,7 +141,7 @@ class Detail extends Backend
|
|||
|
||||
|
||||
$this->view->assign("month", $month);
|
||||
$this->view->assign("salaryitem", json_encode($items));
|
||||
$this->view->assign("salaryitem", json_encode($salaryItem));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
rawColumns.forEach(function (item) {
|
||||
// 可以加入格式化、样式控制等逻辑
|
||||
defaultColumnArr.push({
|
||||
field: 'item_' + item.id,
|
||||
field: item.id,
|
||||
title: item.name,
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user