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

【艾迈柯思】收入证明占位符创建

XMLWord打印

    • Icon: Change Change
    • 解决结果: 完成
    • Icon: Medium Medium
    • 202105
    • A-艾迈柯思-Y2021018
    • ammextest
    • 基础通用功能
    • 隐藏

      代码:
      税前年薪:
      display_name = '当月税前项Gross Income'
      result = 0
      employee_id = record.employee_id.id
      env.cr.execute("""select peiwi.employee_id,sum(peiwi.value) value_display
      from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      left join
      (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      group by peiwi.employee_id) pm
      on peiwi.employee_id=pm.employee_id
      where pi.payroll_month>=pm.payroll_month::timestamp + '-12 month'
      and pi.payroll_month<=pm.payroll_month
      and peiwi.display = '{}'
      and peiwi.employee_id={}
      group by peiwi.employee_id
      order by
      limit 1""".format(display_name,employee_id))
      shyx = env.cr.fetchone()
      if shyx:
      result = shyx[1]

      =======================
      税前月薪:
      display_name = '测试'
      result = 0
      employee_id = record.employee_id.id
      env.cr.execute("""select peiwi.employee_id,sum(cast(peiwi.value_display as float)) value_display
      from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      left join
      (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      group by peiwi.employee_id) pm
      on peiwi.employee_id=pm.employee_id
      where pi.payroll_month=pm.payroll_month
      and peiwi.display = '{}'
      and peiwi.employee_id={}
      group by peiwi.employee_id
      limit 1""".format(display_name,employee_id))
      sqyx = env.cr.fetchone()
      if sqyx:
      result = sqyx[1]
      ==========================
      税后年薪:
      display_name = '当月实发工资 Net Pay'
      result = 0
      employee_id = record.employee_id.id
      env.cr.execute("""select peiwi.employee_id,sum(peiwi.value) value_display
      from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      left join
      (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      group by peiwi.employee_id) pm
      on peiwi.employee_id=pm.employee_id
      where pi.payroll_month>=pm.payroll_month::timestamp + '-12 month'
      and pi.payroll_month<=pm.payroll_month
      and peiwi.display = '{}'
      and peiwi.employee_id={}
      group by peiwi.employee_id
      order by
      limit 1""".format(display_name,employee_id))
      shyx = env.cr.fetchone()
      if shyx:
      result = shyx[1]
      =============
      税后月薪:
      display_name = '当月实发工资 Net Pay'
      result = 0
      employee_id = record.employee_id.id
      env.cr.execute("""select peiwi.employee_id,sum(peiwi.value) value_display
      from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      left join
      (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi
      left join payslip_info pi on pi.id=peiwi.payslip_info_id
      group by peiwi.employee_id) pm
      on peiwi.employee_id=pm.employee_id
      where pi.payroll_month=pm.payroll_month
      and peiwi.display = '{}'
      and peiwi.employee_id={}
      group by peiwi.employee_id
      limit 1""".format(display_name,employee_id))
      shyx = env.cr.fetchone()
      if shyx:
      result = shyx[1]

      显示
      代码: 税前年薪: display_name = '当月税前项Gross Income' result = 0 employee_id = record.employee_id.id env.cr.execute("""select peiwi.employee_id,sum(peiwi.value) value_display from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id left join (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id group by peiwi.employee_id) pm on peiwi.employee_id=pm.employee_id where pi.payroll_month>=pm.payroll_month::timestamp + '-12 month' and pi.payroll_month<=pm.payroll_month and peiwi.display = '{}' and peiwi.employee_id={} group by peiwi.employee_id order by limit 1""".format(display_name,employee_id)) shyx = env.cr.fetchone() if shyx: result = shyx [1] ======================= 税前月薪: display_name = '测试' result = 0 employee_id = record.employee_id.id env.cr.execute("""select peiwi.employee_id,sum(cast(peiwi.value_display as float)) value_display from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id left join (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id group by peiwi.employee_id) pm on peiwi.employee_id=pm.employee_id where pi.payroll_month=pm.payroll_month and peiwi.display = '{}' and peiwi.employee_id={} group by peiwi.employee_id limit 1""".format(display_name,employee_id)) sqyx = env.cr.fetchone() if sqyx: result = sqyx [1] ========================== 税后年薪: display_name = '当月实发工资 Net Pay' result = 0 employee_id = record.employee_id.id env.cr.execute("""select peiwi.employee_id,sum(peiwi.value) value_display from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id left join (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id group by peiwi.employee_id) pm on peiwi.employee_id=pm.employee_id where pi.payroll_month>=pm.payroll_month::timestamp + '-12 month' and pi.payroll_month<=pm.payroll_month and peiwi.display = '{}' and peiwi.employee_id={} group by peiwi.employee_id order by limit 1""".format(display_name,employee_id)) shyx = env.cr.fetchone() if shyx: result = shyx [1] ============= 税后月薪: display_name = '当月实发工资 Net Pay' result = 0 employee_id = record.employee_id.id env.cr.execute("""select peiwi.employee_id,sum(peiwi.value) value_display from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id left join (select peiwi.employee_id, max(pi.payroll_month) payroll_month from payslip_employee_info_wage_item peiwi left join payslip_info pi on pi.id=peiwi.payslip_info_id group by peiwi.employee_id) pm on peiwi.employee_id=pm.employee_id where pi.payroll_month=pm.payroll_month and peiwi.display = '{}' and peiwi.employee_id={} group by peiwi.employee_id limit 1""".format(display_name,employee_id)) shyx = env.cr.fetchone() if shyx: result = shyx [1]

      收入证明添加四个占位符:税前月薪、税后月薪、税前年薪、税后年薪 从客户导入的工资单里取数.

      工资单明细表:select * from payslip_employee_info_wage_item

      税前月薪 = select value_display from payslip_employee_info_wage_item where display = ‘当月税前项Gross Income’ (薪资期间要取最近一个月,薪资期间在payslip_employee_info_wage_item表里没有,需要先帮忙查下是在哪个表里,下同)

      税后月薪 = select value_display from payslip_employee_info_wage_item where display = ‘当月实发工资 Net Pay’ (薪资期间要取最近一个月)

      税前年薪 = 根据薪资期间向前累计12个月的“税前月薪”,如该员工历史记录不满12月则以实际月数为准

      税后年薪 = 根据薪资期间向前累计12个月的“税后月薪”,如该员工历史记录不满12月则以实际月数为准

            grant.yang 杨光磊
            evan.zhang 张鹏远
            表决:
            0 为这个问题表决

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