Rework the get_earnings() helper in EDD_Payment_Stats for #1977