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

correction code

parent 73fee5a1
Branches
No related tags found
No related merge requests found
This diff is collapsed.
No preview for this file type
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"outputs": [
{
......@@ -27,7 +27,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......
......@@ -2,3 +2,4 @@ streamlit
datetime
pandas
numpy
matplotlib
\ No newline at end of file
......@@ -40,7 +40,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
popover = st.popover("Filtre employés à afficher")
total = popover.checkbox("Salaires des employés par semaine", True)
dimin = popover.checkbox("Salaires des employés ayant eu une diminution par semaine", True)
conn= sqlite3.connect(r'donnees\company.db')
conn= sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor()
cursor.execute("SELECT DATE_LUNDI,SALAIRE_SEMAINE.NUMERO_EMPLOYE,NOM,PRENOM,SALAIRE_BASE,SALAIRE_AVANT, SALAIRE_APRES,NB_HEURES, NB_PRODUCTION,RETARD,ANCIENNETE,NOEL, DATE_DEBUT FROM SALAIRE_SEMAINE JOIN EMPLOYE ON EMPLOYE.NUMERO_EMPLOYE = SALAIRE_SEMAINE.NUMERO_EMPLOYE")
employees = cursor.fetchall()
......@@ -57,7 +57,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
conn.close()
with tab2:
conn= sqlite3.connect(r'donnees\company.db')
conn= sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor()
on = st.toggle("Employés avec 3 ans d'anciénneté")
cursor.execute("SELECT NUMERO_EMPLOYE,NOM,PRENOM,TYPE,DATE_DEBUT FROM EMPLOYE")
......@@ -84,7 +84,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
st.dataframe(df[df['Type du contrat'] == 2])
with tab3:
conn= sqlite3.connect(r'donnees\company.db')
conn= sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor()
cursor.execute("SELECT NUMERO_EMPLOYE,NOM,PRENOM,TYPE FROM EMPLOYE")
employees = cursor.fetchall()
......@@ -174,13 +174,13 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
return mondays
# Connexion à la base de données
conn = sqlite3.connect('donnees\company.db')
conn = sqlite3.connect('donnees/company.db')
cursor = conn.cursor()
# Génération des lundis
mondays = generate_mondays(datetime.now().strftime('%Y-%m-%d'))
# Exemple d'opérations avec les employés
chrismas_day = datetime(2024, 12, 25)
chrismas_day = datetime(2025, 12, 25)
cursor.execute("SELECT NUMERO_EMPLOYE, NOM, PRENOM, CS_PRODUCTION, CS_JOURNEE, DATE_DEBUT FROM EMPLOYE")
employees = cursor.fetchall()
......@@ -216,11 +216,11 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
if CS_JOURNEE is not None:
cursor.execute(f"SELECT SALAIRE_SEMAINE_BASE FROM GRILLE_SALAIRE_HORAIRE WHERE CS_HORAIRE = {CS_JOURNEE}")
salaire_base=cursor.fetchone()[0]
prime_partielle= max(0, salaire_base * delta.days / 365 )
prime_partielle= max(0, salaire_base * delta.days / 365 )*4.5
if CS_PRODUCTION is not None:
cursor.execute(f"SELECT SALAIRE_SEMAINE_BASE FROM GRILLE_SALAIRE_PROD WHERE CS_PRODUCTION = {CS_PRODUCTION}")
salaire_base=cursor.fetchone()[0]
prime_partielle=max(0, salaire_base*100 * delta.days / 365 )
prime_partielle=max(0, salaire_base* delta.days / 365 )*4.5
if 0 <= abs(delta_days%365)<= 6:
if CS_JOURNEE is not None:
......@@ -253,7 +253,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
with tab5:
st.header("Création de compte employé")
conn= sqlite3.connect(r'donnees\company.db')
conn= sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor()
cursor.execute("SELECT MAX(NUMERO_EMPLOYE) FROM EMPLOYE")
max_numero_employe = cursor.fetchone()[0]
......@@ -272,10 +272,10 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
# Conditional fields based on employee type
if TYPE == 2:
CS_PRODUCTION = st.number_input("Code salarial de production", min_value=1, step=1, value=None)
CS_PRODUCTION = st.number_input("Code salarial de production", min_value=1,max_value=6, step=1, value=None)
CS_JOURNEE = None
else:
CS_JOURNEE = st.number_input("Code salarial journalier", min_value=1, step=1, value=1)
CS_JOURNEE = st.number_input("Code salarial journalier", min_value=1,max_value=9, step=1, value=1)
CS_PRODUCTION = None
# Start date
......@@ -284,7 +284,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
# Submit button
if st.button("Create Account"):
# Connect to the database
conn=sqlite3.connect(r'donnees\company.db')
conn=sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor()
cursor.execute("""
SELECT NUMERO_EMPLOYE FROM EMPLOYE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment