Merge branch 'r-1902001-01' of gitlab.com:code2lab/SXRestaurant into r-1902001-01
This commit is contained in:
@@ -18,13 +18,13 @@ class Customer < ApplicationRecord
|
|||||||
paginates_per 50
|
paginates_per 50
|
||||||
|
|
||||||
def self.get_member_account(customer)
|
def self.get_member_account(customer)
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.active.find_by_membership_type("paypar_url")
|
||||||
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
|
memberaction = MembershipAction.active.find_by_membership_type("get_all_member_account")
|
||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
# urltest =self.url_exist?(url)
|
# urltest =self.url_exist?(url)
|
||||||
|
if !membership.nil? && !memberaction.nil?
|
||||||
begin
|
begin
|
||||||
response = HTTParty.get(url, :body => {
|
response = HTTParty.get(url, :body => {
|
||||||
membership_id: customer.membership_id,
|
membership_id: customer.membership_id,
|
||||||
@@ -49,6 +49,9 @@ class Customer < ApplicationRecord
|
|||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { status: false, message: "Can't connect server"}
|
response = { status: false, message: "Can't connect server"}
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
response = {status: false, message: "There is no membership setting."}
|
||||||
|
end
|
||||||
Rails.logger.debug "--------Get Member Account response -------"
|
Rails.logger.debug "--------Get Member Account response -------"
|
||||||
Rails.logger.debug response.to_json
|
Rails.logger.debug response.to_json
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -180,10 +180,10 @@ class SaleItem < ApplicationRecord
|
|||||||
def self.get_all_sale_items(sale_id)
|
def self.get_all_sale_items(sale_id)
|
||||||
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
||||||
product_name,product_alt_name,account_id,status,remark,
|
product_name,product_alt_name,account_id,status,remark,
|
||||||
(CASE WHEN (qty > 0 AND remark IS NULL) OR (qty < 0 AND status = 'foc') OR (qty < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(qty) ELSE qty END) as qty,
|
(CASE WHEN (qty > 0 AND remark IS NULL) OR (qty > 0 AND status='foc') OR (qty < 0 AND status = 'foc') OR (qty < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(qty) ELSE qty END) as qty,
|
||||||
unit_price,
|
unit_price,
|
||||||
taxable_price,
|
taxable_price,
|
||||||
(CASE WHEN (price > 0 AND remark IS NULL) OR (qty < 0 AND status = 'foc') OR (price < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(price) ELSE price END) as price,
|
(CASE WHEN (price > 0 AND remark IS NULL) OR (qty > 0 AND status='foc') OR (qty < 0 AND status = 'foc') OR (price < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(price) ELSE price END) as price,
|
||||||
is_taxable")
|
is_taxable")
|
||||||
.where("sale_id = ?",sale_id)
|
.where("sale_id = ?",sale_id)
|
||||||
.order("product_name asc")
|
.order("product_name asc")
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{number_with_precision(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
text "#{number_with_precision(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
#start other payment details
|
#start other payment details
|
||||||
if shift_sale.other_sales > 0
|
if shift_sale.other_sales > 0
|
||||||
other_payment.each do |other|
|
other_payment.each do |other|
|
||||||
|
|||||||
@@ -721,7 +721,6 @@ $(document).ready(function(){
|
|||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
window.location.replace('/origami/sale/'+sale_id+'/cashier/payment');
|
window.location.replace('/origami/sale/'+sale_id+'/cashier/payment');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* replace url type*/
|
/* replace url type*/
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
var member_id = $('#membership_id').text();
|
var member_id = $('#membership_id').text();
|
||||||
@@ -1125,6 +1124,8 @@ $(document).ready(function(){
|
|||||||
<% else %>
|
<% else %>
|
||||||
$('#balance').text(parseFloat(result));
|
$('#balance').text(parseFloat(result));
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
show_hide_btn($('#balance').text());
|
||||||
}
|
}
|
||||||
|
|
||||||
function customer_display_view(data,status) {
|
function customer_display_view(data,status) {
|
||||||
@@ -1831,4 +1832,15 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
},100);
|
},100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function show_hide_btn(balance) {
|
||||||
|
// show discount when balance is greater than 0
|
||||||
|
// if(parseFloat(balance) > 0){
|
||||||
|
// $("#discount").show();
|
||||||
|
// $("#edit").show();
|
||||||
|
// }else{
|
||||||
|
// $("#discount").hide();
|
||||||
|
// $("#edit").hide();
|
||||||
|
// }
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# check for license file
|
# check for license file
|
||||||
# if check_license
|
if check_license
|
||||||
# current_license(ENV["SX_PROVISION_URL"])
|
current_license(ENV["SX_PROVISION_URL"])
|
||||||
# else
|
else
|
||||||
# redirect_to activate_path
|
redirect_to activate_path
|
||||||
# end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#application_path="#{File.expand_path("../..", __FILE__)}"
|
application_path="#{File.expand_path("../..", __FILE__)}"
|
||||||
#directory application_path
|
directory application_path
|
||||||
# environment ENV.fetch("RAILS_ENV") { "production" }
|
# environment ENV.fetch("RAILS_ENV") { "production" }
|
||||||
#environment "production"
|
environment "production"
|
||||||
#pidfile "#{application_path}/tmp/puma/pid"
|
pidfile "#{application_path}/tmp/puma/pid"
|
||||||
#state_path "#{application_path}/tmp/puma/state"
|
state_path "#{application_path}/tmp/puma/state"
|
||||||
#stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||||
#port ENV.fetch("PORT") { 62158 }
|
port ENV.fetch("PORT") { 62158 }
|
||||||
#workers 2
|
workers 2
|
||||||
#preload_app!
|
preload_app!
|
||||||
|
|||||||
Reference in New Issue
Block a user