上传的图像用于项目: 'CST技术支持'
  1. CST技术支持
  2. SLAL2-1902

【Pro】报表中心-数据集管理-薪资档案项

XMLWord打印

    • Icon: Change Change
    • 解决结果: 完成
    • Icon: High High
    • 202102
    • T-天猫养车-Y2020052
    • 新康众(天猫养车),PRO S12版本
    • 基础通用功能
    • 隐藏

      sql:
      select base_all.*,
      case
      when base_all.x_builder_salary_code in ('P002','P003','P006','P007','P008','P009','P005','P004') then base_all.P018+base_all.P002+base_all.P004+base_all.P003+base_all.P017
      when base_all.x_builder_salary_code='P004' then base_all.P018 + base_all.P018/21.75*2*4+base_all.P005 + base_all.P004+base_all.P003
      when base_all.x_builder_salary_code='P005' then base_all.P001*2 + base_all.P003
      else 0
      end salary_standard – 薪资标准
      from
      (select
      emp.name emp_name,-- 员工姓名
      emp.employee_number the_employee_number,-- 员工工号
      hr_department.name department_name, – 部门名称
      emp_job.x_businesstitle x_businesstitle,-- 业务头衔
      builder_salary.x_code x_builder_salary_code,
      sum(case when parchc.code='P001' then parch.amount else 0 end) P001,
      sum(case when parchc.code='P002' then parch.amount else 0 end) P002,
      sum(case when parchc.code='P003' then parch.amount else 0 end) P003,
      sum(case when parchc.code='P004' then parch.amount else 0 end) P004,
      sum(case when parchc.code='P005' then parch.amount else 0 end) P005,
      sum(case when parchc.code='P006' then parch.amount else 0 end) P006,
      sum(case when parchc.code='P007' then parch.amount else 0 end) P007,
      sum(case when parchc.code='P008' then parch.amount else 0 end) P008,
      sum(case when parchc.code='P009' then parch.amount else 0 end) P009,
      sum(case when parchc.code='P010' then parch.amount else 0 end) P010,
      sum(case when parchc.code='P011' then parch.amount else 0 end) P011,
      sum(case when parchc.code='P012' then parch.amount else 0 end) P012,
      sum(case when parchc.code='P013' then parch.amount else 0 end) P013,
      sum(case when parchc.code='P013' then parch.amount else 0 end) P014,
      sum(case when parchc.code='P015' then parch.amount else 0 end) P015,
      sum(case when parchc.code='P016' then parch.amount else 0 end) P016,
      sum(case when parchc.code='P017' then parch.amount else 0 end) P017,
      sum(case when parchc.code='P018' then parch.amount else 0 end) P018,
      sum(case when parchc.code='P019' then parch.amount else 0 end) P019,
      sum(case when parchc.code='P020' then parch.amount else 0 end) P020,
      sum(case when parchc.code='P021' then parch.amount else 0 end) P021,
      sum(case when parchc.code='P022' then parch.amount else 0 end) P022
      from
      hr_employee emp
      left join payroll_archive parch on parch.employee_id=emp.id
      and parch.effective_date <= current_date AND
      (parch.expired_date >= current_date OR parch.expired_date IS NULL) AND
      parch.active = True
      left join payroll_archive_config parchc on parch.payroll_item_id=parchc.id
      inner join emp_job on emp.id = emp_job.employee_id and
      emp_job.eroad_index_id IS NOT NULL and
      emp_job.eroad_start_date <= current_date AND
      (emp_job.eroad_end_date >= current_date OR emp_job.eroad_end_date IS NULL) AND
      emp_job.status = 'active' AND
      emp_job.active = TRUE AND
      emp_job.employee_id IS NOT NULL
      left join hr_department on emp_job.department_id = hr_department.id
      left join x_builder_salary_scheme builder_salary on emp_job.x_xzgz=builder_salary.id
      where emp.active=True
      group by emp_name,the_employee_number,department_name,x_businesstitle,x_builder_salary_code) base_all

      显示
      sql: select base_all.*, case when base_all.x_builder_salary_code in ('P002','P003','P006','P007','P008','P009','P005','P004') then base_all.P018+base_all.P002+base_all.P004+base_all.P003+base_all.P017 when base_all.x_builder_salary_code='P004' then base_all.P018 + base_all.P018/21.75*2*4+base_all.P005 + base_all.P004+base_all.P003 when base_all.x_builder_salary_code='P005' then base_all.P001*2 + base_all.P003 else 0 end salary_standard – 薪资标准 from (select emp.name emp_name,-- 员工姓名 emp.employee_number the_employee_number,-- 员工工号 hr_department.name department_name, – 部门名称 emp_job.x_businesstitle x_businesstitle,-- 业务头衔 builder_salary.x_code x_builder_salary_code, sum(case when parchc.code='P001' then parch.amount else 0 end) P001, sum(case when parchc.code='P002' then parch.amount else 0 end) P002, sum(case when parchc.code='P003' then parch.amount else 0 end) P003, sum(case when parchc.code='P004' then parch.amount else 0 end) P004, sum(case when parchc.code='P005' then parch.amount else 0 end) P005, sum(case when parchc.code='P006' then parch.amount else 0 end) P006, sum(case when parchc.code='P007' then parch.amount else 0 end) P007, sum(case when parchc.code='P008' then parch.amount else 0 end) P008, sum(case when parchc.code='P009' then parch.amount else 0 end) P009, sum(case when parchc.code='P010' then parch.amount else 0 end) P010, sum(case when parchc.code='P011' then parch.amount else 0 end) P011, sum(case when parchc.code='P012' then parch.amount else 0 end) P012, sum(case when parchc.code='P013' then parch.amount else 0 end) P013, sum(case when parchc.code='P013' then parch.amount else 0 end) P014, sum(case when parchc.code='P015' then parch.amount else 0 end) P015, sum(case when parchc.code='P016' then parch.amount else 0 end) P016, sum(case when parchc.code='P017' then parch.amount else 0 end) P017, sum(case when parchc.code='P018' then parch.amount else 0 end) P018, sum(case when parchc.code='P019' then parch.amount else 0 end) P019, sum(case when parchc.code='P020' then parch.amount else 0 end) P020, sum(case when parchc.code='P021' then parch.amount else 0 end) P021, sum(case when parchc.code='P022' then parch.amount else 0 end) P022 from hr_employee emp left join payroll_archive parch on parch.employee_id=emp.id and parch.effective_date <= current_date AND (parch.expired_date >= current_date OR parch.expired_date IS NULL) AND parch.active = True left join payroll_archive_config parchc on parch.payroll_item_id=parchc.id inner join emp_job on emp.id = emp_job.employee_id and emp_job.eroad_index_id IS NOT NULL and emp_job.eroad_start_date <= current_date AND (emp_job.eroad_end_date >= current_date OR emp_job.eroad_end_date IS NULL) AND emp_job.status = 'active' AND emp_job.active = TRUE AND emp_job.employee_id IS NOT NULL left join hr_department on emp_job.department_id = hr_department.id left join x_builder_salary_scheme builder_salary on emp_job.x_xzgz=builder_salary.id where emp.active=True group by emp_name,the_employee_number,department_name,x_businesstitle,x_builder_salary_code) base_all

      需求:报表中心-数据集管理
      需要员工薪资档案数据集,获取员工最新且在有效期内的薪资档案数据数据(SQL)其中添加一个计算项字段:薪资标准:
      1、 如果员工的薪资方案规则编码=OR(P002,P003,P006,P007,P008,P009):岗位工资+职务工资+区域补贴+绩效基数+职级工资
      2、如果员工的薪资方案规则编码=P004:岗位工资+岗位工资/21.75*2*4+餐补标准+区域补贴+绩效基数
      3、如果员工的薪资方案规则编码=P005:基本工资*2+绩效基数
      注:
      1、P002,P003,P006,P007,P008,P009,P005,P004为odoo薪资方案规则的编码,每个员工在前台的雇佣信息的薪资模板会绑定一个薪资方案(详细请参考截图)
      2、岗位工资,职务工资,区域补贴,绩效基数,职级工资,餐补标准,基本工资等都是薪资档案项(请参考截图)
      报表字段:
      主数据基础信息:员工工号,员工姓名,部门
      主数据雇佣信息:业务头衔
      薪资档案:薪资档案项,有效期始,有效期止,薪资执行月,金额,薪资标准(根据逻辑计算)

        1. 1614220190(1).jpg
          55 kB
          张治辉
        2. 1614225647(1).jpg
          24 kB
          张治辉
        3. 1614226417(1).jpg
          76 kB
          张治辉
        4. 薪资档案项.jpg
          39 kB
          张治辉
        5. 薪资方案.jpg
          16 kB
          张治辉

            grant.yang 杨光磊
            zhihui.zhang 张治辉
            表决:
            0 为这个问题表决

              创建日期:
              已更新:
              已解决: