add show subtotal+service charges in receipt bill
This commit is contained in:
@@ -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 and service charges in receipt bill
|
||||||
|
settings/lookups => {type:show_sub_total_and_service_charges, name:Show Sub Total and Service charges, value: {0 or 1}}
|
||||||
|
|
||||||
* ToDo list
|
* ToDo list
|
||||||
|
|
||||||
1. Migration
|
1. Migration
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -218,7 +218,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|
|
||||||
@@ -242,7 +242,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
|
||||||
@@ -268,7 +268,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)
|
||||||
@@ -326,23 +326,73 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
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(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_sub_total_and_service_charges')
|
||||||
move_down line_move
|
if find_lookup.value == '1'
|
||||||
y_position = cursor
|
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 "Sub Total + #{@Service_Tax_Desc}", :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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user