diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index e0667a83..8c3d7cc4 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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) diff --git a/app/models/sale.rb b/app/models/sale.rb index 83d49309..efe63e12 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -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 diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 1bf5bf88..f6dd86b8 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -147,7 +147,11 @@ <% if payment.payment_method == 'mpu' || payment.payment_method == 'visa' || payment.payment_method == 'master' || payment.payment_method == 'jcb' %> Card Sale : - <%= @sale_data[0]['card'] %> + + <% @sale_data.each do |data| %> + <%= data["card"] %> + <% end %> + <% else %> @@ -220,16 +224,16 @@ <% if !@total_order.nil? %> - - + + <% end %> <% if !(@total_accounts.nil?) %> <% @total_accounts.each do |account| %> - - + - - + + <% end %> <% if !@total_foc_items.nil? %> - - + + <% end %>
Total Order : <%= @total_order.total_order %>Total Order : <%= @total_order.total_order %>
<%= account.title %> (Account) : + <%= account.title %> (Account) : <% @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? %>
Top Item : <%= @top_items.item_name %> -
( <%= @top_items.item_total_price %> )
Top Item : <%= @top_items.item_name %> +
(<%= @top_items.item_total_price %>)
Total FOC Item : <%= @total_foc_items %>Total FOC Item : <%= @total_foc_items %>
diff --git a/app/views/origami/in_duties/_assign_in_duty.html.erb b/app/views/origami/in_duties/_assign_in_duty.html.erb index 1dfe82b6..2a58a9b9 100755 --- a/app/views/origami/in_duties/_assign_in_duty.html.erb +++ b/app/views/origami/in_duties/_assign_in_duty.html.erb @@ -1,24 +1,27 @@ <%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :method => :post do |f| %> - - <%= f.error_notification %> - <%= f.hidden_field :id, :class => "form-control col-md-6 " %> +
+
+ + <%= f.error_notification %> + <%= f.hidden_field :id, :class => "form-control col-md-6 " %> -
- <%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %> - - <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %> - <%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %> - <%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %> -

+
+ <%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %> + + <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %> + <%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %> + <%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %> +

-
- <%= f.button :submit, "Create", :class => 'btn btn-primary ', :id => 'create' %> - <%= f.button :submit, "Update", :class => 'btn btn-primary ', :disabled => '', :id => 'update' %> - <%= f.button :button, "Reset", :class => 'btn btn-danger ', :id => 'reset' %> +
+ <%= f.button :submit, "Create", :class => 'btn btn-primary ', :id => 'create' %> + <%= f.button :submit, "Update", :class => 'btn btn-primary ', :disabled => '', :id => 'update' %> + <%= f.button :button, "Reset", :class => 'btn btn-danger ', :id => 'reset' %> - Back + Back +
- +
<% end %> diff --git a/app/views/origami/in_duties/_edit_in_duty.html.erb b/app/views/origami/in_duties/_edit_in_duty.html.erb index 41a492eb..d52a123b 100755 --- a/app/views/origami/in_duties/_edit_in_duty.html.erb +++ b/app/views/origami/in_duties/_edit_in_duty.html.erb @@ -1,14 +1,18 @@ <%= simple_form_for([:origami, @in_duty]) do |f| %> - <%= f.error_notification %> +
+
+ <%= f.error_notification %> +
+ <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %> +

+ <%= f.input :in_time %> + <%= f.input :out_time %> +
-
- <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %> -

- <%= f.input :in_time %> - <%= f.input :out_time %> -
- -
- <%= f.button :submit %> +
+ <%= f.button :submit %> +
+
+ <% end %> diff --git a/app/views/origami/in_duties/_form.html.erb b/app/views/origami/in_duties/_form.html.erb index c4890e4a..272d1bb3 100755 --- a/app/views/origami/in_duties/_form.html.erb +++ b/app/views/origami/in_duties/_form.html.erb @@ -1,5 +1,7 @@
<%= simple_form_for @in_duty, :url => origami_index_in_duty_path, :method => :post do |f| %> +
+
<%= f.error_notification %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %> @@ -10,52 +12,55 @@
- -
- -
- - date_range - - <% if !@in_duty.in_time.nil?%> - - <% else %> - - <% end %> -
+ <%= f.input :out_time, :placeholder => "To Date", :class => "form-control datetimepicker" %>--> + +
+ +
+ + date_range + + <% if !@in_duty.in_time.nil?%> + + <% else %> + + <% end %>
-
- -
- - date_range - - <% if !@in_duty.out_time.nil?%> - - <% else %> - - <% end %> -
-
-

- +
- <% f.button :submit, "Create", :class => 'btn bg-blue ', :id => 'create' %> - <% f.button :submit, "Update", :class => 'btn bg-blue ', :disabled => '', :id => 'update' %> - <% f.button :button, "Reset", :class => 'btn bg-danger ', :id => 'reset' %> -
-
- <%= f.submit "Create In Duty", :class => 'btn bg-blue' %> + +
+ + date_range + + <% if !@in_duty.out_time.nil?%> + + <% else %> + + <% end %> +
+

+ +
+ <% f.button :submit, "Create", :class => 'btn bg-blue ', :id => 'create' %> + <% f.button :submit, "Update", :class => 'btn bg-blue ', :disabled => '', :id => 'update' %> + <% f.button :button, "Reset", :class => 'btn bg-danger ', :id => 'reset' %> +
+
+ <%= f.submit "Create In Duty", :class => 'btn bg-blue' %> +
+
+
+ <% end %> diff --git a/app/views/origami/in_duties/assign_in_duty.html.erb b/app/views/origami/in_duties/assign_in_duty.html.erb index 16e32dc7..f24b16d9 100755 --- a/app/views/origami/in_duties/assign_in_duty.html.erb +++ b/app/views/origami/in_duties/assign_in_duty.html.erb @@ -4,31 +4,34 @@
<%= simple_form_for([:origami,@in_duty]) do |f| %> - <%= f.error_notification %> - -
- - <%= @table.name %> -
-
- - - <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>

- - <%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
- - <%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%> -

-
-
-
- <%= link_to 'Back', origami_index_in_duty_path(@table.id), class: 'btn bg-default' %> -
-
- -
-
-
+
+
+ <%= f.error_notification %> +
+ + <%= @table.name %> +
+
+ + + <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>

+ + <%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
+ + <%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%> +

+
+
+
+ <%= link_to 'Back', origami_index_in_duty_path(@table.id), class: 'btn bg-default' %> +
+
+ +
+
+
+
+
<% end %>