35 lines
949 B
Ruby
Executable File
35 lines
949 B
Ruby
Executable File
class Transactions::CreditNotesController < ApplicationController
|
|
|
|
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
|
before_action :check_user
|
|
|
|
# GET /transactions/sales
|
|
# GET /transactions/sales.json
|
|
def index
|
|
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
|
|
@customers = Customer.all
|
|
|
|
filter = params[:filter]
|
|
customer = params[:customer]
|
|
from = params[:from]
|
|
to = params[:to]
|
|
order_source = params[:order_source]
|
|
|
|
sale = Sale.search_credit_sales(customer,filter,from,to,order_source)
|
|
@credit_notes = Kaminari.paginate_array(sale).page(params[:page]).per(20)
|
|
|
|
respond_to do |format|
|
|
format.html # index.html.erb
|
|
format.json { render json: @credit_notes }
|
|
end
|
|
|
|
end
|
|
|
|
def check_user
|
|
if current_user.nil?
|
|
redirect_to root_path
|
|
end
|
|
end
|
|
|
|
end
|