diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index a23ebd16..bb0d9e42 100644 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -29,7 +29,7 @@ class Origami::OtherChargesController < BaseOrigamiController sale_item.sale_id = sale_id sale_item.product_code = "Other Charges" - sale_item.product_name = di["name"] + sale_item.product_name = "*" + di["name"] sale_item.product_alt_name = "" sale_item.remark = "Other Charges" diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 2cdd44b5..1a757282 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -30,7 +30,7 @@ class Origami::PaymentsController < BaseOrigamiController printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details) + printer.print_receipt_bill(print_settings,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt") end def create @@ -63,7 +63,7 @@ class Origami::PaymentsController < BaseOrigamiController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details) + printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid") end end @@ -142,6 +142,6 @@ class Origami::PaymentsController < BaseOrigamiController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details) + printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print") end end diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb index d4fba302..0e2c6cff 100644 --- a/app/controllers/origami/sale_edit_controller.rb +++ b/app/controllers/origami/sale_edit_controller.rb @@ -18,7 +18,7 @@ class Origami::SaleEditController < BaseOrigamiController @newsaleitem.save @newsaleitem.qty = saleitemObj.qty * -1 @newsaleitem.price = saleitemObj.price * -1 - @newsaleitem.is_taxable = 0 + @newsaleitem.is_taxable = 1 @newsaleitem.product_name = saleitemObj.product_name + " - void" @newsaleitem.save end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index b8972cf2..687d9fa5 100644 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -30,6 +30,13 @@ class Origami::VoidController < BaseOrigamiController table.save end + # update complete order items in oqs + SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr| + AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi| + aoi.delivery_status = 1 + aoi.save + end + end end end diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index f8eb46d6..652339b9 100644 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -65,11 +65,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker end #Bill Receipt Print - def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details) + def print_receipt_bill(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) #Use CUPS service #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) + + 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) # print as print copies in printer setting count = printer_settings.print_copies diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index bff0852d..60e1203c 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -1,7 +1,7 @@ class ReceiptBillPdf < 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 - 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) + 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) self.page_width = 210 self.page_height = 7000 self.margin = 5 @@ -53,7 +53,7 @@ class ReceiptBillPdf < Prawn::Document items_account(item_price_by_accounts,printer_settings.precision,delimiter) - footer + footer(printed_status) end def header (shop_details) @@ -82,14 +82,11 @@ class ReceiptBillPdf < Prawn::Document move_down 5 y_position = cursor - bounding_box([0, y_position], :width =>self.item_width) do - text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left - end - move_down 5 - - y_position = cursor - bounding_box([0,y_position], :width =>self.item_width, :height => self.item_height) do - text "Cashier: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :left + bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do + text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left + end + bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do + text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right end move_down 5 @@ -182,7 +179,7 @@ class ReceiptBillPdf < Prawn::Document y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do - text "#{ st.tax_name }", :size => self.item_font_size,:align => :left + text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left end bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right @@ -360,12 +357,18 @@ class ReceiptBillPdf < Prawn::Document end end - def footer + def footer(printed_status) move_down 5 stroke_horizontal_rule move_down 5 - text "Thank You! See you Again", :left_margin => -10, :size => self.header_font_size,:align => :center + y_position = cursor + bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do + text "#{printed_status}", :size => self.header_font_size,:align => :left + end + bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do + text "Thank You! See you Again", :left_margin => -10, :size => self.header_font_size,:align => :right + end move_down 5 end diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index fbbff065..faa48c05 100644 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -174,7 +174,7 @@