Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -19,9 +19,9 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
// auto refresh every 10 seconds
|
||||
setTimeout(function(){
|
||||
window.location.reload(1);
|
||||
}, 10000);
|
||||
// setTimeout(function(){
|
||||
// window.location.reload(1);
|
||||
// }, 10000);
|
||||
|
||||
$('.queue_station').on('click',function(){
|
||||
var orderZone=$(this).children().children().children('.order-zone').text();
|
||||
|
||||
@@ -157,10 +157,11 @@ $(document).ready(function(){
|
||||
|
||||
if(sale_item_id != null){
|
||||
ajax_url = "/origami/" + sale_item_id + "/discount";
|
||||
sub_total = $("#"+sale_item_id).children().find("#item-total-price").text();
|
||||
}
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_value)/100;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class Api::OrdersController < Api::ApiController
|
||||
# check booking id is already completed.
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed"
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@@ -49,7 +49,7 @@ class Api::OrdersController < Api::ApiController
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
puts "booking sale is null"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
|
||||
@@ -16,6 +16,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
discount_value = params[:discount_value]
|
||||
discount_amount = params[:discount_amount]
|
||||
grand_total = params[:grand_total]
|
||||
product_name = "Overall Discount"
|
||||
|
||||
if discount_type == 0
|
||||
remark="Discount " + discount_amount + " as net"
|
||||
@@ -32,13 +33,14 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
#save sale item for discount
|
||||
if sale_item_id != nil
|
||||
origin_sale_item = SaleItem.find(sale_item_id)
|
||||
product_name = origin_sale_item.product_name + "-Disocunt"
|
||||
end
|
||||
sale_item = SaleItem.new
|
||||
|
||||
#pull
|
||||
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 = "Overall Discount"
|
||||
sale_item.product_name = product_name
|
||||
sale_item.remark = remark
|
||||
|
||||
sale_item.qty = 1
|
||||
|
||||
@@ -4,7 +4,8 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
# GET /settings/order_queue_stations
|
||||
# GET /settings/order_queue_stations.json
|
||||
def index
|
||||
@settings_order_queue_stations = OrderQueueStation.all.active
|
||||
@settings_order_queue_stations = OrderQueueStation.all
|
||||
@settings_order_queue_stations = Kaminari.paginate_array(@settings_order_queue_stations).page(params[:page]).per(50)
|
||||
end
|
||||
|
||||
# GET /settings/order_queue_stations/1
|
||||
|
||||
@@ -9,23 +9,30 @@ class Transactions::SalesController < ApplicationController
|
||||
receipt_no = params[:receipt_no]
|
||||
today = Date.today
|
||||
|
||||
if receipt_no.nil?
|
||||
sales = Sale.order("sale_id desc")
|
||||
if receipt_no.nil? && search_date.nil?
|
||||
@sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500)
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
|
||||
else
|
||||
order = Sale.search(receipt_no)
|
||||
if order.count > 0
|
||||
sales = order
|
||||
if !search_date.blank? && receipt_no.blank?
|
||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') = ? and NOT sale_status = 'void' ", search_date).order("sale_id desc").limit(500).page(params[:page])
|
||||
elsif !search_date.blank? && !receipt_no.blank?
|
||||
sale = Sale.where("receipt_no LIKE ? or DATE_FORMAT(receipt_date,'%d-%m-%Y') = ? and NOT sale_status = 'void' ", "%#{receipt_no}%", search_date).order("sale_id desc").limit(500).page(params[:page])
|
||||
else
|
||||
sale = Sale.where("receipt_no LIKE ? and NOT sale_status = 'void' ", receipt_no).order("sale_id desc").limit(500).page(params[:page])
|
||||
end
|
||||
if sale.count > 0
|
||||
@sales = sale
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
|
||||
else
|
||||
sales = Sale.order("sale_id desc")
|
||||
|
||||
end
|
||||
end
|
||||
@sales = Kaminari.paginate_array(sales).page(params[:page]).per(50)
|
||||
@sales = 0
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sales }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /transactions/sales/1
|
||||
@@ -43,6 +50,18 @@ class Transactions::SalesController < ApplicationController
|
||||
end
|
||||
|
||||
@sale_receivables = SalePayment.where('sale_id = ?', @sale.id)
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale.customer_id)
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
if(response["status"] == true)
|
||||
@membership = response["data"]
|
||||
else
|
||||
@membership = 0
|
||||
end
|
||||
#end customer amount
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @sale }
|
||||
@@ -104,22 +123,32 @@ class Transactions::SalesController < ApplicationController
|
||||
end
|
||||
|
||||
def manual_void_sale
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
reason = params[:reason]
|
||||
sale = Sale.find(sale_id)
|
||||
sale.sales_status = 'void'
|
||||
sale.remarks = reason
|
||||
sale.void_by = current_user.id
|
||||
sale.sale_status = 'void'
|
||||
sale.requested_by = current_login_employee.id
|
||||
if sale.save
|
||||
sale =SaleAudit.record_audit_void(sale_id, current_user.id, current_user.id, reason)
|
||||
@sale = SaleAudit.record_audit_void(sale_id, current_login_employee.id, current_login_employee.id, reason)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to transactions_sales_url, notice: 'Sale was successfully void.' }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def manual_complete_sale
|
||||
sale_id = params[:sale_id]
|
||||
sale = Sale.find(sale_id)
|
||||
sale.sale_status = 'completed'
|
||||
sale.requested_by = current_login_employee.id
|
||||
remark = remark = "Complete for Sale ID #{sale_id} By #{current_login_employee.name}"
|
||||
if sale.save
|
||||
sale = SaleAudit.record_audit_complete(sale_id, remark, current_login_employee.id)
|
||||
end
|
||||
redirect_to transactions_sales_path
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_transactions_sale
|
||||
|
||||
@@ -32,7 +32,7 @@ class Order < ApplicationRecord
|
||||
table = DiningFacility.find(self.table_id)
|
||||
table.status = "occupied"
|
||||
table.save
|
||||
else
|
||||
else
|
||||
booking = Booking.find(self.booking_id)
|
||||
end
|
||||
|
||||
@@ -231,7 +231,7 @@ class Order < ApplicationRecord
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true)
|
||||
.group("bookings.booking_id")
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
||||
# For PG
|
||||
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true
|
||||
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
||||
@@ -246,7 +246,7 @@ class Order < ApplicationRecord
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("sales.sale_status='completed'")
|
||||
.group("sales.sale_id")
|
||||
.group("sales.sale_id,bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
||||
# For PG
|
||||
#bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
||||
end
|
||||
@@ -262,7 +262,7 @@ class Order < ApplicationRecord
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::ROOM_TYPE,true)
|
||||
.group("bookings.booking_id")
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id")
|
||||
# For PG
|
||||
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true
|
||||
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id
|
||||
|
||||
@@ -35,23 +35,29 @@ class OrderItem < ApplicationRecord
|
||||
|
||||
#logger.debug orderitem.to_yml
|
||||
orderitem.save!
|
||||
|
||||
|
||||
end
|
||||
#Origami : Cashier : to show order items details
|
||||
|
||||
#Origami : Cashier : to show order items details
|
||||
def self.get_order_items_details(booking_id)
|
||||
booking_orders = BookingOrder.where("booking_id=?",booking_id)
|
||||
if booking_orders
|
||||
booking_orders.each do |book_order|
|
||||
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
|
||||
# booking_orders = BookingOrder.where("booking_id=?",booking.booking_id)
|
||||
# if booking_orders
|
||||
# booking_orders.each do |book_order|
|
||||
# order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
|
||||
# .joins("left join orders on orders.order_id = order_items.order_id")
|
||||
# .where("order_items.order_id=?",book_order.order)
|
||||
# return order_details
|
||||
# end
|
||||
# else
|
||||
# return false
|
||||
# end
|
||||
|
||||
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
|
||||
.joins("left join orders on orders.order_id = order_items.order_id")
|
||||
.where("order_items.order_id=?",book_order.order)
|
||||
return order_details
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
.joins("left join booking_orders on booking_orders.order_id = order_items.order_id")
|
||||
.joins("left join bookings on bookings.booking_id = booking_orders.booking_id")
|
||||
.where("bookings.booking_id=?",booking_id)
|
||||
|
||||
return order_details
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -186,6 +186,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
# Tax Calculate
|
||||
def apply_tax(total_taxable)
|
||||
|
||||
#if tax is not apply create new record
|
||||
|
||||
@@ -6,19 +6,30 @@ class SaleAudit < ApplicationRecord
|
||||
|
||||
belongs_to :sale
|
||||
|
||||
def record_audit_void(sale_id, void_by, approved_by, reason)
|
||||
def self.record_audit_void(sale_id, void_by, approved_by, reason)
|
||||
#sale_audit
|
||||
sale_audit = SaleAudit.new()
|
||||
sale_audit.sale_id = sale_id
|
||||
sale_audit.action = "SALEVOID"
|
||||
sale_audit.action_at = DateTime.now.utc
|
||||
sale_audit.action_by = void_by
|
||||
sale_audit = SaleAudit.new()
|
||||
sale_audit.sale_id = sale_id
|
||||
sale_audit.action = "SALEVOID"
|
||||
sale_audit.action_at = DateTime.now.utc
|
||||
sale_audit.action_by = void_by
|
||||
sale_audit.approved_by = approved_by
|
||||
sale_audit.remark = reason
|
||||
sale_audit.remark = reason
|
||||
sale_audit.save!
|
||||
#sale_audit.
|
||||
end
|
||||
|
||||
def self.record_audit_complete(sale_id, remark, action_by)
|
||||
sale_audit = SaleAudit.new()
|
||||
sale_audit.sale_id = sale_id
|
||||
sale_audit.action = "SALECOMPLETE"
|
||||
sale_audit.action_at = DateTime.now.utc
|
||||
sale_audit.action_by = action_by
|
||||
sale_audit.remark = remark
|
||||
sale_audit.approved_by = Time.now
|
||||
sale_audit.save!
|
||||
end
|
||||
|
||||
def record_audit_discount(sale_id, discount_by, approved_by, reason)
|
||||
#sale_audit
|
||||
sale_audit = SaleAudit.new()
|
||||
|
||||
@@ -165,16 +165,32 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
if sale_data.sale_taxes.length > 1
|
||||
sale_data.sale_taxes.each do |st|
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "( " +"#{ st.tax_payable_amount }" +" )" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Total Tax", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
# move_down 5
|
||||
# y_position = cursor
|
||||
|
||||
# bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
# text "Total Tax", :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
# text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right
|
||||
# end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
move_down 5
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
if (@booking)
|
||||
json.id @booking.booking_id
|
||||
json.status @booking.booking_status
|
||||
if Sale.exists?(@booking.sale_id)
|
||||
json.sale_status Sale.find(@booking.sale_id).sale_status
|
||||
else
|
||||
json.sale_status ""
|
||||
end
|
||||
json.checkin_at @booking.checkin_at.strftime("%d-%m-%Y")
|
||||
json.checkin_by @booking.checkin_by
|
||||
json.table_name @booking.dining_facility.name
|
||||
@@ -12,7 +17,7 @@ if (@booking)
|
||||
end
|
||||
@total_amount = 0.00
|
||||
@total_tax = 0.00
|
||||
|
||||
|
||||
if @booking.booking_orders
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<div class="tab-pane active" id="queue" role="tabpanel"">
|
||||
<div class="row">
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6">
|
||||
@@ -115,7 +115,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<div class="tab-pane" id="customer" role="tabpanel">
|
||||
<h3>Sale Details</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
|
||||
@@ -42,5 +42,5 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @settings_order_queue_stations %>
|
||||
</div>
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
<td colspan="8">
|
||||
<%= form_tag transactions_sales_path, :method => :get do %>
|
||||
<div class="input-append form-group pull-right col-md-6">
|
||||
<!-- <input class="datepicker col-md-3 form-control" name="date" id="date" type="text" placeholder="Receipt date" style="margin-right: 10px"> -->
|
||||
<input class="datepicker col-md-3 form-control" name="date" id="date" type="text" placeholder="Receipt date" style="margin-right: 10px">
|
||||
|
||||
<input type="text" name="receipt_no" class="col-md-6 form-control" placeholder="Receipt No" style="margin-right: 10px">
|
||||
<input type="text" name="receipt_no" class="col-md-5 form-control" placeholder="Receipt No" style="margin-right: 10px">
|
||||
<button type="submit" class="btn btn-primary btn">Search</button>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -41,23 +41,28 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @sales.each do |sale| %>
|
||||
|
||||
<tr>
|
||||
<td><%= sale.sale_id %></td>
|
||||
<td><%= sale.receipt_no %></td>
|
||||
<td><%= sale.grand_total rescue '-' %></td>
|
||||
<td><%= sale.total_tax %></td>
|
||||
<td><%= sale.cashier_name rescue '-' %></td>
|
||||
<td> <%= sale.sale_status %> </td>
|
||||
<td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
|
||||
<td><%= link_to 'Show', transactions_sale_path(sale) %></td>
|
||||
</tr>
|
||||
<% if @sales != 0 %>
|
||||
<% @sales.each do |sale| %>
|
||||
<tr>
|
||||
<td><%= sale.sale_id %></td>
|
||||
<td><%= sale.receipt_no %></td>
|
||||
<td><%= sale.grand_total rescue '-' %></td>
|
||||
<td><%= sale.total_tax %></td>
|
||||
<td><%= sale.cashier_name rescue '-' %></td>
|
||||
<td> <%= sale.sale_status %> </td>
|
||||
<td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
|
||||
<td><%= link_to 'Show', transactions_sale_path(sale) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr><td colspan="8"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<%= paginate @sales %>
|
||||
<% if @sales != 0 %>
|
||||
<%= paginate @sales %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<a href="<%= transactions_sales_path %>">Sale</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="<%= transactions_sales_path %>"><%= @sale.sale_id %></a>
|
||||
<a href="<%= transactions_sale_path(@sale.sale_id) %>"><%= @sale.sale_id %></a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
@@ -21,11 +21,11 @@
|
||||
<a class="nav-link active" data-toggle="tab" href="#queue" role="tab">Sale Details </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#booking" role="tab">Orders </a>
|
||||
<a class="nav-link " data-toggle="tab" href="#booking" role="tab">Orders Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Customer Details</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Sales</a>
|
||||
</li> -->
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
@@ -124,6 +124,9 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="8"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Order ID</th>
|
||||
<th>Menu Item</th>
|
||||
@@ -154,11 +157,71 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<h3>Sale Details</h3>
|
||||
<div class="table-responsive">
|
||||
<div class="tab-pane" id="customer" role="tabpanel">
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%"><h4>Customer Details</h4></th>
|
||||
<th width="20%"></th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%"></th>
|
||||
<th width="20%">Name</th>
|
||||
<td><%= @customer.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%"></th>
|
||||
<th width="20%">Email</th>
|
||||
<td><%= @customer.email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%"></th>
|
||||
<th width="20%">Contact no</th>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%"></th>
|
||||
<th width="20%">Company</th>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%"></th>
|
||||
<th width="20%">Date Of Birth</th>
|
||||
<td><%= @customer.date_of_birth rescue '-' %> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%"><h4>Membership Details</h4></th>
|
||||
<td width="20%"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% if @membership == 0 %>
|
||||
<tr>
|
||||
<td colspan="2">"There is no membership data"</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% @membership.each do |member| %>
|
||||
<tr>
|
||||
<td width="20%"></td>
|
||||
<th width="20%"><%= member["accountable_type"] %></th>
|
||||
<td><%= member["balance"] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -171,11 +234,11 @@
|
||||
</a>
|
||||
|
||||
<!-- Temporary No Needs -->
|
||||
<!-- <a href="<%= transactions_void_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
||||
<a href="<%= transactions_void_path(@sale)%>" style="margin-top: 10px " class="btn btn-danger pull-right btn-lg">
|
||||
|
||||
<i class="fa fa-trash fa-lg"></i> Void Sale
|
||||
</a>
|
||||
<a href="<%= %>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
||||
<!-- <a href="<%= transactions_manual_complete_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-success pull-right btn-lg">
|
||||
<i class="fa fa-invoice fa-lg"></i> Complete Sale
|
||||
</a> -->
|
||||
</div>
|
||||
|
||||
@@ -60,19 +60,15 @@
|
||||
|
||||
var reason = $('input[type="radio"]:checked').val();
|
||||
console.log(reason)
|
||||
|
||||
var url = '<% transactions_manual_void_sale_path()%>';
|
||||
var sale_id = $(this).find(".customer-id").text();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'sales/manual_void_sale',
|
||||
url: 'manual_void_sale',
|
||||
data: {reason: reason, sale_id: sale_id},
|
||||
success: function(data){
|
||||
window.location.href = "transactions/sales"
|
||||
// window.location.href = "transactions/sales"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user