Skip to content

Commit

Permalink
Merge pull request #151 from ResidenciaTICBrisa/listadeprojetos
Browse files Browse the repository at this point in the history
backend da lista nova de projetos
  • Loading branch information
raqueleucaria authored Nov 14, 2023
2 parents 2efe6fa + 84820ba commit 38a7cb5
Show file tree
Hide file tree
Showing 44 changed files with 441 additions and 0 deletions.
Binary file modified project/app/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/capa.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/estilo_fub.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/estilo_fundep.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/new_dev.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/oracle_cruds.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/preenche_fub.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/preenche_fundep.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified project/app/__pycache__/views.cpython-38.pyc
Binary file not shown.
18 changes: 18 additions & 0 deletions project/app/migrations/0003_alter_mapeamento_id_tipo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2023-11-13 23:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('app', '0002_rename_agencia_bancaria_mapeamento_agencia_bancaria_and_more'),
]

operations = [
migrations.AlterField(
model_name='mapeamento',
name='id_tipo',
field=models.CharField(max_length=200),
),
]
Binary file modified project/app/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified project/app/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Empty file added project/backend/__init__.py
Empty file.
Binary file added project/backend/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added project/backend/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added project/backend/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file added project/backend/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file added project/backend/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added project/backend/__pycache__/views.cpython-38.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions project/backend/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions project/backend/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BackendConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'backend'
107 changes: 107 additions & 0 deletions project/backend/consultas_oracledb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import oracledb


file_path = "/home/ubuntu/Desktop/devfront/devfull/pass.txt"
conStr = ''
with open(file_path, 'r') as file:
conStr = file.readline().strip()

def getCollumNames():

#inicializando o objeto que ira conectar no db
conn = None
#criando o objeto de conexão das
conn = oracledb.connect(conStr)
#criar um objeto cursor necessario para fazer as consultas
cur = conn.cursor()
cur.execute("SELECT * FROM IDEA.STG_PROJETOS_CONVENIAR")

return cur

print("\n")

# cur.close()
# #encerra a conexao
# conn.close()
# print("conexão db completa!")

def getlimitedRows(numb):
consulta = {}
a=[]
try:
connection = oracledb.connect(conStr)
cursor = connection.cursor()
print("Connected to database")
sqlite_select_query = f"SELECT * FROM IDEA.STG_PROJETOS_CONVENIAR WHERE ROWNUM <={numb}"

cursor.execute(sqlite_select_query)
records = cursor.fetchall()
collums = getCollumNames()
a=collums.description

for i in range(0, numb):
# Create a dictionary to store the data for each i
i_data = {}
for j in range(len(a)):
key = a[j][0]
value = records[i][j]

if key in i_data:
i_data[key].append(value) # If the key already exists, append the new value
else:
i_data[key] = value # If the key doesn't exist, create a list with the value

# Add the i_data dictionary to the consulta dictionary under the i key
consulta[i] = i_data


#print(consulta)

# print(f"\n <oracledb.LOB object at 0x7f8823d022b0> \n {consulta['OBJETIVOS']} \n")
#consulta[0]['OBJETIVOS'] = str(consulta[0]['OBJETIVOS'])

cursor.close()

except oracledb.Error as error:
print("Failed to read data from table", error)
finally:
if connection:
connection.close()
print("The connection is closed")

# return records
return consulta


# a = int(input(""))
# lul = getlimitedRows(a)
# print("\n")
# print(type(lul))

def getallRows():

try:
connection = oracledb.connect(conStr)
cursor = connection.cursor()
print("Connected to database")
sqlite_select_query = f"SELECT * FROM IDEA.STG_PROJETOS_CONVENIAR"
cursor.execute(sqlite_select_query)
records = cursor.fetchall()
length = len(records)
print(len(records))
cursor.execute(sqlite_select_query)

cursor.close()

except oracledb.Error as error:
print("Failed to read data from table", error)
finally:
if connection:
connection.close()
print("The connection is closed")

# return records
return length



Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions project/backend/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
26 changes: 26 additions & 0 deletions project/backend/templates/backend/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% load static %}
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>AutomaTEC</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.16/jquery.mask.min.js"></script>
</head>

<body>
<header>
<img src="{% static 'imagem/finateclogo.png' %}" alt="finatec">
<h1>Sistema de prestação automático</h1>
</header>
{% block conteudo %}

{% endblock %}
<footer class="footer">Copyright BRISA 2021©. Todos direitos reservados.</footer>
</body>
</html>
180 changes: 180 additions & 0 deletions project/backend/templates/backend/projetos.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{% extends 'base.html' %}
{% block conteudo %}
{% load static %}
<style>
.data-table {
border-collapse: collapse;
width: 100%;
}

.data-table th, .data-table td {
border: 1px solid #c41515;
padding: 8px;
text-align: left;
}

.data-table tr:nth-child(even) {
background-color: #2e06dd;
}

.data-table th {
background-color: #333;
color: rgb(0, 0, 0);
}
</style>
<div class="search-container">
<form method="get" action="{% url 'pjview' %}">
<input type="text" name="search" placeholder="Digite codigo,nome do projeto,coordenador..." value="{{ search_query }}">
<button type="submit">Buscar</button>
</form>
</div>

<!-- <table class="data-table">
<thead>
<tr>
<th>CODIGO</th>
<th>NOME</th>
<th>FINANCIADOR</th>
<th>COORDENADOR</th>
<th>DATA ASSINATURA</th>
<th>DATA VIGENCIA</th>
<th>DATA ENCERRAMENTO</th>
<th>TIPO DO CONTRATO</th>
<th>INSTITUICAO EXECUTORA</th>
</tr>
</thead>
<tbody>
{% for entry in data %}
<tr>
<td style="color: white;" >{{ entry.CODIGO }}</td>
<td style="color: white;" >{{ entry.NOME }}</td>
<td style="color: white;" >{{ entry.NOME_FINANCIADOR }}</td>
<td style="color: white;">{{ entry.COORDENADOR }}</td>
<td style="color: white;" >{{ entry.DATA_ASSINATURA }}</td>
<td style="color: white;" >{{ entry.DATA_VIGENCIA }}</td>
<td style="color: white;" >{{ entry.DATA_ENCERRAMENTO }}</td>
<td style="color: white;" >{{ entry.TIPO_CONTRATO }}</td>
<td style="color: white;" >{{ entry.INSTITUICAO_EXECUTORA }}</td>
</tr>
{% endfor %}
</tbody>
</table> -->
<table class="data-table">
<thead>
<tr>
<th>CODIGO</th>
<th>NOME</th>
<th>SALDO</th>
<th>DATA ASSINATURA</th>
<th>DATA VIGENCIA</th>
<th>DATA ENCERRAMENTO</th>
<th>TIPO DO CONTRATO</th>
<th>INSTITUICAO EXECUTORA</th>
<th>PROCESSO</th>
<th>SUBPROCESSO</th>
<th>COD_PROPOSTA</th>
<th>PROPOSTA</th>
<!-- #<th>OBJETIVOS</th> -->
<th>VALOR_APROVADO</th>
<th>NOME_TP_CONTROLE_SALDO</th>
<th>GRUPO_GESTORES</th>
<th>GESTOR_RESP</th>
<th>COORDENADOR</th>
<th>PROCEDIMENTO_COMPRA</th>
<th>TAB_FRETE</th>
<th>TAB_DIARIAS</th>
<th>CUSTO_OP</th>
<th>NOME_FINANCIADOR</th>
<th>DEPARTAMENTO</th>
<th>SITUACAO</th>
<th>BANCO</th>
<th>AGENCIA_BANCARIA</th>
<th>CONTA_BANCARIA</th>
<th>CENTRO_CUSTO</th>
<th>CONTA_CAIXA</th>
<th>CATEGORIA_PROJETO</th>
<th>COD_CONVENIO_CONTA</th>
<th>COD_STATUS</th>
<th>IND_SUB_PROJETO</th>
<th>TIPO_CUSTO_OP</th>
<th>PROJETO_MAE</th>
<th>ID_COORDENADOR</th>
<th>ID_FINANCIADOR</th>
<th>ID_INSTITUICAO</th>
<th>ID_DEPARTAMENTO</th>
<th>NOME_INSTITUICAO</th>
<th>ID_INSTITUICAO_EXECUTORA</th>
<th>ID_TIPO</th>
</tr>
</thead>
<tbody>
{% for entry in data %}
<tr>
<td style="color: black;">{{ entry.CODIGO }}</td>
<td style="color: black;">{{ entry.NOME }}</td>
<td style="color: black;">{{ entry.SALDO }}</td>
<td style="color: black;">{{ entry.DATA_ASSINATURA }}</td>
<td style="color: black;">{{ entry.DATA_VIGENCIA }}</td>
<td style="color: black;">{{ entry.DATA_ENCERRAMENTO }}</td>
<td style="color: black;">{{ entry.TIPO_CONTRATO }}</td>
<td style="color: black;">{{ entry.INSTITUICAO_EXECUTORA }}</td>
<td style="color: black;">{{ entry.PROCESSO }}</td>
<td style="color: black;">{{ entry.SUBPROCESSO }}</td>
<td style="color: black;">{{ entry.COD_PROPOSTA }}</td>
<td style="color: black;">{{ entry.PROPOSTA }}</td>
<!-- <td style="color: black;">{{ entry.OBJETIVOS }}</td> -->
<td style="color: black;">{{ entry.VALOR_APROVADO }}</td>
<td style="color: black;">{{ entry.NOME_TP_CONTROLE_SALDO }}</td>
<td style="color: black;">{{ entry.GRUPO_GESTORES }}</td>
<td style="color: black;">{{ entry.GESTOR_RESP }}</td>
<td style="color: black;">{{ entry.COORDENADOR }}</td>
<td style="color: black;">{{ entry.PROCEDIMENTO_COMPRA }}</td>
<td style="color: black;">{{ entry.TAB_FRETE }}</td>
<td style="color: black;">{{ entry.TAB_DIARIAS }}</td>
<td style="color: black;">{{ entry.CUSTO_OP }}</td>
<td style="color: black;">{{ entry.NOME_FINANCIADOR }}</td>
<td style="color: black;">{{ entry.DEPARTAMENTO }}</td>
<td style="color: black;">{{ entry.SITUACAO }}</td>
<td style="color: black;">{{ entry.BANCO }}</td>
<td style="color: black;">{{ entry.AGENCIA_BANCARIA }}</td>
<td style="color: black;">{{ entry.CONTA_BANCARIA }}</td>
<td style="color: black;">{{ entry.CENTRO_CUSTO }}</td>
<td style="color: black;">{{ entry.CONTA_CAIXA }}</td>
<td style="color: black;">{{ entry.CATEGORIA_PROJETO }}</td>
<td style="color: black;">{{ entry.COD_CONVENIO_CONTA }}</td>
<td style="color: black;">{{ entry.COD_STATUS }}</td>
<td style="color: black;">{{ entry.IND_SUB_PROJETO }}</td>
<td style="color: black;">{{ entry.TIPO_CUSTO_OP }}</td>
<td style="color: black;">{{ entry.PROJETO_MAE }}</td>
<td style="color: black;">{{ entry.ID_COORDENADOR }}</td>
<td style="color: black;">{{ entry.ID_FINANCIADOR }}</td>
<td style="color: black;">{{ entry.ID_INSTITUICAO }}</td>
<td style="color: black;">{{ entry.ID_DEPARTAMENTO }}</td>
<td style="color: black;">{{ entry.NOME_INSTITUICAO }}</td>
<td style="color: black;">{{ entry.ID_INSTITUICAO_EXECUTORA }}</td>
<td style="color: black;">{{ entry.ID_TIPO }}</td>
</tr>
<tr><td colspan="8"><hr></td></tr>
{% endfor %}
</tbody>
</table>

<div class="pagination">
<span class="step-links">
{% if data.has_previous %}
<a href="?page=1">&laquo; first</a>
<a href="?page={{ data.previous_page_number }}">previous</a>
{% endif %}

<span class="current-page">
Page {{ data.number }} of {{ data.paginator.num_pages }}.
</span>

{% if data.has_next %}
<a href="?page={{ data.next_page_number }}">next</a>
<a href="?page={{ data.paginator.num_pages }}">last &raquo;</a>
{% endif %}
</span>
</div>

{% endblock %}
3 changes: 3 additions & 0 deletions project/backend/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
6 changes: 6 additions & 0 deletions project/backend/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.urls import path
from . import views

urlpatterns = [
path('', views.project_views, name='pjview'),
]
Loading

0 comments on commit 38a7cb5

Please sign in to comment.