update void and complete sale
This commit is contained in:
@@ -15,6 +15,7 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
# GET /crm/dining_queues/new
|
# GET /crm/dining_queues/new
|
||||||
def new
|
def new
|
||||||
@dining_queue = DiningQueue.new
|
@dining_queue = DiningQueue.new
|
||||||
|
@queue_no = DiningQueue.generate_queue_no
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/dining_queues/1/edit
|
# GET /crm/dining_queues/1/edit
|
||||||
@@ -26,6 +27,8 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
def create
|
def create
|
||||||
@dining_queue = DiningQueue.new(dining_queue_params)
|
@dining_queue = DiningQueue.new(dining_queue_params)
|
||||||
|
|
||||||
|
puts "ffffffffffff"
|
||||||
|
puts @queue_no
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @dining_queue.save
|
if @dining_queue.save
|
||||||
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully created.' }
|
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully created.' }
|
||||||
|
|||||||
77
app/controllers/transactions/manual_sales_controller.rb
Normal file
77
app/controllers/transactions/manual_sales_controller.rb
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
class Transactions::ManualSalesController < ApplicationController
|
||||||
|
|
||||||
|
def void
|
||||||
|
@sale = params[:sale_id]
|
||||||
|
@reason = Lookup.where("lookup_type = 'void_reason'")
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.json { render json: @sales }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def manual_void_sale
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
reason = params[:reason]
|
||||||
|
sale = Sale.find(sale_id)
|
||||||
|
sale.sale_status = 'void'
|
||||||
|
sale.requested_by = current_login_employee.id
|
||||||
|
if sale.save
|
||||||
|
@sale = SaleAudit.record_audit_void(sale_id, current_login_employee.id, current_login_employee.id, reason)
|
||||||
|
|
||||||
|
if sale.sale_orders
|
||||||
|
|
||||||
|
sale.sale_orders.each do |bo|
|
||||||
|
order =Order.find(bo.order_id)
|
||||||
|
order.status= 'void'
|
||||||
|
order.save
|
||||||
|
booking_order = BookingOrder.find_by_order_id(bo.order_id)
|
||||||
|
|
||||||
|
if booking_order.booking_id
|
||||||
|
booking = Booking.find(booking_order.booking_id)
|
||||||
|
dining_facility = booking.dining_facility
|
||||||
|
dining_facility.status = 'available'
|
||||||
|
dining_facility.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
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 = "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)
|
||||||
|
|
||||||
|
if sale.sale_orders
|
||||||
|
|
||||||
|
sale.sale_orders.each do |bo|
|
||||||
|
# order =Order.find(bo.order_id)
|
||||||
|
# order.status= 'void'
|
||||||
|
# order.save
|
||||||
|
booking_order = BookingOrder.find_by_order_id(bo.order_id)
|
||||||
|
|
||||||
|
if booking_order.booking_id
|
||||||
|
booking = Booking.find(booking_order.booking_id)
|
||||||
|
dining_facility = booking.dining_facility
|
||||||
|
dining_facility.status = 'available'
|
||||||
|
dining_facility.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
redirect_to transactions_sales_path
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -117,38 +117,6 @@ class Transactions::SalesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def void
|
|
||||||
@sale = params[:sale_id]
|
|
||||||
@reason = Lookup.where("lookup_type = 'void_reason'")
|
|
||||||
end
|
|
||||||
|
|
||||||
def manual_void_sale
|
|
||||||
sale_id = params[:sale_id]
|
|
||||||
reason = params[:reason]
|
|
||||||
sale = Sale.find(sale_id)
|
|
||||||
sale.sale_status = 'void'
|
|
||||||
sale.requested_by = current_login_employee.id
|
|
||||||
if sale.save
|
|
||||||
@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
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_transactions_sale
|
def set_transactions_sale
|
||||||
|
|||||||
@@ -1,2 +1,7 @@
|
|||||||
class DiningQueue < ApplicationRecord
|
class DiningQueue < ApplicationRecord
|
||||||
|
|
||||||
|
def self.generate_queue_no
|
||||||
|
queue_no = DiningQueue.all.count + 1
|
||||||
|
return queue_no
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -160,67 +160,7 @@
|
|||||||
<div class="tab-pane" id="customer" role="tabpanel">
|
<div class="tab-pane" id="customer" role="tabpanel">
|
||||||
|
|
||||||
<div class="table-responsive">
|
<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>
|
</div>
|
||||||
|
|
||||||
@@ -238,9 +178,9 @@
|
|||||||
|
|
||||||
<i class="fa fa-trash fa-lg"></i> Void Sale
|
<i class="fa fa-trash fa-lg"></i> Void Sale
|
||||||
</a>
|
</a>
|
||||||
<!-- <a href="<%= transactions_manual_complete_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-success 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
|
<i class="fa fa-invoice fa-lg"></i> Complete Sale
|
||||||
</a> -->
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -199,9 +199,9 @@ Rails.application.routes.draw do
|
|||||||
resources :sales
|
resources :sales
|
||||||
resources :orders
|
resources :orders
|
||||||
|
|
||||||
get "/sales/:sale_id/manual_complete_sale" =>"sales#manual_complete_sale", :as => "manual_complete_sale"
|
get "/sales/:sale_id/manual_complete_sale" =>"manual_sales#manual_complete_sale", :as => "manual_complete_sale"
|
||||||
get "/sales/:sale_id/void" =>"sales#void", :as => "void"
|
get "/sales/:sale_id/void" =>"manual_sales#void", :as => "void"
|
||||||
post "sales/:sale_id/manual_void_sale", to: "sales#manual_void_sale", :as => "manual_void_sale"
|
post "sales/:sale_id/manual_void_sale", to: "manual_sales#manual_void_sale", :as => "manual_void_sale"
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Reports Controller Sections ------------#
|
#--------- Reports Controller Sections ------------#
|
||||||
|
|||||||
Reference in New Issue
Block a user