split bill fixed

This commit is contained in:
yarzar_code
2020-08-26 10:41:13 +06:30
parent 289187c019
commit a226a39d08
2 changed files with 15 additions and 13 deletions

View File

@@ -35,19 +35,21 @@ class Origami::HomeController < BaseOrigamiController
@shop = shop_detail
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@dining_booking = @dining.current_bookings
@order_items = Array.new
@dining_booking.each do |booking|
@dining.current_bookings.each do |booking|
if @obj_sale || @booking.blank?
@booking = booking
end
if booking.sale_id
@obj_sale = booking.sale
@sale_array.push(@obj_sale)
@sale_taxes = @obj_sale.sale_taxes
@status_sale = 'sale'
@sale_array.push(booking.sale)
if @obj_sale.blank?
@obj_sale = booking.sale
@sale_taxes = @obj_sale.sale_taxes
@status_sale = 'sale'
end
else
@order_items += booking.order_items
@obj_order = booking.orders.first

View File

@@ -239,7 +239,7 @@
<div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<%= @obj_sale.receipt_no rescue '' %>
<% end %>
</span>
<br>
@@ -266,8 +266,8 @@
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<p class="hidden customer-id"><%= @obj_sale.customer_id rescue '' %></p>
&nbsp; Customer : <%= @obj_sale.customer.name rescue '' %>
<% elsif @status_order == 'order'
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
@@ -291,9 +291,9 @@
<% count = 0
sub_total = 0
if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item|
@obj_sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
<%count += 1 %>
<tr>
<td><%= count %></td>
@@ -455,7 +455,7 @@
<% end %>
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
unless sale.receipt_no == @obj_sale.receipt_no
%>
<table class="table table-striped">
<tr>
@@ -529,7 +529,7 @@
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<% if @split_bill == '1' && (@orde_items.present?) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %>
<% end %>