sx cash payment api

This commit is contained in:
Myat Zin Wai Maw
2019-06-20 15:00:39 +06:30
parent 129e6a2a53
commit c06f0aade8
8 changed files with 184 additions and 6 deletions

View File

@@ -70,10 +70,8 @@ class Sale < ApplicationRecord
induties_pay_amount = (current_checkin_induties_count.to_i * (distance_in_minutes / 60.0).to_f * basic_pay_amount).to_i
create_saleitem_indutycharges(charges, current_checkin_induties_count.to_i, induties_pay_amount, booking.dining_facility.name, dining_time, order_source, basic_pay_amount)
end
create_saleitem_diningcharges(charges, block_count, diningprice, booking.dining_facility.name, dining_time, order_source)
end
return status, sale_id
end
end

View File

@@ -36,7 +36,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)
@@ -106,7 +106,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}]"
@@ -336,7 +336,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