Skip to content

Commit

Permalink
Merge pull request #161 from ResidenciaTICBrisa/estilos_outras_tabelas
Browse files Browse the repository at this point in the history
Estilos outras tabelas
  • Loading branch information
pedrobarbosaocb authored Dec 7, 2023
2 parents 29213d1 + 8f1f5bf commit 6c2dae5
Show file tree
Hide file tree
Showing 7 changed files with 404 additions and 26 deletions.
42 changes: 29 additions & 13 deletions project/app/estiloFINEP.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela):
size = tamanho + 10
cinza = "d9d9d9"
cinza_escuro = "bfbfbf"
azul_claro = 'cdfeff'
azul_claro = 'cdfffe'

borda = Border(right=Side(border_style="medium"))
worksheet.sheet_view.showGridLines = False
Expand Down Expand Up @@ -71,32 +71,32 @@ 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 - EQUIPAMENTO E MATERIAL PERMANENTE'


worksheet['A1'].font = Font(name="Arial", size=12, color="FFFFFF",bold=True)
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'] = "='Receita x Despesa'!A3:J3"
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'] = "='Receita x Despesa'!A4:J4"
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'] = "='Receita x Despesa'!A5:J5"
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'] = "='Receita x Despesa'!A6:J6"
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'] = "='Receita x Despesa'!A7:J7"
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")

Expand All @@ -107,7 +107,7 @@ def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela):

#colunas azul cabecario
locals()[input2] = NamedStyle(name=f'{input2}')
locals()[input2].font = Font(name="Arial", size=12, color="FFFFFF",bold=True)
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") )
Expand All @@ -119,7 +119,7 @@ def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela):
if cell.column == 10:
cell.border = Border(top=Side(border_style="medium") ,bottom=Side(border_style="thin"), right=Side(border_style="medium") )

valores = ["ITEM","NOME","CNPJ/CPF",'ESPECIFICAÇÃO DA DESPESA','DESCRIÇÃO',"DO RECIBO OU EQUIVALENTE","DATA DE EMISSÃO",'CHEQUE / ORDEM BANCÁRIA','DATA DE PGTO','Valor']
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)
Expand Down Expand Up @@ -195,7 +195,7 @@ def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela):
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].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
Expand All @@ -212,12 +212,10 @@ def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela):



values = ["Item","Restituidor","CNPJ/CPF",'Descrição',"Cheque equivalente","Data do Cheque",'Nº do Depósito','Data da Devolução','Valor']
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)
if coluna == 4:
coluna = coluna + 1
coluna = coluna + 1


Expand Down Expand Up @@ -351,3 +349,21 @@ def estiloGeral(tabela,tamanho,nomeVariavel,nomeTabela):

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)
8 changes: 4 additions & 4 deletions project/app/estilo_fub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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") )
Expand Down Expand Up @@ -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") )
Expand Down
Binary file modified project/app/planilhas_preenchidas/planilhas/Modelo_Fub.xlsx
Binary file not shown.
90 changes: 81 additions & 9 deletions project/app/preenche_fub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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):

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 6c2dae5

Please sign in to comment.