Commit 11bce73a by Juan Pablo dure

empesamos a tocar reportes

1 parent 208b02ca
...@@ -11,6 +11,12 @@ class estaticos(): ...@@ -11,6 +11,12 @@ class estaticos():
return(rta) return(rta)
@staticmethod @staticmethod
def Hora():
"""Devuelve la fecha y hora en formato humano"""
rta = datetime.datetime.now().strftime("%H:%M")
return(rta)
@staticmethod
def Fecha(): def Fecha():
"""Devuelve la fecha con formatio humano""" """Devuelve la fecha con formatio humano"""
rta = datetime.datetime.now().strftime("%d/%m/%Y") rta = datetime.datetime.now().strftime("%d/%m/%Y")
......
...@@ -8,17 +8,17 @@ ing = ingenieros.ingenieros() ...@@ -8,17 +8,17 @@ ing = ingenieros.ingenieros()
app = Flask(__name__) app = Flask(__name__)
def create(): def create():
if not os.path.exists("users.json"): if not os.path.exists("data/users.json"):
with open("users.json", "+w") as f: with open("data/users.json", "+w") as f:
f.write("{}") f.write("{}")
def usersave(usr, psw): def usersave(usr, psw):
create() create()
content = "" content = ""
with open("users.json", "r") as u: with open("data/users.json", "r") as u:
content = u.read() content = u.read()
with open("users.json", "w") as u: with open("data/users.json", "w") as u:
try: try:
content = json.loads(content) content = json.loads(content)
except: except:
...@@ -30,7 +30,7 @@ def usersave(usr, psw): ...@@ -30,7 +30,7 @@ def usersave(usr, psw):
def userget(usr): def userget(usr):
create() create()
content = "" content = ""
with open("users.json", "r") as u: with open("data/users.json", "r") as u:
content = u.read() content = u.read()
try: try:
...@@ -157,7 +157,8 @@ def report(): ...@@ -157,7 +157,8 @@ def report():
answer['header']['patente'] = plate.upper() answer['header']['patente'] = plate.upper()
answer['header']["fecha-hora"] = apollo.estaticos.FechaHora() answer['header']["fecha-hora"] = apollo.estaticos.FechaHora()
answer['header']["ingeniero"] = ing.LeerDatosUsuario(request.cookies["login"]) answer['header']["hora"] = apollo.estaticos.Hora()
answer['header']["ingeniero"] = ing.LeerDatosUsuario(request.cookies["login"])['nombreyapellido']
try: try:
login( login(
......
...@@ -139,8 +139,10 @@ class PDF1 { ...@@ -139,8 +139,10 @@ class PDF1 {
"CP:Ciudad:", "CP:Ciudad:",
"Teléfono:", "Teléfono:",
`Fecha de Prueba:\t${data['fecha']}`, `Fecha de Prueba:\t${data['fecha']}`,
"Hora de Prueba:", `Hora de Prueba:\t${data['hora']}`,
`Ingeniero:\t${data['ingeniero']}`,
"Estado de Carga:\tVacio" "Estado de Carga:\tVacio"
], ],
new Vector(Pos.beg_margin + 5, Pos.beg_margin + 10), new Vector(Pos.beg_margin + 5, Pos.beg_margin + 10),
body_black body_black
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!