diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 63c871d9..9adb6b75 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -30,134 +30,3 @@ function export_to(path) var form_params = $("#frm_report").serialize(); window.location = path+"?"+ form_params; } - -/* -* ToDo Move to here from pages -* -* - - - -$(function(){ - $('#custom_excel').hide(); - - $('#custom_excel').click(function(){ - var url = $('#custom_excel').attr('data-url'); - $('#frm_report').attr('action',url) - $('#frm_report').submit(); - // window.location = url; - }); - - var item = $('#item').val(); - var payment_type = $('#payment_type'); - - if(item == 'order'){ - $('#cashier').hide(); - $('#waiter').show(); - if(payment_type){ - $('#payment_type').hide(); - } - } - else if(item == 'sale'){ - $('#waiter').hide(); - $('#cashier').show(); - } - else{ - $('#waiter').hide(); - $('#cashier').show(); - $("#item").val('sale'); - } -}); - -//Reset the form to pervious values -$("#branch").val(<%=params[:branch]%>); -$("#waiter").val("<%=params[:waiter]%>"); -$("#cashier").val(<%=params[:cashier]%>); -$("#product").val(<%=params[:product]%>); -$("#singer").val(<%=params[:singer]%>); -$("#item").val('<%=params[:item]%>'); -$("#guest_role").val('<%=params[:guest_role]%>'); - - -$("#from").val("<%=params[:from]%>"); -$("#to").val("<%=params[:to]%>"); -$("#sel_period").val(<%=params[:period]%>); -$("#sel_sale_type").val(<%=params[:sale_type]%>); - -<% if params[:period_type] == 1 || params[:period_type] == "1" %> - $("#rd_period_type_1").attr("checked","checked"); -<% else %> - $("#rd_period_type_0").attr("checked","checked"); -<% end %> -$(".btn-group button").removeClass("active"); -<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %> -$("#btn_report_type_<%= report_type %>").addClass("active"); - -$('#item').change(function(){ - var item = $('#item').val(); - var payment_type = $('#payment_type'); - - if(item == 'sale'){ - $('#waiter').hide(); - $('#cashier').show(); - if(payment_type){ - $('#payment_type').show(); - } - } - else{ - $('#cashier').hide(); - $('#waiter').show(); - if(payment_type){ - $('#payment_type').hide(); - } - } -}); - -$(function(){ - var check_arr = []; - var search = '<%= params[:period_type] %>'; - if(search){ - if(parseInt(search) == 0){ - search_by_period(); - } - else{ - search_by_date(); - } - }else{ - search_by_period(); - } - $('#sel_period').change(function(){ - search_by_period(); - }); - function search_by_period(){ - var period = $('#sel_period').val(); - var period_type = 0; - var from = ""; - var to = ""; - } - - $('#from').change(function(){ - search_by_date(); - }); - - $('#to').change(function(){ - search_by_date(); - }); - function search_by_date(){ - var from = $('#from').val(); - var to = $('#to').val(); - var period = 0; - var period_type = 1; - if(to != '' && from != ''){ - shift_name = from + ',' + to; - check_arr.push(to); - // console.log(check_arr.length) - if(check_arr.length == 1){ - } - if(check_arr.length == 3){ - check_arr = []; - } - } - } -}); -*/ diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index d3934eef..012f2bc6 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,13 +1,13 @@ class Crm::HomeController < BaseCrmController def index - @booking = Booking.all - @customer = Customer.all - from = Time.now.beginning_of_day.utc - to = Time.now.end_of_day.utc - @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC') - # redirect_to crm_customers_path - # .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) + @booking = Booking.all + @customer = Customer.all + from = Time.now.beginning_of_day.utc + to = Time.now.end_of_day.utc + @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC') + redirect_to crm_customers_path + # .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index fb42bfee..ead69f39 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -42,9 +42,12 @@ class HomeController < ApplicationController elsif @employee.role == "manager" session[:session_token] = @employee.token_session redirect_to dashboard_path - elsif @employee.role == "accountant" + elsif @employee.role == "supervisour" session[:session_token] = @employee.token_session - redirect_to dashboard_path + redirect_to origami_root_path + elsif @employee.role == "account" + session[:session_token] = @employee.token_session + redirect_to reports_dailysale_index_path else render :index end @@ -96,12 +99,15 @@ class HomeController < ApplicationController redirect_to new_origami_shift_path end elsif employee.role == "manager" - redirect_to oqs_root_path + redirect_to dashboard_path elsif employee.role == "waiter" redirect_to oqs_root_path elsif employee.role == "crm" redirect_to crm_root_path - + elsif @employee.role == "supervisour" + redirect_to origami_root_path + elsif @employee.role == "account" + redirect_to reports_dailysale_index_path end end end diff --git a/app/models/ability.rb b/app/models/ability.rb index f9d98bfc..368aa424 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -104,7 +104,7 @@ class Ability can :manage, DiningQueue - elsif user.role == "accountant" + elsif user.role == "account" can :index, :dailysale can :index, :saleitem @@ -113,11 +113,19 @@ class Ability elsif user.role == "supervisour" - can :index, :dailysale - can :index, :saleitem - can :index, :receipt_no - can :index, :shiftsale + can :edit, :sale_edit + can :item_void, :sale_edit + can :item_edit, :sale_edit + can :item_void_cancel, :sale_edit + can :cancel_all_void, :sale_edit + can :apply_void, :sale_edit + can :overall_void, :void + can :first_bill, :payment + can :create, :payment + can :show, :payment + can :reprint, :payment + can :rounding_adj, :payment end end diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 546e8f82..61f5f0c2 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -6,7 +6,7 @@ class OrderItemPdf < Prawn::Document self.page_height = 1450 self.margin = 0 self.price_width = 40 # No Need for item - self.qty_width = 35 + self.qty_width = 40 self.total_width = 40 # No Need for item self.item_width = self.page_width - (self.qty_width - self.margin) self.item_height = 15 @@ -80,7 +80,7 @@ class OrderItemPdf < Prawn::Document text "#{order_item.item_name}", :size => self.item_font_size,:align => :left end - bounding_box([self.item_width,y_position], :width => self.qty_width) do + bounding_box([self.item_width-4,y_position], :width => self.qty_width) do text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left end diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 6d530058..26a89476 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -68,8 +68,8 @@ class OrderSummaryPdf < Prawn::Document text "Item", :size => self.item_font_size,:align => :left end - bounding_box([self.item_width-2,y_position], :width => self.qty_width, :height => self.item_height) do - text "Qty", :size => self.item_font_size,:align => :left + bounding_box([self.item_width-4,y_position], :width => self.qty_width, :height => self.item_height) do + text "Qty", :size => self.item_font_size,:align => :right end stroke_horizontal_rule @@ -96,8 +96,8 @@ class OrderSummaryPdf < Prawn::Document end - bounding_box([self.item_width,y_position], :width => self.qty_width) do - text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left + bounding_box([self.item_width-4,y_position], :width => self.qty_width) do + text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :right end bounding_box([0,y_position], :width => self.item_width) do diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 87bf3f50..ac20f446 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -24,8 +24,8 @@ -->
-
-
+
+
<% @employees.each do |employee| %> @@ -43,11 +43,111 @@
- <% end %> + <% end %>
+ +
+
+ + +
+
+ +
+
+
    +
  • All Accept
  • +
+
+
+
+
+
+

+ Manager +

+
+
+
+
    +
  • All Accept except Membership and Payment Settings
  • +
+
+
+
+
+
+

+ Supervisor +

+
+
+
+
    +
  • Void
  • +
  • FOC
  • +
  • Edit
  • +
  • Credit
  • +
  • and Payment
  • +
+
+
+
+
+
+

+ Cashier +

+
+
+
+
    +
  • Orgami Panel except Edit and Void
  • +
  • Sale and Order
  • +
  • and Queue in CRM
  • +
+
+
+
+
+
+

+ Accountant +

+
+
+
+
    +
  • Daily Sale Report
  • +
  • Sale Item Report
  • +
  • Receipt No Report
  • +
  • ShiftSale Report
  • +
+
+
+
+
+
+
+ + + + + + + + +