Code Duplication    Length = 66-66 lines in 2 locations

myems-api/excelexporters/combinedequipmentoutput.py 1 location

@@ 188-253 (lines=66) @@
185
186
    reporting_period_data = report['reporting_period']
187
188
    if "names" not in reporting_period_data.keys() or \
189
            reporting_period_data['names'] is None or \
190
            len(reporting_period_data['names']) == 0:
191
        pass
192
    else:
193
        ws['B' + str(current_row_number)].font = title_font
194
        ws['B' + str(current_row_number)] = name + ' ' + _('Reporting Period Output')
195
196
        current_row_number += 1
197
198
        category = reporting_period_data['names']
199
        ca_len = len(category)
200
201
        ws.row_dimensions[current_row_number].height = 60
202
        ws['B' + str(current_row_number)].fill = table_fill
203
        ws['B' + str(current_row_number)].border = f_border
204
205
        col = 'C'
206
207
        for i in range(0, ca_len):
208
            ws[col + str(current_row_number)].fill = table_fill
209
            ws[col + str(current_row_number)].font = name_font
210
            ws[col + str(current_row_number)].alignment = c_c_alignment
211
            ws[col + str(current_row_number)].border = f_border
212
            ws[col + str(current_row_number)] = \
213
                reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + ")"
214
215
            col = chr(ord(col) + 1)
216
217
        current_row_number += 1
218
219
        ws['B' + str(current_row_number)].font = title_font
220
        ws['B' + str(current_row_number)].alignment = c_c_alignment
221
        ws['B' + str(current_row_number)].border = f_border
222
        ws['B' + str(current_row_number)] = _('Output')
223
224
        col = 'C'
225
226
        for i in range(0, ca_len):
227
            ws[col + str(current_row_number)].font = name_font
228
            ws[col + str(current_row_number)].alignment = c_c_alignment
229
            ws[col + str(current_row_number)].border = f_border
230
            ws[col + str(current_row_number)] = round2(reporting_period_data['subtotals'][i], 2)
231
232
            col = chr(ord(col) + 1)
233
234
        current_row_number += 1
235
236
        ws['B' + str(current_row_number)].font = title_font
237
        ws['B' + str(current_row_number)].alignment = c_c_alignment
238
        ws['B' + str(current_row_number)].border = f_border
239
        ws['B' + str(current_row_number)] = _('Increment Rate')
240
241
        col = 'C'
242
243
        for i in range(0, ca_len):
244
            ws[col + str(current_row_number)].font = name_font
245
            ws[col + str(current_row_number)].alignment = c_c_alignment
246
            ws[col + str(current_row_number)].border = f_border
247
            ws[col + str(current_row_number)] = str(
248
                round2(reporting_period_data['increment_rates'][i] * 100, 2)) + '%' \
249
                if reporting_period_data['increment_rates'][i] is not None else '-'
250
251
            col = chr(ord(col) + 1)
252
253
        current_row_number += 2
254
255
    ####################################################################################################################
256
    table_start_draw_flag = current_row_number + 1

myems-api/excelexporters/equipmentoutput.py 1 location

@@ 181-246 (lines=66) @@
178
179
    current_row_number = 7
180
    reporting_period_data = report['reporting_period']
181
    if "names" not in reporting_period_data.keys() or \
182
            reporting_period_data['names'] is None or \
183
            len(reporting_period_data['names']) == 0:
184
        pass
185
    else:
186
        ws['B' + str(current_row_number)].font = title_font
187
        ws['B' + str(current_row_number)] = name + ' ' + _('Reporting Period Output')
188
189
        current_row_number += 1
190
191
        category = reporting_period_data['names']
192
        ca_len = len(category)
193
194
        ws.row_dimensions[current_row_number].height = 60
195
        ws['B' + str(current_row_number)].fill = table_fill
196
        ws['B' + str(current_row_number)].border = f_border
197
198
        col = 'C'
199
200
        for i in range(0, ca_len):
201
            ws[col + str(current_row_number)].fill = table_fill
202
            ws[col + str(current_row_number)].font = name_font
203
            ws[col + str(current_row_number)].alignment = c_c_alignment
204
            ws[col + str(current_row_number)].border = f_border
205
            ws[col + str(current_row_number)] = \
206
                reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + ")"
207
208
            col = chr(ord(col) + 1)
209
210
        current_row_number += 1
211
212
        ws['B' + str(current_row_number)].font = title_font
213
        ws['B' + str(current_row_number)].alignment = c_c_alignment
214
        ws['B' + str(current_row_number)].border = f_border
215
        ws['B' + str(current_row_number)] = _('Output')
216
217
        col = 'C'
218
219
        for i in range(0, ca_len):
220
            ws[col + str(current_row_number)].font = name_font
221
            ws[col + str(current_row_number)].alignment = c_c_alignment
222
            ws[col + str(current_row_number)].border = f_border
223
            ws[col + str(current_row_number)] = round2(reporting_period_data['subtotals'][i], 2)
224
225
            col = chr(ord(col) + 1)
226
227
        current_row_number += 1
228
229
        ws['B' + str(current_row_number)].font = title_font
230
        ws['B' + str(current_row_number)].alignment = c_c_alignment
231
        ws['B' + str(current_row_number)].border = f_border
232
        ws['B' + str(current_row_number)] = _('Increment Rate')
233
234
        col = 'C'
235
236
        for i in range(0, ca_len):
237
            ws[col + str(current_row_number)].font = name_font
238
            ws[col + str(current_row_number)].alignment = c_c_alignment
239
            ws[col + str(current_row_number)].border = f_border
240
            ws[col + str(current_row_number)] = str(
241
                round2(reporting_period_data['increment_rates'][i] * 100, 2)) + '%' \
242
                if reporting_period_data['increment_rates'][i] is not None else '-'
243
244
            col = chr(ord(col) + 1)
245
246
        current_row_number += 2
247
248
    ####################################################################################################################
249
    table_start_draw_flag = current_row_number + 1