remove def total_account from sale

This commit is contained in:
Thein Lin Kyaw
2019-11-18 14:00:52 +06:30
parent 5702819b8b
commit 74e29f7c39
4 changed files with 8 additions and 27 deletions

View File

@@ -134,7 +134,7 @@ class HomeController < ApplicationController
end
@inventories = StockJournal.inventory_balances(today,@from,@to,@from_time,@to_time).sum(:balance)
@total_trans = Sale.total_trans(today,current_user,@from,@to,@from_time,@to_time)
@total_trans = Sale.total_trans(today,current_user,@from,@to,@from_time,@to_time)
@total_card = Sale.total_card_sale(today,current_user,@from,@to,@from_time,@to_time)
@total_credit = Sale.credit_payment(today,current_user,@from,@to,@from_time,@to_time)
@@ -157,15 +157,16 @@ class HomeController < ApplicationController
# @total_other_customer = Sale.total_other_customer(today,current_user)
@total_order = Sale.total_order(today,current_user,@from,@to,@from_time,@to_time)
@total_accounts = Sale.total_account(today,current_user,@from,@to,@from_time,@to_time)
@total_accounts = Account.select("accounts.id as account_id, accounts.title as title")
@account_data = Array.new
if !@total_accounts.nil?
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today,current_user,@from,@to,@from_time,@to_time)
if !acc.nil?
if !acc.nil? && acc.cnt_acc > 0
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
end
@total_accounts = @total_accounts.reject.with_index { |x, i| @account_data[i].nil? }
end
@top_items = Sale.top_items(today,current_user,@from,@to,@from_time,@to_time)