fix conflict

This commit is contained in:
Myat Zin Wai Maw
2019-06-25 10:30:08 +06:30
9 changed files with 58 additions and 17 deletions

View File

@@ -47,6 +47,7 @@ gem 'jquery-fileupload-rails'
gem 'cups'
gem 'prawn'
gem 'prawn-table'
gem 'prawn-qrcode'
gem 'to_xls-rails'
gem 'rubyzip', '= 1.0.0'
gem 'axlsx', '= 2.0.1'

View File

@@ -79,6 +79,7 @@ GEM
mime-types (>= 1.16)
chartkick (2.2.5)
chronic (0.10.2)
chunky_png (1.3.11)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
@@ -177,6 +178,9 @@ GEM
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
prawn-qrcode (0.3.1)
prawn (>= 1)
rqrcode (>= 0.4.1)
prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0)
puma (3.10.0)
@@ -218,6 +222,8 @@ GEM
nokogiri
rubyzip
spreadsheet (> 0.6.4)
rqrcode (0.10.1)
chunky_png (~> 1.0)
rspec-core (3.7.0)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
@@ -341,6 +347,7 @@ DEPENDENCIES
pdfjs_viewer-rails
pg
prawn
prawn-qrcode
prawn-table
puma (~> 3.0)
rack-cors

View File

@@ -102,9 +102,22 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
# status, qr = KbzPay.pay(amount, receipt_no)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil,nil,nil)
#TODO :: KBZPAY ( QR )
# On/Off setting ( show or not qr )
# qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD"
kbz_pay_setting = PaymentMethodSetting.where(:payment_method => 'KBZPay').last
status = false
qr = nil
if !kbz_pay_setting.nil?
if kbz_pay_setting.is_active == true
status, qr = KbzPay.pay(sale_data.grand_total, sale_data.receipt_no)
end
end
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil,nil,nil)
result = {
:filepath => filename,
@@ -270,7 +283,7 @@ class Origami::PaymentsController < BaseOrigamiController
other_amount = SaleItem.calculate_other_charges(sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})

View File

@@ -188,20 +188,20 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
#Bill Receipt Print
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation)
def print_receipt_bill(printer_settings, kbz_pay_status, qr_code, cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation)
#Use CUPS service
#Generate PDF
#Print
if !printer_settings.nil?
if !printer_settings.unique_code.strip.downcase.include? ("receiptbillorder")
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,card_data,other_amount,latest_order_no,card_balance_amount)
pdf = ReceiptBillPdf.new(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
settings = PrintSetting.all
if !settings.nil?
settings.each do |setting|
if setting.unique_code == 'ReceiptBillPdf'
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,card_data,other_amount,latest_order_no,card_balance_amount)
pdf = ReceiptBillPdf.new(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
elsif setting.unique_code == 'ReceiptBillStarPdf'
pdf = ReceiptBillStarPdf.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,card_data,other_amount,latest_order_no,card_balance_amount)
pdf = ReceiptBillStarPdf.new(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
end
end
end

View File

@@ -206,7 +206,7 @@ class Sale < ApplicationRecord
end
end
link_order_sale(order.id)
# link_order_sale(order.id)
end
self.save!
@@ -735,9 +735,11 @@ class Sale < ApplicationRecord
saleOrder = SaleOrder.where("sale_id=? and order_id=?", self.id, order_id).take
if saleOrder.nil?
sale_order = SaleOrder.new
sale = sale_order.create_sale_order(self.id, order_id)
saleOrder = SaleOrder.new
# sale = saleOrder.create_sale_order(self.id, order_id)
end
sale = saleOrder.create_sale_order(self.id, order_id)
# if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?)
# SaleOrder.create(:sale_id => self.id, :order_id => order_id)
# end

View File

@@ -7,11 +7,11 @@ class SaleOrder < ApplicationRecord
belongs_to :sale
belongs_to :order
def create_sale_order(sale, order)
sale_order = SaleOrder.new
sale_order.sale_id = sale
sale_order.order_id = order
sale_order.save!
def create_sale_order(sale_id, order_id)
# sale_order = SaleOrder.new
self.sale_id = sale_id
self.order_id = order_id
self.save!
end
def self.sync_sale_order_records(sale_orders)

View File

@@ -17,7 +17,7 @@ class OrderItemPdf < 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_top, 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

View File

@@ -1,9 +1,11 @@
# require 'prawn/qrcode'
require 'prawn/measurement_extensions'
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, :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)
def initialize(printer_settings, kbz_pay_status, qr_code, 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
self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i
@@ -101,6 +103,10 @@ class ReceiptBillPdf < Prawn::Document
if shop_details.note && !shop_details.note.nil?
shop_note(shop_details)
end
if kbz_pay_status
pay_by_kbzpay(printed_status, qr_code)
end
footer(printed_status)
end
@@ -679,6 +685,18 @@ class ReceiptBillPdf < Prawn::Document
move_down line_move
end
def pay_by_kbzpay(status, qr_code)
if status == 'Frt'
move_down line_move
move_down line_move
text "KBZ Pay", :size => self.header_font_size+2, :align => :center
move_down line_move
print_qr_code(qr_code, pos: [30, cursor], extent: 160, stroke: false, dot: 1000)
# stroke_horizontal_rule
move_down line_move
end
end
def footer(printed_status)
move_down line_move
stroke_horizontal_rule

BIN
dump.rdb

Binary file not shown.