59 lines
2.6 KiB
Plaintext
59 lines
2.6 KiB
Plaintext
操作前做好数据备份
|
|
|
|
一、删除指定扣缴义务人下的档案
|
|
删除扣缴义务人下的档案(注意删除后,再添加进扣缴义务人,不会自动生成档案)
|
|
|
|
1、查询hrsa_tax_agent表对应扣缴义务人id
|
|
select id from hrsa_tax_agent
|
|
|
|
2、删除社保福利档案
|
|
update hrsa_insurance_base_info set delete_type=3 where payment_organization = 扣缴义务人id
|
|
update hrsa_social_archives set delete_type=3 where payment_organization = 扣缴义务人id
|
|
update hrsa_fund_archives set delete_type=3 where payment_organization = 扣缴义务人id
|
|
update hrsa_other_archives set delete_type=3 where payment_organization = 扣缴义务人id
|
|
|
|
|
|
3、删除薪资档案
|
|
update hrsa_salary_archive set delete_type=3 where tax_agent_id=扣缴义务人id
|
|
|
|
|
|
二、删除停薪员工档案
|
|
update hrsa_salary_archive set delete_type=3 where delete_type=0 and run_status in ('STOP_FROM_PENDING','STOP_FROM_SUSPEND')
|
|
update hrsa_salary_archive_item set delete_type=3 where delete_type=0
|
|
|
|
二、删除停薪员工社保档案
|
|
update hrsa_insurance_base_info set delete_type=3 where run_status in ('4','5')
|
|
|
|
|
|
三、删除指定人员档案
|
|
|
|
|
|
--删除社保福利档案
|
|
update hrsa_insurance_base_info set delete_type=3 WHERE delete_type=0 and employee_id = ? and payment_organization =?
|
|
update hrsa_social_archives set delete_type=3 WHERE delete_type=0 and employee_id = ? and payment_organization =?
|
|
update hrsa_fund_archives set delete_type=3 WHERE delete_type=0 and employee_id = ? and payment_organization =?
|
|
update hrsa_other_archives set delete_type=3 WHERE delete_type=0 and employee_id = ? and payment_organization =?
|
|
|
|
-- 删除薪资档案
|
|
update hrsa_salary_archive set delete_type=3 where employee_id = ? and tax_agent_id=?
|
|
|
|
|
|
update hrsa_salary_archive set delete_type=3;
|
|
update hrsa_insurance_base_info set delete_type=3;
|
|
update hrsa_social_archives set delete_type=3;
|
|
update hrsa_fund_archives set delete_type=3;
|
|
update hrsa_other_archives set delete_type=3;
|
|
update hrsa_tax_agent_emp set delete_type=3;
|
|
|
|
|
|
-- 删除核算记录
|
|
update hrsa_salary_acct_record set delete_type=3 where delete_type=0 and id= 核算记录id;
|
|
update hrsa_salary_acct_emp set delete_type=3 where delete_type=0 and salary_acct_record_id=核算记录id;
|
|
update hrsa_salary_acct_result set delete_type=3 where delete_type=0 and salary_acct_record_id = 核算记录id;
|
|
|
|
--删除工资单信息
|
|
update hrsa_salary_send set delete_type=3 where delete_type=0 and salary_accounting_id = 核算记录id;
|
|
update hrsa_salary_send_info set delete_type=3 where delete_type=0 and salary_acct_record_id = 核算记录id;
|
|
|
|
|