예제 #1
0
def checale(fecha1,fecha2):
	global cur,generic
	fecha=hora.mostrarFechayHora()
	archivo = open("/home/pi/Documents/eum/app/caseta/NoCajero.txt", "r")
	idCajero=str(archivo.readline().rstrip("\n"))
	archivo.close()
	Generic.set(size='2x', align='center')
	Generic.text("Reporte de Eventos\n\n")
	Generic.set(size='normal', align='center')
	Generic.text(fecha1+" - "+fecha2+"\n")
	Generic.text("Cajero: "+str(idCajero)+"\n\n")
	cur.execute("select costo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"+fecha1+"' and '"+fecha2+"' group by costo ")
	for reg in cur: 
		print(reg[0],reg[1])
		Generic.text('Tarifa:'+str(reg[0])+'     '+' boletos cobrados:'+str(reg[1])+'\n\n')
		
	cur.execute("select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"+fecha1+"' and '"+fecha2+"'")
	for reg in cur: 
		print(reg[0])
		Generic.text('Dinero total:'+str(reg[0])+'\n\n')
		
	cur.execute("select tipo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"+fecha1+"' and '"+fecha2+"' group by tipo ")
	for reg in cur: 
		print(reg[0],reg[1])
		Generic.text('Tipo:'+str(reg[0])+'     '+' boletos cobrados:'+str(reg[1])+'\n\n')
		
	cur.execute("select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"+fecha1+"' and '"+fecha2+"'")
	for reg in cur: 
		print(reg[0])
		#Generic.text('Dinero total:'+str(reg[0])+'\n\n')

	Generic.cut()
예제 #2
0
파일: publicidad.py 프로젝트: eumsys/app
		def elimina2(self):
				global cur,conn
				fecha=hora.mostrarFechayHora()
				idp=self.idpub.value()
				print("Eliminado Caon")
				cur.execute("delete from \"PUBLICIDAD\" where \"idPublicidad\"="+str(idp))
				conn.commit()
				self.llenaTabla()
예제 #3
0
def checale(fecha1, fecha2):
    global cur, generic
    fecha = hora.mostrarFechayHora()
    archivo = open("/home/pi/Documents/eum/app/caseta/NoCajero.txt", "r")
    idCajero = str(archivo.readline().rstrip("\n"))
    archivo.close()
    Generic.set(size='2x', align='center')
    Generic.text("INGRESO\n")
    Generic.text("TOTAL.\n\n")
    Generic.set(size='normal', align='center')
    Generic.text(fecha1 + " - " + fecha + "\n")
    Generic.text("Caja: " + str(idCajero) + "\n\n")
    cur.execute(
        "select costo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "' group by costo ")
    for reg in cur:
        print(reg[0], reg[1])
        Generic.text('Tarifa:' + str(reg[0]) + '     ' + ' boletos cobrados:' +
                     str(reg[1]) + '\n\n')

    cur.execute(
        "select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "'")
    for reg in cur:
        #print("AAAS"reg[0])
        Generic.text('Dinero total:' + str(reg[0]) + '\n\n')
    conn = psycopg2.connect(database='CajerOk',
                            user='******',
                            password='******',
                            host='localhost')
    cur = conn.cursor()
    cur2 = conn.cursor()
    cur.execute(
        "select tipo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "' group by tipo ")
    for rega in cur:
        print("tipazos", rega[0], rega[1])
        cur2.execute("select nombre from \"TIPO\" where \"idTipo\"=" +
                     str(rega[0]) + "")
        for reg in cur2:
            print(reg[0])
        Generic.text('Tipo:' + str(reg[0]) + '     ' + ' boletos cobrados:' +
                     str(rega[1]) + '\n\n')

    cur.execute(
        "select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "'")
    for reg in cur:
        print(reg[0])
        #Generic.text('Dinero total:'+str(reg[0])+'\n\n')

    Generic.cut()
예제 #4
0
def checale(fecha1, fecha2):
    global cur, generic
    fecha = hora.mostrarFechayHora()
    archivo = open("/home/pi/Documents/NoCajero.txt", "r")
    idCajero = str(archivo.readline().rstrip("\n"))
    archivo.close()

    pdf = FPDF()
    pdf.add_page()
    pdf.set_font('Arial', 'B', 48)
    pdf.cell(30, 10, 'Reporte de Eventos\n')
    pdf.ln()
    pdf.ln()
    pdf.set_font('Arial', 'B', 24)
    pdf.cell(30, 10,
             fecha1.rstrip(' 00:00:00') + ' - ' + fecha2.rstrip(' 23:59:59'))
    fechaA = str(fecha1.rstrip(' 00:00:00')).replace("/", "-")
    fechaB = str(fecha2.rstrip(' 23:59:59')).replace("/", "-")
    pdf.ln()
    pdf.cell(30, 10, "Cajero: " + str(idCajero))
    pdf.ln()
    pdf.ln()
    pdf.set_font('Arial', 'B', 14)
    pdf.cell(45, 10, 'Fecha', 1)
    pdf.cell(45, 10, 'Usuario', 1)
    pdf.cell(45, 10, 'Evento', 1)
    pdf.cell(55, 10, 'Detalle', 1)
    pdf.set_font('Arial', '', 12)
    pdf.ln()
    cur.execute(
        "select \"USUARIO\".nombre,\"LOG\".nombre,fecha,detalle from \"USUARIO_LOG\" left join \"USUARIO\" on \"USUARIO_LOG\".usuario=\"idUsuario\" left join \"LOG\" on \"USUARIO_LOG\".log=\"idLog\" WHERE fecha BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "' order by fecha")
    for reg in cur:
        print(reg[0], reg[1])
        pdf.cell(45, 10, str(reg[2]), 1)
        pdf.cell(45, 10, str(reg[0]), 1)
        pdf.cell(45, 10, str(reg[1]), 1)
        pdf.cell(55, 10, str(reg[3]), 1)
        pdf.ln()
    #pdf.output('reporteEventos.pdf','F')
    os.system("ls /media/pi/ > /home/pi/Documents/usbPath.txt")
    leerArch = open("/home/pi/Documents/usbPath.txt", "r")
    linea = leerArch.readline().rstrip("\n")
    if (linea != ''):
        print(linea)
        pdf.output(
            '/media/pi/' + linea + '/reportes/reporteEventosDEL' + fechaA +
            'AL' + fechaB + '.pdf', 'F')
    else:
        print("MEMORIA NO CONECTADA")
예제 #5
0
def checale(fecha1,fecha2):
	global cur,generic
	fecha=hora.mostrarFechayHora()
	archivo = open("/home/pi/Documents/NoCajero.txt", "r")
	idCajero=str(archivo.readline().rstrip("\n"))
	archivo.close()
	
	Generic.set(size='2x', align='center')
	Generic.text("Reporte de Eventos\n\n")
	Generic.set(size='normal', align='center')
	Generic.text(fecha1.rstrip(" 00:00:00")+" - "+fecha2.rstrip("23:59:59")+"\n")
	Generic.text("Cajero: "+str(idCajero)+"\n\n")
	cur.execute("select \"USUARIO\".nombre,\"LOG\".nombre,fecha,detalle from \"USUARIO_LOG\" left join \"USUARIO\" on \"USUARIO_LOG\".usuario=\"idUsuario\" left join \"LOG\" on \"USUARIO_LOG\".log=\"idLog\" WHERE fecha BETWEEN '"+fecha1+"' and '"+fecha2+"' order by fecha")
	for reg in cur: 
		print(reg[0],reg[1])
		Generic.text('\nFecha:'+str(reg[2])+'\nUsuario:'+str(reg[0])+'\nEvento:'+str(reg[1])+'\nDetalle:'+str(reg[3])+'\n\n')

	Generic.cut()
예제 #6
0
파일: publicidad.py 프로젝트: eumsys/app
		def habilitaTarifa(self):
				global cur,conn
				idp=self.idpub2.value()
				fecha=hora.mostrarFechayHora()
				vac=0
				cur.execute("select estado from \"PUBLICIDAD\" where \"idPublicidad\"="+str(idp))
				for reg in cur: 
					vac=reg[0]
					print(reg[0])
				
				if(vac==0):
					
					cur.execute("update \"PUBLICIDAD\" set estado=1 where \"idPublicidad\"="+str(idp))
					self.bhabilitar.setText("Deshabilitar")
					conn.commit()
				else:
					cur.execute("update \"PUBLICIDAD\" set estado=0 where \"idPublicidad\"="+str(idp))
					self.bhabilitar.setText("Habilitar")
					conn.commit()
					
				
				self.llenaTabla()
예제 #7
0
파일: rt2.py 프로젝트: eumsys/eum
def checale(fecha1, fecha2, turno, folio):
    global cur, generic, dats, tipos, sucursal, fechaHoy, horaHoy
    boletaje = '-'
    fecha = hora.mostrarFechayHora()

    infile = open(
        '/home/pi/Documents/eum/app/caseta/archivos_config/datos.txt', 'r')
    datos = infile.readline()
    arr = datos.split(',')
    plaza = arr[0]
    localidad = arr[1]
    idCajero = arr[2]
    infile.close()
    """Generic.set(size='2x', align='center')
	Generic.text("INGRESO ")
	Generic.text("VESPERTINO \n")
	Generic.text("CAJA "+str(idCajero)+"\n\n")
	Generic.set(size='normal', align='center')
	Generic.text("Ultimo corte: "+fecha1)
	Generic.text("\nHora actual: "+fecha+"\n\n")
	Generic.set(size='normal', align='left')
	"""
    tot = ''
    cur.execute(
        "select costo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "' group by costo ")
    for reg in cur:
        #print(reg[0],reg[1])
        #Generic.text('Boletos de '+str(reg[0])+' --> '+str(reg[1])+'\n')
        boletaje = boletaje + str(reg[1]) + ':' + str(int(reg[0])) + '\n'
    print(boletaje)

    cur.execute(
        "select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "'")
    for reg in cur:
        #print("AAAS"reg[0])
        #Generic.text('\nDinero total:'+str(reg[0])+'\n\n')
        tot = str(reg[0])
        if (tot == 'None'):
            tot = 0
        else:
            tot = int(reg[0])
    #print(dats)
    conn = psycopg2.connect(database='caseta',
                            user='******',
                            password='******',
                            host='localhost')
    cur = conn.cursor()
    cur2 = conn.cursor()
    print(fecha1, fecha2)
    cur.execute(
        "select tipo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "' group by tipo ")
    for rega in cur:
        print("tipazos", rega[0], rega[1])
        cur2.execute("select nombre from \"TIPO\" where \"idTipo\"=" +
                     str(rega[0]) + "")
        for reg in cur2:
            print(reg[0])

        #Generic.text('Pagos '+str(reg[0])+' --> '+str(rega[1])+'\n')
        print("TIPOSSSSSSSSSSSSSSSSS1", tipos)
        print("TIPOSSSSSSSSSSSSSSSSS2", rega[0], rega[1])

        tipos[int(rega[0]) - 1] = (rega[1])
        print("TIPOSSSSSSSSSSSSSSSSS3", tipos)
        dats = dats + 'Pagos ' + str(reg[0]) + ' --> ' + str(rega[1]) + '\n'

    #print(dats)
    cur.execute(
        "select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "'")
    for reg in cur:
        print(reg[0])
        #Generic.text('Dinero total:'+str(reg[0])+'\n\n')

    #Generic.cut()
    ##tipos[5]:Cobrados,tipos6:Incompletos,tipos4:propina, tipos7:s/propina, tipos2: Perdidos
    sinSello = '0'
    locales = '0'
    cancelados = '0'
    proovedores = '0'
    tolerancias = '0'

    cortesias = '0'
    gastos = '0'
    nomina = '0'
    bonos = '0'
    dobletes = '0'
    anticipoDeDepositos = '0'

    dats = folio + ";" + plaza + "; ;" + fecha + ";" + str(
        idCajero
    ) + ";" + turno + ";" + str(sinSello) + ";" + str(tipos[5]) + ";" + str(
        tipos[6]
    ) + ";" + str(tipos[4]) + ";" + str(
        tipos[7]
    ) + ";" + locales + ";" + cancelados + ";" + proovedores + ";" + tolerancias + ";" + str(
        tipos[2]
    ) + ";" + str(
        tot
    ) + ";" + boletaje + ";" + cortesias + ";" + gastos + ";" + nomina + ";" + bonos + ";" + dobletes + ";" + anticipoDeDepositos
    ##tipos[5]:Cobrados,tipos6:Incompletos,tipos4:propina, tipos7:s/propina, tipos2: Perdidos
    qr = qrcode.QRCode(
        version=4,
        box_size=7,
        border=4,
    )
    conexionServ = os.system("ping -c 1 parkingtip.pythonanywhere.com")
    print("conexionServ", conexionServ)
    if conexionServ != 0:
        try:
            qr.add_data(dats)
            qr.make(fit=True)
            img = qr.make_image(back_color='black')
            f = open("/home/pi/Documents/eum/app/iconos/outputQR2.png", "wb")
            img.save(f)
            f.close()
        except:
            print("Error de registro del corte privado")
            return "Error registro corte privado"
    else:
        try:
            print("turno:", turno)
            if ("V" in turno):
                turno = "Vespertino"
            else:
                turno = "Matutino"
            payload = {
                "turno": turno,
                "boletaje": "0",
                "recuperados": str(tipos[5]),
                "sellados": "0",
                "noSellados": str(sinSello),
                "incompletos": str(tipos[6]),
                "propina": str(tipos[4]),
                "sinpropina": str(tipos[7]),
                "cortesias": "0",
                "tolerancias": tolerancias,
                "locatarios": str(tipos[1]),
                "caja": str(idCajero),
                "created": fechaHoy + "T" + horaHoy,
                "ingreso": str(tot),
                "detalles": boletaje,
                "encargado": "1",
                "sucursal_id": sucursal
            }
            r = requests.post(
                "https://parkingtip.pythonanywhere.com/api/cortes/create/",
                json=payload)
            #r = requests.post("http://127.0.0.1:8000/api/cortes/create/", json=payload)
            print("Result...:", r.text, ", turno:", turno)
        except:
            print("Error de registro del corte publico")
            return "Error registro corte publico"
예제 #8
0
파일: rt2.py 프로젝트: eumsys/app
def checale(fecha1, fecha2, turno, folio):
    global cur, generic, dats, tipos
    boletaje = ''
    fecha = hora.mostrarFechayHora()
    archivo = open("/home/pi/Documents/eum/app/caseta/NoCajero.txt", "r")
    idCajero = str(archivo.readline().rstrip("\n"))
    archivo.close()
    """Generic.set(size='2x', align='center')
	Generic.text("INGRESO ")
	Generic.text("VESPERTINO \n")
	Generic.text("CAJA "+str(idCajero)+"\n\n")
	Generic.set(size='normal', align='center')
	Generic.text("Ultimo corte: "+fecha1)
	Generic.text("\nHora actual: "+fecha+"\n\n")
	Generic.set(size='normal', align='left')
	"""
    tot = ''
    cur.execute(
        "select costo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "' group by costo ")
    for reg in cur:
        #print(reg[0],reg[1])
        #Generic.text('Boletos de '+str(reg[0])+' --> '+str(reg[1])+'\n')
        boletaje = boletaje + str(reg[1]) + ':' + str(int(reg[0])) + '\n'
    print(boletaje)

    cur.execute(
        "select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "'")
    for reg in cur:
        #print("AAAS"reg[0])
        #Generic.text('\nDinero total:'+str(reg[0])+'\n\n')
        tot = str(reg[0])
        if (tot == 'None'):
            tot = 0
        else:
            tot = int(reg[0])
    #print(dats)
    conn = psycopg2.connect(database='CajerOk',
                            user='******',
                            password='******',
                            host='localhost')
    cur = conn.cursor()
    cur2 = conn.cursor()
    print(fecha1, fecha2)
    cur.execute(
        "select tipo,COUNT(\"idBoleto\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "' group by tipo ")
    for rega in cur:
        print("tipazos", rega[0], rega[1])
        cur2.execute("select nombre from \"TIPO\" where \"idTipo\"=" +
                     str(rega[0]) + "")
        for reg in cur2:
            print(reg[0])

        #Generic.text('Pagos '+str(reg[0])+' --> '+str(rega[1])+'\n')
        print("TIPOSSSSSSSSSSSSSSSSS1", tipos)
        print("TIPOSSSSSSSSSSSSSSSSS2", rega[0], rega[1])

        tipos[int(rega[0]) - 1] = (rega[1])
        print("TIPOSSSSSSSSSSSSSSSSS3", tipos)
        dats = dats + 'Pagos ' + str(reg[0]) + ' --> ' + str(rega[1]) + '\n'

    #print(dats)
    cur.execute(
        "select SUM(\"costo\") from \"BOLETO\" where \"fechaExpedicion\" BETWEEN '"
        + fecha1 + "' and '" + fecha2 + "'")
    for reg in cur:
        print(reg[0])
        #Generic.text('Dinero total:'+str(reg[0])+'\n\n')

    #Generic.cut()
    ##tipos[5]:Cobrados,tipos6:Incompletos,tipos4:propina, tipos7:s/propina, tipos2: Perdidos
    sinSello = '0'
    locales = '0'
    cancelados = '0'
    proovedores = '0'
    tolerancias = '0'

    cortesias = '0'
    gastos = '0'
    nomina = '0'
    bonos = '0'
    dobletes = '0'
    anticipoDeDepositos = '0'

    dats = folio + ";" + "Quintana" + "; ;" + fecha + ";" + str(
        idCajero
    ) + ";" + turno + ";" + str(sinSello) + ";" + str(tipos[5]) + ";" + str(
        tipos[6]
    ) + ";" + str(tipos[4]) + ";" + str(
        tipos[7]
    ) + ";" + locales + ";" + cancelados + ";" + proovedores + ";" + tolerancias + ";" + str(
        tipos[2]
    ) + ";" + str(
        tot
    ) + ";" + boletaje + ";" + cortesias + ";" + gastos + ";" + nomina + ";" + bonos + ";" + dobletes + ";" + anticipoDeDepositos
    qr = qrcode.QRCode(
        version=4,
        box_size=7,
        border=4,
    )
    qr.add_data(dats)
    qr.make(fit=True)
    img = qr.make_image(back_color='black')
    f = open("/home/pi/Documents/eum/app/iconos/outputQR2.png", "wb")
    img.save(f)
    f.close()