Working on a django project. On my payment model I have a simple def save
def save(self, *args, **kwargs):
self.amount_change = self.amount_due - self.amount_paid
return super(Payment, self).save(*args, **kwargs)
If my amount_change comes to -455.50
I'd like to return change as
- 2x200
- 1x50
- 1x5
- 1x0.5
What I'd like to do is breakdown the amount_change into the money denominations that I have and return the change to the client with the correct notes and or coins. My denominations are [200, 100, 50, 20, 10, 5, 1, 0.5]
How do I go about doing this? Any help is appreciated.