diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 6c76c27a..02a85f91 100644 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -22,10 +22,10 @@ class Origami::DiscountsController < BaseOrigamiController sale = Sale.find(sale_id) table_id = sale.bookings[0].dining_facility_id table_type = DiningFacility.find(table_id).type - sale.total_discount = overall_discount.to_f - sale.total_amount = sub_total.to_f - sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax; - sale.save + # sale.total_discount = overall_discount.to_f + # sale.total_amount = sub_total.to_f + # sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax; + # sale.save if discount_items.length > 0 #save sale item for discount discount_items.each do |di| @@ -35,6 +35,7 @@ class Origami::DiscountsController < BaseOrigamiController sale_item.sale_id = sale_id sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id sale_item.product_name = di["name"] + sale_item.product_alt_name = "" sale_item.remark = "Discount" sale_item.qty = 1 @@ -45,7 +46,10 @@ class Origami::DiscountsController < BaseOrigamiController sale_item.price = di["price"] sale_item.save end - end + end + + # Re-calc All Amount in Sale + sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f) end dining = {:table_id => table_id, :table_type => table_type } diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index 654f539a..a23ebd16 100644 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -16,10 +16,11 @@ class Origami::OtherChargesController < BaseOrigamiController if Sale.exists?(sale_id) sale = Sale.find(sale_id) table_id = sale.bookings[0].dining_facility_id - table_type = DiningFacility.find(table_id).type - sale.total_amount = sub_total.to_f - sale.grand_total = sub_total.to_f + sale.total_tax; - sale.save + table_type = DiningFacility.find(table_id).type + + # sale.total_amount = sub_total.to_f + # sale.grand_total = sub_total.to_f + sale.total_tax; + # sale.save if other_charges_items.length > 0 #save sale item for discount other_charges_items.each do |di| @@ -29,18 +30,22 @@ class Origami::OtherChargesController < BaseOrigamiController sale_item.sale_id = sale_id sale_item.product_code = "Other Charges" sale_item.product_name = di["name"] + sale_item.product_alt_name = "" sale_item.remark = "Other Charges" sale_item.qty = 1 sale_item.unit_price = di["price"] - sale_item.taxable_price = di["price"] + sale_item.taxable_price = 0 sale_item.is_taxable = 0 sale_item.price = di["price"] sale_item.save end - end - end + end + + # Re-calc All Amount in Sale + sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount) + end dining = {:table_id => table_id, :table_type => table_type } render :json => dining.to_json diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 0d2d9082..2cdd44b5 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -9,10 +9,6 @@ class Origami::PaymentsController < BaseOrigamiController sale_data = Sale.find_by_sale_id(sale_id) sale_items = SaleItem.where("sale_id=?",sale_id) - new_total = Sale.get_rounding_adjustment(sale_data.grand_total) - rounding_adj = sale_data.grand_total - new_total - - sale_data.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj) # Print for First Bill to Customer unique_code = "ReceiptBillPdf" @@ -43,7 +39,12 @@ class Origami::PaymentsController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - sale_payment.process_payment(saleObj, @user, cash, "cash") + sale_payment.process_payment(saleObj, @user, cash, "cash") + + new_total = Sale.get_rounding_adjustment(saleObj.grand_total) + rounding_adj = saleObj.grand_total - new_total + + saleObj.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj) rebate_amount = nil diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb index e272c1ee..c397da0f 100644 --- a/app/controllers/origami/sales_controller.rb +++ b/app/controllers/origami/sales_controller.rb @@ -26,6 +26,9 @@ class Origami::SalesController < BaseOrigamiController order.order_items.each do |orer_item| saleobj.add_item (orer_item) end + + # Re-compute for add + saleobj.compute saleobj.save order.save booking.save diff --git a/app/controllers/reports/shiftsale_controller.rb b/app/controllers/reports/shiftsale_controller.rb index 5f13857d..87fae97d 100644 --- a/app/controllers/reports/shiftsale_controller.rb +++ b/app/controllers/reports/shiftsale_controller.rb @@ -1,5 +1,5 @@ -class Reports::ShiftsaleController < ApplicationController - # authorize_resource :class => false +class Reports::ShiftsaleController < BaseReportController + authorize_resource :class => false def index diff --git a/app/models/ability.rb b/app/models/ability.rb index 066311af..9a7b5f6f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -36,12 +36,13 @@ class Ability can :index, :dailysale can :index, :saleitem can :index, :receipt_no + can :index, :shiftsale can :add_customer, Customer can :update_sale_by_customer, Customer - can :index, :other_charges - can :create, :other_charges + can :index, :other_charge + can :create, :other_charge can :index, :discount can :create, :discount can :remove_discount_items, :discount @@ -76,11 +77,14 @@ class Ability can :add_customer, Customer can :update_sale_by_customer, Customer + can :index, :other_charge + can :create, :other_charge can :index, :discount can :create, :discount can :remove_discount_items, :discount can :remove_all_discount, :discount + can :first_bill, :payment can :show, :payment can :create, :payment can :reprint, :payment @@ -89,18 +93,25 @@ class Ability can :moving, :movetable can :move_dining, :moveroom + + can :first_bill, :payment + can :show, :payment + can :create, :payment + can :reprint, :payment elsif user.role == "accountant" can :index, :dailysale - can :manage, :saleitem - can :index, :receiptno + can :index, :saleitem + can :index, :receipt_no + can :index, :shiftsale elsif user.role == "supervisour" can :index, :dailysale - can :manage, :saleitem - can :index, :receiptno + can :index, :saleitem + can :index, :receipt_no + can :index, :shiftsale end diff --git a/app/models/order.rb b/app/models/order.rb index 249e82ea..714174fe 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -91,7 +91,7 @@ class Order < ApplicationRecord # self.employee_name) # end - OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id], + OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id], item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, self.employee_name) diff --git a/app/models/order_item.rb b/app/models/order_item.rb index 2c9a9ba0..f4f3efba 100644 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -20,12 +20,13 @@ class OrderItem < ApplicationRecord # option_values : [], # sub_order_items : [], # } - def self.processs_item (item_code, menu_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by) + def self.processs_item (item_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by) orderitem = OrderItem.create do |oitem| oitem.order_id = order_id oitem.item_code = item_code oitem.item_name = menu_name + oitem.alt_name = alt_name oitem.account_id = account_id oitem.qty = qty oitem.price = price diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 7e3352d1..c9da3a9f 100644 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -59,11 +59,11 @@ class OrderQueueStation < ApplicationRecord private #Print order_items in 1 slip def print_slip(oqs, order, order_items) - unique_code="OrderSummaryPdf" + unique_code="OrderSummaryPdf" print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - order_queue_printer.print_order_summary(oqs,order.order_id, order_items, print_status="") + order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="") AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai| # update print status for order items @@ -80,7 +80,7 @@ class OrderQueueStation < ApplicationRecord # print when complete click print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - order_queue_printer.print_order_item(oqs,item.order_id, item.item_code, print_status="" ) + order_queue_printer.print_order_item(print_settings, oqs,item.order_id, item.item_code, print_status="" ) # update print status for completed same order items assigned_order_item.each do |ai| diff --git a/app/models/sale.rb b/app/models/sale.rb index 1df94034..f2599cc9 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -41,8 +41,10 @@ class Sale < ApplicationRecord end booking.sale_id = sale_id end + order = booking.booking_orders.take.order link_order_sale(order.id) + return status, sale_id end end @@ -93,7 +95,6 @@ class Sale < ApplicationRecord end - self.save! #compute sales summary @@ -148,6 +149,7 @@ class Sale < ApplicationRecord #pull sale_item.product_code = item.item_code sale_item.product_name = item.item_name + sale_item.product_alt_name = item.alt_name sale_item.account_id = item.account_id sale_item.remark = item.remark @@ -206,6 +208,33 @@ class Sale < ApplicationRecord end + #compute - invoice total + def compute_by_sale_items(sale_id, sale_itemss, total_discount) + sale = Sale.find(sale_id) + sales_items = sale_itemss + + #Computation Fields + subtotal_price = 0 + total_taxable = 0 + rounding_adjustment = 0 + + sales_items.each do |item| + #compute each item and added to total + subtotal_price = subtotal_price + item.price + total_taxable = total_taxable + (item.taxable_price * item.qty) + end + + compute_tax(sale, total_taxable) + sale.total_amount = subtotal_price + sale.total_discount = total_discount + sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax + #compute rounding adjustment + # adjust_rounding + + sale.save! + + end + def compute_without_void sales_items = self.sale_items @@ -231,6 +260,39 @@ class Sale < ApplicationRecord self.save! end + + # Tax Re-Calculte + def compute_tax(sale, total_taxable) + #if tax is not apply create new record + SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax| + #delete existing and create new + existing_tax.delete + end + + total_tax_amount = 0 + #tax_profile - list by order_by + tax_profiles = TaxProfile.all.order("order_by asc") + + # #Creat new tax records + tax_profiles.each do |tax| + sale_tax = SaleTax.new(:sale => sale) + sale_tax.tax_name = tax.name + sale_tax.tax_rate = tax.rate + #include or execulive + # sale_tax.tax_payable_amount = total_taxable * tax.rate + sale_tax.tax_payable_amount = total_taxable * tax.rate / 100 + #new taxable amount + total_taxable = total_taxable + sale_tax.tax_payable_amount + + sale_tax.inclusive = tax.inclusive + sale_tax.save + + total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount + end + + sale.total_tax = total_tax_amount + end + # Tax Calculate def apply_tax(total_taxable) #if tax is not apply create new record @@ -447,6 +509,63 @@ def self.get_by_shiftsales(from,to) return ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to) end +# def self.get_by_shiftsales(employee,from,to) +# shift_sales = ShiftSale.select('shift_sales.id, cs.name as cashier_station_name, shift_sales.shift_started_at as opening_date, shift_sales.shift_closeed_at as closing_date') +# .joins(" INNER JOIN cashier_terminals cs ON cs.id = shift_sales.cashier_terminal_id") +# .where("shift_sales.employee_id = ? and (shift_sales.shift_started_at between ? and ? OR shift_sales.shift_closeed_at between ? and ? )", employee, from, to, from, to) +# .order("shift_sales.id DESC") + +# sale_arr = Array.new +# shift_sales.each do |shift| +# all_total= Sale.select("grand_total,sr.payment_method, sr.payment_amount, rounding_adjustment") +# .joins("join employees e on sales.cashier_id = e.id join shift_sales sh on sh.id = sales.shift_sale_id") +# .joins("INNER JOIN (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sr ON sr.sale_id = sales.sale_id") +# .where("sales.shift_sale_id =? and sales.sale_status = 'completed' and sales.total_amount != 0",shift.id) + +# void = Sale.select("SUM(sales.grand_total) AS grand_total") +# .joins("join shift_sales sh on sh.id = sales.shift_sale_id") +# .where('sales.sales_status = "void" and sales.total_amount != 0 and sales.shift_sale_id = ?', shift.id) +# .sum(:grand_total) +# cash = all_total.select('sr.payment_type') +# .where('sr.payment_type = "cash"') +# .sum(:amount) + +# credit = all_total.where('sr.payment_type = "credit"') +# .sum(:amount) + +# accept_credit = all_total.select('ci.amout') +# .joins("INNER JOIN credit_items ci ON ci.sale_id = sales.id") +# .where('sr.payment_type = "credit"') +# .sum(:amout) + + + +# foc = all_total.where('sales.payment_type = "foc" and sales.sales_status = "completed"') +# .sum(:grand_total) + +# card = all_total.select('payment_type') +# .where('sr.payment_type = "card"') +# .sum(:amount).to_f + +# rounding_adj = all_total.sum(:rounding_adjustment) + +# discount = all_total.sum(:discount_amount) +# void = void.nil? ? 0 : void +# cash = cash.nil? ? 0 : cash +# credit = credit.nil? ? 0 : credit +# foc = foc.nil? ? 0 : foc +# card = card.nil? ? 0 : card +# accept_credit = accept_credit.nil? ? 0 : accept_credit +# # all_payments = void.to_d + cash.to_d + credit.to_d + foc.to_d + card.to_d + accept_credit.to_d +# all_payments = cash.to_d + credit.to_d + foc.to_d + card.to_d + accept_credit.to_d +# payments = { void_amount: void, cash_amount: cash, credit_amount: credit,accept_credit_amount: accept_credit, foc_amount: foc, card_amount: card, grand_total: all_payments , cashier_station_name: shift.cashier_station_name, opening_date: shift.opening_date, closing_date: shift.closing_date, rounding_adj: rounding_adj } + +# sale_arr.push(payments) +# end + +# return sale_arr +# end + def get_cash_amount cash = 0.0 self.sale_payments.each do |pay| @@ -487,7 +606,6 @@ end return tax end - private def generate_custom_id diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 741abfc2..59cee9a6 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -54,6 +54,14 @@ class SalePayment < ApplicationRecord remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}" sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by) + # update complete order items in oqs + SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr| + AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi| + aoi.delivery_status = 1 + aoi.save + end + end + return true, self.save else #record an payment in sale-audit diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index ae4c93a8..aa471972 100644 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -20,8 +20,8 @@ class ShiftSale < ApplicationRecord #if current_user #find open shift where is open today and is not closed and login by current cashier today_date = DateTime.now.strftime("%Y-%m-%d") - puts today_date - shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}", today_date).take + + shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take return shift #end diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 3817c509..bff0852d 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -95,7 +95,7 @@ class ReceiptBillPdf < Prawn::Document y_position = cursor bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do - text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left + text "Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left end @@ -202,6 +202,18 @@ class ReceiptBillPdf < Prawn::Document # text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right # end + if sale_data.rounding_adjustment != 0.0 + move_down 5 + y_position = cursor + + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Rounding Adjustment", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "#{sale_data.rounding_adjustment}", :size => self.item_font_size,:align => :right + end + end + move_down 5 y_position = cursor move_down 5 @@ -253,18 +265,13 @@ class ReceiptBillPdf < Prawn::Document if rebate_amount["status"] == true stroke_horizontal_rule + rebate = 0 rebate_amount["data"].each do |res| if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Rebate" - move_down 5 - y_position = cursor - bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do - text "Current Rebate Amount", :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(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right - end + rebate = rebate + res["rebate"] + end if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem" @@ -279,6 +286,14 @@ class ReceiptBillPdf < Prawn::Document end end + move_down 5 + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Current Rebate Amount", :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(rebate, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right + end end end if member_info["status"] == true && member_info["data"].present? diff --git a/app/views/crm/customers/show.html.erb b/app/views/crm/customers/show.html.erb index 3cf08856..5d36f5c3 100644 --- a/app/views/crm/customers/show.html.erb +++ b/app/views/crm/customers/show.html.erb @@ -60,7 +60,7 @@
| Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>) | -||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sr.no | -Date | -Void Amount | -Mpu Sales | -Master Sales | -Visa Sales | -Jcb Sales | -Paypar Sales | -Cash Sales | -Credit Sales | -FOC Sales | -(Discount) | -Grand Total + Rounding Adj. |
- Rounding Adj. | -Grand Total | -||
| <%= count %> | -<%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %> | -<%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%> | -(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>) | -<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%> | -||
| From Date : <%= params[:from] rescue '-'%> ,To Date : <%= params[:to] rescue '-'%> | +||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Cashier Station | +Cashier Name | +Shift Name | + +Cash Payment | + +Credit Payment | + +Other Payment | + + +Grand Total | +||||||||
| Total | -<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%> | -(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>) | -<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%> | -||
| + <%= result.cashier_terminal.name rescue '-'%> + | ++ <%= result.employee.name rescue '-'%> + | +<%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> - + <%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %> + | + +<%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%> | +<%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%> | + + +<%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%> | +<%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%> | - <% total_tax = 0 %> - <% unless @tax.empty? %> - <% @tax.each do |tax| %> - <% total_tax += tax.tax_amount.to_f %> -||||||||
| <%= tax.tax_name rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> | -- | ||||||||||||
| Net Amount | -<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> | -- | ||||||||||||