Edit Close Cashier Customise Pdf

This commit is contained in:
San Wai Lwin
2018-02-21 14:39:33 +06:30
parent 51a243ea7c
commit 8c0f379a4f
2 changed files with 43 additions and 33 deletions

View File

@@ -36,13 +36,13 @@ class ApplicationController < ActionController::Base
# redirect_to root_url(:host => request.domain) + "store_error" # redirect_to root_url(:host => request.domain) + "store_error"
render :json => [{ status: false, message: 'Invalid Access!'}] render :json => [{ status: false, message: 'Invalid Access!'}]
end end
else # else
# check for license file # # check for license file
if check_license # if check_license
current_license(ENV["SX_PROVISION_URL"]) # current_license(ENV["SX_PROVISION_URL"])
else # else
redirect_to activate_path # redirect_to activate_path
end # end
end end
end end

View File

@@ -174,7 +174,7 @@ class CloseCashierCustomisePdf < Prawn::Document
end end
#end total FOC amount #end total FOC amount
total_grand_total = shift_sale.grand_total + shift_sale.total_discounts + @total_foc.to_f + shift_sale.total_void.to_f - total_discount_account.to_f total_grand_total = shift_sale.grand_total + @total_foc.to_f + shift_sale.total_void.to_f - total_discount_account.to_f
# @total_grand_total = @shift_sale.grand_total + @overall + @total_foc + @shift_sale.total_void # @total_grand_total = @shift_sale.grand_total + @overall + @total_foc + @shift_sale.total_void
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
@@ -197,31 +197,6 @@ class CloseCashierCustomisePdf < Prawn::Document
end end
#end total amount by Account #end total amount by Account
if total_member_discount[0].member_discount.present?
@member_discount = total_member_discount[0].member_discount rescue 0.0
@overall = shift_sale.total_discounts - @member_discount
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Member Discount :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "#{ number_with_precision(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
end
else
@overall = shift_sale.total_discounts
end
if @overall > 0
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Overall Discount :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "-#{ number_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
end
end
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total FOC :", :size => self.item_font_size, :align => :right text "Total FOC :", :size => self.item_font_size, :align => :right
@@ -452,6 +427,41 @@ class CloseCashierCustomisePdf < Prawn::Document
end end
#end total other charges amount #end total other charges amount
move_down -5
stroke_horizontal_rule
move_down 7
#start total over all discount
if total_member_discount[0].member_discount.present?
@member_discount = total_member_discount[0].member_discount rescue 0.0
@overall = shift_sale.total_discounts - @member_discount
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Member Discount :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "#{ number_with_precision(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
end
else
@overall = shift_sale.total_discounts
end
if @overall > 0
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Overall Discount :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "-#{ number_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
end
end
#end total over all discount
move_down -5
stroke_horizontal_rule
move_down 7
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Dine-in Count :", :size => self.item_font_size, :align => :right text "Total Dine-in Count :", :size => self.item_font_size, :align => :right