dashboard chart UI

This commit is contained in:
phyusin
2017-11-15 13:27:42 +06:30
parent 69fb7fa551
commit 9647a28f91
6 changed files with 114 additions and 279 deletions

View File

@@ -67,13 +67,21 @@ class HomeController < ApplicationController
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
@top_products = Sale.top_products(today)
@top_products = Sale.top_products(today).sum('i.qty')
@hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
# .sum(:grand_total)
@employee_sales = Sale.employee_sales(today).sum(:grand_total)
@inventories = StockJournal.inventory_balances(today).sum(:balance)
#@employee_sales = Hash.new
#employee_sales.each do |key, value|
# if(@employee_sales.has_key? key[1])
# @employee_sales[key[1]].push({key[0] => value})
# else
# @employee_sales[key[1]] = [key[0] => value]
# end
#end
@total_sale = Sale.total_sale(today)
@total_count = Sale.total_count(today)
@total_card = Sale.total_card_sale(today)