diff --git a/project/app/__pycache__/__init__.cpython-310.pyc b/project/app/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index e84fc361..00000000 Binary files a/project/app/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/project/app/__pycache__/__init__.cpython-311.pyc b/project/app/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index d0891a13..00000000 Binary files a/project/app/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/project/app/__pycache__/__init__.cpython-38.pyc b/project/app/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 2cc52291..00000000 Binary files a/project/app/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/admin.cpython-310.pyc b/project/app/__pycache__/admin.cpython-310.pyc deleted file mode 100644 index 3afb4c85..00000000 Binary files a/project/app/__pycache__/admin.cpython-310.pyc and /dev/null differ diff --git a/project/app/__pycache__/admin.cpython-311.pyc b/project/app/__pycache__/admin.cpython-311.pyc deleted file mode 100644 index e5ec7b0e..00000000 Binary files a/project/app/__pycache__/admin.cpython-311.pyc and /dev/null differ diff --git a/project/app/__pycache__/admin.cpython-38.pyc b/project/app/__pycache__/admin.cpython-38.pyc deleted file mode 100644 index 95a85748..00000000 Binary files a/project/app/__pycache__/admin.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/apps.cpython-310.pyc b/project/app/__pycache__/apps.cpython-310.pyc deleted file mode 100644 index 63e76c30..00000000 Binary files a/project/app/__pycache__/apps.cpython-310.pyc and /dev/null differ diff --git a/project/app/__pycache__/apps.cpython-311.pyc b/project/app/__pycache__/apps.cpython-311.pyc deleted file mode 100644 index 220056c8..00000000 Binary files a/project/app/__pycache__/apps.cpython-311.pyc and /dev/null differ diff --git a/project/app/__pycache__/apps.cpython-38.pyc b/project/app/__pycache__/apps.cpython-38.pyc deleted file mode 100644 index bbc95296..00000000 Binary files a/project/app/__pycache__/apps.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/capa.cpython-38.pyc b/project/app/__pycache__/capa.cpython-38.pyc deleted file mode 100644 index 1d709008..00000000 Binary files a/project/app/__pycache__/capa.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/estilo.cpython-38.pyc b/project/app/__pycache__/estilo.cpython-38.pyc deleted file mode 100644 index 05a4664d..00000000 Binary files a/project/app/__pycache__/estilo.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/estilo_fundep.cpython-38.pyc b/project/app/__pycache__/estilo_fundep.cpython-38.pyc deleted file mode 100644 index 6b7ce0a0..00000000 Binary files a/project/app/__pycache__/estilo_fundep.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/models.cpython-310.pyc b/project/app/__pycache__/models.cpython-310.pyc deleted file mode 100644 index aed424d3..00000000 Binary files a/project/app/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/project/app/__pycache__/models.cpython-311.pyc b/project/app/__pycache__/models.cpython-311.pyc deleted file mode 100644 index faf18252..00000000 Binary files a/project/app/__pycache__/models.cpython-311.pyc and /dev/null differ diff --git a/project/app/__pycache__/models.cpython-38.pyc b/project/app/__pycache__/models.cpython-38.pyc deleted file mode 100644 index da00ce1f..00000000 Binary files a/project/app/__pycache__/models.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/new_dev.cpython-38.pyc b/project/app/__pycache__/new_dev.cpython-38.pyc deleted file mode 100644 index ac7b4ac1..00000000 Binary files a/project/app/__pycache__/new_dev.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/oracle_cruds.cpython-38.pyc b/project/app/__pycache__/oracle_cruds.cpython-38.pyc deleted file mode 100644 index fb690a51..00000000 Binary files a/project/app/__pycache__/oracle_cruds.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/preenche_fub.cpython-38.pyc b/project/app/__pycache__/preenche_fub.cpython-38.pyc deleted file mode 100644 index 593bdbb7..00000000 Binary files a/project/app/__pycache__/preenche_fub.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/preenche_fundep.cpython-38.pyc b/project/app/__pycache__/preenche_fundep.cpython-38.pyc deleted file mode 100644 index 8b9cfb6b..00000000 Binary files a/project/app/__pycache__/preenche_fundep.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/preencher_colunas.cpython-38.pyc b/project/app/__pycache__/preencher_colunas.cpython-38.pyc deleted file mode 100644 index b63d009f..00000000 Binary files a/project/app/__pycache__/preencher_colunas.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/urls.cpython-310.pyc b/project/app/__pycache__/urls.cpython-310.pyc deleted file mode 100644 index 67f4815d..00000000 Binary files a/project/app/__pycache__/urls.cpython-310.pyc and /dev/null differ diff --git a/project/app/__pycache__/urls.cpython-311.pyc b/project/app/__pycache__/urls.cpython-311.pyc deleted file mode 100644 index 90817f00..00000000 Binary files a/project/app/__pycache__/urls.cpython-311.pyc and /dev/null differ diff --git a/project/app/__pycache__/urls.cpython-38.pyc b/project/app/__pycache__/urls.cpython-38.pyc deleted file mode 100644 index 78f94d4b..00000000 Binary files a/project/app/__pycache__/urls.cpython-38.pyc and /dev/null differ diff --git a/project/app/__pycache__/views.cpython-310.pyc b/project/app/__pycache__/views.cpython-310.pyc deleted file mode 100644 index a1c16d54..00000000 Binary files a/project/app/__pycache__/views.cpython-310.pyc and /dev/null differ diff --git a/project/app/__pycache__/views.cpython-311.pyc b/project/app/__pycache__/views.cpython-311.pyc deleted file mode 100644 index 3f43d846..00000000 Binary files a/project/app/__pycache__/views.cpython-311.pyc and /dev/null differ diff --git a/project/app/__pycache__/views.cpython-38.pyc b/project/app/__pycache__/views.cpython-38.pyc deleted file mode 100644 index ddbe8ce0..00000000 Binary files a/project/app/__pycache__/views.cpython-38.pyc and /dev/null differ diff --git a/project/app/capa.py b/project/app/capa.py index f14af5f3..94a591aa 100644 --- a/project/app/capa.py +++ b/project/app/capa.py @@ -136,7 +136,7 @@ def inserir_round_retangulo(planilha,data1,data2,dicionariofin): worksheet = workbook['Capa Finatec'] - + # List of image names image_names = [ 'agencia.png',#0 @@ -168,18 +168,20 @@ def inserir_round_retangulo(planilha,data1,data2,dicionariofin): 'centrodecusto_branco.png' ] - # Path to the images - path = '/home/ubuntu/Desktop/entrega/05_PipelineFinatec/project/app/capa_60/' + # List to hold Image objects images = [] + nomePasta = "imagensCapa" + diretorio = os.path.dirname(__file__) + # Loop through the list of image names and create Image objects for i, name in enumerate(image_names): - image_path = path + name - pil_image = PILImage.open(image_path) - pil_image.save(image_path) - img = Image(image_path) + caminhoImage = os.path.join(diretorio, nomePasta, name) + pil_image = PILImage.open(caminhoImage) + pil_image.save(caminhoImage) + img = Image(caminhoImage) images.append(img) diff --git a/project/app/estiloFINEP.py b/project/app/estiloFINEP.py new file mode 100644 index 00000000..3d60c294 --- /dev/null +++ b/project/app/estiloFINEP.py @@ -0,0 +1,369 @@ +import openpyxl +from openpyxl.styles import Font, PatternFill, Alignment,NamedStyle,Border, Side +import os +#pegar o caminho do arquivo +def pegar_caminho(nome_arquivo): + + # Obter o caminho absoluto do arquivo Python em execução + caminho_script = os.path.abspath(__file__) + + # Obter o diretório da pasta onde o script está localizado + pasta_script = os.path.dirname(caminho_script) + + # Combinar o caminho da pasta com o nome do arquivo Excel + caminho = os.path.join(pasta_script, nome_arquivo) + + return caminho + +def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela): + nomeSheet=nomeVariavel + caminho = pegar_caminho(tabela) + workbook = openpyxl.load_workbook(caminho) + worksheet = workbook[nomeTabela] + size = tamanho + 10 + cinza = "d9d9d9" + cinza_escuro = "bfbfbf" + azul_claro = 'cdfffe' + + borda = Border(right=Side(border_style="medium")) + worksheet.sheet_view.showGridLines = False + # + for row in worksheet.iter_rows(min_row=1, max_row=size+11,min_col=10,max_col=10): + for cell in row: + cell.border = borda + + + worksheet.column_dimensions['a'].width = 25 + worksheet.column_dimensions['b'].width = 25 + worksheet.column_dimensions['c'].width = 35 + worksheet.column_dimensions['d'].width = 35#descrição + worksheet.column_dimensions['e'].width = 65 #n do recibo ou qeuivalente + worksheet.column_dimensions['f'].width = 25 #data de emissão + worksheet.column_dimensions['g'].width = 25 #data de emissão + worksheet.column_dimensions['h'].width = 25 #data de emissão + worksheet.column_dimensions['i'].width = 25 #data de emissão + worksheet.column_dimensions['j'].width = 25 #data de emissão + + + #cabecario relação de pagamentos - outro servicoes de terceiros + worksheet.merge_cells('A1:J2') + if nomeSheet == "diarias": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - DIÁRIAS' + elif nomeSheet == "pessoaFisica": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - OUTROS SERVIÇOS DE TERCEIROS - PF' + elif nomeSheet == "pessoaJuridica": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - OUTROS SERVIÇOS DE TERCEIROS - PESSOA JURÍDICA' + elif nomeSheet == "passagenDespLocomo": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - PASSAGENS E DESPESAS COM LOCOMOÇÃO' + elif nomeSheet == "outrosServiçosTerceiros": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - O U T R O S S E R V I Ç O S D E T E R C E I R O S - C E L E T I S T A S' + elif nomeSheet == "auxilioEstudante": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - AUXÍLIO FINANCEIRO A ESTUDANTE' + elif nomeSheet == "bolsaExtensao": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - BOLSA DE EXTENSÃO' + elif nomeSheet == "estagiario": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - ESTAGIÁRIO' + elif nomeSheet == "custosIndiretos": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - CUSTOS INDIRETOS - FUB' + elif nomeSheet == "materialDeConsumo": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - MATERIAL DE CONSUMO' + elif nomeSheet == "equipamentoMaterialPermanente": + worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - EQUIPAMENTO E MATERIAL PERMANENTE' + + + worksheet['A1'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A1'].alignment = Alignment(horizontal="center",vertical="center") + worksheet['A1'].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + + worksheet.merge_cells('A3:F3') + worksheet['A3'] = "=''Relatório de Exec Financ A.1'!A3" + worksheet['A3'].font = Font(name="Arial", size=12, color="000000") + worksheet['A3'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A4:F4') + worksheet['A4'] = "=''Relatório de Exec Financ A.1'!A4" + worksheet['A4'].font = Font(name="Arial", size=12, color="000000") + worksheet['A4'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A5:F5') + worksheet['A5'] = "=''Relatório de Exec Financ A.1'!A5" + worksheet['A5'].font = Font(name="Arial", size=12, color="000000") + worksheet['A5'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A6:F6') + worksheet['A6'] = "=''Relatório de Exec Financ A.1'!A6" + worksheet['A6'].font = Font(name="Arial", size=12, color="000000") + worksheet['A6'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A7:F7') + worksheet['A7'] = "=''Relatório de Exec Financ A.1'!A7" + worksheet['A7'].font = Font(name="Arial", size=12, color="000000") + worksheet['A7'].alignment = Alignment(horizontal="left",vertical="center") + + #variavel + + input2=f'rowStyle{nomeVariavel}' + + + #colunas azul cabecario + locals()[input2] = NamedStyle(name=f'{input2}') + locals()[input2].font = Font(name="Arial", size=12, color="000000",bold=True) + locals()[input2].fill = openpyxl.styles.PatternFill(start_color=azul_claro, end_color=azul_claro, fill_type='solid') + locals()[input2].alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + locals()[input2].border = Border(top=Side(border_style="medium") ,bottom=Side(border_style="thin") ) + locals()[input2].height = 20 + linha_number = 9 + for row in worksheet.iter_rows(min_row=linha_number, max_row=linha_number, min_col=1, max_col=10): + for cell in row: + cell.style = locals()[input2] + if cell.column == 10: + cell.border = Border(top=Side(border_style="medium") ,bottom=Side(border_style="thin"), right=Side(border_style="medium") ) + + valores = ["Nº DE ORDEM","CREDOR","CNPJ/CPF",'Equivalência na Relação de Itens Apoiados','Nº DA NOTA FISCAL OU EQUIVALENTE',"DATA DA NOTA FISCAL","Nº DO CHEQUE OU EQUIVALENTE",'DATA DA COMPENSAÇÃO DO CHEQUE','VALOR'] + col = 1 + for a,b in enumerate(valores): + worksheet.cell(row=linha_number, column=col, value=b) + col = col + 1 + + + #Aumentar a altura das celulas + for row in worksheet.iter_rows(min_row=10, max_row=size, min_col=1, max_col=10): + worksheet.row_dimensions[row[0].row].height = 60 + input3 = f'customNumber{nomeVariavel}' + + # MASCARA R$ + + locals()[input3] = NamedStyle(name=f'{input3}') + locals()[input3].number_format = 'R$ #,##0.00' + locals()[input3].font = Font(name="Arial", size=12, color="000000") + locals()[input3].alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + + #estilocinzasimcinzanao + value_to_stop = size + start_row = 10 +# + for row in range(start_row,size+1): + cell = worksheet[f'J{row}'] + cell.style = locals()[input3] + + for rows in worksheet.iter_rows(min_row=10, max_row=size, min_col=1, max_col=10): + for cell in rows: + if cell.row % 2: + cell.fill = PatternFill(start_color=cinza, end_color=cinza, + fill_type = "solid") + if cell.column == 10: + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="hair") ,right =Side(border_style="medium") ,bottom=Side(border_style="hair") ) + else: + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="hair") ,right =Side(border_style="hair") ,bottom=Side(border_style="hair") ) + + + #subtotal + stringAfinarCelula =size+2 + worksheet.row_dimensions[size+2].height = 6 + celulas_mergidas_subtotal = f"A{size+2}:I{size+2}" + worksheet.merge_cells(celulas_mergidas_subtotal) + left_celula_cell = f"A{size+2}" + top_left_cell = worksheet[left_celula_cell] + top_left_cell.value = "Sub Total1" + top_left_cell.fill = PatternFill(start_color=cinza, end_color=cinza,fill_type = "solid") + top_left_cell.font = Font(name="Arial", size=12, color="000000",bold=True) + top_left_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_cell.border = Border(top=Side(border_style="thin") ,left = Side(border_style="medium") ,right =Side(border_style="thin") ,bottom=Side(border_style="medium") ) + + worksheet.row_dimensions[size+2].height = 56.25 + + # FORMULATOTAL + formula = f"=SUM(J10:J{size})" + celula = f'J{size+2}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza, end_color=cinza,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[celula].border = Border(top=Side(border_style="thin") ,left = Side(border_style="thin") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) + worksheet[celula].number_format = 'R$ #,##0.00' + #restituições creditadas + restituicoes = size + 3 + celula_restituicoes=f'A{restituicoes}' + worksheet[celula_restituicoes].value = "RESTITUIÇÕES CREDITADAS" + worksheet[celula_restituicoes].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet.row_dimensions[restituicoes].height = 30 + + + input4 = f'row_style_diaria_append{nomeVariavel}' + #estilo colunas restitucoes creditadas + locals()[input4] = NamedStyle(name=f'{input4}') + locals()[input4].font = Font(name="Arial", size=12, color="000000",bold=True) + locals()[input4].fill = openpyxl.styles.PatternFill(start_color=azul_claro, end_color=azul_claro, fill_type='solid') + locals()[input4].alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + locals()[input4].height = 30 + locals()[input4].border = Border(top=Side(border_style="medium") ,bottom=Side(border_style="medium") ) + + + row_number = size + 4 + + for column in range(1, 11): + cell = worksheet.cell(row=row_number, column=column) + cell.style = locals()[input4] + if cell.column == 10: + cell.border = Border(top=Side(border_style="medium") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) + + + + values = ["Nº DE ORDEM","RESTITUIDOR","CNPJ/CPF",'Equivalência na Relação de Itens Apoiados',"CHEQUE OU EQUIVALENTE ESTORNADO","DATA DO CHEQUE",'Nº DO DEPÓSITO','DATA DO DEPÓSITO','VALOR'] + coluna = 1 + for a,b in enumerate(values): + worksheet.cell(row=row_number, column=coluna, value=b) + coluna = coluna + 1 + + + merge_formula = f'D{row_number}:E{row_number}' + worksheet.merge_cells(merge_formula) + + + #subtotal2 + sub_total2_row = size + 5 + subtotal_merge_cells= f'A{sub_total2_row}:I{sub_total2_row}' + worksheet.merge_cells(subtotal_merge_cells) + top_left_subtotal2_cell_formula = f'A{sub_total2_row}' + top_left_subtotal2_cell = worksheet[top_left_subtotal2_cell_formula] + top_left_subtotal2_cell.value = "Sub Total 2" + top_left_subtotal2_cell.fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + top_left_subtotal2_cell.font = Font(name="Arial", size=12, color="000000",bold=True) + top_left_subtotal2_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_subtotal2_cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="medium") ,right =Side(border_style="hair") ,bottom=Side(border_style="medium") ) + + sub_formula_row_celula = f'J{sub_total2_row}' + worksheet[sub_formula_row_celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[sub_formula_row_celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[sub_formula_row_celula].number_format = 'R$ #,##0.00' + worksheet[sub_formula_row_celula].border = Border(top=Side(border_style="thin") ,left = Side(border_style="thin") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) + + #total1-2 + total12_row = size + 6 + total12_merge_cells = f'A{total12_row}:I{total12_row}' + worksheet.merge_cells(total12_merge_cells) + top_left_total12_cell_formula = f'A{total12_row}' + top_left_total12_cell = worksheet[top_left_total12_cell_formula] + top_left_total12_cell.value = "Total(1-2)" + top_left_total12_cell.fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + top_left_total12_cell.font = Font(name="Arial", size=12, color="000000",bold=True) + top_left_total12_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_total12_cell.border = Border(top=Side(border_style="medium") ,left = Side(border_style="medium") ,bottom=Side(border_style="medium") ) + + + #total_formula + total_formula_row = size + 6 + total_formulaa = f'=J{size}' + total_formula_row_celula = f'J{total_formula_row}' + worksheet[total_formula_row_celula].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + worksheet[total_formula_row_celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[total_formula_row_celula].number_format = 'R$ #,##0.00' + worksheet[total_formula_row_celula].border = Border(top=Side(border_style="medium") ,bottom=Side(border_style="medium"),right=Side(border_style="medium") ) + + worksheet.row_dimensions[total_formula_row].height = 30 + worksheet[total_formula_row_celula] = total_formulaa + + + #brasilia + brasilia_row = size + 7 + brasilia_formula = f"='Receita x Despesa'!A42:J42" + brasilia_merge_cells = f'A{brasilia_row}:I{brasilia_row}' + worksheet.merge_cells(brasilia_merge_cells) + top_left_brasilia_cell_formula = f'A{brasilia_row}' + top_left_brasilia_cell = worksheet[top_left_brasilia_cell_formula] + top_left_brasilia_cell.value = brasilia_formula + top_left_brasilia_cell.alignment = Alignment(horizontal="center",vertical="center") + + #DiretorFinanceiro + diretor_row = size + 8 + diretor_cargo_row = size + 9 + diretor_cpf_row = size + 10 + diretor_nome_formula = f"='Receita x Despesa'!A45" + diretor_cargo_formula = f"='Receita x Despesa'!A46" + diretor_cpf_formula = f"='Receita x Despesa'!A47" + diretor_merge_cells = f'A{diretor_row}:D{diretor_row}' + diretor_cargo_merge_cells = f'A{diretor_cargo_row}:D{diretor_cargo_row}' + diretor_cpf_merge_cells = f'A{diretor_cpf_row}:D{diretor_cpf_row}' + worksheet.merge_cells(diretor_merge_cells) + worksheet.merge_cells(diretor_cargo_merge_cells) + worksheet.merge_cells(diretor_cpf_merge_cells) + top_left_diretor_cell_formula = f'A{diretor_row}' + top_left_diretor_cell_cargo_formula = f'A{diretor_cargo_row}' + top_left_diretor_cell_cpf_formula = f'A{diretor_cpf_row}' + top_left_diretor_cell = worksheet[top_left_diretor_cell_formula] + top_left_diretor_cell_cargo_formula = worksheet[top_left_diretor_cell_cargo_formula] + top_left_diretor_cell_cpf_formula = worksheet[top_left_diretor_cell_cpf_formula] + top_left_diretor_cell.value = diretor_nome_formula + top_left_diretor_cell_cargo_formula.value = diretor_cargo_formula + top_left_diretor_cell_cpf_formula.value = diretor_cpf_formula + top_left_diretor_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell.font = Font(bold=True) + top_left_diretor_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + #Coordenadora + coordenadora_row = size + 8 + coordenadora_cargo_row = size + 9 + coordenadora_cpf_row = size + 10 + coordenadora_nome_formula = f"='Receita x Despesa'!H45" + coordenadora_cargo_formula = f"='Receita x Despesa'!H46" + coordenadora_cpf_formula = f"='Receita x Despesa'!H47" + coordenadora_merge_cells = f'F{coordenadora_row}:J{coordenadora_row}' + coordenadora_cargo_merge_cells = f'F{coordenadora_cargo_row}:J{coordenadora_cargo_row}' + coordenadora_cpf_merge_cells = f'F{coordenadora_cpf_row}:J{coordenadora_cpf_row}' + worksheet.merge_cells(coordenadora_merge_cells) + worksheet.merge_cells(coordenadora_cargo_merge_cells) + worksheet.merge_cells(coordenadora_cpf_merge_cells) + top_left_coordenadora_cell_formula = f'F{coordenadora_row}' + top_left_coordenadora_cell_cargo_formula = f'F{coordenadora_cargo_row}' + top_left_coordenadora_cell_cpf_formula = f'F{coordenadora_cpf_row}' + top_left_coordenadora_cell = worksheet[top_left_coordenadora_cell_formula] + top_left_coordenadora_cell_cargo_formula = worksheet[top_left_coordenadora_cell_cargo_formula] + top_left_coordenadora_cell_cpf_formula = worksheet[top_left_coordenadora_cell_cpf_formula] + top_left_coordenadora_cell.value = coordenadora_nome_formula + top_left_coordenadora_cell_cargo_formula.value = coordenadora_cargo_formula + top_left_coordenadora_cell_cpf_formula.value = coordenadora_cpf_formula + top_left_coordenadora_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell.font= Font(bold = True) + top_left_coordenadora_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + + + # borda = Border(right=Side(border_style="medium")) + # worksheet.sheet_view.showGridLines = False + # # + # for row in worksheet.iter_rows(min_row=1, max_row=coordenadora_cpf_row+1,min_col=10,max_col=10): + # for cell in row: + # cell.border = borda + + + + for row in worksheet.iter_rows(min_row=coordenadora_cpf_row+1, max_row=coordenadora_cpf_row+1,min_col=1,max_col=10): + for cell in row: + if cell.column == 10: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) + else: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="none") ,bottom=Side(border_style="medium") ) + + workbook.save(tabela) + workbook.close() + + + + + + + +tabela = pegar_caminho('modelFINEP.xlsx') +nomeTabela ="Elemento de Despesa 36a" +tituloStyle = "36a" +workbook = openpyxl.load_workbook(tabela) +sheet2 = workbook.create_sheet(title=nomeTabela) +workbook.save("tabelapreenchida.xlsx") +workbook.close() +maior = 20 +tabela2 = pegar_caminho('tabelapreenchida.xlsx') +print(tabela2) +estiloGeral(tabela2,maior,tituloStyle,nomeTabela) diff --git a/project/app/estiloIBICT.py b/project/app/estiloIBICT.py new file mode 100644 index 00000000..53a4b8f6 --- /dev/null +++ b/project/app/estiloIBICT.py @@ -0,0 +1,1055 @@ +import openpyxl +from openpyxl.styles import Font, PatternFill, Alignment,NamedStyle,Border, Side +from openpyxl.drawing.image import Image +from PIL import Image as PILImage +import os +#pegar o caminho do arquivo +def pegar_caminho(nome_arquivo): + + # Obter o caminho absoluto do arquivo Python em execução + caminho_script = os.path.abspath(__file__) + + # Obter o diretório da pasta onde o script está localizado + pasta_script = os.path.dirname(caminho_script) + + # Combinar o caminho da pasta com o nome do arquivo Excel + caminho = os.path.join(pasta_script, nome_arquivo) + + return caminho + + +def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela): + nomeSheet=nomeVariavel + caminho = pegar_caminho(tabela) + workbook = openpyxl.load_workbook(caminho) + worksheet = workbook[nomeTabela] + size = tamanho + 16 + cinza = "d9d9d9" + cinza_escuro = "bfbfbf" + azul = "336394" + azul_claro = '1c8cbc' + + borda = Border(right=Side(border_style="dashed")) + worksheet.sheet_view.showGridLines = False + # + for row in worksheet.iter_rows(min_row=1, max_row=size+11,min_col=10,max_col=10): + for cell in row: + cell.border = borda + + + worksheet.column_dimensions['a'].width = 25 + worksheet.column_dimensions['b'].width = 25 + worksheet.column_dimensions['c'].width = 35 + worksheet.column_dimensions['d'].width = 35#descrição + worksheet.column_dimensions['e'].width = 65 #n do recibo ou qeuivalente + worksheet.column_dimensions['f'].width = 25 #data de emissão + worksheet.column_dimensions['g'].width = 25 #data de emissão + worksheet.column_dimensions['h'].width = 25 #data de emissão + worksheet.column_dimensions['i'].width = 25 #data de emissão + worksheet.column_dimensions['j'].width = 25 #data de emissão + + + #cabecario relação de pagamentos - outro servicoes de terceiros + worksheet.merge_cells('A7:J8') + if nomeSheet == "diarias": + worksheet['A7'] = f'R E L A Ç Ã O D E P A G A M E N T O S -DIÁRIAS E PASSAGENS' + elif nomeSheet == "custoOperacional": + worksheet['A7'] = f'R E L A Ç Ã O D E P A G A M E N T O S - CUSTO OPERACIONAL' + elif nomeSheet == "pessoaJuridica": + worksheet['A7'] = f'R E L A Ç Ã O D E P A G A M E N T O S - OUTROS SERVIÇOS DE TERCEIROS - PESSOA JURÍDICA' + elif nomeSheet == "bolsaExtensao": + worksheet['A7'] = f'R E L A Ç Ã O D E P A G A M E N T O S - BOLSA DE PESQUISA' + elif nomeSheet == "materialDeConsumo": + worksheet['A7'] = f'R E L A Ç Ã O D E P A G A M E N T O S - MATERIAL DE CONSUMO' + elif nomeSheet == "evento": + worksheet['A7'] = f'R E L A Ç Ã O D E P A G A M E N T O S - EVENTOS' + + + # List of image names + image_names = [ + 'finatec.png', + 'ibict.png' + ] + + # # Path to the images + # path = 'C:\\Users\\Softex\\Desktop\\entrega29\\' + + # # List to hold Image objects + # images = [] + + # # Loop through the list of image names and create Image objects + # for i, name in enumerate(image_names): + # image_path = path + name + # pil_image = PILImage.open(image_path) + # pil_image.save(image_path) + # img = Image(image_path) + # images.append(img) + + # List to hold Image objects + images = [] + + nomePasta = "imagensIBICIT" + diretorio = os.path.dirname(__file__) + + # Loop through the list of image names and create Image objects + for i, name in enumerate(image_names): + caminhoImage = os.path.join(diretorio, nomePasta, name) + pil_image = PILImage.open(caminhoImage) + pil_image.save(caminhoImage) + img = Image(caminhoImage) + images.append(img) + + + worksheet.add_image(images[1], "A1")#ibict + worksheet.add_image(images[0], "H1")#finatec + + + worksheet['A7'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet['A7'].alignment = Alignment(horizontal="center",vertical="center") + worksheet['A7'].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + + worksheet.merge_cells('A9:F9') + worksheet['A9'] = "='Receita x Despesa'!A9:J9" + worksheet['A9'].font = Font(name="Arial", size=12, color="000000") + worksheet['A9'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A10:F10') + worksheet['A10'] = "='Receita x Despesa'!A10:J10" + worksheet['A10'].font = Font(name="Arial", size=12, color="000000") + worksheet['A10'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A11:F11') + worksheet['A11'] = "='Receita x Despesa'!A11:J11" + worksheet['A11'].font = Font(name="Arial", size=12, color="000000") + worksheet['A11'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A12:F12') + worksheet['A12'] = "='Receita x Despesa'!A12:J12" + worksheet['A12'].font = Font(name="Arial", size=12, color="000000") + worksheet['A12'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A13:F13') + worksheet['A13'] = "='Receita x Despesa'!A13:J13" + worksheet['A13'].font = Font(name="Arial", size=12, color="000000") + worksheet['A13'].alignment = Alignment(horizontal="left",vertical="center") + + #variavel + + input2=f'rowStyle{nomeVariavel}' + + + #colunas azul cabecario + locals()[input2] = NamedStyle(name=f'{input2}') + locals()[input2].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + locals()[input2].fill = openpyxl.styles.PatternFill(start_color=azul_claro, end_color=azul_claro, fill_type='solid') + locals()[input2].alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + locals()[input2].border = Border(top=Side(border_style="thin") ,bottom=Side(border_style="thin") ) + locals()[input2].height = 20 + linha_number = 15 + for row in worksheet.iter_rows(min_row=linha_number, max_row=linha_number, min_col=1, max_col=10): + for cell in row: + cell.style = locals()[input2] + if cell.column == 10: + cell.border = Border(top=Side(border_style="thin") ,bottom=Side(border_style="thin"), right=Side(border_style="thin") ) + + valores = ["ITEM","NOME","CNPJ/CPF",'ESPECIFICAÇÃO DA DESPESA','DESCRIÇÃO',"Nº DO RECIBO OU EQUIVALENTE","DATA DE EMISSÃO",'CHEQUE / ORDEM BANCÁRIA','DATA DE PGTO','Valor'] + col = 1 + for a,b in enumerate(valores): + worksheet.cell(row=linha_number, column=col, value=b) + col = col + 1 + + + #Aumentar a altura das celulas + for row in worksheet.iter_rows(min_row=16, max_row=size, min_col=1, max_col=10): + worksheet.row_dimensions[row[0].row].height = 60 + input3 = f'customNumber{nomeVariavel}' + + # MASCARA R$ + + locals()[input3] = NamedStyle(name=f'{input3}') + locals()[input3].number_format = 'R$ #,##0.00' + locals()[input3].font = Font(name="Arial", size=12, color="000000") + locals()[input3].alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + + #estilocinzasimcinzanao + value_to_stop = size + start_row = 16 +# + for row in range(start_row,size+1): + cell = worksheet[f'J{row}'] + cell.style = locals()[input3] + + for rows in worksheet.iter_rows(min_row=16, max_row=size, min_col=1, max_col=10): + for cell in rows: + if cell.row % 2: + cell.fill = PatternFill(start_color=cinza, end_color=cinza, + fill_type = "solid") + if cell.column == 10: + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="hair") ,right =Side(border_style="dashed") ,bottom=Side(border_style="hair") ) + else: + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="hair") ,right =Side(border_style="hair") ,bottom=Side(border_style="hair") ) + + + #subtotal + stringAfinarCelula =size+2 + worksheet.row_dimensions[size+2].height = 6 + celulas_mergidas_subtotal = f"A{size+2}:I{size+2}" + worksheet.merge_cells(celulas_mergidas_subtotal) + left_celula_cell = f"A{size+2}" + top_left_cell = worksheet[left_celula_cell] + top_left_cell.value = "Sub Total1" + top_left_cell.fill = PatternFill(start_color=cinza, end_color=cinza,fill_type = "solid") + top_left_cell.font = Font(name="Arial", size=12, color="000000",bold=True) + top_left_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_cell.border = Border(top=Side(border_style="thin") ,left = Side(border_style="thin") ,right =Side(border_style="thin") ,bottom=Side(border_style="thin") ) + + worksheet.row_dimensions[size+2].height = 56.25 + + # FORMULATOTAL + formula = f"=SUM(J10:J{size})" + celula = f'J{size+2}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza, end_color=cinza,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[celula].border = Border(top=Side(border_style="thin") ,left = Side(border_style="thin") ,right =Side(border_style="dashed") ,bottom=Side(border_style="thin") ) + worksheet[celula].number_format = 'R$ #,##0.00' + #restituições creditadas + restituicoes = size + 3 + celula_restituicoes=f'A{restituicoes}' + worksheet[celula_restituicoes].value = "RESTITUIÇÕES CREDITADAS" + worksheet[celula_restituicoes].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet.row_dimensions[restituicoes].height = 30 + + + input4 = f'row_style_diaria_append{nomeVariavel}' + #estilo colunas restitucoes creditadas + locals()[input4] = NamedStyle(name=f'{input4}') + locals()[input4].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + locals()[input4].fill = openpyxl.styles.PatternFill(start_color=azul_claro, end_color=azul_claro, fill_type='solid') + locals()[input4].alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + locals()[input4].height = 30 + locals()[input4].border = Border(top=Side(border_style="thin") ,bottom=Side(border_style="thin") ) + + + row_number = size + 4 + + for column in range(1, 11): + cell = worksheet.cell(row=row_number, column=column) + cell.style = locals()[input4] + if cell.column == 10: + cell.border = Border(top=Side(border_style="thin") ,right =Side(border_style="thin") ,bottom=Side(border_style="thin") ) + + + + values = ["Item","Restituidor","CNPJ/CPF",'Descrição',"Cheque equivalente","Data do Cheque",'Nº do Depósito','Data da Devolução','Valor'] + coluna = 1 + for a,b in enumerate(values): + worksheet.cell(row=row_number, column=coluna, value=b) + if coluna == 4: + coluna = coluna + 1 + coluna = coluna + 1 + + + merge_formula = f'D{row_number}:E{row_number}' + worksheet.merge_cells(merge_formula) + + + #subtotal2 + sub_total2_row = size + 5 + subtotal_merge_cells= f'A{sub_total2_row}:I{sub_total2_row}' + worksheet.merge_cells(subtotal_merge_cells) + top_left_subtotal2_cell_formula = f'A{sub_total2_row}' + top_left_subtotal2_cell = worksheet[top_left_subtotal2_cell_formula] + top_left_subtotal2_cell.value = "Sub Total 2" + top_left_subtotal2_cell.fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + top_left_subtotal2_cell.font = Font(name="Arial", size=12, color="000000",bold=True) + top_left_subtotal2_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_subtotal2_cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="thin") ,right =Side(border_style="hair") ,bottom=Side(border_style="thin") ) + + sub_formula_row_celula = f'J{sub_total2_row}' + worksheet[sub_formula_row_celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[sub_formula_row_celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[sub_formula_row_celula].number_format = 'R$ #,##0.00' + worksheet[sub_formula_row_celula].border = Border(top=Side(border_style="thin") ,left = Side(border_style="thin") ,right =Side(border_style="thin") ,bottom=Side(border_style="thin") ) + + #total1-2 + total12_row = size + 6 + total12_merge_cells = f'A{total12_row}:I{total12_row}' + worksheet.merge_cells(total12_merge_cells) + top_left_total12_cell_formula = f'A{total12_row}' + top_left_total12_cell = worksheet[top_left_total12_cell_formula] + top_left_total12_cell.value = "Total(1-2)" + top_left_total12_cell.fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + top_left_total12_cell.font = Font(name="Arial", size=12, color="000000",bold=True) + top_left_total12_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_total12_cell.border = Border(top=Side(border_style="thin") ,left = Side(border_style="thin") ,bottom=Side(border_style="thin") ) + + + #total_formula + total_formula_row = size + 6 + total_formulaa = f'=J{size}' + total_formula_row_celula = f'J{total_formula_row}' + worksheet[total_formula_row_celula].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + worksheet[total_formula_row_celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[total_formula_row_celula].number_format = 'R$ #,##0.00' + worksheet[total_formula_row_celula].border = Border(top=Side(border_style="thin") ,bottom=Side(border_style="thin"),right=Side(border_style="thin") ) + + worksheet.row_dimensions[total_formula_row].height = 30 + worksheet[total_formula_row_celula] = total_formulaa + + + #valor + + + #brasilia + brasilia_row = size + 7 + brasilia_formula = f"='Receita x Despesa'!A44:J44" + brasilia_merge_cells = f'A{brasilia_row}:I{brasilia_row}' + worksheet.merge_cells(brasilia_merge_cells) + top_left_brasilia_cell_formula = f'A{brasilia_row}' + top_left_brasilia_cell = worksheet[top_left_brasilia_cell_formula] + top_left_brasilia_cell.value = brasilia_formula + top_left_brasilia_cell.alignment = Alignment(horizontal="center",vertical="center") + + #DiretorFinanceiro + diretor_row = size + 8 + diretor_cargo_row = size + 9 + diretor_cpf_row = size + 10 + diretor_nome_formula = f"='Receita x Despesa'!A48" + diretor_cargo_formula = f"='Receita x Despesa'!A49" + diretor_cpf_formula = f"='Receita x Despesa'!A50" + diretor_merge_cells = f'A{diretor_row}:D{diretor_row}' + diretor_cargo_merge_cells = f'A{diretor_cargo_row}:D{diretor_cargo_row}' + diretor_cpf_merge_cells = f'A{diretor_cpf_row}:D{diretor_cpf_row}' + worksheet.merge_cells(diretor_merge_cells) + worksheet.merge_cells(diretor_cargo_merge_cells) + worksheet.merge_cells(diretor_cpf_merge_cells) + top_left_diretor_cell_formula = f'A{diretor_row}' + top_left_diretor_cell_cargo_formula = f'A{diretor_cargo_row}' + top_left_diretor_cell_cpf_formula = f'A{diretor_cpf_row}' + top_left_diretor_cell = worksheet[top_left_diretor_cell_formula] + top_left_diretor_cell_cargo_formula = worksheet[top_left_diretor_cell_cargo_formula] + top_left_diretor_cell_cpf_formula = worksheet[top_left_diretor_cell_cpf_formula] + top_left_diretor_cell.value = diretor_nome_formula + top_left_diretor_cell_cargo_formula.value = diretor_cargo_formula + top_left_diretor_cell_cpf_formula.value = diretor_cpf_formula + top_left_diretor_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell.font = Font(bold=True) + top_left_diretor_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + #Coordenadora + coordenadora_row = size + 8 + coordenadora_cargo_row = size + 9 + coordenadora_cpf_row = size + 10 + coordenadora_nome_formula = f"='Receita x Despesa'!G48" + coordenadora_cargo_formula = f"='Receita x Despesa'!G49" + coordenadora_cpf_formula = f"='Receita x Despesa'!G50" + coordenadora_merge_cells = f'F{coordenadora_row}:J{coordenadora_row}' + coordenadora_cargo_merge_cells = f'F{coordenadora_cargo_row}:J{coordenadora_cargo_row}' + coordenadora_cpf_merge_cells = f'F{coordenadora_cpf_row}:J{coordenadora_cpf_row}' + worksheet.merge_cells(coordenadora_merge_cells) + worksheet.merge_cells(coordenadora_cargo_merge_cells) + worksheet.merge_cells(coordenadora_cpf_merge_cells) + top_left_coordenadora_cell_formula = f'F{coordenadora_row}' + top_left_coordenadora_cell_cargo_formula = f'F{coordenadora_cargo_row}' + top_left_coordenadora_cell_cpf_formula = f'F{coordenadora_cpf_row}' + top_left_coordenadora_cell = worksheet[top_left_coordenadora_cell_formula] + top_left_coordenadora_cell_cargo_formula = worksheet[top_left_coordenadora_cell_cargo_formula] + top_left_coordenadora_cell_cpf_formula = worksheet[top_left_coordenadora_cell_cpf_formula] + top_left_coordenadora_cell.value = coordenadora_nome_formula + top_left_coordenadora_cell_cargo_formula.value = coordenadora_cargo_formula + top_left_coordenadora_cell_cpf_formula.value = coordenadora_cpf_formula + top_left_coordenadora_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell.font= Font(bold = True) + top_left_coordenadora_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + + + # borda = Border(right=Side(border_style="thin")) + # worksheet.sheet_view.showGridLines = False + # # + # for row in worksheet.iter_rows(min_row=1, max_row=coordenadora_cpf_row+1,min_col=10,max_col=10): + # for cell in row: + # cell.border = borda + + + + for row in worksheet.iter_rows(min_row=coordenadora_cpf_row+1, max_row=coordenadora_cpf_row+1,min_col=1,max_col=10): + for cell in row: + if cell.column == 10: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="dashed") ,bottom=Side(border_style="dashed") ) + else: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="none") ,bottom=Side(border_style="dashed") ) + + bord = Border(right=Side(border_style="dashed")) + + # + for row in worksheet.iter_rows(min_row=1, max_row=14,min_col=10,max_col=10): + for cell in row: + cell.border = bord + + workbook.save(tabela) + workbook.close() + +def estilo_conciliacoes_bancaria(tabela,tamanho,tamanho2): + + + caminho = pegar_caminho(tabela) + workbook = openpyxl.load_workbook(caminho) + worksheet = workbook['Conciliação Bancária'] + + + size = tamanho + 21 + #worksheet.row_dimensions[27].height = 50 + cinza = "d9d9d9" + cinza_escuro = "bfbfbf" + azul = "336394" + azul_claro = '1c8cbc' + + borda = Border(right=Side(border_style="dashed")) + worksheet.sheet_view.showGridLines = False + # + + + + # List of image names + image_names = [ + 'finatec.png', + 'ibict.png' + ] + + # # Path to the images + # path = 'C:\\Users\\Softex\\Desktop\\entrega29\\' + + # # List to hold Image objects + # images = [] + + # # Loop through the list of image names and create Image objects + # for i, name in enumerate(image_names): + # image_path = path + name + # pil_image = PILImage.open(image_path) + # pil_image.save(image_path) + # img = Image(image_path) + # images.append(img) + + # Path to the images + path = "/imagensIBICIT/" + + # List to hold Image objects + images = [] + + nomePasta = "imagensIBICIT" + diretorio = os.path.dirname(__file__) + + # Loop through the list of image names and create Image objects + for i, name in enumerate(image_names): + caminhoImage = os.path.join(diretorio, nomePasta, name) + pil_image = PILImage.open(caminhoImage) + pil_image.save(caminhoImage) + img = Image(caminhoImage) + images.append(img) + + + worksheet.add_image(images[1], "A1")#ibict + worksheet.add_image(images[0], "E1")#finatec + + + worksheet.column_dimensions['a'].width = 25 + worksheet.column_dimensions['b'].width = 25 + worksheet.column_dimensions['c'].width = 35 + worksheet.column_dimensions['d'].width = 35 + worksheet.column_dimensions['e'].width = 35 + worksheet.column_dimensions['f'].width = 25 + worksheet.row_dimensions[14].height = 6 + worksheet.row_dimensions[15].height = 29.25 + worksheet.row_dimensions[16].height = 6 + + + #cabecario relação de pagamentos - outro servicoes de terceiros + worksheet.merge_cells('A7:F8') + worksheet['A7'] = f'C O N C I L I A Ç Ã O B A N C Á R I A' + worksheet['A7'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet['A7'].alignment = Alignment(horizontal="center",vertical="center") + worksheet['A7'].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + + worksheet.merge_cells('A9:F9') + worksheet['A9'] = "='Receita x Despesa'!A9:J9" + worksheet['A9'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A9'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A10:F10') + worksheet['A10'] = "='Receita x Despesa'!A10:J10" + worksheet['A10'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A10'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A11:F11') + worksheet['A11'] = "='Receita x Despesa'!A11:J11" + worksheet['A11'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A11'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A12:F12') + worksheet['A12'] = "='Receita x Despesa'!A12:J12" + worksheet['A12'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A12'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A13:F13') + worksheet['A13'] = "='Receita x Despesa'!A13:J13" + worksheet['A13'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A13'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A15:F15') + worksheet['A15'] = "BB RF Simples - CNPJBB RF SIMPLES" + worksheet['A15'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet['A15'].alignment = Alignment(horizontal="center",vertical="center") + worksheet['A15'].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + + worksheet.merge_cells('A17:F17') + worksheet['A17'] = '1.Saldo conforme extratos bancários na data final do período' + worksheet['A17'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet['A17'].alignment = Alignment(horizontal="left",vertical="center") + worksheet['A17'].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + + worksheet.merge_cells('A18:E18') + worksheet['A18'] = 'Saldo de Conta Corrente(R$)' + worksheet['A18'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A18'].alignment = Alignment(horizontal="right",vertical="center") + + worksheet.merge_cells('A19:E19') + worksheet['A19'] = 'Saldo de Aplicações Financeiras(R$)' + worksheet['A19'].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet['A19'].alignment = Alignment(horizontal="right",vertical="center") + worksheet['A19'].fill = PatternFill(start_color=cinza, end_color=cinza,fill_type = "solid") + + worksheet['F19'].fill = PatternFill(start_color=cinza, end_color=cinza,fill_type = "solid") + + worksheet.merge_cells('A21:F21') + worksheet['A21'] = '2. Restituições não creditadas pelo banco até a data final do período' + worksheet['A21'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet['A21'].alignment = Alignment(horizontal="left",vertical="center") + worksheet['A21'].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + + for i in range(21,size): + sttring = f"D{i}:F{i}" + worksheet.merge_cells(sttring) + + for i in range(size+3,size+3+tamanho2): + sttring = f"D{i}:F{i}" + worksheet.merge_cells(sttring) + + custom_number_format_conciliacoes = [] + # MASCARA R$ + if custom_number_format_conciliacoes!= False: + custom_number_format_conciliacoes = NamedStyle(name='custom_number_format_conciliacoes') + custom_number_format_conciliacoes.number_format = 'R$ #,##0.00' + custom_number_format_conciliacoes.font = Font(name="Arial", size=12, color="000000") + custom_number_format_conciliacoes.alignment = Alignment(horizontal="general",vertical="bottom",wrap_text=True) + + #stylecinza + start_row = 22 + for row in range(start_row,size+2): + cell = worksheet[f'B{row}'] + cell.style = custom_number_format_conciliacoes + + for rows in worksheet.iter_rows(min_row=22, max_row=size, min_col=1, max_col=6): + for cell in rows: + if cell.row % 2: + cell.fill = PatternFill(start_color=cinza, end_color=cinza, + fill_type = "solid") + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + + + row_number = 22 + values = ["Data","Valor(R$)","Documento",'Descrição'] + coluna = 1 + for a,b in enumerate(values): + worksheet.cell(row=row_number, column=coluna, value=b) + + coluna = coluna + 1 + + # FORMULATOTAL + formula = f"=SUM(B16:B{size-1})" + celula = f'B{size}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + #Total + celula_total = F'A{size}' + worksheet[celula_total] = f'TOTAL' + worksheet[celula_total].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula_total].font = Font(name="Arial", size=12, color="000000",bold=True) + #rubricado + celulaRubricado = F'C{size}' + stringLozalicaoRubricado = f'C{size}:F{size}' + worksheet.merge_cells(stringLozalicaoRubricado) + worksheet[celulaRubricado].fill = PatternFill(start_color="000000", end_color="FFFFFF",fill_type = "lightUp") + + #'3. Restituições não creditadas pelo banco até a data final do período' + string_reituicoes_creditadas = f'A{size+2}:F{size+2}' + row_creditadas = f'A{size+2}' + worksheet.merge_cells(string_reituicoes_creditadas) + worksheet[row_creditadas] = '3. Restituições creditadas pelo banco até a data final do período' + worksheet[row_creditadas].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet[row_creditadas].alignment = Alignment(horizontal="left",vertical="center") + worksheet[row_creditadas].fill = PatternFill(start_color=azul_claro, end_color=azul_claro,fill_type = "solid") + + #data valor documento descrição + row_number = size+3 + values = ["Data","Valor(R$)","Documento",'Descrição'] + coluna = 1 + for a,b in enumerate(values): + worksheet.cell(row=row_number, column=coluna, value=b) + coluna = coluna + 1 + + for rows in worksheet.iter_rows(min_row=22, max_row=22, min_col=1, max_col=6): + for cell in rows: + cell.font = Font(name="Arial", size=12, color="000000",bold=True) + + + + + for row in range(size+4,size+4+tamanho2): + cell = worksheet[f'B{row}'] + cell.style = custom_number_format_conciliacoes + + for rows in worksheet.iter_rows(min_row=size+3, max_row=size+3+tamanho, min_col=1, max_col=6): + for cell in rows: + if cell.row % 2: + cell.fill = PatternFill(start_color=cinza, end_color=cinza, + fill_type = "solid") + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + if cell.column == 6: + cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="hair") ,right =Side(border_style="dashed") ,bottom=Side(border_style="hair") ) + + + # FORMULATOTALrestituição + formula = f"=SUM(B{size+4}:B{size+tamanho2+3})" + celula = f'B{size+tamanho2+4}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[celula].number_format = 'R$ #,##0.00' + #Total + celula_total = F'A{size+tamanho2+4}' + worksheet[celula_total] = f'TOTAL' + worksheet[celula_total].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula_total].font = Font(name="Arial", size=12, color="000000",bold=True) + #rubricado + celulaRubricadoSegundo = F'C{size+tamanho2+4}' + stringLozalicaoRubricadoSegundo = f'C{size+tamanho2+4}:F{size+tamanho2+4}' + worksheet.merge_cells(stringLozalicaoRubricadoSegundo) + worksheet[celulaRubricadoSegundo].fill = PatternFill(start_color="000000", end_color="FFFFFF",fill_type = "lightUp") + #Saldo disponível p/ período seguinte (1 +2 - 3) + string_saldo_disponivel = f'A{size+3+tamanho2+3}:D{size+3+tamanho2+3}' + celula_string_saldo = f'A{size+tamanho2+6}' + worksheet[celula_string_saldo].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet.merge_cells(string_saldo_disponivel) + worksheet[celula_string_saldo]= f'Saldo disponível p/ período seguinte (1 + 2 - 3)' + #total saldo diposnivel + string_merge_saldo_disponivel = f'E{size+3+tamanho2+3}:F{size+3+tamanho2+3}' + celula_string_total = f'E{size+tamanho2+6}' + worksheet.merge_cells(string_merge_saldo_disponivel) + saldodiposnivelformat_conciliacoes = NamedStyle(name='saldodiposnivelformat_conciliacoes') + saldodiposnivelformat_conciliacoes.number_format = 'R$ #,##0.00' + saldodiposnivelformat_conciliacoes.font = Font(name="Arial", size=12, color="000000") + saldodiposnivelformat_conciliacoes.alignment = Alignment(horizontal="general",vertical="bottom",wrap_text=True) + saldodiposnivelformat_conciliacoes.fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + celular = worksheet[celula_string_total] + celular.style = saldodiposnivelformat_conciliacoes + celular.value = f'=F10+F11+B{size} -B{size+tamanho2+4}' + + #brasilia + brasilia_row = size + tamanho2+ 8 + brasilia_formula = f"='Receita x Despesa'!A44:I44" + brasilia_merge_cells = f'A{brasilia_row}:F{brasilia_row}' + worksheet.merge_cells(brasilia_merge_cells) + top_left_brasilia_cell_formula = f'A{brasilia_row}' + top_left_brasilia_cell = worksheet[top_left_brasilia_cell_formula] + top_left_brasilia_cell.value = brasilia_formula + top_left_brasilia_cell.alignment = Alignment(horizontal="center",vertical="center") + + # #DiretorFinanceiro + diretor_row = size + 10 + tamanho2 + diretor_cargo_row = size + 11 + tamanho2 + diretor_cpf_row = size + 12 + tamanho2 + diretor_nome_formula = f"='Receita x Despesa'!A48" + diretor_cargo_formula = f"='Receita x Despesa'!A49" + diretor_cpf_formula = f"='Receita x Despesa'!A50" + diretor_merge_cells = f'A{diretor_row}:B{diretor_row}' + diretor_cargo_merge_cells = f'A{diretor_cargo_row}:B{diretor_cargo_row}' + diretor_cpf_merge_cells = f'A{diretor_cpf_row}:B{diretor_cpf_row}' + worksheet.merge_cells(diretor_merge_cells) + worksheet.merge_cells(diretor_cargo_merge_cells) + worksheet.merge_cells(diretor_cpf_merge_cells) + top_left_diretor_cell_formula = f'A{diretor_row}' + top_left_diretor_cell_cargo_formula = f'A{diretor_cargo_row}' + top_left_diretor_cell_cpf_formula = f'A{diretor_cpf_row}' + top_left_diretor_cell = worksheet[top_left_diretor_cell_formula] + top_left_diretor_cell_cargo_formula = worksheet[top_left_diretor_cell_cargo_formula] + top_left_diretor_cell_cpf_formula = worksheet[top_left_diretor_cell_cpf_formula] + top_left_diretor_cell.value = diretor_nome_formula + top_left_diretor_cell_cargo_formula.value = diretor_cargo_formula + top_left_diretor_cell_cpf_formula.value = diretor_cpf_formula + top_left_diretor_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell.font = Font(bold=True) + top_left_diretor_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + #Coordenadora + coordenadora_row = size + tamanho2 + 10 + coordenadora_cargo_row = size + 11 + tamanho2 + coordenadora_cpf_row = size + 12+ tamanho2 + coordenadora_nome_formula = f"='Receita x Despesa'!G48" + coordenadora_cargo_formula = f"='Receita x Despesa'!G49" + coordenadora_cpf_formula = f"='Receita x Despesa'!G50" + coordenadora_merge_cells = f'D{coordenadora_row}:F{coordenadora_row}' + coordenadora_cargo_merge_cells = f'D{coordenadora_cargo_row}:F{coordenadora_cargo_row}' + coordenadora_cpf_merge_cells = f'D{coordenadora_cpf_row}:F{coordenadora_cpf_row}' + worksheet.merge_cells(coordenadora_merge_cells) + worksheet.merge_cells(coordenadora_cargo_merge_cells) + worksheet.merge_cells(coordenadora_cpf_merge_cells) + top_left_coordenadora_cell_formula = f'D{coordenadora_row}' + top_left_coordenadora_cell_cargo_formula = f'D{coordenadora_cargo_row}' + top_left_coordenadora_cell_cpf_formula = f'D{coordenadora_cpf_row}' + top_left_coordenadora_cell = worksheet[top_left_coordenadora_cell_formula] + top_left_coordenadora_cell_cargo_formula = worksheet[top_left_coordenadora_cell_cargo_formula] + top_left_coordenadora_cell_cpf_formula = worksheet[top_left_coordenadora_cell_cpf_formula] + top_left_coordenadora_cell.value = coordenadora_nome_formula + top_left_coordenadora_cell_cargo_formula.value = coordenadora_cargo_formula + top_left_coordenadora_cell_cpf_formula.value = coordenadora_cpf_formula + top_left_coordenadora_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell.border = borda + top_left_coordenadora_cell.font= Font(bold = True) + top_left_coordenadora_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell_cargo_formula.border = borda + top_left_coordenadora_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell_cpf_formula.border = borda + + for row in worksheet.iter_rows(min_row=1, max_row=size+tamanho2+12,min_col=6,max_col=6): + for cell in row: + cell.border = borda + + for row in worksheet.iter_rows(min_row=coordenadora_cpf_row+1, max_row=coordenadora_cpf_row+1,min_col=1,max_col=6): + for cell in row: + if cell.column == 6: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="dashed") ,bottom=Side(border_style="dashed") ) + else: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="none") ,bottom=Side(border_style="dashed") ) + + for rows in worksheet.iter_rows(min_row=row_number, max_row=row_number, min_col=1, max_col=6): + for cell in rows: + cell.font = Font(name="Arial", size=12, color="000000",bold=True) + + workbook.save(tabela) + workbook.close() + +def estilo_rendimento_de_aplicacao(tabela,tamanho): + caminho = pegar_caminho(tabela) + workbook = openpyxl.load_workbook(caminho) + worksheet = workbook['Rendimento de Aplicação'] + size = tamanho + 16 + worksheet.row_dimensions[10].height = 2 + worksheet.row_dimensions[9].height = 20 + + # List of image names + image_names = [ + 'finatec.png', + 'ibict.png' + ] + + # # Path to the images + # path = 'C:\\Users\\Softex\\Desktop\\entrega29\\' + + # # List to hold Image objects + # images = [] + + # # Loop through the list of image names and create Image objects + # for i, name in enumerate(image_names): + # image_path = path + name + # pil_image = PILImage.open(image_path) + # pil_image.save(image_path) + # img = Image(image_path) + # images.append(img) + + + # Path to the images + path = "/imagensIBICIT/" + + # List to hold Image objects + images = [] + + nomePasta = "imagensIBICIT" + diretorio = os.path.dirname(__file__) + + # Loop through the list of image names and create Image objects + for i, name in enumerate(image_names): + caminhoImage = os.path.join(diretorio, nomePasta, name) + pil_image = PILImage.open(caminhoImage) + pil_image.save(caminhoImage) + img = Image(caminhoImage) + images.append(img) + + + + + + + + worksheet.add_image(images[1], "A1")#ibict + worksheet.add_image(images[0], "E1")#finatec + + cinza = "d9d9d9" + cinza_escuro = "bfbfbf" + azul = "336394" + azul_claro = '0198cc' + borda = Border(right=Side(border_style="dashed")) + worksheet.sheet_view.showGridLines = False + # + for row in worksheet.iter_rows(min_row=1, max_row=size+9,min_col=8,max_col=8): + for cell in row: + cell.border = borda + + + + worksheet.column_dimensions['a'].width = 20 + worksheet.column_dimensions['b'].width = 20 + worksheet.column_dimensions['c'].width = 20 + worksheet.column_dimensions['d'].width = 20 + worksheet.column_dimensions['e'].width = 20 + worksheet.column_dimensions['f'].width = 20 + worksheet.column_dimensions['g'].width = 20 + worksheet.column_dimensions['h'].width = 20 + + + + #cabecario relação de pagamentos - outro servicoes de terceiros + worksheet.merge_cells('A7:H8') + worksheet['A7'] = f'Demonstrativo dos Ganhos Auferidos com Aplicações Financeiras' + worksheet['A7'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet['A7'].alignment = Alignment(horizontal="center",vertical="center") + worksheet['A7'].fill = PatternFill(start_color=azul, end_color=azul,fill_type = "solid") + + worksheet.merge_cells('A9:H9') + worksheet['A9'] = "='Receita x Despesa'!A9:J9" + worksheet['A9'].font = Font(name="Arial", size=12, color="000000") + worksheet['A9'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A10:H10') + worksheet['A10'] = "='Receita x Despesa'!A10:J10" + worksheet['A10'].font = Font(name="Arial", size=12, color="000000") + worksheet['A10'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A11:H11') + worksheet['A11'] = "='Receita x Despesa'!A11:J11" + worksheet['A11'].font = Font(name="Arial", size=12, color="000000") + worksheet['A11'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A12:H12') + worksheet['A12'] = "='Receita x Despesa'!A12:J12" + worksheet['A12'].font = Font(name="Arial", size=12, color="000000") + worksheet['A12'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A13:H13') + worksheet['A13'] = "='Receita x Despesa'!A13:J13" + worksheet['A13'].font = Font(name="Arial", size=12, color="000000") + worksheet['A13'].alignment = Alignment(horizontal="left",vertical="center") + + worksheet.merge_cells('A14:H14') + worksheet['A14'] = 'BB CP Corpor Àgil - CNPJ 11.351.449-0001-10L' + worksheet['A14'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True) + worksheet['A14'].alignment = Alignment(horizontal="center",vertical="center") + worksheet['A14'].fill = PatternFill(start_color=azul, end_color=azul,fill_type = "solid") + + + + + #stylecinza + start_row = 18 + for rows in worksheet.iter_rows(min_row=start_row, max_row=13, min_col=1, max_col=8): + for cell in rows: + if cell.row % 2: + cell.fill = PatternFill(start_color=azul_claro, end_color=azul_claro, + fill_type = "solid") + cell.font = Font(name="Arial", size=12, color="000000",bold=True) + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + + + row_number = 15 + values = ["Período","Saldo Anterior","Valor Aplicado no período",'Valor Resgatado no Período','Rendimento Bruto','Imposto de Renda / IOF','Rendimento Líquido','Saldo'] + coluna = 1 + for a,b in enumerate(values): + worksheet.cell(row=row_number, column=coluna, value=b) + + coluna = coluna + 1 + + for i in range(1,9): + worksheet.merge_cells(start_row=11,end_row=13,start_column=i,end_column=i) + #BARRAS DE DADOS + start_row = 14 + for rows in worksheet.iter_rows(min_row=start_row, max_row=size, min_col=1, max_col=8): + for cell in rows: + if cell.row % 2: + cell.fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro, + fill_type = "solid") + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + #MASCARA VERMELHO + for rows in worksheet.iter_rows(min_row=start_row, max_row=size-1, min_col=6, max_col=6): + for cell in rows: + cell.font = Font(name="Arial", size=12, color="f90000") + #MASCARANEGRITO + for rows in worksheet.iter_rows(min_row=start_row, max_row=size-1, min_col=1, max_col=1): + for cell in rows: + cell.font = Font(name="Arial", size=12, color="000000",bold=True) + #MASCARA AZUL + for rows in worksheet.iter_rows(min_row=start_row, max_row=size-1, min_col=7, max_col=7): + for cell in rows: + cell.font = Font(name="Arial", size=12, color="141fca",bold=True) + + + #barra de totais + # FORMULATOTAL + #C + formula = f"=SUM(C14:C{size-1})" + celula = f'C{size}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + #D + formula = f"=SUM(D14:D{size-1})" + celula = f'D{size}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + #E + formula = f"=SUM(E14:E{size-1})" + celula = f'E{size}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + #F + formula = f"=SUM(F14:F{size-1})" + celula = f'F{size}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + #G + formula = f"=SUM(G14:G{size-1})" + celula = f'G{size}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + #H + formula = f"=SUM(H14:H{size-1})" + celula = f'H{size}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + + #Total + celula_total = F'A{size}' + worksheet[celula_total] = f'TOTAL' + worksheet[celula_total].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula_total].font = Font(name="Arial", size=12, color="000000",bold=True) + + #brasilia + brasilia_row = size + 2 + brasilia_formula = f"='Receita x Despesa'!A42:F42" + brasilia_merge_cells = f'A{brasilia_row}:F{brasilia_row}' + worksheet.merge_cells(brasilia_merge_cells) + top_left_brasilia_cell_formula = f'A{brasilia_row}' + top_left_brasilia_cell = worksheet[top_left_brasilia_cell_formula] + top_left_brasilia_cell.value = brasilia_formula + top_left_brasilia_cell.alignment = Alignment(horizontal="center",vertical="center") + + # #DiretorFinanceiro + diretor_row = size + 6 + diretor_cargo_row = size + 7 + diretor_cpf_row = size + 8 + diretor_nome_formula = f"='Receita x Despesa'!A45" + diretor_cargo_formula = f"='Receita x Despesa'!A46" + diretor_cpf_formula = f"='Receita x Despesa'!A47" + diretor_merge_cells = f'A{diretor_row}:C{diretor_row}' + diretor_cargo_merge_cells = f'A{diretor_cargo_row}:C{diretor_cargo_row}' + diretor_cpf_merge_cells = f'A{diretor_cpf_row}:C{diretor_cpf_row}' + worksheet.merge_cells(diretor_merge_cells) + worksheet.merge_cells(diretor_cargo_merge_cells) + worksheet.merge_cells(diretor_cpf_merge_cells) + top_left_diretor_cell_formula = f'A{diretor_row}' + top_left_diretor_cell_cargo_formula = f'A{diretor_cargo_row}' + top_left_diretor_cell_cpf_formula = f'A{diretor_cpf_row}' + top_left_diretor_cell = worksheet[top_left_diretor_cell_formula] + top_left_diretor_cell_cargo_formula = worksheet[top_left_diretor_cell_cargo_formula] + top_left_diretor_cell_cpf_formula = worksheet[top_left_diretor_cell_cpf_formula] + top_left_diretor_cell.value = diretor_nome_formula + top_left_diretor_cell_cargo_formula.value = diretor_cargo_formula + top_left_diretor_cell_cpf_formula.value = diretor_cpf_formula + top_left_diretor_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell.font = Font(bold=True) + top_left_diretor_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_diretor_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + #Coordenadora + coordenadora_row = size + 6 + coordenadora_cargo_row = size + 7 + coordenadora_cpf_row = size + 8 + coordenadora_nome_formula = f"='Receita x Despesa'!G45" + coordenadora_cargo_formula = f"='Receita x Despesa'!G46" + coordenadora_cpf_formula = f"='Receita x Despesa'!G47" + coordenadora_merge_cells = f'E{coordenadora_row}:G{coordenadora_row}' + coordenadora_cargo_merge_cells = f'E{coordenadora_cargo_row}:G{coordenadora_cargo_row}' + coordenadora_cpf_merge_cells = f'E{coordenadora_cpf_row}:G{coordenadora_cpf_row}' + worksheet.merge_cells(coordenadora_merge_cells) + worksheet.merge_cells(coordenadora_cargo_merge_cells) + worksheet.merge_cells(coordenadora_cpf_merge_cells) + top_left_coordenadora_cell_formula = f'E{coordenadora_row}' + top_left_coordenadora_cell_cargo_formula = f'E{coordenadora_cargo_row}' + top_left_coordenadora_cell_cpf_formula = f'E{coordenadora_cpf_row}' + top_left_coordenadora_cell = worksheet[top_left_coordenadora_cell_formula] + top_left_coordenadora_cell_cargo_formula = worksheet[top_left_coordenadora_cell_cargo_formula] + top_left_coordenadora_cell_cpf_formula = worksheet[top_left_coordenadora_cell_cpf_formula] + top_left_coordenadora_cell.value = coordenadora_nome_formula + top_left_coordenadora_cell_cargo_formula.value = coordenadora_cargo_formula + top_left_coordenadora_cell_cpf_formula.value = coordenadora_cpf_formula + top_left_coordenadora_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell.font= Font(bold = True) + top_left_coordenadora_cell_cargo_formula.alignment = Alignment(horizontal="center",vertical="center") + top_left_coordenadora_cell_cpf_formula.alignment = Alignment(horizontal="center",vertical="center") + + + for row in worksheet.iter_rows(min_row=coordenadora_cpf_row+1, max_row=coordenadora_cpf_row+1,min_col=1,max_col=8): + for cell in row: + if cell.column == 4: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="dashed") ,bottom=Side(border_style="dashed") ) + else: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="none") ,bottom=Side(border_style="dashed") ) + + + workbook.save(tabela) + workbook.close() + + + +tabela = pegar_caminho('IBICT.xlsx') +nomeTabela ="Evento" +tituloStyle = "evento" +workbook = openpyxl.load_workbook(tabela) +sheet2 = workbook.create_sheet(title="Evento") +workbook.save("tabelapreenchida.xlsx") +workbook.close() +tabela = pegar_caminho("tabelapreenchida.xlsx") +workbook = openpyxl.load_workbook(tabela) +sheet2 = workbook.create_sheet(title="Conciliação Bancária") +sheet2 = workbook.create_sheet(title="Rendimento de Aplicação") +workbook.save(tabela) +workbook.close() +maior = 20 +maior2 = 20 +tabela2 = pegar_caminho('tabelapreenchida.xlsx') +print(tabela2) +estiloGeral(tabela2,maior,tituloStyle,nomeTabela) +estilo_conciliacoes_bancaria(tabela2,maior2,maior) +estilo_rendimento_de_aplicacao(tabela2,maior) \ No newline at end of file diff --git a/project/app/estiloOPAS.py b/project/app/estiloOPAS.py new file mode 100644 index 00000000..6294dfee --- /dev/null +++ b/project/app/estiloOPAS.py @@ -0,0 +1,178 @@ +import openpyxl +from openpyxl.styles import Font, PatternFill, Alignment,NamedStyle,Border, Side +import os +#pegar o caminho do arquivo +def pegar_caminho(nome_arquivo): + + # Obter o caminho absoluto do arquivo Python em execução + caminho_script = os.path.abspath(__file__) + + # Obter o diretório da pasta onde o script está localizado + pasta_script = os.path.dirname(caminho_script) + + # Combinar o caminho da pasta com o nome do arquivo Excel + caminho = os.path.join(pasta_script, nome_arquivo) + + return caminho + +def estiloOpas(tabela,tamanho,nomeVariavel,nomeTabela): + nomeSheet=nomeVariavel + print(tabela) + caminho = pegar_caminho(tabela) + workbook = openpyxl.load_workbook(caminho) + worksheet = workbook[nomeTabela] + size = tamanho + 10 + print(size) + cinza = "d9d9d9" + cinza_escuro = "d8e0f2" + + + borda = Border(right=Side(border_style="medium")) + worksheet.sheet_view.showGridLines = False + # + for row in worksheet.iter_rows(min_row=12, max_row=size+10,min_col=5,max_col=5): + for cell in row: + cell.border = borda + + + worksheet.column_dimensions['a'].width = 20 #N + worksheet.column_dimensions['b'].width = 65 #Fornecedor + worksheet.column_dimensions['c'].width = 35 # ateogira de despesa + worksheet.column_dimensions['d'].width = 35 #data + worksheet.column_dimensions['e'].width = 35 #montante + + + #Aumentar a altura das celulas + for row in worksheet.iter_rows(min_row=11, max_row=size, min_col=1, max_col=5): + worksheet.row_dimensions[row[0].row].height = 60 + input3 = f'customNumber{nomeVariavel}' + + # MASCARA R$ + + locals()[input3] = NamedStyle(name=f'{input3}') + locals()[input3].number_format = 'R$ #,##0.00' + locals()[input3].font = Font(name="Arial", size=12, color="000000") + locals()[input3].alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + + for row in range(12,size+1): + cell = worksheet[f'E{row}'] + cell.style = locals()[input3] + + #estilocinzasimcinzanao + value_to_stop = size + start_row = 12 +# + + + for rows in worksheet.iter_rows(min_row=12, max_row=size, min_col=1, max_col=5): + for cell in rows: + if cell.row % 2: + cell.fill = PatternFill(start_color=cinza, end_color=cinza, + fill_type = "solid") + if cell.column == 5: + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="hair") ,right =Side(border_style="medium") ,bottom=Side(border_style="hair") ) + else: + cell.font = Font(name="Arial", size=12, color="000000") + cell.alignment = Alignment(horizontal="center",vertical="center",wrap_text=True) + cell.border = Border(top=Side(border_style="hair") ,left = Side(border_style="hair") ,right =Side(border_style="hair") ,bottom=Side(border_style="hair") ) + + + + #subtotal + stringAfinarCelula =size+1 + worksheet.row_dimensions[size+1].height = 6 + celulas_mergidas_subtotal = f"A{size+2}:B{size+2}" + worksheet.merge_cells(celulas_mergidas_subtotal) + left_celula_cell = f"A{size+2}" + left_celula_cell2 = f"B{size+2}" + top_left_cell = worksheet[left_celula_cell] + top_left_cell.value = "Total" + top_left_cell.fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + top_left_cell.font = Font(name="Arial", size=12, color="000000",bold=True) + top_left_cell.alignment = Alignment(horizontal="center",vertical="center") + top_left_cell.border = Border(top=Side(border_style="medium") ,left = Side(border_style="medium") ,right =Side(border_style="thin") ,bottom=Side(border_style="medium") ) + worksheet[left_celula_cell2].border = Border(top=Side(border_style="medium") ,right =Side(border_style="thin") ,bottom=Side(border_style="medium") ) + + + + worksheet.row_dimensions[size+2].height = 56.25 + + + # FORMULATOTAL + celulas_mergidas_total = f"C{size+2}:E{size+2}" + worksheet.merge_cells(celulas_mergidas_total) + formula = f"=SUM(E10:E{size})" + celula = f'C{size+2}' + celula2 =f'D{size+2}' + celula3 =f'E{size+2}' + worksheet[celula] = formula + worksheet[celula].fill = PatternFill(start_color=cinza_escuro, end_color=cinza_escuro,fill_type = "solid") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + worksheet[celula].border = Border(top=Side(border_style="medium") ,left = Side(border_style="thin") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) + worksheet[celula2].border = Border(top=Side(border_style="medium") , bottom=Side(border_style="medium") ) + worksheet[celula3].border = Border(top=Side(border_style="medium") ,left = Side(border_style="thin") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) + + worksheet[celula].number_format = 'R$ #,##0.00' + + + #Local + brasilia_row = size + 4 + brasilia_formula = f"Local:" + top_left_brasilia_cell_formula = f'B{brasilia_row}' + top_left_brasilia_cell = worksheet[top_left_brasilia_cell_formula] + top_left_brasilia_cell.value = brasilia_formula + top_left_brasilia_cell.alignment = Alignment(horizontal="center",vertical="center") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + + #data + data_row = size + 5 + data_formula = f"Data:" + top_left_data_cell_formula = f'B{data_row}' + top_left_data_cell = worksheet[top_left_data_cell_formula] + top_left_data_cell.value = data_formula + top_left_data_cell.alignment = Alignment(horizontal="center",vertical="center") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + + #Representante Legal da Instituição Beneficiária: + repre_row = size + 7 + repre_formula = f"Representante Legal da Instituição Beneficiária::" + top_left_repre_cell_formula = f'B{repre_row}' + top_left_repre_cell = worksheet[top_left_repre_cell_formula] + top_left_repre_cell.value = repre_formula + top_left_repre_cell.alignment = Alignment(horizontal="center",vertical="center") + worksheet[celula].font = Font(name="Arial", size=12, color="000000",bold=True) + + + #diretor preseitente + diretor_row = size + 9 + diretor = f"Diretor-Presidente" + top_left_diretor_cell_formula = f'C{diretor_row}' + top_left_diretor_cell = worksheet[top_left_diretor_cell_formula] + top_left_diretor_cell.value = diretor + top_left_diretor_cell.alignment = Alignment(horizontal="center",vertical="center") + + for row in worksheet.iter_rows(min_row=diretor_row+1, max_row=diretor_row+1,min_col=1,max_col=5): + for cell in row: + if cell.column == 5: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) + else: + cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="none") ,bottom=Side(border_style="medium") ) + + workbook.save(tabela) + workbook.close() + + + + +tabela = pegar_caminho('ModeloOPAS.xlsx') +workbook = openpyxl.load_workbook(tabela) +nomeTabela ="Relatório Detalhado" +tituloStyle = "aff" +workbook.save("tabelapreenchida.xlsx") +workbook.close() +maior = 20 +tabela2 = pegar_caminho('tabelapreenchida.xlsx') +print(tabela2) +estiloOpas(tabela2,maior,tituloStyle,nomeTabela) \ No newline at end of file diff --git a/project/app/estilo_fub.py b/project/app/estilo_fub.py index e57c92a3..8762e69f 100644 --- a/project/app/estilo_fub.py +++ b/project/app/estilo_fub.py @@ -65,8 +65,8 @@ def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela): worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - OUTROS SERVIÇOS DE TERCEIROS - PESSOA JURÍDICA' elif nomeSheet == "passagenDespLocomo": worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - PASSAGENS E DESPESAS COM LOCOMOÇÃO' - elif nomeSheet == "outrosServiçosTerceiros": - worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - O U T R O S S E R V I Ç O S D E T E R C E I R O S - C E L E T I S T A S' + # elif nomeSheet == "outrosServiçosTerceiros": + # worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - O U T R O S S E R V I Ç O S D E T E R C E I R O S - C E L E T I S T A S' elif nomeSheet == "auxilioEstudante": worksheet['A1'] = f'R E L A Ç Ã O D E P A G A M E N T O S - AUXÍLIO FINANCEIRO A ESTUDANTE' elif nomeSheet == "bolsaExtensao": @@ -876,7 +876,7 @@ def estilo_rendimento_de_aplicacao(tabela,tamanho): for row in worksheet.iter_rows(min_row=coordenadora_cpf_row+1, max_row=coordenadora_cpf_row+1,min_col=1,max_col=8): for cell in row: - if cell.column == 4: + if cell.column == 8: cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) else: cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="none") ,bottom=Side(border_style="medium") ) @@ -1477,7 +1477,7 @@ def estilo_demonstrativoDeReceita(tabela,tamanho): for row in worksheet.iter_rows(min_row=coordenadora_cpf_row+1, max_row=coordenadora_cpf_row+1,min_col=1,max_col=4): for cell in row: - if cell.column == 8: + if cell.column == 4: cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="medium") ,bottom=Side(border_style="medium") ) else: cell.border = Border(top=Side(border_style="none") ,left = Side(border_style="none") ,right =Side(border_style="none") ,bottom=Side(border_style="medium") ) diff --git a/project/app/capa_60/agencia.png b/project/app/imagensCapa/agencia.png similarity index 100% rename from project/app/capa_60/agencia.png rename to project/app/imagensCapa/agencia.png diff --git a/project/app/capa_60/agencia_branco.png b/project/app/imagensCapa/agencia_branco.png similarity index 100% rename from project/app/capa_60/agencia_branco.png rename to project/app/imagensCapa/agencia_branco.png diff --git a/project/app/capa_60/agente.png b/project/app/imagensCapa/agente.png similarity index 100% rename from project/app/capa_60/agente.png rename to project/app/imagensCapa/agente.png diff --git a/project/app/capa_60/agente_branco.png b/project/app/imagensCapa/agente_branco.png similarity index 100% rename from project/app/capa_60/agente_branco.png rename to project/app/imagensCapa/agente_branco.png diff --git a/project/app/capa_60/analista.png b/project/app/imagensCapa/analista.png similarity index 100% rename from project/app/capa_60/analista.png rename to project/app/imagensCapa/analista.png diff --git a/project/app/capa_60/analista_branco.png b/project/app/imagensCapa/analista_branco.png similarity index 100% rename from project/app/capa_60/analista_branco.png rename to project/app/imagensCapa/analista_branco.png diff --git a/project/app/capa_60/assinaturas_responsaveis.png b/project/app/imagensCapa/assinaturas_responsaveis.png similarity index 100% rename from project/app/capa_60/assinaturas_responsaveis.png rename to project/app/imagensCapa/assinaturas_responsaveis.png diff --git a/project/app/capa_60/assistente.png b/project/app/imagensCapa/assistente.png similarity index 100% rename from project/app/capa_60/assistente.png rename to project/app/imagensCapa/assistente.png diff --git a/project/app/capa_60/assistente_branco.png b/project/app/imagensCapa/assistente_branco.png similarity index 100% rename from project/app/capa_60/assistente_branco.png rename to project/app/imagensCapa/assistente_branco.png diff --git a/project/app/capa_60/banco.png b/project/app/imagensCapa/banco.png similarity index 100% rename from project/app/capa_60/banco.png rename to project/app/imagensCapa/banco.png diff --git a/project/app/capa_60/banco_branco.png b/project/app/imagensCapa/banco_branco.png similarity index 100% rename from project/app/capa_60/banco_branco.png rename to project/app/imagensCapa/banco_branco.png diff --git a/project/app/capa_60/centrodecusto.png b/project/app/imagensCapa/centrodecusto.png similarity index 100% rename from project/app/capa_60/centrodecusto.png rename to project/app/imagensCapa/centrodecusto.png diff --git a/project/app/capa_60/centrodecusto_branco.png b/project/app/imagensCapa/centrodecusto_branco.png similarity index 100% rename from project/app/capa_60/centrodecusto_branco.png rename to project/app/imagensCapa/centrodecusto_branco.png diff --git a/project/app/capa_60/conta_corrente.png b/project/app/imagensCapa/conta_corrente.png similarity index 100% rename from project/app/capa_60/conta_corrente.png rename to project/app/imagensCapa/conta_corrente.png diff --git a/project/app/capa_60/conta_corrente_branco.png b/project/app/imagensCapa/conta_corrente_branco.png similarity index 100% rename from project/app/capa_60/conta_corrente_branco.png rename to project/app/imagensCapa/conta_corrente_branco.png diff --git a/project/app/capa_60/coordenador.png b/project/app/imagensCapa/coordenador.png similarity index 100% rename from project/app/capa_60/coordenador.png rename to project/app/imagensCapa/coordenador.png diff --git a/project/app/capa_60/coordenador_branco.png b/project/app/imagensCapa/coordenador_branco.png similarity index 100% rename from project/app/capa_60/coordenador_branco.png rename to project/app/imagensCapa/coordenador_branco.png diff --git a/project/app/capa_60/dadosdoacordo.png b/project/app/imagensCapa/dadosdoacordo.png similarity index 100% rename from project/app/capa_60/dadosdoacordo.png rename to project/app/imagensCapa/dadosdoacordo.png diff --git a/project/app/capa_60/gerente.png b/project/app/imagensCapa/gerente.png similarity index 100% rename from project/app/capa_60/gerente.png rename to project/app/imagensCapa/gerente.png diff --git a/project/app/capa_60/gerente_branco.png b/project/app/imagensCapa/gerente_branco.png similarity index 100% rename from project/app/capa_60/gerente_branco.png rename to project/app/imagensCapa/gerente_branco.png diff --git a/project/app/capa_60/periodo.png b/project/app/imagensCapa/periodo.png similarity index 100% rename from project/app/capa_60/periodo.png rename to project/app/imagensCapa/periodo.png diff --git a/project/app/capa_60/periodo_branco.png b/project/app/imagensCapa/periodo_branco.png similarity index 100% rename from project/app/capa_60/periodo_branco.png rename to project/app/imagensCapa/periodo_branco.png diff --git "a/project/app/capa_60/presta\303\247\303\243odecontasparcial.png" "b/project/app/imagensCapa/presta\303\247\303\243odecontasparcial.png" similarity index 100% rename from "project/app/capa_60/presta\303\247\303\243odecontasparcial.png" rename to "project/app/imagensCapa/presta\303\247\303\243odecontasparcial.png" diff --git a/project/app/capa_60/processo.png b/project/app/imagensCapa/processo.png similarity index 100% rename from project/app/capa_60/processo.png rename to project/app/imagensCapa/processo.png diff --git a/project/app/capa_60/processo_branco.png b/project/app/imagensCapa/processo_branco.png similarity index 100% rename from project/app/capa_60/processo_branco.png rename to project/app/imagensCapa/processo_branco.png diff --git a/project/app/capa_60/projeto.png b/project/app/imagensCapa/projeto.png similarity index 100% rename from project/app/capa_60/projeto.png rename to project/app/imagensCapa/projeto.png diff --git a/project/app/capa_60/projeto_branco.png b/project/app/imagensCapa/projeto_branco.png similarity index 100% rename from project/app/capa_60/projeto_branco.png rename to project/app/imagensCapa/projeto_branco.png diff --git a/project/app/imagensIBICIT/finatec.png b/project/app/imagensIBICIT/finatec.png new file mode 100644 index 00000000..88ffdeb0 Binary files /dev/null and b/project/app/imagensIBICIT/finatec.png differ diff --git a/project/app/imagensIBICIT/ibict.png b/project/app/imagensIBICIT/ibict.png new file mode 100644 index 00000000..8038a251 Binary files /dev/null and b/project/app/imagensIBICIT/ibict.png differ diff --git a/project/app/migrations/__pycache__/0001_initial.cpython-38.pyc b/project/app/migrations/__pycache__/0001_initial.cpython-38.pyc deleted file mode 100644 index f762d35b..00000000 Binary files a/project/app/migrations/__pycache__/0001_initial.cpython-38.pyc and /dev/null differ diff --git a/project/app/migrations/__pycache__/0002_rename_agencia_bancaria_mapeamento_agencia_bancaria_and_more.cpython-38.pyc b/project/app/migrations/__pycache__/0002_rename_agencia_bancaria_mapeamento_agencia_bancaria_and_more.cpython-38.pyc deleted file mode 100644 index 1f16a19d..00000000 Binary files a/project/app/migrations/__pycache__/0002_rename_agencia_bancaria_mapeamento_agencia_bancaria_and_more.cpython-38.pyc and /dev/null differ diff --git a/project/app/migrations/__pycache__/0003_alter_mapeamento_id_tipo.cpython-38.pyc b/project/app/migrations/__pycache__/0003_alter_mapeamento_id_tipo.cpython-38.pyc deleted file mode 100644 index 0b5eb3dc..00000000 Binary files a/project/app/migrations/__pycache__/0003_alter_mapeamento_id_tipo.cpython-38.pyc and /dev/null differ diff --git a/project/app/migrations/__pycache__/__init__.cpython-310.pyc b/project/app/migrations/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 59e9df92..00000000 Binary files a/project/app/migrations/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/project/app/migrations/__pycache__/__init__.cpython-311.pyc b/project/app/migrations/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index f1933ca1..00000000 Binary files a/project/app/migrations/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/project/app/migrations/__pycache__/__init__.cpython-38.pyc b/project/app/migrations/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index f4eaebd1..00000000 Binary files a/project/app/migrations/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/project/app/planilhas/IBICT.xlsx b/project/app/planilhas/IBICT.xlsx new file mode 100644 index 00000000..93a0990a Binary files /dev/null and b/project/app/planilhas/IBICT.xlsx differ diff --git a/project/app/planilhas/ModeloFINEP.xlsx b/project/app/planilhas/ModeloFINEP.xlsx deleted file mode 100644 index ff3c5ac1..00000000 Binary files a/project/app/planilhas/ModeloFINEP.xlsx and /dev/null differ diff --git a/project/app/planilhas/ModeloOPAS.xlsx b/project/app/planilhas/ModeloOPAS.xlsx index 2837f2bd..89b22070 100644 Binary files a/project/app/planilhas/ModeloOPAS.xlsx and b/project/app/planilhas/ModeloOPAS.xlsx differ diff --git a/project/app/planilhas_preenchidas/planilhas/ModeloFUNDEP.xlsx b/project/app/planilhas_preenchidas/planilhas/ModeloFUNDEP.xlsx new file mode 100644 index 00000000..cd310147 Binary files /dev/null and b/project/app/planilhas_preenchidas/planilhas/ModeloFUNDEP.xlsx differ diff --git a/project/app/planilhas_preenchidas/planilhas/Modelo_Fub.xlsx b/project/app/planilhas_preenchidas/planilhas/Modelo_Fub.xlsx new file mode 100644 index 00000000..9191dce7 Binary files /dev/null and b/project/app/planilhas_preenchidas/planilhas/Modelo_Fub.xlsx differ diff --git a/project/app/preenche_fub.py b/project/app/preenche_fub.py index 158b7a6c..118e5ebd 100644 --- a/project/app/preenche_fub.py +++ b/project/app/preenche_fub.py @@ -191,13 +191,13 @@ def criaout(planilha,codigo,data1,data2): workbook.save(planilha) workbook.close() -# ##########################################Pessoa Fisica######################################### +# ##########################################Pessoa Fisica######################################### CANCELADO def pessoa_fisica(codigo,data1,data2,keys,planilha): tabela = pegar_caminho(planilha) - nomeTabela ="Pessoa Fisica" + nomeTabela ="Outros Serviços Terceiros - PF" tituloStyle = "pessoaFisica" workbook = openpyxl.load_workbook(tabela) - sheet2 = workbook.create_sheet(title="Pessoa Fisica") + sheet2 = workbook.create_sheet(title="Outros Serviços Terceiros - PF") workbook.save(tabela) workbook.close() categorized_data= separarporrubrica(codigo,data1,data2) @@ -219,7 +219,7 @@ def pessoa_fisica(codigo,data1,data2,keys,planilha): # caminho = pegar_caminho(planilha) workb = openpyxl.load_workbook(tabela) - worksheet5 = workb['Pessoa Fisica'] + worksheet5 = workb['Outros Serviços Terceiros - PF'] for i in range(1,maior+1): valor_coluna = 9 + i @@ -246,6 +246,78 @@ def pessoa_fisica(codigo,data1,data2,keys,planilha): workb.save(tabela) workb.close() + + +def pessoaFisica(codigo,data1,data2,keys,planilha): + + tabela = pegar_caminho(planilha) + nomeTabela ="Outros Serviços Terceiros - PF" + tituloStyle = "pessoaFisica" + workbook = openpyxl.load_workbook(tabela) + sheet2 = workbook.create_sheet(title="Outros Serviços Terceiros - PF") + workbook.save(tabela) + workbook.close() + categorized_data= separarporrubrica(codigo,data1,data2) + + tamanho = [] + + if 87 in categorized_data and 25 in categorized_data: + categorized_data[87].extend(categorized_data[25]) + elif 87 not in categorized_data and 25 in categorized_data: + categorized_data[87] = categorized_data[25] + else: + print("Data not available or empty.") + maior = 1 + tabela = pegar_caminho(planilha) + estiloGeral(tabela,maior,tituloStyle,nomeTabela) + return None # or handle the case accordingly + + if 87 not in categorized_data or not categorized_data[87]: + maior = 1 + tabela = pegar_caminho(planilha) + estiloGeral(tabela,maior,tituloStyle,nomeTabela) + print("Data not available or empty.") + return None # or handle the case accordingly + maior = len(categorized_data[87]) + print(maior) + print(len(categorized_data[87])) + tabela = pegar_caminho(planilha) + + estiloGeral(tabela,maior,tituloStyle,nomeTabela) + + + coluna = 2 + # caminho = pegar_caminho(planilha) + + workb = openpyxl.load_workbook(tabela) + worksheet5 = workb['Outros Serviços Terceiros - PF'] + + for i in range(1,maior+1): + valor_coluna = 9 + i + worksheet5.cell(row=valor_coluna, column=1, value=i) # column index starts from 1 + + + for i in keys: + li = [i] + if 87 not in categorized_data or not categorized_data[87]: + print("Data not available or empty.") + maior = 1 + tabela = pegar_caminho(planilha) + estiloGeral(tabela,maior,tituloStyle,nomeTabela) + return None # or handle the case accordingly + valores_preenchimento = retornavalores(categorized_data[87],li) + + n = len(valores_preenchimento) + for rowkek, cell_data in enumerate(valores_preenchimento, start=10): + worksheet5.cell(row=rowkek, column=coluna, value=cell_data) + if coluna == 5 or coluna == 7 : + coluna = coluna + 1 + coluna = coluna + 1 + + workb.save(tabela) + workb.close() + + # ##########################################Pessoa Juridica######################################### def pessoa_juridica(codigo,data1,data2,keys,planilha): @@ -318,7 +390,7 @@ def pessoa_juridica(codigo,data1,data2,keys,planilha): workb.save(tabela) workb.close() -# ##########################################ISS######################################### +# ##########################################ISS#########################################CANCELADO def iss(codigo,data1,data2,keys,planilha): tabela = pegar_caminho(planilha) nomeTabela ="ISS" @@ -430,7 +502,7 @@ def passagem_locomção(codigo,data1,data2,keys,planilha): workb.save(tabela) workb.close() -# ##########################################Serv.Terceiro CLTa######################################### +# ##########################################Serv.Terceiro CLTa#########################################CANCELADO def terclt(codigo,data1,data2,keys,planilha): tabela = pegar_caminho(planilha) nomeTabela ="Serv. Terceiro CLT" @@ -458,7 +530,7 @@ def terclt(codigo,data1,data2,keys,planilha): # caminho = pegar_caminho(planilha) workb = openpyxl.load_workbook(tabela) - worksheet4 = workb['Outros Serviços Terceiros - PF'] + worksheet4 = workb['Serv. Terceiro CLT'] for i in range(1,maior+1): valor_coluna = 9 + i @@ -850,11 +922,11 @@ def demonstrativo(codigo,data1,data2,planilha): def preencher_fub_teste(codigo,data1,data2,keys,tabela): criaout(tabela,codigo,data1,data2) preencherCapa(codigo,tabela) - pessoa_fisica(codigo,data1,data2,keys,tabela) + pessoaFisica(codigo,data1,data2,keys,tabela) pessoa_juridica(codigo,data1,data2,keys,tabela) #iss(codigo,data1,data2,keys,tabela) passagem_locomção(codigo,data1,data2,keys,tabela) - terclt(codigo,data1,data2,keys,tabela) + #terclt(codigo,data1,data2,keys,tabela) obricacao_tributaria(codigo,data1,data2,keys,tabela) conciliacao_bancaria(codigo,data1,data2,tabela) rendimentodeaplicacao(codigo,data1,data2,tabela) diff --git a/project/app/static/css/style.css b/project/app/static/css/style.css index 79fb97cf..bab12387 100644 --- a/project/app/static/css/style.css +++ b/project/app/static/css/style.css @@ -10,6 +10,7 @@ body { height: 100vh; width: 100vw; } + header { display: flex; align-items: center; diff --git a/project/app/static/imagem/baixar.png b/project/app/static/imagem/baixar.png new file mode 100644 index 00000000..870ac645 Binary files /dev/null and b/project/app/static/imagem/baixar.png differ diff --git a/project/app/static/imagem/pesquisar.png b/project/app/static/imagem/pesquisar.png new file mode 100644 index 00000000..b21ef930 Binary files /dev/null and b/project/app/static/imagem/pesquisar.png differ diff --git a/project/app/templates/cadastro.html b/project/app/templates/cadastro.html index 1c9ef4b5..6b9f33f0 100644 --- a/project/app/templates/cadastro.html +++ b/project/app/templates/cadastro.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} + \ No newline at end of file diff --git a/project/app/templates/home.html b/project/app/templates/home.html index d9b73d42..c66d1bd0 100644 --- a/project/app/templates/home.html +++ b/project/app/templates/home.html @@ -9,7 +9,7 @@
@@ -23,9 +23,9 @@CODIGO | -NOME | -SALDO | -DATA ASSINATURA | -DATA VIGENCIA | -DATA ENCERRAMENTO | -TIPO DO CONTRATO | -INSTITUICAO EXECUTORA | -PROCESSO | -SUBPROCESSO | -COD_PROPOSTA | -PROPOSTA | - -VALOR_APROVADO | -NOME_TP_CONTROLE_SALDO | -GRUPO_GESTORES | -GESTOR_RESP | -COORDENADOR | -PROCEDIMENTO_COMPRA | -TAB_FRETE | -TAB_DIARIAS | -CUSTO_OP | -NOME_FINANCIADOR | -DEPARTAMENTO | -SITUACAO | -BANCO | -AGENCIA_BANCARIA | -CONTA_BANCARIA | -CENTRO_CUSTO | -CONTA_CAIXA | -CATEGORIA_PROJETO | -COD_CONVENIO_CONTA | -COD_STATUS | -IND_SUB_PROJETO | -TIPO_CUSTO_OP | -PROJETO_MAE | -ID_COORDENADOR | -ID_FINANCIADOR | -ID_INSTITUICAO | -ID_DEPARTAMENTO | -NOME_INSTITUICAO | -ID_INSTITUICAO_EXECUTORA | -ID_TIPO | -
---|
{{ entry.CODIGO }} | -{{ entry.NOME }} | -{{ entry.SALDO }} | -{{ entry.DATA_ASSINATURA }} | -{{ entry.DATA_VIGENCIA }} | -{{ entry.DATA_ENCERRAMENTO }} | -{{ entry.TIPO_CONTRATO }} | -{{ entry.INSTITUICAO_EXECUTORA }} | -{{ entry.PROCESSO }} | -{{ entry.SUBPROCESSO }} | -{{ entry.COD_PROPOSTA }} | -{{ entry.PROPOSTA }} | - -{{ entry.VALOR_APROVADO }} | -{{ entry.NOME_TP_CONTROLE_SALDO }} | -{{ entry.GRUPO_GESTORES }} | -{{ entry.GESTOR_RESP }} | -{{ entry.COORDENADOR }} | -{{ entry.PROCEDIMENTO_COMPRA }} | -{{ entry.TAB_FRETE }} | -{{ entry.TAB_DIARIAS }} | -{{ entry.CUSTO_OP }} | -{{ entry.NOME_FINANCIADOR }} | -{{ entry.DEPARTAMENTO }} | -{{ entry.SITUACAO }} | -{{ entry.BANCO }} | -{{ entry.AGENCIA_BANCARIA }} | -{{ entry.CONTA_BANCARIA }} | -{{ entry.CENTRO_CUSTO }} | -{{ entry.CONTA_CAIXA }} | -{{ entry.CATEGORIA_PROJETO }} | -{{ entry.COD_CONVENIO_CONTA }} | -{{ entry.COD_STATUS }} | -{{ entry.IND_SUB_PROJETO }} | -{{ entry.TIPO_CUSTO_OP }} | -{{ entry.PROJETO_MAE }} | -{{ entry.ID_COORDENADOR }} | -{{ entry.ID_FINANCIADOR }} | -{{ entry.ID_INSTITUICAO }} | -{{ entry.ID_DEPARTAMENTO }} | -{{ entry.NOME_INSTITUICAO }} | -{{ entry.ID_INSTITUICAO_EXECUTORA }} | -{{ entry.ID_TIPO }} | +Código | +Nome | +Financiador | +Data Assinatura |
+ Data Vigência |
+ Coordenador | +Valor Aprovado |
+ Grupo | +Baixar |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
...
+ {{ data.previous_page_number }} + + {% endif %} + + {{ data.number }} + + {% if data.has_next and data.next_page_number == data.paginator.num_pages %} + {{ data.paginator.num_pages }} + + {% elif data.has_next %} + {{ data.next_page_number }} +...
+ {{ data.paginator.num_pages }} + + {% endif %} + +