split bill process

This commit is contained in:
phyusin
2018-02-20 13:33:59 +06:30
parent 8ccf45d06f
commit 4bfb5842bf
7 changed files with 88 additions and 18 deletions

View File

@@ -186,9 +186,21 @@ class Origami::PaymentsController < BaseOrigamiController
@table_no = ''
@dining = ''
@shop = Shop::ShopDetail
@shop = Shop::ShopDetail #show shop info
saleObj = Sale.find(sale_id)
#total customer with individual total amount
survey = nil
@individual_total = Array.new
if !@sale_data.nil?
survey = Survey.find_by_receipt_no(@sale_data.receipt_no)
if !survey.nil?
per_person_amount = saleObj.grand_total.to_f / survey.total_customer.to_i
@individual_total.push({'total_customer' => survey.total_customer, 'per_person_amount' => per_person_amount.to_f })
end
end
# rounding adjustment
if @shop.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus