This commit is contained in:
Myat Zin Wai Maw
2019-12-13 10:12:08 +06:30
parent 79598c0126
commit f45849de49
39 changed files with 123 additions and 1121 deletions

View File

@@ -9,7 +9,7 @@ class Transactions::BookingsController < ApplicationController
to = params[:to]
if filter.nil? && from.nil? && to.nil?
@bookings = Booking.order("sale_id desc")
@bookings = Booking.where("shop_code=?",@shop.shop_code).order("sale_id desc")
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20)
else
booking = Booking.search(filter,from,to)

View File

@@ -6,7 +6,7 @@ class Transactions::CreditNotesController < ApplicationController
# GET /transactions/sales
# GET /transactions/sales.json
def index
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
@customers = Customer.all
@@ -23,10 +23,10 @@ class Transactions::CreditNotesController < ApplicationController
.joins("JOIN sale_payments sp on sp.sale_id = sales.sale_id")
.where("(CASE WHEN (sales.grand_total + sales.amount_changed)=(select SUM(sale_payments.payment_amount)
FROM sale_payments WHERE sale_payments.sale_id=sales.sale_id AND sale_payments.payment_method!='creditnote')
THEN NULL ELSE payment_method='creditnote' END) and sales.shop_code='#{@shop.shop_code}'")
THEN NULL ELSE payment_method='creditnote' END)").shop
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
else
sale = Sale.search_credit_sales(customer,filter,from,to,order_source).where("sales.shop_code='#{@shop.shop_code}'")
sale = Sale.search_credit_sales(customer,filter,from,to,order_source).shop
if !sale.nil?
@credit_notes = sale
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)

View File

@@ -18,13 +18,13 @@ class Transactions::SalesController < ApplicationController
if receipt_no.nil? && from.nil? && to.nil?
if @shift.blank?
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new'").shop.order("sale_id desc")
else
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").shop.order("sale_id desc")
end
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
sale = Sale.search(receipt_no,from,to,@shift)
sale = Sale.search(receipt_no,from,to,@shift).shop
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
@@ -271,6 +271,10 @@ class Transactions::SalesController < ApplicationController
sale.sale_status = 'void'
sale.save
#call paymal to void
if !sale.sale_payments.nil?
membership_response =sale.paymal_payment_void
end
# No Need
# bookings = sale.bookings
# bookings.each do |booking|