-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added helper functions for invoice dashboard
Implemented function for event invoice calculation Added net_revenue & gross_revenue added logic for pdf and saved to DB Scheduled job on 1st of every month Hound & codacy Changed to monthly revenue
- Loading branch information
1 parent
3ed0142
commit 2dece3b
Showing
6 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import datetime | ||
|
||
from app.models.event_invoice import EventInvoice | ||
|
||
|
||
def fetch_event_invoices(invoice_status): | ||
""" | ||
Helper function to fetch event invoices based on status | ||
""" | ||
|
||
if invoice_status == 'due': | ||
event_invoices = EventInvoice.query.filter(EventInvoice.created_at + datetime.timedelta(days=30) <= | ||
datetime.datetime.now(), | ||
EventInvoice.paid_via is None).all() | ||
elif invoice_status == 'paid': | ||
event_invoices = EventInvoice.query.filter(EventInvoice.paid_via is not None).all() | ||
elif invoice_status == 'upcoming': | ||
event_invoices = EventInvoice.query.filter(EventInvoice.created_at + datetime.timedelta(days=30) > | ||
datetime.datetime.now(), | ||
EventInvoice.paid_via is None).all() | ||
return event_invoices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.