Code Duplication    Length = 73-77 lines in 4 locations

excelexporters/spaceenergycategory.py 1 location

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

excelexporters/spacecost.py 1 location

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

excelexporters/tenantenergycategory.py 1 location

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

excelexporters/tenantcost.py 1 location

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