Skip to content

Commit

Permalink
Implemented processor for baremetal
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanMPhm committed Feb 26, 2025
1 parent 3b757ce commit 811f9bb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
30 changes: 30 additions & 0 deletions process_report/invoices/bm_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from dataclasses import dataclass


from process_report.invoices import invoice


@dataclass
class BMInvoice(invoice.Invoice):
export_columns_list = [
invoice.INVOICE_DATE_FIELD,
invoice.PROJECT_FIELD,
invoice.PROJECT_ID_FIELD,
invoice.PI_FIELD,
invoice.INVOICE_EMAIL_FIELD,
invoice.INVOICE_ADDRESS_FIELD,
invoice.INSTITUTION_FIELD,
invoice.INSTITUTION_ID_FIELD,
invoice.SU_HOURS_FIELD,
invoice.SU_TYPE_FIELD,
invoice.RATE_FIELD,
invoice.COST_FIELD,
invoice.CREDIT_FIELD,
invoice.CREDIT_CODE_FIELD,
invoice.BALANCE_FIELD,
]

def _prepare_export(self):
self.export_data = self.data[
self.data[invoice.PROJECT_ID_FIELD] == "ESI Bare Metal"
]
12 changes: 12 additions & 0 deletions process_report/process_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from process_report import util
from process_report.invoices import (
bm_invoice,
lenovo_invoice,
nonbillable_invoice,
billable_invoice,
Expand Down Expand Up @@ -190,6 +191,12 @@ def main():
default="Lenovo",
help="Name of output csv for Lenovo SU Types invoice",
)
parser.add_argument(
"--bm-usage-file",
required=False,
default="bm_usage",
help="Name of output csv for Lenovo SU Types invoice",
)
parser.add_argument(
"--old-pi-file",
required=False,
Expand Down Expand Up @@ -366,6 +373,10 @@ def main():
name="", invoice_month=invoice_month, data=processed_data.copy()
)

bm_inv = bm_invoice.BMInvoice(
name=args.bm_usage_file, invoice_month=invoice_month, data=processed_data
)

util.process_and_export_invoices(
[
lenovo_inv,
Expand All @@ -375,6 +386,7 @@ def main():
bu_internal_inv,
pi_inv,
moca_prepaid_inv,
bm_inv,
],
args.upload_to_s3,
)
Expand Down

0 comments on commit 811f9bb

Please sign in to comment.