finished customer form and update
This commit is contained in:
@@ -23,3 +23,6 @@
|
|||||||
.assign .text-muted{
|
.assign .text-muted{
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
}
|
}
|
||||||
|
.required abbr{
|
||||||
|
color: red !important;
|
||||||
|
}
|
||||||
@@ -7,23 +7,19 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
filter = params[:filter]
|
filter = params[:filter]
|
||||||
|
|
||||||
if filter.nil?
|
if filter.nil?
|
||||||
@crm_customers = Customer.order("customer_id").page(params[:page])
|
@crm_customers = Customer.all
|
||||||
#@products = Product.order("name").page(params[:page]).per(5)
|
|
||||||
else
|
else
|
||||||
@crm_customers = Customer.search(filter)
|
@crm_customers = Customer.search(filter)
|
||||||
|
|
||||||
end
|
end
|
||||||
#@crm_customers = Customer.all
|
#@crm_customers = Customer.all
|
||||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
|
@count_customer = Customer.count_customer
|
||||||
|
|
||||||
# if flash["errors"]
|
# if flash["errors"]
|
||||||
# @crm_customer.valid?
|
# @crm_customer.valid?
|
||||||
# end
|
# end
|
||||||
# @membership = Customer.get_member_group
|
|
||||||
# if @membership["status"] == true
|
|
||||||
# @member_group = @membership["data"]
|
|
||||||
# end
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.json { render json: @crm_customers }
|
format.json { render json: @crm_customers }
|
||||||
@@ -50,14 +46,14 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
end
|
end
|
||||||
|
|
||||||
#get customer amount
|
#get customer amount
|
||||||
@customer = Customer.find(params[:id])
|
# @customer = Customer.find(params[:id])
|
||||||
response = Customer.get_member_account(@customer)
|
# response = Customer.get_member_account(@customer)
|
||||||
|
|
||||||
if(response["status"] == true)
|
# if(response["status"] == true)
|
||||||
@membership = response["data"]
|
# @membership = response["data"]
|
||||||
else
|
# else
|
||||||
@membership = 0
|
@membership = 0
|
||||||
end
|
# end
|
||||||
|
|
||||||
#end customer amount
|
#end customer amount
|
||||||
|
|
||||||
@@ -87,6 +83,8 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
phone = customer_params[:contact_no]
|
phone = customer_params[:contact_no]
|
||||||
email = customer_params[:email]
|
email = customer_params[:email]
|
||||||
dob = customer_params[:date_of_birth]
|
dob = customer_params[:date_of_birth]
|
||||||
|
address = customer_params[:address]
|
||||||
|
nrc = customer_params[:nrc_no]
|
||||||
member_group_id = params[:member_group_id]
|
member_group_id = params[:member_group_id]
|
||||||
|
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
@@ -97,7 +95,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||||
dob: dob,
|
dob: dob,address: address,nrc:nrc,
|
||||||
member_group_id: member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
member_group_id: member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
@@ -155,6 +153,8 @@ end
|
|||||||
phone = customer_params[:contact_no]
|
phone = customer_params[:contact_no]
|
||||||
email = customer_params[:email]
|
email = customer_params[:email]
|
||||||
dob = customer_params[:date_of_birth]
|
dob = customer_params[:date_of_birth]
|
||||||
|
address = customer_params[:address]
|
||||||
|
nrc = customer_params[:nrc_no]
|
||||||
id = @crm_customer.membership_id
|
id = @crm_customer.membership_id
|
||||||
member_group_id = params[:member_group_id]
|
member_group_id = params[:member_group_id]
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ end
|
|||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||||
dob: dob,
|
dob: dob,address: address,nrc:nrc,
|
||||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
@@ -207,6 +207,7 @@ end
|
|||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def customer_params
|
def customer_params
|
||||||
|
|
||||||
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth)
|
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||||
|
:date_of_birth,:salution,:gender,:nrc_no,:address,:card_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
rebate_amount = sale_payment.process_payment(saleObj, @user, cash, "cash")
|
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||||
|
|
||||||
puts "resssssssssssssssssss"
|
rebate_amount = nil
|
||||||
puts rebate_amount.to_json
|
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|||||||
@@ -45,43 +45,19 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# require "net/http"
|
|
||||||
# def self.url_exist?(url_string)
|
|
||||||
# url = URI.parse(url_string)
|
|
||||||
|
|
||||||
|
|
||||||
# req = Net::HTTP.new(url.host, url.port)
|
|
||||||
# puts "hhhhhhhhhhhh"
|
|
||||||
# puts req.to_json
|
|
||||||
# req.use_ssl = (url.scheme == 'https')
|
|
||||||
# puts "aaaaaaaaaaaa"
|
|
||||||
# puts req.use_ssl?
|
|
||||||
# path = url.path if url.path.present?
|
|
||||||
# puts "bbbbbbbbbbbbb"
|
|
||||||
# puts path
|
|
||||||
# res = req.request_head(path || '/')
|
|
||||||
# puts "cccccccccccccc"
|
|
||||||
# puts res.to_json
|
|
||||||
# puts "ddddddddd"
|
|
||||||
# puts res.kind_of?(Net::HTTPRedirection)
|
|
||||||
# if res.kind_of?(Net::HTTPRedirection)
|
|
||||||
# url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL
|
|
||||||
# else
|
|
||||||
# ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families
|
|
||||||
# end
|
|
||||||
# rescue Errno::ENOENT
|
|
||||||
# false #false if can't find the server
|
|
||||||
# end
|
|
||||||
|
|
||||||
|
|
||||||
# def self.search(search)
|
|
||||||
# where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
|
|
||||||
# end
|
|
||||||
|
|
||||||
def lastest_invoices
|
def lastest_invoices
|
||||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.count_customer
|
||||||
|
all = self.all.count+1
|
||||||
|
count = all-2
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
WALKIN = "CUS-000000000001"
|
||||||
|
TAKEAWAY = "CUS-000000000002"
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.customer_id = SeedGenerator.generate_id(self.class.name, "CUS")
|
self.customer_id = SeedGenerator.generate_id(self.class.name, "CUS")
|
||||||
|
|||||||
@@ -54,10 +54,8 @@ class SalePayment < ApplicationRecord
|
|||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
||||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||||
sObj = Sale.find(self.sale_id)
|
|
||||||
|
|
||||||
response = rebat(sObj)
|
return true, self.save
|
||||||
return true, response
|
|
||||||
else
|
else
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
json.array! @customers, :id, :name, :company, :contact_no, :email, :membership_id, :membership_type
|
json.array! @customers, :id, :name, :company, :contact_no,:salution,
|
||||||
|
:gender,:nrc_no,:address,:card_no, :membership_type,
|
||||||
|
:membership_id, :created_at
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
json.extract! @customer, :id, :name, :company, :contact_no, :membership_type, :membership_id, :created_at
|
json.extract! @customer, :id, :name, :company, :contact_no,:salution,
|
||||||
|
:gender,:nrc_no,:address,:card_no, :membership_type,
|
||||||
|
:membership_id, :created_at
|
||||||
json.invoices do
|
json.invoices do
|
||||||
json.array! @customer.lastest_invoices ,:id, :receipt_no, :receipt_date, :sale_status, :payment_status
|
json.array! @customer.lastest_invoices ,:id, :receipt_no, :receipt_date, :sale_status, :payment_status
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Select</th>
|
<th>Select</th>
|
||||||
|
<th>Sr.no</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Company</th>
|
<th>Company</th>
|
||||||
<th>Contact no</th>
|
<th>Contact no</th>
|
||||||
@@ -43,11 +44,13 @@
|
|||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<% if @crm_customers.count > 0 %>
|
<% if @crm_customers.count > 0 %>
|
||||||
|
<% @i = 0 %>
|
||||||
<% @crm_customers.each do |crm_customer| %>
|
<% @crm_customers.each do |crm_customer| %>
|
||||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||||
|
<td><%= @i += 1 %></td>
|
||||||
<td><%= crm_customer.name %></td>
|
<td><%= crm_customer.name %></td>
|
||||||
<td><%= crm_customer.company rescue '-' %></td>
|
<td><%= crm_customer.company rescue '-' %></td>
|
||||||
<td><%= crm_customer.contact_no %></td>
|
<td><%= crm_customer.contact_no %></td>
|
||||||
@@ -76,31 +79,88 @@
|
|||||||
<span class="patch_method"></span>
|
<span class="patch_method"></span>
|
||||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||||
|
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
|
||||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
|
||||||
<% flash.each do |name, msg| %>
|
|
||||||
<span class="help-block"><%= msg['name'] %></span>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
<label>Salutation :</label><br>
|
||||||
</div>
|
<label>
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
|
||||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
</label>
|
||||||
<% flash.each do |name, msg| %>
|
<label>
|
||||||
<span class="help-block"><%= msg['contact_no'] %></span>
|
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
|
||||||
<% end -%>
|
</label>
|
||||||
</div>
|
<label>
|
||||||
|
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||||
|
|
||||||
<% flash.each do |name, msg| %>
|
<% flash.each do |name, msg| %>
|
||||||
<span class="help-block"><%= msg['email'] %></span>
|
<% str="[\"#{msg['name']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Gender :</label><br>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||||
|
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<% str="[\"#{msg['company']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
|
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||||
|
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<% str="[\"#{msg['contact_no']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
|
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||||
|
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<% str="[\"#{msg['contact_no']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Sr.No</label>
|
||||||
|
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Date Of Birth</label>
|
<label>Date Of Birth</label>
|
||||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||||
@@ -137,12 +197,12 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.datepicker').datepicker({
|
$('.datepicker').datepicker({
|
||||||
format : 'dd-mm-yyyy',
|
format : 'dd-mm-yyyy',
|
||||||
autoclose: true
|
autoclose: true
|
||||||
});
|
});
|
||||||
$('.datepicker').attr('ReadOnly','true');
|
$('.datepicker').attr('ReadOnly','true');
|
||||||
$('.datepicker').css('cursor','pointer');
|
$('.datepicker').css('cursor','pointer');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click',".customer_tr",function(){
|
$(document).on('click',".customer_tr",function(){
|
||||||
@@ -171,8 +231,27 @@ $(function() {
|
|||||||
$('#customer_company').val(data.company);
|
$('#customer_company').val(data.company);
|
||||||
$('#customer_contact_no').val(data.contact_no);
|
$('#customer_contact_no').val(data.contact_no);
|
||||||
$('#customer_email').val(data.email);
|
$('#customer_email').val(data.email);
|
||||||
|
$('#customer_salution').val(data.salution);
|
||||||
|
$('#customer_nrc_no').val(data.nrc_no);
|
||||||
|
$('#customer_address').val(data.address);
|
||||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||||
$('#customer_membership_type').val(data.membership_type);
|
$('#customer_membership_type').val(data.membership_type);
|
||||||
|
|
||||||
|
if (data.gender == 'Male') {
|
||||||
|
$('.male').prop( "checked", true )
|
||||||
|
}else{
|
||||||
|
$('.female').prop( "checked", true )
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.salution == 'Mr') {
|
||||||
|
$('.mr').prop( "checked", true )
|
||||||
|
}else if(data.salution == 'Miss') {
|
||||||
|
$('.miss').prop( "checked", true )
|
||||||
|
}else if(data.salution == 'Mrs'){
|
||||||
|
$('.mrs').prop( "checked", true )
|
||||||
|
}else{
|
||||||
|
$('.mdm').prop( "checked", true )
|
||||||
|
}
|
||||||
// $('.selectpicker > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
// $('.selectpicker > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at
|
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||||
|
:membership_id, :membership_type, :membership_authentication_code,
|
||||||
|
:created_at, :updated_at,
|
||||||
|
:salution, :gender,:nrc_no,:address,:card_no
|
||||||
json.url crm_customer_url(@crm_customer, format: :json)
|
json.url crm_customer_url(@crm_customer, format: :json)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Select</th>
|
<th>Select</th>
|
||||||
|
<th>Sr.no</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Company</th>
|
<th>Company</th>
|
||||||
<th>Contact no</th>
|
<th>Contact no</th>
|
||||||
@@ -44,11 +45,13 @@
|
|||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<% if @crm_customers.count > 0 %>
|
<% if @crm_customers.count > 0 %>
|
||||||
|
<% @i = 0 %>
|
||||||
<% @crm_customers.each do |crm_customer| %>
|
<% @crm_customers.each do |crm_customer| %>
|
||||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||||
|
<td><%= @i += 1 %></td>
|
||||||
<td><%= crm_customer.name %></td>
|
<td><%= crm_customer.name %></td>
|
||||||
<td><%= crm_customer.company rescue '-' %></td>
|
<td><%= crm_customer.company rescue '-' %></td>
|
||||||
<td><%= crm_customer.contact_no %></td>
|
<td><%= crm_customer.contact_no %></td>
|
||||||
@@ -79,31 +82,86 @@
|
|||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||||
|
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
<div class="form-group">
|
||||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
<label>Salutation :</label><br>
|
||||||
<% flash.each do |name, msg| %>
|
<label>
|
||||||
<span class="help-block"><%= msg['name'] %></span>
|
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
|
||||||
<% end -%>
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
|
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||||
|
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<% str="[\"#{msg['name']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Gender :</label><br>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||||
|
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<% str="[\"#{msg['company']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||||
|
|
||||||
<% flash.each do |name, msg| %>
|
<% flash.each do |name, msg| %>
|
||||||
<span class="help-block"><%= msg['contact_no'] %></span>
|
<% str="[\"#{msg['contact_no']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||||
|
|
||||||
<% flash.each do |name, msg| %>
|
<% flash.each do |name, msg| %>
|
||||||
<span class="help-block"><%= msg['email'] %></span>
|
<% str="[\"#{msg['contact_no']}\"]"
|
||||||
|
str.gsub!('["', '')
|
||||||
|
str.gsub!('"]', '') %>
|
||||||
|
<span class="help-block"><%= str %></span>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Sr.No</label>
|
||||||
|
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Date Of Birth</label>
|
<label>Date Of Birth</label>
|
||||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||||
@@ -176,6 +234,25 @@
|
|||||||
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||||
|
|
||||||
|
$('#customer_salution').val(data.salution);
|
||||||
|
$('#customer_nrc_no').val(data.nrc_no);
|
||||||
|
|
||||||
|
if (data.gender == 'Male') {
|
||||||
|
$('.male').prop( "checked", true )
|
||||||
|
}else{
|
||||||
|
$('.female').prop( "checked", true )
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.salution == 'Mr') {
|
||||||
|
$('.mr').prop( "checked", true )
|
||||||
|
} else if(data.salution == 'Miss') {
|
||||||
|
$('.miss').prop( "checked", true )
|
||||||
|
}else if(data.salution == 'Mrs'){
|
||||||
|
$('.mrs').prop( "checked", true )
|
||||||
|
}else{
|
||||||
|
$('.mdm').prop( "checked", true )
|
||||||
|
}
|
||||||
|
|
||||||
$('#update_customer').removeAttr('disabled').val('');
|
$('#update_customer').removeAttr('disabled').val('');
|
||||||
$('#update_customer').attr('value', 'Update');
|
$('#update_customer').attr('value', 'Update');
|
||||||
$('#submit_customer').attr('disabled','disabled');
|
$('#submit_customer').attr('disabled','disabled');
|
||||||
|
|||||||
@@ -30,7 +30,9 @@
|
|||||||
<th style='text-align:center;'>Gross Sales</th>
|
<th style='text-align:center;'>Gross Sales</th>
|
||||||
<th style='text-align:center;'>Discount</th>
|
<th style='text-align:center;'>Discount</th>
|
||||||
<th style='text-align:center;'>Total Sales</th>
|
<th style='text-align:center;'>Total Sales</th>
|
||||||
<th style='text-align:center;'>CT</th>
|
<% TaxProfile.all.each do |r|%>
|
||||||
|
<th style='text-align:center;'><%=r.name%></th>
|
||||||
|
<% end %>
|
||||||
<th style='text-align:center;'>Nett Sales</th>
|
<th style='text-align:center;'>Nett Sales</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -48,7 +50,10 @@
|
|||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %></td>
|
<% sale.sale_taxes.each do |sale|%>
|
||||||
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
<td><%= @sale.receipt_no %></td>
|
<td><%= @sale.receipt_no %></td>
|
||||||
<td><%= @sale.cashier_name rescue '-' %></td>
|
<td><%= @sale.cashier_name rescue '-' %></td>
|
||||||
<td> <%= @sale.sale_status %> </td>
|
<td> <%= @sale.sale_status %> </td>
|
||||||
<td> <%= @sale.requested_at %> </td>
|
<td> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="border-top:2px solid #000">
|
<tr style="border-top:2px solid #000">
|
||||||
<th>Sale item name</th>
|
<th>Sale item name</th>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class CreateCustomers < ActiveRecord::Migration[5.1]
|
|
||||||
|
class CreateCustomers < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :customers, :id => false do |t|
|
create_table :customers, :id => false do |t|
|
||||||
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||||
@@ -10,6 +11,11 @@ class CreateCustomers < ActiveRecord::Migration[5.1]
|
|||||||
t.string :membership_id
|
t.string :membership_id
|
||||||
t.string :membership_type
|
t.string :membership_type
|
||||||
t.string :membership_authentication_code
|
t.string :membership_authentication_code
|
||||||
|
t.string :salution
|
||||||
|
t.string :gender
|
||||||
|
t.string :nrc_no
|
||||||
|
t.string :address
|
||||||
|
t.string :card_no
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user