fixed for customer

This commit is contained in:
Yan
2017-06-22 15:01:13 +06:30
19 changed files with 205 additions and 143 deletions

View File

@@ -46,7 +46,7 @@ class Crm::CustomersController < BaseCrmController
end
#get customer amount
@customer = Customer.find(params[:id])
@customer = Customer.find(params[:id])
@response = Customer.get_membership_transactions(@customer)
#end customer amount
@@ -201,6 +201,6 @@ end
def customer_params
params.require(:customer).permit(:name, :company, :contact_no, :email,
:date_of_birth,:salution,:gender,:nrc_no,:address,:card_no)
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no)
end
end

View File

@@ -39,5 +39,29 @@ class Origami::CustomersController < BaseOrigamiController
end
end
def update_sale_by_customer
id = params[:sale_id][0,3]
if(id == "SAL")
sale = Sale.find(params[:sale_id])
status = sale.update_attributes(customer_id: params[:customer_id])
else
@booking = BookingOrder.find_by_order_id(params[:sale_id])
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
@orders.each do |bo|
order = Order.find(bo.order_id)
status = order.update_attributes(customer_id: params[:customer_id])
end
end
if status == true
render json: JSON.generate({:status => true})
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end
end
end

View File

@@ -4,6 +4,10 @@ class Reports::DailySaleController < BaseReportController
from, to ,report_type = get_date_range_from_params
@sale_data = Sale.daily_sales_list(from,to)
@tax = SaleTax.get_tax(from,to)
respond_to do |format|
format.html
format.xls
end
end
def show

View File

@@ -8,6 +8,10 @@ class Reports::ReceiptNoController < BaseReportController
puts to
@sale_data = Sale.get_receipt_no_list(from,to)
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
respond_to do |format|
format.html
format.xls
end
end
def show

View File

@@ -5,6 +5,11 @@ class Reports::SaleItemController < BaseReportController
from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
respond_to do |format|
format.html
format.xls
end
end
def show