diff --git a/bpeng/__init__.py b/bpeng/__init__.py index 8d41ece75379e5c6a0778f3df3e0a9f785eb5ce9..ac451766b4707c820333ac607113c1980d7ec28b 100644 --- a/bpeng/__init__.py +++ b/bpeng/__init__.py @@ -4,4 +4,4 @@ BlocPower Engine library. Engineering and Financial modeling. """ -__version__ = '0.4.0' +__version__ = '0.4.1' diff --git a/bpeng/reports/__init__.py b/bpeng/reports/__init__.py index 7bf47562d20e347208fffbfb4bac3c53f8942114..1d3fb321e258b665b6394daffd6f2ee32e98c8ce 100644 --- a/bpeng/reports/__init__.py +++ b/bpeng/reports/__init__.py @@ -1 +1,2 @@ from .cbra_diag import CbraDiagnostic +from .customer_pns import CustomerPns diff --git a/bpeng/reports/cbra_diag.py b/bpeng/reports/cbra_diag.py index f2b181a7f892c0e5899a07e56ca1a76ed5856b32..7ce9fef9a84aea94195f4bb5e0282f7bd2bfcb73 100644 --- a/bpeng/reports/cbra_diag.py +++ b/bpeng/reports/cbra_diag.py @@ -400,7 +400,16 @@ class CbraDiagnostic: """ template_file = input('Enter Template Name (with .pptx extension): ') file_name = input('Enter File Name (with .xlsx extension): ') - file_input = pd.ExcelFile(file_name) + project_address, diag_rep = CbraDiagnostic.generate_report_from_file(template_file, file_name) + diag_rep.save('EEDR {}.pptx'.format(project_address)) + print('Report generated!') + + @staticmethod + def generate_report_from_file(template_file, report_file): + """ + Generate a report from the inputted file + """ + file_input = pd.ExcelFile(report_file) sheet_input = file_input.parse("Inputs", header=None) ( project_summary_data, @@ -408,15 +417,13 @@ class CbraDiagnostic: heat_loss_data, retrofit_data ) = CbraDiagnostic.parse_arguments(sheet_input) - project_address, diag_rep = CbraDiagnostic._generate_report( + return CbraDiagnostic._generate_report( template_file, project_summary_data, util_break_data, heat_loss_data, retrofit_data, ) - diag_rep.save('EEDR {}.pptx'.format(project_address)) - print('Report generated!') @staticmethod def parse_arguments(sheet_input): diff --git a/bpeng/reports/customer_pns.py b/bpeng/reports/customer_pns.py index 2faaf4701b7f6a0271ce8cb5e31948f8283026a4..8685240500a6ab55917b8692c8acd251899637d4 100644 --- a/bpeng/reports/customer_pns.py +++ b/bpeng/reports/customer_pns.py @@ -464,6 +464,14 @@ class CustomerPns: """ template_file = 'PNS_SlideDeck.pptx' # TODO: input('Enter Template Name (with .pptx extension): ') file_name = input('Enter PNS file name (with .xlsx extension): ') + project_address, client_pns = CustomerPns.generate_pns_from_file( + template_file, + file_name, + ) + client_pns.save('PNS {}.pptx'.format(project_address)) + + @staticmethod + def generate_pns_from_file(template_file, file_name): file_input = pd.ExcelFile(file_name) sheet_input = file_input.parse("Inputs", header=None) ( @@ -471,13 +479,13 @@ class CustomerPns: building_information_data, retrofit_data ) = CustomerPns.parse_arguments(sheet_input) - project_address, client_pns = CustomerPns._generate_report( + return CustomerPns._generate_report( template_file, project_summary_data, building_information_data, retrofit_data, ) - client_pns.save('PNS {}.pptx'.format(project_address)) + @staticmethod def parse_arguments(sheet_input):