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

This commit is contained in:
Zoey
2019-06-21 10:04:48 +06:30
75 changed files with 1760 additions and 429 deletions

View File

@@ -57,7 +57,7 @@ class SalePayment < ApplicationRecord
#route to payment type
case payment_method
when "cash"
payment_status = cash_payment(payment_for)
payment_status ,outstanding_amount ,balance_amount = cash_payment(payment_for)
when "creditnote"
if !self.sale.customer_id.nil?
payment_status = creditnote_payment(self.customer_id)
@@ -127,7 +127,7 @@ class SalePayment < ApplicationRecord
# end
end
return true, self.save,membership_data
return true, self.save,membership_data, outstanding_amount ,balance_amount
else
#record an payment in sale-audit
remark = "Payment failed - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
@@ -357,7 +357,16 @@ class SalePayment < ApplicationRecord
if !payment_for
sale_update_payment_status(self.received_amount,status)
end
return payment_status
balance_amount =0.0
outstanding_amount =0.0
if self.sale.grand_total.to_f > self.received_amount.to_f
balance_amount = self.sale.grand_total.to_f - self.received_amount.to_f
outstanding_amount = 0.0
else
balance_amount = 0.0
outstanding_amount = self.received_amount.to_f - self.sale.grand_total.to_f
end
return payment_status , outstanding_amount.to_i, balance_amount.to_i
end
def foc_payment