Merge branch 'split_bill' of bitbucket.org:code2lab/sxrestaurant into quick_service
This commit is contained in:
@@ -192,9 +192,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
|
||||
@@ -211,7 +223,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@rounding_adj = @sale_data.rounding_adjustment
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale_data.customer_id)
|
||||
|
||||
@@ -97,11 +97,11 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
else
|
||||
table = nil
|
||||
cashier_zone = nil
|
||||
end
|
||||
|
||||
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
# get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id)
|
||||
get_cashier_by_terminal = current_user
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@@ -208,17 +208,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# begin
|
||||
order = Order.new
|
||||
order.source = "cashier"
|
||||
order.order_type = order_type
|
||||
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
order.item_count = order_items.count
|
||||
order.status = "new"
|
||||
order.table_id = params[:dining_id] # this is dining facilities's id
|
||||
order.waiters = current_user.name
|
||||
order.employee_name = current_user.name
|
||||
order.guest_info = nil
|
||||
order.save!
|
||||
order = create_order(params,order_type,order_items.count,current_user)
|
||||
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
||||
|
||||
@@ -260,17 +250,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# begin
|
||||
order = Order.new
|
||||
order.source = "cashier"
|
||||
order.order_type = order_type
|
||||
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
order.item_count = order_items.count
|
||||
order.status = "new"
|
||||
order.table_id = params[:dining_id] # this is dining facilities's id
|
||||
order.waiters = current_user.name
|
||||
order.employee_name = current_user.name
|
||||
order.guest_info = nil
|
||||
order.save!
|
||||
order = create_order(params,order_type,order_items.count,current_user)
|
||||
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
||||
|
||||
@@ -297,17 +277,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# begin
|
||||
order = Order.new
|
||||
order.source = "cashier"
|
||||
order.order_type = order_type
|
||||
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
order.item_count = order_items.count
|
||||
order.status = "new"
|
||||
order.table_id = params[:dining_id] # this is dining facilities's id
|
||||
order.waiters = current_user.name
|
||||
order.employee_name = current_user.name
|
||||
order.guest_info = nil
|
||||
order.save!
|
||||
order = create_order(params,order_type,order_items.count,current_user)
|
||||
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
||||
|
||||
@@ -319,17 +289,12 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
sale = Sale.new
|
||||
status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, get_cashier_by_terminal)
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, current_user)
|
||||
end
|
||||
|
||||
# Bind shift sale id to sale
|
||||
# sale_data.shift_sale_id = shift_by_terminal.id
|
||||
# sale_data.save
|
||||
|
||||
Promotion.promo_activate(sale)
|
||||
|
||||
BillBroadcastJob.perform_later(table)
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
|
||||
render :json => { status: status }
|
||||
else
|
||||
@@ -337,9 +302,36 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def create_order(params,order_type,items_count,current_user)
|
||||
order = Order.new
|
||||
order.source = "cashier"
|
||||
order.order_type = order_type
|
||||
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
order.item_count = items_count
|
||||
order.status = "new"
|
||||
order.table_id = params[:dining_id] # this is dining facilities's id
|
||||
order.waiters = current_user.name
|
||||
order.employee_name = current_user.name
|
||||
order.guest_info = nil
|
||||
order.save!
|
||||
|
||||
return order
|
||||
end
|
||||
|
||||
def update_order_item(order_id, order_item)
|
||||
orderItem = OrderItem.find(order_item["id"])
|
||||
if orderItem.qty.to_f != order_item['qty'].to_f
|
||||
set_menu_items_obj = Array.new
|
||||
if !orderItem.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(orderItem.set_menu_items)
|
||||
instance_item_sets.each_with_index do |instance_item, instance_index|
|
||||
instance_item_sets[instance_index]["quantity"] = (instance_item["quantity"].to_i - order_item['qty'].to_i).to_s
|
||||
"[{\"item_instance_code\":\"psi002in001\",\"quantity\":\"2\",\"price\":\"5500.0\"}]"
|
||||
set_menu_items_obj.push({'item_instance_code' => instance_item["item_instance_code"], 'quantity' => order_item['qty'].to_i, 'price' => instance_item["price"]})
|
||||
end
|
||||
orderItem.set_menu_items = instance_item_sets.to_json
|
||||
end
|
||||
|
||||
OrderItem.processs_item(orderItem.item_code,
|
||||
orderItem.item_instance_code,
|
||||
orderItem.item_name,
|
||||
@@ -348,7 +340,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
order_item['qty'],
|
||||
orderItem.price,
|
||||
orderItem.options,
|
||||
orderItem.set_menu_items,
|
||||
set_menu_items_obj.to_json,
|
||||
order_id,
|
||||
orderItem.item_order_by,
|
||||
orderItem.taxable)
|
||||
|
||||
@@ -86,9 +86,10 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
|
||||
def create_survey
|
||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
@type = params[:cashier_type]
|
||||
@sale_id = params[:sale_id]
|
||||
sale = Sale.find(@sale_id)
|
||||
@type = params[:cashier_type]
|
||||
@sale_id = params[:sale_id]
|
||||
sale = Sale.find(@sale_id)
|
||||
receipt_no = params[:receipt_no]
|
||||
|
||||
if @type != "quick_service"
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
@@ -102,27 +103,43 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_terminal_id,nil)
|
||||
|
||||
if @type != "quick_service"
|
||||
survey = Survey.find_by_dining_name(dining_facility.name)
|
||||
survey = Survey.find_by_dining_name_and_receipt_no(dining_facility.name,receipt_no)
|
||||
else
|
||||
survey = nil
|
||||
end
|
||||
|
||||
|
||||
if survey.nil?
|
||||
survey = Survey.new
|
||||
if @type != "quick_service"
|
||||
survey.dining_name = dining_facility.name
|
||||
survey = Survey.find_by_dining_name_and_receipt_no(dining_facility.name,nil)
|
||||
if survey.nil?
|
||||
survey = Survey.new
|
||||
survey.dining_name = dining_facility.name
|
||||
survey.receipt_no = params[:receipt_no]
|
||||
survey.shift_id = shift_by_terminal.id
|
||||
survey.created_by = current_user.name
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.save!
|
||||
else
|
||||
survey.receipt_no = params[:receipt_no]
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.save!
|
||||
end
|
||||
else
|
||||
survey = Survey.new
|
||||
survey.receipt_no = params[:receipt_no]
|
||||
survey.shift_id = shift_by_terminal.id
|
||||
survey.created_by = current_user.name
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.save!
|
||||
end
|
||||
|
||||
survey.receipt_no = params[:receipt_no]
|
||||
survey.shift_id = shift_by_terminal.id
|
||||
survey.created_by = current_user.name
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.save!
|
||||
else
|
||||
survey.receipt_no = params[:receipt_no]
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.save!
|
||||
end
|
||||
render :json => {status: true}
|
||||
@@ -131,6 +148,22 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def get_survey
|
||||
dining_id = params[:dining_id]
|
||||
receipt_no = params[:receipt_no]
|
||||
table = DiningFacility.find_by_id(dining_id)
|
||||
survey = Survey.find_by_dining_name_and_receipt_no(table.name,receipt_no)
|
||||
if survey.nil?
|
||||
survey = Survey.find_by_dining_name_and_receipt_no(table.name,nil)
|
||||
end
|
||||
|
||||
if !survey.nil?
|
||||
render :json => { status: true, survey: survey }
|
||||
else
|
||||
render :json => { status: false }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
||||
@@ -484,7 +484,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
|
||||
bounding_box([0,y_position], :width =>self.label_width) do
|
||||
move_down 15
|
||||
text "Total", :size => self.item_font_size,:align => :left
|
||||
text "Total Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
|
||||
@@ -493,7 +493,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
bounding_box([0,y_position], :width =>self.label_width) do
|
||||
move_down 15
|
||||
text "Total", :size => self.item_font_size,:align => :left
|
||||
text "Total Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
|
||||
@@ -2,6 +2,21 @@
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<% if !@print_settings.nil? %>
|
||||
<% 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
|
||||
%>
|
||||
<% end %>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<div class="card">
|
||||
@@ -56,9 +71,9 @@
|
||||
<% sub_total += sale_item.price%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class="item-name"><%=sale_item.product_name%>@<%=sale_item.unit_price%></td>
|
||||
<td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
|
||||
<td class="item-attr"><%=sale_item.qty%></td>
|
||||
<td class="item-attr"><%=(sale_item.price)%></td>
|
||||
<td class="item-attr"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
|
||||
</tr>
|
||||
<%end %>
|
||||
</tbody>
|
||||
@@ -71,7 +86,7 @@
|
||||
<tfooter>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total</strong></td>
|
||||
<td class="item-attr"><strong><span id="sub-total"><%=sub_total%></span></strong></td>
|
||||
<td class="item-attr"><strong><span id="sub-total"><%=number_with_precision(sub_total, precision: precision.to_i)%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
@@ -79,7 +94,7 @@
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>(Discount)</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
|
||||
<td class="item-attr"><strong><span>(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax
|
||||
@@ -91,22 +106,30 @@
|
||||
<%end%>
|
||||
<%end %>)
|
||||
</strong></td>
|
||||
<td class="item-attr"><strong><span><%=@sale_data.total_tax rescue 0%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong><%= @sale_data.rounding_adjustment rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong><%= number_with_precision(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total</strong></td>
|
||||
<td class="item-attr"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<%if @balance > 0%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong><%= @accountable_type %></strong></td>
|
||||
<td class="item-attr"><strong><span><%=@balance%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%=number_with_precision(@balance, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@individual_total[0].nil? %>
|
||||
<tr>
|
||||
<td class="charges-name">
|
||||
<strong>Individual amount for <%= @individual_total[0]['total_customer'] %> persons</strong>
|
||||
</td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@individual_total[0]['per_person_amount'], precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tfooter>
|
||||
</table>
|
||||
</div>
|
||||
@@ -124,24 +147,24 @@
|
||||
<div class="col-md-8"><strong>Amount Due</strong></div>
|
||||
<div class="col-md-4">
|
||||
<strong>
|
||||
<span id="grand_total" class="hidden"><%= @sale_data.grand_total rescue 0%></span>
|
||||
<span id="amount_due"><%= @sale_data.grand_total rescue 0%></span></strong>
|
||||
<span id="grand_total" class="hidden"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i)%></span>
|
||||
<span id="amount_due"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row payment cash-color p-l-5 p-r-5">
|
||||
<div class="col-md-8">Cash</div>
|
||||
<div class="col-md-4" id="cash" ><%= @cash %></div>
|
||||
<div class="col-md-4" id="cash" ><%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
|
||||
<div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" >
|
||||
<div class="col-md-8">Credit</div>
|
||||
<div class="col-md-4" id="credit"><%= @credit %></div>
|
||||
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
<div class="col-md-4" id="others"><%= number_with_precision(@other, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
@@ -156,13 +179,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= @other %></div>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4" id="others">0.0</div>
|
||||
<div class="col-md-4" id="others"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- paypar -->
|
||||
@@ -170,13 +193,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<div class="col-md-4" id="ppamount">0.0</div>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Visa -->
|
||||
@@ -184,13 +207,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= @visacount %></div>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<div class="col-md-4" id="visacount">0.0</div>
|
||||
<div class="col-md-4" id="visacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- JCB -->
|
||||
@@ -198,13 +221,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= @jcbcount %></div>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4" id="jcbcount">0.0</div>
|
||||
<div class="col-md-4" id="jcbcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Master -->
|
||||
@@ -212,13 +235,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= @mastercount %></div>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<div class="col-md-4" id="mastercount">0.0</div>
|
||||
<div class="col-md-4" id="mastercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- <br> -->
|
||||
@@ -227,18 +250,18 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= @unionpaycount %></div>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<div class="col-md-4" id="unionpaycount">0.0</div>
|
||||
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row m-l-5 m-r-5">
|
||||
<div class="col-md-8"><strong>Balance</strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= @sale_data.grand_total rescue 0 %></span></strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong></div>
|
||||
</div>
|
||||
<!-- <br> -->
|
||||
</div>
|
||||
@@ -488,8 +511,13 @@ console.log("fffffffffffff")
|
||||
var unionpay1 = $('#unionpaycount').text();
|
||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
|
||||
var total = $('#amount_due').text();
|
||||
var amt = parseFloat(total) - parseFloat(othertotal);
|
||||
$('#cash').text(parseFloat(amt).toFixed(1));
|
||||
var amt = 0;
|
||||
<% if precision.to_i > 0 %>;
|
||||
amt = parseFloat(parseFloat(total) - parseFloat(othertotal)).toFixed(<%= precision %>);
|
||||
<% else %>
|
||||
amt = parseFloat(parseFloat(total) - parseFloat(othertotal));
|
||||
<% end %>
|
||||
$('#cash').text(amt);
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
@@ -654,7 +682,11 @@ console.log("fffffffffffff")
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay)
|
||||
var result = parseFloat(amount_due) - parseFloat(total);
|
||||
$('#balance').text(result.toFixed(2));
|
||||
<% if precision.to_i > 0 %>
|
||||
$('#balance').text(parseFloat(result).toFixed(<%= precision %>));
|
||||
<% else %>
|
||||
$('#balance').text(parseFloat(result));
|
||||
<% end %>
|
||||
}
|
||||
|
||||
$('#foc').click(function() {
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
<div class="modal-body">
|
||||
<div class="form-horizontal">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<input type="text" id="per_person" name="per_person" class="form-control" onkeypress="return isNumberKey(event);"/><br>
|
||||
<span id="per_personErr" style="color:red;"></span>
|
||||
</div>
|
||||
@@ -318,7 +318,6 @@
|
||||
var split_receipt_no = "";
|
||||
var split_total_amount = 0;
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#back').on('click',function(){
|
||||
backToOrigami();
|
||||
})
|
||||
@@ -472,9 +471,26 @@
|
||||
|
||||
//equal split process
|
||||
$('#equal_split').on('click', function(){
|
||||
var dining_id = $("#table_id").text();
|
||||
split_sale_id = $("input[type='radio'][name='rdn_receipt']:checked").val();
|
||||
split_receipt_no = $("input[type='radio'][name='rdn_receipt']:checked").parent().parent().attr('id');
|
||||
split_total_amount = $("input[type='radio'][name='rdn_receipt']:checked").parent().parent().attr('data');
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/split_bills/get_survey",
|
||||
dataType: 'JSON',
|
||||
data: {'dining_id':dining_id, 'receipt_no':split_receipt_no },
|
||||
success: function (result) {
|
||||
if(result.status){
|
||||
if(parseInt(result.survey.total_customer) > 0){
|
||||
$("#per_person").val(parseInt(result.survey.total_customer));
|
||||
}else{
|
||||
$("#per_person").val("");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if(split_sale_id != undefined && split_sale_id != ""){
|
||||
$('#equal_split_modal').modal({backdrop: 'static', keyboard: true, show: true});
|
||||
}
|
||||
|
||||
@@ -239,6 +239,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills"
|
||||
|
||||
post '/split_bills/surveys', to: 'surveys#create_survey'
|
||||
post '/split_bills/get_survey', to: 'surveys#get_survey'
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user