diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 3f5c310c..71ce212d 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -60,7 +60,7 @@ class Origami::HomeController < BaseOrigamiController accounts = @customer.tax_profiles @account_arr =[] accounts.each do |acc| - account = TaxProfile.find(acc) + account = TaxProfile.find_by_id(acc) if !account.nil? @account_arr.push(account) end @@ -85,7 +85,7 @@ class Origami::HomeController < BaseOrigamiController accounts = @customer.tax_profiles @account_arr =[] accounts.each do |acc| - account = TaxProfile.find(acc) + account = TaxProfile.find_by_id(acc) if !account.nil? @account_arr.push(account) end diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index 0a44ede7..c833c7dd 100755 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -60,7 +60,7 @@ class Origami::RoomsController < BaseOrigamiController accounts = @customer.tax_profiles @account_arr =[] accounts.each do |acc| - account = TaxProfile.find(acc) + account = TaxProfile.find_by_id(acc) if !account.nil? @account_arr.push(account) end @@ -85,7 +85,7 @@ class Origami::RoomsController < BaseOrigamiController accounts = @customer.tax_profiles @account_arr =[] accounts.each do |acc| - account = TaxProfile.find(acc) + account = TaxProfile.find_by_id(acc) if !account.nil? @account_arr.push(account) end diff --git a/app/controllers/reports/credit_payment_controller.rb b/app/controllers/reports/credit_payment_controller.rb index d7567769..ccd2b0b5 100755 --- a/app/controllers/reports/credit_payment_controller.rb +++ b/app/controllers/reports/credit_payment_controller.rb @@ -4,7 +4,7 @@ authorize_resource :class => false @filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']] from, to = get_date_range_from_params - @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) + @shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) @shift = '' if params[:shift_name].to_i != 0 @@ -42,7 +42,7 @@ authorize_resource :class => false def show from, to = get_date_range_from_params - @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) + @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) date_arr = Array.new @sale_data.each do |sale| diff --git a/app/models/sale.rb b/app/models/sale.rb index 824cc671..3fc7824c 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -1926,7 +1926,7 @@ end query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() end else - if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor' + if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' if !from_time.nil? && !to_time.nil? query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") if payment_method == 'card' diff --git a/app/views/reports/receipt_no_detail/index.html.erb b/app/views/reports/receipt_no_detail/index.html.erb index d16139be..50ed0544 100755 --- a/app/views/reports/receipt_no_detail/index.html.erb +++ b/app/views/reports/receipt_no_detail/index.html.erb @@ -127,14 +127,14 @@