123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class SalaryRecord extends Base
- {
- // 发放薪水
- public function save(){
- model('SalaryRecord')->add();
- HelpHander::success([],'操作成功');
- }
- // 获取要发放薪水的人及检测该月是否已发放工资
- public function preSave(){
- $data = [
- 'type' => input('type/d',1),
- 'month' => input('month','','trim'),
- 'types' => input('types','','trim'),
- 'continue' => input('continue/d',0)
- ];
- if(!in_array($data['type'],[1,2,3,4,5,6,7,8,9])){
- HelpHander::error('未选择工资类型');
- }
- if(!$data['month']){
- HelpHander::error('未选择月份');
- }
- $map[] = ['del','=',0];
- // if($data['type'] == 1||$data['type'] == 6){
- // $map[] = ['type','in',[1,6]];
- // }
- // if($data['type'] == 2||$data['type'] == 7){
- // $map[] = ['type','in',[2,7]];
- // }
- // if($data['type'] == 3||$data['type'] == 8){
- // $map[] = ['type','in',[3,8]];
- // }
- // if($data['type'] == 4||$data['type'] == 9){
- // $map[] = ['type','in',[4,9]];
- // }
- // if($data['type'] == 5){
- // $map[] = ['type','=',$data['type']];
- // }
- $map[] = ['type','=',$data['type']];
- $map[] = ['status','in',[0,1,3]];
- $info = Db::name('salary_record')->where($map)->find();
- if($info){
- HelpHander::error('有正在处理的工资未发放');
- }
- // $res = Db::name('salary_record')
- // ->where('type',$data['type'])
- // ->where('del',0)
- // ->where('status','in',[0,1,3])
- // ->find();
- // if($res){
- // HelpHander::error('有正在处理的工资未发放');
- // }
- $ret = model('SalaryRecord')->preAdd($data,$this->orgId);
- HelpHander::success($ret,'操作成功');
- }
- public function reloadAdd(){
- $salaryRecordId = input('salaryRecordId/d',0);
- $uid = input('uid/d',0);
- $ret = model('SalaryRecord')->reloadAdd($salaryRecordId,$uid,$this->orgId);
- HelpHander::success($ret,'操作成功');
- }
- // 重新计算
- public function resend(){
- model('SalaryRecord')->resend();
- HelpHander::success([],'操作成功');
- }
- // 重新计算个税
- public function resendtax(){
- model('SalaryRecord')->resendtax();
- HelpHander::success([],'操作成功');
- }
- // 删除工资项
- public function delsalary(){
- model('SalaryRecord')->delsalary();
- HelpHander::success([],'操作成功');
- }
- // 添加工资项
- public function addsalary(){
- model('SalaryRecord')->addsalary();
- HelpHander::success([],'操作成功');
- }
- // 修改工资项
- public function modifysalary(){
- model('SalaryRecord')->modifysalary();
- HelpHander::success([],'操作成功');
- }
- // 同意
- public function agree(){
- $id = input('id/d',0);
- model('SalaryRecord')->agree($id,$this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 打回
- public function disagree(){
- $id = input('id/d',0);
- model('SalaryRecord')->disagree($id,$this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 重新提交
- public function reapply(){
- $id = input('id/d',0);
- model('SalaryRecord')->reapply($id,$this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 发放
- public function confirm(){
- $id = input('id/d',0);
- model('SalaryRecord')->confirm($id,$this->userId);
- HelpHander::success([],'操作成功');
- }
- // 社保
- public function sbinfo(){
- $id = input('id/d',0);
- $uid = input('uid/d',0);
- $ret = model('SalaryRecord')->sbinfo($id,$uid);
- HelpHander::success($ret,'操作成功');
- }
- // 个税
- public function taxinfo(){
- $id = input('id/d',0);
- $uid = input('uid/d',0);
- $ret = model('SalaryRecord')->taxinfo($id,$uid);
- HelpHander::success($ret,'操作成功');
- }
- // 详情
- public function detail(){
- $id = input('id/d',0);
- $ret = model('SalaryRecord')->info($id);
- HelpHander::success($ret);
- }
- public function payinfo(){
- $id = input('id/d',0);
- $ret = model('SalaryRecord')->payinfo($id);
- HelpHander::success($ret);
- }
- // 列表
- public function list(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $month = input('month','','trim');
- $type = input('type/d',-1);
- $ret = model('SalaryRecord')->lists($page,$size,$month,$type);
- HelpHander::success($ret);
- }
- // 工资列表
- public function listLog(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $name = input('name','','trim');
- $id = input('id/d',0);
- $ret = model('SalaryRecord')->listLog($page,$size,$name,$id);
- HelpHander::success($ret);
- }
- public function listSpecial(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $name = input('name','','trim');
- $id = input('id/d',0);
- $ret = model('SalaryRecord')->listSpecial($page,$size,$name,$id);
- HelpHander::success($ret);
- }
- // 编辑个税
- public function taxEdit(){
- model('SalaryRecord')->taxEdit();
- HelpHander::success([],'操作成功');
- }
- // 导出
- public function exportListLog(){
- $name = input('name','','trim');
- $id = input('id/d',0);
- $ret = model('SalaryRecord')->exportListLog($name,$id);
- HelpHander::success($ret);
- }
- // 删除
- public function del(){
- $id = input('id/d',0);
- model('SalaryRecord')->del($id);
- HelpHander::success([],'操作成功');
- }
- // 重新发放
- public function send(){
- $id = input('id/d',0);
- model('SalaryRecord')->send($id);
- HelpHander::success([],'操作成功');
- }
- // 我的薪水列表
- public function mySalary(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $month = input('month','','trim');
- $ret = model('SalaryRecord')->mySalary($page,$size,$month,$this->userId);
- HelpHander::success($ret);
- }
- // 工资详情
- public function salaryDetail(){
- $id = input('id/d',0);
- if($id <= 0){
- HelpHander::error('参数错误');
- }
- $ret = model('SalaryRecord')->salaryDetail($id,$this->userId);
- HelpHander::success($ret);
- }
- // 列表
- public function taxlist(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $month = input('month','','trim');
- $name = input('name','','trim');
- $type = input('type/d',0);
- $ret = model('SalaryRecord')->taxlist($page,$size,$month,$name,$type);
- HelpHander::success($ret);
- }
- // 聚合列表
- public function ntaxlist(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $month = input('month','','trim');
- $name = input('name','','trim');
- $type = input('type/d',0);
- $ret = model('SalaryRecord')->ntaxlist($month,$name,$type);
- HelpHander::success($ret);
- }
- public function ntaxexport(){
- $month = input('month','','trim');
- $name = input('name','','trim');
- $type = input('type/d',0);
- $ret = model('SalaryRecord')->ntaxexport($month,$name,$type);
- HelpHander::success($ret);
- }
- // 社保公积金列表
- public function sblist(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $month = input('month','','trim');
- $name = input('name','','trim');
- $type = input('type/d',0);
- $ret = model('SalaryRecord')->sblist($month,$name,$type);
- HelpHander::success($ret);
- }
- // 社保公积金导出
- public function sbexport(){
- $month = input('month','','trim');
- $name = input('name','','trim');
- $type = input('type/d',0);
- $ret = model('SalaryRecord')->sbexport($month,$name,$type);
- HelpHander::success($ret);
- }
- // 待审批记录
- public function unapply(){
- $ret = model('SalaryRecord')->unapply($this->userId);
- HelpHander::success($ret);
- }
- // 个人明细
- public function userdetail(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $year = input('year','','trim');
- $type = input('type/d',1);
- if(!$year||!in_array($type,[1,2,3,4,5])){
- HelpHander::error('参数错误');
- }
- $ret = model('SalaryRecord')->userdetail($page,$size,$type,$year);
- HelpHander::success($ret);
- }
- //年度用工成本统计
- public function userYear(){
- $year = input('year','','trim');
- $month = input('month/d',0);
- $name = input('name','','trim');
- $type = input('type/d',1);
- if(!$year||!in_array($type,[1,2,3,4])){
- HelpHander::error('参数错误');
- }
- $ret = model('SalaryRecord')->userYear($type,$year,$name,$month);
- HelpHander::success($ret);
- }
- public function yearexport(){
- $year = input('year','','trim');
- $name = input('name','','trim');
- $month = input('month/d',0);
- $type = input('type/d',1);
- if(!$year||!in_array($type,[1,2,3,4])){
- HelpHander::error('参数错误');
- }
- $ret = model('SalaryRecord')->yearExport($type,$year,$name,$month);
- HelpHander::success($ret);
- }
- //年度工资积累
- public function workerYear(){
- $year = input('year','','trim');
- $name = input('name','','trim');
- $type = input('type/d',1);
- if(!$year||!in_array($type,[1,2,3,4])){
- HelpHander::error('参数错误');
- }
- $ret = model('SalaryRecord')->workerYear($type,$year,$name);
- HelpHander::success($ret);
- }
- public function yearworkerexport(){
- $year = input('year','','trim');
- $name = input('name','','trim');
- $type = input('type/d',1);
- if(!$year||!in_array($type,[1,2,3,4])){
- HelpHander::error('参数错误');
- }
- $ret = model('SalaryRecord')->yearWorkerExport($type,$year,$name);
- HelpHander::success($ret);
- }
- //个人年度工资积累
- public function userWorkerYear(){
- $year = input('year','','trim');
- $type = input('type/d',1);
- if(!$year||!in_array($type,[1,2,3,4,5,6,7,8,9])){
- HelpHander::error('参数错误');
- }
- $ret = model('SalaryRecord')->userWorkerYear($type,$year,$this->userId);
- HelpHander::success($ret);
- }
- public function userTypes(){
- $ret = model('SalaryRecord')->getUserSalayrTypes($this->userId);
- HelpHander::success($ret);
- }
- }
|