merged crm

This commit is contained in:
Yan
2017-06-06 09:41:06 +06:30
22 changed files with 371 additions and 129 deletions

View File

@@ -4,7 +4,7 @@ class Crm::CustomersController < ApplicationController
# GET /crm/customers
# GET /crm/customers.json
def index
@crm_customers = Crm::Customer.all
@crm_customers = Customer.all
end
# GET /crm/customers/1
@@ -14,7 +14,7 @@ class Crm::CustomersController < ApplicationController
# GET /crm/customers/new
def new
@crm_customer = Crm::Customer.new
@crm_customer = Customer.new
end
# GET /crm/customers/1/edit
@@ -24,7 +24,7 @@ class Crm::CustomersController < ApplicationController
# POST /crm/customers
# POST /crm/customers.json
def create
@crm_customer = Crm::Customer.new(crm_customer_params)
@crm_customer = Customer.new(crm_customer_params)
respond_to do |format|
if @crm_customer.save
@@ -64,7 +64,7 @@ class Crm::CustomersController < ApplicationController
private
# Use callbacks to share common setup or constraints between actions.
def set_crm_customer
@crm_customer = Crm::Customer.find(params[:id])
@crm_customer = Customer.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.

View File

@@ -1,15 +1,24 @@
class Origami::HomeController < BaseOrigamiController
def index
@order_table = Order.get_order_table()
@order_rooms = Order.get_order_rooms()
@booking_orders = Order.get_booking_order_table()
@booking_rooms = Order.get_booking_order_rooms()
@orders = Order.get_orders()
end
def show
str = []
@order_details = OrderItem.get_order_items_details(params[:order_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end
render :json => str.to_json
if !params[:sale_id].nil?
@order_details = SaleItem.get_order_items_details(params[:sale_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end
render :json => str.to_json
else
@order_details = OrderItem.get_order_items_details(params[:order_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end
render :json => str.to_json
end
end
end

View File

@@ -2,21 +2,26 @@ class Origami::RequestBillsController < BaseOrigamiController
def show
@sale = Sale.new
check_order = Order.find_by_id(params[:id])
if check_order
@order_details = OrderItem.get_order_items_details(check_order.id)
@order_details = OrderItem.get_order_items_details(check_order.id)
@status, @sale_id = @sale.generate_invoice_from_order(check_order.id, nil,current_login_employee.name)
@sale_data = Sale.find_by_id(@sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_id)
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)
else
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
end
unique_code="ReceiptBillPdf"
print_settings=PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,@sale_items,@sale)
printer.print_receipt_bill(print_settings,@sale_items,@sale,@sale_data)
end
end