From be6dd25a7012a37f193f33ad3d0a2fc54d8819f8 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 9 Jan 2018 15:58:37 +0630 Subject: [PATCH] a5 print format done --- app/controllers/origami/payments_controller.rb | 8 ++++---- app/models/printer/receipt_printer.rb | 2 +- app/pdf/receipt_bill_a5_pdf.rb | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 0bc77fc3..b14be800 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -22,7 +22,7 @@ class Origami::PaymentsController < BaseOrigamiController cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) # Print for First Bill to Customer - unique_code = "ReceiptBillPdf" + unique_code = "ReceiptBillA5Pdf" #shop detail shop_details = Shop::ShopDetail # customer= Customer.where('customer_id=' +.customer_id) @@ -106,7 +106,7 @@ class Origami::PaymentsController < BaseOrigamiController cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) # For Print - unique_code = "ReceiptBillPdf" + unique_code = "ReceiptBillA5Pdf" customer= Customer.find(saleObj.customer_id) # get member information @@ -228,7 +228,7 @@ class Origami::PaymentsController < BaseOrigamiController cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) - unique_code = "ReceiptBillPdf" + unique_code = "ReceiptBillA5Pdf" customer= Customer.find(saleObj.customer_id) #shop detail @@ -285,7 +285,7 @@ class Origami::PaymentsController < BaseOrigamiController # Re-call Sale Data saleObj = Sale.find(sale_id) - unique_code = "ReceiptBillPdf" + unique_code = "ReceiptBillA5Pdf" customer= Customer.find(saleObj.customer_id) #shop detail diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index adcb187e..7a1ef65a 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -70,7 +70,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Generate PDF #Print - pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance) + pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance) # print as print copies in printer setting count = printer_settings.print_copies diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 4346759c..0861c65a 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -4,13 +4,13 @@ class ReceiptBillA5Pdf < Prawn::Document 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) self.page_width = printer_settings.page_width self.page_height = printer_settings.page_height - self.margin = 20 + self.margin = 15 self.price_width = 120 self.qty_width = 50 self.total_width = 120 self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width)) self.item_height = 25 - self.item_description_width = (self.page_width-20) / 2 + self.item_description_width = (self.page_width-40) / 2 self.label_width = 150 self.description_width = 500 @@ -494,11 +494,11 @@ class ReceiptBillA5Pdf < Prawn::Document move_down 10 y_position = cursor - bounding_box([0, y_position], :width =>self.label_width) do + bounding_box([0, y_position], :width =>self.item_description_width) do text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left end - bounding_box([self.description_width,y_position], :width =>self.description_width, :height => self.item_height) do - text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :left + bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :right end move_down 10