Edit Precision in Receipt Bill & Recceipt Bill A5 Pdf

This commit is contained in:
San Wai Lwin
2018-05-23 15:30:18 +06:30
parent 8134e37f5f
commit 71b6ade245
4 changed files with 42 additions and 15 deletions

View File

@@ -201,7 +201,7 @@ Add Feature for Order and Reservation
=> settings/lookups => { type:order_reservation, name: OrderReservation, value:'{0 or 1}' }
For Price 0 in receipt bill
2) settings/lookups => { type:show_price, name:Shoe Price, value:1 }
2) settings/lookups => { type:show_price, name:Show Price, value:1 }
For Price 0 in receipt bill
2) settings/lookups => { type:order_by, name:Order By, value:name }

View File

@@ -187,6 +187,20 @@ class ReceiptBillA5Pdf < Prawn::Document
def add_line_item_row(sale_items,precision,delimiter)
if precision.to_i > 0
item_name_width = (self.item_width+self.price_width)
item_qty_front_width = (self.item_width+self.price_width) + 5
item_qty_end_width = self.qty_width + 4
item_total_front_width = item_name_width + 10
item_total_end_width = self.total_width + 9
else
item_name_width = (self.item_width+self.price_width)
item_qty_front_width = item_name_width + 8
item_qty_end_width = self.qty_width + 7
item_total_front_width = item_name_width + 5
item_total_end_width = self.total_width + 4
end
y_position = cursor
move_down line_move
sub_total = 0.0
@@ -194,7 +208,7 @@ class ReceiptBillA5Pdf < Prawn::Document
sale_items.each do |item|
# check for item not to show
show_price = Lookup.find_by_lookup_type("show_price").value
show_price = Lookup.find_by_lookup_type("show_price")
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
if item.status != 'Discount' && item.qty > 0
@@ -221,12 +235,15 @@ class ReceiptBillA5Pdf < Prawn::Document
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
text "Sub Total", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
end
bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
# bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
# text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
# end
# bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
# text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
# end
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
end
def item_row(item,precision,delimiter,product_name,price,qty ,total_price)

View File

@@ -181,6 +181,20 @@ class ReceiptBillPdf < Prawn::Document
def add_line_item_row(sale_items,precision,delimiter)
if precision.to_i > 0
item_name_width = (self.item_width+self.price_width)
item_qty_front_width = (self.item_width+self.price_width) + 5
item_qty_end_width = self.qty_width + 4
item_total_front_width = item_name_width + 10
item_total_end_width = self.total_width + 9
else
item_name_width = (self.item_width+self.price_width)
item_qty_front_width = item_name_width + 8
item_qty_end_width = self.qty_width + 7
item_total_front_width = item_name_width + 5
item_total_end_width = self.total_width + 4
end
y_position = cursor
move_down line_move
sub_total = 0.0
@@ -215,12 +229,8 @@ class ReceiptBillPdf < Prawn::Document
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
text "Sub Total", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
end
bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
end
def item_row(item,precision,delimiter,product_name,price,qty ,total_price)

View File

@@ -19,7 +19,7 @@ class ActionController::Base
render :json => [{ status: false, message: 'Invalid Access!'}]
end
else
check for license file
# check for license file
if check_license
current_license(ENV["SX_PROVISION_URL"])
else