fixed receipt header
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
class MoveTableStarPdf < 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
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :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,moved_by,order_items)
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
self.item_font_size = printer_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.margin_top = 10
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
@@ -15,7 +16,7 @@ class MoveTableStarPdf < Prawn::Document
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != ""
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
class OrderItemStarPdf < 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
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :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, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
self.page_height = print_settings.page_height
|
||||
self.header_font_size = print_settings.header_font_size.to_i
|
||||
self.item_font_size = print_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.margin_top = 10
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 38
|
||||
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_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
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 => [self.margin_top, 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
|
||||
@@ -29,17 +30,17 @@ class OrderItemStarPdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if !order_item.dining.nil?
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 3
|
||||
|
||||
@@ -51,31 +52,31 @@ class OrderItemStarPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 2
|
||||
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
|
||||
text "OrderNo: #{order_no}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 2
|
||||
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
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 2
|
||||
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
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -87,7 +88,7 @@ class OrderItemStarPdf < Prawn::Document
|
||||
def order_items(order_item, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
@@ -155,7 +156,7 @@ class OrderItemStarPdf < Prawn::Document
|
||||
booking = Order.joins(" JOIN booking_orders bo ON bo.order_id = orders.order_id")
|
||||
.joins(" JOIN bookings b ON b.booking_id=bo.booking_id")
|
||||
.where("orders.order_id='#{order_no}'")
|
||||
.first()
|
||||
.first()
|
||||
|
||||
return booking.booking_id
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class ReceiptBillStarPdf < 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, :line_move
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :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,latest_order_no,card_balance_amount)
|
||||
self.page_width = printer_settings.page_width
|
||||
@@ -9,6 +9,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
self.item_font_size = printer_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.margin_top = 10
|
||||
self.price_width = 60
|
||||
self.qty_width = 20
|
||||
self.total_width = 40
|
||||
@@ -25,7 +26,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
# @double = @qty_width * 1.3
|
||||
# @half_qty = @qty_width / 2
|
||||
#setting page margin and width
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
|
||||
Reference in New Issue
Block a user