Está en la página 1de 14

Carátula

Proyecto
Finalizado

Alumna: GRECIA SHERLIN, RAMOS MENDOZA

Profesor: HECTOR ODIN DELGADO ENRIQUEZ

2022
Índice

DATOS PRINCIPALES

DER (Diagrama Entidad Relación)

Diccionario de tablas

Manual del programador


Datos principales

Nº Indicador Descripción
1 Nombre de la aplicación MAGIC SHOP
2 Versión 2022
3 Año 2022
4 Lenguaje de Programación PYTHON
5 Sistema de gestión de base de ADMINISTRAR
datos
6 Explique lo que realiza su ADMINISTRAR LO QUE SE VENDE AL DIA DE
programa PRENDAS
DER (Diagrama Entidad Relación)
Diccionario de tablas

Nº Nombre de tabla Descripción


1 compras Esta tabla trae la función de recolectar las ventas, hora,
prenda, precio, num_precio, fecha, de la empresa
2
3
4
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

from tkinter import *


from tkinter import ttk
from tkinter import messagebox
ventana = Tk()
ventana.title("Primera Ventana")
ventana.geometry("620x680")
ventana.config(bg="lavender")

nNro_compra=[]
nReg_venta=[]
nPrecio=[]
nFecha=[]
nHora=[]

Explicación del código fuente

ACA HACEMOS LA CONEXIÓN CON LA VENTANA TKINTER, LE ASIGNAMOS NOMBRE, DE DAMOS TAMAÑO, COLOR, Y SUS IMPORT
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

import pyodbc
direccion_servidor = 'localhost'
nombre_bd = 'Mikros'
nombre_usuario = 'sa'
password = '12345'
try:
    conexion = pyodbc.connect(DRIVER='{ODBC Driver 17 for SQL Server}',
                              SERVER= direccion_servidor,
                              DATABASE=nombre_bd,
                              USER=nombre_usuario,
                              PWD=password)
    # OK! conexión exitosa
except Exception as e:
    # Atrapar error
    print("Ocurrió un error al conectar a SQL Server: ", e)

Explicación del código fuente

ACA HACEMOS LA CONEXIÓN CON SQL, COLACAMOS NUESTRA CONTRASEÑA, USUARIO, Y HACEMOS AL LLAMADO DE LA TABLA,
PARA QUE SE PUEDA ALMACENAR, BORRAR, DE ACUERDO LO HACEMOS EN EL VISUAL
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

lbl=Label(ventana,text="Registro de ventas",bg="lavender",
font=("Ariel", 25))
lbl.pack()
lblNro_compra=Label(text="Nro_compra:", font=("Agency FB",
15)).place(x=20, y=80)
lblReg_venta=Label(text="Venta:", font=("Agency FB",
15)).place(x=20, y=120)
lblPrecio_venta=Label(text="Precio:", font=("Agency FB",
15)).place(x=20, y=160)
lblFecha_entrega=Label(text="Fecha:", font=("Agency FB",
15)).place(x=20, y=200)
lblHora_entrega=Label(text="Hora:", font=("Agency FB",
15)).place(x=20, y=240)

Explicación del código fuente

ACA CREAMOS LOS LABEL, LE ASIGNAMOS EL NOMBRE, EL TIPO DE LETRA, EL TAMAÑO, Y LO AINEAMOS BIEN
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

#CREANDO CAMPO PARA ID_COMPRAS


compra=StringVar()
txtNro_compra=Entry(ventana,textvariable=compra).place(x=100, y=87)
#CREANDO CAMPO PARA NUM_VENTA
venta=StringVar()
txtReg_venta=Entry(ventana,textvariable=venta).place(x=100, y=125)
#CREANDO CAMPO PARA COSTO
precio=StringVar()
txtPrecio_venta=Entry(ventana,textvariable=precio).place(x=100, y=165)
#CREANDO CAMPO PARA FECHA
fecha=StringVar()
txtFecha_entrega=Entry(ventana,textvariable=fecha).place(x=100, y=208)
#CREANDO CAMPO PARA HORA
hora=StringVar()
txtHora_entrega=Entry(ventana,textvariable=hora).place(x=100, y=247)
#CREANDO BOTON ELIMINAR

Explicación del código fuente

ACA CREAMOS LOS CAMPOS, DE IGUAL MANERA, LOS ALINEAMOS A LA ALTURA DE LOS LABEL, YA QUE ESTOS SON SUS CAJAS
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

def Borrar():
    if messagebox.askyesno(message="¿Realmente
desea borrar el registro?", title="¿Borrado?")
== True:
     query="delete from Num_venta"
    """ Nro_compra.delete()
     Reg_venta.delete()
     Precio_venta.delete()
     Fecha_entrega.delete()
     Hora_entrega.delete()"""
    print("")

Explicación del código fuente

ACA CREAMOS EL BOTON ELIMINAR, ASIGNAMOS Y LO HACEMOS LA CONEXIÓN CON LOS DATOS ALMACENADOS DE SQL
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

def Registrar(id_compras, num_venta, costo,


fecha, hora):
    cursorInsert = conexion.cursor()
    consulta = "{call Insertar(?,?,?,?,?)}"
    pr=(id_compras, num_venta, costo,
fecha, hora)
    cursorInsert.execute(consulta, pr)
    cursorInsert.commit()

Explicación del código fuente

ACA CREAMOS EL BOTON REGISTRAMOS, ASIGNAMOS Y LO HACEMOS LA CONEXIÓN CON LOS DATOS ALMACENADOS DE SQL
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

def Agregar():
   
Registrar(compra.get(),venta.get(),precio.get(),
fecha.get(), hora.get())
   
tabla.insert("",'end',text="1",values=[(compra.get
(),venta.get(),precio.get(), fecha.get(),
hora.get())])

Explicación del código fuente

ACA CREAMOS EL BOTON AGREGAR, ASIGNAMOS Y LO HACEMOS LA CONEXIÓN CON LOS DATOS ALMACENADOS DE SQL
Manual del programador
Código Fuente por proceso (pegar como texto) Captura de pantalla del formulario

def Actualizar():
    print("")

#CREANDO FUNCION DE BOTON ELIMINAR


btnBorrar=Button(ventana, text="Borrar", command=Borrar,font=("Agency FB",
13),width=9 ).place(x=100, y=330)
btnAgregar=Button(ventana, text="Agregar", command=Agregar,font=("Agency FB", 13),width=9
).place(x=190, y=330)
btnActualizar=Button(ventana, text="Actualizar", command=Actualizar,font=("Agency FB",
13),width=9 ).place(x=280, y=330)
#CREANDO TABLA
tabla=ttk.Treeview(ventana,column=('Nro_compra','Reg_venta','Precio_venta','Fecha_entrega
','Hora_entrega'),show='headings',height=9)
tabla.place(x=100,y=400)
tabla.column("#1",anchor=CENTER,width=70)
tabla.heading("#1",text="Nro_compra")
tabla.column("#2",anchor=CENTER,width=70)
tabla.heading("#2",text="Reg_venta")
tabla.column("#3",anchor=CENTER,width=70)
tabla.heading("#3",text="Precio_venta")
tabla.column("#4",anchor=CENTER,width=60)
tabla.heading("#4",text="Fecha_entrega")
tabla.column("#5",anchor=CENTER,width=80)
tabla.heading("#5",text='Hora_entrega')

ventana.mainloop()

Explicación del código fuente

ACA CREAMOS LOS BOTONES QUE IRAN EN EL TKINTER, SE POSICIONAN CORRECTAMENTE, CREAMOS UNA PEQUEÑA TABLA QUE
LLEVARA LOS DATOS; NRO_COMPRA, REG_VENTA, PRECIO_VENTA, FECHA_ENTREGA, HORA_ENTREGA.
GRACIAS

También podría gustarte