update number_formattable

This commit is contained in:
Thein Lin Kyaw
2019-11-28 19:25:52 +06:30
parent 3c5755a028
commit 5b88d16485
2 changed files with 33 additions and 28 deletions

View File

@@ -2,21 +2,20 @@ class Origami::DashboardController < BaseOrigamiController
def index
@shop = Shop.first
today = DateTime.now.strftime('%Y-%m-%d')
@display_type = Lookup.find_by_lookup_type("display_type")
@sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(current_user)
if !@total_payment_methods.nil?
@total_payment_methods.each do |payment|
pay = Sale.payment_sale(payment.payment_method, current_user)
@sale_data.push({payment.payment_method => pay.payment_amount})
end
@total_payment_methods.each do |payment|
pay = Sale.payment_sale(payment.payment_method, current_user)
@sale_data.push({payment.payment_method => pay.payment_amount})
end
else
@sale_data = nil
end
@summ_sale = Sale.summary_sale_receipt(current_user)
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(current_user,@from,@to)
# @total_other_customer = Sale.total_other_customer(today,current_user)
@@ -25,13 +24,13 @@ class Origami::DashboardController < BaseOrigamiController
@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, current_user)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, current_user)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
@total_accounts = @total_accounts.reject.with_index { |x, i| @account_data[i].nil? }
end
@total_accounts = @total_accounts.reject.with_index { |x, i| @account_data[i].nil? }
else
@account_data = nil
end