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

correction code

parent 73fee5a1
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
No preview for this file type
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
......
...@@ -2,3 +2,4 @@ streamlit ...@@ -2,3 +2,4 @@ streamlit
datetime datetime
pandas pandas
numpy 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: ...@@ -40,7 +40,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
popover = st.popover("Filtre employés à afficher") popover = st.popover("Filtre employés à afficher")
total = popover.checkbox("Salaires des employés par semaine", True) total = popover.checkbox("Salaires des employés par semaine", True)
dimin = popover.checkbox("Salaires des employés ayant eu une diminution 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 = 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") 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() employees = cursor.fetchall()
...@@ -57,7 +57,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in: ...@@ -57,7 +57,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
conn.close() conn.close()
with tab2: with tab2:
conn= sqlite3.connect(r'donnees\company.db') conn= sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor() cursor = conn.cursor()
on = st.toggle("Employés avec 3 ans d'anciénneté") on = st.toggle("Employés avec 3 ans d'anciénneté")
cursor.execute("SELECT NUMERO_EMPLOYE,NOM,PRENOM,TYPE,DATE_DEBUT FROM EMPLOYE") 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: ...@@ -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]) st.dataframe(df[df['Type du contrat'] == 2])
with tab3: with tab3:
conn= sqlite3.connect(r'donnees\company.db') conn= sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute("SELECT NUMERO_EMPLOYE,NOM,PRENOM,TYPE FROM EMPLOYE") cursor.execute("SELECT NUMERO_EMPLOYE,NOM,PRENOM,TYPE FROM EMPLOYE")
employees = cursor.fetchall() employees = cursor.fetchall()
...@@ -174,13 +174,13 @@ if 'logged_in' in st.session_state and st.session_state.logged_in: ...@@ -174,13 +174,13 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
return mondays return mondays
# Connexion à la base de données # Connexion à la base de données
conn = sqlite3.connect('donnees\company.db') conn = sqlite3.connect('donnees/company.db')
cursor = conn.cursor() cursor = conn.cursor()
# Génération des lundis # Génération des lundis
mondays = generate_mondays(datetime.now().strftime('%Y-%m-%d')) mondays = generate_mondays(datetime.now().strftime('%Y-%m-%d'))
# Exemple d'opérations avec les employés # 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") cursor.execute("SELECT NUMERO_EMPLOYE, NOM, PRENOM, CS_PRODUCTION, CS_JOURNEE, DATE_DEBUT FROM EMPLOYE")
employees = cursor.fetchall() employees = cursor.fetchall()
...@@ -216,11 +216,11 @@ if 'logged_in' in st.session_state and st.session_state.logged_in: ...@@ -216,11 +216,11 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
if CS_JOURNEE is not None: if CS_JOURNEE is not None:
cursor.execute(f"SELECT SALAIRE_SEMAINE_BASE FROM GRILLE_SALAIRE_HORAIRE WHERE CS_HORAIRE = {CS_JOURNEE}") cursor.execute(f"SELECT SALAIRE_SEMAINE_BASE FROM GRILLE_SALAIRE_HORAIRE WHERE CS_HORAIRE = {CS_JOURNEE}")
salaire_base=cursor.fetchone()[0] 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: if CS_PRODUCTION is not None:
cursor.execute(f"SELECT SALAIRE_SEMAINE_BASE FROM GRILLE_SALAIRE_PROD WHERE CS_PRODUCTION = {CS_PRODUCTION}") cursor.execute(f"SELECT SALAIRE_SEMAINE_BASE FROM GRILLE_SALAIRE_PROD WHERE CS_PRODUCTION = {CS_PRODUCTION}")
salaire_base=cursor.fetchone()[0] 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 0 <= abs(delta_days%365)<= 6:
if CS_JOURNEE is not None: if CS_JOURNEE is not None:
...@@ -253,7 +253,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in: ...@@ -253,7 +253,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
with tab5: with tab5:
st.header("Création de compte employé") 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 = conn.cursor()
cursor.execute("SELECT MAX(NUMERO_EMPLOYE) FROM EMPLOYE") cursor.execute("SELECT MAX(NUMERO_EMPLOYE) FROM EMPLOYE")
max_numero_employe = cursor.fetchone()[0] max_numero_employe = cursor.fetchone()[0]
...@@ -272,10 +272,10 @@ if 'logged_in' in st.session_state and st.session_state.logged_in: ...@@ -272,10 +272,10 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
# Conditional fields based on employee type # Conditional fields based on employee type
if TYPE == 2: 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 CS_JOURNEE = None
else: 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 CS_PRODUCTION = None
# Start date # Start date
...@@ -284,7 +284,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in: ...@@ -284,7 +284,7 @@ if 'logged_in' in st.session_state and st.session_state.logged_in:
# Submit button # Submit button
if st.button("Create Account"): if st.button("Create Account"):
# Connect to the database # Connect to the database
conn=sqlite3.connect(r'donnees\company.db') conn=sqlite3.connect(r'donnees/company.db')
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute(""" cursor.execute("""
SELECT NUMERO_EMPLOYE FROM EMPLOYE 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