Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -18,4 +18,5 @@
|
||||
//= require cable
|
||||
//= require jquery-ui
|
||||
//= require bootstrap-datepicker
|
||||
//= require bootstrap/modal
|
||||
//= require bootstrap/modal
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require tether
|
||||
//= require bootstrap
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
|
||||
@@ -5,26 +5,33 @@ class Api::BillController < Api::ApiController
|
||||
def create
|
||||
@status = false
|
||||
@error_message = "Order ID or Booking ID is require to request for a bill."
|
||||
|
||||
if ShiftSale.current_shift
|
||||
#create Bill by Booking ID
|
||||
if (params[:booking_id])
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if (params[:booking_id])
|
||||
booking = Booking.find(params[:booking_id])
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
end
|
||||
|
||||
#@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
#@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
|
||||
# Not Use for these printed bill cannot give customer
|
||||
# @sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
# @sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
@@ -44,11 +51,12 @@ class Api::BillController < Api::ApiController
|
||||
# # Calculate Price by accounts
|
||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
||||
|
||||
#customer= Customer.find(@sale_data.customer_id)
|
||||
# get member information
|
||||
#member_info = Customer.get_member_account(customer)
|
||||
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,22 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
# get member information
|
||||
total = Customer.get_member_account(@customer)
|
||||
|
||||
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
if total["status"]==true
|
||||
total["data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@balance += res["balance"]
|
||||
# @accountable_type = res["accountable_type"]
|
||||
@accountable_type = "Rebate Balance"
|
||||
end
|
||||
end
|
||||
end
|
||||
# @response = ""
|
||||
#end customer amount
|
||||
|
||||
@@ -100,18 +115,22 @@ class Crm::CustomersController < BaseCrmController
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
:timeout => 100
|
||||
)
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Can't open embership server "}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
rescue Net::OpenTimeout
|
||||
|
||||
response = { status: false , message: "Can't open embership server "}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false, message: "Can't open embership server "}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't open embership server "}
|
||||
end
|
||||
if response["status"] == true
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
@@ -123,16 +142,17 @@ class Crm::CustomersController < BaseCrmController
|
||||
end
|
||||
# format.json { render :index, status: :created, location: @crm_customers }
|
||||
else
|
||||
# @crm_customers.destroy
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_type:member_group_id )
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response[:message]}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response[:message] }
|
||||
end
|
||||
end
|
||||
else
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. noted'}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
|
||||
end
|
||||
@@ -207,7 +227,12 @@ end
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
|
||||
|
||||
else
|
||||
|
||||
customer = Customer.find(@crm_customer.customer_id)
|
||||
status = customer.update_attributes(membership_type:member_group_id )
|
||||
|
||||
format.html { redirect_to crm_customers_path, notice: response["error"] }
|
||||
end
|
||||
|
||||
@@ -231,7 +256,7 @@ end
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
#@crm_customers = Customer.all
|
||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||
@crm_customer = Customer.new
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
|
||||
@@ -4,6 +4,8 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def show
|
||||
puts ">>>>>"
|
||||
puts current_user.id
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
|
||||
|
||||
@@ -74,10 +74,10 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_order_queue_station_params
|
||||
# <<<<<<< HEAD
|
||||
params.require(:order_queue_station).permit(:station_name, :is_active, :auto_print, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
|
||||
# params.require(:order_queue_station).permit(:station_name, :is_active, :auto_print, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
|
||||
# =======
|
||||
# Don't Know { zone_ids: [] }
|
||||
# params.require(:order_queue_station).permit(:station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by,{ zone_ids: [] })
|
||||
params.require(:order_queue_station).permit(:station_name, :is_active, :processing_items, :auto_print, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by,{ zone_ids: [] })
|
||||
# >>>>>>> b093a993ba002c92659bbb34338c55c031c11d87
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,16 +27,19 @@ class Customer < ApplicationRecord
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
:timeout => 100
|
||||
)
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Server Error"}
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
response = { status: false , message: "Server Time out"}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
end
|
||||
|
||||
return response;
|
||||
@@ -60,19 +63,61 @@ class Customer < ApplicationRecord
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
response = { status: false , message: "Server Time out"}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
end
|
||||
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
def self.update_membership
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
|
||||
|
||||
@customers.each do |customer|
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body =>
|
||||
{ name: customer.name,phone: customer.contact_no,
|
||||
email: customer.email,dob: customer.date_of_birth,
|
||||
address: customer.address,nrc:customer.nrc_no,
|
||||
card_no:customer.card_no,member_group_id: customer.membership_type,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
})
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
puts response.to_json
|
||||
|
||||
if response["status"] == true
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
|
||||
@@ -55,7 +55,7 @@ class SalePayment < ApplicationRecord
|
||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||
|
||||
# update complete order items in oqs
|
||||
SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr|
|
||||
SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr|
|
||||
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||
aoi.delivery_status = 1
|
||||
aoi.save
|
||||
@@ -287,7 +287,7 @@ class SalePayment < ApplicationRecord
|
||||
bookings = table.bookings
|
||||
bookings.each do |tablebooking|
|
||||
if tablebooking.booking_status != 'moved'
|
||||
if tablebooking.sale.sale_status != 'completed'
|
||||
if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void'
|
||||
status = false
|
||||
end
|
||||
end
|
||||
@@ -306,16 +306,22 @@ class SalePayment < ApplicationRecord
|
||||
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
||||
paypar = sObj.sale_payments
|
||||
payparcost = 0
|
||||
credit = 0
|
||||
paypar.each do |pp|
|
||||
if pp.payment_method == "paypar"
|
||||
payparcost = payparcost + pp.payment_amount
|
||||
elsif pp.payment_method == "creditnote"
|
||||
credit = 1
|
||||
end
|
||||
end
|
||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||
overall_dis = sObj.total_discount
|
||||
|
||||
total_amount = rebate_prices - payparcost + overall_dis
|
||||
if total_amount > 0
|
||||
total_amount = rebate_prices - payparcost - overall_dis
|
||||
if credit == 1
|
||||
total_amount = 0
|
||||
end
|
||||
if total_amount >= 0
|
||||
receipt_no = sObj.receipt_no
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("rebate")
|
||||
@@ -331,15 +337,15 @@ class SalePayment < ApplicationRecord
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}, :timeout => 10)
|
||||
}, :timeout => 100)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
response = { status: false , message: "Server Time out"}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
end
|
||||
return response
|
||||
# puts response.to_json
|
||||
|
||||
@@ -16,11 +16,17 @@ class ShiftSale < ApplicationRecord
|
||||
belongs_to :cashier_terminal
|
||||
belongs_to :employee, :foreign_key => 'employee_id'
|
||||
|
||||
def self.current_shift
|
||||
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null",today_date).take
|
||||
return shift
|
||||
end
|
||||
|
||||
def self.current_open_shift(current_user)
|
||||
#if current_user
|
||||
#find open shift where is open today and is not closed and login by current cashier
|
||||
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
||||
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take
|
||||
return shift
|
||||
#end
|
||||
end
|
||||
|
||||
@@ -168,7 +168,10 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
move_down 5
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -233,9 +233,16 @@ class ReceiptBillPdf < Prawn::Document
|
||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
if payment.payment_method == "paypar"
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Redeem Payment", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
else
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -263,34 +270,56 @@ class ReceiptBillPdf < Prawn::Document
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
rebate = 0
|
||||
redeem = 0
|
||||
rebate_amount["data"].each do |res|
|
||||
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Rebate"
|
||||
|
||||
rebate = rebate + res["rebate"]
|
||||
|
||||
end
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Current Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["redeem"], :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
redeem = redeem + res["redeem"]
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate"
|
||||
|
||||
rebate = rebate + res["rebate"]
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["balance"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate"
|
||||
|
||||
rebate = rebate + res["rebate"]
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["balance"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Current Rebate Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(rebate, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
if member_info["status"] == true && member_info["data"].present?
|
||||
@@ -306,7 +335,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Current Balance", :size => self.item_font_size,:align => :left
|
||||
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
@@ -364,10 +393,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{printed_status}", :size => self.header_font_size,:align => :left
|
||||
text "#{printed_status}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Thank You! See you Again", :left_margin => -10, :size => self.header_font_size,:align => :right
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
@@ -47,11 +47,15 @@
|
||||
<tbody>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<% if crm_customer.customer_id != "CUS-00001" && crm_customer.customer_id != "CUS-000000000" %>
|
||||
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||
<td><%= @i += 1 %></td>
|
||||
<td>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<%= @i += 1 %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
@@ -59,7 +63,7 @@
|
||||
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<th>NRC/Passport No</th>
|
||||
<th>Address</th>
|
||||
<th>DOB</th>
|
||||
<th>Membership Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -45,8 +46,16 @@
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
<% if @customer.membership_type.to_f > 0%>
|
||||
<td><%lookup= Lookup.find_by_value(@customer.membership_type) %>
|
||||
<%= lookup.name %>
|
||||
</td>
|
||||
<%else%>
|
||||
<td>-</td>
|
||||
<%end%>
|
||||
|
||||
</tr>
|
||||
<tr><th colspan="8"></th></tr>
|
||||
<tr><th colspan="9"></th></tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -55,21 +64,19 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<%
|
||||
if @response["data"].present? %>
|
||||
|
||||
<tr>
|
||||
<th colspan="5">Membership Transactions</th>
|
||||
<% if @response["status"] == true %>
|
||||
<th>Current Balance : <%= @response["data"].last["balance"]%></th>
|
||||
<% end %>
|
||||
|
||||
<th>Current Balance : <%= @balance%></th>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Redeem</th>
|
||||
<th>Rebate</th>
|
||||
<th>Balance</th>
|
||||
<!-- <th>Account No</th> -->
|
||||
<th>From Account</th>
|
||||
<th>Status</th>
|
||||
<th>Receipt No</th>
|
||||
</tr>
|
||||
@@ -82,7 +89,7 @@
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<!-- <td><%= transaction["account_no"] %></td> -->
|
||||
<td><%= transaction["account_status"] %></td>
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
|
||||
|
||||
@@ -41,11 +41,15 @@
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<% if crm_customer.customer_id != "CUS-00000" && crm_customer.customer_id != "CUS-00000000" %>
|
||||
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||
<td><%= @i += 1 %></td>
|
||||
<td>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<%= @i += 1 %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company rescue '-' %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
@@ -53,7 +57,6 @@
|
||||
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%else%>
|
||||
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
||||
@@ -155,10 +158,10 @@
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group">
|
||||
<div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
|
||||
@@ -163,18 +163,18 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
|
||||
count = 0
|
||||
sub_total = 0
|
||||
if @status_sale == "sale"
|
||||
@sale_array[0].sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
count += 1
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
@@ -439,7 +439,7 @@ $("#first_bill").on('click', function(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success:function(result){
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
@@ -452,11 +452,11 @@ $('#pay').on('click',function() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/origami/sale/'+ sale_id + "/rounding_adj",
|
||||
success:function(result){
|
||||
success:function(result){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
|
||||
@@ -334,6 +334,7 @@ $( document ).ready(function() {
|
||||
});
|
||||
|
||||
$('#pay').click(function() {
|
||||
$('#pay').text("Processing, Please wait!")
|
||||
if($('#balance').text() > 0){
|
||||
alert(" Insufficient Amount!")
|
||||
}else{
|
||||
@@ -351,6 +352,7 @@ $( document ).ready(function() {
|
||||
if($('#balance').text() < 0){
|
||||
alert("Changed amount " + $('#balance').text() * (-1) )
|
||||
}else{
|
||||
$('#pay').text("Pay")
|
||||
alert("Thank you")
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<script>
|
||||
$('#close_cashier').on('click',function(){
|
||||
var amount = $('#closing_balance_amount').val();
|
||||
var shift_id = "<%= @shift.id %>"
|
||||
var shift_id = "<%= @shift.id rescue ""%>"
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_close_shift_path %>",
|
||||
data: "closing_balance="+ amount + "&shift_id="+ shift_id,
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Customer Details</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#sale_audit" role="tab">Sale Audits</a>
|
||||
</li> -->
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
@@ -235,23 +238,31 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="sale_audit" role="tabpanel">
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>Action At</th>
|
||||
<th>Approved By</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary btn-lg">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
|
||||
|
||||
<a href="<%= transactions_void_path(@sale)%>" style="margin-top: 10px " class="btn btn-danger btn-lg">
|
||||
<i class="fa fa-trash fa-lg"></i> Void Sale
|
||||
</a>
|
||||
<a href="<%= transactions_manual_complete_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-success btn-lg">
|
||||
<i class="fa fa-invoice fa-lg"></i> Complete Sale
|
||||
</a>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user