Update shift for credit payment
This commit is contained in:
@@ -721,7 +721,8 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
# update for shift with credit payment
|
# update for shift with credit payment
|
||||||
def update_shift_for_credit_payment
|
def update_shift_for_credit_payment
|
||||||
shift = ShiftSale.find_by_id(self.sale.shift_sale_id)
|
shift_credit = ShiftSale.find_by_id(self.sale.shift_sale_id)
|
||||||
|
shift = ShiftSale.find_by_id(ShiftSale.current_shift)
|
||||||
if !shift.nil?
|
if !shift.nil?
|
||||||
credit_payment_left = get_credit_payment_left[0].payment_amount.to_f
|
credit_payment_left = get_credit_payment_left[0].payment_amount.to_f
|
||||||
if self.payment_method == "cash"
|
if self.payment_method == "cash"
|
||||||
@@ -739,9 +740,12 @@ class SalePayment < ApplicationRecord
|
|||||||
shift.other_sales = shift.other_sales.to_f + self.received_amount.to_f
|
shift.other_sales = shift.other_sales.to_f + self.received_amount.to_f
|
||||||
end
|
end
|
||||||
if credit_payment_left == 0 || credit_payment_left >= self.received_amount.to_f
|
if credit_payment_left == 0 || credit_payment_left >= self.received_amount.to_f
|
||||||
shift.credit_sales = shift.credit_sales.to_f - self.received_amount.to_f
|
if shift.id == shift_credit.id
|
||||||
|
shift.credit_sales = shift_credit.credit_sales.to_f - self.received_amount.to_f
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
shift.credit_sales = shift.credit_sales.to_f - (self.received_amount.to_f + credit_payment_left)
|
shift.credit_sales = shift_credit.credit_sales.to_f - (self.received_amount.to_f + credit_payment_left)
|
||||||
end
|
end
|
||||||
shift.save
|
shift.save
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# 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!
|
||||||
# threads 1,1
|
threads 1,1
|
||||||
|
|||||||
Reference in New Issue
Block a user