Example #1
0
def header(pdf, fac, mat, dni):
    pdf.set_font('Arial', 'B', 12)
    pdf.cell(60, 10, 'TALLERAUTO', 0, 1, 'C')
    pdf.set_font('Arial', '', 10)
    pdf.cell(60, 10, 'Calle Senra, 12  Marin (Pontevedra)', 0, 1, 'L')
    pdf.cell(60, 10, '36911 Tlfo: 986 882 211-656 565 918', 0, 1, 'L')
    pdf.image('car.png', 170, 10, 25, 25, 'png', '')
    pdf.line(5, 40, 200, 40)
    pdf.set_font('Times', 'B', 12)
    pdf.cell(180, 10, 'Factura numero: %s ' % fac, 0, 1, 'R')
    pdf.cell(60, 10, 'DATOS CLIENTE:', 0, 1, 'L')
    cursor = bd.cursor()
    cursor.execute(
        """ SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""",
        (dni, ))
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(30, 10, '%s' % fila[1], 0, 0, 'L')
        pdf.cell(30, 10, '%s' % fila[2], 0, 1, 'L')
        pdf.cell(20, 10, '%s' % fila[3], 0, 0, 'L')
        pdf.cell(50, 10, '%s' % fila[4], 0, 0, 'R')
        pdf.cell(90, 10, 'Matricula Vehiculo: %s' % mat, 0, 1, 'R')
        pdf.cell(30, 10, '%s' % fila[6], 0, 0, 'L')
        pdf.cell(60, 10, '%s' % fila[5], 0, 1, 'L')
    pdf.line(5, 90, 200, 90)
Example #2
0
def Borrarcli(dni):
    dni = str(dni)
    cursor = bd.cursor()
    cursor.execute(""" DELETE FROM clientes WHERE dnicli=? """, (dni,))
    bd.commit()
    
    
Example #3
0
def body(pdf, fac):
    pdf.set_font('Times', 'B', 12)
    pdf.cell(180, 10, 'Fecha factura: ' + time.strftime('%d %b %y'), 0, 1, 'R')
    pdf.cell(120, 10, 'DATOS FACTURA:', 0, 1, 'L')
    pdf.cell(60, 10, 'ID', 1, 0, 'L')
    pdf.cell(60, 10, 'Concepto', 1, 0, 'C')
    pdf.cell(60, 10, 'Precio unidad', 1, 1, 'R')

    cursor = bd.cursor()
    cursor.execute(
        """ SELECT idv, idfac, conceptov, preciov FROM ventas WHERE idfac=?""",
        (fac, ))
    datos = cursor.fetchall()
    suma = 0
    for fila in datos:
        pdf.cell(60, 10, '%s' % fila[0], 1, 0, 'L')
        pdf.cell(60, 10, '%s' % fila[2], 1, 0, 'C')
        pdf.cell(60, 10, '%s' % fila[3], 1, 1, 'R')
        suma = suma + int(fila[3])

    pdf.cell(60, 10, '', 0, 1, 'C')
    pdf.cell(180, 10, 'IVA: 21%', 0, 1, 'R')
    pdf.cell(180, 10, 'Total sin IVA: ' + str(suma) + ' E', 0, 1, 'R')
    pdf.cell(180, 10, 'Total con IVA: ' + str(suma + (suma * 0.21)) + ' E', 0,
             1, 'R')
Example #4
0
def header(pdf,fac,mat,dni):
    pdf.set_font('Arial','B',12)
    pdf.cell(60,10,'TALLERAUTO',0,1,'C')
    pdf.set_font('Arial','',10)
    pdf.cell(60,10,'Calle Senra, 12  Marin (Pontevedra)',0,1,'L')
    pdf.cell(60,10,'36911 Tlfo: 986 882 211-656 565 918',0,1,'L')
    pdf.image('car.png',170,10,25,25,'png','')
    pdf.line(5,40,200,40)
    pdf.set_font('Times','B',12)
    fecha = time.strftime("%d/%m/%y")
    pdf.cell(30,10,'FECHA: %s ' % fecha,0,0,'L')
    pdf.cell(140,10,'Factura numero: %s ' % fac,0,1,'R')
    pdf.cell(60,10,'DATOS CLIENTE:',0,1,'L')
    cursor = bd.cursor()
    cursor.execute(""" SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""", (dni,))
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(30,10,'%s' % fila[1],0,0,'L')
        pdf.cell(30,10,'%s' % fila[2],0,1,'L')
        pdf.cell(20,10,'%s' % fila[3],0,0,'L')
        pdf.cell(50,10,'%s' % fila[4],0,0,'R')
        pdf.cell(90,10,'Matricula Vehiculo: %s' %mat,0,1,'R')
        pdf.cell(30,10,'%s' % fila[6],0,0,'L')
        pdf.cell(60,10,'%s' % fila[5],0,1,'L')
    pdf.line(5,90,205,90)
Example #5
0
def Borrarcli(dni):
    dni = str(dni)
    cursor = bd.cursor()
    cursor.execute(""" DELETE FROM clientes WHERE dnicli=? """, (dni,))
    bd.commit()
    
    
Example #6
0
def Grabarcli(dni, apel, nom, dir, loc, pro, cp, mov, tel, mail, no):
    cursor = bd.cursor()
    registro = (dni, apel, nom, dir, loc, pro, cp, mov, tel, mail, no)
    if dni != "" and  apel != "":
        cursor.executemany("""INSERT INTO clientes(dnicli,apelcli,nomcli,dircli,poblic,procli,cpcli,movcli,telcli,mailcli,pubcli) VALUES (?,?,?,?,?,?,?,?,?,?,?);""", (registro,))
        bd.commit()
    else:
       return False
Example #7
0
 def cargarpreg(self, widet):
     if (self.comboboxProvincia == None):
         cursor = bd.cursor()
         sql = "SELECT * FROM provincias"
         cursor.execute(sql)
         datos = cursor.fetchall()
         for fila in datos:
             self.listProvincias.append([fila[1]])
Example #8
0
File: main.py Project: ChTosar/di
 def cargarpreg(self,widet):
     if(self.comboboxProvincia==None):
         cursor=bd.cursor()
         sql="SELECT * FROM provincias"
         cursor.execute(sql)
         datos=cursor.fetchall()
         for fila in datos:
             self.listProvincias.append([fila[1]])
Example #9
0
def Grabarven(dataf, concepto, precio):
    cursor = bd.cursor()
    registroven = (dataf, concepto, precio)
    if concepto != "":
        cursor.executemany("""INSERT INTO ventas(idfac, conceptov, preciov) VALUES (?,?,?);""", (registroven,))
        bd.commit()
    else:
       return False
Example #10
0
def Grabarcli(dni, apel, nom, dir, loc, cmbProv, cp, mov, tel, mail, no):
    cursor = bd.cursor()
    registro = (dni, apel, nom, dir, loc, cmbProv, cp, mov, tel, mail, no)
    if dni != "" and  apel != "":
        cursor.executemany("""INSERT INTO clientes(dnicli,apelcli,nomcli,dircli,poblic,procli,cpcli,movcli,telcli,mailcli,pubcli) VALUES (?,?,?,?,?,?,?,?,?,?,?);""", (registro,))
        bd.commit()
    else:
       return False
Example #11
0
def Grabarfac(dnifac, matrifac, marcafac, modelfac, fechafac):
    cursor = bd.cursor()
    registrofac = (dnifac, matrifac, marcafac, modelfac, fechafac)
    if dnifac != "" and  matrifac != "":
        cursor.executemany("""INSERT INTO facturas(dnifac,matrifac, modelfac,marcafac,fechafac) VALUES (?,?,?,?,?);""", (registrofac,))
        bd.commit()
    else:
       return False
Example #12
0
def cargarProvs(model,lista):
    if model == None:    
        cursor = bd.cursor()
        sql = """ SELECT * FROM provincias"""
        cursor.execute(sql)
        datos = cursor.fetchall()
        #print datos
        for fila in datos:
            lista.append([fila[1]])
            
Example #13
0
def header(pdf, fac, mat, dni):
    cursor = bd.cursor()
    pdf.set_font("Arial", "B", 12)
    pdf.cell(60, 10, "TALLERAUTO", 0, 1, "C")
    pdf.set_font("Arial", "", 10)
    pdf.cell(60, 10, "Calle Senra, 12  Marin (Pontevedra)", 0, 1, "L")
    pdf.cell(60, 10, "36911 Tlfo: 986 882 211-656 565 918", 0, 1, "L")
    pdf.image("car.png", 170, 10, 25, 25, "png", "")
    pdf.line(5, 40, 200, 40)
    pdf.set_font("Times", "B", 12)
    cursor.execute("""select fechafac from facturas where idfac=?""", (fac,))
    pdf.cell(120, 10, "Fecha de factura:", 0, 0, "R")
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(20, 10, "%s" % fila[0], 0, 0, "R")
    pdf.cell(50, 10, "Factura numero: %s " % fac, 0, 1, "R")
    pdf.cell(60, 10, "DATOS CLIENTE:", 0, 1, "L")
    cursor.execute(
        """ SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""", (dni,)
    )
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(30, 10, "%s" % fila[1], 0, 0, "L")
        pdf.cell(30, 10, "%s" % fila[2], 0, 1, "L")
        pdf.cell(20, 10, "%s" % fila[3], 0, 0, "L")
        pdf.cell(50, 10, "%s" % fila[4], 0, 0, "R")
        pdf.cell(90, 10, "Matricula Vehiculo: %s" % mat, 0, 1, "R")
        pdf.cell(30, 10, "%s" % fila[6], 0, 0, "L")
        pdf.cell(60, 10, "%s" % fila[5], 0, 1, "L")

    pdf.line(5, 90, 200, 90)
    pdf.cell(185, 20, "", 0, 1, "C")
    pdf.cell(20, 10, "ID", 1, 0, "C")
    pdf.cell(135, 10, "Concepto", 1, 0, "C")
    pdf.cell(30, 10, "Venta", 1, 1, "C")

    cursor.execute(""" SELECT idv, conceptov, preciov FROM ventas WHERE idfac=?""", (fac,))
    datos = cursor.fetchall()
    precio = 0
    for fila in datos:
        p = fila[2]
        pdf.cell(20, 10, "%s" % fila[0], 1, 0, "C")
        pdf.cell(135, 10, "%s" % fila[1], 1, 0, "C")
        pdf.cell(30, 10, "%.2f" % float(fila[2]), 1, 1, "C")
        precio = precio + float(p)

    pdf.cell(155, 10, "Neto", 0, 0, "R")
    pdf.cell(30, 10, "%.2f" % float(precio), 1, 1, "C")
    total = precio * 1.21
    iva = total - precio
    pdf.cell(155, 10, "21% IVA", 0, 0, "R")
    pdf.cell(30, 10, "%.2f" % float(iva), 1, 1, "C")
    pdf.cell(155, 10, "Total Factura", 0, 0, "R")
    pdf.cell(30, 10, "%.2f" % float(total), 1, 1, "C")
Example #14
0
def header(pdf, fac, mat, dni):
    cursor = bd.cursor()

    cursor.execute(""" SELECT fechafac FROM facturas WHERE idfac=?""", (fac, ))
    datos = cursor.fetchall()
    for fila in datos:
        fecha = fila[0]

    pdf.set_font('Arial', 'B', 12)
    pdf.cell(60, 10, 'TALLERAUTO', 0, 1, 'C')
    pdf.set_font('Arial', '', 10)
    pdf.cell(60, 10, 'Calle Senra, 12  Marin (Pontevedra)', 0, 1, 'L')
    pdf.cell(60, 10, '36911 Tlfo: 986 882 211-656 565 918', 0, 1, 'L')
    pdf.image('car.png', 170, 10, 25, 25, 'png', '')
    pdf.line(5, 40, 200, 40)
    pdf.set_font('Times', 'B', 12)
    pdf.cell(50, 10, 'Fecha %s ' % fecha, 0, 0, 'L')
    pdf.cell(130, 10, 'Factura numero: %s ' % fac, 0, 1, 'R')
    pdf.cell(60, 10, 'DATOS CLIENTE:', 0, 1, 'L')
    cursor.execute(
        """ SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""",
        (dni, ))
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(30, 10, '%s' % fila[1], 0, 0, 'L')
        pdf.cell(30, 10, '%s' % fila[2], 0, 1, 'L')
        pdf.cell(20, 10, '%s' % fila[3], 0, 0, 'L')
        pdf.cell(50, 10, '%s' % fila[4], 0, 0, 'R')
        pdf.cell(90, 10, 'Matricula Vehiculo: %s' % mat, 0, 1, 'R')
        pdf.cell(30, 10, '%s' % fila[6], 0, 0, 'L')
        pdf.cell(60, 10, '%s' % fila[5], 0, 1, 'L')
    pdf.line(5, 100, 200, 100)
    total = 0
    cursor.execute(
        """ SELECT idv, conceptov, preciov FROM ventas WHERE idfac=?""",
        (fac, ))
    datosv = cursor.fetchall()
    datosv = filter(None, datosv)
    pdf.cell(30, 10, 'ID', 0, 0, 'L')
    pdf.cell(140, 10, 'Concepto', 0, 0, 'L')
    pdf.cell(20, 10, 'Precio', 0, 1, 'R')
    for fila in datosv:
        pdf.cell(30, 10, '%s' % fila[0], 0, 0, 'L')
        pdf.cell(140, 10, '%s' % fila[1], 0, 0, 'L')
        pdf.cell(20, 10, '%s' % fila[2], 0, 1, 'R')
        total += float(fila[2])
    pdf.line(5, 120, 200, 120)
    pdf.cell(30, 10, 'IVA', 0, 0, 'L')
    pdf.cell(160, 10, '%s' % (total * 0.21), 0, 1, 'R')

    pdf.cell(30, 10, 'Total', 0, 0, 'L')
    pdf.cell(145, 10, '%s' % (total * 1.21), 0, 0, 'R')

    pdf.cell(15, 10, 'Euros', 0, 1, 'R')
Example #15
0
def mostrar(lista, trewCliente):
    lista.clear()
    cursor = bd.cursor()
    sql = """ SELECT dnicli, apelcli, nomcli, movcli FROM clientes ORDER BY apelcli"""
    cursor.execute(sql)
    datos = cursor.fetchall()
    datos = filter(None, datos)
    for fila in datos:
        if fila != None:
            lista.append(fila)
        else:
            print "error"
        trewCliente.show()
Example #16
0
def mostrarven(listaven, trewVentas, dataf):
    listaven.clear()
    dataf = str(dataf)
    cursor = bd.cursor()
    cursor.execute(""" SELECT idv, conceptov, preciov FROM ventas WHERE idfac=?""", (dataf,))
    datosv = cursor.fetchall()
    datosv = filter(None, datosv)
    for fila in datosv:
        if fila != None:
            listaven.append(fila)
        else:
            print"error"
        trewVentas.show() 
Example #17
0
def mostrar(listafac, trewFactura, data):
    listafac.clear()
    data = str(data)
    cursor = bd.cursor()
    cursor.execute(""" SELECT idfac, dnifac, matrifac, marcafac, modelfac, fechafac FROM facturas WHERE dnifac=?""", (data,))
    datos = cursor.fetchall()
    datos = filter(None, datos)
    for fila in datos:
        if fila != None:
            listafac.append(fila)
        else:
            print"error"
        trewFactura.show()
Example #18
0
def mostrar(lista, trewCliente):
    lista.clear()
    cursor = bd.cursor()
    sql = """ SELECT dnicli, apelcli, nomcli, movcli FROM clientes ORDER BY apelcli"""
    cursor.execute(sql)
    datos = cursor.fetchall()
    datos = filter(None, datos)
    for fila in datos:
        if fila != None:
            lista.append(fila)
        else:
            print"error"
        trewCliente.show()
Example #19
0
def header(pdf,fac,mat,dni):
    cursor = bd.cursor()

    cursor.execute(""" SELECT fechafac FROM facturas WHERE idfac=?""", (fac,))
    datos=cursor.fetchall()
    for fila in datos:
        fecha=fila[0]
    
    pdf.set_font('Arial','B',12)
    pdf.cell(60,10,'TALLERAUTO',0,1,'C')
    pdf.set_font('Arial','',10)
    pdf.cell(60,10,'Calle Senra, 12  Marin (Pontevedra)',0,1,'L')
    pdf.cell(60,10,'36911 Tlfo: 986 882 211-656 565 918',0,1,'L')
    pdf.image('car.png',170,10,25,25,'png','')
    pdf.line(5,40,200,40)
    pdf.set_font('Times','B',12)    
    pdf.cell(50,10,'Fecha %s ' % fecha,0,0,'L')
    pdf.cell(130,10,'Factura numero: %s ' % fac,0,1,'R')
    pdf.cell(60,10,'DATOS CLIENTE:',0,1,'L')
    cursor.execute(""" SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""", (dni,))
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(30,10,'%s' % fila[1],0,0,'L')
        pdf.cell(30,10,'%s' % fila[2],0,1,'L')
        pdf.cell(20,10,'%s' % fila[3],0,0,'L')
        pdf.cell(50,10,'%s' % fila[4],0,0,'R')
        pdf.cell(90,10,'Matricula Vehiculo: %s' %mat,0,1,'R')
        pdf.cell(30,10,'%s' % fila[6],0,0,'L')
        pdf.cell(60,10,'%s' % fila[5],0,1,'L')
    pdf.line(5,100,200,100)
    total=0
    cursor.execute(""" SELECT idv, conceptov, preciov FROM ventas WHERE idfac=?""", (fac,))
    datosv = cursor.fetchall()
    datosv = filter(None, datosv)
    pdf.cell(30,10,'ID',0,0,'L')
    pdf.cell(140,10,'Concepto',0,0,'L')
    pdf.cell(20,10,'Precio',0,1,'R')
    for fila in datosv:
        pdf.cell(30,10,'%s' % fila[0],0,0,'L')
        pdf.cell(140,10,'%s' % fila[1],0,0,'L')
        pdf.cell(20,10,'%s' % fila[2],0,1,'R')
        total+=float(fila[2])
    pdf.line(5,120,200,120)
    pdf.cell(30,10,'IVA',0,0,'L')
    pdf.cell(160,10,'%s' % (total*0.21),0,1,'R')

    pdf.cell(30,10,'Total',0,0,'L')
    pdf.cell(145,10,'%s' % (total*1.21),0,0,'R')

    pdf.cell(15,10,'Euros',0,1,'R')
Example #20
0
def cuerpo(pdf,fac):
    pdf.cell(60,10,'',0,1,'L')
    pdf.cell(50,10,'ID Venta',0,0,'L')
    pdf.cell(100,10,'CONCEPTO',0,0,'C')
    pdf.cell(30,10,'IMPORTE',0,1,'R')
    cursor = bd.cursor()
    cursor.execute(""" SELECT * FROM ventas WHERE idfac=? """, (fac,))
    datos = cursor.fetchall()
    precios = 0
    for fila in datos:
        pdf.cell(50,10,'%s' % fila[0],1,0,'L')
        pdf.cell(100,10,'%s' % fila[2],1,0,'L')
        pdf.cell(30,10,'%s' % fila[3],1,1,'R')
        precio = int(fila[3])
        precios = precios+precio
    return precios
Example #21
0
def cuerpo(pdf, fac):
    pdf.cell(60, 10, '', 0, 1, 'L')
    pdf.cell(50, 10, 'ID Venta', 0, 0, 'L')
    pdf.cell(100, 10, 'CONCEPTO', 0, 0, 'C')
    pdf.cell(30, 10, 'IMPORTE', 0, 1, 'R')
    cursor = bd.cursor()
    cursor.execute(""" SELECT * FROM ventas WHERE idfac=? """, (fac, ))
    datos = cursor.fetchall()
    precios = 0
    for fila in datos:
        pdf.cell(50, 10, '%s' % fila[0], 1, 0, 'L')
        pdf.cell(100, 10, '%s' % fila[2], 1, 0, 'L')
        pdf.cell(30, 10, '%s' % fila[3], 1, 1, 'R')
        precio = int(fila[3])
        precios = precios + precio
    return precios
Example #22
0
def header(pdf, fac, mat, dni):
    pdf.set_font('Arial', 'B', 12)
    pdf.cell(60, 10, 'TALLERAUTO', 0, 0, 'C')
    import time
    fecha = time.strftime('%d/%b/%y')
    pdf.cell(100, 10, 'Fecha: %s' % fecha, 0, 1, 'R')
    pdf.set_font('Arial', '', 10)
    pdf.cell(60, 10, 'Calle Senra, 12  Marin (Pontevedra)', 0, 1, 'L')
    pdf.cell(60, 10, '36911 Tlfo: 986 882 211-656 565 918', 0, 1, 'L')
    pdf.image('el taller logo.png', 170, 10, 25, 25, 'png', '')
    pdf.line(5, 40, 200, 40)
    pdf.set_font('Times', 'B', 12)
    pdf.cell(180, 10, 'Factura numero: %s ' % fac, 0, 1, 'R')
    pdf.cell(60, 10, 'DATOS CLIENTE:', 0, 1, 'L')
    cursor = bd.cursor()
    cursor.execute(
        """ SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""",
        (dni, ))
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(30, 10, '%s' % fila[1] + ', %s' % fila[2], 0, 1, 'L')
        # pdf.cell(30,10,'%s' % fila[2],0,1,'L')
        pdf.cell(50, 10, 'Calle: %s' % fila[3], 0, 0, 'L')
        pdf.cell(50, 10, 'Poblacion: %s' % fila[4], 0, 0, 'R')
        pdf.cell(80, 10, 'Matricula Vehiculo: %s' % mat, 0, 1, 'R')
        pdf.cell(50, 10, 'CP: %s' % fila[6], 0, 0, 'L')
        pdf.cell(60, 10, 'Provincia: %s' % fila[5], 0, 1, 'L')
    pdf.line(5, 90, 200, 90)

    pdf.cell(30, 10, "ID", 0, 0, 'C')
    pdf.cell(100, 10, "CONCEPTO", 0, 0, 'C')
    pdf.cell(30, 10, "PRECIO", 0, 1, 'C')
    pdf.line(5, 100, 200, 100)
    cursor.execute(
        """ SELECT idv,conceptov,preciov from ventas WHERE idfac=?""", (fac, ))
    datos = cursor.fetchall()
    subtotal = 0
    for fila in datos:
        pdf.cell(30, 10, '%s' % fila[0], 1, 0, 'C')
        pdf.cell(100, 10, '%s' % fila[1], 1, 0, 'C')
        pdf.cell(30, 10, '%s' % fila[2], 1, 1, 'C')
        precio = fila[2]
        subtotal = subtotal + int(precio)
    pdf.cell(170, 20, 'TOTAL     %s' % subtotal + ' ' + chr(128), 0, 0, 'R')
Example #23
0
def header(pdf,fac,mat,dni):
    pdf.set_font('Arial','B',12)
    pdf.cell(60,10,'TALLERAUTO',0,0,'C')	
    import time
    fecha=time.strftime('%d/%b/%y')
    pdf.cell(100,10,'Fecha: %s' % fecha,0,1,'R')
    pdf.set_font('Arial','',10)
    pdf.cell(60,10,'Calle Senra, 12  Marin (Pontevedra)',0,1,'L')
    pdf.cell(60,10,'36911 Tlfo: 986 882 211-656 565 918',0,1,'L')
    pdf.image('el taller logo.png',170,10,25,25,'png','')
    pdf.line(5,40,200,40)
    pdf.set_font('Times','B',12)
    pdf.cell(180,10,'Factura numero: %s ' % fac,0,1,'R')
    pdf.cell(60,10,'DATOS CLIENTE:',0,1,'L')
    cursor = bd.cursor()
    cursor.execute(""" SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""", (dni,))
    datos = cursor.fetchall()
    for fila in datos:
        pdf.cell(30,10,'%s' % fila[1]+', %s'%fila[2],0,1,'L')
       # pdf.cell(30,10,'%s' % fila[2],0,1,'L')
        pdf.cell(50,10,'Calle: %s' % fila[3],0,0,'L')
        pdf.cell(50,10,'Poblacion: %s' % fila[4],0,0,'R')
        pdf.cell(80,10,'Matricula Vehiculo: %s' %mat,0,1,'R')
        pdf.cell(50,10,'CP: %s' % fila[6],0,0,'L')
        pdf.cell(60,10,'Provincia: %s' % fila[5],0,1,'L')
    pdf.line(5,90,200,90)
    
    pdf.cell(30,10,"ID",0,0,'C')
    pdf.cell(100,10,"CONCEPTO",0,0,'C')
    pdf.cell(30,10,"PRECIO",0,1,'C')
    pdf.line(5,100,200,100)
    cursor.execute(""" SELECT idv,conceptov,preciov from ventas WHERE idfac=?""", (fac,))
    datos = cursor.fetchall()
    subtotal=0;
    for fila in datos:
        pdf.cell(30,10,'%s' % fila[0],1,0,'C')
        pdf.cell(100,10,'%s' % fila[1],1,0,'C')
        pdf.cell(30,10,'%s' % fila[2],1,1,'C')
        precio=fila[2]
        subtotal=subtotal+int(precio)
    pdf.cell(170,20,'TOTAL     %s'% subtotal+' '+chr(128),0,0,'R')
Example #24
0
def cuerpo(pdf, fac):
    pdf.set_font('Times','B',12)
    pdf.cell(50,10,'ID',0,0,'L')
    pdf.cell(115,10,'CONCEPTO',0,0,'L')
    pdf.cell(30,10,'IMPORTE',0,1,'C')
    pdf.line(5,99,205,99)
    cursor = bd.cursor()
    cursor.execute(""" SELECT idv, conceptov, preciov FROM ventas WHERE idfac=?""", (fac,))
    datos = cursor.fetchall()
    subtotal = 0
    for fila in datos:
        pdf.cell(50,10,'%s' % fila[0],0,0,'L')
        pdf.cell(105,10,'%s' % fila[1],0,0,'L')
        pdf.cell(30,10,'%s' % fila[2],0,1,'R')
        subtotal = float(subtotal) + float(fila[2])
    iva = 0.21*subtotal
    total = iva + subtotal
    pdf.set_y(-60)
    pdf.cell(180,10,'Subtotal: %.2f' % subtotal,0,1,'R')
    pdf.cell(180,10,'IVA: %.2f' % iva,0,1,'R')
    pdf.cell(180,10,'Total: %.2f' % total,0,1,'R')
Example #25
0
def body(pdf, fac):  
    pdf.set_font('Times','B',12)
    pdf.cell(180,10,'Fecha factura: ' + time.strftime('%d %b %y'),0,1,'R')
    pdf.cell(120,10,'DATOS FACTURA:',0,1,'L')
    pdf.cell(60,10,'ID',1,0,'L')
    pdf.cell(60,10,'Concepto',1,0,'C')
    pdf.cell(60,10,'Precio unidad',1,1,'R')

    cursor = bd.cursor()
    cursor.execute(""" SELECT idv, idfac, conceptov, preciov FROM ventas WHERE idfac=?""", (fac,))
    datos = cursor.fetchall()
    suma = 0
    for fila in datos:
        pdf.cell(60,10,'%s' % fila[0],1,0,'L')
        pdf.cell(60,10,'%s' % fila[2],1,0,'C')
        pdf.cell(60,10,'%s' % fila[3],1,1,'R')
        suma = suma + int(fila[3])
        
    pdf.cell(60,10,'',0,1,'C')  
    pdf.cell(180,10,'IVA: 21%',0,1,'R')
    pdf.cell(180,10,'Total sin IVA: ' + str(suma) + ' E',0,1,'R')
    pdf.cell(180,10,'Total con IVA: ' + str(suma+(suma*0.21)) + ' E',0,1,'R')
Example #26
0
 def llenarCombo(self):
     cursor = bd.cursor()
     rows=cursor.execute("SELECT provincia FROM  provincias")
     for row in rows:
         self.listaProv.append([row[0]])
Example #27
0
def grabarUsuario(nombre,password):
    cursor = bd.cursor()
    registro =(nombre,password)
    if nombre!="" and password!="":
        cursor.executemany("""INSERT INTO usuarios(Usuario,Password) VALUES(?,?)""",registro)
Example #28
0
def header(pdf,fac,mat,dni):
    pdf.set_font('Arial','B',12)
    pdf.cell(80,10,'EL TALLER DE LAS IDEAS S.L.',0,1,'C')
    pdf.set_font('Arial','',10)
    pdf.cell(80,10,'Calle Senra, 12  Marin (Pontevedra)',0,1,'C')
    pdf.cell(80,10,'C.P: 36911 Tlfo: 986 882 211-656 565 918',0,1,'C')
    pdf.image('logo.png',140,10,60,25,'png','')
    pdf.set_font('Times','B',12)
    pdf.cell(0,10,'Factura numero: %s ' % fac + '   Fecha: %s' % time.strftime("%d/%b/%y"),0,1,'R')
    pdf.line(5,50,200,50)
    pdf.set_font('Times','B',14)
    pdf.cell(60,10,'DATOS CLIENTE:',0,1,'L')
    pdf.set_font('Times','B',12)
    cursor = bd.cursor()
    cursor.execute(""" SELECT dnicli, apelcli, nomcli, dircli, poblic, procli, cpcli FROM clientes WHERE dnicli=?""", (dni,))
    datos = cursor.fetchall()
    for fila in datos:
        #Nombre cliente
        pdf.set_font('Times','B',12)
        pdf.cell(25,10,'Nombre: ',0,0,'L')
        pdf.set_font('Times','',12)
        pdf.cell(25,10,'%s' % fila[1]+',  %s' % fila[2],0,0,'L')
        pdf.set_font('Times','B',12)
        pdf.cell(118,10,'Matricula Vehiculo:',0,0,'R')
        pdf.set_font('Times','U',12)
        pdf.cell(20,10,'%s ' %mat,0,1,'R')
        #pdf.cell(20,10,'%s' % fila[2],0,1,'L')
        #Direccion
        pdf.set_font('Times','B',12)
        pdf.cell(25,10,'Direccion:  ',0,0,'L')
        pdf.set_font('Times','',12)
        pdf.cell(25,10,'%s' % fila[3]+'  %s' % fila[4],0,1,'L')
        #pdf.cell(50,10,'%s' % fila[4],0,0,'R')
        pdf.set_font('Times','B',12)
        #Cod Postal
        pdf.cell(25,10,'Cod. Post: ',0,0,'L')
        pdf.set_font('Times','',12)
        pdf.cell(25,10,'%s' % fila[6] + ' - %s' % fila[5],0,1,'L')
        #pdf.cell(50,10,'%s' % fila[5],0,0,'L')
        pdf.line(5,95,200,95)
        
        #pdf.set_font('Times','B',14)
        pdf.cell(60,10,'',0,1,'L')
        #pdf.set_font('Times','B',12)
        
        #Cabecera de la tabla
        #pdf.cell(0,10,'',0,1,'L')
        pdf.set_font('Times','BI',14)
        pdf.cell(22,10,'Codigo',1,0,'C')
        pdf.cell(122,10,'Concepto',1,0,'C')
        pdf.cell(45,10,'Precio',1,1,'C')
        
        cursor2 = bd.cursor()
        cursor2.execute("""select idv,conceptov,preciov from ventas where idfac=?""",(fac,))
        datos2 = cursor2.fetchall()
       
        
        total = 0
        
        for fila2 in datos2:
            pdf.set_font('Times','',12)
            pdf.cell(22,5,'%s' % fila2[0],1,0,'C')
            pdf.cell(122,5,'%s' % fila2[1],1,0,'C')
            precio=fila2[2]
            pdf.cell(45,5,'%s' % precio,1,1,'C')
            total = total+float(fila2[2])


        #Precio sin IVA
        pdf.cell(144,10,'Total Sin IVA: ',0,0,'R')
        pdf.set_font('Times','I',12)
        totalsiniva = float(total)
        pdf.cell(45,10,'%s' % round(totalsiniva,2),1,1,'C')
        
        #IVA
        pdf.cell(144,10,'IVA(21%): ',0,0,'R')
        pdf.set_font('Times','I',12)
        iva = float(total*0.21)
        pdf.cell(45,10,'%s' % round(iva,2),1,1,'C')
        
        #Imprime total
        pdf.set_font('Times','B',14)
        pdf.cell(144,10,'Total: ',0,0,'R')
        pdf.set_font('Times','BI',14)
        pdf.set_text_color(247,94,37)
        pdf.cell(45,10,'%s' % round(iva+totalsiniva,2) + '$',1,1,'C')
Example #29
0
 def llenarCombo(self):
     cursor = bd.cursor()
     rows = cursor.execute("SELECT provincia FROM  provincias")
     for row in rows:
         self.listaProv.append([row[0]])