number with precision in receipt report excel.

This commit is contained in:
Thein Lin Kyaw
2019-11-08 10:21:58 +06:30
17 changed files with 230 additions and 197 deletions

View File

@@ -47,7 +47,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
aescrypt (1.0.0)
airbrussh (1.3.4)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
arel (8.0.0)
axlsx (2.0.1)
@@ -62,7 +62,7 @@ GEM
builder (3.2.3)
byebug (11.0.1)
cancancan (1.17.0)
capistrano (3.11.1)
capistrano (3.11.2)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
@@ -88,7 +88,7 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
crass (1.0.4)
crass (1.0.5)
cups (0.1.10)
database_cleaner (1.7.0)
diff-lcs (1.3)
@@ -99,8 +99,8 @@ GEM
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
railties (>= 3.0.0)
faker (2.4.0)
i18n (~> 1.6.0)
faker (2.6.0)
i18n (>= 1.6, < 1.8)
ffi (1.11.1)
filterrific (5.2.1)
font-awesome-rails (4.7.0.5)
@@ -110,7 +110,7 @@ GEM
htmlentities (4.3.4)
httparty (0.15.7)
multi_xml (>= 0.5.2)
i18n (1.6.0)
i18n (1.7.0)
concurrent-ruby (~> 1.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
@@ -140,7 +140,7 @@ GEM
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.2.3)
loofah (2.3.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@@ -150,11 +150,11 @@ GEM
method_source (0.9.2)
mime-types (3.3)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0904)
mime-types-data (3.2019.1009)
mini_magick (4.9.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.12.0)
minitest (5.12.2)
momentjs-rails (2.20.1)
railties (>= 3.1)
multi_xml (0.6.0)
@@ -175,9 +175,9 @@ GEM
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
prawn-qrcode (0.3.1)
prawn-qrcode (0.4.0)
prawn (>= 1)
rqrcode (>= 0.4.1)
rqrcode (>= 1.0.0)
prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0)
puma (3.12.1)
@@ -202,15 +202,15 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.1.7)
actionpack (= 5.1.7)
activesupport (= 5.1.7)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.3)
rake (13.0.0)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
@@ -223,23 +223,23 @@ GEM
chunky_png (~> 1.0)
rqrcode_core (~> 0.1.0)
rqrcode_core (0.1.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.4)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.1)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
rspec-support (~> 3.9.0)
rspec-rails (3.9.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.2)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
ruby-ole (1.2.12.2)
rubyzip (1.0.0)
sass (3.7.4)
@@ -262,12 +262,13 @@ GEM
rack (>= 1.5.0)
rack-protection (>= 1.5.0)
redis (>= 3.3.5, < 5)
simple_form (4.1.0)
simple_form (5.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
spreadsheet (1.2.4)
ruby-ole (>= 1.0)
spring (2.1.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)

View File

@@ -9,6 +9,7 @@ class Reports::DailysaleController < BaseReportController
@to = to
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
respond_to do |format|

View File

@@ -27,8 +27,6 @@ class Reports::HourlySaleitemController < BaseReportController
account_type = params[:account_type]
@type = params[:sale_type]
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
# logger.debug 'product>>>>>>>>>>>>>>>>>>>>>>>>>>'
# logger.debug @sale_data.group(:date_format)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@@ -59,7 +57,7 @@ class Reports::HourlySaleitemController < BaseReportController
# @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
@hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }}
puts @hourly_total_qty.to_json
respond_to do |format|
format.html
format.xls

View File

@@ -227,8 +227,8 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
count = printer_settings.print_copies
# override print copies for print worker loop
print_settings.print_copies = 1
print_settings.save!
# print_settings.print_copies = 1
# print_settings.save!
end
directory_name = 'public/receipts'
Dir.mkdir(directory_name) unless File.exists?(directory_name)

View File

@@ -2727,16 +2727,17 @@ def self.get_hourly_item_query(type)
"i.status as status_type,i.remark as remark,"+
"i.unit_price,i.price as price,i.product_name as product_name, " +
"i.menu_category_name,i.menu_category_code as menu_category_id, " +
"date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')
as date_format")
"concat(hour(CONVERT_TZ(receipt_date,'+00:00', '+06:30')), ':00 - ', hour(CONVERT_TZ(receipt_date,'+00:00', '+06:30')) + 1, ':00') as date_format," +
"hour(CONVERT_TZ(receipt_date,'+00:00', '+06:30')) as hour")
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
query = query.joins(" JOIN accounts acc ON acc.id = i.account_id")
query = query.where("#{sale_type}")
query = query.group("acc.title,i.account_id,i.menu_category_code,i.item_instance_code,i.product_name,i.unit_price")
.order("date_format asc")
query = query.group("acc.title,i.account_id,i.menu_category_code,i.item_instance_code,i.product_name,i.unit_price,hour")
.order("hour asc")
# query = query.order("i.menu_category_name asc, SUM(i.qty) desc")
end

View File

@@ -12,9 +12,9 @@ class OrderItemCustomisePdf < Prawn::Document
self.qty_width = 40
self.total_width = 40 # No Need for item
self.item_width = self.page_width - (self.qty_width - self.margin)
self.item_height = 15
self.item_height = 15
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90
self.label_width=90
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
@@ -29,17 +29,17 @@ class OrderItemCustomisePdf < Prawn::Document
})
font "#{print_settings.font}"
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
end
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf"
# font "public/fonts/padauk.ttf"
#font "public/fonts/Chinese.ttf"
if !order_item.dining.nil?
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
end
stroke_horizontal_rule
move_down 3
@@ -51,31 +51,31 @@ class OrderItemCustomisePdf < Prawn::Document
end
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
end
stroke_horizontal_rule
@@ -87,7 +87,7 @@ class OrderItemCustomisePdf < Prawn::Document
def order_items(order_item, options, alt_name, precision, before_updated_qty)
y_position = cursor
#Add Order Item
#Add Order Item
add_order_items(order_item, options, alt_name, precision)
dash(1, :space => 1, :phase => 1)
@@ -129,7 +129,7 @@ class OrderItemCustomisePdf < Prawn::Document
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
bounding_box([0,y_position], :width => self.item_width) do
text "#{options}", :size => self.item_font_size,:align => :left
end
end

View File

@@ -130,7 +130,7 @@ class OrderItemPdf < Prawn::Document
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
bounding_box([0,y_position], :width => self.item_width) do
text "#{options}", :size => self.item_font_size,:align => :left
end
end

View File

@@ -130,7 +130,7 @@ class OrderItemSlimPdf < Prawn::Document
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
bounding_box([0,y_position], :width => self.item_width) do
text "#{options}", :size => self.item_font_size,:align => :left
end
end

View File

@@ -130,7 +130,7 @@ class OrderItemStarPdf < Prawn::Document
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
bounding_box([0,y_position], :width => self.item_width) do
text "#{options}", :size => self.item_font_size,:align => :left
end
end

View File

@@ -144,7 +144,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
bounding_box([0,y_position], :width => self.item_width) do
text "#{options}", :size => self.item_font_size,:align => :left
end
end

View File

@@ -143,7 +143,7 @@ class OrderSetItemPdf < Prawn::Document
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
bounding_box([0,y_position], :width => self.item_width) do
text "#{options}", :size => self.item_font_size,:align => :left
end
end

View File

@@ -12,9 +12,9 @@ class OrderSummaryCustomisePdf < Prawn::Document
self.qty_width = 40
self.total_width = 40 # No Need for item
self.item_width = self.page_width - (self.qty_width - self.margin)
self.item_height = 15
self.item_height = 15
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90
self.label_width=90
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
@@ -28,18 +28,18 @@ class OrderSummaryCustomisePdf < Prawn::Document
})
font "#{print_settings.font}"
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
end
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if !order[0].dining.nil?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
end
stroke_horizontal_rule
move_down 5
@@ -55,31 +55,31 @@ class OrderSummaryCustomisePdf < Prawn::Document
end
# Write Order Information to PDF
def order_info(order_no, order_by, order_at)
def order_info(order_no, order_by, order_at)
#booking ID
booking_id = get_booking_id(order_no)
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
end
move_down 1
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
end
stroke_horizontal_rule
@@ -93,7 +93,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
#Add Order Item
add_order_items(order_item, alt_name, precision)
end
# Add order items under order info
@@ -103,7 +103,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
move_down 5
order_item.each do|odi|
# check for item not to show
# check for item not to show
# if odi.price != 0
y_position = cursor
@@ -120,7 +120,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
end
if alt_name
if !(odi.alt_name).empty?
move_down 4
@@ -128,15 +128,15 @@ class OrderSummaryCustomisePdf < Prawn::Document
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
# end
end
end
# add option
options = odi.options == "[]"? "" : odi.options
if options != ""
move_down 5
y_position = cursor
bounding_box([0,y_position], :width => self.item_width) do
text "#{options}", :size => self.item_font_size,:align => :left
@@ -151,7 +151,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
stroke_horizontal_line 0, (self.page_width - self.margin)
move_down 5
# end
end
end
end
def get_booking_id(order_no)

View File

@@ -26,10 +26,58 @@
<tr>
<th colspan="18"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<tr>
<% @payment_methods.each_slice(10) do |slice| %>
<tr>
<th></th>
<th></th>
<% alph = "A" %>
<% @count = 1 %>
<% slice.each do |payment_method| %>
<th style="text-align:center;">
<%= alph %>
</th>
<% alph = alph.ord.next.chr %>
<% @count += 1 %>
<% end %>
<th style="text-align:center;" ><%= alph %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
</tr>
<!-- <tr>
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
<% slice.each do |payment_method| %>
<th style="text-align:center;">
<%= payment_method %>
</th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<% if @payment_methods.include? ("GiftVoucher") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<% end %>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
</tr> -->
<% end %>
<tr>
<th></th>
<th></th>
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
<th colspan=4 style='text-align:center;'>Outgoing</th>
</tr>
<tr>
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
<% if @payment_methods.include? ("MPU") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
<% end %>
@@ -63,16 +111,18 @@
<% if @payment_methods.include? ("Redeem") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.redeem_sales") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<% if @payment_methods.include? ("GiftVoucher") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
</tr>
</thead>
@@ -137,7 +187,6 @@
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if @payment_methods.include? ("MPU") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
@@ -171,23 +220,25 @@
<% if @payment_methods.include? ("Redeem") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if @payment_methods.include? ("GiftVoucher") %>
<td style='text-align:right;'><%= number_with_precision(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% count = count + 1 %>
<% end %>
<% colspan = 7 %>
<tr style="font-weight:600;">
<td colspan="3" style='text-align:center;'>Total</td>
<td colspan="2" style='text-align:center;'>Total</td>
<% if @payment_methods.include? ("MPU") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
@@ -254,17 +305,19 @@
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if @payment_methods.include? ("GiftVoucher") %>
<% colspan += 1 %>
<td style='text-align:right;'><%= number_with_precision(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_with_precision(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% total_tax = 0 %>

View File

@@ -131,32 +131,28 @@
<% num = 1 %>
<% if tax_flag && tax_count > 0 %>
<% while num <= tax_count %>
<td>0</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% num += 1 %>
<% end %>
<% end %>
<% result.sale_taxes.each do |tax| %>
<td>
<%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %>
</td>
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<%end%>
<% num = 1 %>
<% if !tax_flag && tax_count > 0 %>
<% while num <= tax_count %>
<td>0</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% num += 1 %>
<% end %>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td>0</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% end %>
<%end%>
<td><%= number_with_precision(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i, delimiter: delimiter) %></td>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% if @lookup.value.to_i == 1 %>
<td>
<!-- ############### Need to Check SyncStatus ############# -->
@@ -176,50 +172,30 @@
<td colspan="3">&nbsp;</td>
<td><b><%= number_with_precision(total_sum, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
<!-- <% if !@sale_taxes.empty?
@sale_taxes.each do |tax| %>
<td>
<b><%= number_with_precision(tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b>
</td>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td><b>0</b></td>
<% end %>
<% end %> -->
<% if !@sale_taxes.empty? %>
<% num = 1
if ttax_flag && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>
<%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) %>
</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) %></td>
<% num += 1
end %>
<% end %>
<% @sale_taxes.each do |tax| %>
<td>
<%= number_with_precision(tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %>
</td>
<td><%= number_with_precision(tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<%end%>
<% num = 1
if ttax_flag==false && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>
<%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) %>
</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) %></td>
<% num += 1
end %>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% end %>
<%end%>
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '0' %></b></td>
<td><b><%= number_with_precision(rounding_adj.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
<td></td>

View File

@@ -12,7 +12,7 @@
<table class="table table-striped" border="0">
<thead>
<tr>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to ? @to.utc.getlocal.strftime("%Y-%b-%d") : '-'%></th>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
@@ -22,7 +22,6 @@
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.dining") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
@@ -41,8 +40,21 @@
</tr>
</thead>
<tbody>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end %>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% after_rounding = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
@@ -89,76 +101,66 @@
</td>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= result.total_amount rescue '-' %></td>
<td><%= result.total_discount rescue '-' %></td>
<% if !result.sale_taxes.empty? %>
<% num = 1
if tax_flag && tax_count > 0 %>
<% while num <= tax_count %>
<td>0</td>
<% num += 1
end %>
<td><%= number_with_precision(result.total_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% if !result.sale_taxes.empty? %>
<% num = 1 %>
<% if tax_flag && tax_count > 0 %>
<% while num <= tax_count %>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% num += 1 %>
<% end %>
<% end %>
<% result.sale_taxes.each do |tax| %>
<td>
<%= tax.tax_payable_amount rescue '-' %>
</td>
<%end%>
<% num = 1
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<% end %>
<% num = 1
if tax_flag==false && tax_count > 0 %>
<% while num <= tax_count %>
<td>0</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% num += 1
end %>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td>0</td>
<% end %>
<%end%>
<td><%= result.grand_total - result.rounding_adjustment %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= result.grand_total rescue '-'%></td>
<% else %>
<% @tax_profiles.each do |tax| %>
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<% end %>
<%end%>
<td><%= number_with_precision(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
</tr>
<% end %>
<tr style="border-top:4px double #666;">
<td colspan="3">&nbsp;</td>
<td><b><%= total_sum rescue '-'%></b></td>
<td><b><%= discount_amt rescue '-'%></b></td>
<!-- <% @sale_taxes.each do |tax| %>
<td><b><%= tax.st_amount.round(2) %></b></td>
<% end %> -->
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% if !@sale_taxes.empty? %>
<% num = 1
if ttax_flag && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>0.00</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% num += 1
end %>
<% end %>
<% @sale_taxes.each do |tax| %>
<td>
<%= tax.st_amount.to_f.round(2) %>
</td>
<td><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<%end%>
<% num = 1
if ttax_flag==false && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>0.00</td>
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<% num += 1
end %>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td>0.00</td>
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<% end %>
<%end%>
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
<td><b><%= rounding_adj rescue '-'%></b></td>
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '0' %></b></td>
<td><b><%= number_with_precision(rounding_adj.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
@@ -173,8 +175,10 @@
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</td>
<td>
</td>
</tr>
<%end%>
<%end%>
</tbody>
</table>
</div>

View File

@@ -60,17 +60,17 @@
</th>
<%end%>
<%end%>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<tr>
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td><%= @sale.receipt_date.strftime("%d-%m-%Y") %></td>
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier_name rescue '-' %></td>
<td><%= @sale.sale_status %> </td>
<td colspan="2"> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </td>
</tr>
<td colspan="2"> <%= @sale.requested_at.strftime("%d-%m-%Y %H:%M %p") %> </td>
</tr>
<tr style="border-top:2px solid #000">
<th><%= t :sale %> <%= t("views.right_panel.detail.item_txt") %> <%= t("views.right_panel.detail.name_txt2") %></th>
<th><%= t("views.right_panel.detail.qty") %></th>
@@ -78,20 +78,20 @@
<th><%= t("views.right_panel.detail.total_price") %></th>
<th><%= t("views.right_panel.detail.created_at") %></th>
<th><%= t("views.right_panel.detail.remark") %></th>
</tr>
</tr>
<% @sale.sale_items.each do |s| %>
<tr>
<td><%=s.product_name rescue ' '%></td>
<td><%=s.qty rescue ' '%></td>
<td><%= number_with_precision(s.unit_price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
<td><%=s.remark rescue ' '%></td>
</tr>
<% end %>
<% end %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.total") %></td>
<td><%= t("views.right_panel.detail.total") %></td>
<td colspan="3"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
@@ -102,10 +102,10 @@
<% @sale.sale_taxes.each do |r|%>
<tr>
<td colspan=2 style="text-align:center"></td>
<td><%= r.tax_name %> </td>
<td><%= r.tax_name %> </td>
<td colspan="3"><%= number_with_precision(r.tax_payable_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<% end %>
<% end %>
<tr>
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.grand_total") %></td>
@@ -122,8 +122,8 @@
<td colspan=2 style="text-align:center"></td>
<td> <%= r.payment_method.capitalize rescue ' '%> Payment</td>
<td colspan="3"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<% end %>
</tr>
<% end %>
<tr>
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.change") %></td>
@@ -208,7 +208,7 @@
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th></th>
</tr>
<% if @response["status"] == true %>
<% @response["data"].each do |transaction| %>
<tr>
@@ -216,7 +216,7 @@
<td><%= transaction["redeem"]%></td>
<td><%= transaction["rebate"] %></td>
<td><%= transaction["balance"] %></td>
<td><%= transaction["account_status"] %></td>
<td><%= transaction["account_status"] %></td>
<td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td>
<td></td>
@@ -241,13 +241,13 @@
<th><%= t("views.right_panel.detail.remark") %></th>
</tr>
</thead>
<tbody>
<tbody>
<% @sale_audits.each do |audit| %>
<tr>
<td><%= audit.action%></td>
<td><%= audit.action_at.strftime("%m-%d-%Y %H:%M %p")%></td>
<td><%= audit.approved_by%></td>
<td><%= audit.remark%></td>
<td><%= audit.remark%></td>
</tr>
<% end %>
</tbody>
@@ -297,7 +297,7 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<button class='btn btn-md waves-effect payment-btn-box payment_btn bg-green' data-type='Credit' data-value='Credit'>Credit</button>
</div>
<% @payment_methods.each_with_index do |pay, pay_index| %>
<%if (pay_index+1)%3 == 0 %>
<div class="row clearfix"></div>
@@ -308,8 +308,8 @@
<%end %>
</div>
<!-- </select> -->
<!-- </select> -->
</div>
<div class="modal-footer p-r-30 pb-3">
<button type="button" class="btn btn-md btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
@@ -367,17 +367,17 @@
}
}
// click select option icon for add
$('.payment_btn').on('click', function(event){
// click select option icon for add
$('.payment_btn').on('click', function(event){
active = $(this).hasClass('selected-payment');
value = $(this).data('value');
type = $(this).data('type');
group = $(this).data('group');
payments = $(".payment_btn");
if (active) {
if (active) {
$(this).removeClass('selected-payment');
}else{
}else{
$(this).addClass('selected-payment');
}
}); //End selecct attribute buttom
@@ -415,7 +415,7 @@
}
});
}
});
});
}else{
swal("Opps","You are not authorized for void","warning")
}
@@ -438,14 +438,14 @@
if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Cash",tax_type);
}
}
}
}
$( "#loading_wrapper" ).hide();
receipt_no = "<%= @sale.receipt_no %>";
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
window.location = '/origami/sale/'+sale_id+'/transaction/payment';
});
@@ -454,4 +454,3 @@
window.location = '/origami/sale/'+sale_id+'/transaction/payment';
});
</script>

BIN
dump.rdb

Binary file not shown.