Skip to content
Snippets Groups Projects
Commit e5749dac authored by Bouchaira Neirouz's avatar Bouchaira Neirouz
Browse files

dossiers

parent 6a31f200
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags:
``` python
import sqlite3
# Connect to SQLite database
conn = sqlite3.connect('company.db')
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db')
cursor = conn.cursor()
# Create tables
cursor.execute('''
CREATE TABLE IF NOT EXISTS EMPLOYE (
NUMERO_EMPLOYE INT PRIMARY KEY,
TYPE INT CHECK (TYPE IN (1, 2)),
NOM CHAR(50),
PRENOM CHAR(50),
CS_PRODUCTION INT,
CS_JOURNEE INT,
DATE_DEBUT DATE
);
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS LOG_ANCIENNETE (
NUMERO_EMPLOYE INT,
DATE_DEBUT DATE,
DATE_FIN DATE,
ANCIENNETE FLOAT,
FOREIGN KEY (NUMERO_EMPLOYE) REFERENCES EMPLOYE(NUMERO_EMPLOYE)
);
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS GRILLE_SALAIRE_PROD (
CS_PRODUCTION INT PRIMARY KEY,
PIECE_JOUR INT,
SALAIRE_PIECE FLOAT
);
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS GRILLE_SALAIRE_HORAIRE (
CS_HORAIRE INT PRIMARY KEY,
SALAIRE_HORAIRE FLOAT
);
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS LOG_JOURNEE_PROD (
NUM_LOG_JOUR_PROD INT PRIMARY KEY,
DATE DATE,
NUMERO_EMPLOYE INT,
NB_PIECES INT,
NB_PIECES_SUP INT,
RETARD BOOLEAN,
FOREIGN KEY (NUMERO_EMPLOYE) REFERENCES EMPLOYE(NUMERO_EMPLOYE)
);
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS LOG_JOURNEE_JOUR (
NUM_LOG_JOUR_JOUR INT PRIMARY KEY,
DATE DATE,
NUMERO_EMPLOYE INT,
NB_HEURES INT,
NB_HEURES_SUP INT,
RETARD BOOLEAN,
FOREIGN KEY (NUMERO_EMPLOYE) REFERENCES EMPLOYE(NUMERO_EMPLOYE)
);
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS SALAIRE_SEMAINE (
DATE_LUNDI DATE,
NUMERO_EMPLOYE INT,
NB_HEURES INT,
NB_PRODUCTION INT,
SALAIRE_AVANT FLOAT,
NOEL BOOLEAN,
ANCIENNETE FLOAT,
SALAIRE_APRES FLOAT,
PRIMARY KEY (DATE_LUNDI, NUMERO_EMPLOYE),
FOREIGN KEY (NUMERO_EMPLOYE) REFERENCES EMPLOYE(NUMERO_EMPLOYE)
);
''')
# Commit changes and close connection
conn.commit()
conn.close()
```
......
......@@ -2,7 +2,7 @@ import streamlit as st
import sqlite3
import datetime
# Connect to the database
conn = sqlite3.connect('company.db')
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db')
cursor = conn.cursor()
# Set the title of the Streamlit app
st.title("Machine de Badgeage")
......
......@@ -23,7 +23,7 @@ if page == "suivi_employes":
# Add code for "Suivi Employés" page here
st.write("Page de suivi des employés")
# Connect to the database
conn = sqlite3.connect('company.db')
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db')
cursor = conn.cursor()
# Fetch all employee records
......@@ -46,7 +46,7 @@ if page == "creation_compte_employe":
st.title("Création de compte employé")
# Connect to the database
conn = sqlite3.connect('company.db')
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db')
cursor = conn.cursor()
# Get the maximum employee number from the database
......@@ -82,7 +82,7 @@ if page == "creation_compte_employe":
# Submit button
if st.button("Create Account"):
# Connect to the database
conn = sqlite3.connect('company.db')
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db')
cursor = conn.cursor()
# Insert the new employee record
......
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment