Code Duplication    Length = 33-42 lines in 69 locations

myems-api/excelexporters/combinedequipmentcarbon.py 1 location

@@ 24-65 (lines=42) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
    print(report)
36
37
    ####################################################################################################################
38
    # Step 2: Generate excel file from the report data
39
    ####################################################################################################################
40
    filename = generate_excel(report,
41
                              name,
42
                              reporting_start_datetime_local,
43
                              reporting_end_datetime_local,
44
                              period_type,
45
                              language)
46
    ####################################################################################################################
47
    # Step 3: Encode the excel file to Base64
48
    ####################################################################################################################
49
    binary_file_data = b''
50
    try:
51
        with open(filename, 'rb') as binary_file:
52
            binary_file_data = binary_file.read()
53
    except IOError as ex:
54
        pass
55
56
    # Base64 encode the bytes
57
    base64_encoded_data = base64.b64encode(binary_file_data)
58
    # get the Base64 encoded data using human-readable characters.
59
    base64_message = base64_encoded_data.decode('utf-8')
60
    # delete the file from server
61
    try:
62
        os.remove(filename)
63
    except NotImplementedError as ex:
64
        pass
65
    return base64_message
66
67
68
def generate_excel(report,

myems-api/excelexporters/combinedequipmentincome.py 1 location

@@ 24-65 (lines=42) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
    print(report)
36
37
    ####################################################################################################################
38
    # Step 2: Generate excel file from the report data
39
    ####################################################################################################################
40
    filename = generate_excel(report,
41
                              name,
42
                              reporting_start_datetime_local,
43
                              reporting_end_datetime_local,
44
                              period_type,
45
                              language)
46
    ####################################################################################################################
47
    # Step 3: Encode the excel file to Base64
48
    ####################################################################################################################
49
    binary_file_data = b''
50
    try:
51
        with open(filename, 'rb') as binary_file:
52
            binary_file_data = binary_file.read()
53
    except IOError as ex:
54
        pass
55
56
    # Base64 encode the bytes
57
    base64_encoded_data = base64.b64encode(binary_file_data)
58
    # get the Base64 encoded data using human-readable characters.
59
    base64_message = base64_encoded_data.decode('utf-8')
60
    # delete the file from server
61
    try:
62
        os.remove(filename)
63
    except NotImplementedError as ex:
64
        pass
65
    return base64_message
66
67
68
def generate_excel(report,

myems-api/excelexporters/combinedequipmentcost.py 1 location

@@ 24-65 (lines=42) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
    print(report)
36
37
    ####################################################################################################################
38
    # Step 2: Generate excel file from the report data
39
    ####################################################################################################################
40
    filename = generate_excel(report,
41
                              name,
42
                              reporting_start_datetime_local,
43
                              reporting_end_datetime_local,
44
                              period_type,
45
                              language)
46
    ####################################################################################################################
47
    # Step 3: Encode the excel file to Base64
48
    ####################################################################################################################
49
    binary_file_data = b''
50
    try:
51
        with open(filename, 'rb') as binary_file:
52
            binary_file_data = binary_file.read()
53
    except IOError as ex:
54
        pass
55
56
    # Base64 encode the bytes
57
    base64_encoded_data = base64.b64encode(binary_file_data)
58
    # get the Base64 encoded data using human-readable characters.
59
    base64_message = base64_encoded_data.decode('utf-8')
60
    # delete the file from server
61
    try:
62
        os.remove(filename)
63
    except NotImplementedError as ex:
64
        pass
65
    return base64_message
66
67
68
def generate_excel(report,

myems-api/excelexporters/spacecost.py 1 location

@@ 24-65 (lines=42) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
    print(report)
36
37
    ####################################################################################################################
38
    # Step 2: Generate excel file from the report data
39
    ####################################################################################################################
40
    filename = generate_excel(report,
41
                              name,
42
                              reporting_start_datetime_local,
43
                              reporting_end_datetime_local,
44
                              period_type,
45
                              language)
46
    ####################################################################################################################
47
    # Step 3: Encode the excel file to Base64
48
    ####################################################################################################################
49
    binary_file_data = b''
50
    try:
51
        with open(filename, 'rb') as binary_file:
52
            binary_file_data = binary_file.read()
53
    except IOError as ex:
54
        pass
55
56
    # Base64 encode the bytes
57
    base64_encoded_data = base64.b64encode(binary_file_data)
58
    # get the Base64 encoded data using human-readable characters.
59
    base64_message = base64_encoded_data.decode('utf-8')
60
    # delete the file from server
61
    try:
62
        os.remove(filename)
63
    except NotImplementedError as ex:
64
        pass
65
    return base64_message
66
67
68
def generate_excel(report,

myems-api/excelexporters/spacecarbon.py 1 location

@@ 24-65 (lines=42) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
    print(report)
36
37
    ####################################################################################################################
38
    # Step 2: Generate excel file from the report data
39
    ####################################################################################################################
40
    filename = generate_excel(report,
41
                              name,
42
                              reporting_start_datetime_local,
43
                              reporting_end_datetime_local,
44
                              period_type,
45
                              language)
46
    ####################################################################################################################
47
    # Step 3: Encode the excel file to Base64
48
    ####################################################################################################################
49
    binary_file_data = b''
50
    try:
51
        with open(filename, 'rb') as binary_file:
52
            binary_file_data = binary_file.read()
53
    except IOError as ex:
54
        pass
55
56
    # Base64 encode the bytes
57
    base64_encoded_data = base64.b64encode(binary_file_data)
58
    # get the Base64 encoded data using human-readable characters.
59
    base64_message = base64_encoded_data.decode('utf-8')
60
    # delete the file from server
61
    try:
62
        os.remove(filename)
63
    except NotImplementedError as ex:
64
        pass
65
    return base64_message
66
67
68
def generate_excel(report,

myems-api/excelexporters/spaceincome.py 1 location

@@ 24-65 (lines=42) @@
21
####################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
    print(report)
36
37
    ####################################################################################################################
38
    # Step 2: Generate excel file from the report data
39
    ####################################################################################################################
40
    filename = generate_excel(report,
41
                              name,
42
                              reporting_start_datetime_local,
43
                              reporting_end_datetime_local,
44
                              period_type,
45
                              language)
46
    ####################################################################################################################
47
    # Step 3: Encode the excel file to Base64
48
    ####################################################################################################################
49
    binary_file_data = b''
50
    try:
51
        with open(filename, 'rb') as binary_file:
52
            binary_file_data = binary_file.read()
53
    except IOError as ex:
54
        pass
55
56
    # Base64 encode the bytes
57
    base64_encoded_data = base64.b64encode(binary_file_data)
58
    # get the Base64 encoded data using human-readable characters.
59
    base64_message = base64_encoded_data.decode('utf-8')
60
    # delete the file from server
61
    try:
62
        os.remove(filename)
63
    except NotImplementedError as ex:
64
        pass
65
    return base64_message
66
67
68
def generate_excel(report,

myems-api/excelexporters/combinedequipmentsaving.py 1 location

@@ 24-65 (lines=42) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
    print(report)
36
37
    ####################################################################################################################
38
    # Step 2: Generate excel file from the report data
39
    ####################################################################################################################
40
    filename = generate_excel(report,
41
                              name,
42
                              reporting_start_datetime_local,
43
                              reporting_end_datetime_local,
44
                              period_type,
45
                              language)
46
    ####################################################################################################################
47
    # Step 3: Encode the excel file to Base64
48
    ####################################################################################################################
49
    binary_file_data = b''
50
    try:
51
        with open(filename, 'rb') as binary_file:
52
            binary_file_data = binary_file.read()
53
    except IOError as ex:
54
        pass
55
56
    # Base64 encode the bytes
57
    base64_encoded_data = base64.b64encode(binary_file_data)
58
    # get the Base64 encoded data using human-readable characters.
59
    base64_message = base64_encoded_data.decode('utf-8')
60
    # delete the file from server
61
    try:
62
        os.remove(filename)
63
    except NotImplementedError as ex:
64
        pass
65
    return base64_message
66
67
68
def generate_excel(report,

myems-api/excelexporters/spaceefficiency.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/spaceoutput.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/spacesaving.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/metertrend.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(result,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if result is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(result,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/spaceenergycategory.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/combinedequipmentstatistics.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/combinedequipmentenergyitem.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/combinedequipmentoutput.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/spaceenergyitem.py 1 location

@@ 23-64 (lines=42) @@
20
####################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/spaceload.py 1 location

@@ 23-64 (lines=42) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
    print(report)
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):

myems-api/excelexporters/spacestatistics.py 1 location

@@ 22-63 (lines=42) @@
19
########################################################################################################################
20
21
22
def export(report,
23
           name,
24
           reporting_start_datetime_local,
25
           reporting_end_datetime_local,
26
           period_type,
27
           language):
28
    ####################################################################################################################
29
    # Step 1: Validate the report data
30
    ####################################################################################################################
31
    if report is None:
32
        return None
33
    print(report)
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentincome.py 1 location

@@ 24-64 (lines=41) @@
21
####################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/tenantcost.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/equipmentsaving.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/tenantsaving.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/tenantcarbon.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/shopfloorsaving.py 1 location

@@ 24-64 (lines=41) @@
21
####################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/shopfloorcarbon.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/storecarbon.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/shopfloorcost.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/storecost.py 1 location

@@ 24-64 (lines=41) @@
21
########################################################################################################################
22
23
24
def export(report,
25
           name,
26
           reporting_start_datetime_local,
27
           reporting_end_datetime_local,
28
           period_type,
29
           language):
30
    ####################################################################################################################
31
    # Step 1: Validate the report data
32
    ####################################################################################################################
33
    if report is None:
34
        return None
35
36
    ####################################################################################################################
37
    # Step 2: Generate excel file from the report data
38
    ####################################################################################################################
39
    filename = generate_excel(report,
40
                              name,
41
                              reporting_start_datetime_local,
42
                              reporting_end_datetime_local,
43
                              period_type,
44
                              language)
45
    ####################################################################################################################
46
    # Step 3: Encode the excel file to Base64
47
    ####################################################################################################################
48
    binary_file_data = b''
49
    try:
50
        with open(filename, 'rb') as binary_file:
51
            binary_file_data = binary_file.read()
52
    except IOError as ex:
53
        pass
54
55
    # Base64 encode the bytes
56
    base64_encoded_data = base64.b64encode(binary_file_data)
57
    # get the Base64 encoded data using human-readable characters.
58
    base64_message = base64_encoded_data.decode('utf-8')
59
    # delete the file from server
60
    try:
61
        os.remove(filename)
62
    except NotImplementedError as ex:
63
        pass
64
    return base64_message
65
66
67
def generate_excel(report,

myems-api/excelexporters/equipmentefficiency.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/tenantload.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):

myems-api/excelexporters/combinedequipmentload.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/shopfloorload.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/shopfloorenergyitem.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/storeload.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/storeenergycategory.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/combinedequipmentefficiency.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/tenantstatistics.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentload.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentenergyitem.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/shopfloorenergycategory.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentstatistics.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentoutput.py 1 location

@@ 23-63 (lines=41) @@
20
####################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/shopfloorstatistics.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/combinedequipmentenergycategory.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/tenantenergyitem.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/storesaving.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentcarbon.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/storeenergyitem.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/tenantenergycategory.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentcost.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/equipmentenergycategory.py 1 location

@@ 23-63 (lines=41) @@
20
########################################################################################################################
21
22
23
def export(report,
24
           name,
25
           reporting_start_datetime_local,
26
           reporting_end_datetime_local,
27
           period_type,
28
           language):
29
    ####################################################################################################################
30
    # Step 1: Validate the report data
31
    ####################################################################################################################
32
    if report is None:
33
        return None
34
35
    ####################################################################################################################
36
    # Step 2: Generate excel file from the report data
37
    ####################################################################################################################
38
    filename = generate_excel(report,
39
                              name,
40
                              reporting_start_datetime_local,
41
                              reporting_end_datetime_local,
42
                              period_type,
43
                              language)
44
    ####################################################################################################################
45
    # Step 3: Encode the excel file to Base64
46
    ####################################################################################################################
47
    binary_file_data = b''
48
    try:
49
        with open(filename, 'rb') as binary_file:
50
            binary_file_data = binary_file.read()
51
    except IOError as ex:
52
        pass
53
54
    # Base64 encode the bytes
55
    base64_encoded_data = base64.b64encode(binary_file_data)
56
    # get the Base64 encoded data using human-readable characters.
57
    base64_message = base64_encoded_data.decode('utf-8')
58
    # delete the file from server
59
    try:
60
        os.remove(filename)
61
    except NotImplementedError as ex:
62
        pass
63
    return base64_message
64
65
66
def generate_excel(report,

myems-api/excelexporters/storestatistics.py 1 location

@@ 22-62 (lines=41) @@
19
########################################################################################################################
20
21
22
def export(report,
23
           name,
24
           reporting_start_datetime_local,
25
           reporting_end_datetime_local,
26
           period_type,
27
           language):
28
    ####################################################################################################################
29
    # Step 1: Validate the report data
30
    ####################################################################################################################
31
    if report is None:
32
        return None
33
34
    ####################################################################################################################
35
    # Step 2: Generate excel file from the report data
36
    ####################################################################################################################
37
    filename = generate_excel(report,
38
                              name,
39
                              reporting_start_datetime_local,
40
                              reporting_end_datetime_local,
41
                              period_type,
42
                              language)
43
    ####################################################################################################################
44
    # Step 3: Encode the excel file to Base64
45
    ####################################################################################################################
46
    binary_file_data = b''
47
    try:
48
        with open(filename, 'rb') as binary_file:
49
            binary_file_data = binary_file.read()
50
    except IOError as ex:
51
        pass
52
53
    # Base64 encode the bytes
54
    base64_encoded_data = base64.b64encode(binary_file_data)
55
    # get the Base64 encoded data using human-readable characters.
56
    base64_message = base64_encoded_data.decode('utf-8')
57
    # delete the file from server
58
    try:
59
        os.remove(filename)
60
    except NotImplementedError as ex:
61
        pass
62
    return base64_message
63
64
65
def generate_excel(report,

myems-api/excelexporters/tenantbill.py 1 location

@@ 21-61 (lines=41) @@
18
########################################################################################################################
19
20
21
def export(report,
22
           name,
23
           reporting_start_datetime_local,
24
           reporting_end_datetime_local,
25
           period_type,
26
           language):
27
    ####################################################################################################################
28
    # Step 1: Validate the report data
29
    ####################################################################################################################
30
    if report is None:
31
        return None
32
33
    ####################################################################################################################
34
    # Step 2: Generate excel file from the report data
35
    ####################################################################################################################
36
    filename = generate_excel(report,
37
                              name,
38
                              reporting_start_datetime_local,
39
                              reporting_end_datetime_local,
40
                              period_type,
41
                              language)
42
    ####################################################################################################################
43
    # Step 3: Encode the excel file to Base64
44
    ####################################################################################################################
45
    binary_file_data = b''
46
    try:
47
        with open(filename, 'rb') as binary_file:
48
            binary_file_data = binary_file.read()
49
    except IOError as ex:
50
        pass
51
52
    # Base64 encode the bytes
53
    base64_encoded_data = base64.b64encode(binary_file_data)
54
    # get the Base64 encoded data using human-readable characters.
55
    base64_message = base64_encoded_data.decode('utf-8')
56
    # delete the file from server
57
    try:
58
        os.remove(filename)
59
    except NotImplementedError as ex:
60
        pass
61
    return base64_message
62
63
64
def generate_excel(report,

myems-api/excelexporters/metercomparison.py 1 location

@@ 22-58 (lines=37) @@
19
# Step 3: Encode the excel file to Base64
20
########################################################################################################################
21
22
def export(result, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
23
    ####################################################################################################################
24
    # Step 1: Validate the report data
25
    ####################################################################################################################
26
    if result is None:
27
        return None
28
29
    ####################################################################################################################
30
    # Step 2: Generate excel file from the report data
31
    ####################################################################################################################
32
    filename = generate_excel(result,
33
                              name1,
34
                              name2,
35
                              reporting_start_datetime_local,
36
                              reporting_end_datetime_local,
37
                              period_type,
38
                              language)
39
    ####################################################################################################################
40
    # Step 3: Encode the excel file to Base64
41
    ####################################################################################################################
42
    binary_file_data = b''
43
    try:
44
        with open(filename, 'rb') as binary_file:
45
            binary_file_data = binary_file.read()
46
    except IOError as ex:
47
        pass
48
49
    # Base64 encode the bytes
50
    base64_encoded_data = base64.b64encode(binary_file_data)
51
    # get the Base64 encoded data using human-readable characters.
52
    base64_message = base64_encoded_data.decode('utf-8')
53
    # delete the file from server
54
    try:
55
        os.remove(filename)
56
    except NotImplementedError as ex:
57
        pass
58
    return base64_message
59
60
61
def generate_excel(report, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type,

myems-api/excelexporters/metersubmetersbalance.py 1 location

@@ 22-57 (lines=36) @@
19
# Step 3: Encode the excelexporters file to Base64
20
########################################################################################################################
21
22
def export(result, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
23
    ####################################################################################################################
24
    # Step 1: Validate the report data
25
    ####################################################################################################################
26
    if result is None:
27
        return None
28
29
    ####################################################################################################################
30
    # Step 2: Generate excel file from the report data
31
    ####################################################################################################################
32
    filename = generate_excel(result,
33
                              name,
34
                              reporting_start_datetime_local,
35
                              reporting_end_datetime_local,
36
                              period_type,
37
                              language)
38
    ####################################################################################################################
39
    # Step 3: Encode the excel file to Base64
40
    ####################################################################################################################
41
    binary_file_data = b''
42
    try:
43
        with open(filename, 'rb') as binary_file:
44
            binary_file_data = binary_file.read()
45
    except IOError as ex:
46
        pass
47
48
    # Base64 encode the bytes
49
    base64_encoded_data = base64.b64encode(binary_file_data)
50
    # get the Base64 encoded data using human-readable characters.
51
    base64_message = base64_encoded_data.decode('utf-8')
52
    # delete the file from server
53
    try:
54
        os.remove(filename)
55
    except NotImplementedError as ex:
56
        pass
57
    return base64_message
58
59
60
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):

myems-api/excelexporters/metersaving.py 1 location

@@ 22-57 (lines=36) @@
19
# Step 3: Encode the excel file to Base64
20
########################################################################################################################
21
22
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
23
    ####################################################################################################################
24
    # Step 1: Validate the report data
25
    ####################################################################################################################
26
    if report is None:
27
        return None
28
29
    ####################################################################################################################
30
    # Step 2: Generate excel file from the report data
31
    ####################################################################################################################
32
    filename = generate_excel(report,
33
                              name,
34
                              reporting_start_datetime_local,
35
                              reporting_end_datetime_local,
36
                              period_type,
37
                              language)
38
    ####################################################################################################################
39
    # Step 3: Encode the excel file to Base64
40
    ####################################################################################################################
41
    binary_file_data = b''
42
    try:
43
        with open(filename, 'rb') as binary_file:
44
            binary_file_data = binary_file.read()
45
    except IOError as ex:
46
        pass
47
48
    # Base64 encode the bytes
49
    base64_encoded_data = base64.b64encode(binary_file_data)
50
    # get the Base64 encoded data using human-readable characters.
51
    base64_message = base64_encoded_data.decode('utf-8')
52
    # delete the file from server
53
    try:
54
        os.remove(filename)
55
    except NotImplementedError as ex:
56
        pass
57
    return base64_message
58
59
60
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):

myems-api/excelexporters/virtualmetersaving.py 1 location

@@ 20-55 (lines=36) @@
17
# Step 3: Encode the excel file to Base64
18
########################################################################################################################
19
20
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
21
    ####################################################################################################################
22
    # Step 1: Validate the report data
23
    ####################################################################################################################
24
    if report is None:
25
        return None
26
27
    ####################################################################################################################
28
    # Step 2: Generate excel file from the report data
29
    ####################################################################################################################
30
    filename = generate_excel(report,
31
                              name,
32
                              reporting_start_datetime_local,
33
                              reporting_end_datetime_local,
34
                              period_type,
35
                              language)
36
    ####################################################################################################################
37
    # Step 3: Encode the excel file to Base64
38
    ####################################################################################################################
39
    binary_file_data = b''
40
    try:
41
        with open(filename, 'rb') as binary_file:
42
            binary_file_data = binary_file.read()
43
    except IOError as ex:
44
        pass
45
46
    # Base64 encode the bytes
47
    base64_encoded_data = base64.b64encode(binary_file_data)
48
    # get the Base64 encoded data using human-readable characters.
49
    base64_message = base64_encoded_data.decode('utf-8')
50
    # delete the file from server
51
    try:
52
        os.remove(filename)
53
    except NotImplementedError as ex:
54
        pass
55
    return base64_message
56
57
58
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):

myems-api/excelexporters/offlinemeterenergy.py 1 location

@@ 20-55 (lines=36) @@
17
# Step 3: Encode the excel file to Base64
18
########################################################################################################################
19
20
def export(result, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
21
    ####################################################################################################################
22
    # Step 1: Validate the report data
23
    ####################################################################################################################
24
    if result is None:
25
        return None
26
27
    ####################################################################################################################
28
    # Step 2: Generate excel file from the report data
29
    ####################################################################################################################
30
    filename = generate_excel(result,
31
                              name,
32
                              reporting_start_datetime_local,
33
                              reporting_end_datetime_local,
34
                              period_type,
35
                              language)
36
    ####################################################################################################################
37
    # Step 3: Encode the excel file to Base64
38
    ####################################################################################################################
39
    binary_file_data = b''
40
    try:
41
        with open(filename, 'rb') as binary_file:
42
            binary_file_data = binary_file.read()
43
    except IOError as ex:
44
        pass
45
46
    # Base64 encode the bytes
47
    base64_encoded_data = base64.b64encode(binary_file_data)
48
    # get the Base64 encoded data using human-readable characters.
49
    base64_message = base64_encoded_data.decode('utf-8')
50
    # delete the file from server
51
    try:
52
        os.remove(filename)
53
    except NotImplementedError as ex:
54
        pass
55
    return base64_message
56
57
58
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):

myems-api/excelexporters/virtualmeterenergy.py 1 location

@@ 20-55 (lines=36) @@
17
# Step 3: Encode the excel file to Base64
18
########################################################################################################################
19
20
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
21
    ####################################################################################################################
22
    # Step 1: Validate the report data
23
    ####################################################################################################################
24
    if report is None:
25
        return None
26
27
    ####################################################################################################################
28
    # Step 2: Generate excel file from the report data
29
    ####################################################################################################################
30
    filename = generate_excel(report,
31
                              name,
32
                              reporting_start_datetime_local,
33
                              reporting_end_datetime_local,
34
                              period_type,
35
                              language)
36
    ####################################################################################################################
37
    # Step 3: Encode the excel file to Base64
38
    ####################################################################################################################
39
    binary_file_data = b''
40
    try:
41
        with open(filename, 'rb') as binary_file:
42
            binary_file_data = binary_file.read()
43
    except IOError as ex:
44
        pass
45
46
    # Base64 encode the bytes
47
    base64_encoded_data = base64.b64encode(binary_file_data)
48
    # get the Base64 encoded data using human-readable characters.
49
    base64_message = base64_encoded_data.decode('utf-8')
50
    # delete the file from server
51
    try:
52
        os.remove(filename)
53
    except NotImplementedError as ex:
54
        pass
55
    return base64_message
56
57
58
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):

myems-api/excelexporters/metertracking.py 1 location

@@ 19-54 (lines=36) @@
16
# Step 3: Encode the excelexporters file to Base64
17
########################################################################################################################
18
19
def export(result, space_name, energy_category_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
20
    ####################################################################################################################
21
    # Step 1: Validate the report data
22
    ####################################################################################################################
23
    if result is None:
24
        return None
25
26
    ####################################################################################################################
27
    # Step 2: Generate excel file from the report data
28
    ####################################################################################################################
29
    filename = generate_excel(result,
30
                              space_name,
31
                              energy_category_name,
32
                              reporting_start_datetime_local,
33
                              reporting_end_datetime_local,
34
                              language)
35
    ####################################################################################################################
36
    # Step 3: Encode the excel file to Base64
37
    ####################################################################################################################
38
    binary_file_data = b''
39
    try:
40
        with open(filename, 'rb') as binary_file:
41
            binary_file_data = binary_file.read()
42
    except IOError as ex:
43
        pass
44
45
    # Base64 encode the bytes
46
    base64_encoded_data = base64.b64encode(binary_file_data)
47
    # get the Base64 encoded data using human-readable characters.
48
    base64_message = base64_encoded_data.decode('utf-8')
49
    # delete the file from server
50
    try:
51
        os.remove(filename)
52
    except NotImplementedError as ex:
53
        pass
54
    return base64_message
55
56
57
def generate_excel(report, space_name, energy_category_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/tenantbatch.py 1 location

@@ 19-53 (lines=35) @@
16
# Step 3: Encode the excel file to Base64
17
########################################################################################################################
18
19
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
20
    ####################################################################################################################
21
    # Step 1: Validate the report data
22
    ####################################################################################################################
23
    if result is None:
24
        return None
25
26
    ####################################################################################################################
27
    # Step 2: Generate excel file from the report data
28
    ####################################################################################################################
29
    filename = generate_excel(result,
30
                              space_name,
31
                              reporting_start_datetime_local,
32
                              reporting_end_datetime_local,
33
                              language)
34
    ####################################################################################################################
35
    # Step 3: Encode the excel file to Base64
36
    ####################################################################################################################
37
    binary_file_data = b''
38
    try:
39
        with open(filename, 'rb') as binary_file:
40
            binary_file_data = binary_file.read()
41
    except IOError as ex:
42
        pass
43
44
    # Base64 encode the bytes
45
    base64_encoded_data = base64.b64encode(binary_file_data)
46
    # get the Base64 encoded data using human-readable characters.
47
    base64_message = base64_encoded_data.decode('utf-8')
48
    # delete the file from server
49
    try:
50
        os.remove(filename)
51
    except NotImplementedError as ex:
52
        pass
53
    return base64_message
54
55
56
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/storebatch.py 1 location

@@ 18-52 (lines=35) @@
15
# Step 3: Encode the excel file to Base64
16
########################################################################################################################
17
18
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              reporting_start_datetime_local,
31
                              reporting_end_datetime_local,
32
                              language)
33
    ####################################################################################################################
34
    # Step 3: Encode the excel file to Base64
35
    ####################################################################################################################
36
    binary_file_data = b''
37
    try:
38
        with open(filename, 'rb') as binary_file:
39
            binary_file_data = binary_file.read()
40
    except IOError as ex:
41
        pass
42
43
    # Base64 encode the bytes
44
    base64_encoded_data = base64.b64encode(binary_file_data)
45
    # get the Base64 encoded data using human-readable characters.
46
    base64_message = base64_encoded_data.decode('utf-8')
47
    # delete the file from server
48
    try:
49
        os.remove(filename)
50
    except NotImplementedError as ex:
51
        pass
52
    return base64_message
53
54
55
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/meterbatch.py 1 location

@@ 18-52 (lines=35) @@
15
# Step 3: Encode the excel file to Base64
16
########################################################################################################################
17
18
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              reporting_start_datetime_local,
31
                              reporting_end_datetime_local,
32
                              language)
33
    ####################################################################################################################
34
    # Step 3: Encode the excel file to Base64
35
    ####################################################################################################################
36
    binary_file_data = b''
37
    try:
38
        with open(filename, 'rb') as binary_file:
39
            binary_file_data = binary_file.read()
40
    except IOError as ex:
41
        pass
42
43
    # Base64 encode the bytes
44
    base64_encoded_data = base64.b64encode(binary_file_data)
45
    # get the Base64 encoded data using human-readable characters.
46
    base64_message = base64_encoded_data.decode('utf-8')
47
    # delete the file from server
48
    try:
49
        os.remove(filename)
50
    except NotImplementedError as ex:
51
        pass
52
    return base64_message
53
54
55
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/shopfloorbatch.py 1 location

@@ 18-52 (lines=35) @@
15
# Step 3: Encode the excelexporters file to Base64
16
####################################################################################################################
17
18
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              reporting_start_datetime_local,
31
                              reporting_end_datetime_local,
32
                              language)
33
    ####################################################################################################################
34
    # Step 3: Encode the excel file to Base64
35
    ####################################################################################################################
36
    binary_file_data = b''
37
    try:
38
        with open(filename, 'rb') as binary_file:
39
            binary_file_data = binary_file.read()
40
    except IOError as ex:
41
        pass
42
43
    # Base64 encode the bytes
44
    base64_encoded_data = base64.b64encode(binary_file_data)
45
    # get the Base64 encoded data using human-readable characters.
46
    base64_message = base64_encoded_data.decode('utf-8')
47
    # delete the file from server
48
    try:
49
        os.remove(filename)
50
    except NotImplementedError as ex:
51
        pass
52
    return base64_message
53
54
55
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/virtualmeterbatch.py 1 location

@@ 18-52 (lines=35) @@
15
# Step 3: Encode the excel file to Base64
16
########################################################################################################################
17
18
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              reporting_start_datetime_local,
31
                              reporting_end_datetime_local,
32
                              language)
33
    ####################################################################################################################
34
    # Step 3: Encode the excel file to Base64
35
    ####################################################################################################################
36
    binary_file_data = b''
37
    try:
38
        with open(filename, 'rb') as binary_file:
39
            binary_file_data = binary_file.read()
40
    except IOError as ex:
41
        pass
42
43
    # Base64 encode the bytes
44
    base64_encoded_data = base64.b64encode(binary_file_data)
45
    # get the Base64 encoded data using human-readable characters.
46
    base64_message = base64_encoded_data.decode('utf-8')
47
    # delete the file from server
48
    try:
49
        os.remove(filename)
50
    except NotImplementedError as ex:
51
        pass
52
    return base64_message
53
54
55
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/equipmentbatch.py 1 location

@@ 18-52 (lines=35) @@
15
# Step 3: Encode the excelexporters file to Base64
16
########################################################################################################################
17
18
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              reporting_start_datetime_local,
31
                              reporting_end_datetime_local,
32
                              language)
33
    ####################################################################################################################
34
    # Step 3: Encode the excel file to Base64
35
    ####################################################################################################################
36
    binary_file_data = b''
37
    try:
38
        with open(filename, 'rb') as binary_file:
39
            binary_file_data = binary_file.read()
40
    except IOError as ex:
41
        pass
42
43
    # Base64 encode the bytes
44
    base64_encoded_data = base64.b64encode(binary_file_data)
45
    # get the Base64 encoded data using human-readable characters.
46
    base64_message = base64_encoded_data.decode('utf-8')
47
    # delete the file from server
48
    try:
49
        os.remove(filename)
50
    except NotImplementedError as ex:
51
        pass
52
    return base64_message
53
54
55
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/offlinemeterbatch.py 1 location

@@ 18-52 (lines=35) @@
15
# Step 3: Encode the excel file to Base64
16
########################################################################################################################
17
18
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              reporting_start_datetime_local,
31
                              reporting_end_datetime_local,
32
                              language)
33
    ####################################################################################################################
34
    # Step 3: Encode the excel file to Base64
35
    ####################################################################################################################
36
    binary_file_data = b''
37
    try:
38
        with open(filename, 'rb') as binary_file:
39
            binary_file_data = binary_file.read()
40
    except IOError as ex:
41
        pass
42
43
    # Base64 encode the bytes
44
    base64_encoded_data = base64.b64encode(binary_file_data)
45
    # get the Base64 encoded data using human-readable characters.
46
    base64_message = base64_encoded_data.decode('utf-8')
47
    # delete the file from server
48
    try:
49
        os.remove(filename)
50
    except NotImplementedError as ex:
51
        pass
52
    return base64_message
53
54
55
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/combinedequipmentbatch.py 1 location

@@ 18-52 (lines=35) @@
15
# Step 3: Encode the excel file to Base64
16
########################################################################################################################
17
18
def export(result, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              reporting_start_datetime_local,
31
                              reporting_end_datetime_local,
32
                              language)
33
    ####################################################################################################################
34
    # Step 3: Encode the excel file to Base64
35
    ####################################################################################################################
36
    binary_file_data = b''
37
    try:
38
        with open(filename, 'rb') as binary_file:
39
            binary_file_data = binary_file.read()
40
    except IOError as ex:
41
        pass
42
43
    # Base64 encode the bytes
44
    base64_encoded_data = base64.b64encode(binary_file_data)
45
    # get the Base64 encoded data using human-readable characters.
46
    base64_message = base64_encoded_data.decode('utf-8')
47
    # delete the file from server
48
    try:
49
        os.remove(filename)
50
    except NotImplementedError as ex:
51
        pass
52
    return base64_message
53
54
55
def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):

myems-api/excelexporters/equipmenttracking.py 1 location

@@ 18-50 (lines=33) @@
15
# Step 3: Encode the excel file to Base64
16
########################################################################################################################
17
18
def export(result, space_name, language):
19
    ####################################################################################################################
20
    # Step 1: Validate the report data
21
    ####################################################################################################################
22
    if result is None:
23
        return None
24
25
    ####################################################################################################################
26
    # Step 2: Generate excel file from the report data
27
    ####################################################################################################################
28
    filename = generate_excel(result,
29
                              space_name,
30
                              language)
31
    ####################################################################################################################
32
    # Step 3: Encode the excel file to Base64
33
    ####################################################################################################################
34
    binary_file_data = b''
35
    try:
36
        with open(filename, 'rb') as binary_file:
37
            binary_file_data = binary_file.read()
38
    except IOError as ex:
39
        pass
40
41
    # Base64 encode the bytes
42
    base64_encoded_data = base64.b64encode(binary_file_data)
43
    # get the Base64 encoded data using human-readable characters.
44
    base64_message = base64_encoded_data.decode('utf-8')
45
    # delete the file from server
46
    try:
47
        os.remove(filename)
48
    except NotImplementedError as ex:
49
        pass
50
    return base64_message
51
52
53
def generate_excel(report, space_name, language):