change UI and query for dashboard and UI for Origami/Commissions
This commit is contained in:
@@ -82,6 +82,7 @@ class HomeController < ApplicationController
|
||||
|
||||
@sale_data = Array.new
|
||||
@total_payment_methods = Sale.total_payment_methods(today)
|
||||
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
||||
pay = Sale.payment_sale('card', today)
|
||||
@@ -92,7 +93,6 @@ 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)
|
||||
|
||||
@@ -988,7 +988,7 @@ end
|
||||
end
|
||||
|
||||
def self.total_payment_methods(today)
|
||||
query = Sale.select("sp.payment_method")
|
||||
query = Sale.select("distinct sp.payment_method")
|
||||
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
|
||||
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||
end
|
||||
@@ -996,7 +996,7 @@ end
|
||||
def self.payment_sale(payment_method, today)
|
||||
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||
if payment_method == 'card'
|
||||
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb"',today)
|
||||
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb")',today)
|
||||
else
|
||||
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||
end
|
||||
|
||||
@@ -147,7 +147,11 @@
|
||||
<% if payment.payment_method == 'mpu' || payment.payment_method == 'visa' || payment.payment_method == 'master' || payment.payment_method == 'jcb' %>
|
||||
<tr>
|
||||
<td>Card Sale : </td>
|
||||
<td align="right"><%= @sale_data[0]['card'] %></td>
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<%= data["card"] %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<tr>
|
||||
@@ -220,16 +224,16 @@
|
||||
<table class="table">
|
||||
<% if !@total_order.nil? %>
|
||||
<tr>
|
||||
<td>Total Order : </td>
|
||||
<td align="right"><%= @total_order.total_order %></td>
|
||||
<td width="40px">Total Order : </td>
|
||||
<td align="right" width="60px" style="padding: 5px"><%= @total_order.total_order %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% if !(@total_accounts.nil?) %>
|
||||
<% @total_accounts.each do |account| %>
|
||||
<tr>
|
||||
<td><%= account.title %> (Account) : </td>
|
||||
<td align="right">
|
||||
<td width="40px"><%= account.title %> (Account) : </td>
|
||||
<td align="right" width="60px" style="padding: 5px">
|
||||
<% @account_data.each do |data| %>
|
||||
<% acc = account.title %>
|
||||
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
|
||||
@@ -240,15 +244,15 @@
|
||||
<% end %>
|
||||
<% if !@top_items.nil? %>
|
||||
<tr>
|
||||
<td>Top Item : </td>
|
||||
<td align="right"><%= @top_items.item_name %>
|
||||
<br>( <%= @top_items.item_total_price %> )</td>
|
||||
<td width="40px">Top Item : </td>
|
||||
<td align="right" width="60px" style="padding: 5px"><%= @top_items.item_name %>
|
||||
<br>(<%= @top_items.item_total_price %>)</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_foc_items.nil? %>
|
||||
<tr>
|
||||
<td>Total FOC Item : </td>
|
||||
<td align="right"><%= @total_foc_items %></td>
|
||||
<td width="40px">Total FOC Item : </td>
|
||||
<td align="right" width="60px" style="padding: 5px"><%= @total_foc_items %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :method => :post do |f| %>
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<span class="patch_method"></span>
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
@@ -18,7 +20,8 @@
|
||||
|
||||
<button type="button" class="btn btn-inverse pull-right" id='back'> <button type="button" class="btn bg-default btn-block" onclick="window.location.href = "origami_index_in_duty_path(@table.id)"><i class="material-icons">reply</i> Back </button>Back</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<%= simple_form_for([:origami, @in_duty]) do |f| %>
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
|
||||
<br/><br/>
|
||||
@@ -11,4 +12,7 @@
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<br>
|
||||
<%= simple_form_for @in_duty, :url => origami_index_in_duty_path, :method => :post do |f| %>
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<span class="patch_method"></span>
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
@@ -48,6 +50,9 @@
|
||||
<div class="form-actions">
|
||||
<%= f.submit "Create In Duty", :class => 'btn bg-blue' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami,@in_duty]) do |f| %>
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<label>Dining Name:</label>
|
||||
<%= @table.name %>
|
||||
@@ -29,6 +30,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user