merge with master
This commit is contained in:
31
Capfile
Normal file
31
Capfile
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Load DSL and set up stages
|
||||||
|
require "capistrano/setup"
|
||||||
|
|
||||||
|
# Include default deployment tasks
|
||||||
|
require "capistrano/deploy"
|
||||||
|
|
||||||
|
# Include tasks from other gems included in your Gemfile
|
||||||
|
#
|
||||||
|
# For documentation on these, see for example:
|
||||||
|
#
|
||||||
|
# https://github.com/capistrano/rvm
|
||||||
|
# https://github.com/capistrano/rbenv
|
||||||
|
# https://github.com/capistrano/chruby
|
||||||
|
# https://github.com/capistrano/bundler
|
||||||
|
# https://github.com/capistrano/rails
|
||||||
|
# https://github.com/capistrano/passenger
|
||||||
|
#
|
||||||
|
# require "capistrano/rvm"
|
||||||
|
require "capistrano/rbenv"
|
||||||
|
# require "capistrano/chruby"
|
||||||
|
require "capistrano/bundler"
|
||||||
|
require "capistrano/rails"
|
||||||
|
require "capistrano/rails/assets"
|
||||||
|
require "capistrano/rails/migrations"
|
||||||
|
# require "capistrano/passenger"
|
||||||
|
|
||||||
|
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
||||||
|
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
|
||||||
|
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
|
||||||
|
Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
|
||||||
|
|
||||||
14
Gemfile
14
Gemfile
@@ -1,5 +1,5 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
ruby '2.4.1'
|
||||||
git_source(:github) do |repo_name|
|
git_source(:github) do |repo_name|
|
||||||
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
||||||
"https://github.com/#{repo_name}.git"
|
"https://github.com/#{repo_name}.git"
|
||||||
@@ -43,7 +43,7 @@ gem 'carrierwave', '~> 1.0'
|
|||||||
gem 'mini_magick'
|
gem 'mini_magick'
|
||||||
|
|
||||||
#Report and Printing gems
|
#Report and Printing gems
|
||||||
gem 'cups', '~> 0.0.7'
|
gem 'cups'
|
||||||
gem 'prawn'
|
gem 'prawn'
|
||||||
gem 'prawn-table'
|
gem 'prawn-table'
|
||||||
gem 'spreadsheet'
|
gem 'spreadsheet'
|
||||||
@@ -89,10 +89,10 @@ gem 'cancancan', '~> 1.10'
|
|||||||
# Use Capistrano for deployment
|
# Use Capistrano for deployment
|
||||||
# gem 'capistrano-rails', group: :development
|
# gem 'capistrano-rails', group: :development
|
||||||
|
|
||||||
group :development, :test do
|
#group :development, :test do
|
||||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
gem 'byebug', platform: :mri
|
# gem 'byebug', platform: :mri
|
||||||
end
|
#end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
||||||
@@ -103,6 +103,10 @@ group :development do
|
|||||||
gem 'spring-watcher-listen', '~> 2.0.0'
|
gem 'spring-watcher-listen', '~> 2.0.0'
|
||||||
gem 'rspec-rails', '~> 3.5'
|
gem 'rspec-rails', '~> 3.5'
|
||||||
gem 'schema_to_scaffold'
|
gem 'schema_to_scaffold'
|
||||||
|
gem 'capistrano'
|
||||||
|
gem 'capistrano-bundler'
|
||||||
|
gem 'capistrano-rails'
|
||||||
|
gem 'capistrano-rbenv', github: "capistrano/rbenv"
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
|||||||
42
Gemfile.lock
42
Gemfile.lock
@@ -1,3 +1,11 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/capistrano/rbenv.git
|
||||||
|
revision: c029e4128e4a8f25adda35795f5729bd4f62e51f
|
||||||
|
specs:
|
||||||
|
capistrano-rbenv (2.1.3)
|
||||||
|
capistrano (~> 3.1)
|
||||||
|
sshkit (~> 1.3)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@@ -39,12 +47,24 @@ GEM
|
|||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
aescrypt (1.0.0)
|
aescrypt (1.0.0)
|
||||||
|
airbrussh (1.3.0)
|
||||||
|
sshkit (>= 1.6.1, != 1.7.0)
|
||||||
arel (8.0.0)
|
arel (8.0.0)
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
bindex (0.5.0)
|
bindex (0.5.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
byebug (9.1.0)
|
|
||||||
cancancan (1.17.0)
|
cancancan (1.17.0)
|
||||||
|
capistrano (3.10.1)
|
||||||
|
airbrussh (>= 1.0.0)
|
||||||
|
i18n
|
||||||
|
rake (>= 10.0.0)
|
||||||
|
sshkit (>= 1.9.0)
|
||||||
|
capistrano-bundler (1.3.0)
|
||||||
|
capistrano (~> 3.1)
|
||||||
|
sshkit (~> 1.2)
|
||||||
|
capistrano-rails (1.3.1)
|
||||||
|
capistrano (~> 3.1)
|
||||||
|
capistrano-bundler (~> 1.1)
|
||||||
carrierwave (1.2.1)
|
carrierwave (1.2.1)
|
||||||
activemodel (>= 4.0.0)
|
activemodel (>= 4.0.0)
|
||||||
activesupport (>= 4.0.0)
|
activesupport (>= 4.0.0)
|
||||||
@@ -61,7 +81,7 @@ GEM
|
|||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
connection_pool (2.2.1)
|
connection_pool (2.2.1)
|
||||||
crass (1.0.2)
|
crass (1.0.2)
|
||||||
cups (0.0.7)
|
cups (0.1.10)
|
||||||
database_cleaner (1.6.2)
|
database_cleaner (1.6.2)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
erubi (1.7.0)
|
erubi (1.7.0)
|
||||||
@@ -128,6 +148,9 @@ GEM
|
|||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
mysql2 (0.4.9)
|
mysql2 (0.4.9)
|
||||||
nested_form (0.3.2)
|
nested_form (0.3.2)
|
||||||
|
net-scp (1.2.1)
|
||||||
|
net-ssh (>= 2.6.5)
|
||||||
|
net-ssh (4.2.0)
|
||||||
nio4r (2.1.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.8.1)
|
nokogiri (1.8.1)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.3.0)
|
||||||
@@ -228,6 +251,9 @@ GEM
|
|||||||
actionpack (>= 4.0)
|
actionpack (>= 4.0)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
|
sshkit (1.15.1)
|
||||||
|
net-scp (>= 1.1.2)
|
||||||
|
net-ssh (>= 2.8.0)
|
||||||
tether-rails (1.4.0)
|
tether-rails (1.4.0)
|
||||||
rails (>= 3.1)
|
rails (>= 3.1)
|
||||||
thor (0.20.0)
|
thor (0.20.0)
|
||||||
@@ -260,12 +286,15 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
aescrypt
|
aescrypt
|
||||||
bcrypt (~> 3.1.7)
|
bcrypt (~> 3.1.7)
|
||||||
byebug
|
|
||||||
cancancan (~> 1.10)
|
cancancan (~> 1.10)
|
||||||
|
capistrano
|
||||||
|
capistrano-bundler
|
||||||
|
capistrano-rails
|
||||||
|
capistrano-rbenv!
|
||||||
carrierwave (~> 1.0)
|
carrierwave (~> 1.0)
|
||||||
chartkick
|
chartkick
|
||||||
coffee-rails (~> 4.2)
|
coffee-rails (~> 4.2)
|
||||||
cups (~> 0.0.7)
|
cups
|
||||||
database_cleaner
|
database_cleaner
|
||||||
factory_girl_rails (~> 4.0)
|
factory_girl_rails (~> 4.0)
|
||||||
faker
|
faker
|
||||||
@@ -306,5 +335,8 @@ DEPENDENCIES
|
|||||||
web-console (>= 3.3.0)
|
web-console (>= 3.3.0)
|
||||||
whenever
|
whenever
|
||||||
|
|
||||||
|
RUBY VERSION
|
||||||
|
ruby 2.4.1p111
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.16.0
|
1.16.1
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -31,7 +31,23 @@ ruby 2.4.1p111
|
|||||||
|
|
||||||
Campaign Id => {"campaign_type_id": 1}
|
Campaign Id => {"campaign_type_id": 1}
|
||||||
|
|
||||||
|
java -jar ~/Documents/Jade.jar http://192.168.1.88:3002
|
||||||
|
|
||||||
|
Person and Extra Time
|
||||||
|
category_code = SPL... //for menu categories
|
||||||
|
|
||||||
|
Extra Time
|
||||||
|
instance_code = Extim30, Extim60 //for morning menu
|
||||||
|
instance_code = Extie30, Extie60 //for evening menu
|
||||||
|
|
||||||
|
Order Item & Order Summary Slim
|
||||||
|
*** change OrderItemPdf to OrderItemSlimPdf and OrderSummaryPdf to OrderSummarySlimPdf
|
||||||
|
1) settings/print_settings
|
||||||
|
2) app/controllers/oqs/edit_controller.rb
|
||||||
|
3) app/controllers/oqs/print_controller.rb
|
||||||
|
4) app/models/order_queue_station.rb
|
||||||
|
5) app/models/printer/order_queue_printer.rb
|
||||||
|
6) app/models/printer/receipt_printer.rb
|
||||||
|
|
||||||
* ToDo list
|
* ToDo list
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ $(document).on('turbolinks:load', function() {
|
|||||||
if (data[field]["options"] == "[]" || data[field]["options"] == "") {
|
if (data[field]["options"] == "[]" || data[field]["options"] == "") {
|
||||||
var options = "";
|
var options = "";
|
||||||
}else{
|
}else{
|
||||||
var options = data.options;
|
var options = data[field]["options"];
|
||||||
}
|
}
|
||||||
|
|
||||||
var date = new Date(data[field]["created_at"]);
|
var date = new Date(data[field]["created_at"]);
|
||||||
@@ -80,7 +80,7 @@ $(document).on('turbolinks:load', function() {
|
|||||||
+'<span class="order-qty"> [x'+ data[field]["qty"] +'] </span>'
|
+'<span class="order-qty"> [x'+ data[field]["qty"] +'] </span>'
|
||||||
+'</p>'
|
+'</p>'
|
||||||
|
|
||||||
+'<p class="card-text item-options">'+ options +'</p>'
|
+'<br/><p class="card-text item-options">'+ options +'</p>'
|
||||||
|
|
||||||
+'<span class="card-text">'
|
+'<span class="card-text">'
|
||||||
+'<span class="text-muted">Order at - '
|
+'<span class="text-muted">Order at - '
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ $(function() {
|
|||||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||||
|
|
||||||
value = item_sets[field]["instances"];
|
value = item_sets[field]["instances"];
|
||||||
|
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@@ -241,6 +242,11 @@ $(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('.set-item').attr('data-code',instances[0]['code']);
|
||||||
|
$('.set-item').attr('data-name',instances[0]['name']);
|
||||||
|
$('.set-item').attr('data-price',instances[0]['price']);
|
||||||
|
$('.set-item').attr('data-options','[]');
|
||||||
|
|
||||||
$('#set_change_qty').val(1);
|
$('#set_change_qty').val(1);
|
||||||
$('#set_item_instances').text(instances);
|
$('#set_item_instances').text(instances);
|
||||||
$('#set_name').text(data.attr('data-name'));
|
$('#set_name').text(data.attr('data-name'));
|
||||||
@@ -313,6 +319,8 @@ $(function() {
|
|||||||
item_name = $('#set_name').text();
|
item_name = $('#set_name').text();
|
||||||
min_qty = $(this).data('min-qty');
|
min_qty = $(this).data('min-qty');
|
||||||
|
|
||||||
|
default_instance = $('.set-item');
|
||||||
|
|
||||||
var items = $('.selected-instance');
|
var items = $('.selected-instance');
|
||||||
|
|
||||||
if (items.length >= min_qty) {
|
if (items.length >= min_qty) {
|
||||||
@@ -342,6 +350,29 @@ $(function() {
|
|||||||
$(".summary-items tbody").append(row);
|
$(".summary-items tbody").append(row);
|
||||||
rowCount = rowCount + 1;
|
rowCount = rowCount + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
|
option_arr = []
|
||||||
|
code = $('.set-item').attr('data-code');
|
||||||
|
name = $('.set-item').attr('data-name');
|
||||||
|
price = $('.set-item').attr('data-price');
|
||||||
|
option = $('.set-item').attr('data-options');
|
||||||
|
total = qty * price ;
|
||||||
|
option_arr.push(option);
|
||||||
|
row ="<tr class='item_box' data-price ='"
|
||||||
|
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||||
|
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||||
|
+code+"' data-attributes='"
|
||||||
|
+attribute_arr+"' data-options ='"
|
||||||
|
+option_arr+"' data-row ='"+rowCount+ "'>"
|
||||||
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
|
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
||||||
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
|
+ parseFloat(total).toFixed(2)
|
||||||
|
+'</td>'
|
||||||
|
+'</tr>';
|
||||||
|
$(".summary-items tbody").append(row);
|
||||||
calculate_sub_total();
|
calculate_sub_total();
|
||||||
$(".sx_item_set_detailModal").css({ 'display': "none" });
|
$(".sx_item_set_detailModal").css({ 'display': "none" });
|
||||||
}else{
|
}else{
|
||||||
@@ -526,7 +557,7 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (active) {
|
if (active) {
|
||||||
$(this).revoveClass('selected-option');
|
$(this).removeClass('selected-option');
|
||||||
}else{
|
}else{
|
||||||
$(this).addClass('selected-option');
|
$(this).addClass('selected-option');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ App.checkin = App.cable.subscriptions.create('CheckInBookingChannel', {
|
|||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
|
if($('.table_'+data.table.id).hasClass('green')){
|
||||||
$('.table_'+data.table.id).removeClass('green');
|
$('.table_'+data.table.id).removeClass('green');
|
||||||
$('.table_'+data.table.id).addClass('blue');
|
$('.table_'+data.table.id).addClass('blue');
|
||||||
$('.new_text_'+data.table.id).removeClass('hide')
|
}
|
||||||
|
$('.new_text_'+data.table.id).removeClass('hide');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
|
|||||||
if (items[field]["options"] == "[]" || items[field]["options"] == "") {
|
if (items[field]["options"] == "[]" || items[field]["options"] == "") {
|
||||||
var options = "";
|
var options = "";
|
||||||
}else{
|
}else{
|
||||||
var options = items.options;
|
var options = items[field]["options"];
|
||||||
}
|
}
|
||||||
//for count
|
//for count
|
||||||
test = document.getElementsByClassName("oqs_count");
|
test = document.getElementsByClassName("oqs_count");
|
||||||
@@ -49,7 +49,7 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
|
|||||||
+'<span class="order-qty"> [x'+ items[field]["qty"] +'] </span>'
|
+'<span class="order-qty"> [x'+ items[field]["qty"] +'] </span>'
|
||||||
+'</p>'
|
+'</p>'
|
||||||
|
|
||||||
+'<p class="card-text item-options">'+ options +'</p>'
|
+'<br/><p class="card-text item-options">'+ options +'</p>'
|
||||||
|
|
||||||
+'<span class="card-text">'
|
+'<span class="card-text">'
|
||||||
+'<span class="text-muted">Order at - '
|
+'<span class="text-muted">Order at - '
|
||||||
|
|||||||
@@ -143,3 +143,55 @@ $(document).on('turbolinks:load', function() {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* start check first bill or not funs: */
|
||||||
|
function checkReceiptNoInFirstBillData(receipt_no,payment) {
|
||||||
|
// localStorage.removeItem('receipt_lists');
|
||||||
|
var status = false;
|
||||||
|
if((receipt_no!=undefined) && (receipt_no!="")){
|
||||||
|
if(localStorage.hasOwnProperty("receipt_lists")===true){
|
||||||
|
var arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||||
|
if (payment) {
|
||||||
|
var json_data = arr_data.filter(function(e) { return e.receipt_no == receipt_no });
|
||||||
|
}else{
|
||||||
|
var json_data = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||||
|
}
|
||||||
|
|
||||||
|
if((arr_data.length) > (json_data.length)){
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (payment) {
|
||||||
|
return json_data[0]["payment"];
|
||||||
|
}else{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createReceiptNoInFirstBillData(receipt_no,payment) {
|
||||||
|
var arr_data = [];
|
||||||
|
var json_data = [];
|
||||||
|
if(localStorage.hasOwnProperty("receipt_lists") === true){
|
||||||
|
arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||||
|
json_data = arr_data.filter(function(e) { return e.receipt_no == receipt_no });
|
||||||
|
if (payment) {
|
||||||
|
jdata = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||||
|
jdata.push({'receipt_no':receipt_no,'payment':payment});
|
||||||
|
localStorage.setItem("receipt_lists",JSON.stringify(jdata));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(((arr_data.length == 0) && (json_data.length == 0)) || ((arr_data.length > 0) && (json_data.length == 0))){
|
||||||
|
arr_data.push({'receipt_no':receipt_no,'payment':payment});
|
||||||
|
localStorage.setItem("receipt_lists",JSON.stringify(arr_data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteReceiptNoInFirstBillData(receipt_no) {
|
||||||
|
if(localStorage.hasOwnProperty("receipt_lists") ===true ){
|
||||||
|
var arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||||
|
var json_data = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||||
|
localStorage.setItem("receipt_lists",JSON.stringify(json_data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* end check first bill or not funs: */
|
||||||
@@ -6,6 +6,13 @@ class Api::CallWaitersController < ActionController::API
|
|||||||
@time = params[:time]
|
@time = params[:time]
|
||||||
@table = DiningFacility.find(@table_id)
|
@table = DiningFacility.find(@table_id)
|
||||||
CallWaiterJob.perform_later(@table,@time)
|
CallWaiterJob.perform_later(@table,@time)
|
||||||
|
|
||||||
|
# get printer info
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
unique_code = "CallWaiterPdf"
|
||||||
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
printer.print_call_waiter(print_settings,@table,@time,@shop)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,19 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||||
|
|
||||||
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time }
|
extra_minutes = (booking.checkout_at - booking.reserved_at) / 1.minutes
|
||||||
|
|
||||||
|
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||||
|
alert_time_min = 0
|
||||||
|
if !lookup_checkout_time.nil?
|
||||||
|
if lookup_checkout_time[0][0] == 'min'
|
||||||
|
alert_time_min = (lookup_checkout_time[0][1]).to_i
|
||||||
|
else
|
||||||
|
alert_time_min = 15
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes }
|
||||||
else
|
else
|
||||||
render :json => { :status => false, :error_message => "No current booking!" }
|
render :json => { :status => false, :error_message => "No current booking!" }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -49,7 +49,25 @@ class Api::OrdersController < Api::ApiController
|
|||||||
def create
|
def create
|
||||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||||
|
#for extratime
|
||||||
|
is_extra_time = false
|
||||||
|
extra_time = ''
|
||||||
|
|
||||||
|
params[:order_items].each { |i|
|
||||||
|
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30'
|
||||||
|
is_extra_time = true
|
||||||
|
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
||||||
|
t = Time.now
|
||||||
|
time = 30*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
|
else
|
||||||
|
t = Time.now
|
||||||
|
time = 60*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
#end extra time
|
||||||
# begin
|
# begin
|
||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@@ -61,6 +79,9 @@ class Api::OrdersController < Api::ApiController
|
|||||||
@order.new_booking = true
|
@order.new_booking = true
|
||||||
@order.waiters = current_login_employee.name
|
@order.waiters = current_login_employee.name
|
||||||
@order.employee_name = current_login_employee.name
|
@order.employee_name = current_login_employee.name
|
||||||
|
|
||||||
|
@order.is_extra_time = is_extra_time
|
||||||
|
@order.extra_time = extra_time
|
||||||
#Create Table Booking or Room Booking
|
#Create Table Booking or Room Booking
|
||||||
if !params["booking_id"].nil?
|
if !params["booking_id"].nil?
|
||||||
# check booking id is already completed.
|
# check booking id is already completed.
|
||||||
|
|||||||
@@ -38,19 +38,23 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# check for license file
|
# check for license file
|
||||||
if check_license
|
# if check_license
|
||||||
current_license(ENV["SX_PROVISION_URL"])
|
# current_license(ENV["SX_PROVISION_URL"])
|
||||||
end
|
# else
|
||||||
|
# redirect_to activate_path
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_license(url)
|
def current_license(url)
|
||||||
@license = License.new(url)
|
@license = License.new(url)
|
||||||
|
flag = @license.detail_with_local_file()
|
||||||
if (@license.detail_with_local_file() == true)
|
if (flag == 0)
|
||||||
puts "RUN SAY BYAR"
|
flash[:notice] = 'Expired or No License!'
|
||||||
|
elsif (flag == 2)
|
||||||
|
flash[:notice] = 'Expiring! Please, License extend...'
|
||||||
else
|
else
|
||||||
return nil
|
puts "RUN SAY BYAR"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -107,9 +111,8 @@ class ApplicationController < ActionController::Base
|
|||||||
def check_license
|
def check_license
|
||||||
if License.check_license_file
|
if License.check_license_file
|
||||||
return true
|
return true
|
||||||
else
|
|
||||||
redirect_to activate_path
|
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class BaseController < ActionController::Base
|
class BaseController < ActionController::Base
|
||||||
layout "installation"
|
layout "installation"
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
@count_customer = Customer.count_customer
|
@count_customer = Customer.count_customer
|
||||||
|
|
||||||
|
@membership_types = Lookup.collection_of("member_group_type")
|
||||||
|
|
||||||
@taxes = TaxProfile.all.order("order_by asc")
|
@taxes = TaxProfile.all.order("order_by asc")
|
||||||
|
|
||||||
@filter = filter
|
@filter = filter
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ class HomeController < ApplicationController
|
|||||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@employees = Employee.all_emp_except_waiter.order("name asc")
|
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
||||||
|
@employees = Employee.all.order("name asc")
|
||||||
@login_form = LoginForm.new()
|
@login_form = LoginForm.new()
|
||||||
render "layouts/login_dashboard", layout: false
|
render "layouts/login_dashboard", layout: false
|
||||||
end
|
end
|
||||||
@@ -45,7 +46,7 @@ class HomeController < ApplicationController
|
|||||||
elsif @employee.role == "manager"
|
elsif @employee.role == "manager"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
elsif @employee.role == "supervisor"
|
elsif @employee.role == "supervisor" || @employee.role == "waiter"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to origami_root_path
|
redirect_to origami_root_path
|
||||||
elsif @employee.role == "account"
|
elsif @employee.role == "account"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class InstallController < BaseController
|
class InstallController < BaseController
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
||||||
before_action :check_license
|
# before_action :check_license
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
@@ -20,17 +20,17 @@ class InstallController < BaseController
|
|||||||
phrase = license_key
|
phrase = license_key
|
||||||
|
|
||||||
# Check Exists IV
|
# Check Exists IV
|
||||||
if flag == "<%= ENV['AES_IV'] %>"
|
# if flag == "<%= ENV['AES_IV'] %>"
|
||||||
# Export for Key
|
# # Export for Key
|
||||||
aes = MyAesCrypt.new
|
# aes = MyAesCrypt.new
|
||||||
aes_key, aes_iv = aes.export_key(phrase)
|
# aes_key, aes_iv = aes.export_key(phrase)
|
||||||
else
|
# else
|
||||||
aes_key = ENV["AES_KEY"]
|
# aes_key = ENV["AES_KEY"]
|
||||||
aes_iv = ENV["AES_IV"]
|
# aes_iv = ENV["AES_IV"]
|
||||||
end
|
# end
|
||||||
|
|
||||||
@license = License.new(ENV["SX_PROVISION_URL"])
|
@license = License.new(ENV["SX_PROVISION_URL"])
|
||||||
response = @license.license_activate(aes_key, aes_iv, license_key, db_host, db_schema, db_user, db_password)
|
response = @license.license_activate(restaurant, license_key, db_host, db_schema, db_user, db_password)
|
||||||
if response[:status]
|
if response[:status]
|
||||||
redirect_to root_url, notice: response["message"]
|
redirect_to root_url, notice: response["message"]
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -62,9 +62,21 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||||
puts params[:order_items]
|
is_extra_time = false
|
||||||
|
extra_time = ''
|
||||||
|
|
||||||
items_arr = []
|
items_arr = []
|
||||||
JSON.parse(params[:order_items]).each { |i|
|
JSON.parse(params[:order_items]).each { |i|
|
||||||
|
if i["item_instance_code"] == 'Extim60' || i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie60' || i["item_instance_code"] == 'Extie30'
|
||||||
|
is_extra_time = true
|
||||||
|
if i["item_instance_code"] == 'Extim30' || i["item_instance_code"] == 'Extie30'
|
||||||
|
time = 30*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
|
else
|
||||||
|
time = 60*60*i["quantity"].to_i
|
||||||
|
extra_time = Time.at(time)
|
||||||
|
end
|
||||||
|
end
|
||||||
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": i["options"]}
|
||||||
items_arr.push(items)
|
items_arr.push(items)
|
||||||
}
|
}
|
||||||
@@ -80,16 +92,18 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
|||||||
@order.new_booking = true
|
@order.new_booking = true
|
||||||
@order.waiters = current_login_employee.name
|
@order.waiters = current_login_employee.name
|
||||||
@order.employee_name = current_login_employee.name
|
@order.employee_name = current_login_employee.name
|
||||||
|
|
||||||
|
@order.is_extra_time = is_extra_time
|
||||||
|
@order.extra_time = extra_time
|
||||||
#Create Table Booking or Room Booking
|
#Create Table Booking or Room Booking
|
||||||
if !params["booking_id"].nil?
|
if !params["booking_id"].nil?
|
||||||
# check booking id is already completed.
|
# check booking id is already completed.
|
||||||
booking = Booking.find(params[:booking_id])
|
booking = Booking.find(params[:booking_id])
|
||||||
|
|
||||||
if booking
|
if booking
|
||||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||||
if !booking.sale_id.nil?
|
if !booking.sale_id.nil?
|
||||||
sale_status = check_order_with_booking(booking)
|
sale_status = check_order_with_booking(booking)
|
||||||
# puts "WWwwWWWWWWww"
|
|
||||||
# puts sale_status
|
|
||||||
if sale_status
|
if sale_status
|
||||||
return return_json_status_with_code(400, "bill requested")
|
return return_json_status_with_code(400, "bill requested")
|
||||||
end
|
end
|
||||||
@@ -99,8 +113,6 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
sale_status = check_order_with_table(params[:table_id])
|
||||||
# puts "OOOOOOOOO"
|
|
||||||
# puts sale_status
|
|
||||||
if sale_status
|
if sale_status
|
||||||
return return_json_status_with_code(400, "bill requested")
|
return return_json_status_with_code(400, "bill requested")
|
||||||
end
|
end
|
||||||
@@ -108,8 +120,6 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
|||||||
end #booking exists
|
end #booking exists
|
||||||
else
|
else
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
sale_status = check_order_with_table(params[:table_id])
|
||||||
# puts "MMMMMMMM"
|
|
||||||
# puts sale_status
|
|
||||||
if sale_status
|
if sale_status
|
||||||
# return false , @message = "bill requested"
|
# return false , @message = "bill requested"
|
||||||
return return_json_status_with_code(400, "bill requested")
|
return return_json_status_with_code(400, "bill requested")
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
# if flash["errors"]
|
# if flash["errors"]
|
||||||
# @crm_customer.valid?
|
# @crm_customer.valid?
|
||||||
# end
|
# end
|
||||||
|
@membership_types = Lookup.collection_of("member_group_type")
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
# format.html { render :template => "crm/customers/index" }
|
# format.html { render :template => "crm/customers/index" }
|
||||||
|
|||||||
@@ -157,7 +157,11 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
is_card = params[:is_card]
|
is_card = params[:is_card]
|
||||||
sub_total = params[:sub_total]
|
sub_total = params[:sub_total]
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
|
if is_card == 'true'
|
||||||
|
is_card = true
|
||||||
|
else is_card.to_s == 'false'
|
||||||
|
is_card = false
|
||||||
|
end
|
||||||
# Check for Card Payment
|
# Check for Card Payment
|
||||||
is_card_payment = SalePayment.get_sale_payments_by_card(sale.sale_payments)
|
is_card_payment = SalePayment.get_sale_payments_by_card(sale.sale_payments)
|
||||||
|
|
||||||
@@ -178,9 +182,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
generic_customer_id = sale.customer.membership_id
|
generic_customer_id = sale.customer.membership_id
|
||||||
account_no = sale.customer.paypar_account_no
|
|
||||||
receipt_no = sale.receipt_no
|
receipt_no = sale.receipt_no
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
memberaction = MembershipAction.find_by_membership_type("member_discount")
|
memberaction = MembershipAction.find_by_membership_type("member_discount")
|
||||||
@@ -188,12 +190,13 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
account_no = sale.customer.paypar_account_no rescue nil
|
||||||
|
|
||||||
# Check for items for Paypar Cloud
|
# Check for items for Paypar Cloud
|
||||||
if acc_prices.length > 0
|
if acc_prices.length > 0
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => { account_no: nil,
|
:body => { account_no: account_no,
|
||||||
generic_customer_id:generic_customer_id ,
|
generic_customer_id:generic_customer_id ,
|
||||||
campaign_type_id: campaign_type_id,
|
campaign_type_id: campaign_type_id,
|
||||||
receipt_no: receipt_no,
|
receipt_no: receipt_no,
|
||||||
@@ -220,8 +223,8 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
response = {"status": false, "message": "You have no selected discount item" }
|
response = {"status": false, "message": "You have no selected discount item" }
|
||||||
end
|
end
|
||||||
puts "discountttttttttttt"
|
Rails.logger.debug "-------------- Member Discount Osaka ---------"
|
||||||
puts response.to_json
|
Rails.logger.debug response.to_json
|
||||||
# Re-calc All Amount in Sale
|
# Re-calc All Amount in Sale
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
discount_amount = response["discount_earned"]
|
discount_amount = response["discount_earned"]
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@status_sale = ""
|
@status_sale = ""
|
||||||
@sale_array = Array.new
|
@sale_array = Array.new
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@membership = MembershipSetting::MembershipSetting
|
||||||
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
@dining.bookings.active.each do |booking|
|
@dining.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class Origami::OthersPaymentsController < BaseOrigamiController
|
|||||||
@payment_method_setting = PaymentMethodSetting.all
|
@payment_method_setting = PaymentMethodSetting.all
|
||||||
|
|
||||||
@rebate = MembershipSetting.find_by_rebate(1)
|
@rebate = MembershipSetting.find_by_rebate(1)
|
||||||
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
# @sale_id = params[:sale_id]
|
# @sale_id = params[:sale_id]
|
||||||
# sale_data = Sale.find_by_sale_id(@sale_id)
|
# sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
# Print for First Bill to Customer
|
# Print for First Bill to Customer
|
||||||
|
<<<<<<< HEAD
|
||||||
# unique_code = "ReceiptBillPdf"
|
# unique_code = "ReceiptBillPdf"
|
||||||
# #shop detail
|
# #shop detail
|
||||||
# shop_details = Shop::ShopDetail
|
# shop_details = Shop::ShopDetail
|
||||||
@@ -45,6 +46,48 @@ 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")
|
# 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")
|
||||||
|
=======
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
#shop detail
|
||||||
|
shop_details = Shop::ShopDetail
|
||||||
|
# customer= Customer.where('customer_id=' +.customer_id)
|
||||||
|
customer = Customer.find(sale_data.customer_id)
|
||||||
|
|
||||||
|
# rounding adjustment
|
||||||
|
if shop_details.is_rounding_adj
|
||||||
|
a = sale_data.grand_total % 25 # Modulus
|
||||||
|
b = sale_data.grand_total / 25 # Division
|
||||||
|
#not calculate rounding if modulus is 0 and division is even
|
||||||
|
#calculate rounding if modulus is zero or not zero and division are not even
|
||||||
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
rounding_adj = new_total-sale_data.grand_total
|
||||||
|
sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#end rounding adjustment
|
||||||
|
|
||||||
|
# get member information
|
||||||
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
|
if customer.membership_id != nil && rebate
|
||||||
|
member_info = Customer.get_member_account(customer)
|
||||||
|
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||||
|
current_balance = 0
|
||||||
|
end
|
||||||
|
# get printer info
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# find order id by sale id
|
||||||
|
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||||
|
|
||||||
|
# Calculate price_by_accounts
|
||||||
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale_items)
|
||||||
|
|
||||||
|
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)
|
||||||
|
>>>>>>> master
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@@ -58,10 +101,16 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
|
b = saleObj.grand_total / 25 # Division
|
||||||
|
#not calculate rounding if modulus is 0 and division is even
|
||||||
|
#calculate rounding if modulus is zero or not zero and division are not even
|
||||||
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
rounding_adj = new_total-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)
|
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
@@ -234,6 +283,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
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"
|
||||||
|
saleObj.update_attributes(rounding_adjustment: 0)
|
||||||
|
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0)
|
||||||
|
end
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
||||||
|
|
||||||
@@ -280,14 +335,15 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@shop = Shop.find_by_id(1)
|
@shop = Shop.find_by_id(1)
|
||||||
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
|
b = saleObj.grand_total / 25 # Division
|
||||||
|
#not calculate rounding if modulus is 0 and division is even
|
||||||
|
#calculate rounding if modulus is zero or not zero and division are not even
|
||||||
|
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
else
|
|
||||||
new_total = saleObj.grand_total
|
|
||||||
end
|
|
||||||
|
|
||||||
rounding_adj = new_total-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)
|
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -19,6 +19,10 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@status_sale = ""
|
@status_sale = ""
|
||||||
@sale_array = Array.new
|
@sale_array = Array.new
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
@membership = MembershipSetting::MembershipSetting
|
||||||
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
@room.bookings.active.each do |booking|
|
@room.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
|
|||||||
@@ -15,9 +15,14 @@ class Origami::SalesController < BaseOrigamiController
|
|||||||
dining = params[:dining_id]
|
dining = params[:dining_id]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
table = DiningFacility.find(dining)
|
table = DiningFacility.find(dining)
|
||||||
|
existing_booking = Booking.find_by_sale_id(sale_id)
|
||||||
table.bookings.each do |booking|
|
table.bookings.each do |booking|
|
||||||
|
# if !booking.checkout_at.nil?
|
||||||
|
# existing_booking.update_attributes(checkout_at: checkout_at)
|
||||||
|
# end
|
||||||
if booking.sale_id.nil?
|
if booking.sale_id.nil?
|
||||||
booking.booking_orders.each do |booking_order|
|
booking.booking_orders.each do |booking_order|
|
||||||
|
|
||||||
booking.booking_status = 'moved'
|
booking.booking_status = 'moved'
|
||||||
order = Order.find(booking_order.order_id)
|
order = Order.find(booking_order.order_id)
|
||||||
order.status = 'billed'
|
order.status = 'billed'
|
||||||
@@ -36,7 +41,7 @@ class Origami::SalesController < BaseOrigamiController
|
|||||||
order.save
|
order.save
|
||||||
booking.save
|
booking.save
|
||||||
end
|
end
|
||||||
existing_booking = Booking.find_by_sale_id(sale_id)
|
|
||||||
booking_order = BookingOrder.where('booking_id=?',booking)
|
booking_order = BookingOrder.where('booking_id=?',booking)
|
||||||
booking_order.each do |bo|
|
booking_order.each do |bo|
|
||||||
bo.booking_id = existing_booking.booking_id
|
bo.booking_id = existing_booking.booking_id
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find_by_sale_id(sale_id)
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
|
if sale.discount_type == "member_discount"
|
||||||
|
sale.update_attributes(total_discount: 0)
|
||||||
|
sale.compute_by_sale_items(sale_id, sale.sale_items,0)
|
||||||
|
end
|
||||||
|
|
||||||
# update count for shift sale
|
# update count for shift sale
|
||||||
if(sale.sale_status == "completed")
|
if(sale.sale_status == "completed")
|
||||||
@@ -38,12 +42,14 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
table_avaliable = true
|
table_avaliable = true
|
||||||
table = sale.bookings[0].dining_facility
|
table = sale.bookings[0].dining_facility
|
||||||
table.bookings.each do |booking|
|
table.bookings.each do |booking|
|
||||||
|
if !booking.sale.nil?
|
||||||
if booking.sale.sale_status == 'new'
|
if booking.sale.sale_status == 'new'
|
||||||
table_avaliable = false
|
table_avaliable = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if table_avaliable == true
|
if table_avaliable
|
||||||
table.status = 'available'
|
table.status = 'available'
|
||||||
table.save
|
table.save
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ class Reports::CommissionController < BaseReportController
|
|||||||
|
|
||||||
@from = from_date
|
@from = from_date
|
||||||
@to = to_date
|
@to = to_date
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.xls
|
format.xls
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ authorize_resource :class => false
|
|||||||
|
|
||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
if @shift.present?
|
if @shift.present?
|
||||||
@shift.each do |sh|
|
@shift.each do |sh|
|
||||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ class Reports::DailysaleController < BaseReportController
|
|||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.xls
|
format.xls
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ class Reports::PaymentMethodController < BaseReportController
|
|||||||
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
|
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
|
||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
if @shift.present?
|
if @shift.present?
|
||||||
@shift.each do |sh|
|
@shift.each do |sh|
|
||||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ authorize_resource :class => false
|
|||||||
@tax_profiles = TaxProfile.order('order_by asc')
|
@tax_profiles = TaxProfile.order('order_by asc')
|
||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
if @shift.present?
|
if @shift.present?
|
||||||
@shift.each do |sh|
|
@shift.each do |sh|
|
||||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
|
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
|
||||||
|
|
||||||
@menu_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
@menu_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@sale_data.each {|cate| @menu_cate_count[cate.menu_category_id] += 1}
|
@sale_data.each {|cate| @menu_cate_count[cate.account_id] += 1}
|
||||||
|
|
||||||
|
|
||||||
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@@ -34,6 +34,9 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
|
|
||||||
if shift.present?
|
if shift.present?
|
||||||
shift.each do |sh|
|
shift.each do |sh|
|
||||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
@@ -64,6 +67,9 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
date_arr.push(str)
|
date_arr.push(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||||
|
@sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
||||||
|
|
||||||
out = {:status => 'ok', :message => date_arr}
|
out = {:status => 'ok', :message => date_arr}
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ class Reports::ShiftsaleController < BaseReportController
|
|||||||
@shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
@shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
@shift_data = @shift
|
@shift_data = @shift
|
||||||
end
|
end
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.xls
|
format.xls
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ class Reports::StockCheckController < BaseReportController
|
|||||||
@transaction = StockCheckItem.get_transaction(from_date, to_date, @item_code)
|
@transaction = StockCheckItem.get_transaction(from_date, to_date, @item_code)
|
||||||
@from = from_date
|
@from = from_date
|
||||||
@to = to_date
|
@to = to_date
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.xls
|
format.xls
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ authorize_resource :class => false
|
|||||||
|
|
||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
# get printer info
|
||||||
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
if @shift.present?
|
if @shift.present?
|
||||||
@shift.each do |sh|
|
@shift.each do |sh|
|
||||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
|||||||
35
app/controllers/sym_control_controller.rb
Normal file
35
app/controllers/sym_control_controller.rb
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
class SymControlController < BaseController
|
||||||
|
skip_before_action :verify_authenticity_token
|
||||||
|
|
||||||
|
def run
|
||||||
|
sym_path = "/home/yan/symmetric/"
|
||||||
|
check_sym_proc_str = `#{"service SymmetricDS status"}`
|
||||||
|
# Check Sym Installed
|
||||||
|
# if sym_install_status[1] == "false"
|
||||||
|
# response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"}
|
||||||
|
# end
|
||||||
|
|
||||||
|
if check_sym_proc_str.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running"
|
||||||
|
# Create Sym Table
|
||||||
|
check_sym_table = system(sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||||
|
if check_sym_table
|
||||||
|
sym_sql = Rails.root + "db/sym_master.sql"
|
||||||
|
|
||||||
|
if File.exist? (sym_sql)
|
||||||
|
# Import Sym Sql to db and start sym
|
||||||
|
run_sym_sql = system(sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
||||||
|
stop_sym = system("service SymmetricDS stop")
|
||||||
|
run_sym = system("service SymmetricDS start")
|
||||||
|
if run_sym
|
||||||
|
render :text => "<h1>Success!</h1>"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render :text => "<h1>Sym Sql file not found!</h1>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render :text => "<h1>Sym not running!</h1>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -58,6 +58,7 @@ class Ability
|
|||||||
can :create, :discount
|
can :create, :discount
|
||||||
can :remove_discount_items, :discount
|
can :remove_discount_items, :discount
|
||||||
can :remove_all_discount, :discount
|
can :remove_all_discount, :discount
|
||||||
|
can :member_discount, :discount
|
||||||
|
|
||||||
can :first_bill, :payment
|
can :first_bill, :payment
|
||||||
can :show, :payment
|
can :show, :payment
|
||||||
|
|||||||
@@ -146,8 +146,8 @@ class Customer < ApplicationRecord
|
|||||||
if sale.customer.membership_id
|
if sale.customer.membership_id
|
||||||
response = self.rebat(Sale.find(sale.sale_id))
|
response = self.rebat(Sale.find(sale.sale_id))
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.received_amount} "
|
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.amount_received} "
|
||||||
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, "CronJob")
|
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, 1)
|
||||||
|
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
status = sale.update_attributes(rebate_status: "true")
|
status = sale.update_attributes(rebate_status: "true")
|
||||||
@@ -157,29 +157,96 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.rebat(sObj)
|
def self.rebat(sObj)
|
||||||
rebate_prices = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
||||||
|
|
||||||
generic_customer_id = sObj.customer.membership_id
|
generic_customer_id = sObj.customer.membership_id
|
||||||
if generic_customer_id.present?
|
if generic_customer_id.present?
|
||||||
|
|
||||||
paypar = sObj.sale_payments
|
paypar = sObj.sale_payments
|
||||||
payparcost = 0
|
payparcost = 0
|
||||||
credit = 0
|
credit = 0
|
||||||
|
|
||||||
paypar.each do |pp|
|
paypar.each do |pp|
|
||||||
if pp.payment_method == "paypar"
|
if pp.payment_method == "paypar"
|
||||||
payparcost = payparcost + pp.payment_amount
|
payparcost = payparcost + pp.payment_amount
|
||||||
elsif pp.payment_method == "creditnote"
|
end
|
||||||
|
if pp.payment_method == "creditnote"
|
||||||
credit = 1
|
credit = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||||
overall_dis = sObj.total_discount
|
overall_dis = sObj.total_discount
|
||||||
|
|
||||||
|
if credit != 1
|
||||||
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
|
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
|
||||||
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
|
auth_token = memberaction.auth_token.to_s
|
||||||
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
|
# Control for Paypar Cloud
|
||||||
|
begin
|
||||||
|
response = HTTParty.get(url,
|
||||||
|
:body => {
|
||||||
|
member_group_id:sObj.customer.membership_type,
|
||||||
|
merchant_uid:merchant_uid,
|
||||||
|
campaign_type_id: campaign_type_id,
|
||||||
|
auth_token:auth_token
|
||||||
|
}.to_json,
|
||||||
|
:headers => {
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json; version=2'
|
||||||
|
}, :timeout => 10)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { "status": false , "message": "Connect To" }
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
end
|
||||||
|
|
||||||
|
redeem_amount = payparcost + overall_dis
|
||||||
|
|
||||||
|
total_percentage = 0
|
||||||
|
|
||||||
|
type_arr = []
|
||||||
|
Rails.logger.debug "Get Member Campaign"
|
||||||
|
Rails.logger.debug response.to_json
|
||||||
|
# Check for present response fields
|
||||||
|
if response["membership_campaign_data"].present?
|
||||||
|
response["membership_campaign_data"].each do |a|
|
||||||
|
data = {:type => a["rules_type"], :percentage => a["change_unit"].to_i * a["base_unit"].to_i}
|
||||||
|
total_percentage = total_percentage + a["change_unit"].to_i * a["base_unit"].to_i
|
||||||
|
|
||||||
|
type_arr.push(data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rebate_arr =[]
|
||||||
|
campaign_method.each do |a|
|
||||||
|
data = {:type => a[:type], :amount => a[:amount]}
|
||||||
|
type_arr.each do |si|
|
||||||
|
if si[:type] == a[:type]
|
||||||
|
if credit == 1
|
||||||
|
data[:amount] = 0
|
||||||
|
else
|
||||||
|
amount = (redeem_amount / total_percentage)*si[:percentage]
|
||||||
|
actual = a[:amount] - amount
|
||||||
|
data[:amount] = actual
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rebate_arr.push(data)
|
||||||
|
end
|
||||||
|
|
||||||
total_amount = rebate_prices - payparcost - overall_dis
|
total_amount = rebate_prices - payparcost - overall_dis
|
||||||
|
|
||||||
if credit == 1
|
if credit == 1
|
||||||
total_amount = 0
|
total_amount = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if total_amount >= 0
|
if total_amount >= 0
|
||||||
receipt_no = sObj.receipt_no
|
receipt_no = sObj.receipt_no
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
@@ -191,33 +258,37 @@ class Customer < ApplicationRecord
|
|||||||
|
|
||||||
# Control for Paypar Cloud
|
# Control for Paypar Cloud
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,
|
response = HTTParty.post(url,
|
||||||
|
:body => {
|
||||||
|
generic_customer_id:generic_customer_id ,
|
||||||
total_sale_transaction_amount: sObj.grand_total,
|
total_sale_transaction_amount: sObj.grand_total,
|
||||||
merchant_uid:merchant_uid,
|
merchant_uid:merchant_uid,
|
||||||
total_amount: total_amount,
|
total_amount: total_amount,
|
||||||
campaign_type_id: campaign_type_id,
|
campaign_type_id: campaign_type_id,
|
||||||
receipt_no: receipt_no,
|
receipt_no: receipt_no,
|
||||||
auth_token:auth_token}.to_json,
|
campaign_method: rebate_arr.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=2'
|
||||||
}, :timeout => 10)
|
}, :timeout => 10)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { "status": false , "message": "Connect To" }
|
response = { "status": false , "message": "Connect To" }
|
||||||
|
|
||||||
|
|
||||||
rescue OpenURI::HTTPError
|
rescue OpenURI::HTTPError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
end
|
end
|
||||||
return response
|
Rails.logger.debug "Rebage Response"
|
||||||
Rails.logger.debug "--------Update Rebate response -------"
|
|
||||||
Rails.logger.debug response.to_json
|
Rails.logger.debug response.to_json
|
||||||
|
return response
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
response = { "status": "no_member", "message": "Not membership"}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.search_paypar_account_no(account_no)
|
def self.search_paypar_account_no(account_no)
|
||||||
|
|||||||
@@ -69,21 +69,53 @@ class License
|
|||||||
|
|
||||||
# For Local System
|
# For Local System
|
||||||
def detail_with_local_file()
|
def detail_with_local_file()
|
||||||
has_license = true # verify_license()
|
renewal_date_str = read_license("renewable_date")
|
||||||
|
|
||||||
|
if check_expiring(renewal_date_str)
|
||||||
|
# return for all ok
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
has_license = verify_license()
|
||||||
|
|
||||||
if has_license
|
if has_license
|
||||||
puts "VERIFIED"
|
# return for expiring
|
||||||
|
return 2
|
||||||
|
else
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
# License Activation
|
# License Activation
|
||||||
def license_activate (key, iv, license_key, db_host, db_schema, db_user, db_password)
|
def license_activate (shop, license_key, db_host, db_schema, db_user, db_password)
|
||||||
@params = { query: { lookup_type: self.server_mode, iv_key: iv, license_key: license_key } }
|
aes = MyAesCrypt.new
|
||||||
|
aes_key, aes_iv = aes.export_key(license_key)
|
||||||
|
|
||||||
|
@params = { query: { lookup_type: self.server_mode, iv_key: aes_iv, license_key: license_key } }
|
||||||
response = self.class.get("/activate", @params)
|
response = self.class.get("/activate", @params)
|
||||||
@activate = response.parsed_response
|
@activate = response.parsed_response
|
||||||
|
|
||||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
|
||||||
if (@activate["status"])
|
if (@activate["status"])
|
||||||
|
##Check from local redis - if available load local otherwise get from remote
|
||||||
|
cache_key = "shop:#{@activate["shop_name"]}"
|
||||||
|
|
||||||
|
cache_license = nil
|
||||||
|
|
||||||
|
##Get redis connection from connection pool
|
||||||
|
redis = Redis.new
|
||||||
|
cache_license = redis.get(cache_key)
|
||||||
|
|
||||||
|
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||||
|
|
||||||
|
if cache_license.nil?
|
||||||
|
cache = {"shop" => @activate["shop_name"], "key" => aes_key, "iv" => @activate["iv_key"], "renewable_date" => @activate["renewable_date"] }
|
||||||
|
redis = Redis.new
|
||||||
|
redis.set(cache_key, Marshal.dump(cache))
|
||||||
|
end
|
||||||
|
|
||||||
|
Rails.logger.info "License - " + response.parsed_response.to_s
|
||||||
|
|
||||||
response = create_license_file(@activate)
|
response = create_license_file(@activate)
|
||||||
if(response[:status])
|
if(response[:status])
|
||||||
sym_path = "/home/yan/symmetric/"
|
sym_path = "/home/yan/symmetric/"
|
||||||
@@ -115,9 +147,23 @@ class License
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check Expired before 30 days
|
||||||
|
def check_expiring(renewal_date_str)
|
||||||
|
if !renewal_date_str.empty?
|
||||||
|
renewal_date = DateTime.parse(renewal_date_str)
|
||||||
|
renewal_date > Date.today.advance(:days => 30)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Check License expired date from PROVISION SERVER
|
# Check License expired date from PROVISION SERVER
|
||||||
def check_expired(renewal_date_str)
|
def check_expired(renewal_date_str)
|
||||||
|
expired_date_str = read_license("renewable_date")
|
||||||
renewal_date = DateTime.parse(renewal_date_str)
|
renewal_date = DateTime.parse(renewal_date_str)
|
||||||
|
|
||||||
|
if(renewal_date_str != expired_date_str)
|
||||||
|
update_license("renewable_date", renewal_date_str)
|
||||||
|
end
|
||||||
|
|
||||||
if (renewal_date < Date.today)
|
if (renewal_date < Date.today)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -131,13 +177,15 @@ class License
|
|||||||
end
|
end
|
||||||
|
|
||||||
# read line by key for license file
|
# read line by key for license file
|
||||||
def read_license(key)
|
def read_license(key_name)
|
||||||
decrypted_line = ""
|
decrypted_line = ""
|
||||||
|
key, iv = get_redis_key()
|
||||||
|
|
||||||
if File.exist?("config/license.yml")
|
if File.exist?("config/license.yml")
|
||||||
File.open("config/license.yml").each do |line|
|
File.open("config/license.yml").each do |line|
|
||||||
if line.include? (key)
|
if line.include? (key_name)
|
||||||
decrypted_line_array = line.split(": ")
|
decrypted_line_array = line.split(": ")
|
||||||
decrypted_line = AESCrypt.decrypt_data(decode_str(decrypted_line_array[1]), decode_str(ENV['AES_KEY']), decode_str(ENV['AES_IV']), ENV['CIPHER_TYPE'])
|
decrypted_line = AESCrypt.decrypt_data(decode_str(decrypted_line_array[1]), decode_str(key), decode_str(iv), ENV['CIPHER_TYPE'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -158,7 +206,54 @@ class License
|
|||||||
return decrypted_line
|
return decrypted_line
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Update license file for line
|
||||||
|
def update_license(content, new_content)
|
||||||
|
key, iv = get_redis_key()
|
||||||
|
|
||||||
|
if !new_content.include? "=="
|
||||||
|
crypted_str = AESCrypt.encrypt_data(new_content, decode_str(key), decode_str(iv), ENV['CIPHER_TYPE'])
|
||||||
|
end
|
||||||
|
|
||||||
|
content_str = read_license_no_decrypt(content)
|
||||||
|
if File.exist?("config/license.yml")
|
||||||
|
file_str = File.read("config/license.yml")
|
||||||
|
new_file_str = file_str.gsub(content_str, encode_str(crypted_str))
|
||||||
|
|
||||||
|
# To write changes to the file, use:
|
||||||
|
File.open("config/license.yml", "w") {|file| file.puts new_file_str }
|
||||||
|
|
||||||
|
# File.open("config/license.yml").each do |line|
|
||||||
|
# new_file_str = line.gsub(content, crypted_str)
|
||||||
|
# f.put
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
def get_redis_key
|
||||||
|
iv = ""
|
||||||
|
key = ""
|
||||||
|
shop = read_license_no_decrypt("shop_name")
|
||||||
|
##Check from local redis - if available load local otherwise get from remote
|
||||||
|
cache_key = "shop:#{shop.chomp}"
|
||||||
|
|
||||||
|
cache_shop = nil
|
||||||
|
|
||||||
|
##Get redis connection from connection pool
|
||||||
|
redis = Redis.new
|
||||||
|
cache_shop = redis.get(cache_key)
|
||||||
|
|
||||||
|
if !cache_shop.nil?
|
||||||
|
@shop = Marshal.load(cache_shop)
|
||||||
|
key = @shop["key"]
|
||||||
|
iv = @shop["iv"]
|
||||||
|
end
|
||||||
|
return key, iv
|
||||||
|
end
|
||||||
|
|
||||||
|
def encode_str(str)
|
||||||
|
return Base64.encode64(str)
|
||||||
|
end
|
||||||
|
|
||||||
def decode_str(str)
|
def decode_str(str)
|
||||||
return Base64.decode64(str)
|
return Base64.decode64(str)
|
||||||
@@ -185,6 +280,9 @@ class License
|
|||||||
f.puts("dbpassword: #{response_data['dbpassword']}")
|
f.puts("dbpassword: #{response_data['dbpassword']}")
|
||||||
f.puts("api_token: #{response_data['api_token']}")
|
f.puts("api_token: #{response_data['api_token']}")
|
||||||
f.puts("app_token: #{response_data['app_token']}")
|
f.puts("app_token: #{response_data['app_token']}")
|
||||||
|
f.puts("plan_sku: #{response_data['plan_sku']}")
|
||||||
|
f.puts("renewable_date: #{response_data['renewable_date']}")
|
||||||
|
f.puts("plan_name: #{response_data['plan_name']}")
|
||||||
end
|
end
|
||||||
rescue IOError
|
rescue IOError
|
||||||
response = { "status": false, "message": "Activation is success but something is wrong. \n Please contact code2lab call center!"}
|
response = { "status": false, "message": "Activation is success but something is wrong. \n Please contact code2lab call center!"}
|
||||||
@@ -216,7 +314,7 @@ class License
|
|||||||
f.close
|
f.close
|
||||||
|
|
||||||
# read from license file
|
# read from license file
|
||||||
shop_name = read_license("shop_name")
|
shop_name = read_license_no_decrypt("shop_name")
|
||||||
dbhost = read_license("dbhost")
|
dbhost = read_license("dbhost")
|
||||||
dbschema = read_license("dbschema")
|
dbschema = read_license("dbschema")
|
||||||
dbusername = read_license("dbusername")
|
dbusername = read_license("dbusername")
|
||||||
@@ -299,7 +397,7 @@ class License
|
|||||||
# return true
|
# return true
|
||||||
# end
|
# end
|
||||||
|
|
||||||
if status.include? "Active: active (running)" #"Server is already running"
|
if status.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running"
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@@ -312,29 +410,6 @@ class License
|
|||||||
|
|
||||||
# Assign db info for Cloud
|
# Assign db info for Cloud
|
||||||
def assign(aes_key, aes_iv)
|
def assign(aes_key, aes_iv)
|
||||||
# self.name = @license["name"]
|
|
||||||
# self.address_1 = @license["address_1"]
|
|
||||||
# self.address_2 = @license["address_2"]
|
|
||||||
# self.township = @license["township"]
|
|
||||||
# self.city = @license["city"]
|
|
||||||
# self.country = @license["country"]
|
|
||||||
# self.email = @license["email"]
|
|
||||||
# self.phone = @license["phone"]
|
|
||||||
# self.fax = @license["fax"]
|
|
||||||
# self.logo = @license["logo"]
|
|
||||||
# self.localhost_address = @license["localhost_address"]
|
|
||||||
# self.subdomain = @license["subdomain"]
|
|
||||||
# self.plan_activation_date = Date.parse(@license["plan_activation_date"])
|
|
||||||
# self.plan_next_renewal_date = Date.parse(@license["plan_next_renewal_date"])
|
|
||||||
|
|
||||||
## self.plan_activation_date = Date.strptime(@license["plan_activation_date"], "%Y-%m-%d")
|
|
||||||
## self.plan_next_renewal_date = Date.strptime(@license["plan_next_renewal_date"], "%Y-%m-%d")
|
|
||||||
|
|
||||||
# self.plan_max_products = @license["plan_max_products"].to_i
|
|
||||||
# self.plan_max_customers = @license["plan_max_customers"].to_i
|
|
||||||
# self.plan_active_connections = @license["plan_active_connections"].to_i
|
|
||||||
# salt = @license["secret_key"]
|
|
||||||
|
|
||||||
key = Base64.decode64(aes_key)
|
key = Base64.decode64(aes_key)
|
||||||
iv = Base64.decode64(aes_iv)
|
iv = Base64.decode64(aes_iv)
|
||||||
|
|
||||||
@@ -350,17 +425,5 @@ class License
|
|||||||
self.dbpassword = AESCrypt.decrypt_data(dbpassword, key, iv, ENV['CIPHER_TYPE'])
|
self.dbpassword = AESCrypt.decrypt_data(dbpassword, key, iv, ENV['CIPHER_TYPE'])
|
||||||
end
|
end
|
||||||
|
|
||||||
# self.exchange_unqiue_id = @license["exchange_unqiue_id"]
|
|
||||||
|
|
||||||
# self.localqueue_host= @license["localqueue_host"]
|
|
||||||
# self.localqueue_user= @license["localqueue_user"]
|
|
||||||
# self.localqueue_password= @license["localqueue_password"]
|
|
||||||
|
|
||||||
# self.remotequeue_host = @license["remotequeue_host"]
|
|
||||||
# self.remotequeue_user = @license["remotequeue_user"]
|
|
||||||
# self.remotequeue_password = @license["remotequeue_password"]
|
|
||||||
|
|
||||||
# self.api_token = @license["api_token"]
|
|
||||||
# self.app_token = @license["app_token"]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
class MembershipSetting < ApplicationRecord
|
class MembershipSetting < ApplicationRecord
|
||||||
|
MembershipSetting = MembershipSetting.find_by_id(1)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class MyAesCrypt
|
|||||||
passphrase = passphrase.gsub(".","_")
|
passphrase = passphrase.gsub(".","_")
|
||||||
digest = Digest::SHA256.new
|
digest = Digest::SHA256.new
|
||||||
key_digest = digest.update(passphrase)
|
key_digest = digest.update(passphrase)
|
||||||
# iv_digest = digest.update(iv_salt)
|
|
||||||
key = key_digest.digest
|
key = key_digest.digest
|
||||||
|
|
||||||
# iv = iv_digest.digest
|
# iv = iv_digest.digest
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Order < ApplicationRecord
|
|||||||
has_many :assigned_order_items
|
has_many :assigned_order_items
|
||||||
|
|
||||||
#internal references attributes for business logic control
|
#internal references attributes for business logic control
|
||||||
attr_accessor :items, :guest, :table_id, :new_booking, :booking_type, :employee_name, :booking_id
|
attr_accessor :items, :guest, :table_id, :new_booking, :booking_type, :employee_name, :booking_id, :extra_time, :is_extra_time
|
||||||
scope :active, -> { where("date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
scope :active, -> { where("date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||||
#Main Controller method to create new order - validate all inputs and generate new order
|
#Main Controller method to create new order - validate all inputs and generate new order
|
||||||
# order_item : {
|
# order_item : {
|
||||||
@@ -25,14 +25,33 @@ class Order < ApplicationRecord
|
|||||||
booking = nil
|
booking = nil
|
||||||
|
|
||||||
if self.new_booking
|
if self.new_booking
|
||||||
|
#add extra time
|
||||||
|
if self.is_extra_time && self.extra_time
|
||||||
|
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||||
|
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
|
||||||
|
:checkin_by => self.employee_name,
|
||||||
|
:booking_status => "assign" })
|
||||||
|
else
|
||||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||||
:booking_status => "assign" })
|
:booking_status => "assign" })
|
||||||
|
end
|
||||||
|
#end extra time
|
||||||
|
|
||||||
|
|
||||||
table = DiningFacility.find(self.table_id)
|
table = DiningFacility.find(self.table_id)
|
||||||
table.status = "occupied"
|
table.status = "occupied"
|
||||||
table.save
|
table.save
|
||||||
else
|
else
|
||||||
booking = Booking.find(self.booking_id)
|
booking = Booking.find(self.booking_id)
|
||||||
|
#add extra time
|
||||||
|
if self.is_extra_time
|
||||||
|
if !booking.checkout_at.nil?
|
||||||
|
new_time = booking.checkout_at + self.extra_time.to_i
|
||||||
|
booking.update_attributes(checkout_at: new_time)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#end extra time
|
||||||
end
|
end
|
||||||
|
|
||||||
booking.save!
|
booking.save!
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
class PrintSetting < ApplicationRecord
|
class PrintSetting < ApplicationRecord
|
||||||
# validations
|
# validations
|
||||||
validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height, :print_copies
|
validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height, :print_copies
|
||||||
|
|
||||||
|
def self.get_precision_delimiter
|
||||||
|
PrintSetting.find_by_unique_code("CloseCashierPdf")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
order_item = print_query('order_item', order_item_id) #OrderItem.find_by_item_code(item_code)
|
order_item = print_query('order_item', order_item_id) #OrderItem.find_by_item_code(item_code)
|
||||||
|
|
||||||
filename = "tmp/order_item.pdf"
|
filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
# if order_item[0].price != 0
|
# if order_item[0].price != 0
|
||||||
@@ -46,14 +46,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
order=print_query('order_summary', order_id)
|
order=print_query('order_summary', order_id)
|
||||||
# For Print Per Item
|
# For Print Per Item
|
||||||
if oqs.cut_per_item
|
if oqs.cut_per_item
|
||||||
order.each do|odi|
|
|
||||||
filename = "tmp/order_item.pdf"
|
order_items.each do|odi|
|
||||||
|
odi_item=print_query('order_item', odi.order_items_id)
|
||||||
|
filename = "tmp/order_item_#{order_id}" + ".pdf"
|
||||||
# For Item Options
|
# For Item Options
|
||||||
options = odi.options == "[]"? "" : odi.options
|
options = odi.options == "[]"? "" : odi.options
|
||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
#if odi.price != 0
|
#if odi.price != 0
|
||||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options, oqs.use_alternate_name)
|
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||||
# pdf.render_file "tmp/order_item.pdf"
|
# pdf.render_file "tmp/order_item.pdf"
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -68,7 +70,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
# For Print Order Summary
|
# For Print Order Summary
|
||||||
else
|
else
|
||||||
filename = "tmp/order_summary.pdf"
|
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -96,7 +98,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# For Print Per Item
|
# For Print Per Item
|
||||||
if oqs.cut_per_item
|
if oqs.cut_per_item
|
||||||
order.each do|odi|
|
order.each do|odi|
|
||||||
filename = "tmp/order_item.pdf"
|
filename = "tmp/order_item_#{booking_id}" + ".pdf"
|
||||||
# For Item Options
|
# For Item Options
|
||||||
options = odi.options == "[]"? "" : odi.options
|
options = odi.options == "[]"? "" : odi.options
|
||||||
|
|
||||||
@@ -120,7 +122,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
# For Print Order Summary
|
# For Print Order Summary
|
||||||
else
|
else
|
||||||
filename = "tmp/booking_summary.pdf"
|
filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
|
|||||||
@@ -117,4 +117,15 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
pdf.render_file "tmp/print_crm_order.pdf"
|
pdf.render_file "tmp/print_crm_order.pdf"
|
||||||
self.print("tmp/print_crm_order.pdf")
|
self.print("tmp/print_crm_order.pdf")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Queue No Print
|
||||||
|
def print_call_waiter(printer_settings,table,time,shop_detail)
|
||||||
|
#Use CUPS service
|
||||||
|
#Generate PDF
|
||||||
|
#Print
|
||||||
|
pdf = CallWaiterPdf.new(printer_settings,table,time,shop_detail)
|
||||||
|
pdf.render_file "tmp/print_call_waiter.pdf"
|
||||||
|
self.print("tmp/print_call_waiter.pdf")
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -114,7 +114,14 @@ class Sale < ApplicationRecord
|
|||||||
order.save
|
order.save
|
||||||
|
|
||||||
booking.sale_id = self.id
|
booking.sale_id = self.id
|
||||||
|
if !booking.checkout_at.nil?
|
||||||
|
if booking.checkout_at < Time.now.utc.getlocal
|
||||||
booking.checkout_at = Time.now.utc.getlocal
|
booking.checkout_at = Time.now.utc.getlocal
|
||||||
|
end
|
||||||
|
else
|
||||||
|
booking.checkout_at = Time.now.utc.getlocal
|
||||||
|
end
|
||||||
|
|
||||||
booking.checkout_by = requested_by.name
|
booking.checkout_by = requested_by.name
|
||||||
booking.save
|
booking.save
|
||||||
|
|
||||||
@@ -222,8 +229,6 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
sales_items.each do |item|
|
sales_items.each do |item|
|
||||||
#compute each item and added to total
|
#compute each item and added to total
|
||||||
puts "item.sales_item_id ddd"
|
|
||||||
puts item.sale_item_id
|
|
||||||
subtotal_price = subtotal_price + item.price
|
subtotal_price = subtotal_price + item.price
|
||||||
|
|
||||||
# only calc tax when true
|
# only calc tax when true
|
||||||
@@ -247,6 +252,7 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
#compute - invoice total
|
#compute - invoice total
|
||||||
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil)
|
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil)
|
||||||
|
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
sales_items = sale_itemss
|
sales_items = sale_itemss
|
||||||
|
|
||||||
@@ -659,7 +665,7 @@ def self.get_item_query()
|
|||||||
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
|
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
|
||||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||||
# query = query.where("i.item_instance_code IS NOT NULL")
|
# query = query.where("i.item_instance_code IS NOT NULL")
|
||||||
query = query.group("i.product_name").order("mi.account_id asc","mi.menu_category_id asc")
|
query = query.group("acc.title,mi.account_id,i.product_name").order("acc.title desc, mi.account_id desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_other_charges()
|
def self.get_other_charges()
|
||||||
@@ -1107,7 +1113,7 @@ end
|
|||||||
def self.top_items(today)
|
def self.top_items(today)
|
||||||
query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price")
|
query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price")
|
||||||
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.where("sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
.group("a.product_code")
|
.group("a.product_code")
|
||||||
.order("SUM(a.qty) DESC")
|
.order("SUM(a.qty) DESC")
|
||||||
.first()
|
.first()
|
||||||
|
|||||||
@@ -173,13 +173,20 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
private
|
private
|
||||||
def cash_payment
|
def cash_payment
|
||||||
|
status = false
|
||||||
|
sale_payments_data = SalePayment.find_by_sale_id(self.sale_id)
|
||||||
|
if sale_payments_data.nil?
|
||||||
|
status = true
|
||||||
|
end
|
||||||
|
|
||||||
payment_status = false
|
payment_status = false
|
||||||
self.payment_method = "cash"
|
self.payment_method = "cash"
|
||||||
self.payment_amount = self.received_amount
|
self.payment_amount = self.received_amount
|
||||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||||
self.payment_status = "paid"
|
self.payment_status = "paid"
|
||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
sale_update_payment_status(self.received_amount)
|
|
||||||
|
sale_update_payment_status(self.received_amount,status)
|
||||||
return payment_status
|
return payment_status
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -187,7 +194,7 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
# add to sale item with foc
|
# add to sale item with foc
|
||||||
sale_items = SaleItem.where("sale_id='#{ self.sale.sale_id }'")
|
sale_items = SaleItem.where("sale_id='#{ self.sale.sale_id }' and remark is null")
|
||||||
|
|
||||||
sale_items.each do|item|
|
sale_items.each do|item|
|
||||||
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price)
|
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price)
|
||||||
@@ -271,7 +278,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "#{membership_data} Redeem- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
|
remark = "#{membership_data} Redeem- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
|
||||||
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, "Cashier")
|
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1)
|
||||||
|
|
||||||
if membership_data["status"]==true
|
if membership_data["status"]==true
|
||||||
self.payment_method = "paypar"
|
self.payment_method = "paypar"
|
||||||
@@ -290,7 +297,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def sale_update_payment_status(paid_amount)
|
def sale_update_payment_status(paid_amount,check_foc = false)
|
||||||
#update amount_outstanding
|
#update amount_outstanding
|
||||||
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
|
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
|
||||||
self.sale.save!
|
self.sale.save!
|
||||||
@@ -328,7 +335,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
|
remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
|
||||||
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, "Cashier")
|
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1)
|
||||||
|
|
||||||
if !response.nil?
|
if !response.nil?
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
@@ -350,7 +357,9 @@ class SalePayment < ApplicationRecord
|
|||||||
self.sale.save!
|
self.sale.save!
|
||||||
table_update_status(sObj)
|
table_update_status(sObj)
|
||||||
|
|
||||||
if paid_amount != "0.0"
|
if check_foc
|
||||||
|
update_shift
|
||||||
|
elsif paid_amount != "0.0"
|
||||||
update_shift
|
update_shift
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -363,6 +372,11 @@ class SalePayment < ApplicationRecord
|
|||||||
shift.update(self.sale)
|
shift.update(self.sale)
|
||||||
self.sale.shift_sale_id = shift.id
|
self.sale.shift_sale_id = shift.id
|
||||||
self.sale.save
|
self.sale.save
|
||||||
|
else
|
||||||
|
shift = ShiftSale.current_shift
|
||||||
|
shift.update(self.sale)
|
||||||
|
self.sale.shift_sale_id = shift.id
|
||||||
|
self.sale.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -436,7 +450,7 @@ class SalePayment < ApplicationRecord
|
|||||||
'Accept' => 'application/json; version=2'
|
'Accept' => 'application/json; version=2'
|
||||||
}, :timeout => 10)
|
}, :timeout => 10)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { "status": false , "message": "Connect To" }
|
response = { "status": false , "message": " Connection timeout" }
|
||||||
rescue OpenURI::HTTPError
|
rescue OpenURI::HTTPError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
|
|||||||
71
app/pdf/call_waiter_pdf.rb
Normal file
71
app/pdf/call_waiter_pdf.rb
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
class CallWaiterPdf < Prawn::Document
|
||||||
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||||
|
def initialize(printer_settings, table,time,shop_detail)
|
||||||
|
self.page_width = printer_settings.page_width
|
||||||
|
self.page_height = printer_settings.page_height
|
||||||
|
self.margin = 5
|
||||||
|
self.price_width = 35
|
||||||
|
self.qty_width = 20
|
||||||
|
self.total_width = 35
|
||||||
|
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
||||||
|
self.item_height = 15
|
||||||
|
self.item_description_width = (self.page_width-20) / 2
|
||||||
|
self.label_width = 100
|
||||||
|
|
||||||
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if printer_settings.font != ""
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
|
||||||
|
self.header_font_size = 10
|
||||||
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
header( shop_detail.name, printer_settings.name)
|
||||||
|
|
||||||
|
call_waiter(table)
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
# date_info(queue)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def header (shop_name, name)
|
||||||
|
text "#{shop_name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||||
|
text "#{name}", :size => self.header_font_size,:align => :center
|
||||||
|
# move_down self.item_height
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
end
|
||||||
|
|
||||||
|
def call_waiter (table)
|
||||||
|
move_down 3
|
||||||
|
text "Table Name : #{table.name}",:align => :center
|
||||||
|
end
|
||||||
|
|
||||||
|
# def date_info(queue)
|
||||||
|
# move_down 5
|
||||||
|
|
||||||
|
# y_position = cursor
|
||||||
|
# bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
|
# text "Date:", :size => self.item_font_size,:align => :left
|
||||||
|
# end
|
||||||
|
# bounding_box([self.label_width,y_position], :width => self.item_width) do
|
||||||
|
# text "#{queue.created_at.strftime('%Y-%m-%d %I:%M %p')}" , :size => self.item_font_size,:align => :left
|
||||||
|
# end
|
||||||
|
|
||||||
|
# move_down 5
|
||||||
|
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
class CloseCashierPdf < Prawn::Document
|
class CloseCashierPdf < Prawn::Document
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||||
|
|
||||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
||||||
@@ -38,11 +39,22 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 8
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
#precision checked
|
||||||
|
if printer_settings.precision.to_i > 2
|
||||||
|
printer_settings.precision = 2
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if printer_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
|
||||||
header( shop_details)
|
header( shop_details)
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def header (shop_details)
|
def header (shop_details)
|
||||||
@@ -58,7 +70,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
|
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter)
|
||||||
move_down 7
|
move_down 7
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
@@ -97,7 +109,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Opening Float : ", :size => self.item_font_size,:align => :left
|
text "Opening Float : ", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
text "#{ shift_sale.opening_balance}" , :size => self.item_font_size,:align => :left
|
text "#{ number_with_precision(shift_sale.opening_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -105,7 +117,8 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Closing Float : ", :size => self.item_font_size,:align => :left
|
text "Closing Float : ", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
text "#{ shift_sale.closing_balance}" , :size => self.item_font_size,:align => :left
|
text "#{ number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||||
|
# text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +135,8 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Received Amount :", :size => self.item_font_size, :align => :right
|
text "Received Amount :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.closing_balance}", :size => self.item_font_size, :align => :right
|
text "#{number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -130,7 +144,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Cash In:", :size => self.item_font_size, :align => :right
|
text "Cash In:", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.cash_in}", :size => self.item_font_size, :align => :right
|
text "#{number_with_precision(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -138,7 +152,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Cash Out:", :size => self.item_font_size, :align => :right
|
text "Cash Out:", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.cash_out}", :size => self.item_font_size, :align => :right
|
text "#{number_with_precision(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down -5
|
move_down -5
|
||||||
@@ -151,7 +165,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.cash_sales}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -159,7 +173,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.credit_sales}", :size => self.item_font_size, :align => :right
|
text "#{number_with_precision(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
#start other payment details
|
#start other payment details
|
||||||
if shift_sale.other_sales > 0
|
if shift_sale.other_sales > 0
|
||||||
@@ -170,7 +184,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{other.mpu_amount.round(2)}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(other.mpu_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -178,7 +192,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "VISA Payment :", :size => self.item_font_size, :align => :right
|
text "VISA Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{other.visa_amount.round(2)}", :size => self.item_font_size, :align => :right
|
text "#{number_with_precision(other.visa_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -186,7 +200,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Master Payment :", :size => self.item_font_size, :align => :right
|
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{other.master_amount.round(2)}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(other.master_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -194,7 +208,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{other.jcb_amount.round(2)}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(other.jcb_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -202,7 +216,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Reedem Payment :", :size => self.item_font_size, :align => :right
|
text "Reedem Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{other.paypar_amount.round(2)}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(other.paypar_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -211,7 +225,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.other_sales}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(shift_sale.other_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -220,7 +234,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Rounding Adjustments :", :size => self.item_font_size, :align => :right
|
text "Rounding Adjustments :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.total_rounding.round(2)}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -228,7 +242,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Total :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
text "Total :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.grand_total.round(2)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
text "#{ number_with_precision(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
# end other payment details
|
# end other payment details
|
||||||
@@ -243,7 +257,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{tax.st_amount.round(2)}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(tax.st_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -252,7 +266,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Total Taxes :", :size => self.item_font_size, :align => :right
|
text "Total Taxes :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.total_taxes}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(shift_sale.total_taxes, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -260,7 +274,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Net Sales :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
text "Net Sales :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{shift_sale.nett_sales}", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
text "#{number_with_precision(shift_sale.nett_sales, :precision => precision.to_i, :delimiter => delimiter) }", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||||
end
|
end
|
||||||
#end for service charges and commercial tax
|
#end for service charges and commercial tax
|
||||||
#COMMENTED FOR NO NEED AND NOT CORRECT WHEN OTHER CHARGES
|
#COMMENTED FOR NO NEED AND NOT CORRECT WHEN OTHER CHARGES
|
||||||
@@ -283,7 +297,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{amount.total_price.round(2)} ", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#end total amount by Account
|
#end total amount by Account
|
||||||
@@ -297,7 +311,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Total Member Discount :", :size => self.item_font_size, :align => :right
|
text "Total Member Discount :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{@member_discount}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@overall = shift_sale.total_discounts
|
@overall = shift_sale.total_discounts
|
||||||
@@ -308,7 +322,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Total Discount :", :size => self.item_font_size, :align => :right
|
text "Total Discount :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{@overall}", :size => self.item_font_size, :align => :right
|
text "#{ number_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -316,7 +330,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "Total FOC :", :size => self.item_font_size, :align => :right
|
text "Total FOC :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "(#{@total_foc})", :size => self.item_font_size, :align => :right
|
text "(#{ number_with_precision(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
|
|
||||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 3
|
||||||
|
|
||||||
#order_info
|
#order_info
|
||||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||||
@@ -56,13 +56,13 @@ class OrderItemPdf < Prawn::Document
|
|||||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 2
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 2
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||||
@@ -92,7 +92,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
text "#{order_item.item_code} - #{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
@@ -100,17 +100,20 @@ class OrderItemPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
text "#{order_item.item_code} - #{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if alt_name
|
if alt_name
|
||||||
|
if !(order_item.alt_name).empty?
|
||||||
move_down 4
|
move_down 4
|
||||||
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if !options.empty?
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
# add option
|
# add option
|
||||||
@@ -118,6 +121,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
text "#{options}", :size => self.item_font_size,:align => :left
|
text "#{options}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
|
|||||||
129
app/pdf/order_item_slim_pdf.rb
Normal file
129
app/pdf/order_item_slim_pdf.rb
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
class OrderItemSlimPdf < Prawn::Document
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||||
|
def initialize(print_settings,order_item_slim, print_status, options, alt_name)
|
||||||
|
self.page_width = print_settings.page_width
|
||||||
|
self.page_height = print_settings.page_height
|
||||||
|
self.margin = 0
|
||||||
|
self.price_width = 40 # No Need for item
|
||||||
|
self.qty_width = 40
|
||||||
|
self.total_width = 40 # No Need for item
|
||||||
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
|
self.item_height = 15
|
||||||
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
|
self.label_width=90
|
||||||
|
|
||||||
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if print_settings.font != ""
|
||||||
|
font_families.update("#{print_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{print_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
|
||||||
|
self.header_font_size = 11
|
||||||
|
self.item_font_size = 9
|
||||||
|
else
|
||||||
|
self.header_font_size = 12
|
||||||
|
self.item_font_size = 10
|
||||||
|
end
|
||||||
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
|
# font "public/fonts/padauk.ttf"
|
||||||
|
#font "public/fonts/Chinese.ttf"
|
||||||
|
|
||||||
|
text "#{ order_item_slim.type + '-' + order_item_slim.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
#order_info
|
||||||
|
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)
|
||||||
|
|
||||||
|
# order items slim
|
||||||
|
order_items_slim(order_item_slim, options, alt_name, print_settings.precision)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order Information to PDF
|
||||||
|
def order_info(order_no, order_by, order_at)
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down 3
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order items to PDF
|
||||||
|
def order_items_slim(order_item_slim, options, alt_name, precision)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
#Add Order Item
|
||||||
|
add_order_items_slim(order_item_slim, options, alt_name, precision)
|
||||||
|
|
||||||
|
dash(1, :space => 1, :phase => 1)
|
||||||
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
|
move_down 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add order items slim under order info
|
||||||
|
def add_order_items_slim(order_item_slim, options, alt_name, precision)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{order_item_slim.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
|
text "[#{number_with_precision(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{order_item_slim.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# if alt_name
|
||||||
|
# if !(order_item_slim.alt_name).empty?
|
||||||
|
# move_down 1
|
||||||
|
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
|
# text "(#{order_item_slim.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
if !options.empty?
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
# add option
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "#{options}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
end
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -108,7 +108,7 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -117,24 +117,26 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if alt_name
|
if alt_name
|
||||||
|
if !(odi.alt_name).empty?
|
||||||
move_down 4
|
move_down 4
|
||||||
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
end
|
||||||
|
|
||||||
# add option
|
# add option
|
||||||
options = odi.options == "[]"? "" : odi.options
|
options = odi.options == "[]"? "" : odi.options
|
||||||
|
|
||||||
if options != ""
|
if options != ""
|
||||||
|
move_down 5
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{options}", :size => self.item_font_size,:align => :left
|
text "#{options}", :size => self.item_font_size,:align => :left
|
||||||
|
|||||||
155
app/pdf/order_summary_slim_pdf.rb
Normal file
155
app/pdf/order_summary_slim_pdf.rb
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
class OrderSummarySlimPdf < Prawn::Document
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||||
|
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
|
||||||
|
self.page_width = print_settings.page_width
|
||||||
|
self.page_height = print_settings.page_height
|
||||||
|
self.margin = 0
|
||||||
|
self.price_width = 40 # No Need for item
|
||||||
|
self.qty_width = 40
|
||||||
|
self.total_width = 40 # No Need for item
|
||||||
|
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||||
|
self.item_height = 15
|
||||||
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
|
self.label_width=90
|
||||||
|
|
||||||
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if print_settings.font != ""
|
||||||
|
font_families.update("#{print_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{print_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
|
||||||
|
self.header_font_size = 11
|
||||||
|
self.item_font_size = 9
|
||||||
|
else
|
||||||
|
self.header_font_size = 12
|
||||||
|
self.item_font_size = 10
|
||||||
|
end
|
||||||
|
|
||||||
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
|
# font "public/fonts/padauk.ttf"
|
||||||
|
|
||||||
|
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
#order_info
|
||||||
|
order_info(order[0].order_id, order[0].order_by,order[0].order_at)
|
||||||
|
|
||||||
|
# order items
|
||||||
|
if order_items == nil
|
||||||
|
order_items(order, alt_name, print_settings.precision)
|
||||||
|
else
|
||||||
|
order_items(order_items, alt_name, print_settings.precision)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order Information to PDF
|
||||||
|
def order_info(order_no, order_by, order_at)
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order items to PDF
|
||||||
|
def order_items(order_item, alt_name, precision)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "Item", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||||
|
text "Qty", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
#Add Order Item
|
||||||
|
add_order_items(order_item, alt_name, precision)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add order items under order info
|
||||||
|
def add_order_items(order_item, alt_name, precision)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
order_item.each do|odi|
|
||||||
|
# check for item not to show
|
||||||
|
# if odi.price != 0
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
|
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if alt_name
|
||||||
|
if !(odi.alt_name).empty?
|
||||||
|
move_down 1
|
||||||
|
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
|
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# add option
|
||||||
|
options = odi.options == "[]"? "" : odi.options
|
||||||
|
|
||||||
|
if options != ""
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{options}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
dash(1, :space => 1, :phase => 1)
|
||||||
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
|
move_down 1
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
507
app/pdf/receipt_bill_a5_pdf.rb
Normal file
507
app/pdf/receipt_bill_a5_pdf.rb
Normal file
@@ -0,0 +1,507 @@
|
|||||||
|
class ReceiptBillA5Pdf < Prawn::Document
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width
|
||||||
|
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance)
|
||||||
|
self.page_width = printer_settings.page_width
|
||||||
|
self.page_height = printer_settings.page_height
|
||||||
|
self.margin = 15
|
||||||
|
self.price_width = 120
|
||||||
|
self.qty_width = 50
|
||||||
|
self.total_width = 120
|
||||||
|
self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width))
|
||||||
|
self.item_height = 25
|
||||||
|
self.item_description_width = (self.page_width-40) / 2
|
||||||
|
self.label_width = 150
|
||||||
|
|
||||||
|
self.description_width = 500
|
||||||
|
self.price_num_width = 100
|
||||||
|
# @item_width = self.page_width.to_i / 2
|
||||||
|
# @qty_width = @item_width.to_i / 3
|
||||||
|
# @double = @qty_width * 1.3
|
||||||
|
# @half_qty = @qty_width / 2
|
||||||
|
#setting page margin and width
|
||||||
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
|
#precision checked
|
||||||
|
if printer_settings.precision.to_i > 2
|
||||||
|
printer_settings.precision = 2
|
||||||
|
end
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if printer_settings.font != ""
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
|
# font "public/fonts/padauk.ttf"
|
||||||
|
self.header_font_size = 16
|
||||||
|
self.item_font_size = 14
|
||||||
|
|
||||||
|
if printer_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
header(shop_details)
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
cashier_info(sale_data, customer_name)
|
||||||
|
line_items(sale_items,printer_settings.precision,delimiter)
|
||||||
|
all_total(sale_data,printer_settings.precision,delimiter)
|
||||||
|
|
||||||
|
|
||||||
|
if member_info != nil
|
||||||
|
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
|
||||||
|
end
|
||||||
|
|
||||||
|
customer(customer_name)
|
||||||
|
|
||||||
|
if discount_price_by_accounts.length > 0 && shop_details.show_account_info
|
||||||
|
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
end
|
||||||
|
|
||||||
|
if shop_details.show_account_info
|
||||||
|
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
end
|
||||||
|
|
||||||
|
sign(sale_data)
|
||||||
|
|
||||||
|
footer(printed_status)
|
||||||
|
end
|
||||||
|
|
||||||
|
def header (shop_details)
|
||||||
|
move_down 10
|
||||||
|
text "#{shop_details.name}", :size => self.header_font_size,:align => :center
|
||||||
|
move_down 10
|
||||||
|
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
||||||
|
# move_down self.item_height
|
||||||
|
move_down 10
|
||||||
|
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
|
||||||
|
move_down 10
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
|
||||||
|
def cashier_info(sale_data, customer_name)
|
||||||
|
move_down 12
|
||||||
|
# move_down 2
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width, y_position], :width => self.item_description_width, :height => self.item_height) do
|
||||||
|
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0, y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.page_width - 20, :height => self.item_height) do
|
||||||
|
text "Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do
|
||||||
|
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
|
||||||
|
# - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
|
||||||
|
# :size => self.item_font_size,:align => :right
|
||||||
|
# end
|
||||||
|
|
||||||
|
move_down 10
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
|
||||||
|
def line_items(sale_items,precision,delimiter)
|
||||||
|
if precision.to_i > 0
|
||||||
|
item_label_qty_front_width = (self.item_width+self.price_width) + 5
|
||||||
|
item_label_qty_end_width = self.qty_width + 4
|
||||||
|
item_label_total_front_width = (self.item_width+self.price_width) + 10
|
||||||
|
item_label_total_end_width = self.total_width + 9
|
||||||
|
else
|
||||||
|
self.item_width = self.item_width.to_i + 8
|
||||||
|
item_label_qty_front_width = (self.item_width+self.price_width) + 8
|
||||||
|
item_label_qty_end_width = self.qty_width + 7
|
||||||
|
item_label_total_front_width = (self.item_width+self.price_width) + 5
|
||||||
|
item_label_total_end_width = self.total_width + 4
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
move_down 10
|
||||||
|
pad_top(15) {
|
||||||
|
# @item_width.to_i + @half_qty.to_i
|
||||||
|
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
|
text_box "Price", :at =>[(self.item_width),y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
|
text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
|
text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
|
}
|
||||||
|
move_down -5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
add_line_item_row(sale_items,precision,delimiter)
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_line_item_row(sale_items,precision,delimiter)
|
||||||
|
if precision.to_i > 0
|
||||||
|
item_name_width = (self.item_width+self.price_width)
|
||||||
|
item_qty_front_width = (self.item_width+self.price_width) + 5
|
||||||
|
item_qty_end_width = self.qty_width + 4
|
||||||
|
item_total_front_width = item_name_width + 10
|
||||||
|
item_total_end_width = self.total_width + 9
|
||||||
|
else
|
||||||
|
item_name_width = (self.item_width+self.price_width)
|
||||||
|
item_qty_front_width = item_name_width + 8
|
||||||
|
item_qty_end_width = self.qty_width + 7
|
||||||
|
item_total_front_width = item_name_width + 5
|
||||||
|
item_total_end_width = self.total_width + 4
|
||||||
|
end
|
||||||
|
y_position = cursor
|
||||||
|
move_down 10
|
||||||
|
sub_total = 0.0
|
||||||
|
sale_items.each do |item|
|
||||||
|
# check for item not to show
|
||||||
|
if item.price != 0
|
||||||
|
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||||
|
qty = item.qty
|
||||||
|
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||||
|
price = item.unit_price
|
||||||
|
product_name = item.product_name
|
||||||
|
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
pad_top(15) {
|
||||||
|
bounding_box([0,y_position], :width =>self.item_width) do
|
||||||
|
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||||
|
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
|
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
|
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
|
}
|
||||||
|
move_down 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
end
|
||||||
|
|
||||||
|
def all_total(sale_data,precision,delimiter)
|
||||||
|
item_name_width = self.item_width
|
||||||
|
y_position = cursor
|
||||||
|
if sale_data.discount_type == 'member_discount'
|
||||||
|
dis_type = "Member Discount:"
|
||||||
|
else
|
||||||
|
dis_type = "Overall Discount:"
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "#{ dis_type }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
if sale_data.sale_taxes.length > 0
|
||||||
|
sale_data.sale_taxes.each do |st|
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# move_down 10
|
||||||
|
# y_position = cursor
|
||||||
|
|
||||||
|
# bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
# text "Total Tax", :size => self.item_font_size,:align => :left
|
||||||
|
# end
|
||||||
|
# bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
# text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
|
||||||
|
# end
|
||||||
|
|
||||||
|
if sale_data.rounding_adjustment != 0.0
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Rounding Adjustment", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{sale_data.rounding_adjustment}", :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
move_down 10
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width) do
|
||||||
|
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
|
||||||
|
sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def sale_payment(sale_data,precision,delimiter)
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 10
|
||||||
|
sale_payments = SalePayment.select("SUM(sale_payments.payment_amount) as payment_amount,sale_payments.payment_method").where('sale_id = ?', sale_data.sale_id).group("payment_method")
|
||||||
|
sale_payments.each do |payment|
|
||||||
|
y_position = cursor
|
||||||
|
if payment.payment_method == "paypar"
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Redeem Payment", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
else
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
end
|
||||||
|
if sale_data.amount_received > 0
|
||||||
|
y_position = cursor
|
||||||
|
move_down 10
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Change Amount", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# show member information
|
||||||
|
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||||
|
if rebate_amount != nil
|
||||||
|
if rebate_amount["status"] == true
|
||||||
|
stroke_horizontal_rule
|
||||||
|
total = 0
|
||||||
|
balance = 0
|
||||||
|
rebate_balance =0
|
||||||
|
redeem = 0
|
||||||
|
redeem_count = 0
|
||||||
|
rebate_amount["data"].each do |res|
|
||||||
|
total = total + res["balance"]
|
||||||
|
#total redeem amount
|
||||||
|
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||||
|
redeem = redeem + res["withdraw"]
|
||||||
|
balance = balance + res["balance"]
|
||||||
|
end
|
||||||
|
#end Total redem
|
||||||
|
#total Rebate Earn
|
||||||
|
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate"
|
||||||
|
|
||||||
|
rebate_balance = rebate_balance + res["deposit"]
|
||||||
|
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
# Total Rebate Amount if birthday
|
||||||
|
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
||||||
|
rebate_balance = rebate_balance + res["deposit"]
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#end Total rebate if birthday
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
if current_balance != nil
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if member_info["status"] == true && member_info["data"].present?
|
||||||
|
total_balance = 0
|
||||||
|
member_info["data"].each do |res|
|
||||||
|
|
||||||
|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||||
|
total_balance = total_balance + res["balance"]
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{number_with_precision(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def customer(customer_name)
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "Customer Name", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def discount_account(discount_price_by_accounts,precision,delimiter)
|
||||||
|
move_down 10
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
discount_price_by_accounts.each do |ipa|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
|
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def items_account(item_price_by_accounts,precision,delimiter)
|
||||||
|
move_down 10
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 10
|
||||||
|
y_position = cursor
|
||||||
|
item_price_by_accounts.each do |ipa|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width) do
|
||||||
|
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||||
|
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def sign(sale_data)
|
||||||
|
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||||
|
if payment.payment_method == "creditnote"
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||||
|
move_down 70
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||||
|
move_down 73
|
||||||
|
text "Approved By" , :size => self.item_font_size,:align => :center
|
||||||
|
end
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if sale_data.payment_status == "foc"
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||||
|
move_down 70
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||||
|
move_down 73
|
||||||
|
text "Acknowledged By" , :size => self.item_font_size,:align => :center
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def footer(printed_status)
|
||||||
|
move_down 10
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 10
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0, y_position], :width =>self.item_description_width) do
|
||||||
|
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@@ -4,13 +4,13 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance)
|
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance)
|
||||||
self.page_width = printer_settings.page_width
|
self.page_width = printer_settings.page_width
|
||||||
self.page_height = printer_settings.page_height
|
self.page_height = printer_settings.page_height
|
||||||
self.margin = 5
|
self.margin = 0
|
||||||
self.price_width = 40
|
self.price_width = 60
|
||||||
self.qty_width = 20
|
self.qty_width = 25
|
||||||
self.total_width = 40
|
self.total_width = 60
|
||||||
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width))
|
||||||
self.item_height = 15
|
self.item_height = 15
|
||||||
self.item_description_width = (self.page_width-20) / 2
|
self.item_description_width = (self.page_width-5) / 2
|
||||||
self.label_width = 100
|
self.label_width = 100
|
||||||
|
|
||||||
self.description_width = 150
|
self.description_width = 150
|
||||||
@@ -22,6 +22,11 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
|
#precision checked
|
||||||
|
if printer_settings.precision.to_i > 2
|
||||||
|
printer_settings.precision = 2
|
||||||
|
end
|
||||||
|
|
||||||
# db font setup
|
# db font setup
|
||||||
if printer_settings.font != ""
|
if printer_settings.font != ""
|
||||||
font_families.update("#{printer_settings.font}" => {
|
font_families.update("#{printer_settings.font}" => {
|
||||||
@@ -74,7 +79,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def header (shop_details)
|
def header (shop_details)
|
||||||
move_down 7
|
move_down 5
|
||||||
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||||
move_down 5
|
move_down 5
|
||||||
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
||||||
@@ -124,15 +129,27 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def line_items(sale_items,precision,delimiter)
|
def line_items(sale_items,precision,delimiter)
|
||||||
|
if precision.to_i > 0
|
||||||
|
item_label_qty_front_width = (self.item_width+self.price_width) + 5
|
||||||
|
item_label_qty_end_width = self.qty_width + 4
|
||||||
|
item_label_total_front_width = (self.item_width+self.price_width) + 10
|
||||||
|
item_label_total_end_width = self.total_width + 9
|
||||||
|
else
|
||||||
|
self.item_width = self.item_width.to_i + 8
|
||||||
|
item_label_qty_front_width = (self.item_width+self.price_width) + 8
|
||||||
|
item_label_qty_end_width = self.qty_width + 7
|
||||||
|
item_label_total_front_width = (self.item_width+self.price_width) + 5
|
||||||
|
item_label_total_end_width = self.total_width + 4
|
||||||
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
# @item_width.to_i + @half_qty.to_i
|
# @item_width.to_i + @half_qty.to_i
|
||||||
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
text_box "Price", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "Price", :at =>[(self.item_width),y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
text_box "Qty", :at =>[(self.item_width+self.price_width),y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "Total", :at =>[(self.item_width+self.price_width+4),y_position], :width => self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
}
|
}
|
||||||
move_down -5
|
move_down -5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
@@ -140,7 +157,19 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def add_line_item_row(sale_items,precision,delimiter)
|
def add_line_item_row(sale_items,precision,delimiter)
|
||||||
|
if precision.to_i > 0
|
||||||
item_name_width = (self.item_width+self.price_width)
|
item_name_width = (self.item_width+self.price_width)
|
||||||
|
item_qty_front_width = (self.item_width+self.price_width) + 5
|
||||||
|
item_qty_end_width = self.qty_width + 4
|
||||||
|
item_total_front_width = item_name_width + 10
|
||||||
|
item_total_end_width = self.total_width + 9
|
||||||
|
else
|
||||||
|
item_name_width = (self.item_width+self.price_width)
|
||||||
|
item_qty_front_width = item_name_width + 8
|
||||||
|
item_qty_end_width = self.qty_width + 7
|
||||||
|
item_total_front_width = item_name_width + 5
|
||||||
|
item_total_end_width = self.total_width + 4
|
||||||
|
end
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
sub_total = 0.0
|
sub_total = 0.0
|
||||||
@@ -162,8 +191,8 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_name_width,y_position], :width => self.qty_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
}
|
}
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
@@ -469,7 +498,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|||||||
@@ -60,16 +60,16 @@ if (@booking)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# For YGN BBQ
|
# For YGN BBQ
|
||||||
if adult_count > 0
|
# if adult_count > 0
|
||||||
json.per_adult_spent (adult_spent/adult_count) * 0.05
|
# json.per_adult_spent (adult_spent/adult_count) * 0.05
|
||||||
else
|
# else
|
||||||
json.per_adult_spent 0
|
json.per_adult_spent 0
|
||||||
end
|
# end
|
||||||
if child_count > 0
|
# if child_count > 0
|
||||||
json.per_child_spent (child_spent/child_count) * 0.05
|
# json.per_child_spent (child_spent/child_count) * 0.05
|
||||||
else
|
# else
|
||||||
json.per_child_spent 0
|
json.per_child_spent 0
|
||||||
end
|
# end
|
||||||
# End YGN BBQ
|
# End YGN BBQ
|
||||||
|
|
||||||
json.sub_total @total_amount
|
json.sub_total @total_amount
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
|||||||
if (menu.menu_categories)
|
if (menu.menu_categories)
|
||||||
json.categories menu.menu_categories do |category|
|
json.categories menu.menu_categories do |category|
|
||||||
json.id category.id
|
json.id category.id
|
||||||
|
json.code category.code
|
||||||
|
json.order_by category.order_by
|
||||||
json.name category.name
|
json.name category.name
|
||||||
json.alt_name category.alt_name
|
json.alt_name category.alt_name
|
||||||
|
json.order_by category.order_by
|
||||||
json.parent_id category.menu_category_id
|
json.parent_id category.menu_category_id
|
||||||
json.is_available category.is_available
|
json.is_available category.is_available
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
||||||
<th><%= t("views.right_panel.detail.name") %></th>
|
<th><%= t("views.right_panel.detail.name") %></th>
|
||||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||||
|
<th><%= t("views.right_panel.detail.membership_type") %></th>
|
||||||
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
||||||
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
||||||
<th><%= t("views.right_panel.detail.action") %></th>
|
<th><%= t("views.right_panel.detail.action") %></th>
|
||||||
@@ -75,6 +76,15 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><%= crm_customer.name %></td>
|
<td><%= crm_customer.name %></td>
|
||||||
<td><%= crm_customer.card_no rescue '-' %></td>
|
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||||
|
<td>
|
||||||
|
<% if !@membership_types.nil? %>
|
||||||
|
<% @membership_types.each do |member_type| %>
|
||||||
|
<% if member_type[1] == crm_customer.membership_type %>
|
||||||
|
<%= member_type[0] %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
<td style="width:20px%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
||||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.email %></td>
|
<td style="width:20px%;word-break: break-all;"><%= crm_customer.email %></td>
|
||||||
<td><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %></td>
|
<td><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %></td>
|
||||||
|
|||||||
@@ -14,11 +14,16 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
|
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
|
||||||
|
<%if current_login_employee.role !="waiter" %>
|
||||||
<a href="javascript:void(0);" class="bars"></a>
|
<a href="javascript:void(0);" class="bars"></a>
|
||||||
<a class="navbar-brand" href="<%=dashboard_path%>">
|
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
|
||||||
|
<% else %>
|
||||||
|
<a class="navbar-brand m-0" href="<%=dashboard_path%>">
|
||||||
|
<%end%>
|
||||||
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
||||||
<span class="navbar-brand-txt">SX Restaurant</span>
|
<span class="navbar-brand-txt">SX Restaurant</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Start Delete confirrm text !-->
|
<!-- Start Delete confirrm text !-->
|
||||||
<div class="navbar-right">
|
<div class="navbar-right">
|
||||||
@@ -29,7 +34,8 @@
|
|||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li>
|
<li>
|
||||||
<%if current_login_employee.role !="waiter" %>
|
<!-- <%if current_login_employee.role !="waiter" %> -->
|
||||||
|
<!-- <%end%> -->
|
||||||
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
||||||
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
||||||
<span class="font-18">Logout</span>
|
<span class="font-18">Logout</span>
|
||||||
@@ -38,7 +44,6 @@
|
|||||||
<h6>Are you sure you want to Logout ?</h6>
|
<h6>Are you sure you want to Logout ?</h6>
|
||||||
<!-- <h6>This action can't be undo. </h6> -->
|
<!-- <h6>This action can't be undo. </h6> -->
|
||||||
</span>
|
</span>
|
||||||
<%end%>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- NO Need for color Change
|
<!-- NO Need for color Change
|
||||||
|
|||||||
@@ -145,6 +145,31 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1 col-black">
|
||||||
|
<span>Waiter</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-11">
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<% @employees.each do |employee| %>
|
||||||
|
<%if employee.role == "waiter" %>
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 empBtn" data-formid="#form_<%= employee.emp_id %>" >
|
||||||
|
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||||
|
</form>
|
||||||
|
<div class="card emp-body">
|
||||||
|
<div class="body bg-teal">
|
||||||
|
<%= employee.name%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-xs-12 col-sm-12 col-md-2 col-lg-2"> </div> -->
|
<!-- <div class="col-xs-12 col-sm-12 col-md-2 col-lg-2"> </div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
</span> ]
|
</span> ]
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||||
|
|
||||||
<span class="card-text">
|
<span class="card-text">
|
||||||
<span class="text-muted">Order at -
|
<span class="text-muted">Order at -
|
||||||
|
|||||||
@@ -9,15 +9,26 @@
|
|||||||
<ul class="nav nav-tabs flex-column" role="tablist" >
|
<ul class="nav nav-tabs flex-column" role="tablist" >
|
||||||
<% @menu.each do |menu| %>
|
<% @menu.each do |menu| %>
|
||||||
<% if menu.menu_category_id.nil? %>
|
<% if menu.menu_category_id.nil? %>
|
||||||
|
<% if @table.get_current_checkout_booking.nil? %>
|
||||||
|
<% if !menu.code.include? "SPL" %>
|
||||||
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||||
<p class="hidden menu-id"><%= menu.id %></p>
|
<p class="hidden menu-id"><%= menu.id %></p>
|
||||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
||||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||||
</ul>
|
</ul>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<% end%>
|
<% end%>
|
||||||
|
<% else %>
|
||||||
|
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||||
|
<p class="hidden menu-id"><%= menu.id %></p>
|
||||||
|
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
||||||
|
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||||
|
</ul>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<% end%>
|
||||||
|
<% end%>
|
||||||
<%end %>
|
<%end %>
|
||||||
<!-- <li class="nav-item menu_category">
|
<!-- <li class="nav-item menu_category">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Menu 1 <b class="caret"></b></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Menu 1 <b class="caret"></b></a>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
|
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
|
||||||
|
|
||||||
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
|
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
|
||||||
<input type="hidden" name="type" id="type" value="<%= @dining_facility.type %>">
|
<!-- <input type="hidden" name="type" id="type" value="<%= @dining_facility.type %>"> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
|
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
|
||||||
@@ -54,6 +54,7 @@
|
|||||||
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
||||||
<th><%= t("views.right_panel.detail.name") %></th>
|
<th><%= t("views.right_panel.detail.name") %></th>
|
||||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||||
|
<th><%= t("views.right_panel.detail.membership_type") %></th>
|
||||||
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
||||||
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
||||||
<!-- <th>Paypar No</th> -->
|
<!-- <th>Paypar No</th> -->
|
||||||
@@ -76,7 +77,16 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= crm_customer.name %></td>
|
<td><%= crm_customer.name %></td>
|
||||||
<td><%= crm_customer.company rescue '-' %></td>
|
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||||
|
<td>
|
||||||
|
<% if !@membership_types.nil? %>
|
||||||
|
<% @membership_types.each do |member_type| %>
|
||||||
|
<% if member_type[1] == crm_customer.membership_type %>
|
||||||
|
<%= member_type[0] %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
<td style="width:20%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
<td style="width:20%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
||||||
<td style="width:20%;word-break: break-all;"><%= crm_customer.email %></td>
|
<td style="width:20%;word-break: break-all;"><%= crm_customer.email %></td>
|
||||||
<!-- <td><%= crm_customer.paypar_account_no %></td> -->
|
<!-- <td><%= crm_customer.paypar_account_no %></td> -->
|
||||||
@@ -423,8 +433,8 @@
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
if(data.status == true)
|
if(data.status == true)
|
||||||
{
|
{
|
||||||
var id = $("#table_id").val()
|
var id = $("#table_id").val();
|
||||||
var type = $("#type").val()
|
var type = $("#type").val();
|
||||||
if (type=="Table") {
|
if (type=="Table") {
|
||||||
window.location.href = '/origami/table/'+id
|
window.location.href = '/origami/table/'+id
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -118,12 +118,13 @@
|
|||||||
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||||
</button>
|
</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
<%if current_login_employee.role != "waiter" %>
|
||||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
||||||
<!-- Temporary Disabled -->
|
<!-- Temporary Disabled -->
|
||||||
|
|
||||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||||
|
<%end%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
<div id="loading_wrapper" style="display:none;">
|
||||||
|
<div id="loading"></div>
|
||||||
|
</div>
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
@@ -140,7 +143,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<% elsif @status_sale == 'sale' %>
|
<% elsif @status_sale == 'sale' %>
|
||||||
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||||
|
<% if !@booking.reserved_by.nil? && %>
|
||||||
|
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
|
<% else %>
|
||||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||||
@@ -154,7 +161,6 @@
|
|||||||
Receipt No: <span id="receipt_no">
|
Receipt No: <span id="receipt_no">
|
||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<%= @sale_array[0].receipt_no rescue '' %>
|
<%= @sale_array[0].receipt_no rescue '' %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
@@ -264,7 +270,7 @@
|
|||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<% if @obj_sale != nil && @obj_sale.discount_type == 'member_discount' %>
|
<% if @obj_sale != nil && @obj_sale.discount_type == 'member_discount' %>
|
||||||
@@ -291,7 +297,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
<td class="item-attr">
|
<td class="item-attr">
|
||||||
<strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0 %></strong></td>
|
<strong id="order-round-adj"><%= @obj_sale.rounding_adjustment
|
||||||
|
%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
@@ -366,6 +373,7 @@
|
|||||||
<%= t("views.btn.back") %>
|
<%= t("views.btn.back") %>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||||
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||||
<% if @dining.status != "available" %>
|
<% if @dining.status != "available" %>
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
@@ -389,6 +397,7 @@
|
|||||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
|
|
||||||
<!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button> -->
|
<!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button> -->
|
||||||
|
|
||||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -398,11 +407,52 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||||
|
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||||
|
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<select class="form-control show-tick payment_method" id="payment_method" >
|
||||||
|
<option value="Cash">Cash</option>
|
||||||
|
<option value="Credit">Credit</option>
|
||||||
|
<% @payment_methods.each do |pay| %>
|
||||||
|
<option value="<%= pay.payment_method %>">
|
||||||
|
<%= pay.payment_method %>
|
||||||
|
</option>
|
||||||
|
<%end %>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer p-r-30">
|
||||||
|
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
/* start check first bill or not*/
|
||||||
|
var receipt_no = "";
|
||||||
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
}
|
||||||
|
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||||
|
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||||
|
$("#pay").show();
|
||||||
|
}else{
|
||||||
|
$("#pay").hide();
|
||||||
|
}
|
||||||
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.invoicedetails').on('click', function () {
|
$('.invoicedetails').on('click', function () {
|
||||||
var dining_id = "<%= @dining.id %>";
|
var dining_id = "<%= @dining.id %>";
|
||||||
@@ -491,7 +541,7 @@
|
|||||||
window.location.href = '/origami/' + sale_id + '/other_charges'
|
window.location.href = '/origami/' + sale_id + '/other_charges'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("Please select an table!");
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -510,13 +560,12 @@
|
|||||||
window.location.href = '/origami/' + sale_id + '/discount'
|
window.location.href = '/origami/' + sale_id + '/discount'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("Please select an table!");
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Print for first bill
|
// Print for first bill
|
||||||
// $("#first_bill").on('click', function () {
|
// $("#first_bill").on('click', function () {
|
||||||
// var sale_id = $('#sale_id').val();
|
// var sale_id = $('#sale_id').val();
|
||||||
@@ -556,6 +605,7 @@
|
|||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
// data: 'order_id='+ order_id,
|
// data: 'order_id='+ order_id,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
||||||
if (!result.status) {
|
if (!result.status) {
|
||||||
swal("Information!", result.error_message);
|
swal("Information!", result.error_message);
|
||||||
}
|
}
|
||||||
@@ -567,7 +617,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#move').on('click', function () {
|
$('#move').on('click', function () {
|
||||||
var dining_id = "<%= @dining.id %>"
|
var dining_id = "<%= @dining.id %>";
|
||||||
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -584,8 +634,16 @@
|
|||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
|
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
alert("Invoice updated")
|
swal({
|
||||||
|
title: "Information!",
|
||||||
|
text: "Invoice updated",
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, function () {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -685,7 +743,7 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {dining_id : dining_id},
|
data: {'dining_id' : dining_id},
|
||||||
datatype: 'JSON',
|
datatype: 'JSON',
|
||||||
url: '/origami/check_in',
|
url: '/origami/check_in',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|||||||
@@ -163,18 +163,18 @@ $('#jcb_pay').on('click',function(){
|
|||||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||||
$(this).off("click");
|
$(this).off("click");
|
||||||
//start member discount 5% by pay card
|
//start member discount 5% by pay card
|
||||||
var sub_total = $('#sub-total').text();
|
// var sub_total = $('#sub-total').text();
|
||||||
var member_id = $('#membership_id').text();
|
// var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
// var member_discount = $('#member_discount').text();
|
||||||
if (member_id && member_discount) {
|
// if (member_id && member_discount) {
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
type: "POST",
|
// type: "POST",
|
||||||
url: "/origami/" + sale_id + "/member_discount",
|
// url: "/origami/" + sale_id + "/member_discount",
|
||||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||||
// success:function(result){
|
// success:function(result){
|
||||||
// }
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
//end member discount
|
//end member discount
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_jcb_path %>",
|
url: "<%= origami_payment_jcb_path %>",
|
||||||
|
|||||||
@@ -160,18 +160,18 @@
|
|||||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||||
$(this).off("click");
|
$(this).off("click");
|
||||||
//start member discount 5% by pay card
|
//start member discount 5% by pay card
|
||||||
var sub_total = $('#sub-total').text();
|
// var sub_total = $('#sub-total').text();
|
||||||
var member_id = $('#membership_id').text();
|
// var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
// var member_discount = $('#member_discount').text();
|
||||||
if (member_id && member_discount) {
|
// if (member_id && member_discount) {
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
type: "POST",
|
// type: "POST",
|
||||||
url: "/origami/" + sale_id + "/member_discount",
|
// url: "/origami/" + sale_id + "/member_discount",
|
||||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||||
// success:function(result){
|
// // success:function(result){
|
||||||
|
// // }
|
||||||
|
// });
|
||||||
// }
|
// }
|
||||||
});
|
|
||||||
}
|
|
||||||
//end member discount
|
//end member discount
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_master_path %>",
|
url: "<%= origami_payment_master_path %>",
|
||||||
|
|||||||
@@ -163,18 +163,18 @@
|
|||||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||||
$(this).off("click");
|
$(this).off("click");
|
||||||
//start member discount 5% by pay card
|
//start member discount 5% by pay card
|
||||||
var sub_total = $('#sub-total').text();
|
// var sub_total = $('#sub-total').text();
|
||||||
var member_id = $('#membership_id').text();
|
// var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
// var member_discount = $('#member_discount').text();
|
||||||
if (member_id && member_discount) {
|
// if (member_id && member_discount) {
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
type: "POST",
|
// type: "POST",
|
||||||
url: "/origami/" + sale_id + "/member_discount",
|
// url: "/origami/" + sale_id + "/member_discount",
|
||||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||||
// success:function(result){
|
// success:function(result){
|
||||||
// }
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
//end member discount
|
//end member discount
|
||||||
//Mpu Payment
|
//Mpu Payment
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
|
|||||||
@@ -96,7 +96,8 @@
|
|||||||
<div class="form-horizontal">
|
<div class="form-horizontal">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
<div class="bottom-5">
|
<div class="bottom-5">
|
||||||
<input type="text" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" />
|
<input type="text" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" onkeypress="return isNumberKey(event);" />
|
||||||
|
<br><span id="other-charges-amountErr" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-5">
|
<div class="bottom-5">
|
||||||
<textarea id="reasons" name="reasons" rows="2" class="form-control" placeholder="Reasons"></textarea>
|
<textarea id="reasons" name="reasons" rows="2" class="form-control" placeholder="Reasons"></textarea>
|
||||||
@@ -278,12 +279,19 @@
|
|||||||
if ($("#is_taxable:checked").length > 0) {
|
if ($("#is_taxable:checked").length > 0) {
|
||||||
is_taxable = 1
|
is_taxable = 1
|
||||||
}
|
}
|
||||||
|
$("#other-charges-amountErr").html("");
|
||||||
|
if(charge_amount != ""){
|
||||||
|
$("#other-charges-amount").val("");
|
||||||
|
$("#reasons").val("");
|
||||||
// Update sub total
|
// Update sub total
|
||||||
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
|
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
|
||||||
|
|
||||||
var item_row = item_row_template(sale_id, charge_amount, reasons, is_taxable);
|
var item_row = item_row_template(sale_id, charge_amount, reasons, is_taxable);
|
||||||
$("#order-items-table tbody").append(item_row);
|
$("#order-items-table tbody").append(item_row);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#other-charges-amountErr").html("can't be blank");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Calculate Other Charges for Payment
|
// Calculate Other Charges for Payment
|
||||||
@@ -361,4 +369,13 @@
|
|||||||
return item_row;
|
return item_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isNumberKey(evt) {
|
||||||
|
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||||
|
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -14,8 +14,9 @@
|
|||||||
<div class="col-lg-11col-md-11 col-sm-11">
|
<div class="col-lg-11col-md-11 col-sm-11">
|
||||||
<div >
|
<div >
|
||||||
<div >
|
<div >
|
||||||
|
<span id="receipt_no" class="hidden"><%=@sale_data.receipt_no rescue ' '%></span>
|
||||||
<% @payment_method_setting.where("is_active = true").each do |payment_method|%>
|
<% @payment_method_setting.where("is_active = true").each do |payment_method|%>
|
||||||
<div class="purple others-payment bottom left m-l-30" data-type="<%= payment_method.payment_method %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
|
<div class="purple others-payment bottom left m-l-30 <%= payment_method.payment_method %>" data-type="<%= payment_method.payment_method %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,6 +27,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
/* start check first bill or not*/
|
||||||
|
var receipt_no = "";
|
||||||
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||||
|
if(payment_type) {
|
||||||
|
$(".others-payment").hide();
|
||||||
|
$("."+payment_type).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.others-payment').on('click',function(){
|
$('.others-payment').on('click',function(){
|
||||||
var input_type = $(this).attr("data-type");
|
var input_type = $(this).attr("data-type");
|
||||||
|
|||||||
@@ -94,11 +94,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
<td class="item-attr"><strong><span id="rounding_adj"><%=@rounding_adj rescue 0%></span></strong></td>
|
<td class="item-attr"><strong><%= @sale_data.rounding_adjustment rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total</strong></td>
|
<td class="charges-name"><strong>Grand Total</strong></td>
|
||||||
<td class="item-attr"><strong><span><%=@sale_data.grand_total+ @rounding_adj rescue 0%></span></strong></td>
|
<td class="item-attr"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%if @balance > 0%>
|
<%if @balance > 0%>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<strong>
|
<strong>
|
||||||
<span id="grand_total" class="hidden"><%= @sale_data.grand_total rescue 0%></span>
|
<span id="grand_total" class="hidden"><%= @sale_data.grand_total rescue 0%></span>
|
||||||
<span id="amount_due"><%= @sale_data.grand_total + @rounding_adj rescue 0%></span></strong>
|
<span id="amount_due"><%= @sale_data.grand_total rescue 0%></span></strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
<!-- <br> -->
|
<!-- <br> -->
|
||||||
<div class="row m-l-5 m-r-5">
|
<div class="row m-l-5 m-r-5">
|
||||||
<div class="col-md-8"><strong>Balance</strong></div>
|
<div class="col-md-8"><strong>Balance</strong></div>
|
||||||
<div class="col-md-4"><strong><span id='balance'><%= @sale_data.grand_total+ @rounding_adj rescue 0 %></span></strong></div>
|
<div class="col-md-4"><strong><span id='balance'><%= @sale_data.grand_total rescue 0 %></span></strong></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <br> -->
|
<!-- <br> -->
|
||||||
</div>
|
</div>
|
||||||
@@ -290,6 +290,24 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
/* start check first bill or not*/
|
||||||
|
var receipt_no = "";
|
||||||
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||||
|
if(payment_type=="Cash"){
|
||||||
|
$("#card_payment").hide();
|
||||||
|
$("#credit_payment").hide();
|
||||||
|
}else if(payment_type=="Credit"){
|
||||||
|
$("#card_payment").hide();
|
||||||
|
$("#others_payment").hide();
|
||||||
|
}else if(payment_type=="MPU"||payment_type=="VISA"||payment_type=="JCB"||payment_type=="Master"){
|
||||||
|
$("#credit_payment").hide();
|
||||||
|
}
|
||||||
|
/* end check first bill or not*/
|
||||||
|
|
||||||
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
||||||
|
|
||||||
$("#back").on('click', function() {
|
$("#back").on('click', function() {
|
||||||
@@ -351,7 +369,7 @@
|
|||||||
var master1 = $('#mastercount').text();
|
var master1 = $('#mastercount').text();
|
||||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1);
|
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1);
|
||||||
var total = $('#amount_due').text();
|
var total = $('#amount_due').text();
|
||||||
var amt = parseFloat(total) - othertotal;
|
var amt = parseFloat(total) - parseFloat(othertotal);
|
||||||
$('#cash').text(amt);
|
$('#cash').text(amt);
|
||||||
update_balance();
|
update_balance();
|
||||||
break;
|
break;
|
||||||
@@ -380,31 +398,53 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#pay').click(function() {
|
$('#pay').click(function() {
|
||||||
// $('#pay').text("Processing, Please wait!")
|
sub_total = $('#sub-total').text();
|
||||||
$( "#loading_wrapper").show();
|
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
|
||||||
|
swal("Opps","Please Pay with MPU Payment","warning");
|
||||||
|
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
|
||||||
|
swal("Opps","Please Pay with Redeem Payment","warning");
|
||||||
|
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
|
||||||
|
swal("Opps","Please Pay with Visa Payment","warning");
|
||||||
|
|
||||||
|
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
|
||||||
|
swal("Opps","Please Pay with jcb Payment","warning");
|
||||||
|
}
|
||||||
|
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
|
||||||
|
swal("Opps","Please Pay with Master Payment","warning");
|
||||||
|
}
|
||||||
|
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
|
||||||
|
swal("Opps","Please Pay with Credit Payment","warning");
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$( "#loading_wrapper").show();
|
||||||
if($('#balance').text() > 0){
|
if($('#balance').text() > 0){
|
||||||
swal ( "Oops", "Insufficient Amount!" , "error" );
|
swal ( "Oops", "Insufficient Amount!" , "error" );
|
||||||
$("#loading_wrapper").hide();
|
$("#loading_wrapper").hide();
|
||||||
}else{
|
}else{
|
||||||
$(this).off("click");
|
$(this).off("click");
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
var item_row = $('.is_card');
|
// var item_row = $('.is_card');
|
||||||
|
|
||||||
if (item_row.length < 1) {
|
|
||||||
calculate_member_discount(sale_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// payment
|
// payment
|
||||||
var cash = $('#cash').text();
|
var cash = $('#cash').text();
|
||||||
var credit = $('#credit').text();
|
var credit = $('#credit').text();
|
||||||
var card = $('#card').text();
|
var card = $('#card').text();
|
||||||
|
|
||||||
|
if (credit <= 0) {
|
||||||
|
calculate_member_discount(sale_id);
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_cash_path %>",
|
url: "<%= origami_payment_cash_path %>",
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||||
async: false,
|
async: false,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
/* start delete receipt no in first bill*/
|
||||||
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
|
var receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
deleteReceiptNoInFirstBillData(receipt_no);
|
||||||
|
}
|
||||||
|
/* end delete receipt no in first bill*/
|
||||||
|
|
||||||
localStorage.removeItem("cash");
|
localStorage.removeItem("cash");
|
||||||
if (result.status) {
|
if (result.status) {
|
||||||
@@ -441,6 +481,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#void').on('click',function () {
|
$('#void').on('click',function () {
|
||||||
@@ -476,7 +517,7 @@
|
|||||||
var master = $('#mastercount').text();
|
var master = $('#mastercount').text();
|
||||||
var amount_due = $('#amount_due').text();
|
var amount_due = $('#amount_due').text();
|
||||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master)
|
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master)
|
||||||
var result = amount_due - total;
|
var result = parseFloat(amount_due) - parseFloat(total);
|
||||||
$('#balance').text(result.toFixed(2));
|
$('#balance').text(result.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +538,7 @@
|
|||||||
|
|
||||||
//$( "#loading_wrapper" ).hide();
|
//$( "#loading_wrapper" ).hide();
|
||||||
|
|
||||||
if (cash > 0) {
|
if (cash >= 0) {
|
||||||
swal({
|
swal({
|
||||||
title: "Information!",
|
title: "Information!",
|
||||||
text: 'Thank You !',
|
text: 'Thank You !',
|
||||||
@@ -517,15 +558,20 @@
|
|||||||
var sub_total = $('#sub-total').text();
|
var sub_total = $('#sub-total').text();
|
||||||
var member_id = $('#membership_id').text();
|
var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
var member_discount = $('#member_discount').text();
|
||||||
|
var item_row = $('.is_card');
|
||||||
|
|
||||||
if (member_id && member_discount) {
|
if (member_id && member_discount) {
|
||||||
|
if (item_row.length < 1) {
|
||||||
|
is_card = false
|
||||||
|
}else{
|
||||||
|
is_card = true
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/" + sale_id + "/member_discount",
|
url: "/origami/" + sale_id + "/member_discount",
|
||||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':false },
|
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||||
async: false,
|
async: false,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
<div id="loading_wrapper" style="display:none;">
|
||||||
|
<div id="loading"></div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
@@ -183,7 +186,7 @@
|
|||||||
<div class="card-title row customer_detail p-l-5 p-r-5" >
|
<div class="card-title row customer_detail p-l-5 p-r-5" >
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<p class="hidden customer-id"><%= @obj_sale_sale.customer_id rescue '' %></p>
|
<p class="hidden customer-id"><%= @obj_sale.customer_id rescue '' %></p>
|
||||||
Customer : <%= @obj_sale.customer.name rescue '-' %>
|
Customer : <%= @obj_sale.customer.name rescue '-' %>
|
||||||
<%else%>
|
<%else%>
|
||||||
<p class="hidden customer-id"><%= @obj_order.customer_id rescue "-" %></p>
|
<p class="hidden customer-id"><%= @obj_order.customer_id rescue "-" %></p>
|
||||||
@@ -260,7 +263,7 @@
|
|||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
|
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
|
||||||
@@ -353,12 +356,14 @@
|
|||||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled >Edit</button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" disabled >Edit</button> -->
|
||||||
<!-- <button type="button" id="discount" class="btn bg-blue btn-block" disabled >Discount</button> -->
|
<!-- <button type="button" id="discount" class="btn bg-blue btn-block" disabled >Discount</button> -->
|
||||||
<!-- <button type="button" id="other-charges" class="btn bg-blue btn-block" disabled>Charges</button> -->
|
<!-- <button type="button" id="other-charges" class="btn bg-blue btn-block" disabled>Charges</button> -->
|
||||||
|
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||||
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
||||||
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
||||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block" disabled>First Bill</button> -->
|
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block" disabled>First Bill</button> -->
|
||||||
<!-- <button type="button" id="pay" class="btn bg-blue btn-block" disabled>Pay</button> -->
|
<!-- <button type="button" id="pay" class="btn bg-blue btn-block" disabled>Pay</button> -->
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled=""> Void </button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" disabled=""> Void </button> -->
|
||||||
<% else %>
|
<% end %>
|
||||||
|
<% if @status_sale == 'sale' %>
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
|
||||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||||
<button type="button" class="btn bg-blue btn-block" id='edit'>Edit</button>
|
<button type="button" class="btn bg-blue btn-block" id='edit'>Edit</button>
|
||||||
@@ -369,10 +374,40 @@
|
|||||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
|
||||||
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
|
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
|
||||||
|
|
||||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block">First Bill</button> -->
|
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block">First Bill</button> -->
|
||||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||||
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
|
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||||
|
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||||
|
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<select class="form-control show-tick payment_method" id="payment_method" >
|
||||||
|
<option value="Cash">Cash</option>
|
||||||
|
<% @payment_methods.each do |pay| %>
|
||||||
|
<option value="<%= pay.payment_method %>">
|
||||||
|
<%= pay.payment_method %>
|
||||||
|
</option>
|
||||||
|
<%end %>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer p-r-30">
|
||||||
|
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
|
|
||||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
||||||
@@ -411,6 +446,19 @@ $(document).ready(function(){
|
|||||||
// window.location.href = '/origami/order/' + order_id;
|
// window.location.href = '/origami/order/' + order_id;
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
/* start check first bill or not*/
|
||||||
|
var receipt_no = "";
|
||||||
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
}
|
||||||
|
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||||
|
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||||
|
$("#pay").show();
|
||||||
|
}else{
|
||||||
|
$("#pay").hide();
|
||||||
|
}
|
||||||
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.invoicedetails').on('click',function(){
|
$('.invoicedetails').on('click',function(){
|
||||||
var dining_id = "<%= @room.id %>";
|
var dining_id = "<%= @room.id %>";
|
||||||
var sale_id = this.id;
|
var sale_id = this.id;
|
||||||
@@ -498,7 +546,7 @@ $(document).ready(function(){
|
|||||||
window.location.href = '/origami/' + sale_id + '/discount'
|
window.location.href = '/origami/' + sale_id + '/discount'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("Please select an table!");
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -517,7 +565,7 @@ $(document).ready(function(){
|
|||||||
window.location.href = '/origami/' + sale_id + '/other_charges'
|
window.location.href = '/origami/' + sale_id + '/other_charges'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("Please select an table!");
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -533,11 +581,54 @@ $("#first_bill").on('click', function(){
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||||
|
createReceiptNoInFirstBillData(receipt_no,"");
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".choose_payment").on('click', function () {
|
||||||
|
$( "#loading_wrapper").show();
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
type = $('.payment_method').val();
|
||||||
|
|
||||||
|
calculate_member_discount(sale_id,type);
|
||||||
|
|
||||||
|
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success: function (result) {
|
||||||
|
$( "#loading_wrapper" ).hide();
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||||
|
createReceiptNoInFirstBillData(receipt_no,type);
|
||||||
|
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function calculate_member_discount(sale_id,type) {
|
||||||
|
var sub_total = $('#sub-total').text();
|
||||||
|
if (type == "Cash") {
|
||||||
|
is_card = false
|
||||||
|
}else{
|
||||||
|
is_card = true
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/" + sale_id + "/member_discount",
|
||||||
|
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||||
|
async: false,
|
||||||
|
success:function(result){
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$('#pay').on('click',function() {
|
$('#pay').on('click',function() {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
|
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
|
||||||
@@ -600,8 +691,16 @@ $('#add_invoice').on('click',function(){
|
|||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'dining_id='+ dining_id + "&sale_id=" + sale_id,
|
data: 'dining_id='+ dining_id + "&sale_id=" + sale_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
alert("Invoice updated")
|
swal({
|
||||||
|
title: "Information!",
|
||||||
|
text: "Invoice updated",
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, function () {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -162,18 +162,18 @@
|
|||||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||||
$(this).off("click");
|
$(this).off("click");
|
||||||
//start member discount 5% by pay card
|
//start member discount 5% by pay card
|
||||||
var sub_total = $('#sub-total').text();
|
// var sub_total = $('#sub-total').text();
|
||||||
var member_id = $('#membership_id').text();
|
// var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
// var member_discount = $('#member_discount').text();
|
||||||
if (member_id && member_discount) {
|
// if (member_id && member_discount) {
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
type: "POST",
|
// type: "POST",
|
||||||
url: "/origami/" + sale_id + "/member_discount",
|
// url: "/origami/" + sale_id + "/member_discount",
|
||||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||||
// success:function(result){
|
// success:function(result){
|
||||||
// }
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
//end member discount
|
//end member discount
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_visa_path %>",
|
url: "<%= origami_payment_visa_path %>",
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
<%= f.input :api_settings %>
|
<%= f.input :api_settings %>
|
||||||
<%= f.input :page_width %>
|
<%= f.input :page_width %>
|
||||||
<%= f.input :page_height %>
|
<%= f.input :page_height %>
|
||||||
<%= f.input :print_copies, input_html: { min: '1', step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
|
<%= f.input :print_copies, input_html: { min: 1, step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
|
||||||
<%= f.input :precision %>
|
<%= f.input :precision, input_html: { min: 0, max: 2, :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanTwo(this.value);" } %>
|
||||||
<%= f.input :delimiter %>
|
<%= f.input :delimiter %>
|
||||||
<%= f.input :heading_space %>
|
<%= f.input :heading_space %>
|
||||||
</div>
|
</div>
|
||||||
@@ -73,4 +73,8 @@
|
|||||||
function greaterThanOne(val){
|
function greaterThanOne(val){
|
||||||
if(parseInt(val)==0) $("#print_setting_print_copies").val(1);
|
if(parseInt(val)==0) $("#print_setting_print_copies").val(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function greaterThanTwo(val){
|
||||||
|
if(parseInt(val)>2) $("#print_setting_precision").val(2);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -43,6 +43,18 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
<% total_qty = 0 %>
|
<% total_qty = 0 %>
|
||||||
<% total_price = 0 %>
|
<% total_price = 0 %>
|
||||||
<% total_amount = 0 %>
|
<% total_amount = 0 %>
|
||||||
@@ -53,9 +65,9 @@
|
|||||||
<td><%= result.sale_item_id rescue '-' %></td>
|
<td><%= result.sale_item_id rescue '-' %></td>
|
||||||
<td><%= result.commissioner.name rescue '-' %></td>
|
<td><%= result.commissioner.name rescue '-' %></td>
|
||||||
<td><%= result.commission.menu_item.name rescue '-' %></td>
|
<td><%= result.commission.menu_item.name rescue '-' %></td>
|
||||||
<td><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %></td>
|
<td><%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %></td>
|
<td><%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %></td>
|
<td><%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
|
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% total_qty += result.qty.to_f %>
|
<% total_qty += result.qty.to_f %>
|
||||||
@@ -65,9 +77,9 @@
|
|||||||
|
|
||||||
<tr style="border-top: 3px solid grey;">
|
<tr style="border-top: 3px solid grey;">
|
||||||
<td colspan="4"></td>
|
<td colspan="4"></td>
|
||||||
<td><b><%= sprintf("%.2f", total_qty) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(total_qty, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf("%.2f", total_price) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(total_price, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf("%.2f", total_amount) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -23,6 +23,18 @@
|
|||||||
|
|
||||||
<div class="margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card ">
|
<div class="card ">
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
<% unless @sale_data.blank? %>
|
<% unless @sale_data.blank? %>
|
||||||
|
|
||||||
<table class="table table-striped" border="0">
|
<table class="table table-striped" border="0">
|
||||||
@@ -52,7 +64,7 @@
|
|||||||
<td><%= credit.receipt_no rescue '-' %></td>
|
<td><%= credit.receipt_no rescue '-' %></td>
|
||||||
<td><%= credit.cashier_name rescue '-' %></td>
|
<td><%= credit.cashier_name rescue '-' %></td>
|
||||||
<td><%= credit.sale.customer.name rescue '-' %></td>
|
<td><%= credit.sale.customer.name rescue '-' %></td>
|
||||||
<td><%= credit.payment_amount rescue '-' %></td>
|
<td><%= number_with_precision(credit.payment_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -123,7 +135,10 @@
|
|||||||
|
|
||||||
function show_shift_name(period,period_type,from,to,shift_item){
|
function show_shift_name(period,period_type,from,to,shift_item){
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
|
if (from == '' && to == '') {
|
||||||
|
from = $("#from").val();
|
||||||
|
to = $("#to").val();
|
||||||
|
}
|
||||||
shift.empty();
|
shift.empty();
|
||||||
|
|
||||||
var str = '';
|
var str = '';
|
||||||
|
|||||||
@@ -44,6 +44,18 @@
|
|||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
<% unless @sale_data.empty? %>
|
<% unless @sale_data.empty? %>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -79,37 +91,37 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style='text-align:right;'><%= count %></td>
|
<td style='text-align:right;'><%= count %></td>
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:mpu_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:master_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:visa_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:jcb_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:paypar_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision, delimiter: delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="3" style='text-align:center;'>Total</td>
|
<td colspan="3" style='text-align:center;'>Total</td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(mpu , precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(master, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(visa, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(jcb, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(paypar, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(total, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% total_tax = 0 %>
|
<% total_tax = 0 %>
|
||||||
@@ -118,7 +130,7 @@
|
|||||||
<% total_tax += tax.tax_amount.to_f %>
|
<% total_tax += tax.tax_amount.to_f %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -126,7 +138,7 @@
|
|||||||
<% net = total - total_tax %>
|
<% net = total - total_tax %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="12" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
<td colspan="12" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(net, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -50,18 +50,30 @@
|
|||||||
<th><%= t("views.right_panel.detail.foc_sales") %></th>
|
<th><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
<% unless @sale_data.empty? %>
|
<% unless @sale_data.empty? %>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @sale_data.each do |sale| %>
|
<% @sale_data.each do |sale| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
<td><%= number_with_precision(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -108,11 +120,11 @@
|
|||||||
<!--<td><%= payment.sale.customer.name rescue '-' %></td>-->
|
<!--<td><%= payment.sale.customer.name rescue '-' %></td>-->
|
||||||
<td><%= payment.payment_method rescue '-' %></td>
|
<td><%= payment.payment_method rescue '-' %></td>
|
||||||
<% if payment.payment_method === 'cash' %>
|
<% if payment.payment_method === 'cash' %>
|
||||||
<td><%= payment.payment_amount - payment.change_amount%> </td>
|
<td><%= number_with_precision(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||||
<%else%>
|
<%else%>
|
||||||
<td><%= payment.payment_amount%> </td>
|
<td><%= number_with_precision(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||||
<%end%>
|
<%end%>
|
||||||
<td><%= payment.sale.grand_total rescue '-' %></td>
|
<td><%= number_with_precision(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -120,7 +132,7 @@
|
|||||||
<%if total>0%>
|
<%if total>0%>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" style="text-align: right;"><strong >Total </strong></td>
|
<td colspan="4" style="text-align: right;"><strong >Total </strong></td>
|
||||||
<td colspan="2"><strong><%=total%></strong></td>
|
<td colspan="2"><strong><%=number_with_precision(total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%end%>
|
<%end%>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -189,7 +201,10 @@
|
|||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
|
|
||||||
shift.empty();
|
shift.empty();
|
||||||
|
if (from == '' && to == '') {
|
||||||
|
from = $("#from").val();
|
||||||
|
to = $("#to").val();
|
||||||
|
}
|
||||||
var str = '';
|
var str = '';
|
||||||
var param_shift = '';
|
var param_shift = '';
|
||||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||||
|
|||||||
@@ -58,6 +58,22 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
puts precision
|
||||||
|
puts "predelidm"
|
||||||
|
puts delimiter %>
|
||||||
|
|
||||||
<% grand_total = 0 %>
|
<% grand_total = 0 %>
|
||||||
<% old_grand_total = 0 %>
|
<% old_grand_total = 0 %>
|
||||||
<% total_tax = 0 %>
|
<% total_tax = 0 %>
|
||||||
@@ -81,31 +97,31 @@
|
|||||||
|
|
||||||
<td><%= result.receipt_no rescue '-' %> </td>
|
<td><%= result.receipt_no rescue '-' %> </td>
|
||||||
<td><%= result.cashier_name rescue '-' %></td>
|
<td><%= result.cashier_name rescue '-' %></td>
|
||||||
<td><%= result.total_amount rescue '-' %></td>
|
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||||
<td><%= result.total_discount rescue '-' %></td>
|
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||||
<%if result.customer.customer_type == "Takeaway"%>
|
<%if result.customer.customer_type == "Takeaway"%>
|
||||||
<td>0.0</td>
|
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||||
<%end%>
|
<%end%>
|
||||||
<% result.sale_taxes.each do |tax| %>
|
<% result.sale_taxes.each do |tax| %>
|
||||||
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<td><%= result.grand_total %></td>
|
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<tr style="border-top:4px double #666;">
|
<tr style="border-top:4px double #666;">
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
<td><b><%= total_sum rescue '-'%></b></td>
|
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<% @sale_taxes.each do |tax| %>
|
<% @sale_taxes.each do |tax| %>
|
||||||
<td><b><%= tax.st_amount.round(2) %></b></td>
|
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
|
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
<td><b><%= number_with_precision(rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
|
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
@@ -196,7 +212,10 @@
|
|||||||
var str = '';
|
var str = '';
|
||||||
var param_shift = '';
|
var param_shift = '';
|
||||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||||
|
if (from == '' && to == '') {
|
||||||
|
from = $("#from").val();
|
||||||
|
to = $("#to").val();
|
||||||
|
}
|
||||||
url = '<%= reports_get_shift_by_date_path %>';
|
url = '<%= reports_get_shift_by_date_path %>';
|
||||||
|
|
||||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||||
|
|||||||
@@ -45,10 +45,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
<% unless @sale_data.blank? %>
|
<% unless @sale_data.blank? %>
|
||||||
<% acc_arr = Array.new %>
|
<% acc_arr = Array.new %>
|
||||||
<% cate_arr = Array.new %>
|
<% cate_arr = Array.new %>
|
||||||
|
|
||||||
|
<% sub_qty = 0 %>
|
||||||
<% sub_total = 0 %>
|
<% sub_total = 0 %>
|
||||||
<% other_sub_total = 0 %>
|
<% other_sub_total = 0 %>
|
||||||
<% count = 0 %>
|
<% count = 0 %>
|
||||||
@@ -85,7 +98,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<% @totalByAccount.each do |account, total| %>
|
<% @totalByAccount.each do |account, total| %>
|
||||||
<% if sale.account_id == account %>
|
<% if sale.account_id == account %>
|
||||||
<b><%= total %></b>
|
<b><%= number_with_precision(total, precision:precision,delimiter:delimiter) %></b>
|
||||||
<% grand_total += total %>
|
<% grand_total += total %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -104,22 +117,29 @@
|
|||||||
<td><%= sale.item_code rescue '-' %></td>
|
<td><%= sale.item_code rescue '-' %></td>
|
||||||
<td><%= sale.product_name rescue '-' %></td>
|
<td><%= sale.product_name rescue '-' %></td>
|
||||||
<td><%= sale.total_item rescue '-' %></td>
|
<td><%= sale.total_item rescue '-' %></td>
|
||||||
<td><%= sale.unit_price rescue '-' %></td>
|
<td><%= number_with_precision(sale.unit_price , precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td><%= sale.grand_total rescue '-' %></td>
|
<td><%= number_with_precision(sale.grand_total , precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- sub total -->
|
<!-- sub total -->
|
||||||
<% @menu_cate_count.each do |key,value| %>
|
|
||||||
<% if sale.menu_category_id == key %>
|
|
||||||
|
|
||||||
|
<% @menu_cate_count.each do |key,value| %>
|
||||||
|
<% if sale.account_id == key %>
|
||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
<% sub_total += sale.grand_total %>
|
<% sub_total += sale.grand_total %>
|
||||||
|
<% #sub_qty += sale.total_item %>
|
||||||
|
<% if sale.status_type != "Discount" && sale.status_type != "foc"
|
||||||
|
sub_qty += sale.total_item
|
||||||
|
end %>
|
||||||
<% if count == value %>
|
<% if count == value %>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"> </td>
|
<td colspan="3"> </td>
|
||||||
|
<td><b>Total <%= sale.account_name %> Qty </b> </td>
|
||||||
|
<td><b><%= sub_qty %></b></td>
|
||||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||||
<td ><span class="underline"><%= sub_total %></span></td>
|
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision,delimiter:delimiter)%> </span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% sub_total = 0.0%>
|
<% sub_total = 0.0%>
|
||||||
|
<% sub_qty = 0 %>
|
||||||
<% count = 0%>
|
<% count = 0%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -127,7 +147,7 @@
|
|||||||
<!-- end sub total -->
|
<!-- end sub total -->
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--Other Charges -->
|
<!--Other Charges -->
|
||||||
|
<% if @other_charges.present? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Other Charges</b></td>
|
<td><b>Other Charges</b></td>
|
||||||
<td colspan="4"> </td>
|
<td colspan="4"> </td>
|
||||||
@@ -144,8 +164,8 @@
|
|||||||
<td><%= other.item_code rescue '-' %></td>
|
<td><%= other.item_code rescue '-' %></td>
|
||||||
<td><%= other.product_name rescue '-' %></td>
|
<td><%= other.product_name rescue '-' %></td>
|
||||||
<td><%= other.total_item rescue '-' %></td>
|
<td><%= other.total_item rescue '-' %></td>
|
||||||
<td><%= other.unit_price rescue '-' %></td>
|
<td> <%= number_with_precision(other.unit_price , precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td><%= other.grand_total rescue '-' %></td>
|
<td> <%= number_with_precision(other.grand_total , precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- sub total -->
|
<!-- sub total -->
|
||||||
|
|
||||||
@@ -155,38 +175,38 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"> </td>
|
<td colspan="5"> </td>
|
||||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||||
<td ><span><%= other_sub_total %></span></td>
|
<td ><span><%= number_with_precision(other_sub_total , precision:precision,delimiter:delimiter)%></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<%end%>
|
||||||
<!-- End Other Charges -->
|
<!-- End Other Charges -->
|
||||||
<tr style="border-top:2px solid grey;">
|
<tr style="border-top:2px solid grey;">
|
||||||
<td colspan="3"> </td>
|
<td colspan="3"> </td>
|
||||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
||||||
<td><span><%= total_qty%></span></td>
|
<td><span><%= total_qty%></span></td>
|
||||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||||
<td style="border-bottom:2px solid grey;"><span><%= grand_total%></span></td>
|
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision,delimiter:delimiter)%></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"> </td>
|
<td colspan="5"> </td>
|
||||||
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
|
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||||
<td><span><%= total_item_foc %></span></td>
|
<td><span><%= number_with_precision(total_item_foc , precision:precision,delimiter:delimiter) %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"> </td>
|
<td colspan="5"> </td>
|
||||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||||
<td style="border-bottom:2px solid grey;"><span><%= total_item_dis %></span></td>
|
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision,delimiter:delimiter) %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"> </td>
|
<td colspan="5"> </td>
|
||||||
<td><%= t("views.right_panel.detail.foc_sales") %></td>
|
<td><%= t("views.right_panel.detail.foc_sales") %></td>
|
||||||
<td><span><%= @foc_data %></span></td>
|
<td><span><%= number_with_precision(@foc_data , precision:precision,delimiter:delimiter) %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"> </td>
|
<td colspan="5"> </td>
|
||||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||||
<td style="border-bottom:2px solid grey;"><span><%= @discount_data %></span></td>
|
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(@discount_data , precision:precision,delimiter:delimiter) %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% @sale_taxes.each do |tax| %>
|
<% @sale_taxes.each do |tax| %>
|
||||||
@@ -202,7 +222,7 @@
|
|||||||
<td colspan="5"> </td>
|
<td colspan="5"> </td>
|
||||||
<td style="border-top:2px solid grey;">Net Amount</td>
|
<td style="border-top:2px solid grey;">Net Amount</td>
|
||||||
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
||||||
<td style="border-top:2px solid grey;"><%= grand_total.to_f - @discount_data.to_f%></td>
|
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision,delimiter:delimiter)%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- <tr>
|
<!-- <tr>
|
||||||
<td colspan="5"> </td>
|
<td colspan="5"> </td>
|
||||||
@@ -291,7 +311,10 @@
|
|||||||
|
|
||||||
function show_shift_name(period,period_type,from,to,shift_item){
|
function show_shift_name(period,period_type,from,to,shift_item){
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
|
if (from == '' && to == '') {
|
||||||
|
from = $("#from").val();
|
||||||
|
to = $("#to").val();
|
||||||
|
}
|
||||||
shift.empty();
|
shift.empty();
|
||||||
var selected = '';
|
var selected = '';
|
||||||
var str = '';
|
var str = '';
|
||||||
|
|||||||
@@ -63,6 +63,18 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
<% void = 0%>
|
<% void = 0%>
|
||||||
<% cash = 0%>
|
<% cash = 0%>
|
||||||
<% credit = 0%>
|
<% credit = 0%>
|
||||||
@@ -86,16 +98,16 @@
|
|||||||
<%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %>
|
<%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %>
|
||||||
</td>
|
</td>
|
||||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||||
<td><%= sprintf "%.2f",result[:cash_sales].to_f.to_d rescue '-'%></td>
|
<td><%= number_with_precision(result[:cash_sales].to_f, precision:precision,delimiter:delimiter) %></td>
|
||||||
<td><%= sprintf "%.2f",result[:credit_sales].to_f.to_d rescue '-'%></td>
|
<td><%= number_with_precision(result[:credit_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
||||||
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
||||||
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
||||||
<td><%= sprintf "%.2f",result[:other_sales].to_f.to_d rescue '-'%></td>
|
<td><%= number_with_precision(result[:other_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td>
|
<td>
|
||||||
<%= sprintf "%.2f",result[:foc_sales].to_f.to_d rescue '-'%>
|
<%= number_with_precision(result[:foc_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%>
|
||||||
</td>
|
</td>
|
||||||
<td><%= sprintf "%.2f",result[:grand_total].to_f.to_d rescue '-'%></td>
|
<td><%= number_with_precision(result[:grand_total].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
<!-- <td><%= sprintf "%.2f",result[:rounding_adj].to_f.to_d rescue '-'%></td> -->
|
<!-- <td><%= sprintf "%.2f",result[:rounding_adj].to_f.to_d rescue '-'%></td> -->
|
||||||
<% grand_total = result[:grand_total].to_f %>
|
<% grand_total = result[:grand_total].to_f %>
|
||||||
@@ -114,15 +126,15 @@
|
|||||||
<tr style="border-top: 3px solid grey;">
|
<tr style="border-top: 3px solid grey;">
|
||||||
<td colspan="3"></td>
|
<td colspan="3"></td>
|
||||||
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
||||||
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
<td><b><%= number_with_precision(cash, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
<td><b><%= number_with_precision(credit, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
|
||||||
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
<td><b><%= number_with_precision(card, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td>
|
<td><b><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
|
||||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
<td><b><%= number_with_precision(g_total, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -191,7 +203,10 @@
|
|||||||
|
|
||||||
function show_shift_name(period,period_type,from,to,shift_item){
|
function show_shift_name(period,period_type,from,to,shift_item){
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
|
if (from == '' && to == '') {
|
||||||
|
from = $("#from").val();
|
||||||
|
to = $("#to").val();
|
||||||
|
}
|
||||||
shift.empty();
|
shift.empty();
|
||||||
|
|
||||||
var str = '';
|
var str = '';
|
||||||
|
|||||||
@@ -52,6 +52,18 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<% if @print_settings.precision.to_i > 0
|
||||||
|
precision = @print_settings.precision
|
||||||
|
else
|
||||||
|
precision = 0
|
||||||
|
end
|
||||||
|
#check delimiter
|
||||||
|
if @print_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
%>
|
||||||
<% total_amount = 0.0 %>
|
<% total_amount = 0.0 %>
|
||||||
<% grand_total = 0.0 %>
|
<% grand_total = 0.0 %>
|
||||||
<% rounding_adjustment = 0.0 %>
|
<% rounding_adjustment = 0.0 %>
|
||||||
@@ -61,10 +73,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= item.receipt_no rescue '-' %> </td>
|
<td><%= item.receipt_no rescue '-' %> </td>
|
||||||
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
|
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
|
||||||
<td><%= item.total_amount.to_f rescue '-'%> </td>
|
<td><%= number_with_precision(item.total_amount.to_f, precision: precision.to_i ,delimiter: delimiter) %> </td>
|
||||||
<td><%= item.grand_total.to_f rescue '-'%> </td>
|
<td><%= number_with_precision(item.grand_total.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
|
||||||
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
|
<td><%= number_with_precision(item.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
|
<td><%= number_with_precision(item.grand_total.to_f + item.rounding_adjustment.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
|
||||||
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
||||||
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
||||||
</tr>
|
</tr>
|
||||||
@@ -76,10 +88,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<tr style="border-top:4px double #666;font-weight:600;">
|
<tr style="border-top:4px double #666;font-weight:600;">
|
||||||
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
||||||
<td><%= total_amount rescue '-' %></td>
|
<td><%= number_with_precision(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= grand_total rescue '-' %></td>
|
<td><%= number_with_precision(grand_total, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= rounding_adjustment rescue '-'%></td>
|
<td><%= number_with_precision(rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||||
<td colspan="3"><%= grand_rounding_adjustment rescue '-'%></td>
|
<td colspan="3"><%= number_with_precision(grand_rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -144,7 +156,10 @@
|
|||||||
|
|
||||||
function show_shift_name(period,period_type,from,to,shift_item){
|
function show_shift_name(period,period_type,from,to,shift_item){
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
|
if (from == '' && to == '') {
|
||||||
|
from = $("#from").val();
|
||||||
|
to = $("#to").val();
|
||||||
|
}
|
||||||
shift.empty();
|
shift.empty();
|
||||||
|
|
||||||
var str = '';
|
var str = '';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<th><%= t("views.right_panel.detail.name") %></th>
|
<th><%= t("views.right_panel.detail.name") %></th>
|
||||||
<th><%= t("views.right_panel.detail.alt_name") %></th>
|
<th><%= t("views.right_panel.detail.alt_name") %></th>
|
||||||
<th><%= t("views.right_panel.detail.is_available") %></th>
|
<th><%= t("views.right_panel.detail.is_available") %></th>
|
||||||
<th><%= t("views.right_panel.detail.order_by") %></th>
|
<!-- <th><%= t("views.right_panel.detail.order_by") %></th> -->
|
||||||
<th><%= t("views.right_panel.detail.parent") %></th>
|
<th><%= t("views.right_panel.detail.parent") %></th>
|
||||||
<th><%= t("views.right_panel.detail.actions") %></th>
|
<th><%= t("views.right_panel.detail.actions") %></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
|
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
|
||||||
<td><%= settings_menu_category.alt_name rescue ''%></td>
|
<td><%= settings_menu_category.alt_name rescue ''%></td>
|
||||||
<td><%= settings_menu_category.is_available rescue false%></td>
|
<td><%= settings_menu_category.is_available rescue false%></td>
|
||||||
<td><%= settings_menu_category.order_by rescue ''%></td>
|
<!-- <td><%= settings_menu_category.order_by rescue ''%></td> -->
|
||||||
<td><%= settings_menu_category.parent.name rescue ''%></td>
|
<td><%= settings_menu_category.parent.name rescue ''%></td>
|
||||||
<td><%= link_to t("views.btn.edit"), edit_settings_menu_category_path(settings_menu_category),:class => 'btn btn-info btn-sm waves-effect' %>
|
<td><%= link_to t("views.btn.edit"), edit_settings_menu_category_path(settings_menu_category),:class => 'btn btn-info btn-sm waves-effect' %>
|
||||||
</td></td>
|
</td></td>
|
||||||
@@ -51,9 +51,9 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<%= paginate @settings_menu_categories, param_name: :page, :outer_window => 3 %>
|
<%= paginate @settings_menu_categories, param_name: :page, :outer_window => 3 %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
|
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
|
|||||||
1
app/views/sym_control/run.html.erb
Executable file
1
app/views/sym_control/run.html.erb
Executable file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
20
config/deploy.rb
Normal file
20
config/deploy.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
lock "3.10.1"
|
||||||
|
|
||||||
|
set :application, "zsai"
|
||||||
|
set :repo_url, 'git@bitbucket.org:code2lab/sxrestaurant.git'
|
||||||
|
|
||||||
|
set :deploy_user, 'deploy'
|
||||||
|
|
||||||
|
set :rbenv_type, :global
|
||||||
|
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
|
||||||
|
|
||||||
|
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
|
||||||
|
|
||||||
|
set :keep_releases, 5
|
||||||
|
|
||||||
|
set :linked_files, %w{config/database.yml config/secrets.yml config/puma.rb config/sidekiq.yml config/shops.json}
|
||||||
|
|
||||||
|
set :linked_dirs, %w{bin log tmp/puma tmp/pids tmp/cache tmp/sockets vendor/bundle public/system pids sockets}
|
||||||
|
|
||||||
|
set :tests, []
|
||||||
|
set :pty, true
|
||||||
9
config/deploy/production.rb
Normal file
9
config/deploy/production.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
set :stage, :production
|
||||||
|
set :server_name, "svr.sxrestaurant.host"
|
||||||
|
|
||||||
|
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
||||||
|
server '192.168.1.27', user: 'deploy', roles: %w{web app db}, primary: true
|
||||||
|
|
||||||
|
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
||||||
|
set :rbenv_ruby, '2.4.1'
|
||||||
|
set :rails_env, :production
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
iv_key: A30HZdW+iDZA0vM5PAqwgg==
|
iv_key: TP8dIx4nBGzr+tYyKn5+Xw==
|
||||||
shop_name: 7DdPBxVo8m1xpa5T2kIcWQ==
|
shop_name: Osaka
|
||||||
email: yanaung.nyein@code2lab.com
|
email: wathonaun9@gmail.com
|
||||||
telephone: 111111
|
telephone: 09979204288
|
||||||
fax: 111111
|
fax: 09979204288
|
||||||
address: bitp
|
address: Yangon
|
||||||
dbhost: 9+83FZetcbLZi6COG5PbSw==
|
dbhost: nk57NaR38B2eSYyron3Nbw==
|
||||||
dbschema: shztSYIsNmM9nlHkR/4exQ==
|
dbschema: 3orxFaTi0uQhatBqZGiitQ==
|
||||||
dbusername: LapN+Geriht8yk866FxNiQ==
|
dbusername: EtMle9Gr0/PE3NFHHfwo5A==
|
||||||
dbpassword: QtboWZ4ATE05vvYw6J+Uqw==
|
dbpassword: 86h61/O38GGo64nekz6oeA==
|
||||||
api_token: nGyMizHtoVEFYCjSVEFJuzkxuBJwSsH
|
api_token: FVAGMnjVdaScfydXMbMvPPRWnkEwCSuxs
|
||||||
app_token: QUdPwSakcsnuVLdfkXgGHhPMiIOcSSfaVwQyA
|
app_token: IoXPdqzbnQWbHsnxLAjMjimnjEJNySOeIo
|
||||||
|
plan_sku: PyQJ2sk5NZTudqQ2YIU16A==
|
||||||
plan_sku: 001
|
renewable_date: d/Fk1deU/iPbZFDOdyKsjA==
|
||||||
renewable_date: 2018-12-14
|
plan_name: weWOqr1tZ61Av6YKth1lDw==
|
||||||
plan_name: Community
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
#--------- SmartSales Activation ------------#
|
#--------- SmartSales Activation ------------#
|
||||||
get 'activate' => 'install#index'
|
get 'activate' => 'install#index'
|
||||||
post 'activate' => 'install#activate'
|
post 'activate' => 'install#activate'
|
||||||
|
get 'run_sym' => 'sym_control#run'
|
||||||
|
|
||||||
#--------- Login/Authentication ------------#
|
#--------- Login/Authentication ------------#
|
||||||
get 'auth/:emp_id' => 'home#show', as: :emp_login
|
get 'auth/:emp_id' => 'home#show', as: :emp_login
|
||||||
@@ -244,7 +245,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post "/:id", to: "edit#update"
|
post "/:id", to: "edit#update"
|
||||||
|
|
||||||
# Pass assigned_order_item_id
|
# Pass assigned_order_item_id
|
||||||
get 'print/print/:id', to: "print#print"
|
post 'print/print/:id', to: "print#print"
|
||||||
get 'print/print_order_summary/:id', to: "print#print_order_summary"
|
get 'print/print_order_summary/:id', to: "print#print_order_summary"
|
||||||
|
|
||||||
get "/get_items/:id" => "home#get_items_by_oqs", :as => "get_order_items_by_oqs"
|
get "/get_items/:id" => "home#get_items_by_oqs", :as => "get_order_items_by_oqs"
|
||||||
|
|||||||
@@ -12,12 +12,10 @@
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
sx_provision_url: connect.smartsales.asia/api #provision.zsai.ws/api
|
sx_provision_url: 192.168.1.49:3002/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||||
server_mode: cloud
|
server_mode: application
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
aes_key: <%= ENV['AES_KEY'] %>
|
|
||||||
aes_iv: <%= ENV['AES_IV'] %>
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
||||||
@@ -30,6 +28,4 @@ production:
|
|||||||
server_mode: cloud
|
server_mode: cloud
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
aes_key: <%= ENV['AES_KEY'] %>
|
|
||||||
aes_iv: <%= ENV['AES_IV'] %>
|
|
||||||
|
|
||||||
|
|||||||
11
db/seeds.rb
11
db/seeds.rb
@@ -144,6 +144,7 @@ menu_pkg_options = MenuItemOption.create([{option_type: "Package", name: "Bottle
|
|||||||
# menu_category2 = MenuCategory.create({menu: menu, code:"C005", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 2,created_by: "SYSTEM DEFAULT"})
|
# menu_category2 = MenuCategory.create({menu: menu, code:"C005", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 2,created_by: "SYSTEM DEFAULT"})
|
||||||
# menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Pork", alt_name: "Pork", order_by: 3,created_by: "SYSTEM DEFAULT"})
|
# menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Pork", alt_name: "Pork", order_by: 3,created_by: "SYSTEM DEFAULT"})
|
||||||
# menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Chicken", alt_name: "Chicken", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"})
|
# menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Chicken", alt_name: "Chicken", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"})
|
||||||
|
# menu_category5 = MenuCategory.create({menu: menu, code:"C001", name: "Extra Time", alt_name: "Extra Time", order_by: 1, is_available: 1, created_by: "SYSTEM DEFAULT"})
|
||||||
#
|
#
|
||||||
# #Default Menu items
|
# #Default Menu items
|
||||||
# menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
# menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||||
@@ -167,6 +168,16 @@ menu_pkg_options = MenuItemOption.create([{option_type: "Package", name: "Bottle
|
|||||||
|
|
||||||
# menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"P00002", name: "Child", alt_name: "",menu_category: menu_category1 , min_qty: 1, account: person, :item_attributes => "['2']", created_by: "System" })
|
# menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"P00002", name: "Child", alt_name: "",menu_category: menu_category1 , min_qty: 1, account: person, :item_attributes => "['2']", created_by: "System" })
|
||||||
# menu_item1_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"PI0002", menu_item: menu_category1_menu_item1, price:10000.00, is_on_promotion:false, is_default:true, :item_attributes => "['2']" })
|
# menu_item1_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"PI0002", menu_item: menu_category1_menu_item1, price:10000.00, is_on_promotion:false, is_default:true, :item_attributes => "['2']" })
|
||||||
|
|
||||||
|
# menu_item_attribute_30_min = MenuItemAttribute.create({attribute_type:"Extra Time", name: "30 min", value: "30_min"})
|
||||||
|
# menu_item_attribute_60_min = MenuItemAttribute.create({attribute_type:"Extra Time", name: "1 hrs", value: "60_min"})
|
||||||
|
|
||||||
|
# menu_category1_menu_item2 = SimpleMenuItem.create({item_code:"Ext30", name: "30 minutes", alt_name: "",menu_category: menu_category5 , min_qty: 1, account: extra_time, :item_attributes => "['1']", created_by: "System" })
|
||||||
|
# menu_item0_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"Exti30", menu_item: menu_category1_menu_item2, price:15000.00, is_on_promotion:false, is_default:true, :item_attributes => "['1']" })
|
||||||
|
|
||||||
|
# menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"Ext60", name: "1 hour", alt_name: "",menu_category: menu_category5 , min_qty: 1, account: extra_time, :item_attributes => "['2']", created_by: "System" })
|
||||||
|
# menu_item1_instance = MenuItemInstance.create({item_instance_name:"",item_instance_code:"Exti60", menu_item: menu_category1_menu_item3, price:10000.00, is_on_promotion:false, is_default:true, :item_attributes => "['2']" })
|
||||||
|
|
||||||
# END
|
# END
|
||||||
|
|
||||||
menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size", name: "Small", value: "small"})
|
menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size", name: "Small", value: "small"})
|
||||||
|
|||||||
Reference in New Issue
Block a user