Add Room and Table Moving
This commit is contained in:
12
README.md
12
README.md
@@ -138,6 +138,18 @@ For CloseCashierCustomisePdf in lookups
|
|||||||
1) settings/print_settings
|
1) settings/print_settings
|
||||||
2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }
|
2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }
|
||||||
|
|
||||||
|
<---- Extra Fields Script ----->
|
||||||
|
For MoveTablePdf in lookups
|
||||||
|
*** Both Table and Room Moving ***
|
||||||
|
1) settings/lookups => { type:print_settings, name: MoveTablePdf, value:1 }
|
||||||
|
|
||||||
|
For MoveTablePdf in print settings
|
||||||
|
* Backend > Printer > Print Settings > New
|
||||||
|
i) Name : Move Table
|
||||||
|
ii) Unique Code: MoveTablePdf
|
||||||
|
iii)Template: ...
|
||||||
|
iv) Font: Zawgyi-One v) Printer: #printer name
|
||||||
|
|
||||||
* ToDo list
|
* ToDo list
|
||||||
|
|
||||||
1. Migration
|
1. Migration
|
||||||
|
|||||||
@@ -69,6 +69,17 @@ class Origami::MovetableController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||||
|
|
||||||
|
# get printer info
|
||||||
|
@from = (DiningFacility.find(change_from)).name
|
||||||
|
@to = (DiningFacility.find(change_to)).name
|
||||||
|
@type = (DiningFacility.find(change_to)).type
|
||||||
|
@date = DateTime.now
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
unique_code = "MoveTablePdf"
|
||||||
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -238,6 +238,16 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
self.print("tmp/print_queue_no.pdf")
|
self.print("tmp/print_queue_no.pdf")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Move Table Print
|
||||||
|
def print_move_table(printer_settings,to,from,shop_detail,date,type)
|
||||||
|
#Use CUPS service
|
||||||
|
#Generate PDF
|
||||||
|
#Print
|
||||||
|
pdf = MoveTablePdf.new(printer_settings,to,from,shop_detail,date,type)
|
||||||
|
pdf.render_file "tmp/print_move_table.pdf"
|
||||||
|
self.print("tmp/print_move_table.pdf")
|
||||||
|
end
|
||||||
|
|
||||||
#Bill Receipt Print
|
#Bill Receipt Print
|
||||||
def print_crm_order(booking,order_items,setting)
|
def print_crm_order(booking,order_items,setting)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
|
|||||||
58
app/pdf/move_table_pdf.rb
Normal file
58
app/pdf/move_table_pdf.rb
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
class MoveTablePdf < 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,to,from,shop_detail,date,type)
|
||||||
|
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(printer_settings.name,type)
|
||||||
|
|
||||||
|
call_move_table(to,from,date,type)
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def header (name,type)
|
||||||
|
text "Move #{type}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||||
|
# move_down self.item_height
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
end
|
||||||
|
|
||||||
|
def call_move_table (to,from,date,type)
|
||||||
|
move_down 3
|
||||||
|
text "Date Time : #{date.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :left_margin => -10, :size => self.header_font_size
|
||||||
|
text "Change [#{from}] To [#{to}]", :left_margin => -10, :size => self.header_font_size
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user