diff --git a/.DS_Store b/.DS_Store index a4f1c73c..ccbeaa6d 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/osinaweb/billing/__pycache__/models.cpython-310.pyc b/osinaweb/billing/__pycache__/models.cpython-310.pyc index 0f25db08..6692b3d6 100644 Binary files a/osinaweb/billing/__pycache__/models.cpython-310.pyc and b/osinaweb/billing/__pycache__/models.cpython-310.pyc differ diff --git a/osinaweb/billing/models.py b/osinaweb/billing/models.py index 1e3a4488..9f43a979 100644 --- a/osinaweb/billing/models.py +++ b/osinaweb/billing/models.py @@ -42,6 +42,15 @@ class Order(models.Model): total = sum([item.get_total for item in orderitems]) return total @property + def get_paid_amount(self): + payments = self.orderpayment_set.filter(date_paid__isnull=False) + total_paid = sum([payment.amount for payment in payments]) + return total_paid + @property + def remaining_balance(self): + return self.get_cart_total - self.get_paid_amount + + @property def get_purchased_date(self): first_orderitem = self.orderitem_set.first() if first_orderitem: diff --git a/osinaweb/billing/templates/details_templates/order-details.html b/osinaweb/billing/templates/details_templates/order-details.html index ea5710e0..7926fce4 100644 --- a/osinaweb/billing/templates/details_templates/order-details.html +++ b/osinaweb/billing/templates/details_templates/order-details.html @@ -26,7 +26,7 @@ -

Remaining Balance: $12.00

+

Remaining Balance: ${{order.remaining_balance}}

-

Remaining Balance: $12.00

+

Remaining Balance: ${{order.remaining_balance}}

-

Invoices

+

My Invoices

diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index 6a056e32..4788fd6d 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ