Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into split_bill
This commit is contained in:
@@ -10,7 +10,9 @@ class Oqs::EditController < BaseOqsController
|
|||||||
qty_weight = params[:qty_weight]
|
qty_weight = params[:qty_weight]
|
||||||
remarks = params[:remarks]
|
remarks = params[:remarks]
|
||||||
|
|
||||||
order_item = OrderItem.find(order_items_id);
|
order_item = OrderItem.find(order_items_id)
|
||||||
|
before_updated_qty = order_item.qty
|
||||||
|
|
||||||
order_item.item_order_by = current_user.name
|
order_item.item_order_by = current_user.name
|
||||||
order_item.qty = qty_weight
|
order_item.qty = qty_weight
|
||||||
order_item.remark = remarks
|
order_item.remark = remarks
|
||||||
@@ -45,7 +47,7 @@ class Oqs::EditController < BaseOqsController
|
|||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
|
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Oqs::PrintController < ApplicationController
|
|||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
|
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, "", options )
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
rebate = MembershipSetting.find_by_rebate(1)
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
if customer.membership_id != nil && rebate
|
if customer.membership_id != nil && rebate
|
||||||
member_info = Customer.get_member_account(customer)
|
member_info = Customer.get_member_account(customer)
|
||||||
# current_balance = SaleAudit.paymal_search(sale_id)
|
current_balance = SaleAudit.paymal_search(sale_id)
|
||||||
current_balance = 0
|
# current_balance = 0
|
||||||
end
|
end
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||||
|
|
||||||
def print_order_item(print_settings,oqs, order_id, order_item_id, print_status, options="")
|
def print_order_item(print_settings,oqs, order_id, order_item_id, print_status, before_updated_qty="", options="")
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
@@ -14,7 +14,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||||
|
|
||||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
# if order_item[0].price != 0
|
# if order_item[0].price != 0
|
||||||
@@ -22,15 +22,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
order_slim_pdf.each do |order_item_slim|
|
order_slim_pdf.each do |order_item_slim|
|
||||||
if order_item_slim[0] == 'OrderSlimPdf'
|
if order_item_slim[0] == 'OrderSlimPdf'
|
||||||
if order_item_slim[1] == '1'
|
if order_item_slim[1] == '1'
|
||||||
pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||||
else
|
else
|
||||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||||
end
|
end
|
||||||
elsif order_item_slim[0] == 'OrderSetPdf'
|
elsif order_item_slim[0] == 'OrderSetPdf'
|
||||||
if order_item_slim[1] == '1'
|
if order_item_slim[1] == '1'
|
||||||
pdf = OrderSetItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
pdf = OrderSetItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||||
else
|
else
|
||||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class OrderItemPdf < Prawn::Document
|
class OrderItemPdf < 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
|
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, print_status, options, alt_name)
|
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
|
||||||
self.page_width = print_settings.page_width
|
self.page_width = print_settings.page_width
|
||||||
self.page_height = print_settings.page_height
|
self.page_height = print_settings.page_height
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
@@ -46,7 +46,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
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)
|
||||||
|
|
||||||
# order items
|
# order items
|
||||||
order_items(order_item, options, alt_name, print_settings.precision)
|
order_items(order_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write Order Information to PDF
|
# Write Order Information to PDF
|
||||||
@@ -74,7 +74,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order items to PDF
|
# Write Order items to PDF
|
||||||
def order_items(order_item, options, alt_name, precision)
|
def order_items(order_item, options, alt_name, precision, before_updated_qty)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
#Add Order Item
|
#Add Order Item
|
||||||
@@ -82,6 +82,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
|
|
||||||
dash(1, :space => 1, :phase => 1)
|
dash(1, :space => 1, :phase => 1)
|
||||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
|
add_updated_qty_text(before_updated_qty, order_item.qty, precision)
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -127,4 +128,17 @@ class OrderItemPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#add updated qty text
|
||||||
|
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
|
||||||
|
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
# add option
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class OrderItemSlimPdf < Prawn::Document
|
class OrderItemSlimPdf < 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
|
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)
|
def initialize(print_settings,order_item_slim, print_status, options, alt_name, before_updated_qty)
|
||||||
self.page_width = print_settings.page_width
|
self.page_width = print_settings.page_width
|
||||||
self.page_height = print_settings.page_height
|
self.page_height = print_settings.page_height
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
@@ -46,7 +46,7 @@ class OrderItemSlimPdf < Prawn::Document
|
|||||||
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)
|
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)
|
||||||
|
|
||||||
# order items slim
|
# order items slim
|
||||||
order_items_slim(order_item_slim, options, alt_name, print_settings.precision)
|
order_items_slim(order_item_slim, options, alt_name, print_settings.precision, before_updated_qty)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write Order Information to PDF
|
# Write Order Information to PDF
|
||||||
@@ -74,7 +74,7 @@ class OrderItemSlimPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order items to PDF
|
# Write Order items to PDF
|
||||||
def order_items_slim(order_item_slim, options, alt_name, precision)
|
def order_items_slim(order_item_slim, options, alt_name, precision, before_updated_qty)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
#Add Order Item
|
#Add Order Item
|
||||||
@@ -82,6 +82,7 @@ class OrderItemSlimPdf < Prawn::Document
|
|||||||
|
|
||||||
dash(1, :space => 1, :phase => 1)
|
dash(1, :space => 1, :phase => 1)
|
||||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
|
add_updated_qty_text(before_updated_qty, order_item_slim.qty, precision)
|
||||||
move_down 1
|
move_down 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -126,4 +127,17 @@ class OrderItemSlimPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#add updated qty text
|
||||||
|
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
|
||||||
|
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
|
||||||
|
move_down 1
|
||||||
|
|
||||||
|
# add option
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class OrderSetItemPdf < Prawn::Document
|
class OrderSetItemPdf < 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
|
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_set_item, print_status, options, alt_name)
|
def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty)
|
||||||
self.page_width = print_settings.page_width
|
self.page_width = print_settings.page_width
|
||||||
self.page_height = print_settings.page_height
|
self.page_height = print_settings.page_height
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
@@ -46,7 +46,7 @@ class OrderSetItemPdf < Prawn::Document
|
|||||||
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)
|
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)
|
||||||
|
|
||||||
# order items
|
# order items
|
||||||
order_set_items(order_set_item, options, alt_name, print_settings.precision)
|
order_set_items(order_set_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write Order Information to PDF
|
# Write Order Information to PDF
|
||||||
@@ -74,7 +74,7 @@ class OrderSetItemPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order items to PDF
|
# Write Order items to PDF
|
||||||
def order_set_items(order_set_item, options, alt_name, precision)
|
def order_set_items(order_set_item, options, alt_name, precision, before_updated_qty)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
#Add Order Item
|
#Add Order Item
|
||||||
@@ -82,6 +82,7 @@ class OrderSetItemPdf < Prawn::Document
|
|||||||
|
|
||||||
dash(1, :space => 1, :phase => 1)
|
dash(1, :space => 1, :phase => 1)
|
||||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
|
add_updated_qty_text(before_updated_qty, order_set_item.qty, precision)
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -143,4 +144,17 @@ class OrderSetItemPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#add updated qty text
|
||||||
|
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
|
||||||
|
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
# add option
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
|
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -476,14 +476,16 @@
|
|||||||
receipt_no = ($("#receipt_no").html()).trim();
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
discount="<%= @membership.discount%>"
|
||||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||||
|
if (discount) {
|
||||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||||
$("#pay").show();
|
$("#pay").show();
|
||||||
}else{
|
}else{
|
||||||
$("#pay").hide();
|
$("#pay").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.invoicedetails').on('click', function () {
|
$('.invoicedetails').on('click', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user