order quries update
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -12,7 +12,7 @@ gem 'rails', '~> 5.1.0'
|
|||||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
#Use PosgreSQL
|
#Use PosgreSQL
|
||||||
# gem 'pg'
|
gem 'pg'
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
# gem 'redis', '~> 3.0'
|
# gem 'redis', '~> 3.0'
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ GEM
|
|||||||
nokogiri (1.7.2)
|
nokogiri (1.7.2)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.1.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
|
pg (0.20.0)
|
||||||
prawn (2.2.2)
|
prawn (2.2.2)
|
||||||
pdf-core (~> 0.7.0)
|
pdf-core (~> 0.7.0)
|
||||||
ttfunk (~> 1.5)
|
ttfunk (~> 1.5)
|
||||||
@@ -246,6 +247,7 @@ DEPENDENCIES
|
|||||||
kaminari (~> 0.16.3)
|
kaminari (~> 0.16.3)
|
||||||
listen (~> 3.0.5)
|
listen (~> 3.0.5)
|
||||||
mysql2 (>= 0.3.18, < 0.5)
|
mysql2 (>= 0.3.18, < 0.5)
|
||||||
|
pg
|
||||||
prawn
|
prawn
|
||||||
prawn-table
|
prawn-table
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
|
|||||||
@@ -190,11 +190,17 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
function show_customer_details(customer_id){
|
function show_customer_details(customer_id){
|
||||||
|
|
||||||
|
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
|
||||||
|
var url = customer_id+"/get_customer/"
|
||||||
|
}else{
|
||||||
|
var url = "origami/"+customer_id+"/get_customer/"
|
||||||
|
}
|
||||||
|
|
||||||
$('.customer_detail').removeClass('hide');
|
$('.customer_detail').removeClass('hide');
|
||||||
//Start Ajax
|
//Start Ajax
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "origami/"+customer_id+"/get_customer/",
|
url: url,
|
||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
@@ -203,10 +209,10 @@ $(document).ready(function(){
|
|||||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||||
var balance = data["response_data"]["data"][i]["balance"];
|
var balance = data["response_data"]["data"][i]["balance"];
|
||||||
console.log(balance);
|
console.log(balance);
|
||||||
if (balance) {
|
if (balance == "0.0") {
|
||||||
$("#customer_amount").text(balance);
|
$("#customer_amount").text('0.0');
|
||||||
}else{
|
}else{
|
||||||
$("#customer_amount").text('00');
|
$("#customer_amount").text(balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,15 @@ class Api::BillController < Api::ApiController
|
|||||||
|
|
||||||
#create Bill by Booking ID
|
#create Bill by Booking ID
|
||||||
if (params[:booking_id])
|
if (params[:booking_id])
|
||||||
@sale = Sale.new
|
booking = Booking.find(params[:booking_id])
|
||||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
if booking
|
||||||
|
if booking.sale_id.nil?
|
||||||
|
@sale = Sale.new
|
||||||
|
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
||||||
|
else
|
||||||
|
@status = true
|
||||||
|
end
|
||||||
|
end
|
||||||
elsif (params[:order_id])
|
elsif (params[:order_id])
|
||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
name = customer_params[:name]
|
name = customer_params[:name]
|
||||||
phone = customer_params[:contact_no]
|
phone = customer_params[:contact_no]
|
||||||
email = customer_params[:email]
|
email = customer_params[:email]
|
||||||
date_of_birth = customer_params[:date_of_birth]
|
dob = customer_params[:date_of_birth]
|
||||||
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")
|
||||||
@@ -72,7 +72,9 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||||
date_of_birth: date_of_birth,
|
|
||||||
|
dob: dob,
|
||||||
|
|
||||||
member_group_id: member_group_id,merchant_uid:merchant_uid}.to_json,
|
member_group_id: member_group_id,merchant_uid:merchant_uid}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
@@ -123,8 +125,8 @@ end
|
|||||||
name = customer_params[:name]
|
name = customer_params[:name]
|
||||||
phone = customer_params[:contact_no]
|
phone = customer_params[:contact_no]
|
||||||
email = customer_params[:email]
|
email = customer_params[:email]
|
||||||
date_of_birth = customer_params[:date_of_birth]
|
dob = customer_params[:date_of_birth]
|
||||||
id = customer_params[:membership_id]
|
id = @crm_customer.membership_id
|
||||||
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")
|
||||||
@@ -133,7 +135,7 @@ end
|
|||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||||
date_of_birth: date_of_birth,
|
dob: dob,
|
||||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid}.to_json,
|
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
# if @membership["status"] == true
|
# if @membership["status"] == true
|
||||||
# @member_group = @membership["data"]
|
# @member_group = @membership["data"]
|
||||||
# end
|
# end
|
||||||
puts "Errrrrrrrrrrrrrrrrr"
|
# puts "Errrrrrrrrrrrrrrrrr"
|
||||||
puts @crm_customer.new_record?
|
# puts @crm_customer.valid?
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if spay.payment_method == "cash"
|
if spay.payment_method == "cash"
|
||||||
@cash = spay.payment_amount
|
@cash = spay.payment_amount
|
||||||
end
|
end
|
||||||
if spay.payment_method == "mpu"
|
if spay.payment_method == "mpu" || spay.payment_method == "paypar"
|
||||||
@other = spay.payment_amount
|
@other += spay.payment_amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -243,21 +243,9 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("sales.sale_status='completed'")
|
.where("sales.sale_status='completed'")
|
||||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
|
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view booking order Table
|
|
||||||
# def self.get_booking_order_table
|
|
||||||
# booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
|
||||||
# bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
|
||||||
# .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
|
||||||
# .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
|
||||||
# .joins("left join orders on orders.order_id = booking_orders.order_id")
|
|
||||||
# .joins("left join sales on sales.sale_id = bookings.sale_id")
|
|
||||||
# .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
|
||||||
# .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.customer_id,sales.customer_id,orders.order_id")
|
|
||||||
# end
|
|
||||||
|
|
||||||
#Origami: Cashier : to view order type Room
|
#Origami: Cashier : to view order type Room
|
||||||
def self.get_booking_order_rooms
|
def self.get_booking_order_rooms
|
||||||
booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
||||||
@@ -270,7 +258,7 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id")
|
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id")
|
||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view order type Room
|
#Origami: Cashier : to view order type Room
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class SalePayment < ApplicationRecord
|
|||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
self.sale.save!
|
self.sale.save!
|
||||||
table_update_status(sObj)
|
table_update_status(sObj)
|
||||||
rebat()
|
rebat(sObj)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -233,8 +233,24 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def rebat
|
def rebat(sObj)
|
||||||
|
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
||||||
|
generic_customer_id = sObj.customer.membership_id
|
||||||
|
total_amount = food_prices
|
||||||
|
receipt_no = sObj.receipt_no
|
||||||
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
|
memberaction = MembershipAction.find_by_membership_type("rebate")
|
||||||
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
|
app_token = membership.auth_token.to_s
|
||||||
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||||
|
receipt_no: receipt_no}.to_json,
|
||||||
|
:headers => {
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
})
|
||||||
|
|
||||||
|
puts response.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ member_actions= MembershipAction.create([{membership_type:"get_account_balance",
|
|||||||
])
|
])
|
||||||
|
|
||||||
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http//192.168.1.47:3006"})
|
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http//192.168.1.47:3006"})
|
||||||
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http//192.168.1.47:3006"})
|
|
||||||
payment_methods = PaymentMethodSetting.create({payment_method:"REDEEMREBATE",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
payment_methods = PaymentMethodSetting.create({payment_method:"REDEEMREBATE",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user