|
|
@@ -36,7 +36,7 @@ class EmployeeDailySalary extends Api
|
|
|
->field('DATE_FORMAT(`sczl_rq`, "%Y%m") as sys_ny,bh')
|
|
|
->group('DATE_FORMAT(`sczl_rq`, "%Y%m"),bh')
|
|
|
->whereTime('sczl_rq', '>=', strtotime('-14 months'))
|
|
|
- ->where('bh','<>','000000')
|
|
|
+ ->where('bh','<>','0000')
|
|
|
->order('sczl_rq desc')
|
|
|
->select();
|
|
|
foreach($res as $v){
|
|
|
@@ -104,7 +104,19 @@ class EmployeeDailySalary extends Api
|
|
|
$month=substr($req['date'],-2);
|
|
|
$start_time = $year . '-' . $month . '-01 00:00:00';
|
|
|
$end_time = date('Y-m-t', strtotime("$year-$month-01")) . ' 23:59:59';
|
|
|
-
|
|
|
+
|
|
|
+ $day = $year.'-'.$month;
|
|
|
+
|
|
|
+ //获取包装计件计时时数
|
|
|
+ $result = \db('db_包装计件')
|
|
|
+ ->alias('a')
|
|
|
+ ->join('人事_基本资料 b', 'b.员工编号 = a.sczl_bh')
|
|
|
+ ->where('a.sczl_rq', 'like', $day . '%')
|
|
|
+ ->where('a.sczl_jsss','<>','0')
|
|
|
+ ->where('b.所在部门', 'like', $req['department'] . '%')
|
|
|
+ ->group('a.sczl_bh, LEFT(a.sczl_rq, 10)')
|
|
|
+ ->field('a.sczl_bh, a.sczl_jsss AS 计时时数, a.sczl_冲定额 AS 冲定额, DATE_FORMAT(a.sczl_rq,"%Y/%m/%d") as sczl_rq, b.员工姓名')
|
|
|
+ ->select();
|
|
|
//查询wgjs表获取数据,以供后续计算
|
|
|
$arr = [];
|
|
|
$columns = ['wgjs_bh1', 'wgjs_bh2', 'wgjs_bh3', 'wgjs_bh4', 'wgjs_bh5', 'wgjs_bh6'];
|
|
|
@@ -118,7 +130,6 @@ class EmployeeDailySalary extends Api
|
|
|
|
|
|
$arr = array_merge($arr, $r);
|
|
|
}
|
|
|
-
|
|
|
//计算wgjs总计时时数
|
|
|
$list = [];
|
|
|
foreach($arr as $v){
|
|
|
@@ -137,6 +148,23 @@ class EmployeeDailySalary extends Api
|
|
|
$list[$v['wgjs_bh'].'-'.$v['wgjs_rq']]['日工资合计']=floatval(number_format($v['wgjs_js']*9.5,2, '.', ''));
|
|
|
}
|
|
|
};
|
|
|
+ //计算包装计件计时工资
|
|
|
+ foreach ($result as $v){
|
|
|
+ if(isset($list[$v['sczl_bh'].'-'.$v['sczl_rq']])){
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['计时时数']+=$v['计时时数'];
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['计时工资']=floatval(number_format($list[$v['sczl_bh'].'-'.$v['sczl_rq']]['计时时数']*9.5,2, '.', ''));
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['日工资合计']=floatval(number_format($list[$v['sczl_bh'].'-'.$v['wgjs_rq']]['计时时数']*9.5,2, '.', ''));
|
|
|
+ }else{
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['bh']=$v['sczl_rq'];
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['员工姓名']=$v['员工姓名'];
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['sczl_rq']=$v['sczl_rq'];
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['计件工资']=0;
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['加班工资']=0;
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['计时时数']=$v['计时时数'];
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['计时工资']=floatval(number_format($v['计时时数']*9.5,2, '.', ''));
|
|
|
+ $list[$v['sczl_bh'].'-'.$v['sczl_rq']]['日工资合计']=floatval(number_format($v['计时时数']*9.5,2, '.', ''));
|
|
|
+ }
|
|
|
+ }
|
|
|
//计算当月冲定额时长
|
|
|
$list1 = [];
|
|
|
foreach($arr as $v){
|
|
|
@@ -152,6 +180,20 @@ class EmployeeDailySalary extends Api
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+ //计算包装计件计时工资冲定额
|
|
|
+ foreach ($result as $value){
|
|
|
+ if(isset($list1[$value['sczl_bh']])){
|
|
|
+ if($value['冲定额']=='是'){
|
|
|
+ $list1[$value['sczl_bh']]['计时时数']+=$value['计时时数'];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if($value['冲定额']=='是'){
|
|
|
+ $list1[$value['sczl_bh']]['计时时数']=$value['计时时数'];
|
|
|
+ }else{
|
|
|
+ $list1[$value['sczl_bh']]['计时时数']=0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//获取每个员工计时补差天数
|
|
|
$arr1 = db('绩效工资汇总')->alias('j')
|
|
|
->field('j.bh,j.sczl_rq,j.法定天数')
|