Merge branch 'r-1902001-01' of gitlab.com:code2lab/SXRestaurant into r-1902001-01

This commit is contained in:
NyanLinHtut
2019-05-22 13:47:45 +06:30
14 changed files with 60 additions and 44 deletions

0
10
View File

View File

@@ -18,36 +18,39 @@ class Customer < ApplicationRecord
paginates_per 50
def self.get_member_account(customer)
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
membership = MembershipSetting.active.find_by_membership_type("paypar_url")
memberaction = MembershipAction.active.find_by_membership_type("get_all_member_account")
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
# urltest =self.url_exist?(url)
if !membership.nil? && !memberaction.nil?
begin
response = HTTParty.get(url, :body => {
membership_id: customer.membership_id,
merchant_uid:merchant_uid,
type: "summary",
auth_token:auth_token
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
},
:timeout => 10)
rescue HTTParty::Error
response = {status: false, message: "Server Error"}
rescue Net::OpenTimeout
response = { status: false , message: "Server Time out"}
begin
response = HTTParty.get(url, :body => {
membership_id: customer.membership_id,
merchant_uid:merchant_uid,
type: "summary",
auth_token:auth_token
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
},
:timeout => 10)
rescue HTTParty::Error
response = {status: false, message: "Server Error"}
rescue Net::OpenTimeout
response = { status: false , message: "Server Time out"}
rescue OpenURI::HTTPError
response = { status: false, message: "Can't connect server"}
rescue OpenURI::HTTPError
response = { status: false, message: "Can't connect server"}
rescue SocketError
response = { status: false, message: "Can't connect server"}
rescue SocketError
response = { status: false, message: "Can't connect server"}
end
else
response = {status: false, message: "There is no membership setting."}
end
Rails.logger.debug "--------Get Member Account response -------"
Rails.logger.debug response.to_json

View File

@@ -180,10 +180,10 @@ class SaleItem < ApplicationRecord
def self.get_all_sale_items(sale_id)
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
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,
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")
.where("sale_id = ?",sale_id)
.order("product_name asc")

View File

@@ -175,6 +175,7 @@ class CloseCashierPdf < Prawn::Document
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
end
#start other payment details
if shift_sale.other_sales > 0
other_payment.each do |other|

View File

@@ -35,7 +35,7 @@ class CrmOrderPdf < Prawn::Document
end
header( printer_settings.printer_name, printer_settings.name)
stroke_horizontal_rule
stroke_horizontal_rule
cashier_info(booking)
line_items(order_items)

View File

@@ -66,7 +66,7 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
text "OrderNo: #{order_no}", :size => self.item_font_size,:align => :left
end
move_down 5

View File

@@ -721,7 +721,6 @@ $(document).ready(function(){
var sale_id = $('#sale_id').text();
window.location.replace('/origami/sale/'+sale_id+'/cashier/payment');
}
/* replace url type*/
/* start check first bill or not*/
var member_id = $('#membership_id').text();
@@ -1125,6 +1124,8 @@ $(document).ready(function(){
<% else %>
$('#balance').text(parseFloat(result));
<% end %>
show_hide_btn($('#balance').text());
}
function customer_display_view(data,status) {
@@ -1831,4 +1832,15 @@ $(document).ready(function(){
}
},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>

View File

@@ -20,11 +20,11 @@ class ActionController::Base
end
else
# check for license file
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
end
end

View File

@@ -1,10 +1,10 @@
#application_path="#{File.expand_path("../..", __FILE__)}"
#directory application_path
#environment ENV.fetch("RAILS_ENV") { "production" }
#environment "production"
#pidfile "#{application_path}/tmp/puma/pid"
#state_path "#{application_path}/tmp/puma/state"
#stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
#port ENV.fetch("PORT") { 62158 }
#workers 2
#preload_app!
application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path
# environment ENV.fetch("RAILS_ENV") { "production" }
environment "production"
pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
port ENV.fetch("PORT") { 62158 }
workers 2
preload_app!

BIN
dump.rdb

Binary file not shown.

0
false,
View File

View File

0
{
View File