@frappe.whitelist()
def get_start_end_dates(payroll_frequency, start_date=None, company=None):
 if ((payroll_frequency == u'Monthly') or (payroll_frequency == u'Bimonthly') or (payroll_frequency == u'')):
  fiscal_year = get_fiscal_year(start_date, company=company)[0]
  month = (u'%02d' % getdate(start_date).month)
  m = get_month_details(fiscal_year, month)
  if (payroll_frequency == u'Bimonthly'):
   if (getdate(start_date).day <= 15):
    start_date = m[u'month_start_date']
    end_date = m[u'month_mid_end_date']
   else:
    start_date = m[u'month_mid_start_date']
    end_date = m[u'month_end_date']
  else:
   start_date = m[u'month_start_date']
   end_date = m[u'month_end_date']
 if (payroll_frequency == u'Weekly'):
  end_date = add_days(start_date, 6)
 if (payroll_frequency == u'Fortnightly'):
  end_date = add_days(start_date, 13)
 if (payroll_frequency == u'Daily'):
  end_date = start_date
 return frappe._dict({u'start_date': start_date, u'end_date': end_date})

@ frappe . whitelist ( ) def get_start_end_dates ( payroll_frequency , start_date = None , company = None ) : if ( ( payroll_frequency == u'Monthly' ) or ( payroll_frequency == u'Bimonthly' ) or ( payroll_frequency == u'' ) ) : fiscal_year = get_fiscal_year ( start_date , company = company ) [ 0 ] month = ( u'%02d' % getdate ( start_date ) . month ) m = get_month_details ( fiscal_year , month ) if ( payroll_frequency == u'Bimonthly' ) : if ( getdate ( start_date ) . day <= 15 ) : start_date = m [ u'month_start_date' ] end_date = m [ u'month_mid_end_date' ] else : start_date = m [ u'month_mid_start_date' ] end_date = m [ u'month_end_date' ] else : start_date = m [ u'month_start_date' ] end_date = m [ u'month_end_date' ] if ( payroll_frequency == u'Weekly' ) : end_date = add_days ( start_date , 6 ) if ( payroll_frequency == u'Fortnightly' ) : end_date = add_days ( start_date , 13 ) if ( payroll_frequency == u'Daily' ) : end_date = start_date return frappe . _dict ( { u'start_date' : start_date , u'end_date' : end_date } )
returns dict of start and end dates for given payroll frequency based on start_date .