myems-api/excelexporters/storecomparison.py 1 location
|
@@ 20-68 (lines=49) @@
|
| 17 |
|
# Step 2: Generate excel file from the report data |
| 18 |
|
# Step 3: Encode the excel file to Base64 |
| 19 |
|
######################################################################################################################## |
| 20 |
|
def export( |
| 21 |
|
result, |
| 22 |
|
store1_name, |
| 23 |
|
store2_name, |
| 24 |
|
energy_category_name, |
| 25 |
|
reporting_start_datetime_local, |
| 26 |
|
reporting_end_datetime_local, |
| 27 |
|
period_type, |
| 28 |
|
language, |
| 29 |
|
): |
| 30 |
|
#################################################################################################################### |
| 31 |
|
# Step 1: Validate the report data |
| 32 |
|
#################################################################################################################### |
| 33 |
|
if result is None: |
| 34 |
|
return None |
| 35 |
|
|
| 36 |
|
#################################################################################################################### |
| 37 |
|
# Step 2: Generate excel file from the report data |
| 38 |
|
#################################################################################################################### |
| 39 |
|
filename = generate_excel( |
| 40 |
|
result, |
| 41 |
|
store1_name, |
| 42 |
|
store2_name, |
| 43 |
|
energy_category_name, |
| 44 |
|
reporting_start_datetime_local, |
| 45 |
|
reporting_end_datetime_local, |
| 46 |
|
period_type, |
| 47 |
|
language, |
| 48 |
|
) |
| 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( |
myems-api/excelexporters/spacecomparison.py 1 location
|
@@ 20-68 (lines=49) @@
|
| 17 |
|
# Step 2: Generate excel file from the report data |
| 18 |
|
# Step 3: Encode the excel file to Base64 |
| 19 |
|
######################################################################################################################## |
| 20 |
|
def export( |
| 21 |
|
result, |
| 22 |
|
space1_name, |
| 23 |
|
space2_name, |
| 24 |
|
energy_category_name, |
| 25 |
|
reporting_start_datetime_local, |
| 26 |
|
reporting_end_datetime_local, |
| 27 |
|
period_type, |
| 28 |
|
language, |
| 29 |
|
): |
| 30 |
|
#################################################################################################################### |
| 31 |
|
# Step 1: Validate the report data |
| 32 |
|
#################################################################################################################### |
| 33 |
|
if result is None: |
| 34 |
|
return None |
| 35 |
|
|
| 36 |
|
#################################################################################################################### |
| 37 |
|
# Step 2: Generate excel file from the report data |
| 38 |
|
#################################################################################################################### |
| 39 |
|
filename = generate_excel( |
| 40 |
|
result, |
| 41 |
|
space1_name, |
| 42 |
|
space2_name, |
| 43 |
|
energy_category_name, |
| 44 |
|
reporting_start_datetime_local, |
| 45 |
|
reporting_end_datetime_local, |
| 46 |
|
period_type, |
| 47 |
|
language, |
| 48 |
|
) |
| 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( |
myems-api/excelexporters/combinedequipmentcomparison.py 1 location
|
@@ 20-68 (lines=49) @@
|
| 17 |
|
# Step 2: Generate excel file from the report data |
| 18 |
|
# Step 3: Encode the excel file to Base64 |
| 19 |
|
######################################################################################################################## |
| 20 |
|
def export( |
| 21 |
|
result, |
| 22 |
|
combined_equipment1_name, |
| 23 |
|
combined_equipment2_name, |
| 24 |
|
energy_category_name, |
| 25 |
|
reporting_start_datetime_local, |
| 26 |
|
reporting_end_datetime_local, |
| 27 |
|
period_type, |
| 28 |
|
language, |
| 29 |
|
): |
| 30 |
|
#################################################################################################################### |
| 31 |
|
# Step 1: Validate the report data |
| 32 |
|
#################################################################################################################### |
| 33 |
|
if result is None: |
| 34 |
|
return None |
| 35 |
|
|
| 36 |
|
#################################################################################################################### |
| 37 |
|
# Step 2: Generate excel file from the report data |
| 38 |
|
#################################################################################################################### |
| 39 |
|
filename = generate_excel( |
| 40 |
|
result, |
| 41 |
|
combined_equipment1_name, |
| 42 |
|
combined_equipment2_name, |
| 43 |
|
energy_category_name, |
| 44 |
|
reporting_start_datetime_local, |
| 45 |
|
reporting_end_datetime_local, |
| 46 |
|
period_type, |
| 47 |
|
language, |
| 48 |
|
) |
| 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( |
myems-api/excelexporters/equipmentcomparison.py 1 location
|
@@ 20-68 (lines=49) @@
|
| 17 |
|
# Step 2: Generate excel file from the report data |
| 18 |
|
# Step 3: Encode the excel file to Base64 |
| 19 |
|
######################################################################################################################## |
| 20 |
|
def export( |
| 21 |
|
result, |
| 22 |
|
equipment1_name, |
| 23 |
|
equipment2_name, |
| 24 |
|
energy_category_name, |
| 25 |
|
reporting_start_datetime_local, |
| 26 |
|
reporting_end_datetime_local, |
| 27 |
|
period_type, |
| 28 |
|
language, |
| 29 |
|
): |
| 30 |
|
#################################################################################################################### |
| 31 |
|
# Step 1: Validate the report data |
| 32 |
|
#################################################################################################################### |
| 33 |
|
if result is None: |
| 34 |
|
return None |
| 35 |
|
|
| 36 |
|
#################################################################################################################### |
| 37 |
|
# Step 2: Generate excel file from the report data |
| 38 |
|
#################################################################################################################### |
| 39 |
|
filename = generate_excel( |
| 40 |
|
result, |
| 41 |
|
equipment1_name, |
| 42 |
|
equipment2_name, |
| 43 |
|
energy_category_name, |
| 44 |
|
reporting_start_datetime_local, |
| 45 |
|
reporting_end_datetime_local, |
| 46 |
|
period_type, |
| 47 |
|
language, |
| 48 |
|
) |
| 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( |
myems-api/excelexporters/shopfloorcomparison.py 1 location
|
@@ 20-68 (lines=49) @@
|
| 17 |
|
# Step 2: Generate excel file from the report data |
| 18 |
|
# Step 3: Encode the excel file to Base64 |
| 19 |
|
######################################################################################################################## |
| 20 |
|
def export( |
| 21 |
|
result, |
| 22 |
|
shopfloor1_name, |
| 23 |
|
shopfloor2_name, |
| 24 |
|
energy_category_name, |
| 25 |
|
reporting_start_datetime_local, |
| 26 |
|
reporting_end_datetime_local, |
| 27 |
|
period_type, |
| 28 |
|
language, |
| 29 |
|
): |
| 30 |
|
#################################################################################################################### |
| 31 |
|
# Step 1: Validate the report data |
| 32 |
|
#################################################################################################################### |
| 33 |
|
if result is None: |
| 34 |
|
return None |
| 35 |
|
|
| 36 |
|
#################################################################################################################### |
| 37 |
|
# Step 2: Generate excel file from the report data |
| 38 |
|
#################################################################################################################### |
| 39 |
|
filename = generate_excel( |
| 40 |
|
result, |
| 41 |
|
shopfloor1_name, |
| 42 |
|
shopfloor2_name, |
| 43 |
|
energy_category_name, |
| 44 |
|
reporting_start_datetime_local, |
| 45 |
|
reporting_end_datetime_local, |
| 46 |
|
period_type, |
| 47 |
|
language, |
| 48 |
|
) |
| 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( |
myems-api/excelexporters/tenantcomparison.py 1 location
|
@@ 20-68 (lines=49) @@
|
| 17 |
|
# Step 2: Generate excel file from the report data |
| 18 |
|
# Step 3: Encode the excel file to Base64 |
| 19 |
|
######################################################################################################################## |
| 20 |
|
def export( |
| 21 |
|
result, |
| 22 |
|
tenant1_name, |
| 23 |
|
tenant2_name, |
| 24 |
|
energy_category_name, |
| 25 |
|
reporting_start_datetime_local, |
| 26 |
|
reporting_end_datetime_local, |
| 27 |
|
period_type, |
| 28 |
|
language, |
| 29 |
|
): |
| 30 |
|
#################################################################################################################### |
| 31 |
|
# Step 1: Validate the report data |
| 32 |
|
#################################################################################################################### |
| 33 |
|
if result is None: |
| 34 |
|
return None |
| 35 |
|
|
| 36 |
|
#################################################################################################################### |
| 37 |
|
# Step 2: Generate excel file from the report data |
| 38 |
|
#################################################################################################################### |
| 39 |
|
filename = generate_excel( |
| 40 |
|
result, |
| 41 |
|
tenant1_name, |
| 42 |
|
tenant2_name, |
| 43 |
|
energy_category_name, |
| 44 |
|
reporting_start_datetime_local, |
| 45 |
|
reporting_end_datetime_local, |
| 46 |
|
period_type, |
| 47 |
|
language, |
| 48 |
|
) |
| 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( |
myems-api/excelexporters/spacecarbon.py 1 location
|
@@ 51-96 (lines=46) @@
|
| 48 |
|
######################################################################################################################## |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
def export(report, |
| 52 |
|
name, |
| 53 |
|
base_period_start_datetime_local, |
| 54 |
|
base_period_end_datetime_local, |
| 55 |
|
reporting_start_datetime_local, |
| 56 |
|
reporting_end_datetime_local, |
| 57 |
|
period_type, |
| 58 |
|
language): |
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 1: Validate the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
if report is None: |
| 63 |
|
return None |
| 64 |
|
print(report) |
| 65 |
|
|
| 66 |
|
#################################################################################################################### |
| 67 |
|
# Step 2: Generate excel file from the report data |
| 68 |
|
#################################################################################################################### |
| 69 |
|
filename = generate_excel(report, |
| 70 |
|
name, |
| 71 |
|
base_period_start_datetime_local, |
| 72 |
|
base_period_end_datetime_local, |
| 73 |
|
reporting_start_datetime_local, |
| 74 |
|
reporting_end_datetime_local, |
| 75 |
|
period_type, |
| 76 |
|
language) |
| 77 |
|
#################################################################################################################### |
| 78 |
|
# Step 3: Encode the excel file to Base64 |
| 79 |
|
#################################################################################################################### |
| 80 |
|
binary_file_data = b'' |
| 81 |
|
try: |
| 82 |
|
with open(filename, 'rb') as binary_file: |
| 83 |
|
binary_file_data = binary_file.read() |
| 84 |
|
except IOError as ex: |
| 85 |
|
print(str(ex)) |
| 86 |
|
|
| 87 |
|
# Base64 encode the bytes |
| 88 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 89 |
|
# get the Base64 encoded data using human-readable characters. |
| 90 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 91 |
|
# delete the file from server |
| 92 |
|
try: |
| 93 |
|
os.remove(filename) |
| 94 |
|
except NotImplementedError as ex: |
| 95 |
|
print(str(ex)) |
| 96 |
|
return base64_message |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceincome.py 1 location
|
@@ 50-95 (lines=46) @@
|
| 47 |
|
#################################################################################################################### |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
def export(report, |
| 51 |
|
name, |
| 52 |
|
base_period_start_datetime_local, |
| 53 |
|
base_period_end_datetime_local, |
| 54 |
|
reporting_start_datetime_local, |
| 55 |
|
reporting_end_datetime_local, |
| 56 |
|
period_type, |
| 57 |
|
language): |
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 1: Validate the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
if report is None: |
| 62 |
|
return None |
| 63 |
|
print(report) |
| 64 |
|
|
| 65 |
|
#################################################################################################################### |
| 66 |
|
# Step 2: Generate excel file from the report data |
| 67 |
|
#################################################################################################################### |
| 68 |
|
filename = generate_excel(report, |
| 69 |
|
name, |
| 70 |
|
base_period_start_datetime_local, |
| 71 |
|
base_period_end_datetime_local, |
| 72 |
|
reporting_start_datetime_local, |
| 73 |
|
reporting_end_datetime_local, |
| 74 |
|
period_type, |
| 75 |
|
language) |
| 76 |
|
#################################################################################################################### |
| 77 |
|
# Step 3: Encode the excel file to Base64 |
| 78 |
|
#################################################################################################################### |
| 79 |
|
binary_file_data = b'' |
| 80 |
|
try: |
| 81 |
|
with open(filename, 'rb') as binary_file: |
| 82 |
|
binary_file_data = binary_file.read() |
| 83 |
|
except IOError as ex: |
| 84 |
|
print(str(ex)) |
| 85 |
|
|
| 86 |
|
# Base64 encode the bytes |
| 87 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 88 |
|
# get the Base64 encoded data using human-readable characters. |
| 89 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 90 |
|
# delete the file from server |
| 91 |
|
try: |
| 92 |
|
os.remove(filename) |
| 93 |
|
except NotImplementedError as ex: |
| 94 |
|
print(str(ex)) |
| 95 |
|
return base64_message |
| 96 |
|
|
| 97 |
|
|
| 98 |
|
def generate_excel(report, |
myems-api/excelexporters/spacecost.py 1 location
|
@@ 50-95 (lines=46) @@
|
| 47 |
|
######################################################################################################################## |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
def export(report, |
| 51 |
|
name, |
| 52 |
|
base_period_start_datetime_local, |
| 53 |
|
base_period_end_datetime_local, |
| 54 |
|
reporting_start_datetime_local, |
| 55 |
|
reporting_end_datetime_local, |
| 56 |
|
period_type, |
| 57 |
|
language): |
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 1: Validate the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
if report is None: |
| 62 |
|
return None |
| 63 |
|
print(report) |
| 64 |
|
|
| 65 |
|
#################################################################################################################### |
| 66 |
|
# Step 2: Generate excel file from the report data |
| 67 |
|
#################################################################################################################### |
| 68 |
|
filename = generate_excel(report, |
| 69 |
|
name, |
| 70 |
|
base_period_start_datetime_local, |
| 71 |
|
base_period_end_datetime_local, |
| 72 |
|
reporting_start_datetime_local, |
| 73 |
|
reporting_end_datetime_local, |
| 74 |
|
period_type, |
| 75 |
|
language) |
| 76 |
|
#################################################################################################################### |
| 77 |
|
# Step 3: Encode the excel file to Base64 |
| 78 |
|
#################################################################################################################### |
| 79 |
|
binary_file_data = b'' |
| 80 |
|
try: |
| 81 |
|
with open(filename, 'rb') as binary_file: |
| 82 |
|
binary_file_data = binary_file.read() |
| 83 |
|
except IOError as ex: |
| 84 |
|
print(str(ex)) |
| 85 |
|
|
| 86 |
|
# Base64 encode the bytes |
| 87 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 88 |
|
# get the Base64 encoded data using human-readable characters. |
| 89 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 90 |
|
# delete the file from server |
| 91 |
|
try: |
| 92 |
|
os.remove(filename) |
| 93 |
|
except NotImplementedError as ex: |
| 94 |
|
print(str(ex)) |
| 95 |
|
return base64_message |
| 96 |
|
|
| 97 |
|
|
| 98 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceplan.py 1 location
|
@@ 49-94 (lines=46) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
print(report) |
| 63 |
|
|
| 64 |
|
#################################################################################################################### |
| 65 |
|
# Step 2: Generate excel file from the report data |
| 66 |
|
#################################################################################################################### |
| 67 |
|
filename = generate_excel(report, |
| 68 |
|
name, |
| 69 |
|
base_period_start_datetime_local, |
| 70 |
|
base_period_end_datetime_local, |
| 71 |
|
reporting_start_datetime_local, |
| 72 |
|
reporting_end_datetime_local, |
| 73 |
|
period_type, |
| 74 |
|
language) |
| 75 |
|
#################################################################################################################### |
| 76 |
|
# Step 3: Encode the excel file to Base64 |
| 77 |
|
#################################################################################################################### |
| 78 |
|
binary_file_data = b'' |
| 79 |
|
try: |
| 80 |
|
with open(filename, 'rb') as binary_file: |
| 81 |
|
binary_file_data = binary_file.read() |
| 82 |
|
except IOError as ex: |
| 83 |
|
print(str(ex)) |
| 84 |
|
|
| 85 |
|
# Base64 encode the bytes |
| 86 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 87 |
|
# get the Base64 encoded data using human-readable characters. |
| 88 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 89 |
|
# delete the file from server |
| 90 |
|
try: |
| 91 |
|
os.remove(filename) |
| 92 |
|
except NotImplementedError as ex: |
| 93 |
|
print(str(ex)) |
| 94 |
|
return base64_message |
| 95 |
|
|
| 96 |
|
|
| 97 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceoutput.py 1 location
|
@@ 49-94 (lines=46) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
print(report) |
| 63 |
|
|
| 64 |
|
#################################################################################################################### |
| 65 |
|
# Step 2: Generate excel file from the report data |
| 66 |
|
#################################################################################################################### |
| 67 |
|
filename = generate_excel(report, |
| 68 |
|
name, |
| 69 |
|
base_period_start_datetime_local, |
| 70 |
|
base_period_end_datetime_local, |
| 71 |
|
reporting_start_datetime_local, |
| 72 |
|
reporting_end_datetime_local, |
| 73 |
|
period_type, |
| 74 |
|
language) |
| 75 |
|
#################################################################################################################### |
| 76 |
|
# Step 3: Encode the excel file to Base64 |
| 77 |
|
#################################################################################################################### |
| 78 |
|
binary_file_data = b'' |
| 79 |
|
try: |
| 80 |
|
with open(filename, 'rb') as binary_file: |
| 81 |
|
binary_file_data = binary_file.read() |
| 82 |
|
except IOError as ex: |
| 83 |
|
print(str(ex)) |
| 84 |
|
|
| 85 |
|
# Base64 encode the bytes |
| 86 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 87 |
|
# get the Base64 encoded data using human-readable characters. |
| 88 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 89 |
|
# delete the file from server |
| 90 |
|
try: |
| 91 |
|
os.remove(filename) |
| 92 |
|
except NotImplementedError as ex: |
| 93 |
|
print(str(ex)) |
| 94 |
|
return base64_message |
| 95 |
|
|
| 96 |
|
|
| 97 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentcarbon.py 1 location
|
@@ 49-94 (lines=46) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
print(report) |
| 63 |
|
|
| 64 |
|
#################################################################################################################### |
| 65 |
|
# Step 2: Generate excel file from the report data |
| 66 |
|
#################################################################################################################### |
| 67 |
|
filename = generate_excel(report, |
| 68 |
|
name, |
| 69 |
|
base_period_start_datetime_local, |
| 70 |
|
base_period_end_datetime_local, |
| 71 |
|
reporting_start_datetime_local, |
| 72 |
|
reporting_end_datetime_local, |
| 73 |
|
period_type, |
| 74 |
|
language) |
| 75 |
|
#################################################################################################################### |
| 76 |
|
# Step 3: Encode the excel file to Base64 |
| 77 |
|
#################################################################################################################### |
| 78 |
|
binary_file_data = b'' |
| 79 |
|
try: |
| 80 |
|
with open(filename, 'rb') as binary_file: |
| 81 |
|
binary_file_data = binary_file.read() |
| 82 |
|
except IOError as ex: |
| 83 |
|
print(str(ex)) |
| 84 |
|
|
| 85 |
|
# Base64 encode the bytes |
| 86 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 87 |
|
# get the Base64 encoded data using human-readable characters. |
| 88 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 89 |
|
# delete the file from server |
| 90 |
|
try: |
| 91 |
|
os.remove(filename) |
| 92 |
|
except NotImplementedError as ex: |
| 93 |
|
print(str(ex)) |
| 94 |
|
return base64_message |
| 95 |
|
|
| 96 |
|
|
| 97 |
|
def generate_excel(report, |
myems-api/excelexporters/spacesaving.py 1 location
|
@@ 49-94 (lines=46) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
print(report) |
| 63 |
|
|
| 64 |
|
#################################################################################################################### |
| 65 |
|
# Step 2: Generate excel file from the report data |
| 66 |
|
#################################################################################################################### |
| 67 |
|
filename = generate_excel(report, |
| 68 |
|
name, |
| 69 |
|
base_period_start_datetime_local, |
| 70 |
|
base_period_end_datetime_local, |
| 71 |
|
reporting_start_datetime_local, |
| 72 |
|
reporting_end_datetime_local, |
| 73 |
|
period_type, |
| 74 |
|
language) |
| 75 |
|
#################################################################################################################### |
| 76 |
|
# Step 3: Encode the excel file to Base64 |
| 77 |
|
#################################################################################################################### |
| 78 |
|
binary_file_data = b'' |
| 79 |
|
try: |
| 80 |
|
with open(filename, 'rb') as binary_file: |
| 81 |
|
binary_file_data = binary_file.read() |
| 82 |
|
except IOError as ex: |
| 83 |
|
print(str(ex)) |
| 84 |
|
|
| 85 |
|
# Base64 encode the bytes |
| 86 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 87 |
|
# get the Base64 encoded data using human-readable characters. |
| 88 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 89 |
|
# delete the file from server |
| 90 |
|
try: |
| 91 |
|
os.remove(filename) |
| 92 |
|
except NotImplementedError as ex: |
| 93 |
|
print(str(ex)) |
| 94 |
|
return base64_message |
| 95 |
|
|
| 96 |
|
|
| 97 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentincome.py 1 location
|
@@ 48-93 (lines=46) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
print(report) |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentplan.py 1 location
|
@@ 48-93 (lines=46) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
print(report) |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentsaving.py 1 location
|
@@ 48-93 (lines=46) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
print(report) |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentcost.py 1 location
|
@@ 48-93 (lines=46) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
print(report) |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceenergyitem.py 1 location
|
@@ 47-92 (lines=46) @@
|
| 44 |
|
#################################################################################################################### |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
def export(report, |
| 48 |
|
name, |
| 49 |
|
base_period_start_datetime_local, |
| 50 |
|
base_period_end_datetime_local, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language): |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 1: Validate the report data |
| 57 |
|
#################################################################################################################### |
| 58 |
|
if report is None: |
| 59 |
|
return None |
| 60 |
|
print(report) |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceenergycategory.py 1 location
|
@@ 47-92 (lines=46) @@
|
| 44 |
|
######################################################################################################################## |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
def export(report, |
| 48 |
|
name, |
| 49 |
|
base_period_start_datetime_local, |
| 50 |
|
base_period_end_datetime_local, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language): |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 1: Validate the report data |
| 57 |
|
#################################################################################################################### |
| 58 |
|
if report is None: |
| 59 |
|
return None |
| 60 |
|
print(report) |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceload.py 1 location
|
@@ 46-91 (lines=46) @@
|
| 43 |
|
######################################################################################################################## |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
def export(report, |
| 47 |
|
name, |
| 48 |
|
base_period_start_datetime_local, |
| 49 |
|
base_period_end_datetime_local, |
| 50 |
|
reporting_start_datetime_local, |
| 51 |
|
reporting_end_datetime_local, |
| 52 |
|
period_type, |
| 53 |
|
language): |
| 54 |
|
#################################################################################################################### |
| 55 |
|
# Step 1: Validate the report data |
| 56 |
|
#################################################################################################################### |
| 57 |
|
if report is None: |
| 58 |
|
return None |
| 59 |
|
print(report) |
| 60 |
|
|
| 61 |
|
#################################################################################################################### |
| 62 |
|
# Step 2: Generate excel file from the report data |
| 63 |
|
#################################################################################################################### |
| 64 |
|
filename = generate_excel(report, |
| 65 |
|
name, |
| 66 |
|
base_period_start_datetime_local, |
| 67 |
|
base_period_end_datetime_local, |
| 68 |
|
reporting_start_datetime_local, |
| 69 |
|
reporting_end_datetime_local, |
| 70 |
|
period_type, |
| 71 |
|
language) |
| 72 |
|
#################################################################################################################### |
| 73 |
|
# Step 3: Encode the excel file to Base64 |
| 74 |
|
#################################################################################################################### |
| 75 |
|
binary_file_data = b'' |
| 76 |
|
try: |
| 77 |
|
with open(filename, 'rb') as binary_file: |
| 78 |
|
binary_file_data = binary_file.read() |
| 79 |
|
except IOError as ex: |
| 80 |
|
print(str(ex)) |
| 81 |
|
|
| 82 |
|
# Base64 encode the bytes |
| 83 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 84 |
|
# get the Base64 encoded data using human-readable characters. |
| 85 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 86 |
|
# delete the file from server |
| 87 |
|
try: |
| 88 |
|
os.remove(filename) |
| 89 |
|
except NotImplementedError as ex: |
| 90 |
|
print(str(ex)) |
| 91 |
|
return base64_message |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
def generate_excel(report, |
myems-api/excelexporters/spaceefficiency.py 1 location
|
@@ 46-91 (lines=46) @@
|
| 43 |
|
######################################################################################################################## |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
def export(report, |
| 47 |
|
name, |
| 48 |
|
base_period_start_datetime_local, |
| 49 |
|
base_period_end_datetime_local, |
| 50 |
|
reporting_start_datetime_local, |
| 51 |
|
reporting_end_datetime_local, |
| 52 |
|
period_type, |
| 53 |
|
language): |
| 54 |
|
#################################################################################################################### |
| 55 |
|
# Step 1: Validate the report data |
| 56 |
|
#################################################################################################################### |
| 57 |
|
if report is None: |
| 58 |
|
return None |
| 59 |
|
print(report) |
| 60 |
|
|
| 61 |
|
#################################################################################################################### |
| 62 |
|
# Step 2: Generate excel file from the report data |
| 63 |
|
#################################################################################################################### |
| 64 |
|
filename = generate_excel(report, |
| 65 |
|
name, |
| 66 |
|
base_period_start_datetime_local, |
| 67 |
|
base_period_end_datetime_local, |
| 68 |
|
reporting_start_datetime_local, |
| 69 |
|
reporting_end_datetime_local, |
| 70 |
|
period_type, |
| 71 |
|
language) |
| 72 |
|
#################################################################################################################### |
| 73 |
|
# Step 3: Encode the excel file to Base64 |
| 74 |
|
#################################################################################################################### |
| 75 |
|
binary_file_data = b'' |
| 76 |
|
try: |
| 77 |
|
with open(filename, 'rb') as binary_file: |
| 78 |
|
binary_file_data = binary_file.read() |
| 79 |
|
except IOError as ex: |
| 80 |
|
print(str(ex)) |
| 81 |
|
|
| 82 |
|
# Base64 encode the bytes |
| 83 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 84 |
|
# get the Base64 encoded data using human-readable characters. |
| 85 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 86 |
|
# delete the file from server |
| 87 |
|
try: |
| 88 |
|
os.remove(filename) |
| 89 |
|
except NotImplementedError as ex: |
| 90 |
|
print(str(ex)) |
| 91 |
|
return base64_message |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
def generate_excel(report, |
myems-api/excelexporters/spacestatistics.py 1 location
|
@@ 45-90 (lines=46) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
print(report) |
| 59 |
|
|
| 60 |
|
#################################################################################################################### |
| 61 |
|
# Step 2: Generate excel file from the report data |
| 62 |
|
#################################################################################################################### |
| 63 |
|
filename = generate_excel(report, |
| 64 |
|
name, |
| 65 |
|
base_period_start_datetime_local, |
| 66 |
|
base_period_end_datetime_local, |
| 67 |
|
reporting_start_datetime_local, |
| 68 |
|
reporting_end_datetime_local, |
| 69 |
|
period_type, |
| 70 |
|
language) |
| 71 |
|
#################################################################################################################### |
| 72 |
|
# Step 3: Encode the excel file to Base64 |
| 73 |
|
#################################################################################################################### |
| 74 |
|
binary_file_data = b'' |
| 75 |
|
try: |
| 76 |
|
with open(filename, 'rb') as binary_file: |
| 77 |
|
binary_file_data = binary_file.read() |
| 78 |
|
except IOError as ex: |
| 79 |
|
print(str(ex)) |
| 80 |
|
|
| 81 |
|
# Base64 encode the bytes |
| 82 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 83 |
|
# get the Base64 encoded data using human-readable characters. |
| 84 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 85 |
|
# delete the file from server |
| 86 |
|
try: |
| 87 |
|
os.remove(filename) |
| 88 |
|
except NotImplementedError as ex: |
| 89 |
|
print(str(ex)) |
| 90 |
|
return base64_message |
| 91 |
|
|
| 92 |
|
|
| 93 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentenergyitem.py 1 location
|
@@ 45-90 (lines=46) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
print(report) |
| 59 |
|
|
| 60 |
|
#################################################################################################################### |
| 61 |
|
# Step 2: Generate excel file from the report data |
| 62 |
|
#################################################################################################################### |
| 63 |
|
filename = generate_excel(report, |
| 64 |
|
name, |
| 65 |
|
base_period_start_datetime_local, |
| 66 |
|
base_period_end_datetime_local, |
| 67 |
|
reporting_start_datetime_local, |
| 68 |
|
reporting_end_datetime_local, |
| 69 |
|
period_type, |
| 70 |
|
language) |
| 71 |
|
#################################################################################################################### |
| 72 |
|
# Step 3: Encode the excel file to Base64 |
| 73 |
|
#################################################################################################################### |
| 74 |
|
binary_file_data = b'' |
| 75 |
|
try: |
| 76 |
|
with open(filename, 'rb') as binary_file: |
| 77 |
|
binary_file_data = binary_file.read() |
| 78 |
|
except IOError as ex: |
| 79 |
|
print(str(ex)) |
| 80 |
|
|
| 81 |
|
# Base64 encode the bytes |
| 82 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 83 |
|
# get the Base64 encoded data using human-readable characters. |
| 84 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 85 |
|
# delete the file from server |
| 86 |
|
try: |
| 87 |
|
os.remove(filename) |
| 88 |
|
except NotImplementedError as ex: |
| 89 |
|
print(str(ex)) |
| 90 |
|
return base64_message |
| 91 |
|
|
| 92 |
|
|
| 93 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentoutput.py 1 location
|
@@ 44-89 (lines=46) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
print(report) |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentstatistics.py 1 location
|
@@ 44-89 (lines=46) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
print(report) |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantcarbon.py 1 location
|
@@ 49-93 (lines=45) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorcarbon.py 1 location
|
@@ 49-93 (lines=45) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/storecarbon.py 1 location
|
@@ 49-93 (lines=45) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentcarbon.py 1 location
|
@@ 49-93 (lines=45) @@
|
| 46 |
|
######################################################################################################################## |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
def export(report, |
| 50 |
|
name, |
| 51 |
|
base_period_start_datetime_local, |
| 52 |
|
base_period_end_datetime_local, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language): |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 1: Validate the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
if report is None: |
| 61 |
|
return None |
| 62 |
|
|
| 63 |
|
#################################################################################################################### |
| 64 |
|
# Step 2: Generate excel file from the report data |
| 65 |
|
#################################################################################################################### |
| 66 |
|
filename = generate_excel(report, |
| 67 |
|
name, |
| 68 |
|
base_period_start_datetime_local, |
| 69 |
|
base_period_end_datetime_local, |
| 70 |
|
reporting_start_datetime_local, |
| 71 |
|
reporting_end_datetime_local, |
| 72 |
|
period_type, |
| 73 |
|
language) |
| 74 |
|
#################################################################################################################### |
| 75 |
|
# Step 3: Encode the excel file to Base64 |
| 76 |
|
#################################################################################################################### |
| 77 |
|
binary_file_data = b'' |
| 78 |
|
try: |
| 79 |
|
with open(filename, 'rb') as binary_file: |
| 80 |
|
binary_file_data = binary_file.read() |
| 81 |
|
except IOError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
|
| 84 |
|
# Base64 encode the bytes |
| 85 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 86 |
|
# get the Base64 encoded data using human-readable characters. |
| 87 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 88 |
|
# delete the file from server |
| 89 |
|
try: |
| 90 |
|
os.remove(filename) |
| 91 |
|
except NotImplementedError as ex: |
| 92 |
|
print(str(ex)) |
| 93 |
|
return base64_message |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentplan.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentsaving.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantsaving.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorplan.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
#################################################################################################################### |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantcost.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentcost.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/storecost.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorcost.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorsaving.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
#################################################################################################################### |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentincome.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
#################################################################################################################### |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantplan.py 1 location
|
@@ 48-92 (lines=45) @@
|
| 45 |
|
######################################################################################################################## |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
def export(report, |
| 49 |
|
name, |
| 50 |
|
base_period_start_datetime_local, |
| 51 |
|
base_period_end_datetime_local, |
| 52 |
|
reporting_start_datetime_local, |
| 53 |
|
reporting_end_datetime_local, |
| 54 |
|
period_type, |
| 55 |
|
language): |
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 1: Validate the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
if report is None: |
| 60 |
|
return None |
| 61 |
|
|
| 62 |
|
#################################################################################################################### |
| 63 |
|
# Step 2: Generate excel file from the report data |
| 64 |
|
#################################################################################################################### |
| 65 |
|
filename = generate_excel(report, |
| 66 |
|
name, |
| 67 |
|
base_period_start_datetime_local, |
| 68 |
|
base_period_end_datetime_local, |
| 69 |
|
reporting_start_datetime_local, |
| 70 |
|
reporting_end_datetime_local, |
| 71 |
|
period_type, |
| 72 |
|
language) |
| 73 |
|
#################################################################################################################### |
| 74 |
|
# Step 3: Encode the excel file to Base64 |
| 75 |
|
#################################################################################################################### |
| 76 |
|
binary_file_data = b'' |
| 77 |
|
try: |
| 78 |
|
with open(filename, 'rb') as binary_file: |
| 79 |
|
binary_file_data = binary_file.read() |
| 80 |
|
except IOError as ex: |
| 81 |
|
print(str(ex)) |
| 82 |
|
|
| 83 |
|
# Base64 encode the bytes |
| 84 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 85 |
|
# get the Base64 encoded data using human-readable characters. |
| 86 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 87 |
|
# delete the file from server |
| 88 |
|
try: |
| 89 |
|
os.remove(filename) |
| 90 |
|
except NotImplementedError as ex: |
| 91 |
|
print(str(ex)) |
| 92 |
|
return base64_message |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
def generate_excel(report, |
myems-api/excelexporters/storeplan.py 1 location
|
@@ 47-91 (lines=45) @@
|
| 44 |
|
######################################################################################################################## |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
def export(report, |
| 48 |
|
name, |
| 49 |
|
base_period_start_datetime_local, |
| 50 |
|
base_period_end_datetime_local, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language): |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 1: Validate the report data |
| 57 |
|
#################################################################################################################### |
| 58 |
|
if report is None: |
| 59 |
|
return None |
| 60 |
|
|
| 61 |
|
#################################################################################################################### |
| 62 |
|
# Step 2: Generate excel file from the report data |
| 63 |
|
#################################################################################################################### |
| 64 |
|
filename = generate_excel(report, |
| 65 |
|
name, |
| 66 |
|
base_period_start_datetime_local, |
| 67 |
|
base_period_end_datetime_local, |
| 68 |
|
reporting_start_datetime_local, |
| 69 |
|
reporting_end_datetime_local, |
| 70 |
|
period_type, |
| 71 |
|
language) |
| 72 |
|
#################################################################################################################### |
| 73 |
|
# Step 3: Encode the excel file to Base64 |
| 74 |
|
#################################################################################################################### |
| 75 |
|
binary_file_data = b'' |
| 76 |
|
try: |
| 77 |
|
with open(filename, 'rb') as binary_file: |
| 78 |
|
binary_file_data = binary_file.read() |
| 79 |
|
except IOError as ex: |
| 80 |
|
print(str(ex)) |
| 81 |
|
|
| 82 |
|
# Base64 encode the bytes |
| 83 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 84 |
|
# get the Base64 encoded data using human-readable characters. |
| 85 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 86 |
|
# delete the file from server |
| 87 |
|
try: |
| 88 |
|
os.remove(filename) |
| 89 |
|
except NotImplementedError as ex: |
| 90 |
|
print(str(ex)) |
| 91 |
|
return base64_message |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
def generate_excel(report, |
myems-api/excelexporters/storesaving.py 1 location
|
@@ 47-91 (lines=45) @@
|
| 44 |
|
######################################################################################################################## |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
def export(report, |
| 48 |
|
name, |
| 49 |
|
base_period_start_datetime_local, |
| 50 |
|
base_period_end_datetime_local, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language): |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 1: Validate the report data |
| 57 |
|
#################################################################################################################### |
| 58 |
|
if report is None: |
| 59 |
|
return None |
| 60 |
|
|
| 61 |
|
#################################################################################################################### |
| 62 |
|
# Step 2: Generate excel file from the report data |
| 63 |
|
#################################################################################################################### |
| 64 |
|
filename = generate_excel(report, |
| 65 |
|
name, |
| 66 |
|
base_period_start_datetime_local, |
| 67 |
|
base_period_end_datetime_local, |
| 68 |
|
reporting_start_datetime_local, |
| 69 |
|
reporting_end_datetime_local, |
| 70 |
|
period_type, |
| 71 |
|
language) |
| 72 |
|
#################################################################################################################### |
| 73 |
|
# Step 3: Encode the excel file to Base64 |
| 74 |
|
#################################################################################################################### |
| 75 |
|
binary_file_data = b'' |
| 76 |
|
try: |
| 77 |
|
with open(filename, 'rb') as binary_file: |
| 78 |
|
binary_file_data = binary_file.read() |
| 79 |
|
except IOError as ex: |
| 80 |
|
print(str(ex)) |
| 81 |
|
|
| 82 |
|
# Base64 encode the bytes |
| 83 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 84 |
|
# get the Base64 encoded data using human-readable characters. |
| 85 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 86 |
|
# delete the file from server |
| 87 |
|
try: |
| 88 |
|
os.remove(filename) |
| 89 |
|
except NotImplementedError as ex: |
| 90 |
|
print(str(ex)) |
| 91 |
|
return base64_message |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentenergycategory.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/storeenergycategory.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantenergycategory.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentenergycategory.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorenergycategory.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/storeenergyitem.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorenergyitem.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantenergyitem.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentenergyitem.py 1 location
|
@@ 45-89 (lines=45) @@
|
| 42 |
|
######################################################################################################################## |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
def export(report, |
| 46 |
|
name, |
| 47 |
|
base_period_start_datetime_local, |
| 48 |
|
base_period_end_datetime_local, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
period_type, |
| 52 |
|
language): |
| 53 |
|
#################################################################################################################### |
| 54 |
|
# Step 1: Validate the report data |
| 55 |
|
#################################################################################################################### |
| 56 |
|
if report is None: |
| 57 |
|
return None |
| 58 |
|
|
| 59 |
|
#################################################################################################################### |
| 60 |
|
# Step 2: Generate excel file from the report data |
| 61 |
|
#################################################################################################################### |
| 62 |
|
filename = generate_excel(report, |
| 63 |
|
name, |
| 64 |
|
base_period_start_datetime_local, |
| 65 |
|
base_period_end_datetime_local, |
| 66 |
|
reporting_start_datetime_local, |
| 67 |
|
reporting_end_datetime_local, |
| 68 |
|
period_type, |
| 69 |
|
language) |
| 70 |
|
#################################################################################################################### |
| 71 |
|
# Step 3: Encode the excel file to Base64 |
| 72 |
|
#################################################################################################################### |
| 73 |
|
binary_file_data = b'' |
| 74 |
|
try: |
| 75 |
|
with open(filename, 'rb') as binary_file: |
| 76 |
|
binary_file_data = binary_file.read() |
| 77 |
|
except IOError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
|
| 80 |
|
# Base64 encode the bytes |
| 81 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 82 |
|
# get the Base64 encoded data using human-readable characters. |
| 83 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 84 |
|
# delete the file from server |
| 85 |
|
try: |
| 86 |
|
os.remove(filename) |
| 87 |
|
except NotImplementedError as ex: |
| 88 |
|
print(str(ex)) |
| 89 |
|
return base64_message |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentoutput.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
#################################################################################################################### |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/storeload.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorstatistics.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentstatistics.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantstatistics.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentefficiency.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentefficiency.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantload.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/equipmentload.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/shopfloorload.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/combinedequipmentload.py 1 location
|
@@ 44-88 (lines=45) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(report, |
| 45 |
|
name, |
| 46 |
|
base_period_start_datetime_local, |
| 47 |
|
base_period_end_datetime_local, |
| 48 |
|
reporting_start_datetime_local, |
| 49 |
|
reporting_end_datetime_local, |
| 50 |
|
period_type, |
| 51 |
|
language): |
| 52 |
|
#################################################################################################################### |
| 53 |
|
# Step 1: Validate the report data |
| 54 |
|
#################################################################################################################### |
| 55 |
|
if report is None: |
| 56 |
|
return None |
| 57 |
|
|
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 2: Generate excel file from the report data |
| 60 |
|
#################################################################################################################### |
| 61 |
|
filename = generate_excel(report, |
| 62 |
|
name, |
| 63 |
|
base_period_start_datetime_local, |
| 64 |
|
base_period_end_datetime_local, |
| 65 |
|
reporting_start_datetime_local, |
| 66 |
|
reporting_end_datetime_local, |
| 67 |
|
period_type, |
| 68 |
|
language) |
| 69 |
|
#################################################################################################################### |
| 70 |
|
# Step 3: Encode the excel file to Base64 |
| 71 |
|
#################################################################################################################### |
| 72 |
|
binary_file_data = b'' |
| 73 |
|
try: |
| 74 |
|
with open(filename, 'rb') as binary_file: |
| 75 |
|
binary_file_data = binary_file.read() |
| 76 |
|
except IOError as ex: |
| 77 |
|
print(str(ex)) |
| 78 |
|
|
| 79 |
|
# Base64 encode the bytes |
| 80 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 81 |
|
# get the Base64 encoded data using human-readable characters. |
| 82 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 83 |
|
# delete the file from server |
| 84 |
|
try: |
| 85 |
|
os.remove(filename) |
| 86 |
|
except NotImplementedError as ex: |
| 87 |
|
print(str(ex)) |
| 88 |
|
return base64_message |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
def generate_excel(report, |
myems-api/excelexporters/virtualmetersaving.py 1 location
|
@@ 43-87 (lines=45) @@
|
| 40 |
|
# Step 2: Generate excel file from the report data |
| 41 |
|
# Step 3: Encode the excel file to Base64 |
| 42 |
|
######################################################################################################################## |
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
base_period_start_datetime_local, |
| 46 |
|
base_period_end_datetime_local, |
| 47 |
|
reporting_start_datetime_local, |
| 48 |
|
reporting_end_datetime_local, |
| 49 |
|
period_type, |
| 50 |
|
language): |
| 51 |
|
#################################################################################################################### |
| 52 |
|
# Step 1: Validate the report data |
| 53 |
|
#################################################################################################################### |
| 54 |
|
if report is None: |
| 55 |
|
return None |
| 56 |
|
|
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 2: Generate excel file from the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
filename = generate_excel(report, |
| 61 |
|
name, |
| 62 |
|
base_period_start_datetime_local, |
| 63 |
|
base_period_end_datetime_local, |
| 64 |
|
reporting_start_datetime_local, |
| 65 |
|
reporting_end_datetime_local, |
| 66 |
|
period_type, |
| 67 |
|
language) |
| 68 |
|
#################################################################################################################### |
| 69 |
|
# Step 3: Encode the excel file to Base64 |
| 70 |
|
#################################################################################################################### |
| 71 |
|
binary_file_data = b'' |
| 72 |
|
try: |
| 73 |
|
with open(filename, 'rb') as binary_file: |
| 74 |
|
binary_file_data = binary_file.read() |
| 75 |
|
except IOError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
|
| 78 |
|
# Base64 encode the bytes |
| 79 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 80 |
|
# get the Base64 encoded data using human-readable characters. |
| 81 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 82 |
|
# delete the file from server |
| 83 |
|
try: |
| 84 |
|
os.remove(filename) |
| 85 |
|
except NotImplementedError as ex: |
| 86 |
|
print(str(ex)) |
| 87 |
|
return base64_message |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
def generate_excel(report, |
myems-api/excelexporters/virtualmeterplan.py 1 location
|
@@ 43-87 (lines=45) @@
|
| 40 |
|
# Step 2: Generate excel file from the report data |
| 41 |
|
# Step 3: Encode the excel file to Base64 |
| 42 |
|
######################################################################################################################## |
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
base_period_start_datetime_local, |
| 46 |
|
base_period_end_datetime_local, |
| 47 |
|
reporting_start_datetime_local, |
| 48 |
|
reporting_end_datetime_local, |
| 49 |
|
period_type, |
| 50 |
|
language): |
| 51 |
|
#################################################################################################################### |
| 52 |
|
# Step 1: Validate the report data |
| 53 |
|
#################################################################################################################### |
| 54 |
|
if report is None: |
| 55 |
|
return None |
| 56 |
|
|
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 2: Generate excel file from the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
filename = generate_excel(report, |
| 61 |
|
name, |
| 62 |
|
base_period_start_datetime_local, |
| 63 |
|
base_period_end_datetime_local, |
| 64 |
|
reporting_start_datetime_local, |
| 65 |
|
reporting_end_datetime_local, |
| 66 |
|
period_type, |
| 67 |
|
language) |
| 68 |
|
#################################################################################################################### |
| 69 |
|
# Step 3: Encode the excel file to Base64 |
| 70 |
|
#################################################################################################################### |
| 71 |
|
binary_file_data = b'' |
| 72 |
|
try: |
| 73 |
|
with open(filename, 'rb') as binary_file: |
| 74 |
|
binary_file_data = binary_file.read() |
| 75 |
|
except IOError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
|
| 78 |
|
# Base64 encode the bytes |
| 79 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 80 |
|
# get the Base64 encoded data using human-readable characters. |
| 81 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 82 |
|
# delete the file from server |
| 83 |
|
try: |
| 84 |
|
os.remove(filename) |
| 85 |
|
except NotImplementedError as ex: |
| 86 |
|
print(str(ex)) |
| 87 |
|
return base64_message |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
def generate_excel(report, |
myems-api/excelexporters/metersaving.py 1 location
|
@@ 43-87 (lines=45) @@
|
| 40 |
|
# Step 2: Generate excel file from the report data |
| 41 |
|
# Step 3: Encode the excel file to Base64 |
| 42 |
|
######################################################################################################################## |
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
base_period_start_datetime_local, |
| 46 |
|
base_period_end_datetime_local, |
| 47 |
|
reporting_start_datetime_local, |
| 48 |
|
reporting_end_datetime_local, |
| 49 |
|
period_type, |
| 50 |
|
language): |
| 51 |
|
#################################################################################################################### |
| 52 |
|
# Step 1: Validate the report data |
| 53 |
|
#################################################################################################################### |
| 54 |
|
if report is None: |
| 55 |
|
return None |
| 56 |
|
|
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 2: Generate excel file from the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
filename = generate_excel(report, |
| 61 |
|
name, |
| 62 |
|
base_period_start_datetime_local, |
| 63 |
|
base_period_end_datetime_local, |
| 64 |
|
reporting_start_datetime_local, |
| 65 |
|
reporting_end_datetime_local, |
| 66 |
|
period_type, |
| 67 |
|
language) |
| 68 |
|
#################################################################################################################### |
| 69 |
|
# Step 3: Encode the excel file to Base64 |
| 70 |
|
#################################################################################################################### |
| 71 |
|
binary_file_data = b'' |
| 72 |
|
try: |
| 73 |
|
with open(filename, 'rb') as binary_file: |
| 74 |
|
binary_file_data = binary_file.read() |
| 75 |
|
except IOError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
|
| 78 |
|
# Base64 encode the bytes |
| 79 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 80 |
|
# get the Base64 encoded data using human-readable characters. |
| 81 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 82 |
|
# delete the file from server |
| 83 |
|
try: |
| 84 |
|
os.remove(filename) |
| 85 |
|
except NotImplementedError as ex: |
| 86 |
|
print(str(ex)) |
| 87 |
|
return base64_message |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
def generate_excel(report, |
myems-api/excelexporters/offlinemeterplan.py 1 location
|
@@ 43-87 (lines=45) @@
|
| 40 |
|
# Step 2: Generate excel file from the report data |
| 41 |
|
# Step 3: Encode the excel file to Base64 |
| 42 |
|
######################################################################################################################## |
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
base_period_start_datetime_local, |
| 46 |
|
base_period_end_datetime_local, |
| 47 |
|
reporting_start_datetime_local, |
| 48 |
|
reporting_end_datetime_local, |
| 49 |
|
period_type, |
| 50 |
|
language): |
| 51 |
|
#################################################################################################################### |
| 52 |
|
# Step 1: Validate the report data |
| 53 |
|
#################################################################################################################### |
| 54 |
|
if report is None: |
| 55 |
|
return None |
| 56 |
|
|
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 2: Generate excel file from the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
filename = generate_excel(report, |
| 61 |
|
name, |
| 62 |
|
base_period_start_datetime_local, |
| 63 |
|
base_period_end_datetime_local, |
| 64 |
|
reporting_start_datetime_local, |
| 65 |
|
reporting_end_datetime_local, |
| 66 |
|
period_type, |
| 67 |
|
language) |
| 68 |
|
#################################################################################################################### |
| 69 |
|
# Step 3: Encode the excel file to Base64 |
| 70 |
|
#################################################################################################################### |
| 71 |
|
binary_file_data = b'' |
| 72 |
|
try: |
| 73 |
|
with open(filename, 'rb') as binary_file: |
| 74 |
|
binary_file_data = binary_file.read() |
| 75 |
|
except IOError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
|
| 78 |
|
# Base64 encode the bytes |
| 79 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 80 |
|
# get the Base64 encoded data using human-readable characters. |
| 81 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 82 |
|
# delete the file from server |
| 83 |
|
try: |
| 84 |
|
os.remove(filename) |
| 85 |
|
except NotImplementedError as ex: |
| 86 |
|
print(str(ex)) |
| 87 |
|
return base64_message |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
def generate_excel(report, |
myems-api/excelexporters/storestatistics.py 1 location
|
@@ 43-87 (lines=45) @@
|
| 40 |
|
######################################################################################################################## |
| 41 |
|
|
| 42 |
|
|
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
base_period_start_datetime_local, |
| 46 |
|
base_period_end_datetime_local, |
| 47 |
|
reporting_start_datetime_local, |
| 48 |
|
reporting_end_datetime_local, |
| 49 |
|
period_type, |
| 50 |
|
language): |
| 51 |
|
#################################################################################################################### |
| 52 |
|
# Step 1: Validate the report data |
| 53 |
|
#################################################################################################################### |
| 54 |
|
if report is None: |
| 55 |
|
return None |
| 56 |
|
|
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 2: Generate excel file from the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
filename = generate_excel(report, |
| 61 |
|
name, |
| 62 |
|
base_period_start_datetime_local, |
| 63 |
|
base_period_end_datetime_local, |
| 64 |
|
reporting_start_datetime_local, |
| 65 |
|
reporting_end_datetime_local, |
| 66 |
|
period_type, |
| 67 |
|
language) |
| 68 |
|
#################################################################################################################### |
| 69 |
|
# Step 3: Encode the excel file to Base64 |
| 70 |
|
#################################################################################################################### |
| 71 |
|
binary_file_data = b'' |
| 72 |
|
try: |
| 73 |
|
with open(filename, 'rb') as binary_file: |
| 74 |
|
binary_file_data = binary_file.read() |
| 75 |
|
except IOError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
|
| 78 |
|
# Base64 encode the bytes |
| 79 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 80 |
|
# get the Base64 encoded data using human-readable characters. |
| 81 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 82 |
|
# delete the file from server |
| 83 |
|
try: |
| 84 |
|
os.remove(filename) |
| 85 |
|
except NotImplementedError as ex: |
| 86 |
|
print(str(ex)) |
| 87 |
|
return base64_message |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
def generate_excel(report, |
myems-api/excelexporters/meterplan.py 1 location
|
@@ 43-87 (lines=45) @@
|
| 40 |
|
# Step 2: Generate excel file from the report data |
| 41 |
|
# Step 3: Encode the excel file to Base64 |
| 42 |
|
######################################################################################################################## |
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
base_period_start_datetime_local, |
| 46 |
|
base_period_end_datetime_local, |
| 47 |
|
reporting_start_datetime_local, |
| 48 |
|
reporting_end_datetime_local, |
| 49 |
|
period_type, |
| 50 |
|
language): |
| 51 |
|
#################################################################################################################### |
| 52 |
|
# Step 1: Validate the report data |
| 53 |
|
#################################################################################################################### |
| 54 |
|
if report is None: |
| 55 |
|
return None |
| 56 |
|
|
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 2: Generate excel file from the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
filename = generate_excel(report, |
| 61 |
|
name, |
| 62 |
|
base_period_start_datetime_local, |
| 63 |
|
base_period_end_datetime_local, |
| 64 |
|
reporting_start_datetime_local, |
| 65 |
|
reporting_end_datetime_local, |
| 66 |
|
period_type, |
| 67 |
|
language) |
| 68 |
|
#################################################################################################################### |
| 69 |
|
# Step 3: Encode the excel file to Base64 |
| 70 |
|
#################################################################################################################### |
| 71 |
|
binary_file_data = b'' |
| 72 |
|
try: |
| 73 |
|
with open(filename, 'rb') as binary_file: |
| 74 |
|
binary_file_data = binary_file.read() |
| 75 |
|
except IOError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
|
| 78 |
|
# Base64 encode the bytes |
| 79 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 80 |
|
# get the Base64 encoded data using human-readable characters. |
| 81 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 82 |
|
# delete the file from server |
| 83 |
|
try: |
| 84 |
|
os.remove(filename) |
| 85 |
|
except NotImplementedError as ex: |
| 86 |
|
print(str(ex)) |
| 87 |
|
return base64_message |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
def generate_excel(report, |
myems-api/excelexporters/offlinemetersaving.py 1 location
|
@@ 43-87 (lines=45) @@
|
| 40 |
|
# Step 2: Generate excel file from the report data |
| 41 |
|
# Step 3: Encode the excel file to Base64 |
| 42 |
|
######################################################################################################################## |
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
base_period_start_datetime_local, |
| 46 |
|
base_period_end_datetime_local, |
| 47 |
|
reporting_start_datetime_local, |
| 48 |
|
reporting_end_datetime_local, |
| 49 |
|
period_type, |
| 50 |
|
language): |
| 51 |
|
#################################################################################################################### |
| 52 |
|
# Step 1: Validate the report data |
| 53 |
|
#################################################################################################################### |
| 54 |
|
if report is None: |
| 55 |
|
return None |
| 56 |
|
|
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 2: Generate excel file from the report data |
| 59 |
|
#################################################################################################################### |
| 60 |
|
filename = generate_excel(report, |
| 61 |
|
name, |
| 62 |
|
base_period_start_datetime_local, |
| 63 |
|
base_period_end_datetime_local, |
| 64 |
|
reporting_start_datetime_local, |
| 65 |
|
reporting_end_datetime_local, |
| 66 |
|
period_type, |
| 67 |
|
language) |
| 68 |
|
#################################################################################################################### |
| 69 |
|
# Step 3: Encode the excel file to Base64 |
| 70 |
|
#################################################################################################################### |
| 71 |
|
binary_file_data = b'' |
| 72 |
|
try: |
| 73 |
|
with open(filename, 'rb') as binary_file: |
| 74 |
|
binary_file_data = binary_file.read() |
| 75 |
|
except IOError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
|
| 78 |
|
# Base64 encode the bytes |
| 79 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 80 |
|
# get the Base64 encoded data using human-readable characters. |
| 81 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 82 |
|
# delete the file from server |
| 83 |
|
try: |
| 84 |
|
os.remove(filename) |
| 85 |
|
except NotImplementedError as ex: |
| 86 |
|
print(str(ex)) |
| 87 |
|
return base64_message |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
def generate_excel(report, |
myems-api/excelexporters/virtualmeterenergy.py 1 location
|
@@ 41-85 (lines=45) @@
|
| 38 |
|
# Step 2: Generate excel file from the report data |
| 39 |
|
# Step 3: Encode the excel file to Base64 |
| 40 |
|
######################################################################################################################## |
| 41 |
|
def export(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 1: Validate the report data |
| 51 |
|
#################################################################################################################### |
| 52 |
|
if report is None: |
| 53 |
|
return None |
| 54 |
|
|
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 2: Generate excel file from the report data |
| 57 |
|
#################################################################################################################### |
| 58 |
|
filename = generate_excel(report, |
| 59 |
|
name, |
| 60 |
|
base_period_start_datetime_local, |
| 61 |
|
base_period_end_datetime_local, |
| 62 |
|
reporting_start_datetime_local, |
| 63 |
|
reporting_end_datetime_local, |
| 64 |
|
period_type, |
| 65 |
|
language) |
| 66 |
|
#################################################################################################################### |
| 67 |
|
# Step 3: Encode the excel file to Base64 |
| 68 |
|
#################################################################################################################### |
| 69 |
|
binary_file_data = b'' |
| 70 |
|
try: |
| 71 |
|
with open(filename, 'rb') as binary_file: |
| 72 |
|
binary_file_data = binary_file.read() |
| 73 |
|
except IOError as ex: |
| 74 |
|
print(str(ex)) |
| 75 |
|
|
| 76 |
|
# Base64 encode the bytes |
| 77 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 78 |
|
# get the Base64 encoded data using human-readable characters. |
| 79 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 80 |
|
# delete the file from server |
| 81 |
|
try: |
| 82 |
|
os.remove(filename) |
| 83 |
|
except NotImplementedError as ex: |
| 84 |
|
print(str(ex)) |
| 85 |
|
return base64_message |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
def generate_excel(report, |
myems-api/excelexporters/offlinemeterenergy.py 1 location
|
@@ 41-85 (lines=45) @@
|
| 38 |
|
# Step 2: Generate excel file from the report data |
| 39 |
|
# Step 3: Encode the excel file to Base64 |
| 40 |
|
######################################################################################################################## |
| 41 |
|
def export(result, |
| 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 1: Validate the report data |
| 51 |
|
#################################################################################################################### |
| 52 |
|
if result is None: |
| 53 |
|
return None |
| 54 |
|
|
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 2: Generate excel file from the report data |
| 57 |
|
#################################################################################################################### |
| 58 |
|
filename = generate_excel(result, |
| 59 |
|
name, |
| 60 |
|
base_period_start_datetime_local, |
| 61 |
|
base_period_end_datetime_local, |
| 62 |
|
reporting_start_datetime_local, |
| 63 |
|
reporting_end_datetime_local, |
| 64 |
|
period_type, |
| 65 |
|
language) |
| 66 |
|
#################################################################################################################### |
| 67 |
|
# Step 3: Encode the excel file to Base64 |
| 68 |
|
#################################################################################################################### |
| 69 |
|
binary_file_data = b'' |
| 70 |
|
try: |
| 71 |
|
with open(filename, 'rb') as binary_file: |
| 72 |
|
binary_file_data = binary_file.read() |
| 73 |
|
except IOError as ex: |
| 74 |
|
print(str(ex)) |
| 75 |
|
|
| 76 |
|
# Base64 encode the bytes |
| 77 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 78 |
|
# get the Base64 encoded data using human-readable characters. |
| 79 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 80 |
|
# delete the file from server |
| 81 |
|
try: |
| 82 |
|
os.remove(filename) |
| 83 |
|
except NotImplementedError as ex: |
| 84 |
|
print(str(ex)) |
| 85 |
|
return base64_message |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
def generate_excel(report, |
myems-api/excelexporters/metertrend.py 1 location
|
@@ 44-85 (lines=42) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(result, |
| 45 |
|
name, |
| 46 |
|
reporting_start_datetime_local, |
| 47 |
|
reporting_end_datetime_local, |
| 48 |
|
period_type, |
| 49 |
|
language): |
| 50 |
|
#################################################################################################################### |
| 51 |
|
# Step 1: Validate the report data |
| 52 |
|
#################################################################################################################### |
| 53 |
|
if result is None: |
| 54 |
|
return None |
| 55 |
|
|
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 2: Generate excel file from the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
filename = generate_excel(result, |
| 60 |
|
name, |
| 61 |
|
reporting_start_datetime_local, |
| 62 |
|
reporting_end_datetime_local, |
| 63 |
|
period_type, |
| 64 |
|
language) |
| 65 |
|
|
| 66 |
|
#################################################################################################################### |
| 67 |
|
# Step 3: Encode the excel file to Base64 |
| 68 |
|
#################################################################################################################### |
| 69 |
|
binary_file_data = b'' |
| 70 |
|
try: |
| 71 |
|
with open(filename, 'rb') as binary_file: |
| 72 |
|
binary_file_data = binary_file.read() |
| 73 |
|
except IOError as ex: |
| 74 |
|
print(str(ex)) |
| 75 |
|
|
| 76 |
|
# Base64 encode the bytes |
| 77 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 78 |
|
# get the Base64 encoded data using human-readable characters. |
| 79 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 80 |
|
# delete the file from server |
| 81 |
|
try: |
| 82 |
|
os.remove(filename) |
| 83 |
|
except NotImplementedError as ex: |
| 84 |
|
print(str(ex)) |
| 85 |
|
return base64_message |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
def generate_excel(report, |
myems-api/excelexporters/powerquality.py 1 location
|
@@ 44-85 (lines=42) @@
|
| 41 |
|
######################################################################################################################## |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
def export(result, |
| 45 |
|
name, |
| 46 |
|
reporting_start_datetime_local, |
| 47 |
|
reporting_end_datetime_local, |
| 48 |
|
period_type, |
| 49 |
|
language): |
| 50 |
|
#################################################################################################################### |
| 51 |
|
# Step 1: Validate the report data |
| 52 |
|
#################################################################################################################### |
| 53 |
|
if result is None: |
| 54 |
|
return None |
| 55 |
|
|
| 56 |
|
#################################################################################################################### |
| 57 |
|
# Step 2: Generate excel file from the report data |
| 58 |
|
#################################################################################################################### |
| 59 |
|
filename = generate_excel(result, |
| 60 |
|
name, |
| 61 |
|
reporting_start_datetime_local, |
| 62 |
|
reporting_end_datetime_local, |
| 63 |
|
period_type, |
| 64 |
|
language) |
| 65 |
|
|
| 66 |
|
#################################################################################################################### |
| 67 |
|
# Step 3: Encode the excel file to Base64 |
| 68 |
|
#################################################################################################################### |
| 69 |
|
binary_file_data = b'' |
| 70 |
|
try: |
| 71 |
|
with open(filename, 'rb') as binary_file: |
| 72 |
|
binary_file_data = binary_file.read() |
| 73 |
|
except IOError as ex: |
| 74 |
|
print(str(ex)) |
| 75 |
|
|
| 76 |
|
# Base64 encode the bytes |
| 77 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 78 |
|
# get the Base64 encoded data using human-readable characters. |
| 79 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 80 |
|
# delete the file from server |
| 81 |
|
try: |
| 82 |
|
os.remove(filename) |
| 83 |
|
except NotImplementedError as ex: |
| 84 |
|
print(str(ex)) |
| 85 |
|
return base64_message |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
def generate_excel(report, |
myems-api/excelexporters/tenantbill.py 1 location
|
@@ 43-83 (lines=41) @@
|
| 40 |
|
######################################################################################################################## |
| 41 |
|
|
| 42 |
|
|
| 43 |
|
def export(report, |
| 44 |
|
name, |
| 45 |
|
reporting_start_datetime_local, |
| 46 |
|
reporting_end_datetime_local, |
| 47 |
|
period_type, |
| 48 |
|
language): |
| 49 |
|
#################################################################################################################### |
| 50 |
|
# Step 1: Validate the report data |
| 51 |
|
#################################################################################################################### |
| 52 |
|
if report is None: |
| 53 |
|
return None |
| 54 |
|
|
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 2: Generate excel file from the report data |
| 57 |
|
#################################################################################################################### |
| 58 |
|
filename = generate_excel(report, |
| 59 |
|
name, |
| 60 |
|
reporting_start_datetime_local, |
| 61 |
|
reporting_end_datetime_local, |
| 62 |
|
period_type, |
| 63 |
|
language) |
| 64 |
|
#################################################################################################################### |
| 65 |
|
# Step 3: Encode the excel file to Base64 |
| 66 |
|
#################################################################################################################### |
| 67 |
|
binary_file_data = b'' |
| 68 |
|
try: |
| 69 |
|
with open(filename, 'rb') as binary_file: |
| 70 |
|
binary_file_data = binary_file.read() |
| 71 |
|
except IOError as ex: |
| 72 |
|
print(str(ex)) |
| 73 |
|
|
| 74 |
|
# Base64 encode the bytes |
| 75 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 76 |
|
# get the Base64 encoded data using human-readable characters. |
| 77 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 78 |
|
# delete the file from server |
| 79 |
|
try: |
| 80 |
|
os.remove(filename) |
| 81 |
|
except NotImplementedError as ex: |
| 82 |
|
print(str(ex)) |
| 83 |
|
return base64_message |
| 84 |
|
|
| 85 |
|
|
| 86 |
|
def generate_excel(report, |
myems-api/excelexporters/meterenergy.py 1 location
|
@@ 41-79 (lines=39) @@
|
| 38 |
|
# Step 2: Generate excel file from the report data |
| 39 |
|
# Step 3: Encode the excel file to Base64 |
| 40 |
|
######################################################################################################################## |
| 41 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
| 42 |
|
base_period_end_datetime, period_type, language): |
| 43 |
|
#################################################################################################################### |
| 44 |
|
# Step 1: Validate the report data |
| 45 |
|
#################################################################################################################### |
| 46 |
|
if report is None: |
| 47 |
|
return None |
| 48 |
|
|
| 49 |
|
#################################################################################################################### |
| 50 |
|
# Step 2: Generate excel file from the report data |
| 51 |
|
#################################################################################################################### |
| 52 |
|
filename = generate_excel(report, |
| 53 |
|
name, |
| 54 |
|
reporting_start_datetime_local, |
| 55 |
|
reporting_end_datetime_local, |
| 56 |
|
base_period_start_datetime, |
| 57 |
|
base_period_end_datetime, |
| 58 |
|
period_type, |
| 59 |
|
language) |
| 60 |
|
#################################################################################################################### |
| 61 |
|
# Step 3: Encode the excel file to Base64 |
| 62 |
|
#################################################################################################################### |
| 63 |
|
binary_file_data = b'' |
| 64 |
|
try: |
| 65 |
|
with open(filename, 'rb') as binary_file: |
| 66 |
|
binary_file_data = binary_file.read() |
| 67 |
|
except IOError as ex: |
| 68 |
|
print(str(ex)) |
| 69 |
|
|
| 70 |
|
# Base64 encode the bytes |
| 71 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 72 |
|
# get the Base64 encoded data using human-readable characters. |
| 73 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 74 |
|
# delete the file from server |
| 75 |
|
try: |
| 76 |
|
os.remove(filename) |
| 77 |
|
except NotImplementedError as ex: |
| 78 |
|
print(str(ex)) |
| 79 |
|
return base64_message |
| 80 |
|
|
| 81 |
|
|
| 82 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/microgridreporting.py 1 location
|
@@ 36-74 (lines=39) @@
|
| 33 |
|
# Step 3: Encode the excel file to Base64 |
| 34 |
|
######################################################################################################################## |
| 35 |
|
|
| 36 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
| 37 |
|
base_period_end_datetime, period_type, language): |
| 38 |
|
#################################################################################################################### |
| 39 |
|
# Step 1: Validate the report data |
| 40 |
|
#################################################################################################################### |
| 41 |
|
if report is None: |
| 42 |
|
return None |
| 43 |
|
|
| 44 |
|
#################################################################################################################### |
| 45 |
|
# Step 2: Generate excel file from the report data |
| 46 |
|
#################################################################################################################### |
| 47 |
|
filename = generate_excel(report, |
| 48 |
|
name, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
base_period_start_datetime, |
| 52 |
|
base_period_end_datetime, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/microgridreportingrevenue.py 1 location
|
@@ 36-74 (lines=39) @@
|
| 33 |
|
# Step 3: Encode the excel file to Base64 |
| 34 |
|
######################################################################################################################## |
| 35 |
|
|
| 36 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
| 37 |
|
base_period_end_datetime, period_type, language): |
| 38 |
|
#################################################################################################################### |
| 39 |
|
# Step 1: Validate the report data |
| 40 |
|
#################################################################################################################### |
| 41 |
|
if report is None: |
| 42 |
|
return None |
| 43 |
|
|
| 44 |
|
#################################################################################################################### |
| 45 |
|
# Step 2: Generate excel file from the report data |
| 46 |
|
#################################################################################################################### |
| 47 |
|
filename = generate_excel(report, |
| 48 |
|
name, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
base_period_start_datetime, |
| 52 |
|
base_period_end_datetime, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/microgridreportingenergy.py 1 location
|
@@ 36-74 (lines=39) @@
|
| 33 |
|
# Step 3: Encode the excel file to Base64 |
| 34 |
|
######################################################################################################################## |
| 35 |
|
|
| 36 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
| 37 |
|
base_period_end_datetime, period_type, language): |
| 38 |
|
#################################################################################################################### |
| 39 |
|
# Step 1: Validate the report data |
| 40 |
|
#################################################################################################################### |
| 41 |
|
if report is None: |
| 42 |
|
return None |
| 43 |
|
|
| 44 |
|
#################################################################################################################### |
| 45 |
|
# Step 2: Generate excel file from the report data |
| 46 |
|
#################################################################################################################### |
| 47 |
|
filename = generate_excel(report, |
| 48 |
|
name, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
base_period_start_datetime, |
| 52 |
|
base_period_end_datetime, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/microgridreportingcarbon.py 1 location
|
@@ 36-74 (lines=39) @@
|
| 33 |
|
# Step 3: Encode the excel file to Base64 |
| 34 |
|
######################################################################################################################## |
| 35 |
|
|
| 36 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, base_period_start_datetime, |
| 37 |
|
base_period_end_datetime, period_type, language): |
| 38 |
|
#################################################################################################################### |
| 39 |
|
# Step 1: Validate the report data |
| 40 |
|
#################################################################################################################### |
| 41 |
|
if report is None: |
| 42 |
|
return None |
| 43 |
|
|
| 44 |
|
#################################################################################################################### |
| 45 |
|
# Step 2: Generate excel file from the report data |
| 46 |
|
#################################################################################################################### |
| 47 |
|
filename = generate_excel(report, |
| 48 |
|
name, |
| 49 |
|
reporting_start_datetime_local, |
| 50 |
|
reporting_end_datetime_local, |
| 51 |
|
base_period_start_datetime, |
| 52 |
|
base_period_end_datetime, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, |
myems-api/excelexporters/metercomparison.py 1 location
|
@@ 41-77 (lines=37) @@
|
| 38 |
|
# Step 2: Generate excel file from the report data |
| 39 |
|
# Step 3: Encode the excel file to Base64 |
| 40 |
|
######################################################################################################################## |
| 41 |
|
def export(result, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
| 42 |
|
#################################################################################################################### |
| 43 |
|
# Step 1: Validate the report data |
| 44 |
|
#################################################################################################################### |
| 45 |
|
if result is None: |
| 46 |
|
return None |
| 47 |
|
|
| 48 |
|
#################################################################################################################### |
| 49 |
|
# Step 2: Generate excel file from the report data |
| 50 |
|
#################################################################################################################### |
| 51 |
|
filename = generate_excel(result, |
| 52 |
|
name1, |
| 53 |
|
name2, |
| 54 |
|
reporting_start_datetime_local, |
| 55 |
|
reporting_end_datetime_local, |
| 56 |
|
period_type, |
| 57 |
|
language) |
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 3: Encode the excel file to Base64 |
| 60 |
|
#################################################################################################################### |
| 61 |
|
binary_file_data = b'' |
| 62 |
|
try: |
| 63 |
|
with open(filename, 'rb') as binary_file: |
| 64 |
|
binary_file_data = binary_file.read() |
| 65 |
|
except IOError as ex: |
| 66 |
|
print(str(ex)) |
| 67 |
|
|
| 68 |
|
# Base64 encode the bytes |
| 69 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 70 |
|
# get the Base64 encoded data using human-readable characters. |
| 71 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 72 |
|
# delete the file from server |
| 73 |
|
try: |
| 74 |
|
os.remove(filename) |
| 75 |
|
except NotImplementedError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
return base64_message |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
def generate_excel(report, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type, |
myems-api/excelexporters/virtualmetercomparison.py 1 location
|
@@ 41-77 (lines=37) @@
|
| 38 |
|
# Step 2: Generate excel file from the report data |
| 39 |
|
# Step 3: Encode the excel file to Base64 |
| 40 |
|
######################################################################################################################## |
| 41 |
|
def export(result, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
| 42 |
|
#################################################################################################################### |
| 43 |
|
# Step 1: Validate the report data |
| 44 |
|
#################################################################################################################### |
| 45 |
|
if result is None: |
| 46 |
|
return None |
| 47 |
|
|
| 48 |
|
#################################################################################################################### |
| 49 |
|
# Step 2: Generate excel file from the report data |
| 50 |
|
#################################################################################################################### |
| 51 |
|
filename = generate_excel(result, |
| 52 |
|
name1, |
| 53 |
|
name2, |
| 54 |
|
reporting_start_datetime_local, |
| 55 |
|
reporting_end_datetime_local, |
| 56 |
|
period_type, |
| 57 |
|
language) |
| 58 |
|
#################################################################################################################### |
| 59 |
|
# Step 3: Encode the excel file to Base64 |
| 60 |
|
#################################################################################################################### |
| 61 |
|
binary_file_data = b'' |
| 62 |
|
try: |
| 63 |
|
with open(filename, 'rb') as binary_file: |
| 64 |
|
binary_file_data = binary_file.read() |
| 65 |
|
except IOError as ex: |
| 66 |
|
print(str(ex)) |
| 67 |
|
|
| 68 |
|
# Base64 encode the bytes |
| 69 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 70 |
|
# get the Base64 encoded data using human-readable characters. |
| 71 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 72 |
|
# delete the file from server |
| 73 |
|
try: |
| 74 |
|
os.remove(filename) |
| 75 |
|
except NotImplementedError as ex: |
| 76 |
|
print(str(ex)) |
| 77 |
|
return base64_message |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
def generate_excel(report, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type, |
myems-api/excelexporters/metertracking.py 1 location
|
@@ 37-73 (lines=37) @@
|
| 34 |
|
# Step 2: Generate excelexporters file |
| 35 |
|
# Step 3: Encode the excelexporters file to Base64 |
| 36 |
|
######################################################################################################################## |
| 37 |
|
def export(result, space_name, energy_category_name, reporting_start_datetime_local, reporting_end_datetime_local, |
| 38 |
|
language): |
| 39 |
|
#################################################################################################################### |
| 40 |
|
# Step 1: Validate the report data |
| 41 |
|
#################################################################################################################### |
| 42 |
|
if result is None: |
| 43 |
|
return None |
| 44 |
|
|
| 45 |
|
#################################################################################################################### |
| 46 |
|
# Step 2: Generate excel file from the report data |
| 47 |
|
#################################################################################################################### |
| 48 |
|
filename = generate_excel(result, |
| 49 |
|
space_name, |
| 50 |
|
energy_category_name, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
language) |
| 54 |
|
#################################################################################################################### |
| 55 |
|
# Step 3: Encode the excel file to Base64 |
| 56 |
|
#################################################################################################################### |
| 57 |
|
binary_file_data = b'' |
| 58 |
|
try: |
| 59 |
|
with open(filename, 'rb') as binary_file: |
| 60 |
|
binary_file_data = binary_file.read() |
| 61 |
|
except IOError as ex: |
| 62 |
|
print(str(ex)) |
| 63 |
|
|
| 64 |
|
# Base64 encode the bytes |
| 65 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 66 |
|
# get the Base64 encoded data using human-readable characters. |
| 67 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 68 |
|
# delete the file from server |
| 69 |
|
try: |
| 70 |
|
os.remove(filename) |
| 71 |
|
except NotImplementedError as ex: |
| 72 |
|
print(str(ex)) |
| 73 |
|
return base64_message |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
def generate_excel(report, space_name, energy_category_name, reporting_start_datetime_local, |
myems-api/excelexporters/metersubmetersbalance.py 1 location
|
@@ 41-76 (lines=36) @@
|
| 38 |
|
# Step 2: Generate excelexporters file |
| 39 |
|
# Step 3: Encode the excelexporters file to Base64 |
| 40 |
|
######################################################################################################################## |
| 41 |
|
def export(result, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
| 42 |
|
#################################################################################################################### |
| 43 |
|
# Step 1: Validate the report data |
| 44 |
|
#################################################################################################################### |
| 45 |
|
if result is None: |
| 46 |
|
return None |
| 47 |
|
|
| 48 |
|
#################################################################################################################### |
| 49 |
|
# Step 2: Generate excel file from the report data |
| 50 |
|
#################################################################################################################### |
| 51 |
|
filename = generate_excel(result, |
| 52 |
|
name, |
| 53 |
|
reporting_start_datetime_local, |
| 54 |
|
reporting_end_datetime_local, |
| 55 |
|
period_type, |
| 56 |
|
language) |
| 57 |
|
#################################################################################################################### |
| 58 |
|
# Step 3: Encode the excel file to Base64 |
| 59 |
|
#################################################################################################################### |
| 60 |
|
binary_file_data = b'' |
| 61 |
|
try: |
| 62 |
|
with open(filename, 'rb') as binary_file: |
| 63 |
|
binary_file_data = binary_file.read() |
| 64 |
|
except IOError as ex: |
| 65 |
|
print(str(ex)) |
| 66 |
|
|
| 67 |
|
# Base64 encode the bytes |
| 68 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 69 |
|
# get the Base64 encoded data using human-readable characters. |
| 70 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 71 |
|
# delete the file from server |
| 72 |
|
try: |
| 73 |
|
os.remove(filename) |
| 74 |
|
except NotImplementedError as ex: |
| 75 |
|
print(str(ex)) |
| 76 |
|
return base64_message |
| 77 |
|
|
| 78 |
|
|
| 79 |
|
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
myems-api/excelexporters/photovoltaicpowerstationreportingrevenue.py 1 location
|
@@ 39-74 (lines=36) @@
|
| 36 |
|
# Step 3: Encode the excel file to Base64 |
| 37 |
|
######################################################################################################################## |
| 38 |
|
|
| 39 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
| 40 |
|
#################################################################################################################### |
| 41 |
|
# Step 1: Validate the report data |
| 42 |
|
#################################################################################################################### |
| 43 |
|
if report is None: |
| 44 |
|
return None |
| 45 |
|
|
| 46 |
|
#################################################################################################################### |
| 47 |
|
# Step 2: Generate excel file from the report data |
| 48 |
|
#################################################################################################################### |
| 49 |
|
filename = generate_excel(report, |
| 50 |
|
name, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, |
myems-api/excelexporters/photovoltaicpowerstationreportingenergy.py 1 location
|
@@ 39-74 (lines=36) @@
|
| 36 |
|
# Step 3: Encode the excel file to Base64 |
| 37 |
|
######################################################################################################################## |
| 38 |
|
|
| 39 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
| 40 |
|
#################################################################################################################### |
| 41 |
|
# Step 1: Validate the report data |
| 42 |
|
#################################################################################################################### |
| 43 |
|
if report is None: |
| 44 |
|
return None |
| 45 |
|
|
| 46 |
|
#################################################################################################################### |
| 47 |
|
# Step 2: Generate excel file from the report data |
| 48 |
|
#################################################################################################################### |
| 49 |
|
filename = generate_excel(report, |
| 50 |
|
name, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, |
myems-api/excelexporters/energystoragepowerstationreportingrevenue.py 1 location
|
@@ 39-74 (lines=36) @@
|
| 36 |
|
# Step 3: Encode the excel file to Base64 |
| 37 |
|
######################################################################################################################## |
| 38 |
|
|
| 39 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
| 40 |
|
#################################################################################################################### |
| 41 |
|
# Step 1: Validate the report data |
| 42 |
|
#################################################################################################################### |
| 43 |
|
if report is None: |
| 44 |
|
return None |
| 45 |
|
|
| 46 |
|
#################################################################################################################### |
| 47 |
|
# Step 2: Generate excel file from the report data |
| 48 |
|
#################################################################################################################### |
| 49 |
|
filename = generate_excel(report, |
| 50 |
|
name, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, |
myems-api/excelexporters/energystoragepowerstationreportingenergy.py 1 location
|
@@ 39-74 (lines=36) @@
|
| 36 |
|
# Step 3: Encode the excel file to Base64 |
| 37 |
|
######################################################################################################################## |
| 38 |
|
|
| 39 |
|
def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language): |
| 40 |
|
#################################################################################################################### |
| 41 |
|
# Step 1: Validate the report data |
| 42 |
|
#################################################################################################################### |
| 43 |
|
if report is None: |
| 44 |
|
return None |
| 45 |
|
|
| 46 |
|
#################################################################################################################### |
| 47 |
|
# Step 2: Generate excel file from the report data |
| 48 |
|
#################################################################################################################### |
| 49 |
|
filename = generate_excel(report, |
| 50 |
|
name, |
| 51 |
|
reporting_start_datetime_local, |
| 52 |
|
reporting_end_datetime_local, |
| 53 |
|
period_type, |
| 54 |
|
language) |
| 55 |
|
#################################################################################################################### |
| 56 |
|
# Step 3: Encode the excel file to Base64 |
| 57 |
|
#################################################################################################################### |
| 58 |
|
binary_file_data = b'' |
| 59 |
|
try: |
| 60 |
|
with open(filename, 'rb') as binary_file: |
| 61 |
|
binary_file_data = binary_file.read() |
| 62 |
|
except IOError as ex: |
| 63 |
|
print(str(ex)) |
| 64 |
|
|
| 65 |
|
# Base64 encode the bytes |
| 66 |
|
base64_encoded_data = base64.b64encode(binary_file_data) |
| 67 |
|
# get the Base64 encoded data using human-readable characters. |
| 68 |
|
base64_message = base64_encoded_data.decode('utf-8') |
| 69 |
|
# delete the file from server |
| 70 |
|
try: |
| 71 |
|
os.remove(filename) |
| 72 |
|
except NotImplementedError as ex: |
| 73 |
|
print(str(ex)) |
| 74 |
|
return base64_message |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
def generate_excel(report, |