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