change UI set menu and add lateset order no in receipt bill for QuickService

This commit is contained in:
phyusin
2018-09-06 15:15:28 +06:30
parent 6af0c40456
commit e450927d81
9 changed files with 468 additions and 432 deletions

View File

@@ -64,7 +64,17 @@ $(document).ready(function() {
$('#modal-set-slimscroll').slimScroll({ $('#modal-set-slimscroll').slimScroll({
height: height-$('#modal-set-slimscroll').attr('data-height'), height: height-$('#modal-set-slimscroll').attr('data-height'),
size: '5px', size: '10px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 45
});
$('#set-menu-item-slimscroll').slimScroll({
height: height-$('#set-menu-item-slimscroll').attr('data-height'),
size: '10px',
color: 'rgba(0,0,0,0.5)', color: 'rgba(0,0,0,0.5)',
alwaysVisible: false, alwaysVisible: false,
borderRadius: '0', borderRadius: '0',

View File

@@ -91,7 +91,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount) filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
@@ -111,6 +111,7 @@ class Origami::PaymentsController < BaseOrigamiController
type = params[:type] type = params[:type]
tax_type = params[:tax_type] tax_type = params[:tax_type]
path = request.fullpath path = request.fullpath
latest_order_no = nil
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
@@ -204,6 +205,11 @@ class Origami::PaymentsController < BaseOrigamiController
table_id = 0 table_id = 0
end end
latest_order = booking.booking_orders.order("order_id DESC").limit(1).first()
if !latest_order.nil?
latest_order_no = latest_order.order_id
end
booking.booking_orders.each do |order| booking.booking_orders.each do |order|
# Order.pay_process_order_queue(order.order_id, table_id) # Order.pay_process_order_queue(order.order_id, table_id)
oqs = OrderQueueStation.new oqs = OrderQueueStation.new
@@ -237,7 +243,7 @@ class Origami::PaymentsController < BaseOrigamiController
other_amount = SaleItem.calculate_other_charges(sale_items) other_amount = SaleItem.calculate_other_charges(sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no)
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name}) render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
@@ -442,11 +448,17 @@ class Origami::PaymentsController < BaseOrigamiController
def reprint def reprint
sale_id = params[:sale_id] sale_id = params[:sale_id]
member_info = nil member_info = nil
latest_order_no = nil
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
# For Cashier by Zone # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
booking = Booking.find_by_sale_id(sale_id)
latest_order = booking.booking_orders.joins(" JOIN orders ON orders.order_id = booking_orders.order_id").where("orders.source = 'quick_service'").order("order_id DESC").limit(1).first()
if !latest_order.nil?
latest_order_no = latest_order.order_id
end
# if bookings.count > 1 # if bookings.count > 1
# # for Multiple Booking # # for Multiple Booking
# table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
@@ -514,7 +526,7 @@ class Origami::PaymentsController < BaseOrigamiController
other_amount = SaleItem.calculate_other_charges(saleObj.sale_items) other_amount = SaleItem.calculate_other_charges(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount) filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no)
result = { result = {
:status => true, :status => true,
@@ -600,7 +612,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount,nil)
result = { result = {
:status => true, :status => true,
:filepath => filename, :filepath => filename,

View File

@@ -126,7 +126,7 @@ class Origami::VoidController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
other_amount = SaleItem.calculate_other_charges(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
:printer_model => print_settings.brand_name, :printer_model => print_settings.brand_name,

View File

@@ -107,7 +107,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
other_amount = SaleItem.calculate_other_charges(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
:printer_model => print_settings.brand_name, :printer_model => print_settings.brand_name,

View File

@@ -363,7 +363,7 @@ class Transactions::SalesController < ApplicationController
other_amount = SaleItem.calculate_other_charges(sale.sale_items) #other charges other_amount = SaleItem.calculate_other_charges(sale.sale_items) #other charges
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil)
result = { result = {
:filepath => filename, :filepath => filename,
:printer_model => print_settings.brand_name, :printer_model => print_settings.brand_name,

View File

@@ -188,19 +188,19 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end end
#Bill Receipt Print #Bill Receipt Print
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount) def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no)
#Use CUPS service #Use CUPS service
#Generate PDF #Generate PDF
#Print #Print
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no)
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
if !receipt_bill_a5_pdf.empty? if !receipt_bill_a5_pdf.empty?
receipt_bill_a5_pdf.each do |receipt_bilA5| receipt_bill_a5_pdf.each do |receipt_bilA5|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf' if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
if receipt_bilA5[1] == '1' if receipt_bilA5[1] == '1'
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no)
else else
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no)
end end
end end
end end

View File

@@ -2,7 +2,7 @@ class ReceiptBillA5Pdf < Prawn::Document
include ActionView::Helpers::NumberHelper 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, :line_move 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, :line_move
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,card_data,other_charges_amount) 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,card_data,other_charges_amount,latest_order_no)
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.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = printer_settings.header_font_size.to_i
@@ -56,7 +56,7 @@ class ReceiptBillA5Pdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
cashier_info(sale_data, customer_name) cashier_info(sale_data, customer_name, latest_order_no)
line_items(sale_items,printer_settings.precision,delimiter) line_items(sale_items,printer_settings.precision,delimiter)
all_total(sale_data,printer_settings.precision,delimiter) all_total(sale_data,printer_settings.precision,delimiter)
@@ -112,7 +112,7 @@ class ReceiptBillA5Pdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
end end
def cashier_info(sale_data, customer_name) def cashier_info(sale_data, customer_name, latest_order_no)
move_down line_move move_down line_move
# move_down 2 # move_down 2
y_position = cursor y_position = cursor
@@ -160,6 +160,14 @@ class ReceiptBillA5Pdf < Prawn::Document
# :size => self.item_font_size,:align => :right # :size => self.item_font_size,:align => :right
# end # end
if !latest_order_no.nil?
y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
text "OrderNo : #{ latest_order_no }",:size => self.item_font_size,:align => :left
end
end
move_down line_move move_down line_move
stroke_horizontal_rule stroke_horizontal_rule
end end

View File

@@ -3,7 +3,7 @@ class ReceiptBillPdf < 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, :description_width, :price_num_width, :line_move 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, :line_move
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,card_data,other_charges_amount) 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,card_data,other_charges_amount,latest_order_no)
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.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = printer_settings.header_font_size.to_i
@@ -57,7 +57,7 @@ class ReceiptBillPdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
cashier_info(sale_data, customer_name) cashier_info(sale_data, customer_name, latest_order_no)
line_items(sale_items,printer_settings.precision,delimiter) line_items(sale_items,printer_settings.precision,delimiter)
all_total(sale_data,printer_settings.precision,delimiter) all_total(sale_data,printer_settings.precision,delimiter)
@@ -112,7 +112,7 @@ class ReceiptBillPdf < Prawn::Document
stroke_horizontal_rule stroke_horizontal_rule
end end
def cashier_info(sale_data, customer_name) def cashier_info(sale_data, customer_name, latest_order_no)
move_down line_move move_down line_move
# move_down 2 # move_down 2
@@ -153,7 +153,13 @@ class ReceiptBillPdf < Prawn::Document
# - #{ 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 # :size => self.item_font_size,:align => :right
# end # end
if !latest_order_no.nil?
y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
text "OrderNo : #{ latest_order_no }",:size => self.item_font_size,:align => :left
end
end
move_down line_move move_down line_move
stroke_horizontal_rule stroke_horizontal_rule
end end

View File

@@ -413,22 +413,14 @@
<!-- Large modal --> <!-- Large modal -->
<div class=" modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" > <div class="modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="sx_item_set_detailLabel" aria-hidden="true" >
<div class="modal-dialog custom-modal-dialog modal-lg"> <div class="modal-dialog custom-modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;"> <div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4> <h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
<!-- <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button> --> <button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div> </div>
<div class="col-md-6"> <div class="modal-body" id="set-menu-item-slimscroll" data-height="50">
<button type="button" class="btn btn-primary set_order" data-dismiss="modal" id="set_order">Add to Order</button>
</div>
</div>
</div>
<div class="modal-body">
<div class="row set-item"> <div class="row set-item">
<div class="col-md-4"> <div class="col-md-4">
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p> <p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
@@ -459,7 +451,7 @@
<p class="hidden" id="set_item_code"></p> <p class="hidden" id="set_item_code"></p>
<p></p> <p></p>
<div class="" id="modal-slimscroll" data-height="100"> <div class="" id="modal-set-slimscroll" data-height="100">
<div class="options-list" style="margin-top:-5px"> <div class="options-list" style="margin-top:-5px">
</div> </div>
@@ -469,6 +461,7 @@
</div> </div>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<div class="instance-list row"></div> <div class="instance-list row"></div>
</div> </div>
@@ -478,11 +471,18 @@
<div class="mr-auto"> <div class="mr-auto">
<h4 class=" pull-left">Total : <span id="set_total_price"></span></h4> <h4 class=" pull-left">Total : <span id="set_total_price"></span></h4>
</div> </div>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary set_order" data-dismiss="modal" id="set_order">Add to Order</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<% if type && !modify_order%> <% if type && !modify_order%>
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog"> <div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
@@ -565,7 +565,7 @@
} }
</style> </style>
<script> <script>
var cashier_type = $('#cashier_type').val(); var cashier_type = $('#cashier_type').val();
jQuery(function(){ jQuery(function(){
var menus = JSON.parse(localStorage.getItem("menus")); var menus = JSON.parse(localStorage.getItem("menus"));
@@ -831,4 +831,4 @@
showHideNavbar(webview); showHideNavbar(webview);
<% end %> <% end %>
}); });
</script> </script>