Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -74,7 +74,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
@response = Customer.get_membership_transactions(@customer)
|
@response = Customer.get_membership_transactions(@customer)
|
||||||
|
|
||||||
Rails.logger.debug "get membership transactions response"
|
Rails.logger.debug "get membership transactions response"
|
||||||
Rails.logger.debug response.to_json
|
Rails.logger.debug @response.to_json
|
||||||
# @response = ""
|
# @response = ""
|
||||||
#end customer amount
|
#end customer amount
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,17 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
|||||||
MenuCategory.current_menu
|
MenuCategory.current_menu
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def get_menu_sub_category ()
|
||||||
|
id = params[:id]
|
||||||
|
if (id)
|
||||||
|
#Pull this menu
|
||||||
|
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
|
||||||
|
# puts @menu.menu_items[1].item_attributes.to_json
|
||||||
|
return @sub_menu
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def get_all_product()
|
def get_all_product()
|
||||||
@product = Product.all
|
@product = Product.all
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
# sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
# sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
||||||
# sale.save
|
# sale.save
|
||||||
if discount_items.length > 0
|
if discount_items.length > 0
|
||||||
puts discount_items.to_json
|
|
||||||
puts "dddddddddddd"
|
|
||||||
|
|
||||||
#save sale item for discount
|
#save sale item for discount
|
||||||
discount_items.each do |di|
|
discount_items.each do |di|
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
|
|
||||||
if MembershipSetting.find_by_rebate(1) && is_foc == 0
|
if MembershipSetting.find_by_rebate(1) && is_foc == 0 && is_credit == 0
|
||||||
response = rebat(sObj)
|
response = rebat(sObj)
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
@@ -414,6 +414,7 @@ class SalePayment < ApplicationRecord
|
|||||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||||
overall_dis = sObj.total_discount
|
overall_dis = sObj.total_discount
|
||||||
|
|
||||||
|
if credit != 1
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
|
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
|
||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
@@ -442,87 +443,89 @@ class SalePayment < ApplicationRecord
|
|||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
end
|
end
|
||||||
redeem_amount = payparcost + overall_dis
|
|
||||||
|
|
||||||
total_percentage = 0
|
redeem_amount = payparcost + overall_dis
|
||||||
|
|
||||||
type_arr = []
|
total_percentage = 0
|
||||||
Rails.logger.debug "Get Member Campaign"
|
|
||||||
Rails.logger.debug response.to_json
|
|
||||||
# Check for present response fields
|
|
||||||
if response["membership_campaign_data"].present?
|
|
||||||
response["membership_campaign_data"].each do |a|
|
|
||||||
data = {:type => a["rules_type"], :percentage => a["change_unit"].to_i * a["base_unit"].to_i}
|
|
||||||
total_percentage = total_percentage + a["change_unit"].to_i * a["base_unit"].to_i
|
|
||||||
|
|
||||||
type_arr.push(data)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
rebate_arr =[]
|
type_arr = []
|
||||||
campaign_method.each do |a|
|
Rails.logger.debug "Get Member Campaign"
|
||||||
data = {:type => a[:type], :amount => a[:amount]}
|
Rails.logger.debug response.to_json
|
||||||
type_arr.each do |si|
|
# Check for present response fields
|
||||||
if si[:type] == a[:type]
|
if response["membership_campaign_data"].present?
|
||||||
if credit == 1
|
response["membership_campaign_data"].each do |a|
|
||||||
data[:amount] = 0
|
data = {:type => a["rules_type"], :percentage => a["change_unit"].to_i * a["base_unit"].to_i}
|
||||||
else
|
total_percentage = total_percentage + a["change_unit"].to_i * a["base_unit"].to_i
|
||||||
amount = (redeem_amount / total_percentage)*si[:percentage]
|
|
||||||
actual = a[:amount] - amount
|
type_arr.push(data)
|
||||||
data[:amount] = actual
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rebate_arr.push(data)
|
|
||||||
end
|
|
||||||
|
|
||||||
total_amount = rebate_prices - payparcost - overall_dis
|
rebate_arr =[]
|
||||||
|
campaign_method.each do |a|
|
||||||
if credit == 1
|
data = {:type => a[:type], :amount => a[:amount]}
|
||||||
total_amount = 0
|
type_arr.each do |si|
|
||||||
end
|
if si[:type] == a[:type]
|
||||||
if total_amount >= 0
|
if credit == 1
|
||||||
receipt_no = sObj.receipt_no
|
data[:amount] = 0
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
else
|
||||||
memberaction = MembershipAction.find_by_membership_type("rebate")
|
amount = (redeem_amount / total_percentage)*si[:percentage]
|
||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
actual = a[:amount] - amount
|
||||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
data[:amount] = actual
|
||||||
auth_token = memberaction.auth_token.to_s
|
end
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
|
||||||
|
end
|
||||||
# Control for Paypar Cloud
|
end
|
||||||
begin
|
rebate_arr.push(data)
|
||||||
response = HTTParty.post(url,
|
end
|
||||||
:body => {
|
|
||||||
generic_customer_id:generic_customer_id ,
|
total_amount = rebate_prices - payparcost - overall_dis
|
||||||
total_sale_transaction_amount: sObj.grand_total,
|
|
||||||
merchant_uid:merchant_uid,
|
if credit == 1
|
||||||
total_amount: total_amount,
|
total_amount = 0
|
||||||
campaign_type_id: campaign_type_id,
|
end
|
||||||
receipt_no: receipt_no,
|
|
||||||
campaign_method: rebate_arr.to_json,
|
if total_amount >= 0
|
||||||
auth_token:auth_token
|
receipt_no = sObj.receipt_no
|
||||||
}.to_json,
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
:headers => {
|
memberaction = MembershipAction.find_by_membership_type("rebate")
|
||||||
'Content-Type' => 'application/json',
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
'Accept' => 'application/json; version=2'
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
}, :timeout => 10)
|
auth_token = memberaction.auth_token.to_s
|
||||||
rescue Net::OpenTimeout
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
response = { "status": false , "message": "Connect To" }
|
|
||||||
rescue OpenURI::HTTPError
|
# Control for Paypar Cloud
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
begin
|
||||||
|
response = HTTParty.post(url,
|
||||||
rescue SocketError
|
:body => {
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
generic_customer_id:generic_customer_id ,
|
||||||
|
total_sale_transaction_amount: sObj.grand_total,
|
||||||
|
merchant_uid:merchant_uid,
|
||||||
|
total_amount: total_amount,
|
||||||
|
campaign_type_id: campaign_type_id,
|
||||||
|
receipt_no: receipt_no,
|
||||||
|
campaign_method: rebate_arr.to_json,
|
||||||
|
auth_token:auth_token
|
||||||
|
}.to_json,
|
||||||
|
:headers => {
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json; version=2'
|
||||||
|
}, :timeout => 10)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { "status": false , "message": "Connect To" }
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
end
|
||||||
|
Rails.logger.debug "Rebage Response"
|
||||||
|
Rails.logger.debug response.to_json
|
||||||
|
return response
|
||||||
end
|
end
|
||||||
Rails.logger.debug "Rebage Response"
|
|
||||||
Rails.logger.debug response.to_json
|
|
||||||
return response
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
response = { "status": "no_member", "message": "Not membership"}
|
response = { "status": "no_member", "message": "Not membership"}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -294,6 +294,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
balance = 0
|
balance = 0
|
||||||
rebate_balance =0
|
rebate_balance =0
|
||||||
redeem = 0
|
redeem = 0
|
||||||
|
redeem_count = 0
|
||||||
rebate_amount["data"].each do |res|
|
rebate_amount["data"].each do |res|
|
||||||
total = total + res["balance"]
|
total = total + res["balance"]
|
||||||
#total redeem amount
|
#total redeem amount
|
||||||
@@ -318,7 +319,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
# Total Rebate Amount if birthday
|
# Total Rebate Amount if birthday
|
||||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate"
|
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
||||||
rebate_balance = rebate_balance + res["deposit"]
|
rebate_balance = rebate_balance + res["deposit"]
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -332,20 +333,22 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
#end Total rebate if birthday
|
#end Total rebate if birthday
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
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
|
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
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
|
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if redeem == 0
|
if redeem == 0
|
||||||
old = total - rebate_balance
|
old = total - rebate_balance
|
||||||
else
|
else
|
||||||
old = balance + redeem
|
# if redeem_count == 0
|
||||||
|
old = balance + redeem
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
if @sub_menu
|
||||||
|
json.sub_category @sub_menu.each do |sub_cat|
|
||||||
|
json.id sub_cat.id
|
||||||
|
json.code sub_cat.code
|
||||||
|
json.name sub_cat.name
|
||||||
|
json.menu_id sub_cat.menu_id
|
||||||
|
json.menu_category_id sub_cat.menu_category_id
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -189,6 +189,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post '/:id/create_survey' => "surveys#create", :as => "create_surveys"
|
post '/:id/create_survey' => "surveys#create", :as => "create_surveys"
|
||||||
|
|
||||||
get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
|
get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
|
||||||
|
get '/addorders/get_menu_sub_category/:id' => "addorders#get_menu_sub_category",:as => "get_menu_sub_category", :defaults => { :format => 'json' }
|
||||||
get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' }
|
get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' }
|
||||||
|
|
||||||
get '/:addorders/:id' => "addorders#detail"
|
get '/:addorders/:id' => "addorders#detail"
|
||||||
|
|||||||
Reference in New Issue
Block a user