XMLWord打印

    • Icon: 任务 任务
    • 解决结果: 完成
    • Icon: Medium Medium
    • 202004
    • Y-易路产品-
    • 依图
    • 薪酬管理
    • 隐藏

      新建一个普通公式,函数编码:F_MealAllowance

      def F_MealAllowance():
          result = 0
          departure_time = str(individual_dict['ref_departure_time'])
          departure_time_ = datetime.datetime.strptime(
              departure_time, '%Y-%m-%d') if departure_time else None
          hire_date = str(individual_dict['ref_hire_date'])
          hire_date_ = datetime.datetime.strptime(hire_date,
                                                  '%Y-%m-%d') if hire_date else None
          date_end = global_dict['ref_date_end']
          date_start = global_dict['ref_date_start']
      
          current_perid_date_start = datetime.datetime.strptime(
              date_start, '%Y-%m-%d')
          current_perid_date_end = datetime.datetime.strptime(date_end, '%Y-%m-%d')
          last_month_date_start = current_perid_date_start + relativedelta.relativedelta(
              months=-1)
          last_month = last_month_date_start.replace(day=28) + datetime.timedelta(
              days=4)
          last_month_date_end = last_month - datetime.timedelta(days=last_month.day)
          
          if departure_time_:
              # 4/1~4/30; 4/1~4/29号离职
              if hire_date_<current_perid_date_start<=departure_time_<current_perid_date_end:
                  in_service_days = (departure_time_ - current_perid_date_start).days + 1
                  result = 3000 / 30 * in_service_days
          
              # 4/1~4/30; 4/2~4/30号入职
              elif current_perid_date_start<hire_date_<=current_perid_date_end<departure_time_:
                  in_service_days = (current_perid_date_end - hire_date_).days + 1
                  result = 3000 / 30 * in_service_days
                 
              # 4/1~4/30; 4/2入职,4/29离职
              elif current_perid_date_start<hire_date_<departure_time_<current_perid_date_end:
                  in_service_days = (departure_time_ - hire_date_).days + 1
                  result = 3000 / 30 * in_service_days
                  
              else:
                  result = 3000
                 
          else:
              if current_perid_date_start<hire_date_<=current_perid_date_end:
                  in_service_days = (current_perid_date_end - hire_date_).days + 1
                  result = 3000 / 30 * in_service_days   
                 
              else:
                  result = 3000
          
          return result
      
      显示
      新建一个普通公式,函数编码:F_MealAllowance def F_MealAllowance(): result = 0 departure_time = str(individual_dict[ 'ref_departure_time' ]) departure_time_ = datetime.datetime.strptime( departure_time, '%Y-%m-%d' ) if departure_time else None hire_date = str(individual_dict[ 'ref_hire_date' ]) hire_date_ = datetime.datetime.strptime(hire_date, '%Y-%m-%d' ) if hire_date else None date_end = global_dict[ 'ref_date_end' ] date_start = global_dict[ 'ref_date_start' ] current_perid_date_start = datetime.datetime.strptime( date_start, '%Y-%m-%d' ) current_perid_date_end = datetime.datetime.strptime(date_end, '%Y-%m-%d' ) last_month_date_start = current_perid_date_start + relativedelta.relativedelta( months=-1) last_month = last_month_date_start.replace(day=28) + datetime.timedelta( days=4) last_month_date_end = last_month - datetime.timedelta(days=last_month.day) if departure_time_: # 4/1~4/30; 4/1~4/29号离职 if hire_date_<current_perid_date_start<=departure_time_<current_perid_date_end: in_service_days = (departure_time_ - current_perid_date_start).days + 1 result = 3000 / 30 * in_service_days # 4/1~4/30; 4/2~4/30号入职 elif current_perid_date_start<hire_date_<=current_perid_date_end<departure_time_: in_service_days = (current_perid_date_end - hire_date_).days + 1 result = 3000 / 30 * in_service_days # 4/1~4/30; 4/2入职,4/29离职 elif current_perid_date_start<hire_date_<departure_time_<current_perid_date_end: in_service_days = (departure_time_ - hire_date_).days + 1 result = 3000 / 30 * in_service_days else : result = 3000 else : if current_perid_date_start<hire_date_<=current_perid_date_end: in_service_days = (current_perid_date_end - hire_date_).days + 1 result = 3000 / 30 * in_service_days else : result = 3000 return result

      发放餐补时,每月3000元,按照30天计算
      如果员工有当月入离职且入职日期不等于2月1日或者离职日期不等于2月28日/29日
      按照3000/30*在公司天数

      非当月入离职或者入职日期等于2月1日或者离职日期等于2月28日/29日
      按照3000计算

      回算时按照3000/30*在公司天数
      比如3月20日的,在4月份计算餐补时,12*3000/30+3000

            chengdd 程丹丹
            elem.fang 方钱进
            表决:
            0 为这个问题表决

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