route conflit fix
This commit is contained in:
@@ -2,9 +2,31 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
@creditcount = @creditcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_credit = total - @creditcount - others
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "creditnote")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class Origami::CustomersController < BaseOrigamiController
|
||||
#Form to add customer -
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
|
||||
|
||||
end
|
||||
|
||||
# GET /crm/customers/1
|
||||
@@ -54,6 +52,10 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
sale.sale_orders.each do |sale_order|
|
||||
order = Order.find(sale_order.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
end
|
||||
else
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Origami::DiscountsController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
def index
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
class Origami::MoveroomController < BaseOrigamiController
|
||||
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
end
|
||||
|
||||
@@ -39,6 +39,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@visacount= 0.0
|
||||
@jcbcount= 0.0
|
||||
@mastercount = 0.0
|
||||
@credit = 0.0
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
#get customer amount
|
||||
@@ -75,6 +76,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@jcbcount += spay.payment_amount
|
||||
elsif spay.payment_method == "master"
|
||||
@mastercount += spay.payment_amount
|
||||
elsif spay.payment_method == "creditnote"
|
||||
@credit += spay.payment_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
# Print Request Bill and add to sale tables
|
||||
def print
|
||||
@sale = Sale.new
|
||||
|
||||
40
app/controllers/origami/room_invoices_controller.rb
Normal file
40
app/controllers/origami/room_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
class Origami::RoomInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
puts "room bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@sale = Sale.find(params[:invoice_id])
|
||||
@date = @sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@customer = @sale.customer
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,11 +1,13 @@
|
||||
class Origami::SaleEditController < BaseOrigamiController
|
||||
|
||||
# Index for sale item void OR edit
|
||||
def edit
|
||||
sale_id = params[:sale_id]
|
||||
@table_id = params[:table_id]
|
||||
@saleobj = Sale.find(sale_id)
|
||||
end
|
||||
|
||||
# create item void. make duplicate old record and update qty and price
|
||||
def item_void
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
@@ -19,4 +21,38 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||
@newsaleitem.save
|
||||
end
|
||||
|
||||
# make cancel void item
|
||||
def item_void_cancel
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
both = SaleItem.where('product_code=?',saleitemObj.product_code)
|
||||
both.each do |item|
|
||||
if item.qty.to_i > 0
|
||||
item.remark = nil
|
||||
item.save
|
||||
end
|
||||
end
|
||||
saleitemObj.destroy
|
||||
end
|
||||
|
||||
# remove all void items
|
||||
def cancel_all_void
|
||||
sale_id = params[:sale_id]
|
||||
saleobj = Sale.find(sale_id)
|
||||
saleobj.sale_items.each do |item|
|
||||
if item.qty.to_i < 0
|
||||
item.destroy
|
||||
else
|
||||
item.remark = nil
|
||||
end
|
||||
item.save
|
||||
end
|
||||
end
|
||||
|
||||
def apply_void
|
||||
sale_id = params[:sale_id]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
end
|
||||
|
||||
40
app/controllers/origami/table_invoices_controller.rb
Normal file
40
app/controllers/origami/table_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
class Origami::TableInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
puts "table bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@table.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@sale_array = Array.new
|
||||
@table.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@sale = Sale.find(params[:invoice_id])
|
||||
@date = @sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@customer = @sale.customer
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user