Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring
* 'august_spring' of bitbucket.org:code2lab/sxrestaurant: (71 commits) Update Coupon / Voucher data change update menu_sync update addorder update addorder view add fields for Menu Sync update add oreder add menu api update add order and calculate subtotal update seed menu ui update update ability for setmenu fixed update show for foc add bootstrap file input and menu item img implemented update foc and pdf update menu item update receipt bill pdf for foc and credit add CarrierWave gems for menu image upload add CarrierWave gems for menu image upload ...
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -36,6 +36,9 @@ gem 'tether-rails'
|
|||||||
gem "font-awesome-rails"
|
gem "font-awesome-rails"
|
||||||
gem 'rack-cors'
|
gem 'rack-cors'
|
||||||
|
|
||||||
|
# image upload
|
||||||
|
gem 'carrierwave', '~> 1.0'
|
||||||
|
|
||||||
#Report and Printing gems
|
#Report and Printing gems
|
||||||
gem 'cups', '~> 0.0.7'
|
gem 'cups', '~> 0.0.7'
|
||||||
gem 'prawn'
|
gem 'prawn'
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ GEM
|
|||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
byebug (9.0.6)
|
byebug (9.0.6)
|
||||||
cancancan (1.17.0)
|
cancancan (1.17.0)
|
||||||
|
carrierwave (1.1.0)
|
||||||
|
activemodel (>= 4.0.0)
|
||||||
|
activesupport (>= 4.0.0)
|
||||||
|
mime-types (>= 1.16)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
coffee-rails (4.2.2)
|
coffee-rails (4.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
@@ -250,6 +254,7 @@ DEPENDENCIES
|
|||||||
bootstrap-datepicker-rails
|
bootstrap-datepicker-rails
|
||||||
byebug
|
byebug
|
||||||
cancancan (~> 1.10)
|
cancancan (~> 1.10)
|
||||||
|
carrierwave (~> 1.0)
|
||||||
coffee-rails (~> 4.2)
|
coffee-rails (~> 4.2)
|
||||||
cups (~> 0.0.7)
|
cups (~> 0.0.7)
|
||||||
database_cleaner
|
database_cleaner
|
||||||
|
|||||||
BIN
app/assets/images/logo.png
Normal file
BIN
app/assets/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
@@ -23,8 +23,90 @@ $(document).ready(function(){
|
|||||||
// setTimeout(function(){
|
// setTimeout(function(){
|
||||||
// window.location.reload(1);
|
// window.location.reload(1);
|
||||||
// }, 10000);
|
// }, 10000);
|
||||||
|
$(".nav-completed").on("click", function(){
|
||||||
|
$("#completed").removeClass('hide')
|
||||||
|
$(".oqs_append").addClass('hide')
|
||||||
|
});
|
||||||
|
|
||||||
$('.queue_station').on('click',function(){
|
$(".oqs_click").on("click", function(){
|
||||||
|
$("#completed").addClass('hide')
|
||||||
|
$(".oqs_append").removeClass('hide')
|
||||||
|
|
||||||
|
var oqs_id = $(this).find(".oqs-id").text();
|
||||||
|
var url = 'oqs/get_items/'+oqs_id;
|
||||||
|
show_details(url);
|
||||||
|
|
||||||
|
}); //End Click
|
||||||
|
|
||||||
|
function show_details(url){
|
||||||
|
var oqs_append = $('.oqs_append');
|
||||||
|
oqs_append.empty();
|
||||||
|
var filter = $('.filter').text();
|
||||||
|
//Start Ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
data: {'filter':filter},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
for(var field in data) {
|
||||||
|
var price = parseFloat(data[field].price).toFixed(2);
|
||||||
|
|
||||||
|
if (data[field]["options"] == "[]") {
|
||||||
|
var options = "";
|
||||||
|
}else{
|
||||||
|
var options = data.options;
|
||||||
|
}
|
||||||
|
|
||||||
|
var date = new Date(data[field]["created_at"]);
|
||||||
|
var show_date = date.getDate() + "-" + date.getMonth() + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||||
|
|
||||||
|
row ='<div class="card queue_station">'
|
||||||
|
+'<div class="card-block">'
|
||||||
|
+'<h4 class="card-title">'
|
||||||
|
+'<span class="order-zone-type">'+data[field]["table_type"]+'- </span>'
|
||||||
|
+'<span class="order-zone">'+ data[field]["zone"] +'</span>'
|
||||||
|
+'<small class="pull-right">'+ data[field]["order_id"] +'- </small>'
|
||||||
|
+'</h4>'
|
||||||
|
|
||||||
|
+'<h4>'
|
||||||
|
+'<span class="order-item">'+ data[field]["item_name"] +'- </span>'
|
||||||
|
+'<span class="order-qty">'+ data[field]["qty"] +'- </span>'
|
||||||
|
+'</h4>'
|
||||||
|
|
||||||
|
+'<p class="card-text item-options">'+ options +'</p>'
|
||||||
|
|
||||||
|
+'<p class="card-text">'
|
||||||
|
+'<small class="text-muted">Order at'
|
||||||
|
+'<span class="order-at">'+ show_date +'</span> - '
|
||||||
|
|
||||||
|
+'<span class="order-by">'+ data[field]["item_order_by"] +'</span> '
|
||||||
|
+'</small> '
|
||||||
|
+'</p>'
|
||||||
|
|
||||||
|
+'<p class="hidden order-customer">'+ data[field]["customer_name"] +'</p> '
|
||||||
|
+'<p class="hidden assigned-order-item">'+ data[field]["assigned_order_item_id"] +'</p> '
|
||||||
|
+'</div>'
|
||||||
|
|
||||||
|
+'<div class="card-footer">'
|
||||||
|
+'<button id="edit_'+ data[field]["assigned_order_item_id"]+'" class="btn btn-warning order-item order-item-edit">EDIT</button>'
|
||||||
|
+' <button id="assigned_queue_' + data[field]["assigned_order_item_id"] +'" class="btn btn-primary order-item order-complete">COMPLETE</button>'
|
||||||
|
+'</div>'
|
||||||
|
|
||||||
|
+'</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('.oqs_append').append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//end Ajax
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('click', '.queue_station', function(event){
|
||||||
var orderZone=$(this).children().children().children('.order-zone').text().trim();
|
var orderZone=$(this).children().children().children('.order-zone').text().trim();
|
||||||
// var orderItem=$(this).children().children().children('.order-item').text();
|
// var orderItem=$(this).children().children().children('.order-item').text();
|
||||||
var assigned_item_id = $(this).children().find(".assigned-order-item").text();
|
var assigned_item_id = $(this).children().find(".assigned-order-item").text();
|
||||||
@@ -41,7 +123,6 @@ $(document).ready(function(){
|
|||||||
$('#order-from').text(orderZone);
|
$('#order-from').text(orderZone);
|
||||||
// clear order items
|
// clear order items
|
||||||
$("#oqs-order-details-table").children("tbody").empty();
|
$("#oqs-order-details-table").children("tbody").empty();
|
||||||
|
|
||||||
// Call get_order_items() for Order Items by dining
|
// Call get_order_items() for Order Items by dining
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
@@ -68,19 +149,20 @@ $(document).ready(function(){
|
|||||||
$(this).addClass('selected-item');
|
$(this).addClass('selected-item');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".order-item-edit").on('click', function(){
|
$(document).on('click', '.order-item-edit', function(event){
|
||||||
var _self = $(this); // To know in ajax return
|
var _self = $(this); // To know in ajax return
|
||||||
var assigned_item_id=$(this).attr('id').substr(5);
|
var assigned_item_id=$(this).attr('id').substr(5);
|
||||||
window.location.href = '/oqs/'+ assigned_item_id + "/edit"
|
window.location.href = '/oqs/'+ assigned_item_id + "/edit"
|
||||||
});
|
});
|
||||||
|
|
||||||
// complete for queue item
|
// complete for queue item
|
||||||
$('.order-complete').on('click',function(e){
|
|
||||||
|
$(document).on('click', '.order-complete', function(event){
|
||||||
//e.preventDefault();
|
//e.preventDefault();
|
||||||
var _self = $(this); // To know in ajax return
|
var _self = $(this); // To know in ajax return
|
||||||
var assigned_item_id=$(this).attr('id').substr(15);
|
var assigned_item_id=$(this).attr('id').substr(15);
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'id':assigned_item_id };
|
||||||
|
|
||||||
// Call update_delivery_status() for changed delivery and move to delivery
|
// Call update_delivery_status() for changed delivery and move to delivery
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -117,10 +199,11 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Print Order Item
|
// Print Order Item
|
||||||
$('#print_order_item').on('click',function(){
|
$(document).on('click', '#print_order_item', function(event){
|
||||||
var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||||
var options = $('.selected-item').children('.card-block').find('.item-options').text();
|
var options = $('.selected-item').children('.card-block').find('.item-options').text();
|
||||||
var params = { 'options':options };
|
var params = { 'options':options };
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '/oqs/print/print/'+assigned_item_id,
|
url: '/oqs/print/print/'+assigned_item_id,
|
||||||
@@ -129,7 +212,8 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Print Order Summary
|
// Print Order Summary
|
||||||
$('#print_order_summary').on('click',function(){
|
// $('#print_order_summary').on('click',function(){
|
||||||
|
$(document).on('click', '#print_order_summary', function(event){
|
||||||
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
|
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
|
||||||
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||||
var params = { 'table_name':table_name };
|
var params = { 'table_name':table_name };
|
||||||
|
|||||||
@@ -20,25 +20,47 @@
|
|||||||
//= require jquery-ui
|
//= require jquery-ui
|
||||||
//= require bootstrap-datepicker
|
//= require bootstrap-datepicker
|
||||||
|
|
||||||
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
$(document).on('turbolinks:load', function() {
|
||||||
|
$('.datepicker').datepicker({
|
||||||
|
format : 'dd-mm-yyyy',
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
$('.datepicker').attr('ReadOnly','true');
|
||||||
|
$('.datepicker').css('cursor','pointer');
|
||||||
|
|
||||||
|
// Image Upload
|
||||||
|
$("#simple_menu_item_image_path").fileinput({
|
||||||
|
previewFileType: "image",
|
||||||
|
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||||
|
browseClass: "btn btn-success",
|
||||||
|
browseLabel: "Pick Image",
|
||||||
|
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||||
|
removeClass: "btn btn-danger",
|
||||||
|
removeLabel: "Delete",
|
||||||
|
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||||
|
showUpload: false,
|
||||||
|
// uploadClass: "btn btn-info",
|
||||||
|
// uploadLabel: "Upload",
|
||||||
|
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||||
|
previewTemplates: {
|
||||||
|
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||||
|
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||||
|
'</div>\n',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||||
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
|
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
|
||||||
$('.dropdown-toggle').dropdown();
|
$('.dropdown-toggle').dropdown();
|
||||||
});
|
});
|
||||||
|
|
||||||
function export_to(path)
|
function export_to(path)
|
||||||
{
|
{
|
||||||
var form_params = $("#frm_report").serialize();
|
var form_params = $("#frm_report").serialize();
|
||||||
window.location = path+"?"+ form_params;
|
window.location = path+"?"+ form_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
|
||||||
$('.datepicker').datepicker({
|
|
||||||
format : 'dd-mm-yyyy',
|
|
||||||
autoclose: true
|
|
||||||
});
|
|
||||||
$('.datepicker').attr('ReadOnly','true');
|
|
||||||
$('.datepicker').css('cursor','pointer');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
12
app/assets/javascripts/fileinput.min.js
vendored
Executable file
12
app/assets/javascripts/fileinput.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
3
app/assets/javascripts/origami/addorders.coffee
Normal file
3
app/assets/javascripts/origami/addorders.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
3
app/assets/javascripts/settings/item_sets.coffee
Normal file
3
app/assets/javascripts/settings/item_sets.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
3
app/assets/javascripts/settings/menu_item_sets.coffee
Normal file
3
app/assets/javascripts/settings/menu_item_sets.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
12
app/assets/stylesheets/fileinput.min.css
vendored
Executable file
12
app/assets/stylesheets/fileinput.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -268,4 +268,3 @@ tr.discount-item-row:hover {
|
|||||||
-moz-opacity: 1; /* mozilla */
|
-moz-opacity: 1; /* mozilla */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
app/assets/stylesheets/origami/addorders.scss
Normal file
3
app/assets/stylesheets/origami/addorders.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the origami/addorders controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
@@ -26,7 +26,38 @@ ul.dropdown-menu li a{
|
|||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
margin-bottom: 0px !important;
|
margin-bottom: 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-header{
|
.page-header{
|
||||||
border-bottom :0px solid #000 !important;
|
border-bottom :0px solid #000 !important;
|
||||||
margin :0px !important;
|
margin :0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.center-text {
|
||||||
|
text-align:center;
|
||||||
|
background-color:#ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
height: auto;
|
||||||
|
background-color: #ef404a;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-header {
|
||||||
|
color : #ef404a;
|
||||||
|
font-weight:bold;
|
||||||
|
font-style:italic;
|
||||||
|
margin-bottom:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item-img {
|
||||||
|
margin: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.padding-10 {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
3
app/assets/stylesheets/settings/item_sets.scss
Normal file
3
app/assets/stylesheets/settings/item_sets.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the Settings/ItemSets controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
3
app/assets/stylesheets/settings/menu_item_sets.scss
Normal file
3
app/assets/stylesheets/settings/menu_item_sets.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the Settings/Menu_item_sets controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
9
app/controllers/api/restaurant/item_sets_controller.rb
Normal file
9
app/controllers/api/restaurant/item_sets_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class Api::Restaurant::ItemSetsController < Api::ApiController
|
||||||
|
|
||||||
|
#Description
|
||||||
|
# Pull the default menu details and also other available (active) menus
|
||||||
|
# Input Params - order_id
|
||||||
|
def index
|
||||||
|
@item_sets = ItemSet.all
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
class Api::Restaurant::MenuController < Api::ApiController
|
class Api::Restaurant::MenuCategoriesController < Api::ApiController
|
||||||
|
skip_before_action :authenticate
|
||||||
#Description
|
#Description
|
||||||
# Pull the default menu details and also other available (active) menus
|
# Pull the default menu details and also other available (active) menus
|
||||||
# Input Params - order_id
|
# Input Params - order_id
|
||||||
def index
|
def index
|
||||||
@menus = Menu.all
|
@menus = MenuCategory.all
|
||||||
@current_menu = Menu.current_menu
|
@current_menu = MenuCategory.current_menu
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -21,10 +21,10 @@ class Api::Restaurant::MenuController < Api::ApiController
|
|||||||
def menu_detail (menu_id)
|
def menu_detail (menu_id)
|
||||||
if (menu_id)
|
if (menu_id)
|
||||||
#Pull this menu
|
#Pull this menu
|
||||||
menu = Menu.find_by_id(menu_id)
|
menu = MenuCategory.find_by_id(menu_id)
|
||||||
return menu
|
return menu
|
||||||
else
|
else
|
||||||
Menu.current_menu
|
MenuCategory.current_menu
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
class Api::Restaurant::MenuController < Api::ApiController
|
class Api::Restaurant::MenuController < Api::ApiController
|
||||||
|
skip_before_action :authenticate
|
||||||
#Description
|
#Description
|
||||||
# Pull the default menu details and also other available (active) menus
|
# Pull the default menu details and also other available (active) menus
|
||||||
# Input Params - order_id
|
# Input Params - order_id
|
||||||
def index
|
def index
|
||||||
@menus = Menu.all
|
@menus = Menu.all
|
||||||
@current_menu = Menu.current_menu
|
# @current_menu = Menu.current_menu
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Description
|
#Description
|
||||||
|
|||||||
@@ -6,8 +6,4 @@ class Api::Restaurant::MenuItemAttributesController < Api::ApiController
|
|||||||
def index
|
def index
|
||||||
@menu_attributes = MenuItemAttribute.all
|
@menu_attributes = MenuItemAttribute.all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
class Api::Restaurant::MenuItemOptionsController < Api::ApiController
|
class Api::Restaurant::MenuItemOptionsController < Api::ApiController
|
||||||
|
|
||||||
#Description
|
#Description
|
||||||
# Pull the default menu details and also other available (active) menus
|
# Pull the default menu details and also other available (active) menus
|
||||||
# Input Params - order_id
|
# Input Params - order_id
|
||||||
def index
|
def index
|
||||||
@menu_options = MenuItemOption.all
|
@menu_options = MenuItemOption.all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,10 +14,9 @@ module TokenVerification
|
|||||||
end
|
end
|
||||||
|
|
||||||
def authenticate_token
|
def authenticate_token
|
||||||
authenticate_with_http_token do |token, options|
|
authenticate_with_http_token do |token, options|
|
||||||
#@current_user = User.find_by(api_key: token)
|
#@current_user = User.find_by(api_key: token)
|
||||||
Rails.logger.debug "token - " + token.to_s
|
Rails.logger.debug "token - " + token.to_s
|
||||||
|
|
||||||
@user = Employee.authenticate_by_token(token)
|
@user = Employee.authenticate_by_token(token)
|
||||||
if @user
|
if @user
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
@count_customer = Customer.count_customer
|
@count_customer = Customer.count_customer
|
||||||
|
|
||||||
|
@taxes = TaxProfile.all.order("order_by asc")
|
||||||
|
|
||||||
# if flash["errors"]
|
# if flash["errors"]
|
||||||
# @crm_customer.valid?
|
# @crm_customer.valid?
|
||||||
# end
|
# end
|
||||||
@@ -63,15 +65,21 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
|
|
||||||
# GET /crm/customers/1/edit
|
# GET /crm/customers/1/edit
|
||||||
def edit
|
def edit
|
||||||
|
@customer = Customer.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /crm/customers
|
# POST /crm/customers
|
||||||
# POST /crm/customers.json
|
# POST /crm/customers.json
|
||||||
def create
|
def create
|
||||||
|
# Remove "" default first
|
||||||
|
params[:customer][:tax_profiles].delete_at(0)
|
||||||
@crm_customers = Customer.new(customer_params)
|
@crm_customers = Customer.new(customer_params)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @crm_customers.save
|
if @crm_customers.save
|
||||||
|
# update tax profile
|
||||||
|
customer = Customer.find(@crm_customers.customer_id)
|
||||||
|
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
|
||||||
name = customer_params[:name]
|
name = customer_params[:name]
|
||||||
phone = customer_params[:contact_no]
|
phone = customer_params[:contact_no]
|
||||||
email = customer_params[:email]
|
email = customer_params[:email]
|
||||||
@@ -188,10 +196,12 @@ end
|
|||||||
# PATCH/PUT /crm/customers/1
|
# PATCH/PUT /crm/customers/1
|
||||||
# PATCH/PUT /crm/customers/1.json
|
# PATCH/PUT /crm/customers/1.json
|
||||||
def update
|
def update
|
||||||
|
# Remove "" default first
|
||||||
|
params[:customer][:tax_profiles].delete_at(0)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @crm_customer.update(customer_params)
|
if @crm_customer.update(customer_params)
|
||||||
|
# update tax profile
|
||||||
|
@crm_customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
|
||||||
name = customer_params[:name]
|
name = customer_params[:name]
|
||||||
phone = customer_params[:contact_no]
|
phone = customer_params[:contact_no]
|
||||||
email = customer_params[:email]
|
email = customer_params[:email]
|
||||||
@@ -346,7 +356,7 @@ end
|
|||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def customer_params
|
def customer_params
|
||||||
|
|
||||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
params.require(:customer).permit(:id, :name, :company, :contact_no, :email,
|
||||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no)
|
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
126
app/controllers/oqs/backhome_controller.rb
Normal file
126
app/controllers/oqs/backhome_controller.rb
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
class Oqs::HomeController < BaseOqsController
|
||||||
|
def index
|
||||||
|
queue_stations=OrderQueueStation.all
|
||||||
|
|
||||||
|
# Query for OQS with delivery status false
|
||||||
|
@queue_items_details = queue_items_query(false)
|
||||||
|
|
||||||
|
# Query for OQS with delivery status true
|
||||||
|
@queue_completed_item = completed_order
|
||||||
|
|
||||||
|
@queue_stations_items=Array.new
|
||||||
|
|
||||||
|
# Calculate Count for each station tab
|
||||||
|
queue_stations.each do |que|
|
||||||
|
i = 0
|
||||||
|
zone_id = 0
|
||||||
|
@queue_items_details.each do |qid|
|
||||||
|
dining = DiningFacility.find_by_name(qid.zone)
|
||||||
|
que.order_queue_process_by_zones.each do |qz|
|
||||||
|
if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
|
||||||
|
zone_id = qid.zone_id
|
||||||
|
i=i+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||||
|
end
|
||||||
|
|
||||||
|
# @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
|
||||||
|
@queue_stations_items
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get Order items
|
||||||
|
def get_order_items
|
||||||
|
items = []
|
||||||
|
table_name = params[:table_id]
|
||||||
|
status = params[:status]
|
||||||
|
dining = DiningFacility.find_by_name(table_name);
|
||||||
|
# oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||||
|
# if status == ""
|
||||||
|
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
|
||||||
|
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||||
|
# items.push(oi)
|
||||||
|
# end
|
||||||
|
# else
|
||||||
|
# AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
|
||||||
|
# oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||||
|
# items.push(oi)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||||
|
BookingOrder.where("booking_id='#{ booking.booking_id }'").find_each do |bo|
|
||||||
|
order=Order.find(bo.order_id)
|
||||||
|
order.order_items.each do |oi|
|
||||||
|
items.push(oi)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# booking_id = dining.get_new_booking
|
||||||
|
# BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
|
||||||
|
# order=Order.find(bo.order_id);
|
||||||
|
# order.order_items.each do |oi|
|
||||||
|
# items.push(oi)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
render :json => items.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# update delivery status when complete click
|
||||||
|
def update_delivery_status
|
||||||
|
removed_item = []
|
||||||
|
assigned_item_id = params[:id]
|
||||||
|
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||||
|
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||||
|
|
||||||
|
# update delivery status for completed same order items
|
||||||
|
assigned_items.each do |ai|
|
||||||
|
ai.delivery_status=true
|
||||||
|
ai.save
|
||||||
|
removed_item.push(ai.assigned_order_item_id)
|
||||||
|
end
|
||||||
|
render :json => removed_item.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
# Query for OQS with delivery status
|
||||||
|
def queue_items_query(status)
|
||||||
|
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||||
|
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||||
|
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||||
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
|
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||||
|
left join customers as cus ON cus.customer_id = od.customer_id
|
||||||
|
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||||
|
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||||
|
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||||
|
.where("assigned_order_items.delivery_status = 0 AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
|
||||||
|
.group("assigned_order_items.assigned_order_item_id")
|
||||||
|
.order("assigned_order_items.created_at")
|
||||||
|
end
|
||||||
|
|
||||||
|
# Completed Order
|
||||||
|
def completed_order
|
||||||
|
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||||
|
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||||
|
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||||
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
|
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||||
|
left join customers as cus ON cus.customer_id = od.customer_id
|
||||||
|
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||||
|
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||||
|
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||||
|
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||||
|
.group("assigned_order_items.order_id")
|
||||||
|
.limit(20)
|
||||||
|
.order("assigned_order_items.created_at")
|
||||||
|
|
||||||
|
|
||||||
|
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,33 +1,44 @@
|
|||||||
class Oqs::HomeController < BaseOqsController
|
class Oqs::HomeController < BaseOqsController
|
||||||
def index
|
def index
|
||||||
queue_stations=OrderQueueStation.all
|
|
||||||
|
@queue_stations = OrderQueueStation.all
|
||||||
|
|
||||||
# Query for OQS with delivery status false
|
# Query for OQS with delivery status false
|
||||||
@queue_items_details = queue_items_query(false)
|
# @queue_items_details = queue_items_query(false)
|
||||||
|
|
||||||
# Query for OQS with delivery status true
|
# Query for OQS with delivery status true
|
||||||
@queue_completed_item = completed_order
|
|
||||||
|
|
||||||
@queue_stations_items=Array.new
|
@filter = params[:filter]
|
||||||
|
|
||||||
|
@queue_completed_item = completed_order(@filter)
|
||||||
|
if !@filter.nil?
|
||||||
|
@count = queue_items_count_query(false,@filter)
|
||||||
|
@count.each do |count|
|
||||||
|
|
||||||
# Calculate Count for each station tab
|
|
||||||
queue_stations.each do |que|
|
|
||||||
i = 0
|
|
||||||
zone_id = 0
|
|
||||||
@queue_items_details.each do |qid|
|
|
||||||
dining = DiningFacility.find_by_name(qid.zone)
|
|
||||||
que.order_queue_process_by_zones.each do |qz|
|
|
||||||
if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
|
|
||||||
zone_id = qid.zone_id
|
|
||||||
i=i+1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
|
# @queue_stations_items=Array.new
|
||||||
@queue_stations_items
|
|
||||||
|
# Calculate Count for each station tab
|
||||||
|
# @queue_stations.each do |que|
|
||||||
|
# i = 0
|
||||||
|
# zone_id = 0
|
||||||
|
# @queue_items_details.each do |qid|
|
||||||
|
# dining = DiningFacility.find_by_name(qid.zone)
|
||||||
|
# que.order_queue_process_by_zones.each do |qz|
|
||||||
|
# if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
|
||||||
|
# zone_id = qid.zone_id
|
||||||
|
# i=i+1
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# @queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||||
|
# end
|
||||||
|
|
||||||
|
# # @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
|
||||||
|
# @queue_stations_items
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get Order items
|
# Get Order items
|
||||||
@@ -68,6 +79,13 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
render :json => items.to_json
|
render :json => items.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_items_by_oqs
|
||||||
|
oqs_id = params[:id]
|
||||||
|
filter = params[:filter]
|
||||||
|
items = queue_items_query(false,oqs_id,filter)
|
||||||
|
render :json => items.to_json
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -87,9 +105,22 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
render :json => removed_item.to_json
|
render :json => removed_item.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Query for OQS with delivery status
|
# Query for OQS with delivery status
|
||||||
def queue_items_query(status)
|
def queue_items_query(status,oqs_id=nil,filter)
|
||||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
if oqs_id == nil
|
||||||
|
oqs = ''
|
||||||
|
else
|
||||||
|
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
|
||||||
|
end
|
||||||
|
|
||||||
|
query = AssignedOrderItem.select("assigned_order_items.assigned_order_item_id,
|
||||||
|
oqs.id as station_id, oqs.station_name,
|
||||||
|
oqs.is_active, oqpz.zone_id,
|
||||||
|
df.name as zone, df.type as table_type,
|
||||||
|
odt.order_id, odt.item_code, odt.item_name,
|
||||||
|
odt.price, odt.qty, odt.item_order_by, odt.options,
|
||||||
|
cus.name as customer_name, odt.created_at")
|
||||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
@@ -98,14 +129,15 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
|
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} ")
|
||||||
|
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||||
.group("assigned_order_items.assigned_order_item_id")
|
.group("assigned_order_items.assigned_order_item_id")
|
||||||
.order("assigned_order_items.created_at")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Completed Order
|
# Completed Order
|
||||||
def completed_order
|
def completed_order(filter)
|
||||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
query = AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
@@ -115,12 +147,28 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||||
.group("assigned_order_items.order_id")
|
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||||
.limit(20)
|
.group("assigned_order_items.order_id")
|
||||||
.order("assigned_order_items.created_at")
|
.limit(20)
|
||||||
|
.order("assigned_order_items.created_at")
|
||||||
|
|
||||||
|
|
||||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def queue_items_count_query(status,filter)
|
||||||
|
query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
|
||||||
|
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||||
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
|
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||||
|
left join customers as cus ON cus.customer_id = od.customer_id
|
||||||
|
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||||
|
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||||
|
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||||
|
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||||
|
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||||
|
.group("oqs.id")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
22
app/controllers/origami/addorders_controller.rb
Normal file
22
app/controllers/origami/addorders_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
class Origami::AddordersController < BaseOrigamiController
|
||||||
|
before_action :set_dining, only: [:show]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@tables = Table.all.active.order('zone_id asc').group("zone_id")
|
||||||
|
@rooms = Room.all.active.order('zone_id asc').group("zone_id")
|
||||||
|
@all_table = Table.all.active.order('status desc')
|
||||||
|
@all_room = Room.all.active.order('status desc')
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@menu = MenuCategory.all
|
||||||
|
@table_id = params[:id]
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_dining
|
||||||
|
@dining = DiningFacility.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -37,14 +37,14 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
@crm_customers = Customer.order("customer_id").page(params[:page])
|
@crm_customers = Customer.order("customer_id").page(params[:page])
|
||||||
#@products = Product.order("name").page(params[:page]).per(5)
|
#@products = Product.order("name").page(params[:page]).per(5)
|
||||||
else
|
else
|
||||||
@crm_customers = Customer.search(filter)
|
@crm_customers = Customer.search(filter)
|
||||||
|
|
||||||
end
|
end
|
||||||
#@crm_customers = Customer.all
|
#@crm_customers = Customer.all
|
||||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
@count_customer = Customer.count_customer
|
@count_customer = Customer.count_customer
|
||||||
|
|
||||||
|
@taxes = TaxProfile.all.order("order_by asc")
|
||||||
# if flash["errors"]
|
# if flash["errors"]
|
||||||
# @crm_customer.valid?
|
# @crm_customer.valid?
|
||||||
# end
|
# end
|
||||||
@@ -60,6 +60,7 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
|
|
||||||
id = params[:sale_id][0,3]
|
id = params[:sale_id][0,3]
|
||||||
customer_id = params[:customer_id]
|
customer_id = params[:customer_id]
|
||||||
|
customer = Customer.find(customer_id)
|
||||||
|
|
||||||
# Check and find with card no
|
# Check and find with card no
|
||||||
# if(!customer_id.include? "CUS")
|
# if(!customer_id.include? "CUS")
|
||||||
@@ -74,7 +75,7 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
status = sale.update_attributes(customer_id: customer_id)
|
status = sale.update_attributes(customer_id: customer_id)
|
||||||
sale.sale_orders.each do |sale_order|
|
sale.sale_orders.each do |sale_order|
|
||||||
order = Order.find(sale_order.order_id)
|
order = Order.find(sale_order.order_id)
|
||||||
status = order.update_attributes(customer_id: customer_id)
|
status = order.update_attributes(customer_id: customer_id,order_type:customer.customer_type)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||||
@@ -82,13 +83,15 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
|
|
||||||
@orders.each do |bo|
|
@orders.each do |bo|
|
||||||
order = Order.find(bo.order_id)
|
order = Order.find(bo.order_id)
|
||||||
status = order.update_attributes(customer_id: customer_id)
|
status = order.update_attributes(customer_id: customer_id,order_type:customer.customer_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if status == true
|
if status == true
|
||||||
render json: JSON.generate({:status => true})
|
render json: JSON.generate({:status => true})
|
||||||
|
# Re-calc All Amount in Sale
|
||||||
|
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount)
|
||||||
else
|
else
|
||||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
before_action :set_dining, only: [:show]
|
before_action :set_dining, only: [:show]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.where("sale_status != 'new'")
|
@complete = Sale.where("sale_status != 'new'")
|
||||||
@orders = Order.all.order('date desc')
|
@orders = Order.all.order('date desc')
|
||||||
|
@shop = Shop.find_by_id(1)
|
||||||
|
|
||||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -38,7 +40,6 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
sale = Sale.find(booking.sale_id)
|
sale = Sale.find(booking.sale_id)
|
||||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||||
puts "enter"
|
|
||||||
@sale_array.push(sale)
|
@sale_array.push(sale)
|
||||||
if @status_order == 'order'
|
if @status_order == 'order'
|
||||||
@status_order = 'sale'
|
@status_order = 'sale'
|
||||||
|
|||||||
@@ -163,6 +163,35 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def foc
|
||||||
|
cash = params[:cash]
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
sub_total = params[:sub_total]
|
||||||
|
member_info = nil
|
||||||
|
rebate_amount = nil
|
||||||
|
|
||||||
|
if(Sale.exists?(sale_id))
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
|
sale_payment = SalePayment.new
|
||||||
|
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
||||||
|
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
|
#shop detail
|
||||||
|
shop_details = Shop.find(1)
|
||||||
|
|
||||||
|
# get printer info
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
# Calculate Food and Beverage Total
|
||||||
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def rounding_adj
|
def rounding_adj
|
||||||
|
|
||||||
saleObj = Sale.find(params[:sale_id])
|
saleObj = Sale.find(params[:sale_id])
|
||||||
|
|||||||
@@ -31,15 +31,21 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
unique_code = "CloseCashierPdf"
|
unique_code = "CloseCashierPdf"
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop.find(1)
|
||||||
#get tax
|
#get tax
|
||||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||||
|
#other payment details for mpu or visa like card
|
||||||
|
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||||
|
|
||||||
|
# Calculate price_by_accounts
|
||||||
|
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
|
||||||
|
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
|
||||||
|
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes)
|
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -52,6 +58,21 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
|
|
||||||
def sale_summary
|
def sale_summary
|
||||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
|
|
||||||
|
# @shift = ShiftSale.find_by_id(shift_id)
|
||||||
|
if @shift
|
||||||
|
#get tax
|
||||||
|
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||||
|
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||||
|
#other payment details for mpu or visa like card
|
||||||
|
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||||
|
|
||||||
|
# Calculate price_by_accounts
|
||||||
|
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
|
||||||
|
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
|
||||||
|
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,18 +6,19 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find_by_sale_id(sale_id)
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
sale.payment_status = 'void'
|
|
||||||
sale.sale_status = 'void'
|
|
||||||
sale.save
|
|
||||||
|
|
||||||
# update count for shift sale
|
# update count for shift sale
|
||||||
if(sale.sale_status == "void")
|
if(sale.sale_status == "completed")
|
||||||
if sale.shift_sale_id != nil
|
if sale.shift_sale_id != nil
|
||||||
shift = ShiftSale.find(sale.shift_sale_id)
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
shift.calculate(sale_id, "void")
|
shift.calculate(sale_id, "void")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sale.payment_status = 'void'
|
||||||
|
sale.sale_status = 'void'
|
||||||
|
sale.save
|
||||||
|
|
||||||
bookings = sale.bookings
|
bookings = sale.bookings
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
orders = booking.orders
|
orders = booking.orders
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Origami::VoucherController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
cash = params[:amount]
|
cash = params[:amount]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
sale_id = params[:refnumber]
|
voucher_no = params[:refnumber]
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||||
if customer_data
|
if customer_data
|
||||||
@@ -37,11 +37,12 @@ class Origami::VoucherController < BaseOrigamiController
|
|||||||
auth_token = member_actions.auth_token.to_s
|
auth_token = member_actions.auth_token.to_s
|
||||||
# membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
# membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
||||||
# if membership_data["status"]==true
|
# if membership_data["status"]==true
|
||||||
|
# app_token: token,membership_id:membership_id,
|
||||||
|
# campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
|
||||||
|
# auth_token:auth_token
|
||||||
begin
|
begin
|
||||||
response = HTTParty.get(url,
|
response = HTTParty.get(url,
|
||||||
:body => { app_token: token,membership_id:membership_id,
|
:body => { voucher_no: voucher_no,membership_id:membership_id
|
||||||
campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
|
|
||||||
auth_token:auth_token
|
|
||||||
}.to_json,
|
}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
|||||||
74
app/controllers/settings/item_sets_controller.rb
Normal file
74
app/controllers/settings/item_sets_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
class Settings::ItemSetsController < ApplicationController
|
||||||
|
before_action :set_settings_item_set, only: [:show, :edit, :update, :destroy]
|
||||||
|
load_and_authorize_resource except: [:create]
|
||||||
|
# GET /settings/item_sets
|
||||||
|
# GET /settings/item_sets.json
|
||||||
|
def index
|
||||||
|
@settings_item_sets = ItemSet.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/item_sets/1
|
||||||
|
# GET /settings/item_sets/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/item_sets/new
|
||||||
|
def new
|
||||||
|
@settings_item_set = ItemSet.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/item_sets/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /settings/item_sets
|
||||||
|
# POST /settings/item_sets.json
|
||||||
|
def create
|
||||||
|
@settings_item_set = ItemSet.new(settings_item_set_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_item_set.save
|
||||||
|
format.html { redirect_to settings_item_sets_path, notice: 'Item set was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @settings_item_set }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /settings/item_sets/1
|
||||||
|
# PATCH/PUT /settings/item_sets/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_item_set.update(settings_item_set_params)
|
||||||
|
format.html { redirect_to settings_item_sets_path, notice: 'Item set was successfully updated.' }
|
||||||
|
format.json { render :show, status: :ok, location: @settings_item_set }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: @settings_item_set.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /settings/item_sets/1
|
||||||
|
# DELETE /settings/item_sets/1.json
|
||||||
|
def destroy
|
||||||
|
@settings_item_set.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to settings_item_sets_url, notice: 'Item set was successfully destroyed.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_settings_item_set
|
||||||
|
@settings_item_set = ItemSet.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
def settings_item_set_params
|
||||||
|
params.require(:item_set).permit(:name, :alt_name, :min_selectable_qty, :max_selectable_qty)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -89,6 +89,6 @@ class Settings::MenuCategoriesController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_menu_category_params
|
def settings_menu_category_params
|
||||||
params.require(:menu_category).permit(:code, :menu_id, :name, :alt_name, :order_by, :menu_category_id)
|
params.require(:menu_category).permit(:code, :menu_id, :name, :alt_name, :order_by, :menu_category_id, :is_available)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,12 +21,14 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
id = MenuItemInstance.findParentCategory(@item)
|
id = MenuItemInstance.findParentCategory(@item)
|
||||||
@category = MenuCategory.find(id)
|
@category = MenuCategory.find(id)
|
||||||
@settings_menu_item_instances = MenuItemInstance.new
|
@settings_menu_item_instances = MenuItemInstance.new
|
||||||
|
@item_sets = ItemSet.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/menu_item_instances/1/edit
|
# GET /settings/menu_item_instances/1/edit
|
||||||
def edit
|
def edit
|
||||||
id = MenuItemInstance.findParentCategory(@item)
|
id = MenuItemInstance.findParentCategory(@item)
|
||||||
@category = MenuCategory.find(id)
|
@category = MenuCategory.find(id)
|
||||||
|
@item_sets = ItemSet.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /settings/menu_item_instances
|
# POST /settings/menu_item_instances
|
||||||
@@ -45,6 +47,18 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
|
|
||||||
id = MenuItemInstance.findParentCategory(catID)
|
id = MenuItemInstance.findParentCategory(catID)
|
||||||
category = MenuCategory.find(id)
|
category = MenuCategory.find(id)
|
||||||
|
|
||||||
|
# Bind for Item Sets
|
||||||
|
if params[:menu_item_instance][:item_sets].count > 1
|
||||||
|
params[:menu_item_instance][:item_sets].delete_at(0)
|
||||||
|
|
||||||
|
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
|
||||||
|
|
||||||
|
if sets.count > 0
|
||||||
|
@settings_menu_item.item_sets = sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item_instances.save
|
if @settings_menu_item_instances.save
|
||||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||||
@@ -70,6 +84,18 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
|
|
||||||
id = MenuItemInstance.findParentCategory(catID)
|
id = MenuItemInstance.findParentCategory(catID)
|
||||||
category = MenuCategory.find(id)
|
category = MenuCategory.find(id)
|
||||||
|
|
||||||
|
# Bind for Item Sets
|
||||||
|
if params[:menu_item_instance][:item_sets].count > 1
|
||||||
|
params[:menu_item_instance][:item_sets].delete_at(0)
|
||||||
|
|
||||||
|
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
|
||||||
|
|
||||||
|
if sets.count > 0
|
||||||
|
@settings_menu_item.item_sets = sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
||||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||||
@@ -122,8 +148,6 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_menu_item_instance_params
|
def settings_menu_item_instance_params
|
||||||
|
params.require(:menu_item_instance).permit(:item_instance_code, :item_instance_name, :price, :item_attributes, :is_on_promotion, :promotion_price, :is_available,:menu_category_id,:menu_item_id, :is_default, :item_sets)
|
||||||
params.require(:menu_item_instance).permit(:item_instance_code, :item_instance_name, :price, :item_attributes, :is_on_promotion, :promotion_price, :is_available,:menu_category_id,:menu_item_id)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -70,6 +70,6 @@ class Settings::MenuItemOptionsController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_menu_item_option_params
|
def settings_menu_item_option_params
|
||||||
params.require(:menu_item_option).permit(:name, :value)
|
params.require(:menu_item_option).permit(:option_type, :name, :value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
74
app/controllers/settings/menu_item_sets_controller.rb
Normal file
74
app/controllers/settings/menu_item_sets_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
class Settings::MenuItemSetsController < ApplicationController
|
||||||
|
before_action :set_settings_menu_item_set, only: [:show, :edit, :update, :destroy]
|
||||||
|
load_and_authorize_resource except: [:create]
|
||||||
|
# GET /settings/menu_item_sets
|
||||||
|
# GET /settings/menu_item_sets.json
|
||||||
|
def index
|
||||||
|
@settings_menu_item_sets = MenuItemSet.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/menu_item_sets/1
|
||||||
|
# GET /settings/menu_item_sets/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/menu_item_sets/new
|
||||||
|
def new
|
||||||
|
@settings_menu_item_set = MenuItemSet.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/menu_item_sets/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /settings/menu_item_sets
|
||||||
|
# POST /settings/menu_item_sets.json
|
||||||
|
def create
|
||||||
|
@settings_menu_item_set = MenuItemSet.new(settings_menu_item_set_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_menu_item_set.save
|
||||||
|
format.html { redirect_to settings_menu_item_sets_path, notice: 'Menu item set was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @settings_menu_item_set }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @settings_menu_item_set.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /settings/menu_item_sets/1
|
||||||
|
# PATCH/PUT /settings/menu_item_sets/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_menu_item_set.update(settings_menu_item_set_params)
|
||||||
|
format.html { redirect_to settings_menu_item_sets_path, notice: 'Menu item set was successfully updated.' }
|
||||||
|
format.json { render :show, status: :ok, location: @settings_menu_item_set }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: @settings_menu_item_set.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /settings/menu_item_sets/1
|
||||||
|
# DELETE /settings/menu_item_sets/1.json
|
||||||
|
def destroy
|
||||||
|
@settings_menu_item_set.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to settings_menu_item_sets_url, notice: 'Menu item set was successfully destroyed.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_settings_menu_item_set
|
||||||
|
@settings_menu_item_set = MenuItemSet.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
def settings_menu_item_set_params
|
||||||
|
params.require(:menu_item_set).permit(:item_set_id, :menu_item_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
class Settings::SetMenuItemsController < ApplicationController
|
class Settings::SetMenuItemsController < ApplicationController
|
||||||
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy]
|
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy]
|
||||||
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update]
|
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update]
|
||||||
|
before_action :set_settings_item_attribute, only: [:index, :show, :edit, :new, :update ,:create]
|
||||||
|
before_action :set_settings_item_option, only: [:index, :show, :edit, :new, :update ,:create]
|
||||||
# GET /settings/menu_items
|
# GET /settings/menu_items
|
||||||
# GET /settings/menu_items.json
|
# GET /settings/menu_items.json
|
||||||
def index
|
def index
|
||||||
@@ -10,32 +12,52 @@ class Settings::SetMenuItemsController < ApplicationController
|
|||||||
# GET /settings/menu_items/1
|
# GET /settings/menu_items/1
|
||||||
# GET /settings/menu_items/1.json
|
# GET /settings/menu_items/1.json
|
||||||
def show
|
def show
|
||||||
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||||
|
|
||||||
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/menu_items/new
|
# GET /settings/menu_items/new
|
||||||
def new
|
def new
|
||||||
@settings_menu_item = MenuItem.new
|
@settings_menu_item = MenuItem.new
|
||||||
@settings_menu_item.type = "SetMenuItem"
|
@settings_menu_item.type = "SetMenuItem"
|
||||||
|
@item_sets = ItemSet.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/menu_items/1/edit
|
# GET /settings/menu_items/1/edit
|
||||||
def edit
|
def edit
|
||||||
|
@item_sets = ItemSet.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /settings/menu_items
|
# POST /settings/menu_items
|
||||||
# POST /settings/menu_items.json
|
# POST /settings/menu_items.json
|
||||||
def create
|
def create
|
||||||
@settings_menu_item = MenuItem.new(settings_menu_item_params)
|
@settings_menu_item = MenuItem.new(settings_menu_item_params)
|
||||||
if params[:simple_menu_item][:menu_item_id] == ''
|
|
||||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
# if params[:set_menu_item][:menu_item_id] == ''
|
||||||
end
|
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||||
|
# end
|
||||||
@settings_menu_item.created_by = current_login_employee.name
|
@settings_menu_item.created_by = current_login_employee.name
|
||||||
|
|
||||||
|
# Remove "" default first
|
||||||
|
params[:set_menu_item][:item_attributes].delete_at(0)
|
||||||
|
params[:set_menu_item][:item_options].delete_at(0)
|
||||||
|
|
||||||
|
# Bind for Item Sets
|
||||||
|
if params[:set_menu_item][:item_sets].count > 1
|
||||||
|
params[:set_menu_item][:item_sets].delete_at(0)
|
||||||
|
|
||||||
|
sets = ItemSet.find(params[:set_menu_item][:item_sets])
|
||||||
|
|
||||||
|
if sets.count > 0
|
||||||
|
@settings_menu_item.item_sets = sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item.save
|
if @settings_menu_item.save
|
||||||
|
menu_item = MenuItem.find(@settings_menu_item.id)
|
||||||
|
menu_item.update_attributes(item_attributes: params[:set_menu_item][:item_attributes], item_options: params[:set_menu_item][:item_options])
|
||||||
|
|
||||||
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully created.' }
|
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_menu_item }
|
format.json { render :show, status: :created, location: @settings_menu_item }
|
||||||
else
|
else
|
||||||
@@ -48,8 +70,27 @@ class Settings::SetMenuItemsController < ApplicationController
|
|||||||
# PATCH/PUT /settings/menu_items/1
|
# PATCH/PUT /settings/menu_items/1
|
||||||
# PATCH/PUT /settings/menu_items/1.json
|
# PATCH/PUT /settings/menu_items/1.json
|
||||||
def update
|
def update
|
||||||
|
# Remove "" default first
|
||||||
|
params[:set_menu_item][:item_attributes].delete_at(0)
|
||||||
|
params[:set_menu_item][:item_options].delete_at(0)
|
||||||
|
|
||||||
|
# Bind for Item Sets
|
||||||
|
if params[:set_menu_item][:item_sets].count > 1
|
||||||
|
params[:set_menu_item][:item_sets].delete_at(0)
|
||||||
|
|
||||||
|
sets = ItemSet.find(params[:set_menu_item][:item_sets])
|
||||||
|
|
||||||
|
if sets.count > 0
|
||||||
|
@settings_menu_item.item_sets = sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item.update(settings_menu_item_params)
|
if @settings_menu_item.update(settings_menu_item_params)
|
||||||
|
@settings_menu_item.update_attributes(item_attributes: params[:set_menu_item][:item_attributes], item_options: params[:set_menu_item][:item_options])
|
||||||
|
|
||||||
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully updated.' }
|
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @settings_menu_item }
|
format.json { render :show, status: :ok, location: @settings_menu_item }
|
||||||
else
|
else
|
||||||
@@ -62,6 +103,8 @@ class Settings::SetMenuItemsController < ApplicationController
|
|||||||
# DELETE /settings/menu_items/1
|
# DELETE /settings/menu_items/1
|
||||||
# DELETE /settings/menu_items/1.json
|
# DELETE /settings/menu_items/1.json
|
||||||
def destroy
|
def destroy
|
||||||
|
path_to_file = @settings_menu_item.image_path.to_s
|
||||||
|
File.delete(path_to_file) if File.exist?(path_to_file)
|
||||||
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
||||||
@@ -79,8 +122,16 @@ class Settings::SetMenuItemsController < ApplicationController
|
|||||||
@category = MenuCategory.find(params[:menu_category_id])
|
@category = MenuCategory.find(params[:menu_category_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_settings_item_attribute
|
||||||
|
@item_attributes = MenuItemAttribute.all.order("id asc").map{|a| [a.name, a.value]}
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_settings_item_option
|
||||||
|
@item_options = MenuItemOption.all
|
||||||
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_menu_item_params
|
def settings_menu_item_params
|
||||||
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id,:account_id , :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
|
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
class Settings::SimpleMenuItemsController < ApplicationController
|
class Settings::SimpleMenuItemsController < ApplicationController
|
||||||
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy ]
|
before_action :set_settings_menu_item, only: [:show, :edit, :update, :destroy ]
|
||||||
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update ,:create]
|
before_action :set_settings_menu_category, only: [:index, :show, :edit, :new, :update ,:create]
|
||||||
|
before_action :set_settings_item_attribute, only: [:index, :show, :edit, :new, :update ,:create]
|
||||||
|
before_action :set_settings_item_option, only: [:index, :show, :edit, :new, :update ,:create]
|
||||||
# GET /settings/menu_items
|
# GET /settings/menu_items
|
||||||
# GET /settings/menu_items.json
|
# GET /settings/menu_items.json
|
||||||
def index
|
def index
|
||||||
@@ -10,29 +12,75 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
|||||||
# GET /settings/menu_items/1
|
# GET /settings/menu_items/1
|
||||||
# GET /settings/menu_items/1.json
|
# GET /settings/menu_items/1.json
|
||||||
def show
|
def show
|
||||||
@sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
# @sub_menu = MenuItem.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||||
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
@menu_item_instance = MenuItemInstance.where("menu_item_id=?",params[:id]).page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/menu_items/new
|
# GET /settings/menu_items/new
|
||||||
def new
|
def new
|
||||||
@settings_menu_item = MenuItem.new
|
@settings_menu_item = MenuItem.new
|
||||||
|
@item_sets = ItemSet.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/menu_items/1/edit
|
# GET /settings/menu_items/1/edit
|
||||||
def edit
|
def edit
|
||||||
|
@item_sets = ItemSet.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /settings/menu_items
|
# POST /settings/menu_items
|
||||||
# POST /settings/menu_items.json
|
# POST /settings/menu_items.json
|
||||||
def create
|
def create
|
||||||
@settings_menu_item = MenuItem.new(settings_menu_item_params)
|
@settings_menu_item = MenuItem.new(settings_menu_item_params)
|
||||||
if params[:simple_menu_item][:menu_item_id] == ''
|
|
||||||
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
# if params[:simple_menu_item][:menu_item_id] == ''
|
||||||
end
|
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||||
|
# end
|
||||||
@settings_menu_item.created_by = current_login_employee.name
|
@settings_menu_item.created_by = current_login_employee.name
|
||||||
|
|
||||||
|
# Remove "" default first
|
||||||
|
params[:simple_menu_item][:item_attributes].delete_at(0)
|
||||||
|
params[:simple_menu_item][:item_options].delete_at(0)
|
||||||
|
|
||||||
|
# attr_format = []
|
||||||
|
# param_count = params[:simple_menu_item][:item_attributes].count
|
||||||
|
# # Format for attributes json
|
||||||
|
# params[:simple_menu_item][:item_attributes].each do|attr_id|
|
||||||
|
# menu_attr = MenuItemAttribute.find(attr_id)
|
||||||
|
# if attr_format.count == 0
|
||||||
|
# attr_format.push({ type: menu_attr.attribute_type, value: [] })
|
||||||
|
# end
|
||||||
|
|
||||||
|
# attr_format.each do |af|
|
||||||
|
# if menu_attr.attribute_type == af[:type]
|
||||||
|
# af[:value].push(menu_attr.value)
|
||||||
|
# else
|
||||||
|
# new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
|
||||||
|
# attr_format.push(new_attr)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# break if attr_format.count > param_count
|
||||||
|
# end
|
||||||
|
|
||||||
|
# param_count -= 1
|
||||||
|
# end
|
||||||
|
# @settings_menu_item.item_attributes = attr_format
|
||||||
|
|
||||||
|
# Bind for Item Sets
|
||||||
|
if params[:simple_menu_item][:item_sets].count > 1
|
||||||
|
params[:simple_menu_item][:item_sets].delete_at(0)
|
||||||
|
|
||||||
|
sets = ItemSet.find(params[:simple_menu_item][:item_sets])
|
||||||
|
|
||||||
|
if sets.count > 0
|
||||||
|
@settings_menu_item.item_sets = sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item.save
|
if @settings_menu_item.save
|
||||||
|
menu_item = MenuItem.find(@settings_menu_item.id)
|
||||||
|
menu_item.update_attributes(item_options: params[:simple_menu_item][:item_options])
|
||||||
|
|
||||||
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' }
|
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_menu_item }
|
format.json { render :show, status: :created, location: @settings_menu_item }
|
||||||
else
|
else
|
||||||
@@ -45,8 +93,26 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
|||||||
# PATCH/PUT /settings/menu_items/1
|
# PATCH/PUT /settings/menu_items/1
|
||||||
# PATCH/PUT /settings/menu_items/1.json
|
# PATCH/PUT /settings/menu_items/1.json
|
||||||
def update
|
def update
|
||||||
|
# Remove "" default first
|
||||||
|
params[:simple_menu_item][:item_attributes].delete_at(0)
|
||||||
|
params[:simple_menu_item][:item_options].delete_at(0)
|
||||||
|
|
||||||
|
# Bind for Item Sets
|
||||||
|
if params[:simple_menu_item][:item_sets].count > 1
|
||||||
|
params[:simple_menu_item][:item_sets].delete_at(0)
|
||||||
|
|
||||||
|
sets = ItemSet.find(params[:simple_menu_item][:item_sets])
|
||||||
|
|
||||||
|
if sets.count > 0
|
||||||
|
@settings_menu_item.item_sets = sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@settings_menu_item.menu_category_id = params[:menu_category_id]
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item.update(settings_menu_item_params)
|
if @settings_menu_item.update(settings_menu_item_params)
|
||||||
|
@settings_menu_item.update_attributes(item_attributes: params[:simple_menu_item][:item_attributes], item_options: params[:simple_menu_item][:item_options])
|
||||||
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully updated.' }
|
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @settings_menu_item }
|
format.json { render :show, status: :ok, location: @settings_menu_item }
|
||||||
else
|
else
|
||||||
@@ -59,6 +125,8 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
|||||||
# DELETE /settings/menu_items/1
|
# DELETE /settings/menu_items/1
|
||||||
# DELETE /settings/menu_items/1.json
|
# DELETE /settings/menu_items/1.json
|
||||||
def destroy
|
def destroy
|
||||||
|
path_to_file = @settings_menu_item.image_path.to_s
|
||||||
|
File.delete(path_to_file) if File.exist?(path_to_file)
|
||||||
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
||||||
@@ -76,8 +144,16 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
|||||||
@category = MenuCategory.find(params[:menu_category_id])
|
@category = MenuCategory.find(params[:menu_category_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_settings_item_attribute
|
||||||
|
@item_attributes = MenuItemAttribute.all.order("id asc") #.map{|a| [a.name, a.value]}
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_settings_item_option
|
||||||
|
@item_options = MenuItemOption.all
|
||||||
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_menu_item_params
|
def settings_menu_item_params
|
||||||
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :menu_category_id,:account_id,:item_attributes, :menu_item_id, :min_qty, :min_selectable_item, :max_selectable_item, :created_by)
|
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,18 +3,17 @@ class Transactions::OrdersController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
|
|
||||||
filter = params[:filter]
|
filter = params[:filter]
|
||||||
|
count = params[:count]
|
||||||
from = params[:from]
|
from = params[:from]
|
||||||
to = params[:to]
|
to = params[:to]
|
||||||
|
|
||||||
if filter.nil? || from.nil? || to.nil?
|
if filter.nil? && from.nil? && to.nil? && count.nil?
|
||||||
orders = Order.order("order_id desc")
|
orders = Order.order("order_id desc")
|
||||||
|
puts "ssssss"
|
||||||
else
|
else
|
||||||
orders = Order.search(filter,from,to)
|
orders = Order.search(filter,from,to,count)
|
||||||
# if order.count > 0
|
puts "aaaaa"
|
||||||
# orders = order
|
|
||||||
# else
|
|
||||||
# orders = Order.order("order_id desc")
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if !orders.nil?
|
if !orders.nil?
|
||||||
@@ -22,6 +21,7 @@ class Transactions::OrdersController < ApplicationController
|
|||||||
else
|
else
|
||||||
@orders = []
|
@orders = []
|
||||||
end
|
end
|
||||||
|
puts @orders.to_json
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.json { render json: @orders }
|
format.json { render json: @orders }
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
|
||||||
def flash_class(level)
|
def flash_class(level)
|
||||||
case level
|
case level
|
||||||
when :notice then "alert alert-info fade-in"
|
when :notice then "alert alert-info fade-in"
|
||||||
|
|||||||
2
app/helpers/origami/addorders_helper.rb
Normal file
2
app/helpers/origami/addorders_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Origami::AddordersHelper
|
||||||
|
end
|
||||||
2
app/helpers/settings/item_sets_helper.rb
Normal file
2
app/helpers/settings/item_sets_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Settings::ItemSetsHelper
|
||||||
|
end
|
||||||
2
app/helpers/settings/menu_item_sets_helper.rb
Normal file
2
app/helpers/settings/menu_item_sets_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Settings::MenuItemSetsHelper
|
||||||
|
end
|
||||||
@@ -4,137 +4,131 @@ class Ability
|
|||||||
def initialize(user)
|
def initialize(user)
|
||||||
user ||= Employee.new
|
user ||= Employee.new
|
||||||
|
|
||||||
if user.role == 'administrator'
|
if user.role == "administrator"
|
||||||
|
can :manage, :all
|
||||||
|
elsif user.role == "manager"
|
||||||
|
can :manage, Menu
|
||||||
|
can :manage, MenuCategory
|
||||||
|
can :manage, MenuItemAttribute
|
||||||
|
can :manage, MenuItemInstance
|
||||||
|
can :manage, MenuItemOption
|
||||||
|
can :manage, SetMenuItem
|
||||||
|
can :manage, ItemSet
|
||||||
|
can :manage, MenuItemSet
|
||||||
|
can :manage, OrderQueueStation
|
||||||
|
can :manage, Zone
|
||||||
|
can :manage, CashierTerminal
|
||||||
|
can :manage, Employee
|
||||||
|
# can :manage, MembershipSetting
|
||||||
|
# can :manage, MembershipAction
|
||||||
|
# can :manage, PaymentMethodSetting
|
||||||
|
can :manage, TaxProfile
|
||||||
|
can :manage, PrintSetting
|
||||||
|
can :manage, Account
|
||||||
|
|
||||||
can :manage, :all
|
can :manage, Order
|
||||||
|
can :manage, Sale
|
||||||
|
|
||||||
elsif user.role == 'manager'
|
can :manage, Customer
|
||||||
|
can :manage, DiningQueue
|
||||||
|
|
||||||
can :manage, Menu
|
can :index, :dailysale
|
||||||
can :manage, MenuCategory
|
can :index, :saleitem
|
||||||
can :manage, MenuItemAttribute
|
can :index, :receipt_no
|
||||||
can :manage, MenuItemInstance
|
can :index, :shiftsale
|
||||||
can :manage, MenuItemOption
|
can :index, :credit_payment
|
||||||
can :manage, SetMenuItem
|
can :index, :void_sale
|
||||||
can :manage, OrderQueueStation
|
|
||||||
can :manage, Zone
|
|
||||||
can :manage, CashierTerminal
|
|
||||||
can :manage, Employee
|
|
||||||
# can :manage, MembershipSetting
|
|
||||||
# can :manage, MembershipAction
|
|
||||||
# can :manage, PaymentMethodSetting
|
|
||||||
can :manage, TaxProfile
|
|
||||||
can :manage, PrintSetting
|
|
||||||
can :manage, Account
|
|
||||||
|
|
||||||
can :manage, Order
|
can :get_customer, Customer
|
||||||
can :manage, Sale
|
can :add_customer, Customer
|
||||||
|
can :update_sale_by_customer, Customer
|
||||||
|
|
||||||
can :manage, Customer
|
can :index, :other_charge
|
||||||
can :manage, DiningQueue
|
can :create, :other_charge
|
||||||
|
can :index, :discount
|
||||||
|
can :create, :discount
|
||||||
|
can :remove_discount_items, :discount
|
||||||
|
can :remove_all_discount, :discount
|
||||||
|
|
||||||
can :index, :dailysale
|
can :first_bill, :payment
|
||||||
can :index, :saleitem
|
can :show, :payment
|
||||||
can :index, :receipt_no
|
can :create, :payment
|
||||||
can :index, :shiftsale
|
can :reprint, :payment
|
||||||
can :index, :credit_payment
|
can :rounding_adj, :payment
|
||||||
can :index, :void_sale
|
can :foc, :payment
|
||||||
|
|
||||||
can :get_customer, Customer
|
|
||||||
can :add_customer, Customer
|
|
||||||
can :update_sale_by_customer, Customer
|
|
||||||
|
|
||||||
can :index, :other_charge
|
can :move_dining, :movetable
|
||||||
can :create, :other_charge
|
can :moving, :movetable
|
||||||
can :index, :discount
|
|
||||||
can :create, :discount
|
|
||||||
can :remove_discount_items, :discount
|
|
||||||
can :remove_all_discount, :discount
|
|
||||||
|
|
||||||
can :first_bill, :payment
|
can :move_dining, :moveroom
|
||||||
can :show, :payment
|
|
||||||
can :create, :payment
|
|
||||||
can :reprint, :payment
|
|
||||||
can :rounding_adj, :payment
|
|
||||||
|
|
||||||
can :move_dining, :movetable
|
can :edit, :sale_edit
|
||||||
can :moving, :movetable
|
can :item_void, :sale_edit
|
||||||
|
can :item_void_cancel, :sale_edit
|
||||||
|
can :cancel_all_void, :sale_edit
|
||||||
|
can :apply_void, :sale_edit
|
||||||
|
|
||||||
can :move_dining, :moveroom
|
can :overall_void, :void
|
||||||
|
|
||||||
can :edit, :sale_edit
|
elsif user.role == "cashier"
|
||||||
can :item_void, :sale_edit
|
|
||||||
can :item_void_cancel, :sale_edit
|
# can :overall_void, :void
|
||||||
can :cancel_all_void, :sale_edit
|
|
||||||
can :apply_void, :sale_edit
|
|
||||||
|
|
||||||
can :overall_void, :void
|
can :read, Order
|
||||||
|
can :update, Order
|
||||||
|
|
||||||
|
can :read, Sale
|
||||||
|
can :update, Sale
|
||||||
|
can :get_customer, Customer
|
||||||
|
can :add_customer, Customer
|
||||||
|
can :update_sale_by_customer, Customer
|
||||||
|
|
||||||
elsif user.role == 'cashier'
|
can :index, :other_charge
|
||||||
|
can :create, :other_charge
|
||||||
|
can :index, :discount
|
||||||
|
can :create, :discount
|
||||||
|
can :remove_discount_items, :discount
|
||||||
|
can :remove_all_discount, :discount
|
||||||
|
can :member_discount, :discount
|
||||||
|
|
||||||
# can :overall_void, :void
|
can :first_bill, :payment
|
||||||
|
can :show, :payment
|
||||||
|
can :create, :payment
|
||||||
|
can :reprint, :payment
|
||||||
|
can :rounding_adj, :payment
|
||||||
|
|
||||||
can :read, Order
|
can :move_dining, :movetable
|
||||||
can :update, Order
|
can :moving, :movetable
|
||||||
|
|
||||||
can :read, Sale
|
can :move_dining, :moveroom
|
||||||
can :update, Sale
|
|
||||||
can :get_customer, Customer
|
|
||||||
can :add_customer, Customer
|
|
||||||
can :update_sale_by_customer, Customer
|
|
||||||
|
|
||||||
can :index, :other_charge
|
can :manage, DiningQueue
|
||||||
can :create, :other_charge
|
|
||||||
can :index, :discount
|
elsif user.role == "account"
|
||||||
can :create, :discount
|
|
||||||
can :remove_discount_items, :discount
|
|
||||||
can :remove_all_discount, :discount
|
|
||||||
can :member_discount, :discount
|
|
||||||
|
|
||||||
can :first_bill, :payment
|
can :index, :dailysale
|
||||||
can :show, :payment
|
can :index, :saleitem
|
||||||
can :create, :payment
|
can :index, :receipt_no
|
||||||
can :reprint, :payment
|
can :index, :shiftsale
|
||||||
can :rounding_adj, :payment
|
can :index, :credit_payment
|
||||||
|
can :index, :void_sale
|
||||||
|
|
||||||
can :move_dining, :movetable
|
elsif user.role == "supervisour"
|
||||||
can :moving, :movetable
|
|
||||||
|
|
||||||
can :move_dining, :moveroom
|
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 :first_bill, :payment
|
||||||
can :show, :payment
|
can :create, :payment
|
||||||
can :create, :payment
|
can :show, :payment
|
||||||
can :reprint, :payment
|
can :reprint, :payment
|
||||||
|
can :rounding_adj, :payment
|
||||||
can :manage, DiningQueue
|
|
||||||
|
|
||||||
elsif user.role == 'account'
|
|
||||||
|
|
||||||
can :index, :dailysale
|
|
||||||
can :index, :saleitem
|
|
||||||
can :index, :receipt_no
|
|
||||||
can :index, :shiftsale
|
|
||||||
can :index, :credit_payment
|
|
||||||
can :index, :void_sale
|
|
||||||
|
|
||||||
elsif user.role == 'supervisour'
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class Employee < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.authenticate_by_token(session_token)
|
def self.authenticate_by_token(session_token)
|
||||||
|
|
||||||
if (session_token)
|
if (session_token)
|
||||||
user = Employee.find_by_token_session(session_token)
|
user = Employee.find_by_token_session(session_token)
|
||||||
if user && user.session_expiry.utc > DateTime.now.utc
|
if user && user.session_expiry.utc > DateTime.now.utc
|
||||||
|
|||||||
9
app/models/item_set.rb
Normal file
9
app/models/item_set.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class ItemSet < ApplicationRecord
|
||||||
|
has_many :menu_item_sets
|
||||||
|
has_many :menu_items, through: :menu_item_sets
|
||||||
|
|
||||||
|
has_many :menu_instance_item_sets
|
||||||
|
has_many :menu_item_instances, through: :menu_instance_item_sets
|
||||||
|
|
||||||
|
validates_presence_of :name
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class MenuCategory < ApplicationRecord
|
class MenuCategory < ApplicationRecord
|
||||||
before_create :generate_menu_category_code
|
# before_create :generate_menu_category_code
|
||||||
|
|
||||||
belongs_to :menu
|
belongs_to :menu
|
||||||
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
||||||
@@ -37,7 +37,7 @@ class MenuCategory < ApplicationRecord
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_menu_category_code
|
# def generate_menu_category_code
|
||||||
self.code = SeedGenerator.generate_code(self.class.name, "C")
|
# self.code = SeedGenerator.generate_code(self.class.name, "C")
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|||||||
4
app/models/menu_instance_item_set.rb
Normal file
4
app/models/menu_instance_item_set.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class MenuInstanceItemSet < ApplicationRecord
|
||||||
|
belongs_to :item_set
|
||||||
|
belongs_to :menu_item_instance
|
||||||
|
end
|
||||||
@@ -1,20 +1,25 @@
|
|||||||
class MenuItem < ApplicationRecord
|
class MenuItem < ApplicationRecord
|
||||||
|
# before_create :generate_menu_item_code
|
||||||
before_create :generate_menu_item_code
|
|
||||||
|
|
||||||
belongs_to :menu_category, :optional => true
|
belongs_to :menu_category, :optional => true
|
||||||
has_many :menu_item_instances
|
has_many :menu_item_instances
|
||||||
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
# belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
||||||
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
# has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
|
|
||||||
validates_presence_of :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
|
has_many :menu_item_sets
|
||||||
|
has_many :item_sets, through: :menu_item_sets
|
||||||
|
|
||||||
|
validates_presence_of :name, :type, :min_qty, :taxable
|
||||||
|
|
||||||
default_scope { order('item_code asc') }
|
default_scope { order('item_code asc') }
|
||||||
|
|
||||||
scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') }
|
scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') }
|
||||||
scope :set_menu_item, -> { where(type: 'SetMenuItem') }
|
scope :set_menu_item, -> { where(type: 'SetMenuItem') }
|
||||||
|
|
||||||
|
# Item Image Uploader
|
||||||
|
mount_uploader :image_path, MenuItemImageUploader
|
||||||
|
|
||||||
def self.collection
|
def self.collection
|
||||||
MenuItem.select("id, name").map { |e| [e.name, e.id] }
|
MenuItem.select("id, name").map { |e| [e.name, e.id] }
|
||||||
end
|
end
|
||||||
@@ -70,10 +75,10 @@ class MenuItem < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
# private
|
||||||
|
|
||||||
def generate_menu_item_code
|
# def generate_menu_item_code
|
||||||
self.item_code = SeedGenerator.generate_code(self.class.name, "I")
|
# self.item_code = SeedGenerator.generate_code(self.class.name, "I")
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class MenuItemAttribute < ApplicationRecord
|
class MenuItemAttribute < ApplicationRecord
|
||||||
validates_presence_of :attribute_type, :name, :value
|
validates_presence_of :attribute_type, :name, :value
|
||||||
def self.collection
|
def self.collection
|
||||||
MenuItemAttribute.select("id, name").map { |e| [e.name, e.id] }
|
MenuItemAttribute.select("name, value").map { |e| [e.name, e.value] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
class MenuItemInstance < ApplicationRecord
|
class MenuItemInstance < ApplicationRecord
|
||||||
belongs_to :menu_item
|
belongs_to :menu_item
|
||||||
before_create :generate_menu_item_instance_code
|
|
||||||
|
has_many :menu_instance_item_sets
|
||||||
|
has_many :item_sets, through: :menu_instance_item_sets
|
||||||
|
# before_create :generate_menu_item_instance_code
|
||||||
|
|
||||||
def self.findParentCategory(item)
|
def self.findParentCategory(item)
|
||||||
if item.menu_category_id
|
if item.menu_category_id
|
||||||
@@ -11,9 +14,9 @@ class MenuItemInstance < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
# private
|
||||||
|
|
||||||
def generate_menu_item_instance_code
|
# def generate_menu_item_instance_code
|
||||||
self.item_instance_code = SeedGenerator.generate_code(self.class.name, "II")
|
# self.item_instance_code = SeedGenerator.generate_code(self.class.name, "II")
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
class MenuItemOption < ApplicationRecord
|
class MenuItemOption < ApplicationRecord
|
||||||
validates_presence_of :name, :value
|
validates_presence_of :name, :value
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
9
app/models/menu_item_set.rb
Normal file
9
app/models/menu_item_set.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class MenuItemSet < ApplicationRecord
|
||||||
|
belongs_to :item_set
|
||||||
|
belongs_to :menu_item
|
||||||
|
end
|
||||||
|
|
||||||
|
# class Settings::MenuItemSet < ApplicationRecord
|
||||||
|
# belongs_to :item_set_id
|
||||||
|
# belongs_to :menu_item_id
|
||||||
|
# end
|
||||||
@@ -65,7 +65,6 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def adding_line_items
|
def adding_line_items
|
||||||
|
|
||||||
if self.items
|
if self.items
|
||||||
#re-order to
|
#re-order to
|
||||||
ordered_list = re_order_items(self.items)
|
ordered_list = re_order_items(self.items)
|
||||||
@@ -320,12 +319,18 @@ class Order < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.search(filter,from,to)
|
def self.search(filter,from,to,count)
|
||||||
if !from.nil? && !to.nil?
|
if count.to_i > 0
|
||||||
Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to)
|
item_count = "and item_count = '#{count}'"
|
||||||
else
|
else
|
||||||
# find(:all)
|
item_count = ''
|
||||||
where("order_id LIKE ? OR item_count ='#{filter}'","%#{filter}%",)
|
end
|
||||||
|
if from.present? && to.present?
|
||||||
|
Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ? #{item_count}", from,to)
|
||||||
|
elsif !from.present? && !to.present? && count.present?
|
||||||
|
Order.where("item_count = '#{count}'")
|
||||||
|
else
|
||||||
|
Order.where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
#Bill Receipt Print
|
#Bill Receipt Print
|
||||||
def print_close_cashier(printer_settings,shift_sale,shop_details,sale_taxes)
|
def print_close_cashier(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
cashier = shift_sale.employee.name
|
cashier = shift_sale.employee.name
|
||||||
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
||||||
|
|
||||||
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes)
|
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
|
||||||
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
self.print(filename)
|
self.print(filename)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class Sale < ApplicationRecord
|
|||||||
add_item(item)
|
add_item(item)
|
||||||
end
|
end
|
||||||
|
|
||||||
# link_order_sale(order.id)
|
link_order_sale(order.id)
|
||||||
|
|
||||||
end
|
end
|
||||||
self.save!
|
self.save!
|
||||||
@@ -295,25 +295,33 @@ class Sale < ApplicationRecord
|
|||||||
total_tax_amount = 0
|
total_tax_amount = 0
|
||||||
#tax_profile - list by order_by
|
#tax_profile - list by order_by
|
||||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||||
|
customer = Customer.find(sale.customer_id)
|
||||||
# #Creat new tax records
|
# #Creat new tax records
|
||||||
tax_profiles.each do |tax|
|
tax_profiles.each do |tax|
|
||||||
sale_tax = SaleTax.new(:sale => sale)
|
customer.tax_profiles.each do |cus_tax|
|
||||||
sale_tax.tax_name = tax.name
|
if cus_tax.to_i == tax.id
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax = SaleTax.new(:sale => sale)
|
||||||
#include or execulive
|
sale_tax.tax_name = tax.name
|
||||||
# sale_tax.tax_payable_amount = total_taxable * tax.rate
|
sale_tax.tax_rate = tax.rate
|
||||||
|
|
||||||
# substract , to give after discount
|
# substract , to give after discount
|
||||||
total_tax = total_taxable - total_discount
|
total_tax = total_taxable - total_discount
|
||||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
#include or execulive
|
||||||
#new taxable amount is standard rule for step by step
|
if tax.inclusive
|
||||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
rate = tax.rate
|
||||||
|
divided_value = (100 + rate)/rate
|
||||||
|
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||||
|
else
|
||||||
|
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||||
|
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||||
|
end
|
||||||
|
#new taxable amount is standard rule for step by step
|
||||||
|
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||||
|
|
||||||
sale_tax.inclusive = tax.inclusive
|
sale_tax.inclusive = tax.inclusive
|
||||||
sale_tax.save
|
sale_tax.save
|
||||||
|
end
|
||||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sale.total_tax = total_tax_amount
|
sale.total_tax = total_tax_amount
|
||||||
@@ -321,12 +329,6 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
# Tax Calculate
|
# Tax Calculate
|
||||||
def apply_tax(total_taxable)
|
def apply_tax(total_taxable)
|
||||||
#if tax is not apply create new record
|
|
||||||
# self.sale_taxes.each do |existing_tax|
|
|
||||||
# #delete existing and create new
|
|
||||||
# existing_tax.delete
|
|
||||||
# end
|
|
||||||
|
|
||||||
#if tax is not apply create new record
|
#if tax is not apply create new record
|
||||||
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
||||||
#delete existing and create new
|
#delete existing and create new
|
||||||
@@ -336,27 +338,38 @@ class Sale < ApplicationRecord
|
|||||||
total_tax_amount = 0
|
total_tax_amount = 0
|
||||||
#tax_profile - list by order_by
|
#tax_profile - list by order_by
|
||||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||||
|
|
||||||
|
customer = Customer.find(self.customer_id)
|
||||||
|
|
||||||
# #Creat new tax records
|
#Create new tax records
|
||||||
tax_profiles.each do |tax|
|
tax_profiles.each do |tax|
|
||||||
sale_tax = SaleTax.new(:sale => self)
|
customer.tax_profiles.each do |cus_tax|
|
||||||
sale_tax.tax_name = tax.name
|
if cus_tax.to_i == tax.id
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax = SaleTax.new(:sale => self)
|
||||||
#include or execulive
|
sale_tax.tax_name = tax.name
|
||||||
# sale_tax.tax_payable_amount = total_taxable * tax.rate
|
sale_tax.tax_rate = tax.rate
|
||||||
total_tax = total_taxable - self.total_discount
|
|
||||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
|
||||||
#new taxable amount is standard rule for step by step
|
|
||||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
|
||||||
|
|
||||||
sale_tax.inclusive = tax.inclusive
|
# substract , to give after discount
|
||||||
sale_tax.save
|
total_tax = total_taxable - self.total_discount
|
||||||
|
#include or execulive
|
||||||
|
if tax.inclusive
|
||||||
|
rate = tax.rate
|
||||||
|
divided_value = (100 + rate)/rate
|
||||||
|
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||||
|
else
|
||||||
|
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||||
|
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||||
|
end
|
||||||
|
|
||||||
|
#new taxable amount is standard rule for step by step
|
||||||
|
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||||
|
|
||||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
sale_tax.inclusive = tax.inclusive
|
||||||
|
sale_tax.save
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.total_tax = total_tax_amount
|
self.total_tax = total_tax_amount
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def product_get_unit_price(item_code)
|
def product_get_unit_price(item_code)
|
||||||
@@ -401,7 +414,6 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.search(filter,from,to)
|
def self.search(filter,from,to)
|
||||||
|
|
||||||
if filter.blank?
|
if filter.blank?
|
||||||
keyword = ''
|
keyword = ''
|
||||||
else
|
else
|
||||||
@@ -418,7 +430,6 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.search_credit_sales(customer,filter,from,to)
|
def self.search_credit_sales(customer,filter,from,to)
|
||||||
|
|
||||||
if filter.blank?
|
if filter.blank?
|
||||||
keyword = ''
|
keyword = ''
|
||||||
else
|
else
|
||||||
@@ -436,7 +447,7 @@ class Sale < ApplicationRecord
|
|||||||
.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and sp.payment_method = 'creditnote' #{keyword} #{custo}", from,to)
|
.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and sp.payment_method = 'creditnote' #{keyword} #{custo}", from,to)
|
||||||
else
|
else
|
||||||
sale = Sale.all.joins("JOIN sale_payments sp on sp.sale_id = sales.sale_id")
|
sale = Sale.all.joins("JOIN sale_payments sp on sp.sale_id = sales.sale_id")
|
||||||
.where("sp.payment_method =? #{keyword} #{custo}",'creditnote')
|
.where("sp.payment_method ='creditnote' #{keyword} #{custo}")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -537,31 +548,25 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_by_range_by_saleitems(from,to,status,report_type)
|
def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||||
|
query = Sale.select("
|
||||||
|
mi.item_code as code,(SUM(i.qty) * i.unit_price) as grand_total,
|
||||||
|
SUM(i.qty) as total_item," +
|
||||||
|
" i.unit_price as unit_price,
|
||||||
|
mi.name as product_name,
|
||||||
|
mc.name as menu_category_name,
|
||||||
|
mc.id as menu_category_id ")
|
||||||
|
.group('mi.id')
|
||||||
|
.order("mi.menu_category_id")
|
||||||
|
|
||||||
query = Sale.select("
|
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
||||||
mi.item_code as code,(SUM(i.qty) * i.unit_price) as grand_total,
|
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||||
SUM(i.qty) as total_item," +
|
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
||||||
" i.unit_price as unit_price,
|
JOIN employees ea ON ea.id = sales.cashier_id")
|
||||||
mi.name as product_name,
|
|
||||||
mc.name as menu_category_name,
|
|
||||||
mc.id as menu_category_id ")
|
|
||||||
.group('mi.id')
|
|
||||||
.order("mi.menu_category_id")
|
|
||||||
|
|
||||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
|
||||||
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
|
||||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
|
||||||
JOIN employees ea ON ea.id = sales.cashier_id")
|
|
||||||
|
|
||||||
|
|
||||||
query = query.where("(receipt_date between ? and ? and sale_status=?) AND i.unit_price <> 0",from,to,status)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
query = query.where("(receipt_date between ? and ? and sale_status=?) AND i.unit_price <> 0",from,to,status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.get_by_shiftsales(from,to,shift)
|
def self.get_by_shiftsales(from,to,shift)
|
||||||
if !shift.blank?
|
if !shift.blank?
|
||||||
ShiftSale.where("id =?",shift.id)
|
ShiftSale.where("id =?",shift.id)
|
||||||
@@ -591,79 +596,77 @@ def self.get_item_query()
|
|||||||
|
|
||||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||||
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")
|
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||||
|
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||||
|
|
||||||
|
query = self.get_item_query()
|
||||||
|
discount_query = 0
|
||||||
|
total_card_amount = 0
|
||||||
|
total_cash_amount = 0
|
||||||
|
total_credit_amount = 0
|
||||||
|
total_foc_amount = 0
|
||||||
|
total_grand_total = 0
|
||||||
|
|
||||||
|
if shift.present?
|
||||||
|
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||||
|
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
|
||||||
|
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
|
||||||
|
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||||
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
|
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.to_a)
|
||||||
|
sale_cash.each do |s_c|
|
||||||
|
total_cash_amount += s_c.cash_amount.to_f
|
||||||
|
total_card_amount += s_c.card_amount.to_f
|
||||||
|
total_credit_amount += s_c.credit_amount.to_f
|
||||||
|
total_foc_amount += s_c.foc_amount.to_f
|
||||||
|
end
|
||||||
|
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||||
|
|
||||||
|
### => get all sales range in shift_sales
|
||||||
|
elsif shift_sale_range.present?
|
||||||
|
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||||
|
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
|
||||||
|
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
|
||||||
|
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||||
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
|
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
||||||
|
sale_cash.each do |s_c|
|
||||||
|
total_cash_amount += s_c.cash_amount.to_f
|
||||||
|
total_card_amount += s_c.card_amount.to_f
|
||||||
|
total_credit_amount += s_c.credit_amount.to_f
|
||||||
|
total_foc_amount += s_c.foc_amount.to_f
|
||||||
|
end
|
||||||
|
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||||
|
|
||||||
|
else
|
||||||
|
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||||
|
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
||||||
|
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
||||||
|
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
||||||
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
|
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", from,to)
|
||||||
|
sale_cash.each do |s_c|
|
||||||
|
total_cash_amount += s_c.cash_amount.to_f
|
||||||
|
total_card_amount += s_c.card_amount.to_f
|
||||||
|
total_credit_amount += s_c.credit_amount.to_f
|
||||||
|
total_foc_amount += s_c.foc_amount.to_f
|
||||||
|
end
|
||||||
|
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return query, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
|
||||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
|
||||||
|
|
||||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
|
||||||
|
|
||||||
query = self.get_item_query()
|
|
||||||
discount_query = 0
|
|
||||||
total_card_amount = 0
|
|
||||||
total_cash_amount = 0
|
|
||||||
total_credit_amount = 0
|
|
||||||
total_foc_amount = 0
|
|
||||||
total_grand_total = 0
|
|
||||||
|
|
||||||
if shift.present?
|
|
||||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
|
||||||
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
|
|
||||||
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
|
|
||||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
|
||||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.to_a)
|
|
||||||
sale_cash.each do |s_c|
|
|
||||||
total_cash_amount += s_c.cash_amount.to_f
|
|
||||||
total_card_amount += s_c.card_amount.to_f
|
|
||||||
total_credit_amount += s_c.credit_amount.to_f
|
|
||||||
total_foc_amount += s_c.foc_amount.to_f
|
|
||||||
end
|
|
||||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
|
||||||
|
|
||||||
### => get all sales range in shift_sales
|
|
||||||
elsif shift_sale_range.present?
|
|
||||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
|
||||||
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
|
|
||||||
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
|
|
||||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
|
||||||
.where("sales.shift_sale_id in (?) and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift_sale_range.to_a)
|
|
||||||
sale_cash.each do |s_c|
|
|
||||||
total_cash_amount += s_c.cash_amount.to_f
|
|
||||||
total_card_amount += s_c.card_amount.to_f
|
|
||||||
total_credit_amount += s_c.credit_amount.to_f
|
|
||||||
total_foc_amount += s_c.foc_amount.to_f
|
|
||||||
end
|
|
||||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
|
||||||
|
|
||||||
else
|
|
||||||
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
|
||||||
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
|
||||||
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
|
||||||
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar') then (sale_payments.payment_amount) else 0 end) as card_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='cash') then (sale_payments.payment_amount) else 0 end) as cash_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='creditnote') then (sale_payments.payment_amount) else 0 end) as credit_amount,
|
|
||||||
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
|
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
|
||||||
.where("sales.receipt_date between ? and ? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", from,to)
|
|
||||||
sale_cash.each do |s_c|
|
|
||||||
total_cash_amount += s_c.cash_amount.to_f
|
|
||||||
total_card_amount += s_c.card_amount.to_f
|
|
||||||
total_credit_amount += s_c.credit_amount.to_f
|
|
||||||
total_foc_amount += s_c.foc_amount.to_f
|
|
||||||
end
|
|
||||||
total_grand_total = total_cash_amount.to_f + total_card_amount.to_f + total_credit_amount.to_f
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
return query, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_type)
|
def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_type)
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status = giftcard_payment
|
payment_status = giftcard_payment
|
||||||
when "paypar"
|
when "paypar"
|
||||||
payment_status = paypar_payment
|
payment_status = paypar_payment
|
||||||
|
when "foc"
|
||||||
|
payment_status = foc_payment
|
||||||
else
|
else
|
||||||
puts "it was something else"
|
puts "it was something else"
|
||||||
end
|
end
|
||||||
@@ -164,6 +166,17 @@ class SalePayment < ApplicationRecord
|
|||||||
return payment_status
|
return payment_status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def foc_payment
|
||||||
|
payment_status = false
|
||||||
|
self.payment_method = "foc"
|
||||||
|
self.payment_amount = self.received_amount
|
||||||
|
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||||
|
self.payment_status = "paid"
|
||||||
|
payment_method = self.save!
|
||||||
|
sale_update_payment_status(self.received_amount)
|
||||||
|
return payment_status
|
||||||
|
end
|
||||||
|
|
||||||
def creditnote_payment(customer_id)
|
def creditnote_payment(customer_id)
|
||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
@@ -257,11 +270,15 @@ class SalePayment < ApplicationRecord
|
|||||||
all_received_amount = 0.0
|
all_received_amount = 0.0
|
||||||
sObj = Sale.find(self.sale_id)
|
sObj = Sale.find(self.sale_id)
|
||||||
is_credit = 0
|
is_credit = 0
|
||||||
|
is_foc = 0
|
||||||
sObj.sale_payments.each do |spay|
|
sObj.sale_payments.each do |spay|
|
||||||
all_received_amount += spay.payment_amount.to_f
|
all_received_amount += spay.payment_amount.to_f
|
||||||
if spay.payment_method == "creditnote"
|
if spay.payment_method == "creditnote"
|
||||||
is_credit = 1
|
is_credit = 1
|
||||||
end
|
end
|
||||||
|
if spay.payment_method == "foc"
|
||||||
|
is_foc = 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if (self.sale.grand_total <= all_received_amount)
|
if (self.sale.grand_total <= all_received_amount)
|
||||||
if is_credit == 0
|
if is_credit == 0
|
||||||
@@ -269,9 +286,16 @@ class SalePayment < ApplicationRecord
|
|||||||
else
|
else
|
||||||
self.sale.payment_status = "outstanding"
|
self.sale.payment_status = "outstanding"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if is_foc == 0
|
||||||
|
self.sale.payment_status = "paid"
|
||||||
|
else
|
||||||
|
self.sale.payment_status = "foc"
|
||||||
|
end
|
||||||
|
|
||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
|
|
||||||
if MembershipSetting.find_by_rebate(1)
|
if MembershipSetting.find_by_rebate(1) && is_foc == 0
|
||||||
response = rebat(sObj)
|
response = rebat(sObj)
|
||||||
|
|
||||||
if !response.nil?
|
if !response.nil?
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ class ShiftSale < ApplicationRecord
|
|||||||
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
||||||
self.total_rounding = self.total_rounding + saleobj.rounding_adjustment
|
self.total_rounding = self.total_rounding + saleobj.rounding_adjustment
|
||||||
self.total_receipt = self.total_receipt + 1
|
self.total_receipt = self.total_receipt + 1
|
||||||
|
if saleobj.customer.customer_type == "Dinein"
|
||||||
|
self.dining_count = self.dining_count + 1
|
||||||
|
else
|
||||||
|
self.takeaway_count = self.takeaway_count + 1
|
||||||
|
end
|
||||||
self.save
|
self.save
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -79,6 +84,11 @@ class ShiftSale < ApplicationRecord
|
|||||||
self.commercial_taxes = self.commercial_taxes.to_i - tax.to_f
|
self.commercial_taxes = self.commercial_taxes.to_i - tax.to_f
|
||||||
self.total_rounding = self.total_rounding - saleobj.rounding_adjustment
|
self.total_rounding = self.total_rounding - saleobj.rounding_adjustment
|
||||||
self.total_void = self.total_void + saleobj.grand_total
|
self.total_void = self.total_void + saleobj.grand_total
|
||||||
|
if saleobj.customer.customer_type == "Dinein"
|
||||||
|
self.dining_count = self.dining_count - 1
|
||||||
|
else
|
||||||
|
self.takeaway_count = self.takeaway_count - 1
|
||||||
|
end
|
||||||
self.save
|
self.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -88,4 +98,40 @@ class ShiftSale < ApplicationRecord
|
|||||||
closing_balance = shiftobj.grand_total + shiftobj.cash_in - shiftobj.cash_out + shiftobj.total_cash
|
closing_balance = shiftobj.grand_total + shiftobj.cash_in - shiftobj.cash_out + shiftobj.total_cash
|
||||||
return closing_balance
|
return closing_balance
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_by_shift_other_payment(shift)
|
||||||
|
|
||||||
|
other_payment = Sale.select("sale_payments.payment_method as name,
|
||||||
|
SUM(case when (sale_payments.payment_method='mpu') then (sale_payments.payment_amount) else 0 end) as mpu_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='visa') then (sale_payments.payment_amount) else 0 end) as visa_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='master') then (sale_payments.payment_amount) else 0 end) as master_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='jcb') then (sale_payments.payment_amount) else 0 end) as jcb_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount,
|
||||||
|
SUM(case when (sale_payments.payment_method='paypar') then (sale_payments.payment_amount) else 0 end) as paypar_amount")
|
||||||
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
|
.where("sales.shift_sale_id =? and sale_status = 'completed' and sale_payments.payment_amount != 0 ", shift.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.calculate_total_price_by_accounts(shift,type)
|
||||||
|
query = Sale.select("acc.title as account_name," +
|
||||||
|
"SUM(case when (acc.id=i.account_id) then (i.price) else 0 end) as total_price")
|
||||||
|
|
||||||
|
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id "+
|
||||||
|
"JOIN accounts acc ON acc.id = i.account_id" +
|
||||||
|
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
|
||||||
|
if type == 'discount'
|
||||||
|
query = query.where("sales.shift_sale_id =? and sale_status = 'completed' and i.is_taxable = false and i.remark = 'Discount'", shift.id)
|
||||||
|
.group("acc.title").order("acc.id")
|
||||||
|
else
|
||||||
|
query = query.where("sales.shift_sale_id =? and sale_status = 'completed'", shift.id)
|
||||||
|
.group("acc.title").order("acc.id")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_total_member_discount(shift)
|
||||||
|
query = Sale.select("SUM(sales.total_discount) as member_discount")
|
||||||
|
.where("shift_sale_id =? and sale_status = 'completed' and discount_type = 'member_discount'", shift.id)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
class CloseCashierPdf < Prawn::Document
|
class CloseCashierPdf < Prawn::Document
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes)
|
|
||||||
self.page_width = PrintSetting.where("name = ?","Close Cashier").first.page_width
|
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||||
self.page_height = PrintSetting.where("name = ?","Close Cashier").first.page_height
|
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||||
|
self.page_height = printer_settings.page_height
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
self.price_width = 40
|
self.price_width = 40
|
||||||
self.qty_width = 20
|
self.qty_width = 20
|
||||||
@@ -26,16 +27,11 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 8
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
header( shop_details)
|
header( shop_details)
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
shift_detail(shift_sale,sale_taxes)
|
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def header (shop_details)
|
def header (shop_details)
|
||||||
@@ -51,7 +47,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def shift_detail(shift_sale,sale_taxes)
|
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||||
move_down 7
|
move_down 7
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
@@ -151,6 +147,10 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "#{shift_sale.total_taxes}", :size => self.item_font_size, :align => :right
|
text "#{shift_sale.total_taxes}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
|
move_down -5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 7
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||||
@@ -166,14 +166,91 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.credit_sales}", :size => self.item_font_size, :align => :right
|
text "#{shift_sale.credit_sales}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
#start other payment details
|
||||||
|
if shift_sale.other_sales > 0
|
||||||
|
other_payment.each do |other|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Other Payment Details", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{other.mpu_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "VISA Payment :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{other.visa_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{other.master_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{other.jcb_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Reedem Payment :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{other.paypar_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "FOC :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{other.foc_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
else
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{shift_sale.other_sales}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
|
||||||
text "#{shift_sale.other_sales}", :size => self.item_font_size, :align => :right
|
# end other payment details
|
||||||
|
move_down -5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 7
|
||||||
|
#start total amount by Account Like Food / Beverage /..
|
||||||
|
total_amount_by_account.each do |amount|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Total #{amount.account_name} Amount:", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{amount.total_price.round(2)} ", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
#end total amount by Account
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
@@ -183,14 +260,57 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
|
text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
|
move_down -5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 7
|
||||||
|
#start total amount by Account Like Food / Beverage /..
|
||||||
|
total_discount_by_account.each do |amount|
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{amount.total_price.round(2)} ", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#end total amount by Account
|
||||||
|
|
||||||
|
if total_member_discount[0].member_discount.present?
|
||||||
|
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||||
|
@overall = shift_sale.total_discounts - @member_discount
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Total Member Discount :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{@member_discount}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@overall = shift_sale.total_discounts
|
||||||
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Discount Amount :", :size => self.item_font_size, :align => :right
|
text "Total Overall Discount :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{@overall}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Total Discount Amount :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.total_discounts}", :size => self.item_font_size, :align => :right
|
text "#{shift_sale.total_discounts}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
|
move_down -5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 7
|
||||||
|
|
||||||
sale_taxes.each do |tax|
|
sale_taxes.each do |tax|
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -224,6 +344,22 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "#{shift_sale.total_receipt}", :size => self.item_font_size, :align => :right
|
text "#{shift_sale.total_receipt}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Dining Count :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{shift_sale.dining_count}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Takeaway Count :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{shift_sale.takeaway_count}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Total Void:", :size => self.item_font_size, :align => :right
|
text "Total Void:", :size => self.item_font_size, :align => :right
|
||||||
@@ -236,8 +372,6 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
|
||||||
|
sign(sale_data)
|
||||||
|
|
||||||
|
|
||||||
footer(printed_status)
|
footer(printed_status)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -237,12 +238,10 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def sale_payment(sale_data,precision,delimiter)
|
def sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
if payment.payment_method == "paypar"
|
if payment.payment_method == "paypar"
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
@@ -269,15 +268,12 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# show member information
|
# show member information
|
||||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter)
|
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter)
|
||||||
|
if rebate_amount != nil
|
||||||
if rebate_amount != nil
|
|
||||||
|
|
||||||
if rebate_amount["status"] == true
|
if rebate_amount["status"] == true
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
total = 0
|
total = 0
|
||||||
@@ -414,6 +410,43 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sign(sale_data)
|
||||||
|
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||||
|
if payment.payment_method == "creditnote"
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
|
move_down 70
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
|
move_down 73
|
||||||
|
text "Approved By" , :size => self.item_font_size,:align => :center
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if sale_data.payment_status == "foc"
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
|
move_down 70
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
|
move_down 73
|
||||||
|
text "Acknowledged By" , :size => self.item_font_size,:align => :center
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def footer(printed_status)
|
def footer(printed_status)
|
||||||
move_down 5
|
move_down 5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
@@ -421,7 +454,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
text "#{printed_status}", :size => self.item_font_size,:align => :left
|
text "#{printed_status}",:style => :bold, :size => self.header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
||||||
@@ -429,6 +462,5 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
58
app/uploaders/menu_item_image_uploader.rb
Normal file
58
app/uploaders/menu_item_image_uploader.rb
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
class MenuItemImageUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
|
# Include RMagick or MiniMagick support:
|
||||||
|
# include CarrierWave::RMagick
|
||||||
|
# include CarrierWave::MiniMagick
|
||||||
|
|
||||||
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
storage :file
|
||||||
|
# storage :fog
|
||||||
|
|
||||||
|
def root
|
||||||
|
Rails.root.join 'public/'
|
||||||
|
end
|
||||||
|
|
||||||
|
# Override the directory where uploaded files will be stored.
|
||||||
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
|
def store_dir
|
||||||
|
"image/menu_images"
|
||||||
|
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# def cache_dir
|
||||||
|
# '/tmp/images'
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||||
|
# def default_url(*args)
|
||||||
|
# # For Rails 3.1+ asset pipeline compatibility:
|
||||||
|
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
||||||
|
#
|
||||||
|
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Process files as they are uploaded:
|
||||||
|
# process scale: [200, 300]
|
||||||
|
#
|
||||||
|
# def scale(width, height)
|
||||||
|
# # do something
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Create different versions of your uploaded files:
|
||||||
|
# version :thumb do
|
||||||
|
# process resize_to_fit: [50, 50]
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Add a white list of extensions which are allowed to be uploaded.
|
||||||
|
# For images you might use something like this:
|
||||||
|
def extension_whitelist
|
||||||
|
%w(jpg jpeg gif png)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Override the filename of the uploaded files:
|
||||||
|
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
||||||
|
# def filename
|
||||||
|
# "something.jpg" if original_filename
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
7
app/views/api/restaurant/item_sets/index.json.jbuilder
Normal file
7
app/views/api/restaurant/item_sets/index.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
json.array! @item_sets do |set|
|
||||||
|
json.id set.id
|
||||||
|
json.name set.name
|
||||||
|
json.alt_name set.alt_name
|
||||||
|
json.min_selectable_qty set.min_selectable_qty
|
||||||
|
json.max_selectable_qty set.max_selectable_qty
|
||||||
|
end
|
||||||
@@ -5,13 +5,14 @@ json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
|||||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||||
|
|
||||||
if (menu.menu_categories)
|
if (menu.menu_categories)
|
||||||
json.menu_categories menu.menu_categories do |category|
|
json.categories menu.menu_categories do |category|
|
||||||
json.id category.id
|
json.id category.id
|
||||||
json.name category.name
|
json.name category.name
|
||||||
json.alt_name category.alt_name
|
json.alt_name category.alt_name
|
||||||
|
json.is_available category.is_available
|
||||||
|
|
||||||
if category.menu_items
|
if category.menu_items
|
||||||
json.menu_items category.menu_items do |item|
|
json.items category.menu_items do |item|
|
||||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,40 +1,70 @@
|
|||||||
|
# Format for attributes json
|
||||||
|
attr_format = []
|
||||||
|
param_count = item.item_attributes.count
|
||||||
|
# Format for attributes json
|
||||||
|
item.item_attributes.each do|attr_id|
|
||||||
|
menu_attr = MenuItemAttribute.find(attr_id)
|
||||||
|
if attr_format.count == 0
|
||||||
|
attr_format.push({ type: menu_attr.attribute_type, value: [] })
|
||||||
|
end
|
||||||
|
|
||||||
|
attr_format.each do |af|
|
||||||
|
if menu_attr.attribute_type == af[:type]
|
||||||
|
af[:value].push(menu_attr.value)
|
||||||
|
else
|
||||||
|
new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
|
||||||
|
attr_format.push(new_attr)
|
||||||
|
end
|
||||||
|
|
||||||
|
break if attr_format.count > param_count
|
||||||
|
end
|
||||||
|
|
||||||
|
param_count -= 1
|
||||||
|
end
|
||||||
|
|
||||||
#Menu Item Information
|
#Menu Item Information
|
||||||
json.item_code item.item_code
|
json.id item.id
|
||||||
json.name item.name
|
json.item_code item.item_code
|
||||||
json.alt_name item.alt_name
|
json.name item.name
|
||||||
json.type item.type
|
json.alt_name item.alt_name
|
||||||
json.min_qty item.min_qty
|
json.image item.image_path.url
|
||||||
json.min_selectable_item item.min_selectable_item
|
json.description item.description
|
||||||
json.max_selectable_item item.max_selectable_item
|
json.Information item.information
|
||||||
|
json.type item.type
|
||||||
|
json.account_id item.account_id
|
||||||
|
json.min_qty item.min_qty
|
||||||
|
json.is_available item.is_available
|
||||||
|
json.is_sub_item item.is_sub_item
|
||||||
|
json.item_sets item.item_sets
|
||||||
|
json.attributes attr_format
|
||||||
|
json.options item.item_options
|
||||||
|
# json.min_selectable_item item.min_selectable_item
|
||||||
|
# json.max_selectable_item item.max_selectable_item
|
||||||
|
|
||||||
#Item instance
|
#Item instance
|
||||||
if item.menu_item_instances.count == 1 then
|
# if item.menu_item_instances.count == 1 then
|
||||||
|
# item_instance = item.menu_item_instances[0]
|
||||||
item_instance = item.menu_item_instances[0]
|
# json.price = item_instance.price
|
||||||
json.price = item_instance.price
|
# json.is_available = item_instance.is_available
|
||||||
json.is_available = item_instance.is_available
|
# json.is_on_promotion = item_instance.is_on_promotion
|
||||||
json.is_on_promotion = item_instance.is_on_promotion
|
# json.promotion_price = item_instance.promotion_price
|
||||||
json.promotion_price = item_instance.promotion_price
|
# json.item_attributes = item_instance.item_attributes
|
||||||
json.item_attributes = item_instance.item_attributes
|
|
||||||
|
|
||||||
elsif item.menu_item_instances.count > 1 then
|
|
||||||
|
|
||||||
json.item_instances item.menu_item_instances do |is|
|
|
||||||
json.item_instance_item_code = is.item_instance_code
|
|
||||||
json.item_instance_name = is.item_instance_name
|
|
||||||
json.price = is.price
|
|
||||||
json.is_available = is.is_available
|
|
||||||
json.is_on_promotion = is.is_on_promotion
|
|
||||||
json.promotion_price = is.promotion_price
|
|
||||||
json.item_attributes = is.item_attributes
|
|
||||||
end
|
|
||||||
|
|
||||||
|
json.instances item.menu_item_instances do |is|
|
||||||
|
json.code is.item_instance_code
|
||||||
|
json.name is.item_instance_name
|
||||||
|
json.price is.price
|
||||||
|
json.is_available is.is_available
|
||||||
|
json.is_default is.is_default
|
||||||
|
json.is_on_promotion is.is_on_promotion
|
||||||
|
json.promotion_price is.promotion_price
|
||||||
|
json.item_attributes is.item_attributes
|
||||||
|
json.item_sets is.item_sets
|
||||||
end
|
end
|
||||||
|
|
||||||
#Child Menu items
|
#Child Menu items
|
||||||
if (item.children) then
|
# if (item.children) then
|
||||||
json.set_items item.children.each do |item|
|
# json.set_items item.children.each do |item|
|
||||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||||
end
|
# end
|
||||||
|
# end
|
||||||
end
|
|
||||||
@@ -4,9 +4,11 @@ json.array! @menus do |menu|
|
|||||||
json.valid_days menu.valid_days
|
json.valid_days menu.valid_days
|
||||||
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
||||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||||
if (@current_menu)
|
|
||||||
json.current_menu do
|
json.partial! 'api/restaurant/menu/menu', menu: menu
|
||||||
json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
# if (@current_menu)
|
||||||
end
|
# json.current_menu do
|
||||||
end
|
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
||||||
|
# end
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|||||||
48
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
48
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
if @menu.menu_items
|
||||||
|
json.menu_items @menu.menu_items do |item|
|
||||||
|
#Menu Item Information
|
||||||
|
# json.item_code item.item_code
|
||||||
|
# json.name item.name
|
||||||
|
# json.alt_name item.alt_name
|
||||||
|
# json.type item.type
|
||||||
|
# json.min_qty item.min_qty
|
||||||
|
# json.min_selectable_item item.min_selectable_item
|
||||||
|
# json.max_selectable_item item.max_selectable_item
|
||||||
|
|
||||||
|
#Item instance
|
||||||
|
# if item.menu_item_instances.count == 1 then
|
||||||
|
|
||||||
|
# item_instance = item.menu_item_instances[0]
|
||||||
|
# json.price item_instance.price
|
||||||
|
# json.is_available item_instance.is_available
|
||||||
|
# json.is_on_promotion item_instance.is_on_promotion
|
||||||
|
# json.promotion_price item_instance.promotion_price
|
||||||
|
# json.item_attributes item_instance.item_attributes
|
||||||
|
|
||||||
|
# elsif item.menu_item_instances.count > 1 then
|
||||||
|
|
||||||
|
# json.item_instances item.menu_item_instances do |is|
|
||||||
|
# json.item_instance_item_code is.item_instance_code
|
||||||
|
# json.item_instance_name is.item_instance_name
|
||||||
|
# json.price is.price
|
||||||
|
# json.is_available is.is_available
|
||||||
|
# json.is_on_promotion is.is_on_promotion
|
||||||
|
# json.promotion_price is.promotion_price
|
||||||
|
# json.item_attributes is.item_attributes
|
||||||
|
# end
|
||||||
|
|
||||||
|
# end
|
||||||
|
#Child Menu items
|
||||||
|
# if (item.menu_item_sets) then
|
||||||
|
# json.set_items item.menu_item_sets.each do |item|
|
||||||
|
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||||
|
# end
|
||||||
|
|
||||||
|
#end
|
||||||
|
# if category.menu_items
|
||||||
|
# json.items category.menu_items do |item|
|
||||||
|
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
json.array! @menu_attributes do |attribute|
|
json.array! @menu_attributes do |attribute|
|
||||||
|
json.id attribute.id
|
||||||
json.type attribute.attribute_type
|
json.type attribute.attribute_type
|
||||||
json.name attribute.name
|
json.name attribute.name
|
||||||
json.value attribute.value
|
json.value attribute.value
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
json.array! @menu_options do |option|
|
json.array! @menu_options do |option|
|
||||||
|
json.id option.id
|
||||||
|
json.type option.option_type
|
||||||
json.name option.name
|
json.name option.name
|
||||||
json.value option.value
|
json.value option.value
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<%= simple_form_for([:crm,@crm_customer]) do |f| %>
|
<%= simple_form_for([:crm,@crm_customer]) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,7 @@
|
|||||||
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
|
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
|
||||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||||
<span class="patch_method"></span>
|
<span class="patch_method"></span>
|
||||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||||
|
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
|
||||||
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
|
||||||
<% flash.each do |name, msg| %>
|
|
||||||
<% str="[\"#{msg['card_no']}\"]"
|
|
||||||
str.gsub!('["', '')
|
|
||||||
str.gsub!('"]', '') %>
|
|
||||||
<span class="help-block" style="margin-top:-6px"><%= str %></span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Paypar Account No:</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
|
|
||||||
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Salutation :</label><br>
|
<label>Salutation :</label><br>
|
||||||
@@ -100,7 +82,39 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Date Of Birth</label>
|
<label>Date Of Birth</label>
|
||||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Select Customer Type</label>
|
||||||
|
<select class="selectpicker form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
|
||||||
|
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
|
||||||
|
<option value="<%= ct.value %>">
|
||||||
|
<%= ct.name %></option>
|
||||||
|
<%end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
|
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<% str="[\"#{msg['card_no']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block" style="margin-top:-6px"><%= str %></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Paypar Account No:</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
|
||||||
|
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Select Member Group</label>
|
<label>Select Member Group</label>
|
||||||
@@ -110,8 +124,7 @@
|
|||||||
<option value="<%= member.value %>">
|
<option value="<%= member.value %>">
|
||||||
<%= member.name %></option>
|
<%= member.name %></option>
|
||||||
<%end %>
|
<%end %>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -138,6 +151,11 @@
|
|||||||
},100);
|
},100);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// $("#customer_card_no").click(function(){
|
||||||
|
// var ab=$("#customer_tax_profiles").val();
|
||||||
|
// console.log(JSON.stringify(ab));
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
app/views/crm/customers/edit.json.jbuilder
Normal file
4
app/views/crm/customers/edit.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||||
|
:membership_id, :membership_type, :membership_authentication_code,
|
||||||
|
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
|
||||||
|
json.url crm_customer_url(@crm_customer, format: :json)
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render 'new_form', crm_customer: @crm_customer %>
|
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||||
|
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<br>
|
<br>
|
||||||
@@ -121,15 +121,24 @@ $(document).on('click',".customer_tr",function(){
|
|||||||
update_sale(customer_id,sale_id);
|
update_sale(customer_id,sale_id);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
var url = "customers/"+customer_id;
|
var url = "customers/" + customer_id + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#customer_tax_profiles").children().removeAttr("selected").css({'color':'#000','background':'none'});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
// Selected for Taxes
|
||||||
|
var taxes = JSON.stringify(data.tax_profiles);
|
||||||
|
var parse_taxes = JSON.parse(taxes);
|
||||||
|
$.each(parse_taxes, function(i, value){
|
||||||
|
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
|
||||||
|
});
|
||||||
|
|
||||||
$('#customer_id').val(data.id);
|
$('#customer_id').val(data.id);
|
||||||
$('#customer_name').val(data.name);
|
$('#customer_name').val(data.name);
|
||||||
$('#customer_company').val(data.company);
|
$('#customer_company').val(data.company);
|
||||||
@@ -138,6 +147,7 @@ $(document).on('click',".customer_tr",function(){
|
|||||||
$('#customer_salutation').val(data.salutation);
|
$('#customer_salutation').val(data.salutation);
|
||||||
$('#customer_nrc_no').val(data.nrc_no);
|
$('#customer_nrc_no').val(data.nrc_no);
|
||||||
$('#customer_card_no').val(data.card_no);
|
$('#customer_card_no').val(data.card_no);
|
||||||
|
$('#customer_type').val(data.customer_type);
|
||||||
$('#paypar_account_no').val(data.paypar_account_no);
|
$('#paypar_account_no').val(data.paypar_account_no);
|
||||||
$('#customer_address').val(data.address);
|
$('#customer_address').val(data.address);
|
||||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||||
:membership_id, :membership_type, :membership_authentication_code,
|
:membership_id, :membership_type, :membership_authentication_code,
|
||||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no
|
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
|
||||||
json.url crm_customer_url(@crm_customer, format: :json)
|
json.url crm_customer_url(@crm_customer, format: :json)
|
||||||
|
|||||||
@@ -5,13 +5,10 @@
|
|||||||
|
|
||||||
<% elsif current_login_employee.role = "cashier" %>
|
<% elsif current_login_employee.role = "cashier" %>
|
||||||
<%= link_to "Cashier Station", origami_path %>
|
<%= link_to "Cashier Station", origami_path %>
|
||||||
|
|
||||||
<% elsif current_login_employee = "account" %>
|
<% elsif current_login_employee = "account" %>
|
||||||
<%= link_to "Cashier Station", oishi_path %>
|
<%= link_to "Cashier Station", oishi_path %>
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to "Cashier Station", oishi_path %>
|
<%= link_to "Cashier Station", oishi_path %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% shop = Shop.first %>
|
<% shop = Shop.first %>
|
||||||
|
|
||||||
@@ -228,28 +225,21 @@
|
|||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="page-header" style="width:100%;text-align:center;background-color:#ddd;">
|
<div class="page-header center-text">
|
||||||
<h4 style="color : #ef404a;font-weight:bold;font-style:italic;margin-bottom:0px;"><%= shop.name %></h4>
|
<h4 class="footer-header">
|
||||||
|
<%= shop.name %>
|
||||||
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
|
<div class="center-text">
|
||||||
<%= shop.address %>
|
<%= shop.address %>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
|
<div class="center-text">
|
||||||
<%= shop.phone_no %>
|
<%= shop.phone_no %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
.footer {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
height: auto;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -289,3 +279,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
<li><%= link_to "Order Queue Stations",settings_order_queue_stations_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Order Queue Stations",settings_order_queue_stations_path, :tabindex =>"-1" %></li>
|
||||||
<hr class="hr_advance" />
|
<hr class="hr_advance" />
|
||||||
<li><%= link_to "Menus ", settings_menus_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Menus ", settings_menus_path, :tabindex =>"-1" %></li>
|
||||||
|
<li><%= link_to "Item Sets ", settings_item_sets_path, :tabindex =>"-1" %></li>
|
||||||
|
<li><%= link_to "Menu Item Sets ", settings_menu_item_sets_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Menu Item Attributes", settings_menu_item_attributes_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Menu Item Attributes", settings_menu_item_attributes_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
<hr class="hr_advance" />
|
<hr class="hr_advance" />
|
||||||
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
||||||
<hr class="hr_advance" />
|
<hr class="hr_advance" />
|
||||||
<li><%= link_to "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>]
|
<li><%= link_to "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Products", settings_products_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Products", settings_products_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -11,7 +11,10 @@
|
|||||||
|
|
||||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
<%= stylesheet_link_tag 'settings', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'settings', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'fileinput.min', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'fileinput.min', 'data-turbolinks-track': 'reload' %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -32,8 +35,7 @@
|
|||||||
<%= message %>
|
<%= message %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
197
app/views/oqs/home/bkindex.html.erb
Normal file
197
app/views/oqs/home/bkindex.html.erb
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
<div class="row">
|
||||||
|
<!-- Column One -->
|
||||||
|
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||||
|
<!-- Nav tabs -->
|
||||||
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<% # For Tab Disable for Station is inactive
|
||||||
|
status=""
|
||||||
|
@queue_stations_items.each do |qsi|
|
||||||
|
if qsi[:is_active] == false
|
||||||
|
status="disabled"
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="tab" href=<%= '#' + qsi[:station_name].gsub(' ', '_') %> role="tab" <%= status %>>
|
||||||
|
<%= qsi[:station_name] %>
|
||||||
|
<span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>>
|
||||||
|
<%= qsi[:item_count] %>
|
||||||
|
</span>
|
||||||
|
<% if qsi[:is_ap] %>
|
||||||
|
<span>(ap)</span>
|
||||||
|
<% end %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<!-- Nav tabs - End -->
|
||||||
|
|
||||||
|
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||||
|
<!--- Panel 0 - Completed -->
|
||||||
|
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||||
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
|
<%
|
||||||
|
@queue_completed_item.each do |qid|
|
||||||
|
%>
|
||||||
|
<div class="card queue_station">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title">
|
||||||
|
<span class="order-zone-type"><%= qid.type %> - </span>
|
||||||
|
<span class="order-zone"><%= qid.zone %></span>
|
||||||
|
<small class="pull-right"><%= qid.order_id %></small>
|
||||||
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="order-item">
|
||||||
|
<%= qid.item_name %>
|
||||||
|
</span> [x
|
||||||
|
<span class="order-qty">
|
||||||
|
<%= qid.qty %>
|
||||||
|
</span> ]
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||||
|
|
||||||
|
<p class="card-text">
|
||||||
|
<small class="text-muted">Order at
|
||||||
|
<span class="order-at">
|
||||||
|
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
||||||
|
</span> -
|
||||||
|
<span class="order-by">
|
||||||
|
<%= qid.item_order_by %>
|
||||||
|
</span>
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
<p class="hidden order-status">completed</p>
|
||||||
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Panel 0 - Completed -->
|
||||||
|
|
||||||
|
<!-- Order Item for Queue Station -->
|
||||||
|
<%
|
||||||
|
@queue_stations_items.each do |qsi|
|
||||||
|
%>
|
||||||
|
<!-- Generated Pane -->
|
||||||
|
<div class="tab-pane" id=<%= qsi[:station_name].gsub(' ', '_') %> role="tabpanel">
|
||||||
|
<!--- Order Items -->
|
||||||
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
|
<%
|
||||||
|
@queue_items_details.each do |qid|
|
||||||
|
if qid.price != 0
|
||||||
|
if qid.zone_id == qsi[:zone_id] && qid.station_name == qsi[:station_name]
|
||||||
|
%>
|
||||||
|
<div class="card queue_station">
|
||||||
|
<div class="card-block">
|
||||||
|
<h4 class="card-title">
|
||||||
|
<span class="order-zone-type"><%= qid.type %> - </span>
|
||||||
|
<span class="order-zone"><%= qid.zone %></span>
|
||||||
|
<small class="pull-right"><%= qid.order_id %></small>
|
||||||
|
</h4>
|
||||||
|
<h4>
|
||||||
|
<span class="order-item"><%= qid.item_name %></span> [x
|
||||||
|
<span class="order-qty"><%= qid.qty %></span> ]
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||||
|
|
||||||
|
<p class="card-text">
|
||||||
|
<small class="text-muted">Order at
|
||||||
|
<span class="order-at">
|
||||||
|
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
||||||
|
</span> -
|
||||||
|
<span class="order-by">
|
||||||
|
<%= qid.item_order_by %>
|
||||||
|
</span>
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
<!-- Hidden Fields for Items -->
|
||||||
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<button id=<%= 'edit_' + qid.assigned_order_item_id.to_s %> class="btn btn-warning order-item order-item-edit">EDIT</button>
|
||||||
|
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
|
||||||
|
<!--- end of Items-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end of Pane -->
|
||||||
|
<% end %>
|
||||||
|
<!-- End Order Item for Queue Station -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Two -->
|
||||||
|
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">ORDER DETAILS - Table</strong></div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-title">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:33%; text-align:left">Order By</th>
|
||||||
|
<th style="width:33%; text-align:right">Order At</td>
|
||||||
|
<th style="width:33%; text-align:right">Customer</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td id="order-by" style="width:33%; text-align:left"></td>
|
||||||
|
<td id="order-at" style="width:33%; text-align:right"></td>
|
||||||
|
<td id="order-customer" style="width:33%; text-align:right"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong>Table/Room</strong></td>
|
||||||
|
<td id="order-from" colspan="2"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-text" style="min-height:360px; max-height:360px; overflow:auto">
|
||||||
|
<table class="table" id="oqs-order-details-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:80%; text-align:left">Items</th>
|
||||||
|
<th style="width:20%; text-align:right">QTY</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<!-- Bind With JS -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three--->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<!-- OQS Buttons -->
|
||||||
|
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
|
||||||
|
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_summary">Print <br/>Order<br/>Summary</button>
|
||||||
|
<a href="<%= dashboard_path %>" class="btn btn-primary btn-lg btn-block" role="button" aria-haspopup="true"> Back </a>
|
||||||
|
<!-- <button type="button" class="" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -1,39 +1,66 @@
|
|||||||
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Column One -->
|
<div class="col-md-6">
|
||||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
<%= form_tag oqs_root_path, :method => :get do %>
|
||||||
|
<div class="form-group col-md-8">
|
||||||
|
<input type="text" name="filter" class="form-control input-md" placeholder="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-1">
|
||||||
|
<input type="submit" value="Search" class='btn btn-primary btn-md'>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<!-- Column One -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
|
<!-- <li class="nav-item nav-search <%= @filter.to_s.length > 0? " " : "hide"%>">
|
||||||
<li class="nav-item">
|
<a class="nav-link <%= @filter.to_s.length > 0? "active" : " "%>" data-toggle="tab" href="#search" role="tab">Searching .. <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
||||||
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
</li> -->
|
||||||
|
<li class="nav-item nav-completed">
|
||||||
|
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<%
|
<% # For Tab Disable for Station is inactive
|
||||||
# For Tab Disable for Station is inactive
|
|
||||||
status=""
|
status=""
|
||||||
@queue_stations_items.each do |qsi|
|
@queue_stations.each do |qsi|
|
||||||
if qsi[:is_active] == false
|
if qsi.is_active == false
|
||||||
status="disabled"
|
status="disabled"
|
||||||
end
|
end %>
|
||||||
%>
|
<li class="nav-item oqs_click" >
|
||||||
<li class="nav-item">
|
<p class="hidden oqs-id"><%= qsi.id %></p>
|
||||||
<a class="nav-link" data-toggle="tab" href=<%= '#' + qsi[:station_name].gsub(' ', '_') %> role="tab" <%= status %>>
|
<a class="nav-link" data-toggle="tab" href="" role="tab" <%= status %>>
|
||||||
<%= qsi[:station_name] %>
|
<%= qsi.station_name %>
|
||||||
<span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>>
|
<% if @filter.nil? %>
|
||||||
<%= qsi[:item_count] %>
|
<span class="badge badge-pill badge-default" id=""> <%= qsi.assigned_order_items.where("delivery_status=0").count %>
|
||||||
</span>
|
</span>
|
||||||
<% if qsi[:is_ap] %>
|
<%else%>
|
||||||
<span>(ap)</span>
|
<span class="badge badge-pill badge-default" id="">
|
||||||
<% end %>
|
<% @count.each do |c|%>
|
||||||
</a>
|
<% if qsi.id == c.station_id %>
|
||||||
|
<%= c.total %>
|
||||||
|
<%end %>
|
||||||
|
<%end %>
|
||||||
|
</span>
|
||||||
|
<%end%>
|
||||||
|
<% if qsi.auto_print %>
|
||||||
|
<span>(ap)</span>
|
||||||
|
<% end %>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- Nav tabs - End -->
|
<!-- Nav tabs - End -->
|
||||||
|
<p class="hidden filter"><%= @filter %></p>
|
||||||
|
|
||||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||||
<!--- Panel 0 - Completed -->
|
<!--- Panel 0 - Completed -->
|
||||||
|
|
||||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<%
|
<%
|
||||||
@@ -77,66 +104,14 @@
|
|||||||
%>
|
%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- End Panel 0 - Completed -->
|
<!-- End Panel 0 - Completed -->
|
||||||
|
|
||||||
<!-- Order Item for Queue Station -->
|
<!--- Order Items -->
|
||||||
<%
|
<div class="card-columns oqs_append" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
@queue_stations_items.each do |qsi|
|
</div>
|
||||||
%>
|
<!--- end of Items-->
|
||||||
<!-- Generated Pane -->
|
|
||||||
<div class="tab-pane" id=<%= qsi[:station_name].gsub(' ', '_') %> role="tabpanel">
|
|
||||||
<!--- Order Items -->
|
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
|
||||||
<%
|
|
||||||
@queue_items_details.each do |qid|
|
|
||||||
if qid.price != 0
|
|
||||||
if qid.zone_id == qsi[:zone_id] && qid.station_name == qsi[:station_name]
|
|
||||||
%>
|
|
||||||
<div class="card queue_station">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">
|
|
||||||
<span class="order-zone-type"><%= qid.type %> - </span>
|
|
||||||
<span class="order-zone"><%= qid.zone %></span>
|
|
||||||
<small class="pull-right"><%= qid.order_id %></small>
|
|
||||||
</h4>
|
|
||||||
<h4>
|
|
||||||
<span class="order-item"><%= qid.item_name %></span> [x
|
|
||||||
<span class="order-qty"><%= qid.qty %></span> ]
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
|
||||||
|
|
||||||
<p class="card-text">
|
|
||||||
<small class="text-muted">Order at
|
|
||||||
<span class="order-at">
|
|
||||||
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
|
|
||||||
</span> -
|
|
||||||
<span class="order-by">
|
|
||||||
<%= qid.item_order_by %>
|
|
||||||
</span>
|
|
||||||
</small>
|
|
||||||
</p>
|
|
||||||
<!-- Hidden Fields for Items -->
|
|
||||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
|
||||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<button id=<%= 'edit_' + qid.assigned_order_item_id.to_s %> class="btn btn-warning order-item order-item-edit">EDIT</button>
|
|
||||||
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<%
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
|
|
||||||
<!--- end of Items-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- end of Pane -->
|
|
||||||
<% end %>
|
|
||||||
<!-- End Order Item for Queue Station -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -197,4 +172,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
</script>
|
||||||
108
app/views/origami/addorders/index.html.erb
Normal file
108
app/views/origami/addorders/index.html.erb
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||||
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="tab" href="#table" role="tab">Tables</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="tab" href="#room" role="tab">Rooms</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content" style="max-height:650px; overflow:auto">
|
||||||
|
|
||||||
|
<div class="tab-pane active" id="table" role="tabpanel" style="max-height:; overflow:auto">
|
||||||
|
<% @tables.each do |zone| %>
|
||||||
|
<h3>Zone : <%=zone.zone.name%></h3>
|
||||||
|
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||||
|
|
||||||
|
<% @all_table.each do |table| %>
|
||||||
|
<% if zone.zone_id == table.zone_id %>
|
||||||
|
<div class="card click_table <%= table.status=="available" ? "available" : "occupied"%>" data-id = "<%= table.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<p class="hidden table-status"><%= table.status %></p>
|
||||||
|
<p style="text-align: center"><%= table.name %></p>
|
||||||
|
<p style="text-align: center">Seat : <%= table.seater %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %> <% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane" id="room" role="tabpanel" style="max-height:; overflow:auto">
|
||||||
|
<% @rooms.each do |zone| %>
|
||||||
|
<h3>Zone : <%=zone.zone.name%></h3>
|
||||||
|
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||||
|
|
||||||
|
<% @all_room.each do |room| %>
|
||||||
|
<% if zone.zone_id == room.zone_id %>
|
||||||
|
<div class="card click_table <%= room.status=="available" ? "available" : "occupied"%>" data-id = "<%= room.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<p class="hidden table-status"><%= room.status %></p>
|
||||||
|
<p style="text-align: center"><%= room.name %></p>
|
||||||
|
<p style="text-align: center">Seat : <%= room.seater %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %> <% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).on('click',".click_table",function(){
|
||||||
|
|
||||||
|
var dining_id = $(this).attr('data-id');
|
||||||
|
var status = $(this).find(".table-status").text();
|
||||||
|
|
||||||
|
if (status == "available") {
|
||||||
|
$.confirm({
|
||||||
|
title: 'Confirmation !',
|
||||||
|
content: 'Are you sure to assign this table',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: 'Ok',
|
||||||
|
btnClass: 'btn-green',
|
||||||
|
action: function(){
|
||||||
|
window.location.href = '/origami/addorders/'+dining_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.confirm({
|
||||||
|
title: 'Alert!',
|
||||||
|
content: 'You cannot assign this table',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: 'Ok',
|
||||||
|
btnClass: 'btn-red',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count:5;
|
||||||
|
-moz-column-count:5;
|
||||||
|
column-count:5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.occupied{
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
.available{
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: #009900;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
411
app/views/origami/addorders/show.html.erb
Normal file
411
app/views/origami/addorders/show.html.erb
Normal file
@@ -0,0 +1,411 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
|
<ul class="nav nav-tabs flex-column" role="tablist" >
|
||||||
|
<% @menu.each do |menu| %>
|
||||||
|
<li class="nav-item menu_category" data-ref="<%= api_restaurant_menu_category_path menu.id%>">
|
||||||
|
<p class="hidden menu-id"><%= menu.id %></p>
|
||||||
|
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7 col-lg-7 col-sm-7">
|
||||||
|
<div class="card-columns menu_items_list" style="column-gap: 10px;">
|
||||||
|
<!-- append data -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<div>
|
||||||
|
<strong id="order-title">ORDER DETAILS </strong> | Table <%=@table_id%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-text" style="max-height:550px; overflow:auto"">
|
||||||
|
<table class="table table-striped summary-items">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-qty">QTY</th>
|
||||||
|
<th class="item-attr">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success create" id="create_order" disabled="disabled">Create Order</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Large modal -->
|
||||||
|
<button class="btn btn-primary" data-toggle="modal" data-target=".sx_item_detailModal">Large modal</button>
|
||||||
|
|
||||||
|
<div class="modal fade sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="background-color: #54A5AF;">
|
||||||
|
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<%= image_tag "logo.png" ,width: '', height: '', :style => '' %>
|
||||||
|
<br><br>
|
||||||
|
<div class="form-group">
|
||||||
|
<h4 class="col-md-12">Quantity</h4>
|
||||||
|
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<h4 class="col-md-6">Total</h4>
|
||||||
|
<h4 class="col-md-6" id="total_price"> 2500 Ks</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<h4>Options</h4>
|
||||||
|
|
||||||
|
<h4>Attributes</h4>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
|
||||||
|
<button type="button" class="btn btn-success" data-dismiss="modal" id="save_order">Add Order</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title"></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<table width="100%" class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="">Item Name</th>
|
||||||
|
<th style="">Quantity</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="item_name" id="modal-item-name"></td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" id="remove" class="btn btn-danger" data-dismiss="modal">Remove</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
|
||||||
|
<button type="button" class="btn btn-success" data-dismiss="modal" id="save">Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
|
||||||
|
//click menu sidebar menu category
|
||||||
|
$(".menu_category").on("click", function(){
|
||||||
|
var menu_id = $(this).find(".menu-id").text();
|
||||||
|
var url = $(this).attr('data-ref');
|
||||||
|
show_menu_item_list(url);
|
||||||
|
});
|
||||||
|
//End menu category Click
|
||||||
|
|
||||||
|
//show menu item list when click menu category
|
||||||
|
function show_menu_item_list(url_item){
|
||||||
|
var menu_list = $('.menu_items_list');
|
||||||
|
menu_list.empty();
|
||||||
|
|
||||||
|
//Start Ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url_item,
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
console.log(data);
|
||||||
|
var menu_items_list = $('.menu_items_list');
|
||||||
|
menu_items_list.empty();
|
||||||
|
menu_items = data.menu_items;
|
||||||
|
console.log(data);
|
||||||
|
for(var field in menu_items) {
|
||||||
|
|
||||||
|
var code = menu_items[field].instances[0].code
|
||||||
|
var name = menu_items[field].instances[0].name
|
||||||
|
var price = parseFloat(menu_items[field].instances[0].price).toFixed(2);
|
||||||
|
var is_available = menu_items[field].instances[0].is_available
|
||||||
|
var is_on_promotion = menu_items[field].instances[0].is_on_promotion
|
||||||
|
var item_attributes = menu_items[field].instances[0].item_attributes
|
||||||
|
var promotion_price = menu_items[field].instances[0].promotion_price
|
||||||
|
|
||||||
|
|
||||||
|
row = '<div class="card">'
|
||||||
|
+'<div class="card-head" style="line-height:14px;">'
|
||||||
|
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
||||||
|
+'<div class="col-md-3 add_icon"'
|
||||||
|
+'data-id="'+ menu_items[field].name +'"'
|
||||||
|
+'data-item-code="'+ menu_items[field].item_code +'"'
|
||||||
|
+'data-name="'+ menu_items[field].name +'"'
|
||||||
|
+'data-price="'+ price +'"'
|
||||||
|
+'data-available="'+ is_available +'"'
|
||||||
|
+'data-promotion="'+ is_on_promotion +'"'
|
||||||
|
+'data-attributes="'+ item_attributes +'"'
|
||||||
|
+'data-instance-code="'+ code +'"'
|
||||||
|
+'data-instance="'+ name +'"'
|
||||||
|
+'data-promotion-price="'+ promotion_price +'"'
|
||||||
|
+'>'
|
||||||
|
+'<i class="fa fa-plus "'
|
||||||
|
+ 'style="margin-top:4px;">'
|
||||||
|
+'</i></div>'
|
||||||
|
+'</div>'
|
||||||
|
|
||||||
|
+'<div class="menu_item_box" data-toggle="modal" data-target=".sx_item_detailModal">'
|
||||||
|
+'<div class="card-block">'
|
||||||
|
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
|
||||||
|
+'</div>'
|
||||||
|
|
||||||
|
+'<div class="card-footer">'
|
||||||
|
+'<small>'+ price +'</small>'
|
||||||
|
+'</div>'
|
||||||
|
+'</div>';
|
||||||
|
$('.menu_items_list').append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//end Ajax
|
||||||
|
}
|
||||||
|
//end show detail function
|
||||||
|
|
||||||
|
// click plus icon for add
|
||||||
|
$(document).on('click', '.add_icon', function(event){
|
||||||
|
var item_data = $(this);
|
||||||
|
show_item_detail(item_data);
|
||||||
|
calculate_sub_total();
|
||||||
|
}); //End Add Icon Click
|
||||||
|
|
||||||
|
function show_item_detail(data){
|
||||||
|
qty = 1;
|
||||||
|
append = 0;
|
||||||
|
price = parseFloat(data.attr('data-price')).toFixed(2);
|
||||||
|
instance_code = data.attr('data-instance');
|
||||||
|
|
||||||
|
if (instance_code == "undefined"){
|
||||||
|
instance = '';
|
||||||
|
}else{
|
||||||
|
instance = "("+data.attr('data-instance')+")";
|
||||||
|
}
|
||||||
|
|
||||||
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
if ($(item_row[i]).attr('data-code') == data.attr('data-item-code')) {
|
||||||
|
qty = parseInt($(item_row[i]).children('#item_qty').text()) +1;
|
||||||
|
$(item_row[i]).children('#item_qty').text(qty);
|
||||||
|
parseFloat($(item_row[i]).children('#item_price').text(price*qty)).toFixed(2);
|
||||||
|
|
||||||
|
append = 1;
|
||||||
|
}else{
|
||||||
|
qty = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (append===0) {
|
||||||
|
row ="<tr class='item_box' data-price ='"+price+ "'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"+instance+ "'data-code='"+data.attr('data-item-code')+"'>"
|
||||||
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
|
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance + '</td>'
|
||||||
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
|
+ parseFloat(price).toFixed(2)
|
||||||
|
+'</td>'
|
||||||
|
+'</tr>';
|
||||||
|
$(".summary-items tbody").append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//click item row for update qty
|
||||||
|
$('.summary-items').on('click', '.item_box', function(){
|
||||||
|
$(this).attr('data-active',true);
|
||||||
|
name = $(this).children('#item_name').text();
|
||||||
|
qty = $(this).children('#item_qty').text();
|
||||||
|
$('#modal-item-name').text(name);
|
||||||
|
$('#modal-qty').val(qty);
|
||||||
|
});
|
||||||
|
|
||||||
|
//click item row for update qty
|
||||||
|
$(document).on('click', '.menu_item_box', function(event){
|
||||||
|
|
||||||
|
data = $(this).parent().children().children('.add_icon');
|
||||||
|
$('#title_name').text(data.attr('data-name'));
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
//click remove buttom in modal box
|
||||||
|
$('#sx_itemModal').on('click','#remove', function(){
|
||||||
|
$('.summary-items tr').filter(function(){
|
||||||
|
if ($(this).attr('data-active') == 'true'){
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
calculate_sub_total();
|
||||||
|
});
|
||||||
|
|
||||||
|
//click close
|
||||||
|
$('#sx_itemModal').on('click','#close', function(){
|
||||||
|
$(".item_box").removeAttr("data-active");
|
||||||
|
});
|
||||||
|
|
||||||
|
//click save buttom after change qty
|
||||||
|
$('#sx_itemModal').on('click','#save', function(){
|
||||||
|
summary_items_filter();
|
||||||
|
calculate_sub_total();
|
||||||
|
});
|
||||||
|
|
||||||
|
//calculate subtotal
|
||||||
|
function calculate_sub_total(){
|
||||||
|
var total_price = 0;
|
||||||
|
var taxable_amount = 0;
|
||||||
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||||
|
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||||
|
total_price += qty*unit_price;
|
||||||
|
});
|
||||||
|
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||||
|
var fixed_taxable_amount = parseFloat(taxable_amount).toFixed(2);
|
||||||
|
|
||||||
|
$('#sub_total').empty();
|
||||||
|
$('#sub_total').append(fixed_total_price);
|
||||||
|
|
||||||
|
if (fixed_total_price > 0) {
|
||||||
|
$('.create').removeAttr("disabled", false);
|
||||||
|
}else{
|
||||||
|
$('.create').attr("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function summary_items_filter(){
|
||||||
|
$('.summary-items tr').filter(function(){
|
||||||
|
|
||||||
|
if ($(this).attr('data-active') == 'true'){
|
||||||
|
qty = $('#modal-qty').val();
|
||||||
|
price = parseFloat($(this).attr('data-price'));
|
||||||
|
total_price = parseFloat(price*qty).toFixed(2);
|
||||||
|
|
||||||
|
$(this).find('#item_qty').text(qty);
|
||||||
|
$(this).find('.item-cell-price').text(total_price);
|
||||||
|
|
||||||
|
$(this).removeAttr('data-active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.card-head{
|
||||||
|
height: 40px;
|
||||||
|
background-color: #54A5AF;
|
||||||
|
padding:5px;
|
||||||
|
color :#fff;
|
||||||
|
}
|
||||||
|
.card-block {
|
||||||
|
padding: 0.3rem !important;
|
||||||
|
}
|
||||||
|
@media (min-width: 34em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 2;
|
||||||
|
-moz-column-count: 2;
|
||||||
|
column-count: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 48em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 3;
|
||||||
|
-moz-column-count: 3;
|
||||||
|
column-count: 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 62em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 4;
|
||||||
|
-moz-column-count: 4;
|
||||||
|
column-count: 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 75em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 4;
|
||||||
|
-moz-column-count: 4;
|
||||||
|
column-count: 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-tabs .nav-item {
|
||||||
|
border-bottom: 1px solid #fff;
|
||||||
|
border-left: 1px solid #54A5AF;
|
||||||
|
border-right: 1px solid #54A5AF;
|
||||||
|
}
|
||||||
|
.nav > li > a{
|
||||||
|
color:#54A5AF;
|
||||||
|
}
|
||||||
|
.nav-tabs {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
|
||||||
|
background-color: #fff;
|
||||||
|
border-left: 6px solid #111;
|
||||||
|
color:#54A5AF;
|
||||||
|
font-weight: bold;
|
||||||
|
border-color: #fff #fff #fff #54A5AF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-dialog {
|
||||||
|
left:auto;
|
||||||
|
right: auto;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 100px;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@@ -81,23 +81,7 @@
|
|||||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
|
||||||
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
|
||||||
<% flash.each do |name, msg| %>
|
|
||||||
<% str="[\"#{msg['name']}\"]"
|
|
||||||
str.gsub!('["', '')
|
|
||||||
str.gsub!('"]', '') %>
|
|
||||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Paypar Account No:</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly />
|
|
||||||
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Salutation :</label><br>
|
<label>Salutation :</label><br>
|
||||||
<label>Mr</label>
|
<label>Mr</label>
|
||||||
@@ -176,6 +160,37 @@
|
|||||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Select Customer Type</label>
|
||||||
|
<select class="selectpicker form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
|
||||||
|
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
|
||||||
|
<option value="<%= ct.value %>">
|
||||||
|
<%= ct.name %></option>
|
||||||
|
<%end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
|
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<% str="[\"#{msg['name']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Paypar Account No:</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly />
|
||||||
|
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Select Member Group</label>
|
<label>Select Member Group</label>
|
||||||
<select class="selectpicker form-control col-md-12" name="member_group_id">
|
<select class="selectpicker form-control col-md-12" name="member_group_id">
|
||||||
@@ -292,6 +307,12 @@
|
|||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
var taxes = JSON.stringify(data.tax_profiles);
|
||||||
|
var parse_taxes = JSON.parse(taxes);
|
||||||
|
$.each(parse_taxes, function(i, value){
|
||||||
|
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
|
||||||
|
});
|
||||||
|
|
||||||
$('#customer_id').val(data.id);
|
$('#customer_id').val(data.id);
|
||||||
$('#customer_name').val(data.name);
|
$('#customer_name').val(data.name);
|
||||||
$('#customer_company').val(data.company);
|
$('#customer_company').val(data.company);
|
||||||
@@ -301,7 +322,8 @@
|
|||||||
$('#customer_membership_type').val(data.membership_type);
|
$('#customer_membership_type').val(data.membership_type);
|
||||||
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||||
|
$('#customer_card_no').val(data.card_no);
|
||||||
|
$('#customer_type').val(data.customer_type);
|
||||||
$('#customer_salutation').val(data.salutation);
|
$('#customer_salutation').val(data.salutation);
|
||||||
$('#customer_nrc_no').val(data.nrc_no);
|
$('#customer_nrc_no').val(data.nrc_no);
|
||||||
$('#paypar_account_no').val(data.paypar_account_no);
|
$('#paypar_account_no').val(data.paypar_account_no);
|
||||||
|
|||||||
@@ -108,9 +108,12 @@
|
|||||||
<button id="cash_in" type="button" class="btn btn-block btn-primary"> Cash In </button>
|
<button id="cash_in" type="button" class="btn btn-block btn-primary"> Cash In </button>
|
||||||
<button id="cash_out" type="button" class="btn btn-block btn-primary"> Cash Out </button>
|
<button id="cash_out" type="button" class="btn btn-block btn-primary"> Cash Out </button>
|
||||||
<!-- Temporary Disabled -->
|
<!-- Temporary Disabled -->
|
||||||
<!-- <button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Sammary</button> -->
|
<%if current_login_employee.role == "cashier" && @shop.quick_sale_summary == true%>
|
||||||
|
<button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Summary</button>
|
||||||
|
<%end%>
|
||||||
<button id="close_cashier" type="button" class="btn btn-block btn-primary"> Close Cashier </button>
|
<button id="close_cashier" type="button" class="btn btn-block btn-primary"> Close Cashier </button>
|
||||||
|
|
||||||
|
|
||||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||||
<button id="back" type="button" class="btn btn-block btn-primary"><i class="fa fa-home fa-lg"></i> Back
|
<button id="back" type="button" class="btn btn-block btn-primary"><i class="fa fa-home fa-lg"></i> Back
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -305,31 +305,28 @@
|
|||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
|
<button type="button" id="add_order" class="btn btn-primary btn-block" >Add Order</button>
|
||||||
<% if @dining.bookings.length >= 1 %>
|
<% if @dining.bookings.length >= 1 %>
|
||||||
|
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
|
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
|
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
<% else %>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||||
<% else %>
|
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||||
<!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
|
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
|
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
<% end %>
|
||||||
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
|
||||||
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
|
||||||
<% end %>
|
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
|
|
||||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
||||||
@@ -580,4 +577,9 @@ function show_customer_details(customer_id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#add_order').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>"
|
||||||
|
window.location.href = '/origami/addorders/'+ dining_id;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -41,24 +41,24 @@
|
|||||||
<% sub_total = 0
|
<% sub_total = 0
|
||||||
count = 0
|
count = 0
|
||||||
%>
|
%>
|
||||||
<% @sale_data.sale_items.each do |sale_item|
|
<% @sale_data.sale_items.each do |sale_item|
|
||||||
count += 1
|
count += 1
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<% sub_total += sale_item.price%>
|
<% sub_total += sale_item.price%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%; text-align:right">
|
<td style="width:20%; text-align:right">
|
||||||
<span id="item-qty"><%=sale_item.qty%></span>
|
<span id="item-qty"><%=sale_item.qty%></span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%; text-align:right">
|
<td style="width:20%; text-align:right">
|
||||||
<span id="item-total-price"><%=(sale_item.price)%></span>
|
<span id="item-total-price"><%=(sale_item.price)%></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<%end %>
|
<%end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
<%else%>
|
<%else%>
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
|
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
|
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -258,7 +258,7 @@
|
|||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
||||||
<button type="button" class="btn btn-primary btn-block"> FOC </button>
|
<button type="button" class="btn btn-primary btn-block" id="foc"> FOC </button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id="void"> Void </button>
|
<button type="button" class="btn btn-primary btn-block" id="void"> Void </button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -443,4 +443,40 @@ function update_balance(){
|
|||||||
$('#balance').text(result.toFixed(2));
|
$('#balance').text(result.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#foc').click(function() {
|
||||||
|
|
||||||
|
$( "#loading_wrapper" ).show();
|
||||||
|
// payment
|
||||||
|
var cash = $('#amount_due').text();
|
||||||
|
var sub_total = $('#sub-total').text();
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_payment_foc_path %>",
|
||||||
|
data: params,
|
||||||
|
success:function(result){
|
||||||
|
|
||||||
|
$( "#loading_wrapper" ).hide();
|
||||||
|
|
||||||
|
if (cash > 0) {
|
||||||
|
$.confirm({
|
||||||
|
title: 'Infomation!',
|
||||||
|
content: 'Thank you !',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: 'Ok',
|
||||||
|
btnClass: 'btn-green',
|
||||||
|
action: function(){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
201
app/views/origami/shifts/sale_summary.html.erb
Normal file
201
app/views/origami/shifts/sale_summary.html.erb
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||||
|
<h3 style="text-align: center;">Sales Summary Quick View </h3>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Cashier </th>
|
||||||
|
<th>Cashier Terminal </th>
|
||||||
|
<th>Opening Date </th>
|
||||||
|
<th>Opening float </th>
|
||||||
|
<th>Received Amount </th>
|
||||||
|
<th>Cast In </th>
|
||||||
|
<th>Cast Out </th>
|
||||||
|
<th>Total Receipt </th>
|
||||||
|
<th>Dining Count </th>
|
||||||
|
<th>Takeaway Count </th>
|
||||||
|
<th>Total Void</th>
|
||||||
|
</tr>
|
||||||
|
<tr style="border-bottom:2px solid #000">
|
||||||
|
<td><%= @shift.employee.name%></td>
|
||||||
|
<td><%=@shift.cashier_terminal.name%></td>
|
||||||
|
<td><%= @shift.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
|
||||||
|
</td>
|
||||||
|
<td><%=@shift.opening_balance %></td>
|
||||||
|
<td><%=@shift.closing_balance %></td>
|
||||||
|
<td><%=@shift.cash_in %></td>
|
||||||
|
<td><%=@shift.cash_out %></td>
|
||||||
|
<th><%= @shift.total_receipt %></th>
|
||||||
|
<th><%= @shift.dining_count %></th>
|
||||||
|
<th><%= @shift.takeaway_count %></th>
|
||||||
|
<th>(<%= @shift.total_void.round(2) %>)</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="5">
|
||||||
|
<table width="100%">
|
||||||
|
<% @total_amount_by_account.each do |amount| %>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;"> Total <%= amount.account_name %> Amount</td>
|
||||||
|
<td><%= amount.total_price.round(2) %></td>
|
||||||
|
</tr>
|
||||||
|
<%end%>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;"> Net Sales</th>
|
||||||
|
<th><%=@shift.nett_sales %></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% @total_discount_by_account.each do |amount| %>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;"> Total <%= amount.account_name %> Discount</td>
|
||||||
|
<td><%= amount.total_price.round(2) %></td>
|
||||||
|
</tr>
|
||||||
|
<%end%>
|
||||||
|
|
||||||
|
<% if !@total_member_discount[0].member_discount.nil?
|
||||||
|
@member_discount = @total_member_discount[0].member_discount rescue 0.0
|
||||||
|
@overall = @shift.total_discounts - @member_discount
|
||||||
|
%>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;"> Total Member Discount</th>
|
||||||
|
<th><%= @member_discount %></th>
|
||||||
|
</tr>
|
||||||
|
<%else @overall = @shift.total_discounts %>
|
||||||
|
|
||||||
|
<%end%>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;"> Total Overall Discount</th>
|
||||||
|
<th><%= @overall %></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;"> Total Discount</th>
|
||||||
|
<th><%= @shift.total_discounts %></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% @sale_taxes.each do |tax| %>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;"> <%= tax.tax_name %> </td>
|
||||||
|
<td><%= tax.st_amount.round(2) %></td>
|
||||||
|
</tr>
|
||||||
|
<%end%>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;"> Total Tax </th>
|
||||||
|
<th><%=@shift.total_taxes %></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;"> Rounding Adj </th>
|
||||||
|
<th><%= @shift.total_rounding.round(2) %></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;"> Grand Total </th>
|
||||||
|
<th><%= @shift.grand_total.round(2) %></th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td colspan="6">
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;">Cash Payment </th>
|
||||||
|
<th><%=@shift.cash_sales %></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;">Credit Payment </th>
|
||||||
|
<th><%=@shift.credit_sales %></th>
|
||||||
|
</tr>
|
||||||
|
<% @total_amount = 0
|
||||||
|
|
||||||
|
@other_payment.each do |other| %>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;">Other Payment Detail </th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;">MPU Payment </td>
|
||||||
|
<td><%=other.mpu_amount.round(2) rescue 0.0 %></td>
|
||||||
|
<% @total_amount = @total_amount+other.mpu_amount rescue 0.0 %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;">VISA Payment </td>
|
||||||
|
<td><%=other.visa_amount.round(2) rescue 0.0 %></td>
|
||||||
|
<% @total_amount = @total_amount+other.visa_amount rescue 0.0 %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;">JCB Payment </td>
|
||||||
|
<td><%=other.master_amount.round(2) rescue 0.0 %></td>
|
||||||
|
<% @total_amount = @total_amount+other.master_amount rescue 0.0 %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;">Master Payment </td>
|
||||||
|
<td><%=other.jcb_amount.round(2) rescue 0.0 %></td>
|
||||||
|
<% @total_amount = @total_amount+other.jcb_amount rescue 0.0 %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;">Reedem Payment </td>
|
||||||
|
<td><%=other.paypar_amount.round(2) rescue 0.0 %></td>
|
||||||
|
<% @total_amount = @total_amount+other.paypar_amount rescue 0.0 %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<td style="text-align: right;"><strong>FOC </strong></td>
|
||||||
|
<td><%=other.foc_amount.round(2) rescue 0.0 %></td>
|
||||||
|
<% @total_amount = @total_amount+other.foc_amount rescue 0.0 %>
|
||||||
|
</tr>
|
||||||
|
<%end%>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;">Total Other Payment </th>
|
||||||
|
<th><%=@shift.other_sales %></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="text-align: right;">Total Payment </th>
|
||||||
|
<th><%= @total_amount+@shift.cash_sales+@shift.credit_sales %></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
|
<br><br><br>
|
||||||
|
<button id="close_cashier" type="button" class="btn btn-block btn-primary btn-lg"> Close Cashier
|
||||||
|
</button>
|
||||||
|
<button id="back" type="button" class="btn btn-block btn-primary btn-lg"><i class="fa fa-home fa-lg"></i> Back
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#close_cashier').on('click',function(){
|
||||||
|
window.location.href = '/origami/shift/close';
|
||||||
|
})
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
<li>Credit Payment List Report</li>
|
<li>Void Sale Report</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
15
app/views/settings/item_sets/_form.html.erb
Normal file
15
app/views/settings/item_sets/_form.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<%= simple_form_for([:settings,@settings_item_set]) do |f| %>
|
||||||
|
<%= f.error_notification %>
|
||||||
|
|
||||||
|
<div class="form-inputs">
|
||||||
|
<%= f.input :name %>
|
||||||
|
<%= f.input :alt_name %>
|
||||||
|
<%= f.input :min_selectable_qty,input_html: {value: f.object.min_selectable_qty || '0'} %>
|
||||||
|
<%= f.input :max_selectable_qty,input_html: {value: f.object.max_selectable_qty || '0'} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.button :submit ,:class=>'btn btn-success'%>
|
||||||
|
<%= link_to 'Back', settings_item_sets_path,:class => 'btn btn-danger' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
json.extract! settings_item_set, :id, :name, :min_selectable_qty, :max_selectable_qty, :created_at, :updated_at
|
||||||
|
json.url settings_item_set_url(settings_item_set, format: :json)
|
||||||
3
app/views/settings/item_sets/edit.html.erb
Normal file
3
app/views/settings/item_sets/edit.html.erb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>Editing Settings Item Set</h1>
|
||||||
|
|
||||||
|
<%= render 'form', settings_item_set: @settings_item_set %>
|
||||||
40
app/views/settings/item_sets/index.html.erb
Normal file
40
app/views/settings/item_sets/index.html.erb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= %>">Home</a></li>
|
||||||
|
<li>Item Set</li>
|
||||||
|
<span style="float: right">
|
||||||
|
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_item_set_path,:class => 'btn btn-primary btn-md' %>
|
||||||
|
</span>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div class="card">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Alt Name</th>
|
||||||
|
<th>Min selectable qty</th>
|
||||||
|
<th>Max selectable qty</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @settings_item_sets.each do |item| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= item.name %></td>
|
||||||
|
<td><%= item.alt_name %></td>
|
||||||
|
<td><%= item.min_selectable_qty %></td>
|
||||||
|
<td><%= item.max_selectable_qty %></td>
|
||||||
|
<td><%= link_to 'Show', settings_item_set_path(item),:class=>'btn btn-sm btn-success' %>
|
||||||
|
<%= link_to 'Edit', edit_settings_item_set_path(item),:class=>'btn btn-sm btn-primary' %>
|
||||||
|
<%= link_to 'Destroy', settings_item_set_path(item), method: :delete, data: { confirm: 'Are you sure?' } ,:class=>'btn btn-danger btn-sm'%></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
1
app/views/settings/item_sets/index.json.jbuilder
Normal file
1
app/views/settings/item_sets/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.array! @settings_item_sets, partial: 'settings_item_sets/settings_item_set', as: :settings_item_set
|
||||||
4
app/views/settings/item_sets/new.html.erb
Normal file
4
app/views/settings/item_sets/new.html.erb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<h1>New Settings Item Set</h1>
|
||||||
|
|
||||||
|
<%= render 'form', settings_item_set: @settings_item_set %>
|
||||||
|
|
||||||
38
app/views/settings/item_sets/show.html.erb
Normal file
38
app/views/settings/item_sets/show.html.erb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
|
<li><a href="<%= settings_item_sets_path %>">Item Set</a></li>
|
||||||
|
|
||||||
|
<span style="float: right">
|
||||||
|
</span>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<table class="table">
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><strong>Name:</strong></td>
|
||||||
|
<td><%= @settings_item_set.name %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong>Alt Name:</strong></td>
|
||||||
|
<td><%= @settings_item_set.alt_name %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong>Min selectable qty:</strong></td>
|
||||||
|
<td> <%= @settings_item_set.min_selectable_qty %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong>Max selectable qty:</strong></td>
|
||||||
|
<td><%= @settings_item_set.max_selectable_qty %></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<%= link_to 'Edit', edit_settings_item_set_path(@settings_item_set),:class=>'btn btn-primary' %>
|
||||||
|
<%= link_to 'Back', settings_item_sets_path,:class=>'btn btn-danger' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
1
app/views/settings/item_sets/show.json.jbuilder
Normal file
1
app/views/settings/item_sets/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.partial! "settings_item_sets/settings_item_set", settings_item_set: @settings_item_set
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
<%= f.input :menu_id, as: :hidden %>
|
<%= f.input :menu_id, as: :hidden %>
|
||||||
<%= f.input :code, label: "Category Code" %>
|
<%= f.input :code, label: "Category Code" %>
|
||||||
<%= f.input :name %>
|
<%= f.input :name %>
|
||||||
<%= f.input :alt_name %>
|
<%= f.input :alt_name %>
|
||||||
|
<%= f.input :is_available %>
|
||||||
<%= f.input :order_by %>
|
<%= f.input :order_by %>
|
||||||
<%= f.association :parent %>
|
<%= f.association :parent %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<th>Menu</th>
|
<th>Menu</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Alt name</th>
|
<th>Alt name</th>
|
||||||
|
<th>Is Available</th>
|
||||||
<th>Order by</th>
|
<th>Order by</th>
|
||||||
<th>Parent</th>
|
<th>Parent</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
|
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
|
||||||
|
|
||||||
<td><%= settings_menu_category.alt_name rescue ''%></td>
|
<td><%= settings_menu_category.alt_name rescue ''%></td>
|
||||||
|
<td><%= settings_menu_category.is_available rescue false%></td>
|
||||||
<td><%= settings_menu_category.order_by rescue ''%></td>
|
<td><%= settings_menu_category.order_by rescue ''%></td>
|
||||||
<td><%= settings_menu_category.parent.name rescue ''%></td>
|
<td><%= settings_menu_category.parent.name rescue ''%></td>
|
||||||
<td><%= link_to 'Edit', edit_settings_menu_category_path(settings_menu_category) %> | <%= link_to 'Destroy', settings_menu_category_path(settings_menu_category), method: :delete, data: { confirm: 'Are you sure?' } %></td></td>
|
<td><%= link_to 'Edit', edit_settings_menu_category_path(settings_menu_category) %> | <%= link_to 'Destroy', settings_menu_category_path(settings_menu_category), method: :delete, data: { confirm: 'Are you sure?' } %></td></td>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="<%= %>">Home</a></li>
|
<li><a href="<%= settings_menus_path %>">Home</a></li>
|
||||||
<li><a href="<%= settings_menu_categories_path %>">Menus Categories</a></li>
|
<li><a href="<%= settings_menu_categories_path %>">Menus Categories</a></li>
|
||||||
<li>Details</li>
|
<li>Details</li>
|
||||||
<span style="float: right">
|
<span style="float: right">
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<th>Menu</th>
|
<th>Menu</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Alt name</th>
|
<th>Alt name</th>
|
||||||
|
<th>Is Available</th>
|
||||||
<th>Order by</th>
|
<th>Order by</th>
|
||||||
<th>Created At</th>
|
<th>Created At</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
<td><%= @settings_menu_category.menu.name %></td>
|
<td><%= @settings_menu_category.menu.name %></td>
|
||||||
<td><%= @settings_menu_category.name rescue "-" %></td>
|
<td><%= @settings_menu_category.name rescue "-" %></td>
|
||||||
<td><%= @settings_menu_category.alt_name %></td>
|
<td><%= @settings_menu_category.alt_name %></td>
|
||||||
|
<td><%= settings_menu_category.is_available rescue false%></td>
|
||||||
<td><%= @settings_menu_category.order_by %></td>
|
<td><%= @settings_menu_category.order_by %></td>
|
||||||
<td><%= @settings_menu_category.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
<td><%= @settings_menu_category.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||||
<td><%= link_to 'Edit', edit_settings_menu_menu_category_path(@settings_menu_category, @settings_menu_category) %></td>
|
<td><%= link_to 'Edit', edit_settings_menu_menu_category_path(@settings_menu_category, @settings_menu_category) %></td>
|
||||||
|
|||||||
@@ -3,21 +3,32 @@
|
|||||||
|
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="col-md-8 panel">
|
||||||
<%= f.input :item_instance_code %>
|
<div class="form-group">
|
||||||
<%= f.input :item_instance_name %>
|
<%= f.input :item_instance_code %>
|
||||||
<%= f.input :price %>
|
<%= f.input :item_instance_name %>
|
||||||
|
<%= f.input :price %>
|
||||||
|
|
||||||
<%= f.input :item_attributes, collection: MenuItemAttribute.collection, input_html: { multiple: true } %>
|
<%= f.input :item_attributes, collection: MenuItemAttribute.collection, input_html: { multiple: true } %>
|
||||||
|
|
||||||
|
<%= f.input :is_on_promotion %>
|
||||||
<%= f.input :is_on_promotion %>
|
<%= f.input :promotion_price %>
|
||||||
<%= f.input :promotion_price %>
|
</div>
|
||||||
<%= f.input :is_available %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="col-md-4">
|
||||||
<%= f.button :submit %>
|
<div class="panel padding-10">
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :is_available %>
|
||||||
|
<%= f.input :is_default %>
|
||||||
|
|
||||||
|
<%= f.input :item_sets, :collection => @item_sets, :input_html => { :multiple => true }, :class => "form-control item_sets" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.button :submit %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
<li>Edit</li>
|
<li>Edit</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<%= render 'form', settings_menu_item_menu_item_instances: @settings_menu_item_instances %>
|
<%= render 'form', settings_menu_item_menu_item_instances: @settings_menu_item_instances, item_sets: @item_sets %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
<li>New Menu Item Instance</li>
|
<li>New Menu Item Instance</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<%= render 'form', settings_simple_menu_item_menu_item_instances: @settings_menu_item_instances %>
|
<%= render 'form', settings_simple_menu_item_menu_item_instances: @settings_menu_item_instances, item_sets: @item_sets %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user