For pull
This commit is contained in:
@@ -5,6 +5,13 @@ class Crm::CustomersController < ApplicationController
|
||||
# GET /crm/customers.json
|
||||
def index
|
||||
@crm_customers = Customer.all
|
||||
@customers = Customer.new
|
||||
@membership = Customer.get_member_group
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @crm_customers }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /crm/customers/1
|
||||
@@ -15,7 +22,8 @@ class Crm::CustomersController < ApplicationController
|
||||
# GET /crm/customers/new
|
||||
def new
|
||||
@crm_customer = Customer.new
|
||||
@membership = Customer.get_member_group
|
||||
@membership = Customer.get_member_group()
|
||||
|
||||
end
|
||||
|
||||
# GET /crm/customers/1/edit
|
||||
@@ -25,7 +33,7 @@ class Crm::CustomersController < ApplicationController
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers.json
|
||||
def create
|
||||
@crm_customer = Customer.new(crm_customer_params)
|
||||
@crm_customer = Customer.new(customer_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customer.save
|
||||
@@ -42,7 +50,7 @@ class Crm::CustomersController < ApplicationController
|
||||
# PATCH/PUT /crm/customers/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @crm_customer.update(crm_customer_params)
|
||||
if @crm_customer.update(customer_params)
|
||||
format.html { redirect_to @crm_customer, notice: 'Customer was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @crm_customer }
|
||||
else
|
||||
@@ -69,7 +77,7 @@ class Crm::CustomersController < ApplicationController
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def crm_customer_params
|
||||
params.require(:crm_customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
|
||||
def customer_params
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,16 +7,18 @@ class Origami::HomeController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
str = []
|
||||
type=params[:id].split('-')[0];
|
||||
|
||||
|
||||
if !params[:sale_id].nil?
|
||||
@order_details = SaleItem.get_order_items_details(params[:sale_id])
|
||||
# Sale
|
||||
if type == "SAL"
|
||||
@order_details = SaleItem.get_order_items_details(params[:id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
render :json => str.to_json
|
||||
# Booking
|
||||
else
|
||||
@order_details = OrderItem.get_order_items_details(params[:order_id])
|
||||
@order_details = OrderItem.get_order_items_details(params[:id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
def show
|
||||
def print
|
||||
@sale = Sale.new
|
||||
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
booking_id = params[:id]
|
||||
check_booking = Booking.find_by_booking_id(booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
#check if it doesn't exist
|
||||
@status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||
# Create Sale if it doesn't exist
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
end
|
||||
|
||||
unique_code="ReceiptBillPdf"
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer_name = Customer.select("name").where('customer_id=' + @sale_data.customer_id)
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale,@sale_data)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer_name)
|
||||
redirect_to origami_root_path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user