完成老板工资管理更新

dev
曾超新 5 years ago
parent 022e293ea5
commit 8c506480e8
  1. 123
      frontend/controllers/FinanceController.php
  2. 1015
      frontend/views/finance/gongzi-all-info.php
  3. 270
      frontend/views/finance/gongzi-all-list.php
  4. 2
      frontend/views/finance/pay2-info.php

@ -7564,66 +7564,74 @@ class FinanceController extends \frontend\controllers\UserBaseController
* 财务工资列表 * 财务工资列表
* @return string * @return string
*/ */
public function actionGongziAllList() public function actionGongziAllList() {
$group_items = GroupT::getTree();
return $this->render('gongzi-all-list',[
'group_items' => $group_items
]);
}
public function actionGongziAllListJson()
{ {
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request; $request = Yii::$app->request;
$username = $request->get('username'); $username = $request->get('username');
$name = $request->get('name'); $name = $request->get('name');
$pay_date = $request->get('pay_date', date('Y-m')); $pay_date = $request->get('pay_date', date('Y-m'));
$group_id = $request->get('group_id', 0); $group_id = $request->get('group_id', 0);
$page = $request->get('page', 1); $is_leave = $request->get('is_leave');
$status_id = $request->get('status_id',0); $status_id = $request->get('status_id',0);
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 10);
$user_id = $this->my->id; $user_id = $this->my->id;
// var_dump($user_id); // var_dump($user_id);
$query = UserT::find() $query = UserT::find()
->leftJoin('pay_t','pay_t.user_id=user_t.id') ->leftJoin('pay_t','pay_t.user_id=user_t.id')
->where('group_id>0 and is_delete=0'); ->where('group_id>0 and is_delete=0');
if ($username != '') { if ($username != '') {
$query = $query->andWhere('username like "' . $username . '"'); $query->andWhere('username like "' . $username . '"');
} }
if ($name != '') { if ($name != '') {
$query = $query->andWhere('name like "' . $name . '"'); $query->andWhere('name like "' . $name . '"');
} }
if ($group_id > 0) { if ($group_id > 0) {
$query = $query->andWhere('group_id=' . $group_id); $query->andWhere('group_id=' . $group_id);
}
if($is_leave != '') {
$query->andWhere('is_leave='.$is_leave);
} }
if($status_id > 0) { if($status_id > 0) {
$query = $query->andWhere(['IN','pay_t.status_id',[7,8,9]]); $query->andWhere(['IN','pay_t.status_id',[7,8,9]]);
} }
$query = $query->orderBy('username ASC,id ASC'); $query = $query->orderBy('username ASC,id ASC');
$total = $query->count(); $total = $query->count();
$total_real_pay = 0;
foreach ($query->each() as $item) {
$pay_info = $item->getPay($pay_date);
if ($pay_info)
$total_real_pay += $pay_info->real_pay;
}
$pagination = new Pagination(['totalCount' => $total, 'pageSize' => 20]);
$pagination->setPage($page - 1);
$query = $query->offset($pagination->offset)->limit($pagination->limit); $query->offset($offset)->limit($limit);
$items = $query->all(); $items = $query->all();
$page_info = MyLib::getPageInfo($pagination); $page_info = MyLib::getPageInfo($pagination);
$group_items = GroupT::getTree(); $group_items = GroupT::getTree();
return $this->render('gongzi-all-list', [ $data = [];
'group_items' => $group_items, $data['total'] = $total;
'items' => $items, $data['rows'] = [];
'page_info' => $page_info, foreach($items as $item) {
'page' => $page, $row = $item->toArray();
'username' => $username, $row['pay_date'] = $pay_date;
'name' => $name, $row['group_name'] = $item->group ? $item->group->path : '';
'pay_date' => $pay_date, $row['is_leave'] = $item->is_leave ? '已离职':'';
'group_id' => $group_id, $pay_info = $item->getPay($pay_date);
'total_real_pay' => $total_real_pay, $row['status_name'] = $pay_info ? $pay_info->getStatus($pay_info->status_id) : '';
'status_id' => $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;
$data['rows'][] = $row;
}
return $data;
} }
/** /**
* 出纳工资-详情 * 出纳工资-详情
@ -7688,6 +7696,10 @@ class FinanceController extends \frontend\controllers\UserBaseController
->orderBy('created_at asc'); ->orderBy('created_at asc');
//原新保
$my_type0_query = PayOrderUserT::find()
->where('pay_date="' . $pay_date . '" and type=1 and user_id=' . $user_id.' and is_own =0')
->orderBy('created_at asc');
@ -7730,6 +7742,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
'user_info' => $user_info, 'user_info' => $user_info,
'group_info' => $group_info, 'group_info' => $group_info,
'pay_info' => $pay_info, 'pay_info' => $pay_info,
'my_type0_query' => $my_type0_query,
'my_type1_query' => $my_type1_query, 'my_type1_query' => $my_type1_query,
'my_type3_query' => $my_type3_query, 'my_type3_query' => $my_type3_query,
'my_type5_query' => $my_type5_query, 'my_type5_query' => $my_type5_query,
@ -8008,4 +8021,54 @@ class FinanceController extends \frontend\controllers\UserBaseController
'r_bu_dian_all'=>$r_bu_dian_all 'r_bu_dian_all'=>$r_bu_dian_all
]); ]);
} }
public function actionGongziAllReturnSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
$id = $request->post('id',0);
$remark = $request->post('remark','');
$status_id = 4;
$pay_info = PayT::findOne($id);
$pay_info->status_id = $status_id + 6;
$content = '老板:'.$this->my->showName.'退回'.$pay_info->pay_date.'工资';
$this->addUserLog($pay_info->id, $content,$remark);
if($pay_info->save()){
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
public function actionGongziAllSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '保存失败';
$id = $request->post('id',0);
$pay_info = PayT::findOne($id);
$pay_info->status_id = 5;
$content = '老板:'.$this->my->showName.'同意本条记录'.$pay_info->pay_date.'工资';
$this->addUserLog($pay_info->id, $content);
if($pay_info->save()){
$result['success'] = true;
$result['msg'] = '保存成功';
}
return $result;
}
} }

File diff suppressed because it is too large Load Diff

@ -1,159 +1,149 @@
<?php <?php
use \common\libs\MyLib; use \common\libs\MyLib;
?> ?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script> <?php $this->beginBlock('header_css'); ?>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script> <link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link rel="stylesheet" href="../Myfile/css/font.css?v=20190611"> <?php $this->endBlock(); ?>
<link rel="stylesheet" href="../Myfile/css/xadmin.css?v=20190605">
<link rel="stylesheet" href="../Myfile/css/theme274.min.css?v=20190605">
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script src="../Myfile/lib/layui/layui.js?v=20190611" charset="utf-8"></script>
<script type="text/javascript" src="../Myfile/js/xadmin.js?v=20190612"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js?v=2019"></script><script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
//编辑
function edit(id) {
var params = $('#searchForm').serialize();
window.location.href = '/finance/gongzi-all-info?id=' + id + '&pay_date=<?=$pay_date?>' + '&back_params=' + encodeURIComponent(params);
}
$(function(){
$("#search-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.location.href = "/finance/gongzi-all-list?" + params;
});
$('#searchForm').submit(function(){
$('#search-btn').click();
return false;
});
$("#reset-btn").click(function(){
var pay_date = $('#pay_date').val();
if(confirm('是否对'+ pay_date + '月份的工资进行重新计算?')) {
$('#reseting').show();
$(this).hide();
$.post('/finance/pay2-reset',{pay_date:pay_date},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
$('#reseting').hide();
$(this).show();
},'json');
}
});
$("#pay-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/finance/pay2-tiao?" + params;
});
});
</script> <div class="wrapper wrapper-content animated fadeInRight">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <div class="ibox float-e-margins">
<form id="searchForm"> <div class="ibox-title">
<input type="hidden" id="page" name="page" value="<?=$page?>"> <h5>出纳工资管理</h5>
<tr> <div class="ibox-tools">
<td class="td_bg"> <a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
工号:<input name="username" type="text" value="<?=$username?>"> <i class="fa fa-refresh"></i> 刷新
真实姓名:<input name="name" type="text" value="<?=$name?>"> </a>
工资月份:<input name="pay_date" id="pay_date" class="Wdate" type="text" value="<?=$pay_date?>" onClick="WdatePicker({dateFmt:'yyyy-MM'})"> </div>
分组:<select name="group_id"> </div>
<div class="ibox-content">
<form role="form" id="searchFrm" class="form-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label>工号</label>
<input type="text" name="username" id="username" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label>真实姓名</label>
<input type="text" name="name" id="name" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label>工资月份</label>
<input type="text" name="pay_date" id="pay_date" class="form-control date" value="<?=date('Y-m')?>" autocomplete="off">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label>是否离职</label>
<select name="is_leave" class="form-control">
<option value="">全部</option>
<option value="1"></option>
<option value="0"></option>
</select>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label>分组</label>
<select name="group_id" class="form-control">
<option value="0">全部</option> <option value="0">全部</option>
<?php <?php
foreach($group_items as $group) { foreach($group_items as $group) {
echo '<option value="'.$group->id.'"'; echo '<option value="'.$group->id.'">'.$group->name.'</option>';
if($group->id == $group_id)
echo ' selected ';
echo '>'.$group->name.'</option>';
} }
?> ?>
</select> </select>
状态:<select name="status_id"> </div>
<div class="form-group" style="margin-bottom: 8px;">
<label>状态</label>
<select name="status_id" class="form-control">
<option value="0">全部</option> <option value="0">全部</option>
<option value="1" <?=$status_id == 1?'selected':''?>>人事✔</option> <option value="1">人事✔</option>
<option value="2" <?=$status_id == 2?'selected':''?>>出纳✔</option> <option value="2">出纳✔</option>
<option value="3" <?=$status_id == 3?'selected':''?>>人事✔,出纳✔</option> <option value="3">人事✔,出纳✔</option>
<option value="4" <?=$status_id == 4?'selected':''?>>财务✔</option> <option value="4">财务✔</option>
<option value="5" <?=$status_id == 5?'selected':''?>>老板✔</option> <option value="5">老板✔</option>
<option value="6" <?=$status_id == 6?'selected':''?>>已发放</option> <option value="6">已发放</option>
<option value="10" <?=$status_id == 10?'selected':''?>>退回</option> <option value="7">退回</option>
</select> </select>
<input type="submit" class="act_btn" id="search-btn" name="search-btn" value="搜索"> </div>
<!-- <span id="reseting" style="display: none;">正在计算中...</span>--> <button type="submit" class="btn btn-primary mb-8">搜索</button>
<!-- <input type="button" class="act_btn" id="reset-btn" name="reset-btn" value="重新计算">-->
<!-- <input type="button" class="act_btn" id="pay-btn" name="pay-btn" value="工资条">-->
</td>
</tr>
</form> </form>
</table> <div class="row">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> <div class="col-md-12">
<table id="listTable">
<thead>
<tr> <tr>
<td width="100" align="center" align="center" class="bg_tr">工号</td> <th width="50" data-field="id">ID</th>
<td align="center" class="bg_tr">真实姓名</td> <th data-field="username">工号</th>
<td width="100" align="center" class="bg_tr">工资月份</td> <th data-field="name">真实姓名</th>
<td align="center" class="bg_tr">所属岗位</td> <th data-field="pay_date">工资月份</th>
<!-- <td width="60" align="center" class="bg_tr">角色</td>--> <th data-field="group_name">所属岗位</th>
<td width="60" align="center" class="bg_tr">基本工资</td> <th data-field="real_pay">基本工资</th>
<td width="60" align="center" class="bg_tr">提成工资</td> <th data-field="should_pay">提成工资</th>
<td width="60" align="center" class="bg_tr">状态</td> <th data-field="is_leave">是否离职</th>
<td width="30" align="center" class="bg_tr">操作</td> <th data-field="status_name">状态</th>
<th data-formatter="opFormatter">操作</th>
</tr> </tr>
<form id="delFrm"> </thead>
<?php </table>
foreach($items as $index => $item) { </div>
$pay_info = $item->getPay($pay_date); </div>
$base_real_pay = 0; </div>
$ticheng_real_pay = 0; </div>
$is_begin = 0; </div>
if($pay_info){
$is_begin = 1;
$base_real_pay = $pay_info->base_real_pay; <?php $this->beginBlock('footer_js'); ?>
$ticheng_real_pay = $pay_info->ticheng_real_pay; <script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
var o = {};
function opFormatter(value, row, index) {
var opStr = [];
if(row.is_show == 1) {
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="详情"></i>');
opStr.push('</a>');
} }
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="left" class="td_bg" nowrap ><?=$item->username?></td>
<td class="td_bg" nowrap><?=$item->name?></td>
<td class="td_bg" nowrap><?=$pay_date?></td>
<td align="left" class="td_bg" nowrap><?=$item->group?$item->group->name:''?></td>
<!-- <td class="td_bg" nowrap><=$item->role?$item->role->name:''?></td>-->
<td align="center" class="td_bg" nowrap data="<?=$item->id?>">
<?=number_format($base_real_pay,2)?>
</td>
<td align="center" class="td_bg" nowrap data="<?=$item->id?>">
<?=number_format($ticheng_real_pay,2)?>
</td>
<td align="center" class="td_bg" nowrap data="<?=$item->id?>">
<?php if($is_begin == 0):?>
<?php else:?>
<?=$pay_info->getStatus($pay_info->status_id)?>
<?php endif;?>
</td> return opStr.join(' ');
<td align="center" class="td_bg" nowrap>
<?php if($is_begin == 0):?>
<?php else:?>
[<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">详情</a>]
<?php endif;?>
</td>
</tr>
<?php
} }
?> function edit(id) {
</form> var title = '详情';
<tr> var pay_date = $('#pay_date').val();
<td width="100" align="center" align="center" class="bg_tr"></td> layer_show(title, '/finance/gongzi-all-info?id=' + id + '&pay_date=' + pay_date);
<td align="center" class="bg_tr"></td> }
<td width="100" align="center" class="bg_tr"></td> function refreshList() {
<td align="center" class="bg_tr"></td> $('#listTable').bootstrapTable('refresh');
<td width="60" align="center" class="bg_tr"></td> }
<td width="60" align="center" class="bg_tr"><?=number_format($total_real_pay,2)?></td> function search() {
<td width="30" align="center" class="bg_tr"></td> o = {};
</tr> var params = $("#searchFrm").serializeArray();
<tr > $.each(params, function(index) {
<td height="25" colspan="11" align="center" class="td_bg"><?=$page_info?></td> o[this['name']] = this['value'];
</tr> });
</table> $('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/finance/pay2-list-json",
pagination: false,
sidePagination: 'server',
queryParams: function(params) {
o['offset'] = params['offset'];
o['limit'] = params['limit'];
return o;
}
});
return false;
}
$(function() {
search();
$('.date').datepicker({
minViewMode: 1,
keyboardNavigation: false,
forceParse: false,
autoclose: true,
todayHighlight: true,
format: "yyyy-mm"
});
});
</script>
<?php $this->endBlock(); ?>

@ -81,7 +81,7 @@ use \common\libs\MyLib;
<label class="form-control-static"><?=$pay_chexian + $pay_dz?></label> <label class="form-control-static"><?=$pay_chexian + $pay_dz?></label>
</div> </div>
</div> </div>
<?php if($pay_info->status_id < 4 || $pay_info->status_id == 8) { ?> <?php if($pay_info->status_id < 4 || $pay_info->status_id == 8 || $pay_info->status_id == 10) { ?>
<div> <div>
<div class="row"> <div class="row">
<div class="col-sm-1 col-md-offset-5"> <div class="col-sm-1 col-md-offset-5">

Loading…
Cancel
Save