|
@@ -149,4 +149,44 @@ class StaffSalary extends Api
|
|
|
}
|
|
}
|
|
|
$this->success('成功', $list);
|
|
$this->success('成功', $list);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询月份员工工资数据
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function GetStaffSalaryMonth()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->request->isGet()){
|
|
|
|
|
+ $this->error('请求方法错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param['month'])) {
|
|
|
|
|
+ $this->error('请选择月份');
|
|
|
|
|
+ }
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'date' => ['like', $param['month'] . '%'],
|
|
|
|
|
+ 'del_rq' => null,
|
|
|
|
|
+ ];
|
|
|
|
|
+ if (!empty($param['search'])) {
|
|
|
|
|
+ $where['staff_no|staff_name'] = ['like', '%' . $param['search'] . '%'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $list = db('设备_工分计酬')
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->field('staff_no,staff_name,sum(salary) as salary')
|
|
|
|
|
+ ->group('staff_no,staff_name')
|
|
|
|
|
+ ->field('staff_no,staff_name,DATE_FORMAT(date, "%Y-%m-%d") as date,sum(salary) as salary')
|
|
|
|
|
+ ->group('staff_no,DATE_FORMAT(date, "%Y-%m-%d")')
|
|
|
|
|
+ ->order('staff_no asc,date asc')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ if(empty($list)){
|
|
|
|
|
+ $this->error('没有数据');
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功', $list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|