daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Register < ActiveRecord::Base
  2.     has_many :additions
  3.    
  4.   def sales_subtotal
  5.     usedbook + newbook + medref + medsup + reference + insignia + coursepack + office + cards + greek + food + giftcard
  6.   end
  7.  
  8.   def sales_subtractions
  9.     shipping + tax + voids + onaccount + refunds + payouts + discounts
  10.   end
  11.  
  12.   def sales_totals
  13.     sales_subtotal - sales_subtractions
  14.   end
  15.  
  16.   def addition_amounts
  17.     self.additions.collect{ |addition| addition.amount }    
  18.   end
  19.  
  20.   def addition_totals
  21.     self.additions_amounts.inject( 0 ) { |sum,x| sum+x }
  22.   end
  23.  
  24. #  def additions
  25. #    additions = @additions.sum
  26. #  end
  27. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top