CCI-MOC / process_csv_report

Some scripts to help process our billing reports
0 stars 3 forks source link

Implement prepayment processing in billable invoice #77

Open QuanMPhm opened 1 month ago

QuanMPhm commented 1 month ago

As the first step to implementing prepayments, we need to implement prepayment processing to the billable invoice. Prepayment processing will require several steps and important requirements:

Several new prepaid-related rows are to be added to the billable invoice, empty if the project does not belong to a prepaid group:

These rows should also be shown in all invoices derived from the billable invoice. This includes the HU-BU or NERC Total invoice, the PI-specific invoices, and the BU Internal invoices.

Detailed specifications of this feature is in the Prepaid Development Scaffolding document.

QuanMPhm commented 4 weeks ago

@knikolla @naved001 Should the processing script fetch the prepaid group tables (i.e the debits, credits tables) by making calls to the github API, or should it expect these files to be passed via the CLI like with the nonbillable-related files?

knikolla commented 4 weeks ago

@QuanMPhm the same way as it works with the non billable projects. The script expects a file argument passed.

QuanMPhm commented 3 weeks ago

In the prepayment scaffolding, we agreed that the Prepayment credit should be applied after all other discounts (New-PI credit, BU subsidy), intent being that PIs should benefit from discounts before paying with their money.

That being said, we’re also told that the BU subsidy should be applied, but not visible in any of the invoices except the BU Internal invoice. This leads to a bit of messiness in our current code since the BU Internal invoice is made after (and is based on) the billable invoice. This means implementing the Prepaid credit would require some restructuring of the current code. @knikolla @naved001 My proposed restructuring is the following:

During the process() step for the billable invoice, could I apply the BU subsidy and add the Subsidy column to the dataframe, but filter it out and “undo” the subsidy during the export() step? When we arrive at the process() step for the BU Internal invoice, I can “redo” the subsidy before exporting. Would this be a good way to restructure the code?