membershipworks: Fix subtotals in event invoices

This commit is contained in:
Adam Goldsmith 2024-11-25 14:00:11 -05:00
parent fd26e2b17d
commit 35d74f7bc3

View File

@ -153,7 +153,7 @@ class CurrentAndUpcomingEventTable(EventTable):
sequence = ("title", "start", "next_meeting")
class MoneyFooterColumn(MoneyColumn):
class MoneyFooterColumn(CurrencySymbolMoneyColumn):
def render_footer(self, bound_column, table):
value = getattr(table.event, bound_column.accessor)
if value is not None:
@ -182,18 +182,16 @@ class InvoiceTable(tables.Table):
_math_header("Quantity", "Q"),
footer=lambda table: table.event.quantity,
)
amount = CurrencySymbolMoneyColumn(_math_header("Amount", "A=P*Q"))
materials = CurrencySymbolMoneyColumn(
_math_header("CMS Collected Materials Fee", "M=m*Q")
)
amount_without_materials = CurrencySymbolMoneyColumn(
amount = MoneyFooterColumn(_math_header("Amount", "A=P*Q"))
materials = MoneyFooterColumn(_math_header("CMS Collected Materials Fee", "M=m*Q"))
amount_without_materials = MoneyFooterColumn(
_math_header("Event Revenue Base", "B=A-M")
)
instructor_revenue = CurrencySymbolMoneyColumn(
instructor_revenue = MoneyFooterColumn(
_math_header("Instructor Percentage Revenue", "R=B*I"),
)
instructor_amount = CurrencySymbolMoneyColumn(
_math_header("Amount Due to Instructor", "R+M")
instructor_amount = MoneyFooterColumn(
_math_header("Amount Due to Instructor", "R+M"),
)
class Meta: