finished customer and join membership in crm
This commit is contained in:
@@ -10,8 +10,6 @@ class Customer < ApplicationRecord
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
|
||||
# attr_accessor :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code
|
||||
|
||||
|
||||
def self.get_member_group
|
||||
|
||||
@@ -32,26 +30,6 @@ class Customer < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
|
||||
# http://192.168.1.47:3006/api/create_membership_customer
|
||||
#get_all_member_group
|
||||
|
||||
def self.generate(params)
|
||||
puts "Hello "
|
||||
puts params.to_json
|
||||
customer = Customer.new
|
||||
customer.name= params[:name]
|
||||
customer.company= params[:company]
|
||||
customer.contact_no= params[:contact_no]
|
||||
customer.email= params[:email]
|
||||
customer.date_of_birth= params[:date_of_birth]
|
||||
customer.membership_id= params[:membership_id]
|
||||
customer.membership_type= params[:membership_type]
|
||||
customer.membership_authentication_code= params[:membership_authentication_code]
|
||||
customer.save!
|
||||
return customer
|
||||
end
|
||||
|
||||
def lastest_invoices
|
||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
@@ -72,4 +72,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
self.print("tmp/receipt_bill.pdf")
|
||||
end
|
||||
|
||||
#Bill Receipt Print
|
||||
def print_crm_order(booking)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = CrmOrderPdf.new(booking)
|
||||
pdf.render_file "tmp/print_crm_order.pdf"
|
||||
self.print("tmp/print_crm_order.pdf")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user