myems-api/excelexporters/spacecarbon.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceincome.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
#################################################################################################################### |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentcarbon.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentincome.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/spacecost.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentplan.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentsaving.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentcost.py 1 location
|
@@ 23-68 (lines=46) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
print(report) |
37 |
|
|
38 |
|
#################################################################################################################### |
39 |
|
# Step 2: Generate excel file from the report data |
40 |
|
#################################################################################################################### |
41 |
|
filename = generate_excel(report, |
42 |
|
name, |
43 |
|
base_period_start_datetime_local, |
44 |
|
base_period_end_datetime_local, |
45 |
|
reporting_start_datetime_local, |
46 |
|
reporting_end_datetime_local, |
47 |
|
period_type, |
48 |
|
language) |
49 |
|
#################################################################################################################### |
50 |
|
# Step 3: Encode the excel file to Base64 |
51 |
|
#################################################################################################################### |
52 |
|
binary_file_data = b'' |
53 |
|
try: |
54 |
|
with open(filename, 'rb') as binary_file: |
55 |
|
binary_file_data = binary_file.read() |
56 |
|
except IOError as ex: |
57 |
|
print(str(ex)) |
58 |
|
|
59 |
|
# Base64 encode the bytes |
60 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
61 |
|
# get the Base64 encoded data using human-readable characters. |
62 |
|
base64_message = base64_encoded_data.decode('utf-8') |
63 |
|
# delete the file from server |
64 |
|
try: |
65 |
|
os.remove(filename) |
66 |
|
except NotImplementedError as ex: |
67 |
|
print(str(ex)) |
68 |
|
return base64_message |
69 |
|
|
70 |
|
|
71 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceenergyitem.py 1 location
|
@@ 22-67 (lines=46) @@
|
19 |
|
#################################################################################################################### |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceplan.py 1 location
|
@@ 22-67 (lines=46) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceoutput.py 1 location
|
@@ 22-67 (lines=46) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceenergycategory.py 1 location
|
@@ 22-67 (lines=46) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/spacesaving.py 1 location
|
@@ 22-67 (lines=46) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentenergyitem.py 1 location
|
@@ 22-67 (lines=46) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentplan.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentsaving.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantcarbon.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorcarbon.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantsaving.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/storecarbon.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentcarbon.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorplan.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
#################################################################################################################### |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantcost.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentcost.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/storecost.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorcost.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorsaving.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
#################################################################################################################### |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentincome.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
#################################################################################################################### |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantplan.py 1 location
|
@@ 23-67 (lines=45) @@
|
20 |
|
######################################################################################################################## |
21 |
|
|
22 |
|
|
23 |
|
def export(report, |
24 |
|
name, |
25 |
|
base_period_start_datetime_local, |
26 |
|
base_period_end_datetime_local, |
27 |
|
reporting_start_datetime_local, |
28 |
|
reporting_end_datetime_local, |
29 |
|
period_type, |
30 |
|
language): |
31 |
|
#################################################################################################################### |
32 |
|
# Step 1: Validate the report data |
33 |
|
#################################################################################################################### |
34 |
|
if report is None: |
35 |
|
return None |
36 |
|
|
37 |
|
#################################################################################################################### |
38 |
|
# Step 2: Generate excel file from the report data |
39 |
|
#################################################################################################################### |
40 |
|
filename = generate_excel(report, |
41 |
|
name, |
42 |
|
base_period_start_datetime_local, |
43 |
|
base_period_end_datetime_local, |
44 |
|
reporting_start_datetime_local, |
45 |
|
reporting_end_datetime_local, |
46 |
|
period_type, |
47 |
|
language) |
48 |
|
#################################################################################################################### |
49 |
|
# Step 3: Encode the excel file to Base64 |
50 |
|
#################################################################################################################### |
51 |
|
binary_file_data = b'' |
52 |
|
try: |
53 |
|
with open(filename, 'rb') as binary_file: |
54 |
|
binary_file_data = binary_file.read() |
55 |
|
except IOError as ex: |
56 |
|
print(str(ex)) |
57 |
|
|
58 |
|
# Base64 encode the bytes |
59 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
60 |
|
# get the Base64 encoded data using human-readable characters. |
61 |
|
base64_message = base64_encoded_data.decode('utf-8') |
62 |
|
# delete the file from server |
63 |
|
try: |
64 |
|
os.remove(filename) |
65 |
|
except NotImplementedError as ex: |
66 |
|
print(str(ex)) |
67 |
|
return base64_message |
68 |
|
|
69 |
|
|
70 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentenergycategory.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/storeenergycategory.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantenergycategory.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentenergycategory.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/storeplan.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorenergycategory.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/storesaving.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/storeenergyitem.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorenergyitem.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantenergyitem.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentenergyitem.py 1 location
|
@@ 22-66 (lines=45) @@
|
19 |
|
######################################################################################################################## |
20 |
|
|
21 |
|
|
22 |
|
def export(report, |
23 |
|
name, |
24 |
|
base_period_start_datetime_local, |
25 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantbill.py 1 location
|
@@ 20-60 (lines=41) @@
|
17 |
|
######################################################################################################################## |
18 |
|
|
19 |
|
|
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
reporting_start_datetime_local, |
23 |
|
reporting_end_datetime_local, |
24 |
|
period_type, |
25 |
|
language): |
26 |
|
#################################################################################################################### |
27 |
|
# Step 1: Validate the report data |
28 |
|
#################################################################################################################### |
29 |
|
if report is None: |
30 |
|
return None |
31 |
|
|
32 |
|
#################################################################################################################### |
33 |
|
# Step 2: Generate excel file from the report data |
34 |
|
#################################################################################################################### |
35 |
|
filename = generate_excel(report, |
36 |
|
name, |
37 |
|
reporting_start_datetime_local, |
38 |
|
reporting_end_datetime_local, |
39 |
|
period_type, |
40 |
|
language) |
41 |
|
#################################################################################################################### |
42 |
|
# Step 3: Encode the excel file to Base64 |
43 |
|
#################################################################################################################### |
44 |
|
binary_file_data = b'' |
45 |
|
try: |
46 |
|
with open(filename, 'rb') as binary_file: |
47 |
|
binary_file_data = binary_file.read() |
48 |
|
except IOError as ex: |
49 |
|
print(str(ex)) |
50 |
|
|
51 |
|
# Base64 encode the bytes |
52 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
53 |
|
# get the Base64 encoded data using human-readable characters. |
54 |
|
base64_message = base64_encoded_data.decode('utf-8') |
55 |
|
# delete the file from server |
56 |
|
try: |
57 |
|
os.remove(filename) |
58 |
|
except NotImplementedError as ex: |
59 |
|
print(str(ex)) |
60 |
|
return base64_message |
61 |
|
|
62 |
|
|
63 |
|
def generate_excel(report, |
myems-api/excelexporters/metertracking.py 1 location
|
@@ 18-54 (lines=37) @@
|
15 |
|
# Step 2: Generate excelexporters file |
16 |
|
# Step 3: Encode the excelexporters file to Base64 |
17 |
|
######################################################################################################################## |
18 |
|
def export(result, space_name, energy_category_name, reporting_start_datetime_local, reporting_end_datetime_local, |
19 |
|
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
54 |
|
return base64_message |
55 |
|
|
56 |
|
|
57 |
|
def generate_excel(report, space_name, energy_category_name, reporting_start_datetime_local, |
myems-api/excelexporters/photovoltaicpowerstationreportingenergy.py 1 location
|
@@ 18-53 (lines=36) @@
|
15 |
|
# Step 3: Encode the excel file to Base64 |
16 |
|
######################################################################################################################## |
17 |
|
|
18 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
19 |
|
#################################################################################################################### |
20 |
|
# Step 1: Validate the report data |
21 |
|
#################################################################################################################### |
22 |
|
if report is None: |
23 |
|
return None |
24 |
|
|
25 |
|
#################################################################################################################### |
26 |
|
# Step 2: Generate excel file from the report data |
27 |
|
#################################################################################################################### |
28 |
|
filename = generate_excel(report, |
29 |
|
name, |
30 |
|
reporting_start_datetime_local, |
31 |
|
reporting_end_datetime_local, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, |
myems-api/excelexporters/energystoragepowerstationreportingenergy.py 1 location
|
@@ 18-53 (lines=36) @@
|
15 |
|
# Step 3: Encode the excel file to Base64 |
16 |
|
######################################################################################################################## |
17 |
|
|
18 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
19 |
|
#################################################################################################################### |
20 |
|
# Step 1: Validate the report data |
21 |
|
#################################################################################################################### |
22 |
|
if report is None: |
23 |
|
return None |
24 |
|
|
25 |
|
#################################################################################################################### |
26 |
|
# Step 2: Generate excel file from the report data |
27 |
|
#################################################################################################################### |
28 |
|
filename = generate_excel(report, |
29 |
|
name, |
30 |
|
reporting_start_datetime_local, |
31 |
|
reporting_end_datetime_local, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, |
myems-api/excelexporters/microgridreporting.py 1 location
|
@@ 15-53 (lines=39) @@
|
12 |
|
# Step 3: Encode the excel file to Base64 |
13 |
|
######################################################################################################################## |
14 |
|
|
15 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
16 |
|
base_period_end_datetime, period_type, language): |
17 |
|
#################################################################################################################### |
18 |
|
# Step 1: Validate the report data |
19 |
|
#################################################################################################################### |
20 |
|
if report is None: |
21 |
|
return None |
22 |
|
|
23 |
|
#################################################################################################################### |
24 |
|
# Step 2: Generate excel file from the report data |
25 |
|
#################################################################################################################### |
26 |
|
filename = generate_excel(report, |
27 |
|
name, |
28 |
|
reporting_start_datetime_local, |
29 |
|
reporting_end_datetime_local, |
30 |
|
base_period_start_datetime, |
31 |
|
base_period_end_datetime, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/microgridreportingrevenue.py 1 location
|
@@ 15-53 (lines=39) @@
|
12 |
|
# Step 3: Encode the excel file to Base64 |
13 |
|
######################################################################################################################## |
14 |
|
|
15 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
16 |
|
base_period_end_datetime, period_type, language): |
17 |
|
#################################################################################################################### |
18 |
|
# Step 1: Validate the report data |
19 |
|
#################################################################################################################### |
20 |
|
if report is None: |
21 |
|
return None |
22 |
|
|
23 |
|
#################################################################################################################### |
24 |
|
# Step 2: Generate excel file from the report data |
25 |
|
#################################################################################################################### |
26 |
|
filename = generate_excel(report, |
27 |
|
name, |
28 |
|
reporting_start_datetime_local, |
29 |
|
reporting_end_datetime_local, |
30 |
|
base_period_start_datetime, |
31 |
|
base_period_end_datetime, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/microgridreportingenergy.py 1 location
|
@@ 15-53 (lines=39) @@
|
12 |
|
# Step 3: Encode the excel file to Base64 |
13 |
|
######################################################################################################################## |
14 |
|
|
15 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
16 |
|
base_period_end_datetime, period_type, language): |
17 |
|
#################################################################################################################### |
18 |
|
# Step 1: Validate the report data |
19 |
|
#################################################################################################################### |
20 |
|
if report is None: |
21 |
|
return None |
22 |
|
|
23 |
|
#################################################################################################################### |
24 |
|
# Step 2: Generate excel file from the report data |
25 |
|
#################################################################################################################### |
26 |
|
filename = generate_excel(report, |
27 |
|
name, |
28 |
|
reporting_start_datetime_local, |
29 |
|
reporting_end_datetime_local, |
30 |
|
base_period_start_datetime, |
31 |
|
base_period_end_datetime, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/microgridreportingcarbon.py 1 location
|
@@ 15-53 (lines=39) @@
|
12 |
|
# Step 3: Encode the excel file to Base64 |
13 |
|
######################################################################################################################## |
14 |
|
|
15 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
16 |
|
base_period_end_datetime, period_type, language): |
17 |
|
#################################################################################################################### |
18 |
|
# Step 1: Validate the report data |
19 |
|
#################################################################################################################### |
20 |
|
if report is None: |
21 |
|
return None |
22 |
|
|
23 |
|
#################################################################################################################### |
24 |
|
# Step 2: Generate excel file from the report data |
25 |
|
#################################################################################################################### |
26 |
|
filename = generate_excel(report, |
27 |
|
name, |
28 |
|
reporting_start_datetime_local, |
29 |
|
reporting_end_datetime_local, |
30 |
|
base_period_start_datetime, |
31 |
|
base_period_end_datetime, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/photovoltaicpowerstationreportingrevenue.py 1 location
|
@@ 18-53 (lines=36) @@
|
15 |
|
# Step 3: Encode the excel file to Base64 |
16 |
|
######################################################################################################################## |
17 |
|
|
18 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
19 |
|
#################################################################################################################### |
20 |
|
# Step 1: Validate the report data |
21 |
|
#################################################################################################################### |
22 |
|
if report is None: |
23 |
|
return None |
24 |
|
|
25 |
|
#################################################################################################################### |
26 |
|
# Step 2: Generate excel file from the report data |
27 |
|
#################################################################################################################### |
28 |
|
filename = generate_excel(report, |
29 |
|
name, |
30 |
|
reporting_start_datetime_local, |
31 |
|
reporting_end_datetime_local, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, |
myems-api/excelexporters/energystoragepowerstationreportingrevenue.py 1 location
|
@@ 18-53 (lines=36) @@
|
15 |
|
# Step 3: Encode the excel file to Base64 |
16 |
|
######################################################################################################################## |
17 |
|
|
18 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
19 |
|
#################################################################################################################### |
20 |
|
# Step 1: Validate the report data |
21 |
|
#################################################################################################################### |
22 |
|
if report is None: |
23 |
|
return None |
24 |
|
|
25 |
|
#################################################################################################################### |
26 |
|
# Step 2: Generate excel file from the report data |
27 |
|
#################################################################################################################### |
28 |
|
filename = generate_excel(report, |
29 |
|
name, |
30 |
|
reporting_start_datetime_local, |
31 |
|
reporting_end_datetime_local, |
32 |
|
period_type, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
53 |
|
return base64_message |
54 |
|
|
55 |
|
|
56 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentoutput.py 1 location
|
@@ 21-66 (lines=46) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceload.py 1 location
|
@@ 21-66 (lines=46) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentstatistics.py 1 location
|
@@ 21-66 (lines=46) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceefficiency.py 1 location
|
@@ 21-66 (lines=46) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
42 |
|
base_period_end_datetime_local, |
43 |
|
reporting_start_datetime_local, |
44 |
|
reporting_end_datetime_local, |
45 |
|
period_type, |
46 |
|
language) |
47 |
|
#################################################################################################################### |
48 |
|
# Step 3: Encode the excel file to Base64 |
49 |
|
#################################################################################################################### |
50 |
|
binary_file_data = b'' |
51 |
|
try: |
52 |
|
with open(filename, 'rb') as binary_file: |
53 |
|
binary_file_data = binary_file.read() |
54 |
|
except IOError as ex: |
55 |
|
print(str(ex)) |
56 |
|
|
57 |
|
# Base64 encode the bytes |
58 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
59 |
|
# get the Base64 encoded data using human-readable characters. |
60 |
|
base64_message = base64_encoded_data.decode('utf-8') |
61 |
|
# delete the file from server |
62 |
|
try: |
63 |
|
os.remove(filename) |
64 |
|
except NotImplementedError as ex: |
65 |
|
print(str(ex)) |
66 |
|
return base64_message |
67 |
|
|
68 |
|
|
69 |
|
def generate_excel(report, |
myems-api/excelexporters/spacestatistics.py 1 location
|
@@ 20-65 (lines=46) @@
|
17 |
|
######################################################################################################################## |
18 |
|
|
19 |
|
|
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentoutput.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
#################################################################################################################### |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/storeload.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorstatistics.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentstatistics.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantstatistics.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentefficiency.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentefficiency.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantload.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentload.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorload.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentload.py 1 location
|
@@ 21-65 (lines=45) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(report, |
22 |
|
name, |
23 |
|
base_period_start_datetime_local, |
24 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
41 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
65 |
|
return base64_message |
66 |
|
|
67 |
|
|
68 |
|
def generate_excel(report, |
myems-api/excelexporters/virtualmetersaving.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/virtualmeterplan.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/virtualmeterenergy.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/metersaving.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/offlinemeterplan.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/storestatistics.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
######################################################################################################################## |
18 |
|
|
19 |
|
|
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/meterplan.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/offlinemeterenergy.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(result, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 result is None: |
32 |
|
return None |
33 |
|
|
34 |
|
#################################################################################################################### |
35 |
|
# Step 2: Generate excel file from the report data |
36 |
|
#################################################################################################################### |
37 |
|
filename = generate_excel(result, |
38 |
|
name, |
39 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/offlinemetersaving.py 1 location
|
@@ 20-64 (lines=45) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, |
21 |
|
name, |
22 |
|
base_period_start_datetime_local, |
23 |
|
base_period_end_datetime_local, |
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 |
|
base_period_start_datetime_local, |
40 |
|
base_period_end_datetime_local, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
64 |
|
return base64_message |
65 |
|
|
66 |
|
|
67 |
|
def generate_excel(report, |
myems-api/excelexporters/metertrend.py 1 location
|
@@ 21-62 (lines=42) @@
|
18 |
|
######################################################################################################################## |
19 |
|
|
20 |
|
|
21 |
|
def export(result, |
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 result is None: |
31 |
|
return None |
32 |
|
|
33 |
|
#################################################################################################################### |
34 |
|
# Step 2: Generate excel file from the report data |
35 |
|
#################################################################################################################### |
36 |
|
filename = generate_excel(result, |
37 |
|
name, |
38 |
|
reporting_start_datetime_local, |
39 |
|
reporting_end_datetime_local, |
40 |
|
period_type, |
41 |
|
language) |
42 |
|
|
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
62 |
|
return base64_message |
63 |
|
|
64 |
|
|
65 |
|
def generate_excel(report, |
myems-api/excelexporters/meterenergy.py 1 location
|
@@ 20-58 (lines=39) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
21 |
|
base_period_end_datetime, period_type, language): |
22 |
|
#################################################################################################################### |
23 |
|
# Step 1: Validate the report data |
24 |
|
#################################################################################################################### |
25 |
|
if report is None: |
26 |
|
return None |
27 |
|
|
28 |
|
#################################################################################################################### |
29 |
|
# Step 2: Generate excel file from the report data |
30 |
|
#################################################################################################################### |
31 |
|
filename = generate_excel(report, |
32 |
|
name, |
33 |
|
reporting_start_datetime_local, |
34 |
|
reporting_end_datetime_local, |
35 |
|
base_period_start_datetime, |
36 |
|
base_period_end_datetime, |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
58 |
|
return base64_message |
59 |
|
|
60 |
|
|
61 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/metercomparison.py 1 location
|
@@ 20-56 (lines=37) @@
|
17 |
|
# Step 2: Generate excel file from the report data |
18 |
|
# Step 3: Encode the excel file to Base64 |
19 |
|
######################################################################################################################## |
20 |
|
def export(result, name1, name2, 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 |
|
name1, |
32 |
|
name2, |
33 |
|
reporting_start_datetime_local, |
34 |
|
reporting_end_datetime_local, |
35 |
|
period_type, |
36 |
|
language) |
37 |
|
#################################################################################################################### |
38 |
|
# Step 3: Encode the excel file to Base64 |
39 |
|
#################################################################################################################### |
40 |
|
binary_file_data = b'' |
41 |
|
try: |
42 |
|
with open(filename, 'rb') as binary_file: |
43 |
|
binary_file_data = binary_file.read() |
44 |
|
except IOError as ex: |
45 |
|
print(str(ex)) |
46 |
|
|
47 |
|
# Base64 encode the bytes |
48 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
49 |
|
# get the Base64 encoded data using human-readable characters. |
50 |
|
base64_message = base64_encoded_data.decode('utf-8') |
51 |
|
# delete the file from server |
52 |
|
try: |
53 |
|
os.remove(filename) |
54 |
|
except NotImplementedError as ex: |
55 |
|
print(str(ex)) |
56 |
|
return base64_message |
57 |
|
|
58 |
|
|
59 |
|
def generate_excel(report, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type, |
myems-api/excelexporters/metersubmetersbalance.py 1 location
|
@@ 20-55 (lines=36) @@
|
17 |
|
# Step 2: Generate excelexporters file |
18 |
|
# Step 3: Encode the excelexporters file to Base64 |
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 |
|
print(str(ex)) |
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 |
|
print(str(ex)) |
55 |
|
return base64_message |
56 |
|
|
57 |
|
|
58 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |