diff --git a/app/views/origami/commissioners/_form.html.erb b/app/views/origami/commissioners/_form.html.erb
deleted file mode 100644
index b72be528..00000000
--- a/app/views/origami/commissioners/_form.html.erb
+++ /dev/null
@@ -1,21 +0,0 @@
-
- <%= simple_form_for([:origami, @commissioner]) do |f| %>
- <%= f.error_notification %>
-
-
- <%= f.input :name %>
- <%= f.label :emp_id %>
- <%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
- <%= f.label :commission_type %>
- <%= f.select :commission_type, Commission.all.map{ |l| [l.menu_item.name, l.id] } %>
-
- <%= f.check_box :is_active %> Active
-
-
-
-
- <%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
- <%= f.button :submit, class: 'btn btn-info' %>
-
- <% end %>
-
diff --git a/app/views/origami/commissioners/show.html.erb b/app/views/origami/commissioners/show.html.erb
deleted file mode 100644
index 6f248764..00000000
--- a/app/views/origami/commissioners/show.html.erb
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
Commissioner
-
-
-
-
-
- Name
- <%= @commissioner.name %>
-
-
- Employee Name
-
- <%= @commissioner.employee.name rescue '-' %>
-
-
-
- Commission Type
- <%= @commissioner.commission.menu_item.name rescue '-' %>
-
-
- Active
- <%= @commissioner.is_active %>
-
-
- Created By
- <%= Employee.find(@commissioner.created_by).name %>
-
-
-
- <%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
- <%= link_to 'Edit', edit_origami_commissioner_path(@commissioner), class: 'btn btn-info' %>
- <%= link_to 'Destroy', origami_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
-
-
-
-
diff --git a/app/views/origami/in_juties/_assign_in_juty.html.erb b/app/views/origami/in_juties/_assign_in_juty.html.erb
index f2f0ed16..258c5eb7 100644
--- a/app/views/origami/in_juties/_assign_in_juty.html.erb
+++ b/app/views/origami/in_juties/_assign_in_juty.html.erb
@@ -1,9 +1,12 @@
-<%= simple_form_for @in_juty,:url => origami_create_for_in_juty_path, :method => :post do |f| %>
+<%= 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.hidden_field :dinning_id,:value => @table.id, :class => "form-control col-md-6 " %>
+
Dining Name:
<%= @table.name %>
@@ -12,14 +15,14 @@
Commissioner Name:
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
In time
- <%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
+ <%= f.text_field :in_time, :value=>'',:class=>"form-control datepicker"%>
Out time
- <%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
+ <%= f.text_field :out_time, :value=>'',:class=>"form-control datepicker"%>
<%= f.button :submit, "Create",:class => 'btn btn-primary ', :id => 'create' %>
- <%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'disabled', :id => 'update' %>
+ <%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update' %>
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
@@ -30,11 +33,18 @@
$(function() {
$('.datepicker').datepicker({
- format : 'dd-mm-yyyy',
+ format : 'yyyy-mm-dd',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
+$('#reset').click(function() {
+
+ // window.location.href = '/origami/assign_in_juty/'+ table_id;
+ location.reload();
+
+ return false;
+ });
\ No newline at end of file
diff --git a/app/views/origami/in_juties/_edit_in_juty.html.erb b/app/views/origami/in_juties/_edit_in_juty.html.erb
index a2405f58..9eaf8353 100644
--- a/app/views/origami/in_juties/_edit_in_juty.html.erb
+++ b/app/views/origami/in_juties/_edit_in_juty.html.erb
@@ -2,8 +2,7 @@
<%= f.error_notification %>
- <%= f.input :dinning_id %>
- <%= f.input :commissioner_ids %>
+ <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
<%= f.input :in_time %>
<%= f.input :out_time %>
diff --git a/app/views/origami/in_juties/index_in_juty.html.erb b/app/views/origami/in_juties/index_in_juty.html.erb
index 0141af05..2ac1048e 100644
--- a/app/views/origami/in_juties/index_in_juty.html.erb
+++ b/app/views/origami/in_juties/index_in_juty.html.erb
@@ -4,6 +4,7 @@
+ Select
Dining Facility Name
Commissioner Ids
In time
@@ -21,13 +22,12 @@
<%= in_juty.commissioner.name rescue '-' %>
<%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %>
<%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %>
- <%= link_to 'Back', origami_path(in_juty.dining_facility.id) %>
- <%= link_to 'Edit', origami_edit_in_juty_path(in_juty.dining_facility.id,in_juty) %>
<%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id,in_juty),method: :delete, data: {confirm: 'Are you sure?'} %>
<% end %>
+ <%= paginate @juties_in %>
@@ -35,40 +35,45 @@
+
+Back
+
\ No newline at end of file
diff --git a/app/views/reports/commission/_commission_report_filter.html.erb b/app/views/reports/commission/_commission_report_filter.html.erb
new file mode 100644
index 00000000..ff1a044b
--- /dev/null
+++ b/app/views/reports/commission/_commission_report_filter.html.erb
@@ -0,0 +1,119 @@
+
+
+ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
+ <% if period_type != false %>
+
+
+ Select Period
+
+ Today
+ Yesterday
+ This week
+ Last week
+ Last 7 days
+ This month
+ Last month
+ Last 30 days
+ This year
+ Last year
+
+
+
+
+
+ From
+
+
+
+ To
+
+
+
+ All Shift
+
+
+
+
+
+
+
+ <% end %>
+
+ <% end %>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/reports/commission/index.html.erb b/app/views/reports/commission/index.html.erb
new file mode 100644
index 00000000..9f75c8d5
--- /dev/null
+++ b/app/views/reports/commission/index.html.erb
@@ -0,0 +1,211 @@
+
+
+
+ <%= render :partial=>'commission_report_filter',
+ :locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_commission_index_path} %>
+
+
+
+
+
+
+
+
+
+
+
+
+ From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
+ - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
+
+
+
+ <% if @shift_from %>
+
+ <% if @shift_data.employee %>
+ <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
+ <% end %>
+ Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
+
+ <% end %>
+
+ Cashier Station
+ Cashier Name
+ Shift Name
+
+ Cash Payment
+
+ Credit Payment
+
+ Other Payment
+
+
+ Grand Total
+
+
+
+ <% void = 0%>
+ <% cash = 0%>
+ <% credit = 0%>
+ <% accept_credit = 0%>
+ <% foc = 0%>
+ <% card = 0%>
+ <% total = 0%>
+ <% rounding_adj = 0%>
+ <% g_total = 0 %>
+
+ <% @sale_data.each do |result|%>
+
+
+ <%= result.cashier_terminal.name rescue '-'%>
+
+
+ <%= result.employee.name rescue '-'%>
+
+ <%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
+ <%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
+
+
+ <%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%>
+ <%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%>
+
+
+ <%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%>
+ <%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%>
+
+
+ <% grand_total = result.grand_total.to_f %>
+
+
+ <% cash += result.cash_sales.to_f %>
+ <% credit += result.credit_sales.to_f %>
+ <% card += result.other_sales.to_f %>
+
+ <% total += result.grand_total.to_f %>
+ <% g_total += grand_total.to_f %>
+
+ <% end %>
+
+
+
+
+ <%= sprintf("%.2f",cash) rescue '-'%>
+ <%= sprintf("%.2f",credit) rescue '-'%>
+
+
+ <%= sprintf("%.2f",card) rescue '-'%>
+
+
+ <%= sprintf("%.2f",g_total) rescue '-'%>
+
+
+
+
+
+
+
+
+
diff --git a/app/views/reports/commission/index.xls.erb b/app/views/reports/commission/index.xls.erb
new file mode 100644
index 00000000..e3daaca2
--- /dev/null
+++ b/app/views/reports/commission/index.xls.erb
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+ From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
+ - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
+
+
+
+ <% if @shift_from %>
+
+ <% if @shift_data.employee %>
+ <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
+ <% end %>
+ Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
+
+ <% end %>
+
+
+ Cashier Station
+ Cashier Name
+ Shift Name
+
+ Cash Payment
+
+ Credit Payment
+
+ Other Payment
+
+
+ Grand Total
+
+
+
+ <% void = 0%>
+ <% cash = 0%>
+ <% credit = 0%>
+ <% accept_credit = 0%>
+ <% foc = 0%>
+ <% card = 0%>
+ <% total = 0%>
+ <% rounding_adj = 0%>
+ <% g_total = 0 %>
+
+ <% @sale_data.each do |result|%>
+
+
+ <%= result.cashier_terminal.name rescue '-'%>
+
+
+ <%= result.employee.name rescue '-'%>
+
+ <%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
+ <%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
+
+
+ <%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%>
+ <%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%>
+
+
+ <%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%>
+ <%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%>
+
+
+ <% grand_total = result.grand_total.to_f %>
+
+
+ <% cash += result.cash_sales.to_f %>
+ <% credit += result.credit_sales.to_f %>
+ <% card += result.other_sales.to_f %>
+
+ <% total += result.grand_total.to_f %>
+ <% g_total += grand_total.to_f %>
+
+ <% end %>
+
+
+
+
+ <%= sprintf("%.2f",cash) rescue '-'%>
+ <%= sprintf("%.2f",credit) rescue '-'%>
+
+
+ <%= sprintf("%.2f",card) rescue '-'%>
+
+
+ <%= sprintf("%.2f",g_total) rescue '-'%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/origami/commissioners/_commissioner.json.jbuilder b/app/views/settings/commissioners/_commissioner.json.jbuilder
similarity index 100%
rename from app/views/origami/commissioners/_commissioner.json.jbuilder
rename to app/views/settings/commissioners/_commissioner.json.jbuilder
diff --git a/app/views/settings/commissioners/_form.html.erb b/app/views/settings/commissioners/_form.html.erb
new file mode 100644
index 00000000..e2d9d120
--- /dev/null
+++ b/app/views/settings/commissioners/_form.html.erb
@@ -0,0 +1,42 @@
+
+ <%= simple_form_for([:settings, @commissioner]) do |f| %>
+ <%= f.error_notification %>
+
+
+ <%= f.input :name %>
+ <%= f.label :emp_id, 'Employee' %>
+ <%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
+
+ <%= f.label :commission_id, 'Commission' %>
+ <%= f.select :commission_id, Commission.all.map {|l| [l.menu_item.name, l.id]}, {prompt: 'Select a Product'}, {class: 'form-control'} %>
+
+ <%= f.label :joined_date %>
+ <%= f.text_field :joined_date, {class: 'form-control', id: 'joined_date', readonly: true} %>
+ <%= f.label :resigned_date %>
+ <%= f.text_field :resigned_date, {class: 'form-control', id: 'resigned_date', readonly: true} %>
+ <%= f.check_box :is_active %> Active
+
+
+
+
+ <%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
+ <%= f.button :submit, class: 'btn btn-info' %>
+
+ <% end %>
+
+
+
diff --git a/app/views/origami/commissioners/edit.html.erb b/app/views/settings/commissioners/edit.html.erb
similarity index 57%
rename from app/views/origami/commissioners/edit.html.erb
rename to app/views/settings/commissioners/edit.html.erb
index ea5c44cd..a495cbac 100644
--- a/app/views/origami/commissioners/edit.html.erb
+++ b/app/views/settings/commissioners/edit.html.erb
@@ -1,8 +1,8 @@
diff --git a/app/views/origami/commissioners/index.html.erb b/app/views/settings/commissioners/index.html.erb
similarity index 52%
rename from app/views/origami/commissioners/index.html.erb
rename to app/views/settings/commissioners/index.html.erb
index dfef0320..e6c1fdc9 100644
--- a/app/views/origami/commissioners/index.html.erb
+++ b/app/views/settings/commissioners/index.html.erb
@@ -1,9 +1,9 @@
@@ -16,8 +16,10 @@
Name
Employee Name
Commission type
+
Joined Date
+
Resigned Date
Active
-
+
@@ -29,10 +31,12 @@
<%= commissioner.employee.name rescue '-' %>
<%= commissioner.commission.menu_item.name rescue '-' %>
+
<%= commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %>
+
<%= commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %>
<%= commissioner.is_active %>
-
<%= link_to 'Show', origami_commissioner_path(commissioner) %>
-
<%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %>
-
<%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %>
+
<%= link_to 'Show', settings_commissioner_path(commissioner) %>
+
<%= link_to 'Edit', edit_settings_commissioner_path(commissioner) %>
+
<%= link_to 'Destroy', settings_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %>
<% end %>
diff --git a/app/views/origami/commissioners/index.json.jbuilder b/app/views/settings/commissioners/index.json.jbuilder
similarity index 100%
rename from app/views/origami/commissioners/index.json.jbuilder
rename to app/views/settings/commissioners/index.json.jbuilder
diff --git a/app/views/origami/commissioners/new.html.erb b/app/views/settings/commissioners/new.html.erb
similarity index 53%
rename from app/views/origami/commissioners/new.html.erb
rename to app/views/settings/commissioners/new.html.erb
index ea737022..cfdbbe30 100644
--- a/app/views/origami/commissioners/new.html.erb
+++ b/app/views/settings/commissioners/new.html.erb
@@ -1,8 +1,8 @@
diff --git a/app/views/settings/commissioners/show.html.erb b/app/views/settings/commissioners/show.html.erb
new file mode 100644
index 00000000..7f2005c6
--- /dev/null
+++ b/app/views/settings/commissioners/show.html.erb
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ <%= @commissioner.name %>
+
+
+ Employee Name
+ <%= @commissioner.employee.name rescue '-' %>
+
+
+ Commission Type
+ <%= @commissioner.commission.menu_item.name rescue '-' %>
+
+
+ Joined Date
+ <%= @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %>
+
+
+ Resigned Date
+ <%= @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %>
+
+
+ Active
+ <%= @commissioner.is_active %>
+
+
+ Created By
+ <%= Employee.find(@commissioner.created_by).name %>
+
+
+
+ <%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
+ <%= link_to 'Edit', edit_settings_commissioner_path(@commissioner), class: 'btn btn-info' %>
+ <%= link_to 'Destroy', settings_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
+
+
+
+
+
+
+
+
+
+
+
+ <%= 'Product Type' %>
+ <%= 'Product Name' %>
+ <%= 'Qty' %>
+ <%= 'Price' %>
+ <%= 'Amount' %>
+ <%= 'Date' %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/origami/commissioners/show.json.jbuilder b/app/views/settings/commissioners/show.json.jbuilder
similarity index 100%
rename from app/views/origami/commissioners/show.json.jbuilder
rename to app/views/settings/commissioners/show.json.jbuilder
diff --git a/app/views/origami/commissions/_commission.json.jbuilder b/app/views/settings/commissions/_commission.json.jbuilder
similarity index 100%
rename from app/views/origami/commissions/_commission.json.jbuilder
rename to app/views/settings/commissions/_commission.json.jbuilder
diff --git a/app/views/origami/commissions/_form.html.erb b/app/views/settings/commissions/_form.html.erb
similarity index 58%
rename from app/views/origami/commissions/_form.html.erb
rename to app/views/settings/commissions/_form.html.erb
index 5077f946..2ec9c115 100644
--- a/app/views/origami/commissions/_form.html.erb
+++ b/app/views/settings/commissions/_form.html.erb
@@ -1,17 +1,17 @@
-<%= simple_form_for([:origami,@commission]) do |f| %>
+<%= simple_form_for([:settings,@commission]) do |f| %>
<%= f.error_notification %>
- <%= f.label :product_id %>
- <%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %>
- <%= f.input :amount %>
+ <%= f.label :product_code, 'Product' %>
+ <%= f.collection_select :product_code, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %>
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
+ <%= f.input :amount %>
<%= f.check_box :is_active %> Active
- <%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
+ <%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
<% end %>
diff --git a/app/views/origami/commissions/edit.html.erb b/app/views/settings/commissions/edit.html.erb
similarity index 54%
rename from app/views/origami/commissions/edit.html.erb
rename to app/views/settings/commissions/edit.html.erb
index f3b72f3d..ab93e2bc 100644
--- a/app/views/origami/commissions/edit.html.erb
+++ b/app/views/settings/commissions/edit.html.erb
@@ -1,8 +1,8 @@
diff --git a/app/views/origami/commissions/index.html.erb b/app/views/settings/commissions/index.html.erb
similarity index 62%
rename from app/views/origami/commissions/index.html.erb
rename to app/views/settings/commissions/index.html.erb
index da589347..a30fda08 100644
--- a/app/views/origami/commissions/index.html.erb
+++ b/app/views/settings/commissions/index.html.erb
@@ -1,9 +1,9 @@
@@ -14,8 +14,8 @@
Product Name
+ Commission Type
Amount
- Commission type
Active
@@ -25,12 +25,12 @@
<% @commissions.each do |commission| %>
<%= commission.menu_item.name rescue '-' %>
- <%= commission.amount rescue '-' %>
<%= commission.commission_type rescue '-' %>
+ <%= commission.amount rescue '-' %>
<%= commission.is_active rescue '-' %>
- <%= link_to 'Show', origami_commission_path(commission) %>
- <%= link_to 'Edit', edit_origami_commission_path(commission) %>
- <%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %>
+ <%= link_to 'Show', settings_commissions_path(commission) %>
+ <%= link_to 'Edit', edit_settings_commission_path(commission) %>
+ <%= link_to 'Destroy', settings_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %>
<% end %>
diff --git a/app/views/origami/commissions/index.json.jbuilder b/app/views/settings/commissions/index.json.jbuilder
similarity index 100%
rename from app/views/origami/commissions/index.json.jbuilder
rename to app/views/settings/commissions/index.json.jbuilder
diff --git a/app/views/origami/commissions/load_commissioners.html.erb b/app/views/settings/commissions/load_commissioners.html.erb
similarity index 100%
rename from app/views/origami/commissions/load_commissioners.html.erb
rename to app/views/settings/commissions/load_commissioners.html.erb
diff --git a/app/views/origami/commissions/new.html.erb b/app/views/settings/commissions/new.html.erb
similarity index 54%
rename from app/views/origami/commissions/new.html.erb
rename to app/views/settings/commissions/new.html.erb
index a13c8cb3..35560940 100644
--- a/app/views/origami/commissions/new.html.erb
+++ b/app/views/settings/commissions/new.html.erb
@@ -1,8 +1,8 @@
diff --git a/app/views/origami/commissions/show.html.erb b/app/views/settings/commissions/show.html.erb
similarity index 63%
rename from app/views/origami/commissions/show.html.erb
rename to app/views/settings/commissions/show.html.erb
index 439e2c45..557c7465 100644
--- a/app/views/origami/commissions/show.html.erb
+++ b/app/views/settings/commissions/show.html.erb
@@ -2,8 +2,8 @@
diff --git a/app/views/origami/commissions/show.json.jbuilder b/app/views/settings/commissions/show.json.jbuilder
similarity index 100%
rename from app/views/origami/commissions/show.json.jbuilder
rename to app/views/settings/commissions/show.json.jbuilder
diff --git a/config/routes.rb b/config/routes.rb
index 55d3b1f2..74874fd0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -11,10 +11,10 @@ Rails.application.routes.draw do
#--------- SmartSales Installation ------------#
get 'install' => 'install#index'
- post 'install' => 'install#create'
+ post 'install' => 'install#create'
#--------- Login/Authentication ------------#
- get 'auth/:emp_id' => 'home#show' , as: :emp_login
+ get 'auth/:emp_id' => 'home#show', as: :emp_login
patch "auth/:emp_id" => 'home#update', as: :emp_login_update
post 'login' => 'home#create'
@@ -23,14 +23,14 @@ Rails.application.routes.draw do
#--------- API Routes ------------#
- namespace :api, :defaults => { :format => 'json' } do
+ namespace :api, :defaults => {:format => 'json'} do
#Session Login and Logout
- post 'authenticate' => "authenticate#create"
+ post 'authenticate' => "authenticate#create"
delete 'authenticate' => "authenticate#destroy"
namespace :restaurant do
get 'zones' => "zones#index"
- resources :menu, only:[:index, :show]
+ resources :menu, only: [:index, :show]
resources :menu_categories, only: [:index, :show]
resources :menu_items, only: [:index, :show]
resources :menu_item_attributes, only: [:index]
@@ -57,10 +57,10 @@ Rails.application.routes.draw do
get "customers/get_order/:id" => "customers#get_customer_order"
#Generating Invoice and making payments - output render @sale
- resources :invoices, only: [:index, :show, :create, :update, :destroy ] do
- resources :sale_items, only:[:create, :update, :destroy]
+ resources :invoices, only: [:index, :show, :create, :update, :destroy] do
+ resources :sale_items, only: [:create, :update, :destroy]
resources :discounts, only: [:create, :update, :destroy]
- resources :memberships, only:[:create]
+ resources :memberships, only: [:create]
post "payment/:payment_method" => "payment#create"
put "payment/:id" => "payment#update"
resources :receipt, only: [:create, :show] #generate receipt, show receipt
@@ -72,8 +72,8 @@ Rails.application.routes.draw do
#--------- Cashier ------------#
namespace :origami do
- resources :cash_ins, only:[:new, :create]
- resources :cash_outs, only:[:new, :create]
+ resources :cash_ins, only: [:new, :create]
+ resources :cash_outs, only: [:new, :create]
root "home#index"
get "table/:dining_id" => "home#show" do #origami/:booking_id will show
# resources :discounts, only: [:index,:new, :create ] #add discount type
@@ -87,17 +87,13 @@ Rails.application.routes.draw do
post 'item_void_cancel' => "sale_edit#item_void_cancel"
post 'cancel_all_void' => 'sale_edit#cancel_all_void'
post 'apply_void' => 'sale_edit#apply_void'
- # commissions
- get '/table/:table_id/sale/:sale_id/load_commissioners' => 'commissions#load_commissioners', as: 'load_commissioners'
- post 'select_sale_item' => 'commissions#select_sale_item'
- # product_commission
- post 'select_commissioner' => 'product_commissions#set_commissioner_to_sale_item'
# in_juties
get '/table/:table_id/assign_in_juty' => 'in_juties#assign_in_juty', as: 'assign_in_juty'
- post 'assign_in_juty' => 'in_juties#create_for_in_juty', as: 'create_for_in_juty'
get 'assign_in_juty/:table_id' => 'in_juties#index_in_juty', as: 'index_in_juty'
- get 'table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty'
- put '/edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty'
+ post 'assign_in_juty/:table_id' => 'in_juties#create_for_in_juty'
+
+ get 'assign_in_juty/table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty'
+ patch 'edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty'
delete 'table/:table_id/destroy_in_juty/:id' => 'in_juties#destroy_in_juty', as: 'destroy_in_juty'
get 'table/:dining_id/movetable' => "movetable#move_dining"
@@ -122,8 +118,8 @@ Rails.application.routes.draw do
# Discount for Member
post "/:id/member_discount" => "discounts#member_discount"
- get "/:id/request_bills" => "request_bills#print",:as => "request_bill"
- get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
+ get "/:id/request_bills" => "request_bills#print", :as => "request_bill"
+ get '/:sale_id/reprint' => 'payments#reprint', :defaults => {:format => 'json'}
#---------Shift ---------------#
resources :shifts, only: [:index, :new, :create, :edit]
@@ -141,11 +137,11 @@ Rails.application.routes.draw do
#payment - Outing payments - Cash only [ *Misc expeness tracking]
#--------- Payment ------------#
- post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj',:as => "calculate_rouding_adjs"
- get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => { :format => 'json' }
+ post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj', :as => "calculate_rouding_adjs"
+ get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => {:format => 'json'}
get 'sale/:sale_id/payment' => 'payments#show'
- post 'payment/foc' => 'payments#foc', :defaults => { :format => 'json' }
+ post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'}
post 'payment/cash' => 'payments#create'
post 'payment/mpu' => "mpu#create"
post 'payment/jcb' => "jcb#create"
@@ -168,16 +164,16 @@ Rails.application.routes.draw do
post 'sale/:sale_id/void' => 'void#overall_void'
#---------Multiple Invoices --------------#
- get 'table/:table_id/table_invoices' => "table_invoices#index" , :as => "table_invoice_index"
- get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show" , :as => "table_invoice_show"
- get 'room/:room_id/room_invoices' => "room_invoices#index" , :as => "room_invoice_index"
- get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show" , :as => "room_invoice_show"
+ get 'table/:table_id/table_invoices' => "table_invoices#index", :as => "table_invoice_index"
+ get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show", :as => "table_invoice_show"
+ get 'room/:room_id/room_invoices' => "room_invoices#index", :as => "room_invoice_index"
+ get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show", :as => "room_invoice_show"
#---------Add Customer --------------#
#resources :customers
get '/:sale_id/customers', to: "customers#add_customer"
- get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details"
- post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer" # update customer id in sale table
+ get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details"
+ post '/:sale_id/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
post '/:sale_id/get_customer' => "customers#get_customer"
@@ -186,27 +182,28 @@ Rails.application.routes.draw do
resources :commissions
resources :commissioners
+
resources :in_juties
end
#--------- Waiter/Ordering Station ------------#
namespace :oishi do
- #zones
- #tables
- #orders
+ #zones
+ #tables
+ #orders
end
#--------- Customer Relationship Management ------------#
namespace :crm do
- root "home#index"
- resources :customers
- resources :dining_queues
- post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel
- get '/print/:id', to: "home#print_order"#print order for crm
+ root "home#index"
+ resources :customers
+ resources :dining_queues
+ post "update_booking", to: "bookings#update_booking", as: "update_booking" #assign and cancel
+ get '/print/:id', to: "home#print_order" #print order for crm
- get "/dining_queues/:id/assign" =>"dining_queues#assign", :as => "assign"
- post "/dining_queues/assign_table" =>"dining_queues#assign_table", :as => "assign_table"
- post "/dining_queues/cancel_queue" =>"dining_queues#cancel_queue", :as => "cancel_queue"
+ get "/dining_queues/:id/assign" => "dining_queues#assign", :as => "assign"
+ post "/dining_queues/assign_table" => "dining_queues#assign_table", :as => "assign_table"
+ post "/dining_queues/cancel_queue" => "dining_queues#cancel_queue", :as => "cancel_queue"
end
@@ -225,7 +222,7 @@ Rails.application.routes.draw do
get 'print/print/:id', to: "print#print"
get 'print/print_order_summary/:id', to: "print#print_order_summary"
- get "/get_items/:id" =>"home#get_items_by_oqs", :as => "get_order_items_by_oqs"
+ get "/get_items/:id" => "home#get_items_by_oqs", :as => "get_order_items_by_oqs"
#dashboard
#
end
@@ -237,7 +234,7 @@ Rails.application.routes.draw do
#menu
resources :menus do
#menu_categories
- resources :menu_categories, only: [:new, :create, :edit,:delete]
+ resources :menu_categories, only: [:new, :create, :edit, :delete]
end
resources :item_sets
@@ -301,16 +298,28 @@ Rails.application.routes.draw do
resources :promotion_products
end
+ # commission
+ resources :commissions
+ resources :commissioners
+
+ get '/get_transactions_by_commissioner' => 'commissioners#get_transaction_by_commissioner', as:'get_transaction_by_commissioner'
+
end
+ # commissions
+ get 'origami/table/:table_id/sale/:sale_id/load_commissioners' => 'settings/commissions#load_commissioners', as: 'load_commissioners'
+ post 'origami/select_sale_item' => 'settings/commissions#select_sale_item', as: 'select_sale_item'
+ # product_commission
+ post 'origami/select_commissioner' => 'origami/product_commissions#set_commissioner_to_sale_item', as: 'select_commissioner'
+
#--------- Transactions Sections ------------#
namespace :transactions do
resources :sales
resources :orders
resources :credit_notes
- get "/sales/:sale_id/manual_complete_sale" =>"manual_sales#manual_complete_sale", :as => "manual_complete_sale"
- get "/sales/:sale_id/void" =>"manual_sales#void", :as => "void"
+ get "/sales/:sale_id/manual_complete_sale" => "manual_sales#manual_complete_sale", :as => "manual_complete_sale"
+ get "/sales/:sale_id/void" => "manual_sales#void", :as => "void"
post "sales/:sale_id/manual_void_sale", to: "manual_sales#manual_void_sale", :as => "manual_void_sale"
end
@@ -322,6 +331,7 @@ Rails.application.routes.draw do
resources :shiftsale, :only => [:index, :show]
resources :credit_payment, :only => [:index, :show]
resources :void_sale, :only => [:index, :show]
+ resources :commission, :only => [:index, :show]
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
end
diff --git a/db/migrate/20170818090115_create_commissioners.rb b/db/migrate/20170818090115_create_commissioners.rb
deleted file mode 100644
index b8c4bca3..00000000
--- a/db/migrate/20170818090115_create_commissioners.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class CreateCommissioners < ActiveRecord::Migration[5.1]
- def change
- create_table :commissioners do |t|
- t.string :name, :null => false
- t.string :emp_id
- t.string :created_by
- t.string :commission_type
- t.boolean :is_active
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20170821093252_create_commissions.rb b/db/migrate/20170821093252_create_commissions.rb
deleted file mode 100644
index ebd7d8dd..00000000
--- a/db/migrate/20170821093252_create_commissions.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateCommissions < ActiveRecord::Migration[5.1]
- def change
- create_table :commissions do |t|
- t.integer :product_id, null: false
- t.integer :amount
- t.string :commission_type
- t.boolean :is_active
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20170823034141_create_product_commissions.rb b/db/migrate/20170823034141_create_product_commissions.rb
deleted file mode 100644
index cb0e5a3f..00000000
--- a/db/migrate/20170823034141_create_product_commissions.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class CreateProductCommissions < ActiveRecord::Migration[5.1]
- # rake db:migrate:down VERSION=20170823034141
- def change
- create_table :product_commissions do |t|
- t.string :product_id
- t.integer :commission_id
- t.integer :commissioner_id
- t.decimal :qty, :precision => 10, :scale => 2, :default => 0.00
- t.string :sale_id
- t.string :sale_item_id
- t.decimal :price, :precision => 10, :scale => 2, :default => 0.00
- t.decimal :amount, :precision => 10, :scale => 2, :default => 0.00
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20170825034141_create_product_commissions.rb b/db/migrate/20170825034141_create_product_commissions.rb
new file mode 100644
index 00000000..f083bf68
--- /dev/null
+++ b/db/migrate/20170825034141_create_product_commissions.rb
@@ -0,0 +1,17 @@
+class CreateProductCommissions < ActiveRecord::Migration[5.1]
+ # rake db:migrate:down VERSION=20170825034141
+ def change
+ create_table :product_commissions do |t|
+ t.string :product_type
+ t.string :product_code
+ t.string :commission_id
+ t.integer :commissioner_id
+ t.decimal :qty, precision: 10, scale: 2, default: 0.00
+ t.string :sale_id
+ t.string :sale_item_id
+ t.decimal :price, precision: 10, scale: 2, default: 0.00
+ t.decimal :amount, precision: 10, scale: 2, default: 0.00
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20170825090115_create_commissioners.rb b/db/migrate/20170825090115_create_commissioners.rb
new file mode 100644
index 00000000..1794b5c7
--- /dev/null
+++ b/db/migrate/20170825090115_create_commissioners.rb
@@ -0,0 +1,15 @@
+class CreateCommissioners < ActiveRecord::Migration[5.1]
+ # rake db:migrate:down VERSION=20170825090115
+ def change
+ create_table :commissioners do |t|
+ t.string :name
+ t.string :emp_id
+ t.string :created_by
+ t.string :commission_id
+ t.datetime :joined_date
+ t.datetime :resigned_date
+ t.boolean :is_active, default: true
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20170825093252_create_commissions.rb b/db/migrate/20170825093252_create_commissions.rb
new file mode 100644
index 00000000..8c344fbc
--- /dev/null
+++ b/db/migrate/20170825093252_create_commissions.rb
@@ -0,0 +1,15 @@
+class CreateCommissions < ActiveRecord::Migration[5.1]
+ # rake db:migrate:down VERSION=20170825093252
+ def change
+ create_table :commissions, id: false do |t|
+ t.string :commission_id, limit: 16, primary_key: true # custom primary key
+
+ t.string :product_type
+ t.string :product_code
+ t.string :commission_type
+ t.integer :amount
+ t.boolean :is_active, default: true
+ t.timestamps
+ end
+ end
+end