Exemple #1
0
def realizarCambio(EN, BD, FN, LN, G, HD, S, D):
    ultimoEN = con.DataBase().ultimoEN()
    #f = HD.date ()
    #fechato = f.year() +1
    #DN = con.DataBase().select_depa(D)
    #con.DataBase().insert_salary(EN, S, HD, _date_to_string( fechato))
    #con.DataBase().insert_dept(EN, DN, HD, _date_to_string( fechato))
    con.DataBase().actualizar(EN, BD, FN, LN, G, HD)
    MB.showinfo("Exito", "Cambio Realizado")
    limpiar()
Exemple #2
0
def onReturn(event):
    if (con.DataBase().buscardept(busquedacaja.get())):
        items = con.DataBase().buscardept(busquedacaja.get())
        print(items)
        lb.delete(*lb.get_children())
        for j in items:
            lb.insert('', tk.END, values=(j[0], j[1], j[2], j[3], j[4], j[5]))

        lb.place(x=10, y=280, width=900, height=150)
        lb.selection_remove()
        return lb
Exemple #3
0
def realizarAlta(EN, BD, FN, LN, G, HD, S, D):
    altas = con.DataBase().select_one(EN)
    ultimoEN = con.DataBase().ultimoEN()
    #print("HD " +HD)
    #fechato =  HD +1
    #print(fechato)
    #DN = con.DataBase().select_depa(D)
    if (altas):
        MB.showinfo("Error", "El numero de empleado ya existe")
    else:
        #con.DataBase().insert_salary(EN, S, HD, _date_to_string( fechato))
        #con.DataBase().insert_dept(EN, DN, HD, _date_to_string( fechato))
        con.DataBase().alta(ultimoEN[0] + 1, BD, FN, LN, G, HD)
        limpiar()
Exemple #4
0
def actualizarT():
    lb.delete(*lb.get_children())
    items = con.DataBase().select_all()
    for p in items:
        lb.insert("", tk.END, text=p[0], values=(p[1], p[2], p[3], p[4], p[5]))
    lb.place(x=10, y=240, width=600, height=150)
    lb.selection_remove()
    return lb
Exemple #5
0
def cargar(id):
    limpiar()
    lista = con.DataBase().select_one(id)
    idCaja.insert(0, lista[0])
    marcaCaja.set(lista[1])
    modeCaja.insert(0, lista[2])
    tipoCaja.set(lista[3])
    precioCaja.insert(0, lista[4])
    cantCaja.insert(0, lista[5])
Exemple #6
0
def obtenerNumEmpleado():
    strNumEmpleado.set(numEmpleadoCaja.get())
    if strNumEmpleado.get():
        con.DataBase().baja(strNumEmpleado.get())
        actualizarT()
        limpiar()
        MB.showinfo("Exito", "Baja Realizada")
    else:
        MB.showerror("Error", "Introduce un Numero de Empleado")
Exemple #7
0
def obtenerId():
    strID.set(idCaja.get())
    if strID.get():
        con.DataBase().baja(int(strID.get()))
        actualizarT()
        actualizarTP()
        MB.showinfo("Exito", "Baja Realizada")
        azr()
    else:
        MB.showerror("Error", "Introduce un ID")
Exemple #8
0
def actualizarTP():
    lb2.delete(*lb2.get_children())
    items2 = con.DataBase().select_pedidos()
    for p2 in items2:
        lb2.insert("",
                   tk.END,
                   text=p2[0],
                   values=(p2[1], p2[2], p2[3], p2[4], p2[5], p2[6]))
    lb2.place(x=10, y=430, width=600, height=150)
    lb2.selection_remove()
    return lb2
Exemple #9
0
def canAb():
    lb.delete(*lb.get_children())
    itemscb = con.DataBase().select_cb()
    for pcb in itemscb:
        lb.insert("",
                  tk.END,
                  text=pcb[0],
                  values=(pcb[1], pcb[2], pcb[3], pcb[4], pcb[5]))
    lb.place(x=10, y=240, width=600, height=150)
    lb.selection_remove()
    return lb
Exemple #10
0
def preAr():
    lb.delete(*lb.get_children())
    itemspa = con.DataBase().select_pa()
    for ppa in itemspa:
        lb.insert("",
                  tk.END,
                  text=ppa[0],
                  values=(ppa[1], ppa[2], ppa[3], ppa[4], ppa[5]))
    lb.place(x=10, y=240, width=600, height=150)
    lb.selection_remove()
    return lb
Exemple #11
0
 def realizarVenta():
     if not idCajaV.get() or not marcaCajaV.get() or not modeCajaV.get(
     ) or not tipoCajaV.get() or not precioCajaV.get() or not cantCajaV.get(
     ) or not clienCaja.get() or int(
             cantSpn.get()) == 0 or not telCaja.get() or not direCaja.get():
         MB.showinfo("Error", "Faltan Datos")
     else:
         if int(cantCajaV.get()) < int(cantSpn.get()):
             MB.showinfo("Error", "No contamos con la cantidad Solicitada")
         else:
             con.DataBase().actualizar(
                 int(idCajaV.get()), marcaCajaV.get(), modeCajaV.get(),
                 tipoCajaV.get(), int(precioCajaV.get()),
                 (int(cantCajaV.get()) - int(cantSpn.get())))
             con.DataBase().venta(
                 int(idCajaV.get()), clienCaja.get(), int(cantSpn.get()),
                 (int(cantSpn.get()) * int(precioCajaV.get())),
                 telCaja.get(), direCaja.get())
             MB.showinfo("Exito", "Venta Realizada")
             venta.destroy()
             azr()
Exemple #12
0
def filtrar():
    if not buscarCaja.get() or not buscarCB.get():
        MB.showerror("Error", "Debes introducir los datos a filtrar")
    else:
        lb.delete(*lb.get_children())
        itemsf = con.DataBase().select_filtro(buscarCB.get(), buscarCaja.get())
        for pf in itemsf:
            lb.insert("",
                      tk.END,
                      text=pf[0],
                      values=(pf[1], pf[2], pf[3], pf[4], pf[5]))
        lb.place(x=10, y=240, width=600, height=150)
        lb.selection_remove()
        return lb
Exemple #13
0
def obtenerDatos():
    strUs.set(usCaja.get())
    strCon.set(conCaja.get())
    if not strUs.get() or not strCon.get():
        MB.showerror("Error", "Llena los campos")
    elif not strUs.get().isalpha():
        MB.showerror("Error", "Usuario Solo Puede Llevar LETRAS")
    else:
        lleno = con.DataBase().validarUsuario(strUs.get(), strCon.get())

        if (lleno):
            abrirVentana()
        else:
            MB.showerror("Error", "Usuario o Contrasena Incorrectos")
Exemple #14
0
def export_to_pdf():
    
    data = [("emp_no", "birth_date","first_name", "last_name", "gender", "hire_date")]
    registros = con.DataBase().select_empleadosBD("1960")
    
    for row in registros:
        data.append((str(row[0]),str(row[1]),str(row[2]),str(row[3]),str(row[4]),str(row[5])))
    c = canvas.Canvas("Reportes/empleados.pdf", pagesize=A4)

    text=c.beginText(10,810,None)
    text.setFont("Times-Roman",12)
    text.textLine("Employees- Reporte empleados nacidos en el anio 1960")
    c.drawText(text)
    w,h = A4
    max_rows_per_page = 40
    
    x_offset = 50
    y_offset = 50
    
    padding=15
    
    xlist = [x+ x_offset for x in [0,60,200,250,300,350,400,480]]
    ylist = [h - y_offset - i*padding for i in range(max_rows_per_page + 1)]

    for rows in grouper(data, max_rows_per_page):
        rows = tuple(filter(bool, rows))
        c.grid(xlist, ylist[:len(rows) + 1])
        for y, row in zip(ylist[:-1], rows):
            for x, cell in zip(xlist, row):
                c.drawString(x + 2, y - padding + 3, str(cell))
        c.showPage()

    c.save()
    
    #wb.open_new("www.google.com")
    wb.open_new("C:\\Users\\prits\\git\\repository\\Proyecto_PLyF\\Reportes\\empleados.pdf")
    
    
#export_to_pdf()
Exemple #15
0
def actualizarT():
    #lb = ttk.Treeview(ventana,columns=("numEmpleado","fNacimiento", "name", "last_name","gender","hire_date"), show='headings')
    #lb.heading("numEmpleado", text="Numero de empleado")
    #lb.column("numEmpleado", width=45)
    #lb.heading("fNacimiento", text="Fecha de nacimiento")
    #lb.column("fNacimiento", width=45)
    #lb.heading("name", text="Nombre")
    #lb.column("name", width=45)
    #lb.heading("last_name",text="Apellidos")
    #lb.column("last_name", width=45)
    #lb.heading("gender",text="Genero")
    #lb.column("gender", width=45)
    #lb.heading("hire_date",text="Contratacion")
    #lb.column("hire_date", width=45)
    lb.delete(*lb.get_children())
    items = con.DataBase().select_all()

    for j in items:
        lb.insert('', tk.END, values=(j[0], j[1], j[2], j[3], j[4], j[5]))

    lb.place(x=10, y=280, width=900, height=150)
    lb.selection_remove()
    return lb
Exemple #16
0
def export_to_pdf():

    data = [("ID Venta", "ID Producto", "Cliente", "Cantidad", "Costo",
             "Telefono", "Direccion")]
    registros = con.DataBase().select_ventas()
    for row in registros:
        data.append((str(row[0]), str(row[1]), str(row[2]), str(row[3]),
                     str(row[4]), str(row[5]), str(row[6])))

    c = canvas.Canvas("reportes/ventas.pdf", pagesize=A4)
    text = c.beginText(10, 810, None)
    text.setFont("Times-Roman", 12)
    text.textLine("ALBAR'S MOTO SPORT: --REPORTE DE VENTAS--")
    c.drawText(text)
    w, h = A4
    max_rows_per_page = 45
    # Margin.
    x_offset = 50
    y_offset = 50
    # Space between rows.
    padding = 15

    xlist = [x + x_offset for x in [0, 60, 125, 220, 270, 320, 400, 500]]
    ylist = [h - y_offset - i * padding for i in range(max_rows_per_page + 1)]

    for rows in grouper(data, max_rows_per_page):
        rows = tuple(filter(bool, rows))
        c.grid(xlist, ylist[:len(rows) + 1])
        for y, row in zip(ylist[:-1], rows):
            for x, cell in zip(xlist, row):
                c.drawString(x + 2, y - padding + 3, str(cell))
        c.showPage()
    c.save()
    wb.open_new(
        "C:\\Users\\albar\\Desktop\\ProyectoLogicaFuncional\\ProyectoFinalLogicaFuncional\\reportes\\ventas.pdf"
    )
Exemple #17
0
 def __init__(self):
     self.c=conexion.DataBase()
Exemple #18
0
                   width=30,
                   command=lambda: reportes())
btnPDF.place(x=650, y=120)

#Listbox
lb = ttk.Treeview(ventana,
                  columns=("numEmpleado", "fNacimiento", "name", "last_name",
                           "gender", "hire_date"),
                  show='headings')
lb.heading("numEmpleado", text="Numero de empleado")
lb.heading("fNacimiento", text="Fecha de nacimiento")
lb.heading("name", text="Nombre")
lb.heading("last_name", text="Apellidos")
lb.heading("gender", text="Genero")
lb.heading("hire_date", text="Contratacion")
items = con.DataBase().select_all()
for j in items:
    lb.insert('', tk.END, values=(j[0], j[1], j[2], j[3], j[4], j[5]))
    if j == 50:
        break

lb.place(x=10, y=280, width=900, height=150)


def sacar():
    try:
        seleccionado = lb.selection()[0]
        print(seleccionado)
        numEmpleado = lb.item(seleccionado, option='values')
        print(numEmpleado)
        cargar(numEmpleado)
Exemple #19
0
def ventanaVender(id):
    venta = tk.Tk()
    venta.iconbitmap("icos/vender.ico")
    venta.title("AMS Proceso Venta")
    venta.geometry("300x400")
    venta.resizable(0, 0)
    venta.configure(bg="OldLace")
    #Titulo
    titulo = tk.Label(venta, text="Albar's Moto Sport", bg="OldLace")
    titulo.pack(fill=tk.X)
    etiqueta = tk.Label(venta, text="Menu De Venta", bg="OldLace")
    etiqueta.pack()

    #etiquetas
    idLabel = tk.Label(venta, text="ID", bg="OldLace")
    idLabel.place(x=30, y=60)
    marcaLabel = tk.Label(venta, text="Marca", bg="OldLace")
    marcaLabel.place(x=30, y=85)
    modeloLabel = tk.Label(venta, text="Modelo", bg="OldLace")
    modeloLabel.place(x=30, y=110)
    tipoLabel = tk.Label(venta, text="Tipo", bg="OldLace")
    tipoLabel.place(x=30, y=135)
    precioLabel = tk.Label(venta, text="Precio", bg="OldLace")
    precioLabel.place(x=30, y=160)
    cantidadLabel = tk.Label(venta, text="Cantidad", bg="OldLace")
    cantidadLabel.place(x=30, y=185)
    divLabel = tk.Label(
        venta,
        text="_____________________________________________________________",
        bg="OldLace")
    divLabel.place(x=0, y=200)
    clienteLabel = tk.Label(venta, text="Cliente", bg="OldLace")
    clienteLabel.place(x=30, y=225)
    cantidadLabel = tk.Label(venta, text="Cantidad", bg="OldLace")
    cantidadLabel.place(x=30, y=250)
    telefonoLabel = tk.Label(venta, text="Telefono", bg="OldLace")
    telefonoLabel.place(x=30, y=275)
    direcLabel = tk.Label(venta, text="Direccion", bg="OldLace")
    direcLabel.place(x=30, y=300)

    #cajas
    listav = con.DataBase().select_one(id)

    idCajaV = tk.Entry(venta)
    idCajaV.place(x=150, y=60)
    marcaCajaV = tk.Entry(venta)
    marcaCajaV.place(x=150, y=85)
    modeCajaV = tk.Entry(venta)
    modeCajaV.place(x=150, y=110)
    tipoCajaV = tk.Entry(venta)
    tipoCajaV.place(x=150, y=135)
    precioCajaV = tk.Entry(venta)
    precioCajaV.place(x=150, y=160)
    cantCajaV = tk.Entry(venta)
    cantCajaV.place(x=150, y=185)

    idCajaV.insert(0, listav[0])
    marcaCajaV.insert(0, listav[1])
    modeCajaV.insert(0, listav[2])
    tipoCajaV.insert(0, listav[3])
    precioCajaV.insert(0, listav[4])
    cantCajaV.insert(0, listav[5])

    clienCaja = tk.Entry(venta)
    clienCaja.place(x=150, y=225)
    cantSpn = tk.Spinbox(venta, from_=0, to=1000, width=18, state='readonly')
    cantSpn.place(x=150, y=250)
    telCaja = tk.Entry(venta)
    telCaja.place(x=150, y=275)
    direCaja = tk.Entry(venta)
    direCaja.place(x=150, y=300)

    #Boton
    imgVenta = PhotoImage(file='icos/login.png')
    btnVen = tk.Button(venta, text="vender", command=lambda: realizarVenta())
    btnVen.place(x=120, y=350)

    def realizarVenta():
        if not idCajaV.get() or not marcaCajaV.get() or not modeCajaV.get(
        ) or not tipoCajaV.get() or not precioCajaV.get() or not cantCajaV.get(
        ) or not clienCaja.get() or int(
                cantSpn.get()) == 0 or not telCaja.get() or not direCaja.get():
            MB.showinfo("Error", "Faltan Datos")
        else:
            if int(cantCajaV.get()) < int(cantSpn.get()):
                MB.showinfo("Error", "No contamos con la cantidad Solicitada")
            else:
                con.DataBase().actualizar(
                    int(idCajaV.get()), marcaCajaV.get(), modeCajaV.get(),
                    tipoCajaV.get(), int(precioCajaV.get()),
                    (int(cantCajaV.get()) - int(cantSpn.get())))
                con.DataBase().venta(
                    int(idCajaV.get()), clienCaja.get(), int(cantSpn.get()),
                    (int(cantSpn.get()) * int(precioCajaV.get())),
                    telCaja.get(), direCaja.get())
                MB.showinfo("Exito", "Venta Realizada")
                venta.destroy()
                azr()

    #////////////////////////////////
    venta.mainloop()
Exemple #20
0
 def si():
     reportes()
     con.DataBase().vaciarVentas()
     corte.destroy()
     azr()
Exemple #21
0
def realizarCambio(idp, m, mo, t, p, c):
    con.DataBase().actualizar(idp, m, mo, t, p, c)
    MB.showinfo("Exito", "Cambio Realizado")
Exemple #22
0
def realizarAlta(m, mo, t, p, c):
    con.DataBase().alta(m, mo, t, p, c)
    MB.showinfo("Exito", "Alta Realizada")
Exemple #23
0
    def realizarVenta():
        if not idCajaV.get() or not marcaCajaV.get() or not modeCajaV.get(
        ) or not tipoCajaV.get() or not precioCajaV.get() or not cantCajaV.get(
        ) or not clienCaja.get() or int(
                cantSpn.get()) == 0 or not telCaja.get() or not direCaja.get():
            MB.showinfo("Error", "Faltan Datos")
        else:
            if int(cantCajaV.get()) < int(cantSpn.get()):
                MB.showinfo("Error", "No contamos con la cantidad Solicitada")
            else:
                con.DataBase().actualizar(
                    int(idCajaV.get()), marcaCajaV.get(), modeCajaV.get(),
                    tipoCajaV.get(), int(precioCajaV.get()),
                    (int(cantCajaV.get()) - int(cantSpn.get())))
                con.DataBase().venta(
                    int(idCajaV.get()), clienCaja.get(), int(cantSpn.get()),
                    (int(cantSpn.get()) * int(precioCajaV.get())),
                    telCaja.get(), direCaja.get())
                MB.showinfo("Exito", "Venta Realizada")
                venta.destroy()
                azr()

    #////////////////////////////////
    venta.mainloop()


grafico(con.DataBase().graficaTipo())
lb = actualizarT()
lb2 = actualizarTP()
#//////////////
ventana.mainloop()
Exemple #24
0
def azr():
    actualizarT()
    actualizarTP()
    grafico(con.DataBase().graficaTipo())