Class: DaysController
- Inherits:
-
AuthorizedController
- Object
- AuthorizedController
- DaysController
- Defined in:
- app/controllers/days_controller.rb
Instance Method Summary collapse
-
#calculate_cash ⇒ Object
AJAX methods.
- #create ⇒ Object
Instance Method Details
#calculate_cash ⇒ Object
AJAX methods
8 9 10 11 12 13 14 |
# File 'app/controllers/days_controller.rb', line 8 def calculate_cash bills = params[:cash_register].select { |key, value| key.to_f > 5 } mint = params[:cash_register].select { |key, value| key.to_f <= 5 } @cash = bills.map { |a| a[0].to_f * a[1].to_f }.sum @cash += mint.map { |a| a[1].to_f }.sum end |
#create ⇒ Object
2 3 4 5 |
# File 'app/controllers/days_controller.rb', line 2 def create # Create and redirect to index create! {days_path} end |