fix conflicts

This commit is contained in:
Zoey
2019-07-03 13:51:41 +06:30
5 changed files with 126 additions and 61 deletions

View File

@@ -287,6 +287,12 @@ For Online Order Receipt Setting
For Close Cashier Print Settings For Close Cashier Print Settings
settings/lookups => {type:close_cashier_print, name:CloseCashierPrint, value: {0 or 1} } settings/lookups => {type:close_cashier_print, name:CloseCashierPrint, value: {0 or 1} }
For Second Display View Setting
settings/lookups => {type:display_type, name: Display Type, value: 2}
For show total before tax in receipt bill
settings/lookups => {type:show_total_before_tax, name:Show Total Before Tax, value: {0 or 1}}
* ToDo list * ToDo list
1. Migration 1. Migration

View File

@@ -40,6 +40,7 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
// } // }
d_option = items[i].opt; d_option = items[i].opt;
console.log(d_option)
if (items[i].click_type != "add_icon"){ if (items[i].click_type != "add_icon"){
option_name = "-"+items[i].options; option_name = "-"+items[i].options;
data_option = items[i].options ; data_option = items[i].options ;
@@ -54,7 +55,8 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
$(item_row).each(function(j){ $(item_row).each(function(j){
var item_code = $(item_row[j]).attr('data-code'); var item_code = $(item_row[j]).attr('data-code');
var instance_code = $(item_row[j]).attr('data-instance-code'); var instance_code = $(item_row[j]).attr('data-instance-code');
var r_option = $(item_row[j]).attr('data-options'); var r_option = $(item_row[j]).attr('data-opt');
console.log(r_option)
if (item_code == items[i].item_code && instance_code == items[i].instance_code && r_option==d_option) { if (item_code == items[i].item_code && instance_code == items[i].instance_code && r_option==d_option) {
if (qty > 1) { if (qty > 1) {
qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty; qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty;

View File

@@ -617,7 +617,8 @@ class Origami::PaymentsController < BaseOrigamiController
other_amount = SaleItem.calculate_other_charges(saleObj.sale_items) other_amount = SaleItem.calculate_other_charges(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
result = { result = {
:status => true, :status => true,
@@ -716,7 +717,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount,nil,nil,nil) filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount,nil,nil,nil)
result = { result = {
:status => true, :status => true,
:filepath => filename, :filepath => filename,

View File

@@ -224,7 +224,7 @@ class ReceiptBillPdf < Prawn::Document
y_position = cursor y_position = cursor
move_down line_move move_down line_move
sub_total = 0.0 @sub_total = 0.0
total_qty = 0.0 total_qty = 0.0
show_price = Lookup.find_by_lookup_type("show_price") show_price = Lookup.find_by_lookup_type("show_price")
sale_items.each do |item| sale_items.each do |item|
@@ -248,7 +248,7 @@ class ReceiptBillPdf < Prawn::Document
# total_price = -item.price #item.qty*item.unit_price - comment for room charges # total_price = -item.price #item.qty*item.unit_price - comment for room charges
# price = -item.unit_price # price = -item.unit_price
# else # else
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges @sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
qty = item.qty qty = item.qty
total_price = item.price #item.qty*item.unit_price - comment for room charges total_price = item.price #item.qty*item.unit_price - comment for room charges
price = item.unit_price price = item.unit_price
@@ -274,7 +274,7 @@ class ReceiptBillPdf < Prawn::Document
text "Sub Total", :size => self.item_font_size,:align => :left text "Sub Total", :size => self.item_font_size,:align => :left
end 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(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 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 end
def item_row(item,precision,delimiter,product_name,price,qty ,total_price) def item_row(item,precision,delimiter,product_name,price,qty ,total_price)
@@ -333,22 +333,78 @@ class ReceiptBillPdf < Prawn::Document
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
end end
service_tax_desc = ""
service_tax_amount = 0
service_tax_rate = 0
com_tax_desc = ""
com_tax_amount = 0
com_tax_rate = 0
if sale_data.sale_taxes.length > 0 if sale_data.sale_taxes.length > 0
incl_tax = "" incl_tax = ""
if sale_data.tax_type == "inclusive" if sale_data.tax_type == "inclusive"
incl_tax = "Incl." incl_tax = "Incl."
end end
sale_data.sale_taxes.each do |st| find_lookup = Lookup.find_by_lookup_type('show_total_before_tax')
move_down line_move if find_lookup.nil? || find_lookup == nil
y_position = cursor lookup = Lookup.new(lookup_type: 'show_total_before_tax', name: 'Show Total Before Tax', value: '0')
lookup.save
end
check_lookup_type = Lookup.find_by_lookup_type('show_total_before_tax')
if check_lookup_type.value == '1'
sale_data.sale_taxes.each do |st|
if (st.tax_name.include? "Service")
service_tax_desc = st.tax_name
service_tax_amount = number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
if incl_tax
service_tax_rate = st.tax_rate.to_i
end
end
if (st.tax_name.include? "Commercial")
com_tax_desc = st.tax_name
com_tax_amount = number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
if incl_tax
com_tax_rate = st.tax_rate.to_i
end
end
end
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ service_tax_desc } (#{incl_tax} #{ service_tax_rate }%)", :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(service_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
move_down line_move
y_position = cursor
stroke_horizontal_rule
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Total Before Tax", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{service_tax_amount.to_i + @sub_total.to_i}" , :size => self.item_font_size,:align => :right
end
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ com_tax_desc } (#{incl_tax} #{ com_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(com_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
else
sale_data.sale_taxes.each do |st|
move_down line_move
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
end end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do 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 text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end end
end
end end
else else

View File

@@ -3,7 +3,7 @@ class ReceiptBillStarPdf < Prawn::Document
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :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 attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :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, status, qr , 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_width = printer_settings.page_width
self.page_height = printer_settings.page_height self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = printer_settings.header_font_size.to_i