Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui
This commit is contained in:
@@ -11,26 +11,26 @@ class SeedGenerator < ApplicationRecord
|
||||
seed.save
|
||||
else
|
||||
next_no = seed.next
|
||||
# current_no = seed.next
|
||||
# seed.next = seed.next + seed.increase_by
|
||||
# seed.current = current_no
|
||||
# seed.save
|
||||
cur_val, next_val = self.update_seed(model, seed.next, seed.increase_by)
|
||||
current_no = seed.next
|
||||
seed.next = seed.next + seed.increase_by
|
||||
seed.current = current_no
|
||||
seed.save
|
||||
# cur_val, next_val = self.update_seed(model, seed.next, seed.increase_by)
|
||||
|
||||
if next_no == cur_val
|
||||
puts "SSS"
|
||||
puts next_val
|
||||
cur_val2, next_val2 = self.update_seed(model, next_val, seed.increase_by)
|
||||
puts next_val2
|
||||
padding_len = 15 - prefix.length
|
||||
saleOrderId = prefix +"-"+ cur_val2.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
puts saleOrderId
|
||||
return saleOrderId
|
||||
end
|
||||
# if next_no == cur_val
|
||||
# puts "SSS"
|
||||
# puts next_val
|
||||
# cur_val2, next_val2 = self.update_seed(model, next_val, seed.increase_by)
|
||||
# puts next_val2
|
||||
# padding_len = 15 - prefix.length
|
||||
# saleOrderId = prefix +"-"+ cur_val2.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
# puts saleOrderId
|
||||
# return saleOrderId
|
||||
# end
|
||||
|
||||
padding_len = 15 - prefix.length
|
||||
saleOrderId = prefix +"-"+ cur_val.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
return saleOrderId
|
||||
# padding_len = 15 - prefix.length
|
||||
# saleOrderId = prefix +"-"+ cur_val.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
# return saleOrderId
|
||||
|
||||
end
|
||||
|
||||
@@ -100,7 +100,6 @@ class SeedGenerator < ApplicationRecord
|
||||
select_result = ActiveRecord::Base.connection.execute(select_sql);
|
||||
|
||||
select_result.each do |row|
|
||||
p row
|
||||
cur_val = row [3]
|
||||
next_val = row[4]
|
||||
end
|
||||
|
||||
@@ -17,22 +17,26 @@ class OrderItemPdf < Prawn::Document
|
||||
# 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"
|
||||
# })
|
||||
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"]
|
||||
# end
|
||||
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"
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
stroke_horizontal_rule
|
||||
@@ -42,7 +46,7 @@ class OrderItemPdf < Prawn::Document
|
||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item, options, alt_name, print_settings.precision,print_settings.font)
|
||||
order_items(order_item, options, alt_name, print_settings.precision)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -70,11 +74,11 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item, options, alt_name, precision, font)
|
||||
def order_items(order_item, options, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options, alt_name, precision, font)
|
||||
add_order_items(order_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
@@ -82,19 +86,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item, options, alt_name, precision, font)
|
||||
# db font setup
|
||||
if font != ""
|
||||
font_families.update("#{font}" => {
|
||||
:normal => "public/fonts/#{font}.ttf",
|
||||
:italic => "public/fonts/#{font}.ttf",
|
||||
:bold => "public/fonts/#{font}.ttf",
|
||||
:bold_italic => "public/fonts/#{font}.ttf"
|
||||
})
|
||||
|
||||
font "#{font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
def add_order_items(order_item, options, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
|
||||
@@ -15,10 +15,27 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
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"
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
stroke_horizontal_rule
|
||||
@@ -29,9 +46,9 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision,print_settings.font)
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision,print_settings.font)
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,7 +77,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item, alt_name, precision,font)
|
||||
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
|
||||
@@ -75,24 +92,12 @@ class OrderSummaryPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, alt_name, precision, font)
|
||||
add_order_items(order_item, alt_name, precision)
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item, alt_name, precision, font)
|
||||
# db font setup
|
||||
if font != ""
|
||||
font_families.update("#{font}" => {
|
||||
:normal => "public/fonts/#{font}.ttf",
|
||||
:italic => "public/fonts/#{font}.ttf",
|
||||
:bold => "public/fonts/#{font}.ttf",
|
||||
:bold_italic => "public/fonts/#{font}.ttf"
|
||||
})
|
||||
|
||||
font "#{font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
def add_order_items(order_item, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
|
||||
@@ -23,7 +23,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
|
||||
Reference in New Issue
Block a user