merge with master
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -26,7 +26,7 @@ capybara-*.html
|
|||||||
/public/assets/*
|
/public/assets/*
|
||||||
/public/uploads/*
|
/public/uploads/*
|
||||||
/public/swf/*
|
/public/swf/*
|
||||||
/public/receipts
|
/public/receipts/
|
||||||
/coverage/
|
/coverage/
|
||||||
/spec/tmp/*
|
/spec/tmp/*
|
||||||
*.orig
|
*.orig
|
||||||
|
|||||||
7
Gemfile
7
Gemfile
@@ -46,9 +46,11 @@ gem 'mini_magick'
|
|||||||
gem 'cups'
|
gem 'cups'
|
||||||
gem 'prawn'
|
gem 'prawn'
|
||||||
gem 'prawn-table'
|
gem 'prawn-table'
|
||||||
gem 'spreadsheet'
|
|
||||||
gem 'to_xls-rails'
|
gem 'to_xls-rails'
|
||||||
|
gem 'rubyzip', '= 1.0.0'
|
||||||
|
gem 'axlsx', '= 2.0.1'
|
||||||
|
gem 'axlsx_rails'
|
||||||
|
gem 'roo'
|
||||||
#Reporting gem
|
#Reporting gem
|
||||||
#gem 'compendium'
|
#gem 'compendium'
|
||||||
#gem "cancan"
|
#gem "cancan"
|
||||||
@@ -81,7 +83,6 @@ gem 'kaminari', '~> 1.0.1'
|
|||||||
gem 'filterrific'
|
gem 'filterrific'
|
||||||
|
|
||||||
gem 'cancancan', '~> 1.10'
|
gem 'cancancan', '~> 1.10'
|
||||||
|
|
||||||
#pageless no need for current
|
#pageless no need for current
|
||||||
# gem 'will_paginate'
|
# gem 'will_paginate'
|
||||||
# gem 'pageless-rails', github: 'rorlab/pageless-rails'
|
# gem 'pageless-rails', github: 'rorlab/pageless-rails'
|
||||||
|
|||||||
18
Gemfile.lock
18
Gemfile.lock
@@ -50,6 +50,13 @@ GEM
|
|||||||
airbrussh (1.3.0)
|
airbrussh (1.3.0)
|
||||||
sshkit (>= 1.6.1, != 1.7.0)
|
sshkit (>= 1.6.1, != 1.7.0)
|
||||||
arel (8.0.0)
|
arel (8.0.0)
|
||||||
|
axlsx (2.0.1)
|
||||||
|
htmlentities (~> 4.3.1)
|
||||||
|
nokogiri (>= 1.4.1)
|
||||||
|
rubyzip (~> 1.0.0)
|
||||||
|
axlsx_rails (0.5.1)
|
||||||
|
actionpack (>= 3.1)
|
||||||
|
axlsx (>= 2.0.1)
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
bindex (0.5.0)
|
bindex (0.5.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
@@ -100,6 +107,7 @@ GEM
|
|||||||
railties (>= 3.2, < 5.2)
|
railties (>= 3.2, < 5.2)
|
||||||
globalid (0.4.1)
|
globalid (0.4.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
|
htmlentities (4.3.4)
|
||||||
httparty (0.15.6)
|
httparty (0.15.6)
|
||||||
multi_xml (>= 0.5.2)
|
multi_xml (>= 0.5.2)
|
||||||
i18n (0.9.1)
|
i18n (0.9.1)
|
||||||
@@ -197,6 +205,10 @@ GEM
|
|||||||
rb-inotify (0.9.10)
|
rb-inotify (0.9.10)
|
||||||
ffi (>= 0.5.0, < 2)
|
ffi (>= 0.5.0, < 2)
|
||||||
redis (3.3.5)
|
redis (3.3.5)
|
||||||
|
roo (1.13.2)
|
||||||
|
nokogiri
|
||||||
|
rubyzip
|
||||||
|
spreadsheet (> 0.6.4)
|
||||||
rspec-core (3.7.0)
|
rspec-core (3.7.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.7.0)
|
||||||
rspec-expectations (3.7.0)
|
rspec-expectations (3.7.0)
|
||||||
@@ -215,6 +227,7 @@ GEM
|
|||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.7.0)
|
||||||
rspec-support (3.7.0)
|
rspec-support (3.7.0)
|
||||||
ruby-ole (1.2.12.1)
|
ruby-ole (1.2.12.1)
|
||||||
|
rubyzip (1.0.0)
|
||||||
sass (3.5.3)
|
sass (3.5.3)
|
||||||
sass-listen (~> 4.0.0)
|
sass-listen (~> 4.0.0)
|
||||||
sass-listen (4.0.0)
|
sass-listen (4.0.0)
|
||||||
@@ -286,6 +299,8 @@ PLATFORMS
|
|||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
aescrypt
|
aescrypt
|
||||||
|
axlsx (= 2.0.1)
|
||||||
|
axlsx_rails
|
||||||
bcrypt (~> 3.1.7)
|
bcrypt (~> 3.1.7)
|
||||||
byebug
|
byebug
|
||||||
cancancan (~> 1.10)
|
cancancan (~> 1.10)
|
||||||
@@ -320,13 +335,14 @@ DEPENDENCIES
|
|||||||
rack-cors
|
rack-cors
|
||||||
rails (~> 5.1.0)
|
rails (~> 5.1.0)
|
||||||
redis (~> 3.0)
|
redis (~> 3.0)
|
||||||
|
roo
|
||||||
rspec-rails (~> 3.5)
|
rspec-rails (~> 3.5)
|
||||||
|
rubyzip (= 1.0.0)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
schema_to_scaffold
|
schema_to_scaffold
|
||||||
shoulda-matchers (~> 3.1)
|
shoulda-matchers (~> 3.1)
|
||||||
sidekiq
|
sidekiq
|
||||||
simple_form
|
simple_form
|
||||||
spreadsheet
|
|
||||||
spring
|
spring
|
||||||
spring-watcher-listen (~> 2.0.0)
|
spring-watcher-listen (~> 2.0.0)
|
||||||
tether-rails
|
tether-rails
|
||||||
|
|||||||
50
README.md
50
README.md
@@ -8,30 +8,24 @@ Things you may want to cover:
|
|||||||
ruby 2.4.1p111
|
ruby 2.4.1p111
|
||||||
|
|
||||||
* Membership Details
|
* Membership Details
|
||||||
|
Osaka =>
|
||||||
Osaka
|
Auth Token => wu8YvlLmah0CL => New => v3
|
||||||
|
=> rj0MJ0XI5GsKZehE => Old => v2
|
||||||
Auth Token => wu8YvlLmah0CL => New ##note : Old => rj0MJ0XI5GsKZehE
|
|
||||||
|
|
||||||
=> code2lab => Old
|
=> code2lab => Old
|
||||||
|
|
||||||
Merchant account => RxzaYyAGzm7VqAZ4hKnv
|
Merchant account => RxzaYyAGzm7VqAZ4hKnv
|
||||||
|
|
||||||
Campaign Id => {"campaign_type_id": 5}
|
Campaign Id => {"campaign_type_id": 5}
|
||||||
|
|
||||||
|
BITP
|
||||||
|
Auth Token => pZBHXEFbGNj/G => New => V3
|
||||||
BITP
|
=> rj0MJ0XI5GsKZehE => Old => V2
|
||||||
|
|
||||||
Auth Token => pZBHXEFbGNj/G => New ##note : Old => rj0MJ0XI5GsKZehE
|
|
||||||
|
|
||||||
=> code2lab => Old
|
=> code2lab => Old
|
||||||
|
|
||||||
Merchant account => vWSsseoZCzxd6xcNf_uS
|
Merchant account => vWSsseoZCzxd6xcNf_uS
|
||||||
|
|
||||||
Campaign Id => {"campaign_type_id": 1}
|
Campaign Id => {"campaign_type_id": 1}
|
||||||
|
|
||||||
java -jar ~/Documents/Jade.jar http://192.168.1.88:3002
|
java -jar ~/Documents/Jade.jar http://192.168.1.88:3002
|
||||||
|
java -jar ~/Documents/c2l_jade.jar http://192.168.1.151:3002
|
||||||
|
|
||||||
Person and Extra Time
|
Person and Extra Time
|
||||||
category_code = SPL... //for menu categories special
|
category_code = SPL... //for menu categories special
|
||||||
@@ -106,6 +100,14 @@ Change type in mysql
|
|||||||
For split bill
|
For split bill
|
||||||
1) settings/lookups => { type:split_bill, name:SplitBill, value:1 }
|
1) settings/lookups => { type:split_bill, name:SplitBill, value:1 }
|
||||||
|
|
||||||
|
For Sidekiq
|
||||||
|
1) If you want to use sidekiq
|
||||||
|
=> Create New Lookups => lookup_type = sidekiq, Name = sidekiq , Value = 1 or 0
|
||||||
|
|
||||||
|
For Clear Menu
|
||||||
|
1) rake clear:menu # menu,menu item,menu category,menu item instance,account,item option,item attribute,item set
|
||||||
|
|
||||||
|
For Check CUp status
|
||||||
###please open
|
###please open
|
||||||
sudo cat /etc/sudoers
|
sudo cat /etc/sudoers
|
||||||
### cope and parse
|
### cope and parse
|
||||||
@@ -134,12 +136,34 @@ ADD COLUMN image_path VARCHAR(255);
|
|||||||
|
|
||||||
ALTER TABLE sales
|
ALTER TABLE sales
|
||||||
ADD COLUMN equal_persons INT(11) after rebate_status;
|
ADD COLUMN equal_persons INT(11) after rebate_status;
|
||||||
|
|
||||||
|
ALTER TABLE sale_items
|
||||||
|
ADD COLUMN remark VARCHAR(255) after status;
|
||||||
|
|
||||||
|
ALTER TABLE shops
|
||||||
|
ADD COLUMN shop_code VARCHAR(255) after name,
|
||||||
|
ADD COLUMN client_name VARCHAR(255) after shop_code,
|
||||||
|
ADD COLUMN client_code VARCHAR(255) after client_name;
|
||||||
|
|
||||||
|
ALTER TABLE print_settings
|
||||||
|
ADD COLUMN brand_name VARCHAR(255) after api_settings,
|
||||||
|
ADD COLUMN type VARCHAR(255) after brand_name;
|
||||||
|
|
||||||
|
ALTER TABLE tax_profiles
|
||||||
|
ADD COLUMN group_type VARCHAR(255) after name;
|
||||||
|
|
||||||
<---- Extra Fields Script ----->
|
<---- Extra Fields Script ----->
|
||||||
For CloseCashierCustomisePdf in lookups
|
For CloseCashierCustomisePdf in lookups
|
||||||
*** change CloseCashierPdf to CloseCashierCustomisePdf
|
*** change CloseCashierPdf to CloseCashierCustomisePdf
|
||||||
1) settings/print_settings
|
1) settings/print_settings
|
||||||
2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }
|
2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }
|
||||||
|
|
||||||
|
/* Tax Profile Group Types in lookups */
|
||||||
|
1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier }
|
||||||
|
2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service }
|
||||||
|
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
||||||
|
/* Tax Profile Group Types in lookups */
|
||||||
|
|
||||||
* ToDo list
|
* ToDo list
|
||||||
|
|
||||||
1. Migration
|
1. Migration
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
//= require bootstrap-notify/bootstrap-notify.js
|
//= require bootstrap-notify/bootstrap-notify.js
|
||||||
//= require node-waves/waves.js
|
//= require node-waves/waves.js
|
||||||
//= require sweetalert/sweetalert.min.js
|
//= require sweetalert/sweetalert.min.js
|
||||||
|
//= require fileinput.min
|
||||||
//= require BSBMaterial/turbolink_admin.js
|
//= require BSBMaterial/turbolink_admin.js
|
||||||
//= require BSBMaterial/demo.js
|
//= require BSBMaterial/demo.js
|
||||||
//= require custom.js
|
//= require custom.js
|
||||||
@@ -34,4 +35,24 @@ $(document).on('turbolinks:load', function() {
|
|||||||
weekStart: 1,
|
weekStart: 1,
|
||||||
time: false
|
time: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#customer_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',
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -36,7 +36,7 @@ $(function() {
|
|||||||
image_path = "/image/logo.png";
|
image_path = "/image/logo.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
row = '<div class="card custom-card testimonial-card fadeInRight" style="">'
|
||||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">'
|
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">'
|
||||||
+'<div class="col-md-9">'+ product[field].name +'</div>'
|
+'<div class="col-md-9">'+ product[field].name +'</div>'
|
||||||
+"<div class='col-md-3 add_icon' data-item-code='"
|
+"<div class='col-md-3 add_icon' data-item-code='"
|
||||||
@@ -181,8 +181,7 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
|
||||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
||||||
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
|
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
|
||||||
+"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
|
+"<div class='col-md-3 "+menu_item_box+"' data-item-code='"
|
||||||
@@ -190,19 +189,21 @@ $(function() {
|
|||||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||||
|
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
|
||||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
|
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
|
||||||
+"<i class='fa "+fa_plus+" '>"
|
+"<i class='fa "+fa_plus+" '>"
|
||||||
+add+ '</i>'
|
+add+ '</i>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
+"<div class='"+add_icon+" p-t-65 m-r--5' data-item-code='"
|
+"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='"
|
||||||
+ menu_items[field].code +"' data-name='"
|
+ menu_items[field].code +"' data-name='"
|
||||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||||
+ options +"' data-image='"+image_path+"' data-toggle='"
|
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
|
||||||
|
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
|
||||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||||
@@ -237,7 +238,7 @@ $(function() {
|
|||||||
//instances = $(this).data('instance');
|
//instances = $(this).data('instance');
|
||||||
item_sets = $(this).data('item-sets');
|
item_sets = $(this).data('item-sets');
|
||||||
instances = $(this).data('instances');
|
instances = $(this).data('instances');
|
||||||
// item_sets = $(data).attr('data-item-sets');
|
item_options = $(this).data('options');
|
||||||
|
|
||||||
for(var field in item_sets) {
|
for(var field in item_sets) {
|
||||||
|
|
||||||
@@ -283,10 +284,20 @@ $(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(var j in item_options) {
|
||||||
|
value = item_options[j]["values"];
|
||||||
|
type = item_options[j]["type"];
|
||||||
|
row = "<h4>"+type+"</h4>"
|
||||||
|
$(value).each(function(i){
|
||||||
|
row +="<button class='btn btn- waves-effect option_btn "+ type +"' data-type='"
|
||||||
|
+type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"</button>";
|
||||||
|
});
|
||||||
|
$(".options-list").append(row);
|
||||||
|
}
|
||||||
$('.set-item').attr('data-code',instances[0]['code']);
|
$('.set-item').attr('data-code',instances[0]['code']);
|
||||||
$('.set-item').attr('data-name',instances[0]['name']);
|
$('.set-item').attr('data-name',instances[0]['name']);
|
||||||
$('.set-item').attr('data-price',instances[0]['price']);
|
$('.set-item').attr('data-price',instances[0]['price']);
|
||||||
$('.set-item').attr('data-options','[]');
|
$('.set-item').attr('data-options','');
|
||||||
$('.set-item').attr('data-parent',true);
|
$('.set-item').attr('data-parent',true);
|
||||||
|
|
||||||
$('#set_change_qty').val(1);
|
$('#set_change_qty').val(1);
|
||||||
@@ -341,6 +352,7 @@ $(function() {
|
|||||||
sub_total = $('#set_total_price').text();
|
sub_total = $('#set_total_price').text();
|
||||||
name = $(this).data('name');
|
name = $(this).data('name');
|
||||||
price = $(this).data('price');
|
price = $(this).data('price');
|
||||||
|
options = $(this).attr('data-options','');
|
||||||
// qty = $('#set_change_qty').val();
|
// qty = $('#set_change_qty').val();
|
||||||
qty = document.getElementById("set_count").value;
|
qty = document.getElementById("set_count").value;
|
||||||
total = qty*price;
|
total = qty*price;
|
||||||
@@ -369,52 +381,48 @@ $(function() {
|
|||||||
|
|
||||||
item = get_set_item(items);
|
item = get_set_item(items);
|
||||||
customer_display_view(item,"set_add");
|
customer_display_view(item,"set_add");
|
||||||
|
var option = ''
|
||||||
attribute_arr = []
|
attribute_arr = []
|
||||||
option_arr = []
|
|
||||||
|
|
||||||
var rowCount = $('.summary-items tbody tr').length+1;
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
option_arr = []
|
|
||||||
code = $('.set-item').attr('data-code');
|
code = $('.set-item').attr('data-code');
|
||||||
name = $('.set-item').attr('data-name');
|
name = $('.set-item').attr('data-name');
|
||||||
price = $('.set-item').attr('data-price');
|
price = $('.set-item').attr('data-price');
|
||||||
option = $('.set-item').attr('data-options');
|
option = ($('.set-item').attr('data-options') === 'undefined') ? '' :$('.set-item').attr('data-options');
|
||||||
parent = $('.set-item').attr('data-parent');
|
parent = $('.set-item').attr('data-parent');
|
||||||
total = qty * price ;
|
total = qty * price ;
|
||||||
option_arr.push(option);
|
|
||||||
row ="<tr class='item_box' data-price ='"
|
row ="<tr class='item_box' data-price ='"
|
||||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||||
+code+"' data-attributes='"
|
+code+"' data-attributes='"
|
||||||
+attribute_arr+"' data-options ='"
|
+attribute_arr+"' data-options ='"
|
||||||
+option_arr+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
|
+option+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
|
||||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + option +'</td>'
|
||||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
+'<td class="item-cell-price" id="item_price">'
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
+ parseFloat(total).toFixed(2)
|
+ parseFloat(total).toFixed(2)
|
||||||
+'</td>'
|
+'</td>'
|
||||||
+'</tr>';
|
+'</tr>';
|
||||||
$(".summary-items tbody").append(row);
|
$(".summary-items tbody").append(row);
|
||||||
|
|
||||||
var rowCount = $('.summary-items tbody tr').length+1;
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
|
var set_option = ''
|
||||||
$(items).each(function(i){
|
$(items).each(function(i){
|
||||||
code = $(items[i]).attr('data-code');
|
code = $(items[i]).attr('data-code');
|
||||||
name = $(items[i]).attr('data-name');
|
name = $(items[i]).attr('data-name');
|
||||||
price = $(items[i]).attr('data-price');
|
price = $(items[i]).attr('data-price');
|
||||||
option = $(items[i]).attr('data-options');
|
set_option = ($(items[i]).attr('data-options') === 'undefined') ? ' ' :$(items[i]).attr('data-options');
|
||||||
|
|
||||||
sub_item = $(items[i]).attr('data-sub-item');
|
sub_item = $(items[i]).attr('data-sub-item');
|
||||||
option = $(items[i]).attr('data-options');
|
|
||||||
total = qty * price ;
|
total = qty * price ;
|
||||||
option_arr.push(option);
|
|
||||||
row ="<tr class='item_box' data-price ='"
|
row ="<tr class='item_box' data-price ='"
|
||||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||||
+code+"' data-attributes='"
|
+code+"' data-attributes='"
|
||||||
+attribute_arr+"' data-options ='"
|
+attribute_arr+"' data-options ='"
|
||||||
+option_arr+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
+set_option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
||||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + set_option +'</td>'
|
||||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
+'<td class="item-cell-price" id="item_price">'
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
+ parseFloat(total).toFixed(2)
|
+ parseFloat(total).toFixed(2)
|
||||||
@@ -626,8 +634,6 @@ $(function() {
|
|||||||
|
|
||||||
|
|
||||||
if(group == "set_menu"){
|
if(group == "set_menu"){
|
||||||
code = $(this).data('code');
|
|
||||||
value = $(this).data('value');
|
|
||||||
|
|
||||||
instance = $(".selected-instance");
|
instance = $(".selected-instance");
|
||||||
$(instance).each(function(i){
|
$(instance).each(function(i){
|
||||||
@@ -639,6 +645,12 @@ $(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(group == "set_menu_default"){
|
||||||
|
option_arr = get_selected_attributes('selected-option');
|
||||||
|
$('.set-item').attr('data-options',JSON.stringify(option_arr));
|
||||||
|
$('.set_default_option').text(option_arr);
|
||||||
|
}
|
||||||
|
|
||||||
}); //End selecct attribute buttom
|
}); //End selecct attribute buttom
|
||||||
|
|
||||||
// click add order
|
// click add order
|
||||||
@@ -650,7 +662,6 @@ $(function() {
|
|||||||
|
|
||||||
attribute_arr = get_selected_attributes('selected-attribute');
|
attribute_arr = get_selected_attributes('selected-attribute');
|
||||||
option_arr = get_selected_attributes('selected-option');
|
option_arr = get_selected_attributes('selected-option');
|
||||||
|
|
||||||
if (item_row.length>0) {
|
if (item_row.length>0) {
|
||||||
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
|
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
|
||||||
|
|
||||||
@@ -689,9 +700,9 @@ $(function() {
|
|||||||
$('.add_to_order').attr('data-attributes',JSON.stringify(attribute_arr));
|
$('.add_to_order').attr('data-attributes',JSON.stringify(attribute_arr));
|
||||||
$('.add_to_order').attr('data-options',JSON.stringify(option_arr));
|
$('.add_to_order').attr('data-options',JSON.stringify(option_arr));
|
||||||
var item_data = $(this);
|
var item_data = $(this);
|
||||||
item = get_item(item_data);
|
item = get_item(item_data,"add_to_order");
|
||||||
customer_display_view(item,"add");
|
customer_display_view(item,"add");
|
||||||
show_item_detail(item_data);
|
show_item_detail(item_data,"add_to_order");
|
||||||
calculate_sub_total();
|
calculate_sub_total();
|
||||||
|
|
||||||
}); //End add order Click
|
}); //End add order Click
|
||||||
@@ -699,13 +710,13 @@ $(function() {
|
|||||||
// click plus icon for add
|
// click plus icon for add
|
||||||
$(document).on('click', '.add_icon', function(event){
|
$(document).on('click', '.add_icon', function(event){
|
||||||
var item_data = $(this);
|
var item_data = $(this);
|
||||||
item = get_item(item_data);
|
item = get_item(item_data,"add_icon");
|
||||||
customer_display_view(item,"add");
|
customer_display_view(item,"add");
|
||||||
show_item_detail(item_data);
|
show_item_detail(item_data,"add_icon");
|
||||||
calculate_sub_total();
|
calculate_sub_total();
|
||||||
}); //End Add Icon Click
|
}); //End Add Icon Click
|
||||||
|
|
||||||
function show_item_detail(data){
|
function show_item_detail(data,click_type){
|
||||||
|
|
||||||
qty = parseInt(data.attr('data-qty'));
|
qty = parseInt(data.attr('data-qty'));
|
||||||
append = 0;
|
append = 0;
|
||||||
@@ -717,23 +728,24 @@ $(function() {
|
|||||||
}else{
|
}else{
|
||||||
instance = "("+data.attr('data-instance')+")";
|
instance = "("+data.attr('data-instance')+")";
|
||||||
}
|
}
|
||||||
|
d_option = data.attr('data-opt');
|
||||||
d_option = data.attr('data-options');
|
if (click_type != "add_icon"){
|
||||||
if (d_option){
|
|
||||||
option_name = "-"+data.attr('data-options');
|
option_name = "-"+data.attr('data-options');
|
||||||
|
data_option = data.attr('data-options') ;
|
||||||
}else{
|
}else{
|
||||||
option_name = '';
|
option_name = ' ';
|
||||||
|
data_option = '[]';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var rowCount = $('.summary-items tbody tr').length+1;
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
var item_row = $('.summary-items tbody tr');
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
$(item_row).each(function(i){
|
$(item_row).each(function(i){
|
||||||
item_code = $(item_row[i]).attr('data-code');
|
item_code = $(item_row[i]).attr('data-code');
|
||||||
instance_code = $(item_row[i]).attr('data-instance-code');
|
instance_code = $(item_row[i]).attr('data-instance-code');
|
||||||
r_option = $(item_row[i]).attr('data-options');
|
r_option = $(item_row[i]).attr('data-opt');
|
||||||
|
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) {
|
||||||
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option==d_option) {
|
|
||||||
if (qty > 1) {
|
if (qty > 1) {
|
||||||
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
|
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
|
||||||
}else{
|
}else{
|
||||||
@@ -757,9 +769,10 @@ $(function() {
|
|||||||
+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
|
+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
|
||||||
+data.attr('data-instance-code')+"' data-attributes='"
|
+data.attr('data-instance-code')+"' data-attributes='"
|
||||||
+data.attr('data-attributes')+"' data-options ='"
|
+data.attr('data-attributes')+"' data-options ='"
|
||||||
|
+data_option+"' data-opt ='"
|
||||||
+data.attr('data-options')+"' data-row ='"+rowCount+ "'>"
|
+data.attr('data-options')+"' data-row ='"+rowCount+ "'>"
|
||||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance +' ' + option_name +'</td>'
|
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance +''+option_name+'</td>'
|
||||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
+'<td class="item-cell-price" id="item_price">'
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
+ parseFloat(price).toFixed(2)
|
+ parseFloat(price).toFixed(2)
|
||||||
@@ -776,8 +789,8 @@ $(function() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$("#oqs_loading_wrapper").show();
|
$("#oqs_loading_wrapper").show();
|
||||||
|
|
||||||
type = window.location.href.indexOf("quick_service");
|
quick_service = window.location.href.indexOf("quick_service");
|
||||||
if (type != -1) {
|
if (quick_service != -1) {
|
||||||
type = 'quick_service'
|
type = 'quick_service'
|
||||||
var table_type = $('#table_type').text();
|
var table_type = $('#table_type').text();
|
||||||
var table_id = $('#table_id').val();
|
var table_id = $('#table_id').val();
|
||||||
@@ -813,7 +826,6 @@ $(function() {
|
|||||||
data: params,
|
data: params,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success:function(result){
|
success:function(result){
|
||||||
customer_display_view(null,"reload");
|
|
||||||
if (type == "quick_service") {
|
if (type == "quick_service") {
|
||||||
window.location.href = "/origami/quick_service"
|
window.location.href = "/origami/quick_service"
|
||||||
}else{
|
}else{
|
||||||
@@ -824,6 +836,7 @@ $(function() {
|
|||||||
window.location.href = "/origami/room/" + table_id
|
window.location.href = "/origami/room/" + table_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
customer_display_view(null,"reload");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// }else{
|
// }else{
|
||||||
@@ -878,8 +891,19 @@ $(function() {
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success:function(result){
|
success:function(result){
|
||||||
if (result.status) {
|
if (result.status) {
|
||||||
|
|
||||||
if (result.data == null){
|
if (result.data == null){
|
||||||
|
swal({
|
||||||
|
title: "Please Open Shift !",
|
||||||
|
text: result.status,
|
||||||
|
type: "warning",
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Ok",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function () {
|
||||||
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
|
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
|
||||||
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
|
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
|
||||||
}
|
}
|
||||||
@@ -1156,7 +1180,7 @@ $(function() {
|
|||||||
|
|
||||||
for(var i in data) {
|
for(var i in data) {
|
||||||
|
|
||||||
row = '<li class="menu_category fadeInTop animated" data-id="'+data[i].id+'">'
|
row = '<li class="menu_category fadeInTop" data-id="'+data[i].id+'">'
|
||||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
||||||
+'</li>' ;
|
+'</li>' ;
|
||||||
$(sub_category).append(row);
|
$(sub_category).append(row);
|
||||||
@@ -1169,7 +1193,7 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get Item rows */
|
/* Get Item rows */
|
||||||
function get_item(data){
|
function get_item(data,click_type){
|
||||||
var sale_items = [];
|
var sale_items = [];
|
||||||
|
|
||||||
var sale_item = {};
|
var sale_item = {};
|
||||||
@@ -1180,6 +1204,8 @@ $(function() {
|
|||||||
sale_item.instance_code = data.attr('data-instance-code')
|
sale_item.instance_code = data.attr('data-instance-code')
|
||||||
sale_item.attributes = data.attr('data-attributes')
|
sale_item.attributes = data.attr('data-attributes')
|
||||||
sale_item.options = data.attr('data-options')
|
sale_item.options = data.attr('data-options')
|
||||||
|
sale_item.opt = data.attr('data-opt')
|
||||||
|
sale_item.click_type = click_type
|
||||||
sale_item.instance = data.attr('data-instance')
|
sale_item.instance = data.attr('data-instance')
|
||||||
sale_items.push(sale_item);
|
sale_items.push(sale_item);
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,86 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#shop_logo").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',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#commissioner_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',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#employee_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',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#shop_image").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',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// first input focus for all form
|
// first input focus for all form
|
||||||
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
|
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
var tax = data.tax_profiles;
|
var tax = data.tax_profiles;
|
||||||
var status= data.status
|
var status= data.status
|
||||||
if (status == "reload") {
|
if (status == "reload") {
|
||||||
window.location.reload();
|
jQuery('#s_reload').click();
|
||||||
}
|
}
|
||||||
$('#second_display_slider').addClass("hidden")
|
$('#second_display_slider').addClass("hidden")
|
||||||
$('#second_display_items').removeClass("hidden")
|
$('#second_display_items').removeClass("hidden")
|
||||||
|
|
||||||
|
|
||||||
// append items
|
// append items
|
||||||
if (status == "add") {
|
if (status == "add") {
|
||||||
for(var i in items) {
|
for(var i in items) {
|
||||||
@@ -28,11 +30,20 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
instance = "("+items[i].instance+")";
|
instance = "("+items[i].instance+")";
|
||||||
}
|
}
|
||||||
|
|
||||||
d_option = items[i].options;
|
// d_option = items[i].options;
|
||||||
if (d_option){
|
// if (d_option){
|
||||||
|
// option_name = "-"+items[i].options;
|
||||||
|
// }else{
|
||||||
|
// option_name = '';
|
||||||
|
// }
|
||||||
|
|
||||||
|
d_option = items[i].opt;
|
||||||
|
if (items[i].click_type != "add_icon"){
|
||||||
option_name = "-"+items[i].options;
|
option_name = "-"+items[i].options;
|
||||||
|
data_option = items[i].options ;
|
||||||
}else{
|
}else{
|
||||||
option_name = '';
|
option_name = ' ';
|
||||||
|
data_option = '[]';
|
||||||
}
|
}
|
||||||
|
|
||||||
var rowCount = $('.second_display_items tbody tr').length+1;
|
var rowCount = $('.second_display_items tbody tr').length+1;
|
||||||
@@ -66,6 +77,7 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
|
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
|
||||||
+items[i].instance_code+"' data-attributes='"
|
+items[i].instance_code+"' data-attributes='"
|
||||||
+items[i].attributes+"' data-options ='"
|
+items[i].attributes+"' data-options ='"
|
||||||
|
+data_option+"' data-opt ='"
|
||||||
+items[i].options+"' data-row ='"+rowCount+ "'>"
|
+items[i].options+"' data-row ='"+rowCount+ "'>"
|
||||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
+'<td class="item-cell-name" id="item_name" >' + items[i].name+ ' ' + instance + ' ' + option_name +'</td>'
|
+'<td class="item-cell-name" id="item_name" >' + items[i].name+ ' ' + instance + ' ' + option_name +'</td>'
|
||||||
@@ -84,8 +96,6 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
|
|||||||
var attribute_arr = [];
|
var attribute_arr = [];
|
||||||
var rowCount = $('.second_display_items tbody tr').length+1;
|
var rowCount = $('.second_display_items tbody tr').length+1;
|
||||||
for(var i in items) {
|
for(var i in items) {
|
||||||
|
|
||||||
|
|
||||||
code = items[i].code;
|
code = items[i].code;
|
||||||
item_code = items[i].item_code;
|
item_code = items[i].item_code;
|
||||||
name = items[i].name;
|
name = items[i].name;
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ $(document).ready(function() {
|
|||||||
color: 'rgba(0,0,0,0.5)',
|
color: 'rgba(0,0,0,0.5)',
|
||||||
alwaysVisible: false,
|
alwaysVisible: false,
|
||||||
borderRadius: '0',
|
borderRadius: '0',
|
||||||
railBorderRadius: '0'
|
railBorderRadius: '0',
|
||||||
|
touchScrollStep : 25
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#order-detail-slimscroll').slimScroll({
|
$('#order-detail-slimscroll').slimScroll({
|
||||||
@@ -18,7 +19,18 @@ $(document).ready(function() {
|
|||||||
color: 'rgba(0,0,0,0.5)',
|
color: 'rgba(0,0,0,0.5)',
|
||||||
alwaysVisible: false,
|
alwaysVisible: false,
|
||||||
borderRadius: '0',
|
borderRadius: '0',
|
||||||
railBorderRadius: '0'
|
railBorderRadius: '0',
|
||||||
|
touchScrollStep : 25
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#menu-slimscroll').slimScroll({
|
||||||
|
height: height-$('#menu-slimscroll').attr('data-height'),
|
||||||
|
size: '5px',
|
||||||
|
color: 'rgba(0,0,0,0.5)',
|
||||||
|
alwaysVisible: false,
|
||||||
|
borderRadius: '0',
|
||||||
|
railBorderRadius: '0',
|
||||||
|
touchScrollStep : 25
|
||||||
});
|
});
|
||||||
|
|
||||||
// $('.delete').click(function(){
|
// $('.delete').click(function(){
|
||||||
|
|||||||
@@ -9,12 +9,37 @@
|
|||||||
//= require bootstrap-notify/bootstrap-notify.js
|
//= require bootstrap-notify/bootstrap-notify.js
|
||||||
//= require node-waves/waves.js
|
//= require node-waves/waves.js
|
||||||
//= require sweetalert/sweetalert.min.js
|
//= require sweetalert/sweetalert.min.js
|
||||||
|
//= require fileinput.min
|
||||||
//= require cable
|
//= require cable
|
||||||
//= require turbolinks
|
//= require turbolinks
|
||||||
//= require BSBMaterial/turbolink_admin.js
|
//= require BSBMaterial/turbolink_admin.js
|
||||||
//= require BSBMaterial/demo.js
|
//= require BSBMaterial/demo.js
|
||||||
//= require custom.js
|
//= require custom.js
|
||||||
|
|
||||||
|
|
||||||
|
$(document).on('turbolinks:load', function() {
|
||||||
|
|
||||||
|
$("#customer_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('turbolinks:load', function() {
|
$(document).on('turbolinks:load', function() {
|
||||||
$('.datetimepicker').bootstrapMaterialDatePicker({
|
$('.datetimepicker').bootstrapMaterialDatePicker({
|
||||||
format: 'DD-MM-YYYY - HH:mm',
|
format: 'DD-MM-YYYY - HH:mm',
|
||||||
@@ -224,7 +249,7 @@ function setCommPorts(comPortLists) {
|
|||||||
closeOnCancel: false,
|
closeOnCancel: false,
|
||||||
allowOutsideClick: false
|
allowOutsideClick: false
|
||||||
}, function () {
|
}, function () {
|
||||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/others_payment";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,7 +323,7 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun
|
|||||||
if(jobj.STATUS == "Approved"){
|
if(jobj.STATUS == "Approved"){
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "/origami/payment/"+payment_type,
|
url: "/origami/payment/"+payment_type,
|
||||||
data: "amount="+ bnk_bill_amount + "&sale_id="+ sale_id,
|
data: "amount="+ bnk_bill_amount + "&sale_id="+ sale_id + "&ref_no=" + jobj.REFNUM,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
if(result){
|
if(result){
|
||||||
swal({
|
swal({
|
||||||
@@ -317,6 +342,8 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun
|
|||||||
}else{
|
}else{
|
||||||
if(payment_type!="master"){
|
if(payment_type!="master"){
|
||||||
payment_type = payment_type.toUpperCase();
|
payment_type = payment_type.toUpperCase();
|
||||||
|
}else{
|
||||||
|
payment_type = "Master";
|
||||||
}
|
}
|
||||||
swal({
|
swal({
|
||||||
title: 'Oops',
|
title: 'Oops',
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
@import "BSBMaterial/style";
|
@import "BSBMaterial/style";
|
||||||
@import "BSBMaterial/themes/all-themes";
|
@import "BSBMaterial/themes/all-themes";
|
||||||
@import "reset";
|
@import "reset";
|
||||||
|
@import "fileinput.min";
|
||||||
|
|
||||||
.sx-margin-0 {
|
.sx-margin-0 {
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
|
|||||||
@@ -8,6 +8,11 @@
|
|||||||
background-color: #2790a5;
|
background-color: #2790a5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.active_tab{
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #2790a5;
|
||||||
|
}
|
||||||
|
|
||||||
.login-page {
|
.login-page {
|
||||||
margin: 0% auto;
|
margin: 0% auto;
|
||||||
background-color: #2790a5;
|
background-color: #2790a5;
|
||||||
@@ -75,3 +80,13 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-card{
|
||||||
|
margin: 20px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-name{
|
||||||
|
padding-bottom: 20px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -198,6 +198,18 @@ select.form-control {
|
|||||||
background-color: blue !important;
|
background-color: blue !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selected-payment {
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: blue !important;
|
||||||
|
}
|
||||||
|
.payment_btn {
|
||||||
|
white-space: normal !important;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
margin-right: 15px;
|
||||||
|
color:#fff !important;
|
||||||
|
# background-color: green !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reciept Style */
|
/* Reciept Style */
|
||||||
#order-charges-table td {
|
#order-charges-table td {
|
||||||
border-top: none !important;
|
border-top: none !important;
|
||||||
@@ -314,7 +326,7 @@ tr.discount-item-row:hover {
|
|||||||
position: relative;
|
position: relative;
|
||||||
left: 42%;
|
left: 42%;
|
||||||
top: 30%;
|
top: 30%;
|
||||||
background-color: #d9534f;
|
background-color: #32ad1a;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
@@ -396,3 +408,27 @@ i.logout_icon{
|
|||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: #5DADE2 !important;
|
background-color: #5DADE2 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Start Is Member Modal */
|
||||||
|
#is_memberModal .modal-body {
|
||||||
|
height: 260px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#is_memberModal .btn {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
/* End Is Member Modal */
|
||||||
|
|
||||||
|
/* Start iframe */
|
||||||
|
iframe {
|
||||||
|
border: none;
|
||||||
|
overflow: hidden !important;
|
||||||
|
width: 400px;
|
||||||
|
height: 550px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pdfModal .btn {
|
||||||
|
width: 150%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
/* End iframe */
|
||||||
@@ -67,7 +67,8 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
#end extra time
|
#end extra time
|
||||||
|
puts params[:order_items]
|
||||||
|
puts "ORDER ITEMS"
|
||||||
# begin
|
# begin
|
||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@@ -171,9 +172,9 @@ class Api::OrdersController < Api::ApiController
|
|||||||
# Update customer info, Guest Info
|
# Update customer info, Guest Info
|
||||||
# Input Params
|
# Input Params
|
||||||
# order_id , order_items {[item_code, item_instance_code , qty, option, variants]}
|
# order_id , order_items {[item_code, item_instance_code , qty, option, variants]}
|
||||||
def update
|
# def update
|
||||||
|
|
||||||
end
|
# end
|
||||||
|
|
||||||
def order_params
|
def order_params
|
||||||
params.permits(:order_source, :booking_id,:order_type,
|
params.permits(:order_source, :booking_id,:order_type,
|
||||||
@@ -198,4 +199,59 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
Rails.logger.debug "Booking ID - " + params[:booking_id].to_s
|
||||||
|
if checkin_checkout_time(params[:booking_id])
|
||||||
|
Rails.logger.debug "Order Item ID - " + params[:order_item_id].to_s
|
||||||
|
|
||||||
|
order_items_id = params[:order_item_id]
|
||||||
|
qty_weight = params[:quantity].to_f
|
||||||
|
remarks = params[:remark]
|
||||||
|
|
||||||
|
order_item = OrderItem.find(order_items_id)
|
||||||
|
before_updated_qty = order_item.qty
|
||||||
|
|
||||||
|
order_item.item_order_by = current_login_employee.name
|
||||||
|
order_item.qty = qty_weight
|
||||||
|
order_item.remark = remarks
|
||||||
|
order_item.save
|
||||||
|
|
||||||
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
|
# print
|
||||||
|
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||||
|
# order queue stations
|
||||||
|
oqs = assigned_item.order_queue_station
|
||||||
|
|
||||||
|
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||||
|
|
||||||
|
unique_code="OrderItemPdf"
|
||||||
|
if !order_slim_pdf.empty?
|
||||||
|
order_slim_pdf.each do |order_item_slim|
|
||||||
|
if order_item_slim[0] == 'OrderSlimPdf'
|
||||||
|
if order_item_slim[1] == '1'
|
||||||
|
unique_code="OrderItemSlimPdf"
|
||||||
|
else
|
||||||
|
unique_code="OrderItemPdf"
|
||||||
|
end
|
||||||
|
elsif order_item_slim[0] == 'OrderSetPdf'
|
||||||
|
if order_item_slim[1] == '1'
|
||||||
|
unique_code="OrderSetItemPdf"
|
||||||
|
else
|
||||||
|
unique_code="OrderItemPdf"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
|
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
|
||||||
|
end
|
||||||
|
|
||||||
|
return return_json_status_with_code(200, "updated successfully!")
|
||||||
|
else
|
||||||
|
return return_json_status_with_code(406, "Checkout time is over!")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -84,6 +84,17 @@ class Api::PaymentsController < ActionController::API
|
|||||||
sale_payment.payment_reference = params[:payment_reference]
|
sale_payment.payment_reference = params[:payment_reference]
|
||||||
#TODO: implement paypar implementation
|
#TODO: implement paypar implementation
|
||||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||||
|
when "JunctionPay"
|
||||||
|
sale_payment.payment_method = "JunctionPay"
|
||||||
|
sale_payment.received_amount = params[:amount]
|
||||||
|
sale_payment.customer_id = params[:customer_id]
|
||||||
|
sale_payment.payment_reference = params[:vochure_no]
|
||||||
|
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||||
|
when "alipay"
|
||||||
|
sale_payment.payment_method = "alipay"
|
||||||
|
sale_payment.received_amount = params[:amount]
|
||||||
|
sale_payment.payment_reference = params[:payment_reference]
|
||||||
|
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,4 +2,11 @@ class BaseController < ActionController::Base
|
|||||||
layout "installation"
|
layout "installation"
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,11 +2,36 @@ class BaseCrmController < ActionController::Base
|
|||||||
include LoginVerification
|
include LoginVerification
|
||||||
layout "CRM"
|
layout "CRM"
|
||||||
|
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
flash[:warning] = exception.message
|
flash[:warning] = exception.message
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#change locallization
|
||||||
|
def set_locale
|
||||||
|
I18n.locale = params[:locale] || I18n.default_locale
|
||||||
|
end
|
||||||
|
|
||||||
|
# RESTful url for localize
|
||||||
|
def default_url_options
|
||||||
|
{ locale: I18n.locale }
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,11 +2,26 @@ class BaseInventoryController < ActionController::Base
|
|||||||
include LoginVerification
|
include LoginVerification
|
||||||
layout "inventory"
|
layout "inventory"
|
||||||
|
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
flash[:warning] = exception.message
|
flash[:warning] = exception.message
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,11 +2,36 @@ class BaseOqsController < ActionController::Base
|
|||||||
include LoginVerification
|
include LoginVerification
|
||||||
layout "OQS"
|
layout "OQS"
|
||||||
|
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
flash[:warning] = exception.message
|
flash[:warning] = exception.message
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#change locallization
|
||||||
|
def set_locale
|
||||||
|
I18n.locale = params[:locale] || I18n.default_locale
|
||||||
|
end
|
||||||
|
|
||||||
|
# RESTful url for localize
|
||||||
|
def default_url_options
|
||||||
|
{ locale: I18n.locale }
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,19 +2,22 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
include LoginVerification
|
include LoginVerification
|
||||||
layout "origami"
|
layout "origami"
|
||||||
|
|
||||||
# before_action :checkin_process
|
before_action :check_user
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
flash[:warning] = exception.message
|
flash[:warning] = exception.message
|
||||||
# redirect_to origami_root_path
|
# redirect_to origami_root_path
|
||||||
redirect_to origami_dashboard_path
|
redirect_to origami_dashboard_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_user
|
def check_user
|
||||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# def checkin_process
|
# def checkin_process
|
||||||
@@ -25,4 +28,10 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
def get_cashier
|
def get_cashier
|
||||||
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ class BaseReportController < ActionController::Base
|
|||||||
include LoginVerification
|
include LoginVerification
|
||||||
layout "application"
|
layout "application"
|
||||||
|
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
flash[:warning] = exception.message
|
flash[:warning] = exception.message
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
@@ -80,4 +84,15 @@ class BaseReportController < ActionController::Base
|
|||||||
|
|
||||||
return from, to
|
return from, to
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,21 @@ class BaseWaiterController < ActionController::Base
|
|||||||
include LoginVerification
|
include LoginVerification
|
||||||
layout "waiter"
|
layout "waiter"
|
||||||
|
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ module LoginVerification
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_unauthorized()
|
def render_unauthorized
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,4 @@ class Crm::BookingsController < BaseCrmController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
:body => member_params,
|
:body => member_params,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json; version=2'
|
'Accept' => 'application/json; version=3'
|
||||||
},
|
},
|
||||||
:timeout => 10
|
:timeout => 10
|
||||||
)
|
)
|
||||||
@@ -269,7 +269,7 @@ end
|
|||||||
:body => member_params,
|
:body => member_params,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json; version=2'
|
'Accept' => 'application/json; version=3'
|
||||||
},
|
},
|
||||||
:timeout => 10
|
:timeout => 10
|
||||||
)
|
)
|
||||||
@@ -328,7 +328,7 @@ end
|
|||||||
:body => member_params,
|
:body => member_params,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json; version=2'
|
'Accept' => 'application/json; version=3'
|
||||||
},
|
},
|
||||||
:timeout => 10
|
:timeout => 10
|
||||||
)
|
)
|
||||||
@@ -396,12 +396,7 @@ end
|
|||||||
def customer_params
|
def customer_params
|
||||||
|
|
||||||
params.require(:customer).permit(:id, :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, :customer_type)
|
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -143,9 +143,4 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
params.require(:dining_queue).permit(:customer_id, :name, :contact_no, :queue_no,:status,:seater,:remark)
|
params.require(:dining_queue).permit(:customer_id, :name, :contact_no, :queue_no,:status,:seater,:remark)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -56,10 +56,5 @@ class Crm::HomeController < BaseCrmController
|
|||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
# layout "application", except: [:index, :show]
|
# layout "application", except: [:index, :show]
|
||||||
# skip_before_action only: [:index, :show, :create, :update, :destroy]
|
# skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||||
|
|
||||||
|
before_action :check_user, only: :dashboard
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
|
# Special check for only dashboard
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_user
|
||||||
|
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||||
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
||||||
@@ -65,63 +80,78 @@ class HomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def dashboard
|
def dashboard
|
||||||
@from, @to = get_date_range_from_params
|
@from, @to, @from_time, @to_time = get_date_range_from_params
|
||||||
|
|
||||||
@shop = Shop.first
|
@shop = Shop.first
|
||||||
|
|
||||||
today = DateTime.now.strftime('%Y-%m-%d')
|
today = DateTime.now.strftime('%Y-%m-%d')
|
||||||
|
if !@from.nil? && !@to.nil?
|
||||||
|
if !@from_time.nil? && @to_time.nil?
|
||||||
|
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count()
|
||||||
|
else
|
||||||
|
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count()
|
||||||
|
end
|
||||||
|
else
|
||||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||||
|
end
|
||||||
|
if !@from.nil? && !@to.nil?
|
||||||
|
if !@from_time.nil? && @to_time.nil?
|
||||||
|
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count()
|
||||||
|
else
|
||||||
|
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count()
|
||||||
|
end
|
||||||
|
else
|
||||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||||
|
end
|
||||||
@top_products = Sale.top_products(today,@from,@to).sum('i.qty')
|
@top_products = Sale.top_products(today,current_user,@from,@to,@from_time,@to_time).sum('i.qty')
|
||||||
@bottom_products = Sale.bottom_products(today,@from,@to).sum('i.qty')
|
@bottom_products = Sale.bottom_products(today,current_user,@from,@to,@from_time,@to_time).sum('i.qty')
|
||||||
@hourly_sales = Sale.hourly_sales(today,@from,@to).sum(:grand_total)
|
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time).sum(:grand_total)
|
||||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||||
# .sum(:grand_total)
|
# .sum(:grand_total)
|
||||||
@employee_sales = Sale.employee_sales(today,@from,@to)
|
@employee_sales = Sale.employee_sales(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
.sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
|
.sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
|
||||||
@inventories = StockJournal.inventory_balances(today,@from,@to).sum(:balance)
|
@inventories = StockJournal.inventory_balances(today,@from,@to,@from_time,@to_time).sum(:balance)
|
||||||
|
|
||||||
@total_sale = Sale.total_sale(today,current_user,@from,@to)
|
@total_sale = Sale.total_sale(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_count = Sale.total_count(today,current_user,@from,@to)
|
@total_count = Sale.total_count(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_card = Sale.total_card_sale(today,current_user,@from,@to)
|
@total_card = Sale.total_card_sale(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_credit = Sale.credit_payment(today,current_user,@from,@to)
|
@total_credit = Sale.credit_payment(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
|
|
||||||
@sale_data = Array.new
|
@sale_data = Array.new
|
||||||
@total_payment_methods = Sale.total_payment_methods(today,current_user,@from,@to)
|
@total_payment_methods = Sale.total_payment_methods(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
|
|
||||||
if !@total_payment_methods.nil?
|
if !@total_payment_methods.nil?
|
||||||
@total_payment_methods.each do |payment|
|
@total_payment_methods.each do |payment|
|
||||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" || payment.payment_method == "unionpay"
|
||||||
pay = Sale.payment_sale('card', today, current_user,@from,@to)
|
pay = Sale.payment_sale('card', today, current_user,@from,@to,@from_time,@to_time)
|
||||||
@sale_data.push({'card' => pay.payment_amount})
|
@sale_data.push({'card' => pay.payment_amount})
|
||||||
else
|
else
|
||||||
pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to)
|
pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to,@from_time,@to_time)
|
||||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to)
|
@summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_customer = Sale.total_customer(today,current_user,@from,@to)
|
@total_customer = Sale.total_customer(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_dinein = Sale.total_dinein(today,current_user,@from,@to)
|
@total_dinein = Sale.total_dinein(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_takeaway = Sale.total_takeaway(today,current_user,@from,@to)
|
@total_takeaway = Sale.total_takeaway(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_other_customer = Sale.total_other_customer(today,current_user,@from,@to)
|
@total_other_customer = Sale.total_other_customer(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_membership = Sale.total_membership(today,current_user,@from,@to)
|
@total_membership = Sale.total_membership(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
|
|
||||||
@total_order = Sale.total_order(today,current_user,@from,@to)
|
@total_order = Sale.total_order(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_accounts = Sale.total_account(today,current_user,@from,@to)
|
@total_accounts = Sale.total_account(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@account_data = Array.new
|
@account_data = Array.new
|
||||||
if !@total_accounts.nil?
|
if !@total_accounts.nil?
|
||||||
@total_accounts.each do |account|
|
@total_accounts.each do |account|
|
||||||
acc = Sale.account_data(account.account_id, today,current_user,@from,@to)
|
acc = Sale.account_data(account.account_id, today,current_user,@from,@to,@from_time,@to_time)
|
||||||
if !acc.nil?
|
if !acc.nil?
|
||||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@top_items = Sale.top_items(today,current_user,@from,@to)
|
@top_items = Sale.top_items(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
@total_foc_items = Sale.total_foc_items(today,current_user,@from,@to)
|
@total_foc_items = Sale.total_foc_items(today,current_user,@from,@to,@from_time,@to_time)
|
||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
@print_settings = PrintSetting.get_precision_delimiter()
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
@@ -135,12 +165,6 @@ class HomeController < ApplicationController
|
|||||||
render :json => {:status=> "Success", :url => root_path }.to_json
|
render :json => {:status=> "Success", :url => root_path }.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# 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.
|
||||||
@@ -182,16 +206,26 @@ class HomeController < ApplicationController
|
|||||||
def get_date_range_from_params
|
def get_date_range_from_params
|
||||||
from = params[:from]
|
from = params[:from]
|
||||||
to = params[:to]
|
to = params[:to]
|
||||||
|
from_time = params[:from_time]
|
||||||
|
to_time = params[:to_time]
|
||||||
|
|
||||||
if from.present? && to.present?
|
if from.present? && to.present?
|
||||||
f_date = DateTime.parse(from)
|
# f_date = DateTime.parse(from)
|
||||||
t_date = DateTime.parse(to)
|
# t_date = DateTime.parse(to)
|
||||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
# f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
# t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||||
from = f_time.beginning_of_day.utc.getlocal
|
# from = f_time.beginning_of_day.utc.getlocal
|
||||||
to = t_time.end_of_day.utc.getlocal
|
# to = t_time.end_of_day.utc.getlocal
|
||||||
|
|
||||||
|
from = DateTime.parse(from).utc.getlocal.strftime('%Y-%m-%d')
|
||||||
|
to = DateTime.parse(to).utc.getlocal.strftime('%Y-%m-%d')
|
||||||
end
|
end
|
||||||
|
|
||||||
return from, to
|
return from, to, from_time, to_time
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ class InstallController < BaseController
|
|||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
||||||
# before_action :check_license
|
# before_action :check_license
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -75,4 +77,9 @@ class InstallController < BaseController
|
|||||||
# return nil
|
# return nil
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,12 +30,6 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
@queue_stations_items
|
@queue_stations_items
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get Order items
|
# Get Order items
|
||||||
def get_order_items
|
def get_order_items
|
||||||
items = []
|
items = []
|
||||||
@@ -129,9 +123,4 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
6
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
6
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
@@ -3,9 +3,15 @@ class Oqs::EditController < BaseOqsController
|
|||||||
assigned_item_id = params[:id]
|
assigned_item_id = params[:id]
|
||||||
@link_type = params[:type]
|
@link_type = params[:type]
|
||||||
@dining_type = nil
|
@dining_type = nil
|
||||||
|
@booking = nil
|
||||||
if params[:type] == 'oqs'
|
if params[:type] == 'oqs'
|
||||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")
|
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")
|
||||||
|
elsif params[:type] == "pending"
|
||||||
|
assigned_item = OrderItem.find(assigned_item_id)
|
||||||
|
@booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id")
|
||||||
|
.where("bko.order_id = '#{assigned_item.order_id}'").first()
|
||||||
|
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.item_instance_code }'")
|
||||||
else
|
else
|
||||||
assigned_item = OrderItem.find(assigned_item_id)
|
assigned_item = OrderItem.find(assigned_item_id)
|
||||||
dining = DiningFacility.find_by_id(params[:type])
|
dining = DiningFacility.find_by_id(params[:type])
|
||||||
|
|||||||
@@ -244,10 +244,4 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
.group("order_queue_stations.id")
|
.group("order_queue_stations.id")
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -102,9 +102,4 @@ class Oqs::PrintController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -94,20 +94,20 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
extra_time = Time.at(time)
|
extra_time = Time.at(time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if i["parent_order_item_id"]
|
if i["parent_order_item_id"];
|
||||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
|
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])}
|
||||||
else
|
else
|
||||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])}
|
||||||
end
|
end
|
||||||
items_arr.push(items)
|
items_arr.push(items)
|
||||||
}
|
}
|
||||||
|
|
||||||
# begin
|
# begin
|
||||||
if params[:order_source] == "quick_service"
|
# if params[:order_source] == "quick_service"
|
||||||
customer_id = "CUS-000000000002" # for no customer id from mobile
|
# customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||||
else
|
# else
|
||||||
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
end
|
# end
|
||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@order.order_type = params[:order_type]
|
@order.order_type = params[:order_type]
|
||||||
@@ -226,9 +226,4 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
# @dining = DiningFacility.find(params[:id])
|
# @dining = DiningFacility.find(params[:id])
|
||||||
# end
|
# end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
77
app/controllers/origami/alipay_controller.rb
Normal file
77
app/controllers/origami/alipay_controller.rb
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
class Origami::AlipayController < BaseOrigamiController
|
||||||
|
def index
|
||||||
|
@sale_id = params[:sale_id]
|
||||||
|
@cashier_type = params[:type]
|
||||||
|
# limit alipay_amount
|
||||||
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
total = 0
|
||||||
|
@alipaycount = 0
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@rounding_adj = 0
|
||||||
|
@can_alipay = 0
|
||||||
|
@member_discount = 0
|
||||||
|
@sub_total = 0
|
||||||
|
@membership_id = nil
|
||||||
|
@receipt_no = nil
|
||||||
|
if !sale_data.nil?
|
||||||
|
total = sale_data.grand_total
|
||||||
|
|
||||||
|
others = 0
|
||||||
|
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
|
if sale_payment.payment_method == "alipay"
|
||||||
|
@alipaycount = @alipaycount + sale_payment.payment_amount
|
||||||
|
else
|
||||||
|
others = others + sale_payment.payment_amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@can_alipay = total - @alipaycount - others
|
||||||
|
|
||||||
|
@member_discount = MembershipSetting.find_by_discount(1)
|
||||||
|
@sub_total = sale_data.total_amount
|
||||||
|
@membership_id = sale_data.customer.membership_id
|
||||||
|
#for bank integration
|
||||||
|
@receipt_no = sale_data.receipt_no
|
||||||
|
end
|
||||||
|
|
||||||
|
bank_integration = Lookup.collection_of('bank_integration')
|
||||||
|
@bank_integration = 0
|
||||||
|
if !bank_integration[0].nil?
|
||||||
|
@bank_integration = bank_integration[0][1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
cash = params[:amount]
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
ref_no = params[:ref_no]
|
||||||
|
if(Sale.exists?(sale_id))
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
|
# rounding adjustment
|
||||||
|
# if shop_details.is_rounding_adj
|
||||||
|
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
|
# rounding_adj = new_total-saleObj.grand_total
|
||||||
|
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# saleObj = Sale.find(sale_id)
|
||||||
|
sale_payment = SalePayment.new
|
||||||
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "alipay",ref_no)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
helper_method :shop_detail
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -96,9 +96,4 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
|
|||||||
render json: response
|
render json: response
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,9 +24,4 @@ class Origami::CardPaymentsController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,9 +15,4 @@ class Origami::CashInsController < BaseOrigamiController
|
|||||||
shift.save
|
shift.save
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,9 +8,4 @@ class Origami::CashMgmtController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,9 +13,4 @@ class Origami::CashOutsController < BaseOrigamiController
|
|||||||
shift.save
|
shift.save
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,9 +36,4 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -47,10 +47,4 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -101,7 +101,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)
|
customer = Customer.find(customer_id)
|
||||||
|
order_source = params[:type]
|
||||||
# Check and find with card no
|
# Check and find with card no
|
||||||
# if(!customer_id.include? "CUS")
|
# if(!customer_id.include? "CUS")
|
||||||
# customer = Customer.find_by_paypar_account_no(customer_id)
|
# customer = Customer.find_by_paypar_account_no(customer_id)
|
||||||
@@ -135,16 +135,11 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
if status == true
|
if status == true
|
||||||
render json: JSON.generate({:status => true})
|
render json: JSON.generate({:status => true})
|
||||||
if(id == "SAL")
|
if(id == "SAL")
|
||||||
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount)
|
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount, nil, order_source)
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -58,8 +58,4 @@ class Origami::DashboardController < BaseOrigamiController
|
|||||||
@current_user = current_user
|
@current_user = current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
|
|
||||||
#discount page show from origami index with selected order
|
#discount page show from origami index with selected order
|
||||||
def create
|
def create
|
||||||
|
order_source = params[:cashier_type]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
discount_items = JSON.parse(params[:discount_items])
|
discount_items = JSON.parse(params[:discount_items])
|
||||||
overall_discount = params[:overall_discount]
|
overall_discount = params[:overall_discount]
|
||||||
sub_total = params[:sub_total]
|
sub_total = params[:sub_total]
|
||||||
|
|
||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
if sale.bookings[0].dining_facility_id.to_i > 0
|
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||||
@@ -82,7 +84,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
|
|
||||||
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"OVERALLDISCOUNT" )
|
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"OVERALLDISCOUNT" )
|
||||||
end
|
end
|
||||||
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
|
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f, nil,order_source)
|
||||||
if !table.nil?
|
if !table.nil?
|
||||||
result = {:status=> "Success", :table_id => table_id, :table_type => table.type }
|
result = {:status=> "Success", :table_id => table_id, :table_type => table.type }
|
||||||
else
|
else
|
||||||
@@ -102,6 +104,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
|
|
||||||
# Remove selected discount Items
|
# Remove selected discount Items
|
||||||
def remove_discount_items
|
def remove_discount_items
|
||||||
|
order_source = params[:cashier_type]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
discount_items = JSON.parse(params[:discount_items])
|
discount_items = JSON.parse(params[:discount_items])
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
@@ -136,7 +139,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
# sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
# sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||||
# sale.save
|
# sale.save
|
||||||
# Re-calc All Amount in Sale
|
# Re-calc All Amount in Sale
|
||||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
|
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount, nil, order_source)
|
||||||
if table.nil?
|
if table.nil?
|
||||||
result = {:status=> "Success"}
|
result = {:status=> "Success"}
|
||||||
else
|
else
|
||||||
@@ -158,6 +161,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
# Remove all discount Items
|
# Remove all discount Items
|
||||||
def remove_all_discount
|
def remove_all_discount
|
||||||
sale_id = params[:id]
|
sale_id = params[:id]
|
||||||
|
order_source = params[:type]
|
||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
@@ -197,7 +201,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" )
|
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" )
|
||||||
|
|
||||||
# Re-calc All Amount in Sale
|
# Re-calc All Amount in Sale
|
||||||
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
|
sale.compute_by_sale_items(sale_id, sale.sale_items, 0, nil, order_source)
|
||||||
if table.nil?
|
if table.nil?
|
||||||
result = {:status=> "Success"}
|
result = {:status=> "Success"}
|
||||||
else
|
else
|
||||||
@@ -218,7 +222,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
|
|
||||||
# Member Discount
|
# Member Discount
|
||||||
def member_discount
|
def member_discount
|
||||||
|
order_source = params[:cashier_type]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
is_card = params[:is_card]
|
is_card = params[:is_card]
|
||||||
sub_total = params[:sub_total]
|
sub_total = params[:sub_total]
|
||||||
@@ -273,7 +277,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
auth_token:auth_token}.to_json,
|
auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json; version=2'
|
'Accept' => 'application/json; version=3'
|
||||||
}, :timeout => 10)
|
}, :timeout => 10)
|
||||||
rescue HTTParty::Error
|
rescue HTTParty::Error
|
||||||
response = {"status": false, "message": "Can't open membership server " }
|
response = {"status": false, "message": "Can't open membership server " }
|
||||||
@@ -297,7 +301,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
if response["discount_bonus_earned"]
|
if response["discount_bonus_earned"]
|
||||||
discount_amount = discount_amount + response["discount_bonus_earned"]
|
discount_amount = discount_amount + response["discount_bonus_earned"]
|
||||||
end
|
end
|
||||||
sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount')
|
sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount', order_source)
|
||||||
result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id,:table_type => table_type }
|
result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id,:table_type => table_type }
|
||||||
elsif response["status"] == "500"
|
elsif response["status"] == "500"
|
||||||
result = {:status=> response["error"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
|
result = {:status=> response["error"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
|
||||||
@@ -355,9 +359,5 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
|
|
||||||
# redirect_to origami_path(sale_id)
|
# redirect_to origami_path(sale_id)
|
||||||
# end
|
# end
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -74,16 +74,6 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@date = order.created_at
|
@date = order.created_at
|
||||||
@booking= booking
|
@booking= booking
|
||||||
order.order_items.each do |item|
|
order.order_items.each do |item|
|
||||||
if !item.set_menu_items.nil?
|
|
||||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
|
||||||
arr_instance_item_sets = Array.new
|
|
||||||
instance_item_sets.each do |instance_item|
|
|
||||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
|
||||||
arr_instance_item_sets.push(item_instance_name)
|
|
||||||
item.price = item.price.to_f + instance_item["price"].to_f
|
|
||||||
end
|
|
||||||
item.set_menu_items = arr_instance_item_sets
|
|
||||||
end
|
|
||||||
@order_items.push(item)
|
@order_items.push(item)
|
||||||
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||||
# if !assigned_order_items.nil?
|
# if !assigned_order_items.nil?
|
||||||
@@ -105,7 +95,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@status_order = 'order'
|
@status_order = 'order'
|
||||||
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' && sale.sale_status != 'spoile' && sale.sale_status != 'waste'
|
||||||
@sale_array.push(sale)
|
@sale_array.push(sale)
|
||||||
if @status_order == 'order'
|
if @status_order == 'order'
|
||||||
@status_order = 'sale'
|
@status_order = 'sale'
|
||||||
@@ -136,12 +126,6 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_dining
|
def set_dining
|
||||||
|
|||||||
@@ -81,9 +81,4 @@ class Origami::HomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -169,9 +169,4 @@ class Origami::InDutiesController < BaseOrigamiController
|
|||||||
params.require(:in_duty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time)
|
params.require(:in_duty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
18
app/controllers/origami/jcb_controller.rb
Executable file → Normal file
18
app/controllers/origami/jcb_controller.rb
Executable file → Normal file
@@ -5,11 +5,20 @@ class Origami::JcbController < BaseOrigamiController
|
|||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
# limit jcb_amount
|
# limit jcb_amount
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
total = sale_data.grand_total
|
total = 0
|
||||||
@jcbcount = 0
|
@jcbcount = 0
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@rounding_adj = 0
|
||||||
|
@can_jcb = 0
|
||||||
|
@member_discount= 0
|
||||||
|
@sub_total = 0
|
||||||
|
@membership_id = nil
|
||||||
|
@receipt_no = nil
|
||||||
|
if !sale_data.nil?
|
||||||
|
total = sale_data.grand_total
|
||||||
|
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
else
|
else
|
||||||
@@ -31,6 +40,8 @@ class Origami::JcbController < BaseOrigamiController
|
|||||||
@membership_id = sale_data.customer.membership_id
|
@membership_id = sale_data.customer.membership_id
|
||||||
#for bank integration
|
#for bank integration
|
||||||
@receipt_no = sale_data.receipt_no
|
@receipt_no = sale_data.receipt_no
|
||||||
|
end
|
||||||
|
|
||||||
bank_integration = Lookup.collection_of('bank_integration')
|
bank_integration = Lookup.collection_of('bank_integration')
|
||||||
@bank_integration = 0
|
@bank_integration = 0
|
||||||
if !bank_integration[0].nil?
|
if !bank_integration[0].nil?
|
||||||
@@ -41,6 +52,7 @@ class Origami::JcbController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
cash = params[:amount]
|
cash = params[:amount]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
ref_no = params[:ref_no]
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
@@ -54,7 +66,7 @@ class Origami::JcbController < BaseOrigamiController
|
|||||||
|
|
||||||
# saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb",ref_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
70
app/controllers/origami/junction_pay_controller.rb
Normal file
70
app/controllers/origami/junction_pay_controller.rb
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
class Origami::JunctionPayController < BaseOrigamiController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@sale_id = params[:sale_id]
|
||||||
|
@cashier_type = params[:type]
|
||||||
|
# limit jcb_amount
|
||||||
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
total = sale_data.grand_total
|
||||||
|
@junction_pay_count = 0
|
||||||
|
others = 0
|
||||||
|
@cashier_id = current_user.emp_id
|
||||||
|
|
||||||
|
@payment_method_setting_nav = PaymentMethodSetting.all
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
|
if sale_payment.payment_method == "JunctionPay"
|
||||||
|
@junction_pay_count = @junction_pay_count + sale_payment.payment_amount
|
||||||
|
else
|
||||||
|
others = others + sale_payment.payment_amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@can_junction_pay = total - @junction_pay_count - others
|
||||||
|
|
||||||
|
@member_discount = MembershipSetting.find_by_discount(1)
|
||||||
|
@sub_total = sale_data.total_amount
|
||||||
|
@membership_id = sale_data.customer.membership_id
|
||||||
|
#for bank integration
|
||||||
|
@receipt_no = sale_data.receipt_no
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
gift_amount = params[:gift_amount]
|
||||||
|
voucher_amount = params[:voucher_amount]
|
||||||
|
voucher_no = params[:voucher_no]
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
|
||||||
|
# Gift card or Voucher classified and add for payment_reference
|
||||||
|
remarks = ''
|
||||||
|
cash = (gift_amount.to_f + voucher_amount.to_f)
|
||||||
|
if gift_amount.to_f > 0
|
||||||
|
remarks = "Junciton Gift Card Payment. RefNo-" + voucher_no
|
||||||
|
else
|
||||||
|
remarks = "Junciton Voucher Payment. RefNo-" + voucher_no
|
||||||
|
end
|
||||||
|
|
||||||
|
if(Sale.exists?(sale_id))
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
|
# rounding adjustment
|
||||||
|
# if shop_details.is_rounding_adj
|
||||||
|
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
|
# rounding_adj = new_total-saleObj.grand_total
|
||||||
|
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# saleObj = Sale.find(sale_id)
|
||||||
|
sale_payment = SalePayment.new
|
||||||
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "JunctionPay", remarks)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
17
app/controllers/origami/master_controller.rb
Executable file → Normal file
17
app/controllers/origami/master_controller.rb
Executable file → Normal file
@@ -5,11 +5,20 @@ class Origami::MasterController < BaseOrigamiController
|
|||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
# limit master_amount
|
# limit master_amount
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
total = sale_data.grand_total
|
total = 0
|
||||||
@mastercount = 0
|
@mastercount = 0
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@rounding_adj = 0
|
||||||
|
@can_master = 0
|
||||||
|
@member_discount = 0
|
||||||
|
@sub_total = 0
|
||||||
|
@membership_id = nil
|
||||||
|
@receipt_no = nil
|
||||||
|
if !sale_data.nil?
|
||||||
|
total = sale_data.grand_total
|
||||||
|
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
else
|
else
|
||||||
@@ -30,6 +39,7 @@ class Origami::MasterController < BaseOrigamiController
|
|||||||
@membership_id = sale_data.customer.membership_id
|
@membership_id = sale_data.customer.membership_id
|
||||||
#for bank integration
|
#for bank integration
|
||||||
@receipt_no = sale_data.receipt_no
|
@receipt_no = sale_data.receipt_no
|
||||||
|
end
|
||||||
bank_integration = Lookup.collection_of('bank_integration')
|
bank_integration = Lookup.collection_of('bank_integration')
|
||||||
@bank_integration = 0
|
@bank_integration = 0
|
||||||
if !bank_integration[0].nil?
|
if !bank_integration[0].nil?
|
||||||
@@ -40,6 +50,7 @@ class Origami::MasterController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
cash = params[:amount]
|
cash = params[:amount]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
ref_no = params[:ref_no]
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
@@ -53,7 +64,7 @@ class Origami::MasterController < BaseOrigamiController
|
|||||||
|
|
||||||
# saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master",ref_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,4 @@ class Origami::MoveroomController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -71,9 +71,4 @@ class Origami::MovetableController < BaseOrigamiController
|
|||||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
18
app/controllers/origami/mpu_controller.rb
Executable file → Normal file
18
app/controllers/origami/mpu_controller.rb
Executable file → Normal file
@@ -4,11 +4,20 @@ class Origami::MpuController < BaseOrigamiController
|
|||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
# limit mpu_amount
|
# limit mpu_amount
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
total = sale_data.grand_total
|
total = 0
|
||||||
@mpucount = 0
|
@mpucount = 0
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@rounding_adj = 0
|
||||||
|
@can_mpu = 0
|
||||||
|
@member_discount = 0
|
||||||
|
@sub_total = 0
|
||||||
|
@membership_id = nil
|
||||||
|
@receipt_no = nil
|
||||||
|
if !sale_data.nil?
|
||||||
|
total = sale_data.grand_total
|
||||||
|
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
else
|
else
|
||||||
@@ -30,6 +39,8 @@ class Origami::MpuController < BaseOrigamiController
|
|||||||
@membership_id = sale_data.customer.membership_id
|
@membership_id = sale_data.customer.membership_id
|
||||||
#for bank integration
|
#for bank integration
|
||||||
@receipt_no = sale_data.receipt_no
|
@receipt_no = sale_data.receipt_no
|
||||||
|
end
|
||||||
|
|
||||||
bank_integration = Lookup.collection_of('bank_integration')
|
bank_integration = Lookup.collection_of('bank_integration')
|
||||||
@bank_integration = 0
|
@bank_integration = 0
|
||||||
if !bank_integration[0].nil?
|
if !bank_integration[0].nil?
|
||||||
@@ -40,6 +51,7 @@ class Origami::MpuController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
cash = params[:amount]
|
cash = params[:amount]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
ref_no = params[:ref_no]
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
@@ -53,7 +65,7 @@ class Origami::MpuController < BaseOrigamiController
|
|||||||
|
|
||||||
# saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "alipay",ref_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -81,9 +81,4 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
|||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
other_charges_items = JSON.parse(params[:other_charges_items])
|
other_charges_items = JSON.parse(params[:other_charges_items])
|
||||||
sub_total = params[:sub_total]
|
sub_total = params[:sub_total]
|
||||||
|
cashier_type = params[:cashier_type]
|
||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
@@ -68,7 +69,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Re-calc All Amount in Sale
|
# Re-calc All Amount in Sale
|
||||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
|
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount, nil, cashier_type)
|
||||||
end
|
end
|
||||||
if !table.nil?
|
if !table.nil?
|
||||||
dining = {:table_id => table_id, :table_type => table.type }
|
dining = {:table_id => table_id, :table_type => table.type }
|
||||||
@@ -77,9 +78,4 @@ class Origami::OtherChargesController < BaseOrigamiController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -37,9 +37,4 @@ class Origami::OthersPaymentsController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||||
# Print for First Bill to Customer
|
# Print for First Bill to Customer
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
@@ -63,9 +63,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# get member information
|
# get member information
|
||||||
rebate = MembershipSetting.find_by_rebate(1)
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
if customer.membership_id != nil && rebate
|
if customer.membership_id != nil && rebate
|
||||||
member_info = Customer.get_member_account(customer)
|
# member_info = Customer.get_member_account(customer)
|
||||||
current_balance = SaleAudit.paymal_search(sale_id)
|
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||||
# current_balance = 0
|
current_balance = 0
|
||||||
end
|
end
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
@@ -79,8 +79,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
|
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
|
||||||
end
|
|
||||||
|
result = {
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mobile Print
|
||||||
|
render :json => result.to_json
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@@ -129,7 +138,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# For Print
|
# For Print
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
if !receipt_bill_a5_pdf.empty?
|
if !receipt_bill_a5_pdf.empty?
|
||||||
@@ -156,6 +165,23 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
current_balance = SaleAudit.paymal_search(sale_id)
|
current_balance = SaleAudit.paymal_search(sale_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#orders print out
|
||||||
|
if params[:type] == "quick_service"
|
||||||
|
booking = Booking.find_by_sale_id(sale_id)
|
||||||
|
if booking.dining_facility_id.to_i>0
|
||||||
|
table_id = booking.dining_facility_id
|
||||||
|
else
|
||||||
|
table_id = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
booking.booking_orders.each do |order|
|
||||||
|
# Order.pay_process_order_queue(order.order_id, table_id)
|
||||||
|
oqs = OrderQueueStation.new
|
||||||
|
oqs.pay_process_order_queue(order.order_id, table_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
#for card sale data
|
#for card sale data
|
||||||
card_data = Array.new
|
card_data = Array.new
|
||||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||||
@@ -180,19 +206,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||||
|
|
||||||
if params[:type] == "quick_service"
|
#end
|
||||||
booking = Booking.find_by_sale_id(sale_id)
|
|
||||||
if booking.dining_facility_id.to_i>0
|
|
||||||
table_id = booking.dining_facility_id
|
|
||||||
else
|
|
||||||
table_id = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
booking.booking_orders.each do |order|
|
|
||||||
Order.pay_process_order_queue(order.order_id,table_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -210,16 +224,20 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@jcbcount= 0.0
|
@jcbcount= 0.0
|
||||||
@mastercount = 0.0
|
@mastercount = 0.0
|
||||||
@unionpaycount = 0.0
|
@unionpaycount = 0.0
|
||||||
|
@alipaycount = 0.0
|
||||||
|
@junctionpaycount = 0.0
|
||||||
@credit = 0.0
|
@credit = 0.0
|
||||||
@paymalcount = 0.0
|
@paymalcount = 0.0
|
||||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
@balance = 0.00
|
@balance = 0
|
||||||
@accountable_type = ''
|
@accountable_type = ''
|
||||||
@table_no = ''
|
@table_no = ''
|
||||||
@dining = ''
|
@dining = ''
|
||||||
|
|
||||||
@shop = Shop::ShopDetail #show shop info
|
@shop = Shop::ShopDetail #show shop info
|
||||||
|
|
||||||
|
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
|
||||||
#total customer with individual total amount
|
#total customer with individual total amount
|
||||||
@@ -269,10 +287,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
#get customer amount
|
#get customer amount
|
||||||
@customer = Customer.find(@sale_data.customer_id)
|
@customer = Customer.find(@sale_data.customer_id)
|
||||||
accounts = @customer.tax_profiles
|
# accounts = @customer.tax_profiles
|
||||||
|
accounts = TaxProfile.where("group_type = ?",@cashier_type).order("order_by ASC")
|
||||||
@account_arr =[]
|
@account_arr =[]
|
||||||
accounts.each do |acc|
|
accounts.each do |acc|
|
||||||
account = TaxProfile.find(acc)
|
account = TaxProfile.find(acc.id)
|
||||||
@account_arr.push(account)
|
@account_arr.push(account)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -283,7 +302,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if response["status"]==true
|
if response["status"]==true
|
||||||
response["account_data"].each do |res|
|
response["account_data"].each do |res|
|
||||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||||
@balance += res["balance"]
|
@balance = @balance.to_f + res["balance"].to_f
|
||||||
# @accountable_type = res["accountable_type"]
|
# @accountable_type = res["accountable_type"]
|
||||||
@accountable_type = "Rebate Balance"
|
@accountable_type = "Rebate Balance"
|
||||||
end
|
end
|
||||||
@@ -323,10 +342,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@mastercount += spay.payment_amount
|
@mastercount += spay.payment_amount
|
||||||
elsif spay.payment_method == "unionpay"
|
elsif spay.payment_method == "unionpay"
|
||||||
@unionpaycount += spay.payment_amount
|
@unionpaycount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "JunctionPay"
|
||||||
|
@junctionpaycount += spay.payment_amount
|
||||||
elsif spay.payment_method == "creditnote"
|
elsif spay.payment_method == "creditnote"
|
||||||
@credit += spay.payment_amount
|
@credit += spay.payment_amount
|
||||||
elsif spay.payment_method == "paymal"
|
elsif spay.payment_method == "paymal"
|
||||||
@paymalcount += spay.payment_amount
|
@paymalcount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "alipay"
|
||||||
|
@alipaycount += spay.payment_amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -402,19 +425,19 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
member_info = nil
|
member_info = nil
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
current_balance = nil
|
current_balance = nil
|
||||||
|
order_source = params[:type]
|
||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
if saleObj.discount_type == "member_discount"
|
if saleObj.discount_type == "member_discount"
|
||||||
saleObj.update_attributes(rounding_adjustment: 0)
|
saleObj.update_attributes(rounding_adjustment: 0)
|
||||||
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0)
|
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0,order_source)
|
||||||
end
|
end
|
||||||
|
|
||||||
saleObj.update_attributes(rounding_adjustment: 0)
|
saleObj.update_attributes(rounding_adjustment: 0)
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
# if bookings.count > 1
|
# if bookings.count > 1
|
||||||
@@ -436,7 +459,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# Re-call Sale Data
|
# Re-call Sale Data
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
@@ -450,7 +473,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_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 = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil)
|
|
||||||
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil)
|
||||||
|
result = {
|
||||||
|
:status => true,
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mobile Print
|
||||||
|
render :json => result.to_json
|
||||||
|
|
||||||
if params[:type] == "quick_service"
|
if params[:type] == "quick_service"
|
||||||
booking = Booking.find_by_sale_id(sale_id)
|
booking = Booking.find_by_sale_id(sale_id)
|
||||||
@@ -464,7 +497,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
Order.pay_process_order_queue(order.order_id,table_id)
|
Order.pay_process_order_queue(order.order_id,table_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -510,12 +543,15 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)
|
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)
|
||||||
|
|
||||||
render :json => {status: true}
|
result = {
|
||||||
end
|
:status => true,
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
#Shop Name in Navbor
|
# Mobile Print
|
||||||
helper_method :shop_detail
|
render :json => result.to_json
|
||||||
def shop_detail
|
# render :json => {status: true}
|
||||||
@shop = Shop.first
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -29,9 +29,4 @@ class Origami::PayparPaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,9 +41,4 @@ class Origami::PendingOrderController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -137,9 +137,4 @@ class Origami::ProductCommissionsController < BaseOrigamiController
|
|||||||
params.fetch(:product_commission, {})
|
params.fetch(:product_commission, {})
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
class Origami::QuickServiceController < ApplicationController
|
class Origami::QuickServiceController < ApplicationController
|
||||||
# before_action :set_dining, only: [:detail]
|
# before_action :set_dining, only: [:detail]
|
||||||
|
before_action :check_user
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
today = DateTime.now
|
today = DateTime.now
|
||||||
@@ -211,6 +217,11 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
# this can always true
|
# this can always true
|
||||||
def check_order_with_booking(booking)
|
def check_order_with_booking(booking)
|
||||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
|||||||
@membership_rebate_balance=0
|
@membership_rebate_balance=0
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
|
||||||
|
@payment_method_setting_nav = PaymentMethodSetting.all
|
||||||
@shop = Shop::ShopDetail
|
@shop = Shop::ShopDetail
|
||||||
# if @shop.is_rounding_adj
|
# if @shop.is_rounding_adj
|
||||||
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
@@ -69,9 +70,4 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
|||||||
@out = false, 0
|
@out = false, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
class Origami::RequestBillsController < ApplicationController
|
class Origami::RequestBillsController < ApplicationController
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
# Print Request Bill and add to sale tables
|
# Print Request Bill and add to sale tables
|
||||||
def print
|
def print
|
||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
@@ -8,14 +14,12 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
if !ShiftSale.current_shift.nil?
|
if !ShiftSale.current_shift.nil?
|
||||||
order_id = params[:id] # order_id
|
order_id = params[:id] # order_id
|
||||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||||
puts params[:id]
|
order = Order.find(order_id)
|
||||||
puts bk_order
|
|
||||||
puts bk_order.booking_id
|
|
||||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||||
|
|
||||||
if check_booking.sale_id.nil?
|
if check_booking.sale_id.nil?
|
||||||
# Create Sale if it doesn't exist
|
# Create Sale if it doesn't exist
|
||||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user)
|
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source)
|
||||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
else
|
else
|
||||||
@@ -29,6 +33,10 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
|
|
||||||
# Promotion Activation
|
# Promotion Activation
|
||||||
Promotion.promo_activate(@sale)
|
Promotion.promo_activate(@sale)
|
||||||
|
if order.source == "quick_service"
|
||||||
|
result = {:status=> @status, :data => @sale.sale_id }
|
||||||
|
render :json => result.to_json
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@status = false
|
@status = false
|
||||||
@error_message = "No Current Open Shift for This Employee"
|
@error_message = "No Current Open Shift for This Employee"
|
||||||
@@ -57,9 +65,4 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,9 +37,4 @@ class Origami::RoomInvoicesController < BaseOrigamiController
|
|||||||
@customer = @sale.customer
|
@customer = @sale.customer
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -68,16 +68,6 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@date = order.created_at
|
@date = order.created_at
|
||||||
@booking = booking
|
@booking = booking
|
||||||
order.order_items.each do |item|
|
order.order_items.each do |item|
|
||||||
if !item.set_menu_items.nil?
|
|
||||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
|
||||||
arr_instance_item_sets = Array.new
|
|
||||||
instance_item_sets.each do |instance_item|
|
|
||||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
|
||||||
arr_instance_item_sets.push(item_instance_name)
|
|
||||||
item.price = item.price.to_f + instance_item["price"].to_f
|
|
||||||
end
|
|
||||||
item.set_menu_items = arr_instance_item_sets
|
|
||||||
end
|
|
||||||
@order_items.push(item)
|
@order_items.push(item)
|
||||||
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||||
# if !assigned_order_items.nil?
|
# if !assigned_order_items.nil?
|
||||||
@@ -89,8 +79,7 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@status_order = 'order'
|
@status_order = 'order'
|
||||||
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' && sale.sale_status != 'spoile' && sale.sale_status != 'waste'
|
||||||
puts "enter"
|
|
||||||
@sale_array.push(sale)
|
@sale_array.push(sale)
|
||||||
if @status_order == 'order'
|
if @status_order == 'order'
|
||||||
@status_order = 'sale'
|
@status_order = 'sale'
|
||||||
@@ -136,9 +125,4 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,11 +76,14 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
# re-calc tax
|
# re-calc tax
|
||||||
saleObj = Sale.find(saleitemObj.sale_id)
|
saleObj = Sale.find(saleitemObj.sale_id)
|
||||||
|
|
||||||
|
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
|
||||||
|
order = Order.find(order_id)
|
||||||
|
|
||||||
action_by = current_user.id
|
action_by = current_user.id
|
||||||
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
|
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" )
|
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" )
|
||||||
|
|
||||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
|
||||||
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -141,7 +144,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
|
||||||
|
|
||||||
ProductCommission.edit_product_commission(saleitemObj)
|
ProductCommission.edit_product_commission(saleitemObj)
|
||||||
end
|
end
|
||||||
@@ -162,17 +165,21 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
# re-calc tax
|
# re-calc tax
|
||||||
saleObj = Sale.find(saleitemObj.sale_id)
|
saleObj = Sale.find(saleitemObj.sale_id)
|
||||||
|
|
||||||
|
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
|
||||||
|
order = Order.find(order_id)
|
||||||
|
|
||||||
action_by = current_user.id
|
action_by = current_user.id
|
||||||
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
|
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" )
|
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" )
|
||||||
|
|
||||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount, order.source)
|
||||||
ProductCommission.remove_product_commission(saleitemObj)
|
ProductCommission.remove_product_commission(saleitemObj)
|
||||||
end
|
end
|
||||||
|
|
||||||
# remove all void items
|
# remove all void items
|
||||||
def cancel_all_void
|
def cancel_all_void
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
order_source = params[:type]
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
saleObj.sale_items.each do |item|
|
saleObj.sale_items.each do |item|
|
||||||
if item.qty.to_i < 0
|
if item.qty.to_i < 0
|
||||||
@@ -185,21 +192,17 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# re-calc tax
|
# re-calc tax
|
||||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order_source)
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_void
|
def apply_void
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
order_source = params[:type]
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
saleObj.compute_without_void
|
saleObj.compute_without_void(order_source)
|
||||||
saleObj.sale_items.each do |item|
|
saleObj.sale_items.each do |item|
|
||||||
ProductCommission.remove_product_commission(item)
|
ProductCommission.remove_product_commission(item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -56,9 +56,4 @@ class Origami::SalesController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@cashier_type = params[:type]
|
||||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
#for bank integration
|
#for bank integration
|
||||||
bank_integration = Lookup.collection_of('bank_integration')
|
bank_integration = Lookup.collection_of('bank_integration')
|
||||||
@@ -125,9 +126,4 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
57
app/controllers/origami/split_bill_controller.rb
Normal file → Executable file
57
app/controllers/origami/split_bill_controller.rb
Normal file → Executable file
@@ -3,6 +3,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
dining_id = params[:dining_id]
|
dining_id = params[:dining_id]
|
||||||
|
@cashier_type = params[:type]
|
||||||
@table = DiningFacility.find(dining_id)
|
@table = DiningFacility.find(dining_id)
|
||||||
@booking = @table.get_booking
|
@booking = @table.get_booking
|
||||||
@orders = Array.new
|
@orders = Array.new
|
||||||
@@ -76,7 +77,12 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
cashier_type = params[:cashier_type]
|
||||||
order_ids = params[:order_ids]
|
order_ids = params[:order_ids]
|
||||||
|
arr_order_ids = nil
|
||||||
|
if !params[:arr_order_ids].nil?
|
||||||
|
arr_order_ids = JSON.parse(params[:arr_order_ids])
|
||||||
|
end
|
||||||
orders = nil
|
orders = nil
|
||||||
if !params[:orders].empty?
|
if !params[:orders].empty?
|
||||||
orders = JSON.parse(params[:orders])
|
orders = JSON.parse(params[:orders])
|
||||||
@@ -107,7 +113,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
if booking
|
if booking
|
||||||
if booking.sale_id.nil?
|
if booking.sale_id.nil?
|
||||||
sale = Sale.new
|
sale = Sale.new
|
||||||
status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, current_user)
|
status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, current_user, cashier_type)
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
else
|
else
|
||||||
status = true
|
status = true
|
||||||
@@ -136,16 +142,17 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
order_id_count = 0
|
order_id_count = 0
|
||||||
order_id = nil
|
order_id = nil
|
||||||
|
|
||||||
order_items.each do |order_item|
|
arr_order_ids.each do |order|
|
||||||
order_item_count = 0
|
order.each do |odr|
|
||||||
order = Order.find(order_item["order_id"])
|
data = Order.find(odr[0])
|
||||||
if order.order_items.count == 1
|
if data.order_items.count == odr[1]
|
||||||
order_id = order.id
|
order_id = odr[0]
|
||||||
order_id_count += 1
|
order_id_count += 1
|
||||||
else
|
else
|
||||||
order_item_count += 1
|
order_item_count += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
puts order_id
|
puts order_id
|
||||||
puts order_ids.count
|
puts order_ids.count
|
||||||
@@ -158,10 +165,12 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
puts "order_id_count > 1"
|
puts "order_id_count > 1"
|
||||||
|
|
||||||
updated_order_id = Array.new
|
updated_order_id = Array.new
|
||||||
order_ids.each do |odr_id|
|
arr_order_ids.each do |order|
|
||||||
odr = Order.find(odr_id)
|
order.each do |odr|
|
||||||
if odr.order_items.count > 1
|
data = Order.find(odr[0])
|
||||||
updated_order_id.push(odr_id)
|
if data.order_items.count != odr[1]
|
||||||
|
updated_order_id.push(odr[0])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -226,7 +235,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
puts "order_id_count < 1"
|
puts "order_id_count < 1"
|
||||||
new_order_status = true
|
new_order_status = true
|
||||||
order_items.each do |order_item|
|
order_items.each do |order_item|
|
||||||
orderItem = OrderItem.find_by_order_id(order_id)
|
orderItem = OrderItem.find(order_item["id"])
|
||||||
if !orderItem.nil?
|
if !orderItem.nil?
|
||||||
if order_item["id"] == orderItem.order_items_id
|
if order_item["id"] == orderItem.order_items_id
|
||||||
if orderItem.qty.to_f != order_item['qty'].to_f
|
if orderItem.qty.to_f != order_item['qty'].to_f
|
||||||
@@ -266,13 +275,33 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# puts order_ids
|
if order_ids.count == 1 && order_item_count == 1
|
||||||
if order_ids.count == 1 && order_id_count == 0 && order_item_count == 1
|
if order_id_count == 0
|
||||||
|
customer = Customer.find(params[:customer_id])
|
||||||
|
order_type = "dine_in"
|
||||||
|
if !customer.nil?
|
||||||
|
if customer.customer_type == "Takeaway"
|
||||||
|
order_type = "takeaway"
|
||||||
|
elsif customer.customer_type == "Delivery"
|
||||||
|
order_type = "delivery"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# begin
|
||||||
|
order = create_order(params,order_type,order_items.count,current_user)
|
||||||
|
|
||||||
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
||||||
|
|
||||||
|
order_items.each do |order_item|
|
||||||
|
update_order_item(order.order_id, order_item)
|
||||||
|
end
|
||||||
|
else
|
||||||
BookingOrder.find_by_order_id(order_ids[0]).delete
|
BookingOrder.find_by_order_id(order_ids[0]).delete
|
||||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_ids[0]})
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_ids[0]})
|
||||||
order_items.each do |order_item|
|
order_items.each do |order_item|
|
||||||
update_order_item(order_ids[0], order_item)
|
update_order_item(order_ids[0], order_item)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
customer = Customer.find(params[:customer_id])
|
customer = Customer.find(params[:customer_id])
|
||||||
order_type = "dine_in"
|
order_type = "dine_in"
|
||||||
@@ -297,7 +326,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
sale = Sale.new
|
sale = Sale.new
|
||||||
status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, current_user)
|
status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, current_user, cashier_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
Promotion.promo_activate(sale)
|
Promotion.promo_activate(sale)
|
||||||
|
|||||||
@@ -91,9 +91,4 @@ class Origami::SurveysController < BaseOrigamiController
|
|||||||
params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner, :dining_name,:receipt_no,:shift_id,:created_by,:total_customer,:total_amount,:survey_id)
|
params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner, :dining_name,:receipt_no,:shift_id,:created_by,:total_customer,:total_amount,:survey_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@table = DiningFacility.find(params[:table_id])
|
@table = DiningFacility.find(params[:table_id])
|
||||||
|
@membership = MembershipSetting::MembershipSetting
|
||||||
|
@payment_methods = PaymentMethodSetting.all
|
||||||
shop = Shop::ShopDetail
|
shop = Shop::ShopDetail
|
||||||
@sale_array = Array.new
|
@sale_array = Array.new
|
||||||
@table.bookings.each do |booking|
|
@table.bookings.each do |booking|
|
||||||
@@ -70,9 +72,4 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
|||||||
@print_settings = PrintSetting.get_precision_delimiter()
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,11 +4,19 @@ class Origami::UnionpayController < BaseOrigamiController
|
|||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
# limit unionpay_amount
|
# limit unionpay_amount
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
total = sale_data.grand_total
|
total = 0
|
||||||
@unionpaycount = 0
|
@unionpaycount = 0
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@rounding_adj = 0
|
||||||
|
@can_unionpay = 0
|
||||||
|
@member_discount = 0
|
||||||
|
@sub_total = 0
|
||||||
|
@membership_id = nil
|
||||||
|
@receipt_no = nil
|
||||||
|
if !sale_data.nil?
|
||||||
|
total = sale_data.grand_total
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
else
|
else
|
||||||
@@ -29,6 +37,7 @@ class Origami::UnionpayController < BaseOrigamiController
|
|||||||
@membership_id = sale_data.customer.membership_id
|
@membership_id = sale_data.customer.membership_id
|
||||||
#for bank integration
|
#for bank integration
|
||||||
@receipt_no = sale_data.receipt_no
|
@receipt_no = sale_data.receipt_no
|
||||||
|
end
|
||||||
bank_integration = Lookup.collection_of('bank_integration')
|
bank_integration = Lookup.collection_of('bank_integration')
|
||||||
@bank_integration = 0
|
@bank_integration = 0
|
||||||
if !bank_integration[0].nil?
|
if !bank_integration[0].nil?
|
||||||
@@ -39,6 +48,7 @@ class Origami::UnionpayController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
cash = params[:amount]
|
cash = params[:amount]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
ref_no = params[:ref_no]
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
@@ -53,7 +63,7 @@ class Origami::UnionpayController < BaseOrigamiController
|
|||||||
# saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay",ref_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
16
app/controllers/origami/visa_controller.rb
Executable file → Normal file
16
app/controllers/origami/visa_controller.rb
Executable file → Normal file
@@ -4,11 +4,19 @@ class Origami::VisaController < BaseOrigamiController
|
|||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
# limit visa_amount
|
# limit visa_amount
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
total = sale_data.grand_total
|
total = 0
|
||||||
@visacount = 0
|
@visacount = 0
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@rounding_adj = 0
|
||||||
|
@can_visa = 0
|
||||||
|
@member_discount = 0
|
||||||
|
@sub_total = 0
|
||||||
|
@membership_id = nil
|
||||||
|
@receipt_no = nil
|
||||||
|
if !sale_data.nil?
|
||||||
|
total = sale_data.grand_total
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
@shop = Shop::ShopDetail
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
else
|
else
|
||||||
@@ -29,6 +37,7 @@ class Origami::VisaController < BaseOrigamiController
|
|||||||
@membership_id = sale_data.customer.membership_id
|
@membership_id = sale_data.customer.membership_id
|
||||||
#for bank integration
|
#for bank integration
|
||||||
@receipt_no = sale_data.receipt_no
|
@receipt_no = sale_data.receipt_no
|
||||||
|
end
|
||||||
bank_integration = Lookup.collection_of('bank_integration')
|
bank_integration = Lookup.collection_of('bank_integration')
|
||||||
@bank_integration = 0
|
@bank_integration = 0
|
||||||
if !bank_integration[0].nil?
|
if !bank_integration[0].nil?
|
||||||
@@ -39,6 +48,7 @@ class Origami::VisaController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
cash = params[:amount]
|
cash = params[:amount]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
ref_no = params[:ref_no]
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
@@ -53,7 +63,7 @@ class Origami::VisaController < BaseOrigamiController
|
|||||||
# saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa")
|
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa",ref_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
|
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
remark = params[:remark]
|
remark = params[:remark]
|
||||||
|
order_source = params[:type] #tax profile source
|
||||||
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)
|
||||||
|
|
||||||
if sale.discount_type == "member_discount"
|
if sale.discount_type == "member_discount"
|
||||||
sale.update_attributes(total_discount: 0)
|
sale.update_attributes(total_discount: 0)
|
||||||
sale.compute_by_sale_items(sale_id, sale.sale_items,0)
|
sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source)
|
||||||
end
|
end
|
||||||
|
|
||||||
# update count for shift sale
|
# update count for shift sale
|
||||||
@@ -47,7 +48,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
table.bookings.each do |booking|
|
table.bookings.each do |booking|
|
||||||
if booking.booking_status != 'moved'
|
if booking.booking_status != 'moved'
|
||||||
if booking.sale_id
|
if booking.sale_id
|
||||||
if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void'
|
if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void' && booking.sale.sale_status != 'spoile' && booking.sale.sale_status != 'waste'
|
||||||
table_avaliable = false
|
table_avaliable = false
|
||||||
table_count += 1
|
table_count += 1
|
||||||
else
|
else
|
||||||
@@ -86,8 +87,6 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
if bookings[0].dining_facility_id.to_i>0
|
if bookings[0].dining_facility_id.to_i>0
|
||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if bookings[0].dining_facility_id.to_i > 0
|
if bookings[0].dining_facility_id.to_i > 0
|
||||||
@@ -99,7 +98,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(sale.customer_id)
|
customer= Customer.find(sale.customer_id)
|
||||||
|
|
||||||
@@ -120,8 +119,16 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
||||||
end
|
result = {
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mobile Print
|
||||||
|
render :json => result.to_json
|
||||||
|
# end
|
||||||
|
|
||||||
#end print
|
#end print
|
||||||
|
|
||||||
@@ -135,9 +142,4 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -54,7 +54,7 @@ class Origami::VoucherController < BaseOrigamiController
|
|||||||
}.to_json,
|
}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json; version=2'
|
'Accept' => 'application/json; version=3'
|
||||||
}, :timeout => 10
|
}, :timeout => 10
|
||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
@@ -78,9 +78,4 @@ class Origami::VoucherController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
128
app/controllers/origami/waste_spoile_controller.rb
Executable file
128
app/controllers/origami/waste_spoile_controller.rb
Executable file
@@ -0,0 +1,128 @@
|
|||||||
|
class Origami::WasteSpoileController < BaseOrigamiController
|
||||||
|
def waste_and_spoilage
|
||||||
|
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
remark = params[:remark]
|
||||||
|
order_source = params[:type] #tax profile source
|
||||||
|
if Sale.exists?(sale_id)
|
||||||
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
|
SaleTax.where("sale_id='#{sale_id}'").find_each do |existing_tax|
|
||||||
|
existing_tax.delete
|
||||||
|
end
|
||||||
|
sale.update_attributes(total_discount: 0,total_tax: 0,grand_total: sale.total_amount,rounding_adjustment:0)
|
||||||
|
sale.payment_status = remark
|
||||||
|
sale.sale_status = remark
|
||||||
|
sale.save
|
||||||
|
|
||||||
|
# sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source)
|
||||||
|
# add to sale item with foc
|
||||||
|
# sale_items = SaleItem.where("sale_id='#{ sale_id }' and status is null")
|
||||||
|
|
||||||
|
sale.sale_items.each do|item|
|
||||||
|
# SaleItem.update_existing_item(item.qty, item, sale_id, remark, item.unit_price, item.price)
|
||||||
|
item.status = remark
|
||||||
|
item.remark = remark
|
||||||
|
item.save
|
||||||
|
end
|
||||||
|
|
||||||
|
if sale.bookings[0].dining_facility_id.to_i > 0
|
||||||
|
table_avaliable = true
|
||||||
|
table_count = 0
|
||||||
|
table = sale.bookings[0].dining_facility
|
||||||
|
table.bookings.each do |booking|
|
||||||
|
if booking.booking_status != 'moved'
|
||||||
|
if booking.sale_id
|
||||||
|
if booking.sale.sale_status != 'completed' && booking.sale.sale_status != 'void' && booking.sale.sale_status != 'spoile' && booking.sale.sale_status != 'waste'
|
||||||
|
table_avaliable = false
|
||||||
|
table_count += 1
|
||||||
|
else
|
||||||
|
table_avaliable = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table_avaliable = false
|
||||||
|
table_count += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if table_avaliable && table_count == 0
|
||||||
|
table.status = 'available'
|
||||||
|
table.save
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# FOr Sale Audit
|
||||||
|
action_by = current_user.name
|
||||||
|
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||||
|
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,remark )
|
||||||
|
|
||||||
|
# For Print
|
||||||
|
|
||||||
|
member_info = nil
|
||||||
|
rebate_amount = nil
|
||||||
|
current_balance = nil
|
||||||
|
|
||||||
|
# For Cashier by Zone
|
||||||
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
|
if bookings.count > 1
|
||||||
|
# for Multiple Booking
|
||||||
|
if bookings[0].dining_facility_id.to_i>0
|
||||||
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if bookings[0].dining_facility_id.to_i > 0
|
||||||
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
else
|
||||||
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
customer= Customer.find(sale.customer_id)
|
||||||
|
|
||||||
|
#shop detail
|
||||||
|
shop_details = Shop.find(1)
|
||||||
|
# get member information
|
||||||
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
|
if customer.membership_id != nil && rebate
|
||||||
|
member_info = Customer.get_member_account(customer)
|
||||||
|
rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no)
|
||||||
|
current_balance = SaleAudit.paymal_search(sale_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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(sale.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil)
|
||||||
|
result = {
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mobile Print
|
||||||
|
render :json => result.to_json
|
||||||
|
# end
|
||||||
|
|
||||||
|
#end print
|
||||||
|
|
||||||
|
# update complete order items in oqs
|
||||||
|
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||||
|
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||||
|
aoi.delivery_status = 1
|
||||||
|
aoi.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -2,6 +2,8 @@ class PrintSettingsController < ApplicationController
|
|||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]
|
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
|
helper_method :shop_detail
|
||||||
|
|
||||||
# GET /print_settings
|
# GET /print_settings
|
||||||
# GET /print_settings.json
|
# GET /print_settings.json
|
||||||
def index
|
def index
|
||||||
@@ -62,6 +64,17 @@ class PrintSettingsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_printer_options
|
||||||
|
printer_name = params[:printer_name]
|
||||||
|
printer_options = Printer::PrinterWorker.printer_options(printer_name)
|
||||||
|
options = {
|
||||||
|
:url => printer_options['device-uri'],
|
||||||
|
:model => printer_options['printer-info'],
|
||||||
|
}
|
||||||
|
|
||||||
|
render :json => options.to_json
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_print_setting
|
def set_print_setting
|
||||||
@@ -70,6 +83,11 @@ class PrintSettingsController < 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 print_setting_params
|
def print_setting_params
|
||||||
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :brand_name, :printer_type, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||||
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,10 +16,4 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -50,10 +50,5 @@ class Reports::CommissionController < BaseReportController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,4 @@ authorize_resource :class => false
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -20,9 +20,4 @@ class Reports::DailysaleController < BaseReportController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -62,9 +62,4 @@ class Reports::PaymentMethodController < BaseReportController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -18,4 +18,10 @@ class Reports::ProductSaleController < BaseReportController
|
|||||||
format.xls
|
format.xls
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Shop Name in Navbor
|
||||||
|
helper_method :shop_detail
|
||||||
|
def shop_detail
|
||||||
|
@shop = Shop.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -62,9 +62,4 @@ authorize_resource :class => false
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -15,7 +15,8 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
|
@type = params[:sale_type]
|
||||||
|
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
|
||||||
|
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||||
|
|
||||||
@@ -77,9 +78,4 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -48,10 +48,5 @@ class Reports::ShiftsaleController < BaseReportController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -47,10 +47,5 @@ class Reports::StockCheckController < BaseReportController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,4 @@ authorize_resource :class => false
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
19
app/controllers/reports/waste_and_spoilage_controller.rb
Executable file
19
app/controllers/reports/waste_and_spoilage_controller.rb
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
class Reports::WasteAndSpoilageController < BaseReportController
|
||||||
|
authorize_resource :class => false
|
||||||
|
def index
|
||||||
|
from, to = get_date_range_from_params
|
||||||
|
@sale_type = params[:sale_type]
|
||||||
|
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type)
|
||||||
|
@from = from
|
||||||
|
@to = to
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xls
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::CommissionersController < ApplicationController
|
class Settings::CommissionersController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /commissioners
|
# GET /commissioners
|
||||||
# GET /commissioners.json
|
# GET /commissioners.json
|
||||||
@@ -82,7 +83,11 @@ class Settings::CommissionersController < ApplicationController
|
|||||||
end
|
end
|
||||||
render json: @transactions
|
render json: @transactions
|
||||||
end
|
end
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_commissioner
|
def set_commissioner
|
||||||
@@ -91,6 +96,6 @@ class Settings::CommissionersController < 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 commissioner_params
|
def commissioner_params
|
||||||
params.require(:commissioner).permit(:name, :emp_id, :created_by, :commission_id, :joined_date, :resigned_date, :is_active)
|
params.require(:commissioner).permit(:name, :emp_id, :created_by, :commission_id, :joined_date, :resigned_date, :is_active, :image_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::CommissionsController < ApplicationController
|
class Settings::CommissionsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /commissions
|
# GET /commissions
|
||||||
# GET /commissions.json
|
# GET /commissions.json
|
||||||
@@ -68,6 +69,12 @@ class Settings::CommissionsController < ApplicationController
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_commission
|
def set_commission
|
||||||
|
|||||||
11
app/controllers/settings/display_images_controller.rb
Normal file
11
app/controllers/settings/display_images_controller.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
class Settings::DisplayImagesController < ApplicationController
|
||||||
|
def destroy
|
||||||
|
#byebug
|
||||||
|
@item_photo = DisplayImage.find(params[:shop_id])
|
||||||
|
item = @item_photo.id
|
||||||
|
@item_photo.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html {redirect_to settings_shops_url+'/1/edit', notice: 'Image was successfully destroyed.'}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -68,6 +68,6 @@ class Settings::EmployeesController < 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 employee_params
|
def employee_params
|
||||||
params.require(:employee).permit(:name, :role, :emp_id, :password)
|
params.require(:employee).permit(:name, :role, :emp_id, :password, :image_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ class Settings::MenusController < ApplicationController
|
|||||||
# GET /settings/menus.json
|
# GET /settings/menus.json
|
||||||
def index
|
def index
|
||||||
@settings_menus = Menu.all.page(params[:page]).per(10)
|
@settings_menus = Menu.all.page(params[:page]).per(10)
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xlsx
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/menus/1
|
# GET /settings/menus/1
|
||||||
@@ -67,6 +71,14 @@ class Settings::MenusController < ApplicationController
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def import
|
||||||
|
if params[:file]
|
||||||
|
Menu.import(params[:file])
|
||||||
|
redirect_to settings_menus_path, notice: "Menu was successfully Imported"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_settings_menu
|
def set_settings_menu
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::OrderQueueStationsController < ApplicationController
|
class Settings::OrderQueueStationsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy]
|
before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /settings/order_queue_stations
|
# GET /settings/order_queue_stations
|
||||||
# GET /settings/order_queue_stations.json
|
# GET /settings/order_queue_stations.json
|
||||||
@@ -67,6 +68,12 @@ class Settings::OrderQueueStationsController < ApplicationController
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_settings_order_queue_station
|
def set_settings_order_queue_station
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::ProductsController < ApplicationController
|
class Settings::ProductsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
|
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /settings/products
|
# GET /settings/products
|
||||||
# GET /settings/products.json
|
# GET /settings/products.json
|
||||||
@@ -65,6 +66,12 @@ load_and_authorize_resource except: [:create]
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_settings_product
|
def set_settings_product
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::PromotionProductsController < ApplicationController
|
class Settings::PromotionProductsController < ApplicationController
|
||||||
before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new]
|
before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new]
|
||||||
before_action :set_promotion_product, only: [:show, :edit, :update, :destroy]
|
before_action :set_promotion_product, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /promotion_products
|
# GET /promotion_products
|
||||||
# GET /promotion_products.json
|
# GET /promotion_products.json
|
||||||
@@ -63,6 +64,12 @@ class Settings::PromotionProductsController < ApplicationController
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_promotion
|
def set_promotion
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::PromotionsController < ApplicationController
|
class Settings::PromotionsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
|
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /promotions
|
# GET /promotions
|
||||||
# GET /promotions.json
|
# GET /promotions.json
|
||||||
@@ -119,6 +120,12 @@ class Settings::PromotionsController < ApplicationController
|
|||||||
render json: res
|
render json: res
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_promotion
|
def set_promotion
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Settings::ShopsController < ApplicationController
|
class Settings::ShopsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_shop, only: [:show, :edit, :update]
|
before_action :set_shop, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
# GET /settings/shops
|
# GET /settings/shops
|
||||||
# GET /settings/shops.json
|
# GET /settings/shops.json
|
||||||
@@ -11,11 +11,13 @@ class Settings::ShopsController < ApplicationController
|
|||||||
# GET /settings/shops/1
|
# GET /settings/shops/1
|
||||||
# GET /settings/shops/1.json
|
# GET /settings/shops/1.json
|
||||||
def show
|
def show
|
||||||
|
@display_images = @settings_shop.display_images.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/shops/new
|
# GET /settings/shops/new
|
||||||
def new
|
def new
|
||||||
@settings_shop = Shop.new
|
@settings_shop = Shop.new
|
||||||
|
@display_image = @settings_shop.display_images.build
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /settings/shops/1/edit
|
# GET /settings/shops/1/edit
|
||||||
@@ -28,6 +30,11 @@ class Settings::ShopsController < ApplicationController
|
|||||||
@settings_shop = Shop.new(shop_params)
|
@settings_shop = Shop.new(shop_params)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_shop.save
|
if @settings_shop.save
|
||||||
|
if params[:display_images].present?
|
||||||
|
params[:display_images]['image'].each do |a|
|
||||||
|
@display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => a)
|
||||||
|
end
|
||||||
|
end
|
||||||
format.html { redirect_to settings_shops_url, notice: 'Shop was successfully created.' }
|
format.html { redirect_to settings_shops_url, notice: 'Shop was successfully created.' }
|
||||||
format.json { render :index, status: :created, location: @settings_shop }
|
format.json { render :index, status: :created, location: @settings_shop }
|
||||||
else
|
else
|
||||||
@@ -42,6 +49,11 @@ class Settings::ShopsController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_shop.update(shop_params)
|
if @settings_shop.update(shop_params)
|
||||||
|
if params[:display_images].present?
|
||||||
|
params[:display_images]['image'].each do |a|
|
||||||
|
@display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => a)
|
||||||
|
end
|
||||||
|
end
|
||||||
format.html { redirect_to settings_shops_url, notice: 'Shop was successfully updated.' }
|
format.html { redirect_to settings_shops_url, notice: 'Shop was successfully updated.' }
|
||||||
format.json { render :index, status: :ok, location: @settings_shop }
|
format.json { render :index, status: :ok, location: @settings_shop }
|
||||||
else
|
else
|
||||||
@@ -71,6 +83,6 @@ class Settings::ShopsController < 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 shop_params
|
def shop_params
|
||||||
params.require(:shop).permit(:name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order,:show_account_info)
|
params.require(:shop).permit(:logo, :name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order,:show_account_info, display_images_attributes: [:id, :shop_id, :image])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user