Code Duplication    Length = 102-102 lines in 2 locations

excelexporters/spaceenergycategory.py 1 location

@@ 179-280 (lines=102) @@
176
            len(reporting_period_data['names']) == 0:
177
        has_energy_data_flag = False
178
179
    if has_energy_data_flag:
180
        ws['B6'].font = title_font
181
        ws['B6'] = name+' 能耗分析'
182
183
        category = reporting_period_data['names']
184
        ca_len = len(category)
185
186
        ws['B7'].fill = table_fill
187
188
        ws['B8'].font = title_font
189
        ws['B8'].alignment = c_c_alignment
190
        ws['B8'] = '能耗'
191
        ws['B8'].border = f_border
192
193
        ws['B9'].font = title_font
194
        ws['B9'].alignment = c_c_alignment
195
        ws['B9'] = '单位面积能耗'
196
        ws['B9'].border = f_border
197
198
        ws['B10'].font = title_font
199
        ws['B10'].alignment = c_c_alignment
200
        ws['B10'] = '环比'
201
        ws['B10'].border = f_border
202
203
        for i in range(0, ca_len):
204
            col = chr(ord('C') + i)
205
            row = '7'
206
            cell = col + row
207
            ws[col + '7'].fill = table_fill
208
            ws[col + '7'].font = name_font
209
            ws[col + '7'].alignment = c_c_alignment
210
            ws[col + '7'] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + ")"
211
            ws[col + '7'].border = f_border
212
213
            ws[col + '8'].font = name_font
214
            ws[col + '8'].alignment = c_c_alignment
215
            ws[col + '8'] = round(reporting_period_data['subtotals'][i], 0)
216
            ws[col + '8'].border = f_border
217
218
            ws[col + '9'].font = name_font
219
            ws[col + '9'].alignment = c_c_alignment
220
            ws[col + '9'] = round(reporting_period_data['subtotals_per_unit_area'][i], 2)
221
            ws[col + '9'].border = f_border
222
223
            ws[col + '10'].font = name_font
224
            ws[col + '10'].alignment = c_c_alignment
225
            ws[col + '10'] = str(round(reporting_period_data['increment_rates'][i] * 100, 2)) + "%" \
226
                if reporting_period_data['increment_rates'][i] is not None else "-"
227
            ws[col + '10'].border = f_border
228
229
        # TCE TCO2E
230
        end_col = col
231
        # TCE
232
        tce_col = chr(ord(end_col) + 1)
233
        ws[tce_col + '7'].fill = table_fill
234
        ws[tce_col + '7'].font = name_font
235
        ws[tce_col + '7'].alignment = c_c_alignment
236
        ws[tce_col + '7'] = "TCE"
237
        ws[tce_col + '7'].border = f_border
238
239
        ws[tce_col + '8'].font = name_font
240
        ws[tce_col + '8'].alignment = c_c_alignment
241
        ws[tce_col + '8'] = round(reporting_period_data['total_in_kgce'], 0)
242
        ws[tce_col + '8'].border = f_border
243
244
        ws[tce_col + '9'].font = name_font
245
        ws[tce_col + '9'].alignment = c_c_alignment
246
        ws[tce_col + '9'] = round(reporting_period_data['total_in_kgce_per_unit_area'], 2)
247
        ws[tce_col + '9'].border = f_border
248
249
        ws[tce_col + '10'].font = name_font
250
        ws[tce_col + '10'].alignment = c_c_alignment
251
        ws[tce_col + '10'] = str(round(reporting_period_data['increment_rate_in_kgce'] * 100, 2)) + "%" \
252
            if reporting_period_data['increment_rate_in_kgce'] is not None else "-"
253
        ws[tce_col + '10'].border = f_border
254
255
        # TCO2E
256
        tco2e_col = chr(ord(end_col) + 2)
257
        ws[tco2e_col + '7'].fill = table_fill
258
        ws[tco2e_col + '7'].font = name_font
259
        ws[tco2e_col + '7'].alignment = c_c_alignment
260
        ws[tco2e_col + '7'] = "TCO2E"
261
        ws[tco2e_col + '7'].border = f_border
262
263
        ws[tco2e_col + '8'].font = name_font
264
        ws[tco2e_col + '8'].alignment = c_c_alignment
265
        ws[tco2e_col + '8'] = round(reporting_period_data['total_in_kgco2e'], 0)
266
        ws[tco2e_col + '8'].border = f_border
267
268
        ws[tco2e_col + '9'].font = name_font
269
        ws[tco2e_col + '9'].alignment = c_c_alignment
270
        ws[tco2e_col + '9'] = round(reporting_period_data['total_in_kgco2e_per_unit_area'], 2)
271
        ws[tco2e_col + '9'].border = f_border
272
273
        ws[tco2e_col + '10'].font = name_font
274
        ws[tco2e_col + '10'].alignment = c_c_alignment
275
        ws[tco2e_col + '10'] = str(round(reporting_period_data['increment_rate_in_kgco2e'] * 100, 2)) + "%" \
276
            if reporting_period_data['increment_rate_in_kgco2e'] is not None else "-"
277
        ws[tco2e_col + '10'].border = f_border
278
    else:
279
        for i in range(6, 10 + 1):
280
            ws.row_dimensions[i].height = 0.1
281
    #################################################
282
    # Second: 分时电耗
283
    # 12: title

excelexporters/tenantenergycategory.py 1 location

@@ 177-278 (lines=102) @@
174
            len(reporting_period_data['names']) == 0:
175
        has_energy_data_flag = False
176
177
    if has_energy_data_flag:
178
        ws['B6'].font = title_font
179
        ws['B6'] = name+' 报告期消耗'
180
181
        category = reporting_period_data['names']
182
        ca_len = len(category)
183
184
        ws['B7'].fill = table_fill
185
186
        ws['B8'].font = title_font
187
        ws['B8'].alignment = c_c_alignment
188
        ws['B8'] = '能耗'
189
        ws['B8'].border = f_border
190
191
        ws['B9'].font = title_font
192
        ws['B9'].alignment = c_c_alignment
193
        ws['B9'] = '单位面积能耗'
194
        ws['B9'].border = f_border
195
196
        ws['B10'].font = title_font
197
        ws['B10'].alignment = c_c_alignment
198
        ws['B10'] = '环比'
199
        ws['B10'].border = f_border
200
201
        col = 'B'
202
203
        for i in range(0, ca_len):
204
            col = chr(ord('C') + i)
205
            ws[col + '7'].fill = table_fill
206
            ws[col + '7'].font = name_font
207
            ws[col + '7'].alignment = c_c_alignment
208
            ws[col + '7'] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + ")"
209
            ws[col + '7'].border = f_border
210
211
            ws[col + '8'].font = name_font
212
            ws[col + '8'].alignment = c_c_alignment
213
            ws[col + '8'] = round(reporting_period_data['subtotals'][i], 0)
214
            ws[col + '8'].border = f_border
215
216
            ws[col + '9'].font = name_font
217
            ws[col + '9'].alignment = c_c_alignment
218
            ws[col + '9'] = round(reporting_period_data['subtotals_per_unit_area'][i], 2)
219
            ws[col + '9'].border = f_border
220
221
            ws[col + '10'].font = name_font
222
            ws[col + '10'].alignment = c_c_alignment
223
            ws[col + '10'] = str(round(reporting_period_data['increment_rates'][i] * 100, 2)) + "%" \
224
                if reporting_period_data['increment_rates'][i] is not None else "-"
225
            ws[col + '10'].border = f_border
226
227
        # TCE TCO2E
228
        end_col = col
229
        # TCE
230
        tce_col = chr(ord(end_col) + 1)
231
        ws[tce_col + '7'].fill = table_fill
232
        ws[tce_col + '7'].font = name_font
233
        ws[tce_col + '7'].alignment = c_c_alignment
234
        ws[tce_col + '7'] = "TCE"
235
        ws[tce_col + '7'].border = f_border
236
237
        ws[tce_col + '8'].font = name_font
238
        ws[tce_col + '8'].alignment = c_c_alignment
239
        ws[tce_col + '8'] = round(reporting_period_data['total_in_kgce'], 0)
240
        ws[tce_col + '8'].border = f_border
241
242
        ws[tce_col + '9'].font = name_font
243
        ws[tce_col + '9'].alignment = c_c_alignment
244
        ws[tce_col + '9'] = round(reporting_period_data['total_in_kgce_per_unit_area'], 2)
245
        ws[tce_col + '9'].border = f_border
246
247
        ws[tce_col + '10'].font = name_font
248
        ws[tce_col + '10'].alignment = c_c_alignment
249
        ws[tce_col + '10'] = str(round(reporting_period_data['increment_rate_in_kgce'] * 100, 2)) + "%" \
250
            if reporting_period_data['increment_rate_in_kgce'] is not None else "-"
251
        ws[tce_col + '10'].border = f_border
252
253
        # TCO2E
254
        tco2e_col = chr(ord(end_col) + 2)
255
        ws[tco2e_col + '7'].fill = table_fill
256
        ws[tco2e_col + '7'].font = name_font
257
        ws[tco2e_col + '7'].alignment = c_c_alignment
258
        ws[tco2e_col + '7'] = "TCO2E"
259
        ws[tco2e_col + '7'].border = f_border
260
261
        ws[tco2e_col + '8'].font = name_font
262
        ws[tco2e_col + '8'].alignment = c_c_alignment
263
        ws[tco2e_col + '8'] = round(reporting_period_data['total_in_kgco2e'], 0)
264
        ws[tco2e_col + '8'].border = f_border
265
266
        ws[tco2e_col + '9'].font = name_font
267
        ws[tco2e_col + '9'].alignment = c_c_alignment
268
        ws[tco2e_col + '9'] = round(reporting_period_data['total_in_kgco2e_per_unit_area'], 2)
269
        ws[tco2e_col + '9'].border = f_border
270
271
        ws[tco2e_col + '10'].font = name_font
272
        ws[tco2e_col + '10'].alignment = c_c_alignment
273
        ws[tco2e_col + '10'] = str(round(reporting_period_data['increment_rate_in_kgco2e'] * 100, 2)) + "%" \
274
            if reporting_period_data['increment_rate_in_kgco2e'] is not None else "-"
275
        ws[tco2e_col + '10'].border = f_border
276
    else:
277
        for i in range(6, 10 + 1):
278
            ws.row_dimensions[i].height = 0.1
279
280
    #################################################
281