change dashboard ui

This commit is contained in:
phyusin
2017-11-17 09:56:40 +06:30
parent 384c0f2dd2
commit 4899e624ef
3 changed files with 32 additions and 46 deletions

View File

@@ -91,7 +91,7 @@ class HomeController < ApplicationController
end
end
@summ_sale = Sale.summary_sale_receipt(today)
p @summ_sale
@total_customer = Sale.total_customer(today)
@total_dinein = Sale.total_dinein(today)
@total_takeaway = Sale.total_takeaway(today)

View File

@@ -954,7 +954,7 @@ end
end
def self.summary_sale_receipt(today)
query = Sale.select('count(sale_id) as total_receipt, sum(total_amount) as total_amount, sum(grand_total) as grand_total, sum(total_discount) as total_discount, sum(total_tax) as total_tax')
query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax')
.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
.first()
end

View File

@@ -103,9 +103,9 @@
</div>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<% if !@summ_sale.nil? %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<% if !@summ_sale.nil? %>
<div class="card">
<div class="body">
<h6>Sale</h6>
@@ -157,9 +157,9 @@
</table>
</div>
</div>
<% end %>
</div>
</div>
<% end %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
@@ -168,44 +168,34 @@
<h6>Customer</h6>
<table class="table">
<% if !@total_customer.nil? %>
<% if @total_customer.total_cus > 0 %>
<tr>
<td>Total Customer : </td>
<td align="right"><%= @total_customer.total_cus %></td>
</tr>
<% end %>
<tr>
<td>Total Customer : </td>
<td align="right"><%= @total_customer.total_cus %></td>
</tr>
<% end %>
<% if !@total_dinein.nil? %>
<% if @total_dinein.total_dinein_cus > 0 %>
<tr>
<td>Dine in : </td>
<td align="right"><%= @total_dinein.total_dinein_cus %></td>
</tr>
<% end %>
<tr>
<td>Dine in : </td>
<td align="right"><%= @total_dinein.total_dinein_cus %></td>
</tr>
<% end %>
<% if !@total_takeaway.nil? %>
<% if @total_takeaway.total_take_cus > 0 %>
<tr>
<td>Takeaway : </td>
<td align="right"><%= @total_takeaway.total_take_cus %></td>
</tr>
<% end %>
<tr>
<td>Takeaway : </td>
<td align="right"><%= @total_takeaway.total_take_cus %></td>
</tr>
<% end %>
<% if !@total_other_customer.nil? %>
<% if @total_other_customer.total_cus > 0 %>
<tr>
<td>Customer : </td>
<td align="right"><%= @total_other_customer.total_cus %></td>
</tr>
<% end %>
<tr>
<td>Customer : </td>
<td align="right"><%= @total_other_customer.total_cus %></td>
</tr>
<% end %>
<% if !@total_membership.nil? %>
<% if @total_membership.total_memb_cus > 0 %>
<tr>
<td>Membership : </td>
<td align="right"><%= @total_membership.total_memb_cus %></td>
</tr>
<% end %>
<tr>
<td>Membership : </td>
<td align="right"><%= @total_membership.total_memb_cus %></td>
</tr>
<% end %>
</table>
</div>
@@ -220,12 +210,10 @@
<h6>Order</h6>
<table class="table">
<% if !@total_order.nil? %>
<% if @total_order.total_order > 0 %>
<tr>
<td>Total Order : </td>
<td align="right"><%= @total_order.total_order %></td>
</tr>
<% end %>
<tr>
<td>Total Order : </td>
<td align="right"><%= @total_order.total_order %></td>
</tr>
<% end %>
<% if !(@total_accounts.nil?) %>
@@ -249,12 +237,10 @@
</tr>
<% end %>
<% if !@total_foc_items.nil? %>
<% if @total_foc_items > 0 %>
<tr>
<td>Total FOC Item : </td>
<td align="right"><%= @total_foc_items %></td>
</tr>
<% end %>
<tr>
<td>Total FOC Item : </td>
<td align="right"><%= @total_foc_items %></td>
</tr>
<% end %>
</table>
</div>