diff --git a/README.md b/README.md index 4ba6d51f..1d9b2e2a 100755 --- a/README.md +++ b/README.md @@ -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 } diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 382633de..2bee170d 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -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) diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 862a91a5..18450f51 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -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) diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 1d8b678e..fb212f13 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -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