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