Code Duplication    Length = 72-75 lines in 4 locations

excelexporters/spaceenergycategory.py 1 location

@@ 294-368 (lines=75) @@
291
            len(reporting_period_data['toppeaks']) == 0:
292
        has_ele_peak_flag = False
293
294
    if has_ele_peak_flag:
295
        ws['B12'].font = title_font
296
        ws['B12'] = name+' 分时电耗'
297
298
        ws['B13'].fill = table_fill
299
        ws['B13'].font = name_font
300
        ws['B13'].alignment = c_c_alignment
301
        ws['B13'].border = f_border
302
303
        ws['C13'].fill = table_fill
304
        ws['C13'].font = name_font
305
        ws['C13'].alignment = c_c_alignment
306
        ws['C13'].border = f_border
307
        ws['C13'] = '分时电耗'
308
309
        ws['B14'].font = title_font
310
        ws['B14'].alignment = c_c_alignment
311
        ws['B14'] = '尖'
312
        ws['B14'].border = f_border
313
314
        ws['C14'].font = title_font
315
        ws['C14'].alignment = c_c_alignment
316
        ws['C14'].border = f_border
317
        ws['C14'] = round(reporting_period_data['toppeaks'][0], 0)
318
319
        ws['B15'].font = title_font
320
        ws['B15'].alignment = c_c_alignment
321
        ws['B15'] = '峰'
322
        ws['B15'].border = f_border
323
324
        ws['C15'].font = title_font
325
        ws['C15'].alignment = c_c_alignment
326
        ws['C15'].border = f_border
327
        ws['C15'] = round(reporting_period_data['onpeaks'][0], 0)
328
329
        ws['B16'].font = title_font
330
        ws['B16'].alignment = c_c_alignment
331
        ws['B16'] = '平'
332
        ws['B16'].border = f_border
333
334
        ws['C16'].font = title_font
335
        ws['C16'].alignment = c_c_alignment
336
        ws['C16'].border = f_border
337
        ws['C16'] = round(reporting_period_data['midpeaks'][0], 0)
338
339
        ws['B17'].font = title_font
340
        ws['B17'].alignment = c_c_alignment
341
        ws['B17'] = '谷'
342
        ws['B17'].border = f_border
343
344
        ws['C17'].font = title_font
345
        ws['C17'].alignment = c_c_alignment
346
        ws['C17'].border = f_border
347
        ws['C17'] = round(reporting_period_data['offpeaks'][0], 0)
348
349
        pie = PieChart()
350
        labels = Reference(ws, min_col=2, min_row=14, max_row=17)
351
        pie_data = Reference(ws, min_col=3, min_row=14, max_row=17)
352
        pie.add_data(pie_data, titles_from_data=True)
353
        pie.set_categories(labels)
354
        pie.height = 5.25  # cm 1.05*5 1.05cm = 30 pt
355
        pie.width = 9
356
        # pie.title = "Pies sold by category"
357
        s1 = pie.series[0]
358
        s1.dLbls = DataLabelList()
359
        s1.dLbls.showCatName = False  # 标签显示
360
        s1.dLbls.showVal = True  # 数量显示
361
        s1.dLbls.showPercent = True  # 百分比显示
362
        # s1 = CharacterProperties(sz=1800)     # 图表中字体大小 *100
363
364
        ws.add_chart(pie, "D13")
365
366
    else:
367
        for i in range(12, 18 + 1):
368
            ws.row_dimensions[i].height = 0.1
369
        # end_row 10
370
        # start_row 12
371
    ################################################

excelexporters/spacecost.py 1 location

@@ 237-309 (lines=73) @@
234
            len(reporting_period_data['toppeaks']) == 0:
235
        has_ele_peak_flag = False
236
237
    if has_ele_peak_flag:
238
        ws['B12'].font = title_font
239
        ws['B12'] = name + '分时用电成本'
240
241
        ws['B13'].fill = table_fill
242
        ws['B13'].font = name_font
243
        ws['B13'].alignment = c_c_alignment
244
        ws['B13'].border = f_border
245
246
        ws['C13'].fill = table_fill
247
        ws['C13'].font = name_font
248
        ws['C13'].alignment = c_c_alignment
249
        ws['C13'].border = f_border
250
        ws['C13'] = '分时用电成本'
251
252
        ws['B14'].font = title_font
253
        ws['B14'].alignment = c_c_alignment
254
        ws['B14'] = '尖'
255
        ws['B14'].border = f_border
256
257
        ws['C14'].font = title_font
258
        ws['C14'].alignment = c_c_alignment
259
        ws['C14'].border = f_border
260
        ws['C14'] = round(reporting_period_data['toppeaks'][0], 0)
261
262
        ws['B15'].font = title_font
263
        ws['B15'].alignment = c_c_alignment
264
        ws['B15'] = '峰'
265
        ws['B15'].border = f_border
266
267
        ws['C15'].font = title_font
268
        ws['C15'].alignment = c_c_alignment
269
        ws['C15'].border = f_border
270
        ws['C15'] = round(reporting_period_data['onpeaks'][0], 0)
271
272
        ws['B16'].font = title_font
273
        ws['B16'].alignment = c_c_alignment
274
        ws['B16'] = '平'
275
        ws['B16'].border = f_border
276
277
        ws['C16'].font = title_font
278
        ws['C16'].alignment = c_c_alignment
279
        ws['C16'].border = f_border
280
        ws['C16'] = round(reporting_period_data['midpeaks'][0], 0)
281
282
        ws['B17'].font = title_font
283
        ws['B17'].alignment = c_c_alignment
284
        ws['B17'] = '谷'
285
        ws['B17'].border = f_border
286
287
        ws['C17'].font = title_font
288
        ws['C17'].alignment = c_c_alignment
289
        ws['C17'].border = f_border
290
        ws['C17'] = round(reporting_period_data['offpeaks'][0], 0)
291
292
        pie = PieChart()
293
        labels = Reference(ws, min_col=2, min_row=14, max_row=17)
294
        pie_data = Reference(ws, min_col=3, min_row=13, max_row=17)
295
        pie.add_data(pie_data, titles_from_data=True)
296
        pie.set_categories(labels)
297
        pie.height = 5.25
298
        pie.width = 9
299
        s1 = pie.series[0]
300
        s1.dLbls = DataLabelList()
301
        s1.dLbls.showCatName = False
302
        s1.dLbls.showVal = True
303
        s1.dLbls.showPercent = True
304
305
        ws.add_chart(pie, "D13")
306
307
    else:
308
        for i in range(12, 18 + 1):
309
            ws.row_dimensions[i].height = 0.1
310
311
    ##################################
312
    current_row_number = 19

excelexporters/tenantenergycategory.py 1 location

@@ 288-359 (lines=72) @@
285
            len(reporting_period_data['toppeaks']) == 0:
286
        has_ele_peak_flag = False
287
288
    if has_ele_peak_flag:
289
        ws['B12'].font = title_font
290
        ws['B12'] = name+' 分时电耗'
291
292
        ws['B13'].fill = table_fill
293
        ws['B13'].font = name_font
294
        ws['B13'].alignment = c_c_alignment
295
        ws['B13'].border = f_border
296
297
        ws['C13'].fill = table_fill
298
        ws['C13'].font = name_font
299
        ws['C13'].alignment = c_c_alignment
300
        ws['C13'].border = f_border
301
        ws['C13'] = '分时电耗'
302
303
        ws['B14'].font = title_font
304
        ws['B14'].alignment = c_c_alignment
305
        ws['B14'] = '尖'
306
        ws['B14'].border = f_border
307
308
        ws['C14'].font = title_font
309
        ws['C14'].alignment = c_c_alignment
310
        ws['C14'].border = f_border
311
        ws['C14'] = round(reporting_period_data['toppeaks'][0], 0)
312
313
        ws['B15'].font = title_font
314
        ws['B15'].alignment = c_c_alignment
315
        ws['B15'] = '峰'
316
        ws['B15'].border = f_border
317
318
        ws['C15'].font = title_font
319
        ws['C15'].alignment = c_c_alignment
320
        ws['C15'].border = f_border
321
        ws['C15'] = round(reporting_period_data['onpeaks'][0], 0)
322
323
        ws['B16'].font = title_font
324
        ws['B16'].alignment = c_c_alignment
325
        ws['B16'] = '平'
326
        ws['B16'].border = f_border
327
328
        ws['C16'].font = title_font
329
        ws['C16'].alignment = c_c_alignment
330
        ws['C16'].border = f_border
331
        ws['C16'] = round(reporting_period_data['midpeaks'][0], 0)
332
333
        ws['B17'].font = title_font
334
        ws['B17'].alignment = c_c_alignment
335
        ws['B17'] = '谷'
336
        ws['B17'].border = f_border
337
338
        ws['C17'].font = title_font
339
        ws['C17'].alignment = c_c_alignment
340
        ws['C17'].border = f_border
341
        ws['C17'] = round(reporting_period_data['offpeaks'][0], 0)
342
343
        pie = PieChart()
344
        labels = Reference(ws, min_col=2, min_row=14, max_row=17)
345
        pie_data = Reference(ws, min_col=3, min_row=13, max_row=17)
346
        pie.add_data(pie_data, titles_from_data=True)
347
        pie.set_categories(labels)
348
        pie.height = 5.25
349
        pie.width = 9
350
        s1 = pie.series[0]
351
        s1.dLbls = DataLabelList()
352
        s1.dLbls.showCatName = False
353
        s1.dLbls.showVal = True
354
        s1.dLbls.showPercent = True
355
        ws.add_chart(pie, "D13")
356
357
    else:
358
        for i in range(12, 18 + 1):
359
            ws.row_dimensions[i].height = 0.1
360
361
    ################################################
362

excelexporters/tenantcost.py 1 location

@@ 261-332 (lines=72) @@
258
            len(reporting_period_data['toppeaks']) == 0:
259
        has_ele_peak_flag = False
260
261
    if has_ele_peak_flag:
262
        ws['B12'].font = title_font
263
        ws['B12'] = name+' 分时电耗'
264
265
        ws['B13'].fill = table_fill
266
        ws['B13'].font = name_font
267
        ws['B13'].alignment = c_c_alignment
268
        ws['B13'].border = f_border
269
270
        ws['C13'].fill = table_fill
271
        ws['C13'].font = name_font
272
        ws['C13'].alignment = c_c_alignment
273
        ws['C13'].border = f_border
274
        ws['C13'] = '分时电耗'
275
276
        ws['B14'].font = title_font
277
        ws['B14'].alignment = c_c_alignment
278
        ws['B14'] = '尖'
279
        ws['B14'].border = f_border
280
281
        ws['C14'].font = title_font
282
        ws['C14'].alignment = c_c_alignment
283
        ws['C14'].border = f_border
284
        ws['C14'] = round(reporting_period_data['toppeaks'][0], 0)
285
286
        ws['B15'].font = title_font
287
        ws['B15'].alignment = c_c_alignment
288
        ws['B15'] = '峰'
289
        ws['B15'].border = f_border
290
291
        ws['C15'].font = title_font
292
        ws['C15'].alignment = c_c_alignment
293
        ws['C15'].border = f_border
294
        ws['C15'] = round(reporting_period_data['onpeaks'][0], 0)
295
296
        ws['B16'].font = title_font
297
        ws['B16'].alignment = c_c_alignment
298
        ws['B16'] = '平'
299
        ws['B16'].border = f_border
300
301
        ws['C16'].font = title_font
302
        ws['C16'].alignment = c_c_alignment
303
        ws['C16'].border = f_border
304
        ws['C16'] = round(reporting_period_data['midpeaks'][0], 0)
305
306
        ws['B17'].font = title_font
307
        ws['B17'].alignment = c_c_alignment
308
        ws['B17'] = '谷'
309
        ws['B17'].border = f_border
310
311
        ws['C17'].font = title_font
312
        ws['C17'].alignment = c_c_alignment
313
        ws['C17'].border = f_border
314
        ws['C17'] = round(reporting_period_data['offpeaks'][0], 0)
315
316
        pie = PieChart()
317
        labels = Reference(ws, min_col=2, min_row=14, max_row=17)
318
        pie_data = Reference(ws, min_col=3, min_row=13, max_row=17)
319
        pie.add_data(pie_data, titles_from_data=True)
320
        pie.set_categories(labels)
321
        pie.height = 5.25
322
        pie.width = 9
323
        s1 = pie.series[0]
324
        s1.dLbls = DataLabelList()
325
        s1.dLbls.showCatName = False
326
        s1.dLbls.showVal = True
327
        s1.dLbls.showPercent = True
328
        ws.add_chart(pie, "D13")
329
330
    else:
331
        for i in range(12, 18 + 1):
332
            ws.row_dimensions[i].height = 0.1
333
334
    ################################################
335