modify suppressionClient ans some bugs fixed

pull/14/head
yannis.doumir_fernandes 1 year ago
parent 56b43e9951
commit babf965758

BIN
app

Binary file not shown.

@ -1,3 +1,4 @@
464 50.00 50.00 0.00
464 50.00 50.00 50.00
958 4.75 60.00 32.00
101 2.00 2.00 3.00
32 123.00 123.00 123.00

@ -1 +1 @@
bhv 65
lll 89

@ -1,2 +1,3 @@
958 50
101 25
464 50

@ -99,8 +99,33 @@ void rechercheRefArticle(int tRef[], int ref, int *index, int tLogique)
void supprimerArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique)
{
int ref, index;
affichSupprimerArticle(&ref);
rechercheRefArticle(tRef, ref, &index, *tLogique);
if ( *tLogique == 0)
{
fprintf(stderr,"\x1B[31mERREUR : Aucun article dans le magasin pour l'instant.\x1B[0m");
return;
}
affichSupprimerArticle(&ref, *tLogique, tRef);
index = trouver_index_article(ref, tRef, *tLogique);
for( int i = index; i < *tLogique; ++i)
{
tRef[i] = tRef[i+1];
tPoids[i] = tPoids[i+1];
tVol[i] = tVol[i+1];
tPrix[i] = tPrix[i+1];
}
(*tLogique)--;
}
/*
void supprimerArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique)
{
int ref, index;
affichSupprimerArticle(&ref, *tLogique, tRef);
index = trouver_index_article(ref, tRef, *tLogique);
//rechercheRefArticle(tRef, ref, &index, *tLogique);
for( int i = index; i < *tLogique-1; ++i)
{
@ -111,6 +136,7 @@ void supprimerArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], i
}
(*tLogique)--;
}
*/
void modifierArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique)
{
@ -261,7 +287,6 @@ void sauvegardeReduc( int tRefReduc[], int tReduc[], int tLogReduc)
float retrouvePrix(float prixReduit, int reduction)
{
printf("BLABLA%d", reduction);
return prixReduit / (1.0 - (reduction / 100.0));
}

@ -44,9 +44,9 @@ void affiche_resp(void) {
void affichArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique) {
printf("\t Liste des articles\n\n");
printf("\t Ref\t Poids\t Volume\t Prix\n");
printf("\t Ref\t\t Poids\t\t Volume\t\t Prix\n");
for (int i = 0; i < tLogique; ++i) {
printf("\t %d\t %.2f\t %.2f\t %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]);
printf("\t %d\t\t %.2f\t\t %.2f\t\t %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]);
}
}
@ -58,8 +58,8 @@ void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], in
for (int i = 0; i < tLogique; ++i) {
if (ref == tRef[i]) {
printf("\t Ref\t Poids\t Volume\t Prix\n");
printf("\t %d\t %.2f\t %.2f\t %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]);
printf("\t Ref\t\t Poids\t\t Volume\t\t Prix\n");
printf("\t %d\t\t %.2f\t\t %.2f\t\t %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]);
return;
}
}
@ -118,12 +118,19 @@ void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix, int
}
void affichSupprimerArticle(int *ref) {
void affichSupprimerArticle(int *ref, int tLogArticle, int tRef[])
{
printf("Entrez la référence de l'article que vous voulez supprimer : ");
verifInt(ref);
int index = trouver_index_article(*ref, tRef, tLogArticle);
while (index == -1) {
fprintf(stderr, "\x1B[31mERREUR : Article inexistant. Veuillez entrer un numéro valide :\x1B[0m ");
verifInt(ref);
index = trouver_index_article(*ref, tRef, tLogArticle);
}
}
void affichModifierArticle(int *ref, float *poids, float *volume, float *prix) {
printf("\t Quelle est la référence de l'article que vous voulez modifier ?\n");
verifInt(ref);
@ -394,7 +401,6 @@ void menu_resp(int *choix) {
printf("Vous choisissez: ");
while (scanf("%d", choix) != 1 || *choix < 0 || *choix > MENU_QUIT) {
while (getchar() != '\n');
affiche_resp();
printf("Veuillez entrer un choix valide : ");
}
}

@ -10,7 +10,6 @@
/**
* @brief Affiche la liste des articles.
* @author Yannis Doumir Fernandes
*
* @param tRef - Tableau des références des articles.
* @param tPoids - Tableau des poids des articles.
@ -22,7 +21,6 @@ void affichArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int
/**
* @brief Affiche les informations d'un article spécifique.
* @author Yannis Doumir Fernandes
*
* @param tRef - Tableau des références des articles.
* @param tPoids - Tableau des poids des articles.
@ -34,7 +32,6 @@ void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], in
/**
* @brief Affiche les informations d'un client spécifique.
* @author Yannis Doumir Fernandes
*
* @param tNumClient - Tableau des numéros de clients.
* @param tCagnotte - Tableau des cagnottes des clients.
@ -45,7 +42,6 @@ void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogiqu
/**
* @brief Affiche la liste des clients.
* @author Yannis Doumir Fernandes
*
* @param tNumClient - Tableau des numéros de clients.
* @param tCagnotte - Tableau des cagnottes des clients.
@ -56,7 +52,6 @@ void affichClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique
/**
* @brief Affiche les informations nécessaires pour ajouter un nouvel article.
* @author Yannis Doumir Fernandes
*
* @param ref - Référence du nouvel article.
* @param poids - Poids du nouvel article.
@ -69,15 +64,15 @@ void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix, int
/**
* @brief Affiche les informations nécessaires pour supprimer un article.
* @author Yannis Doumir Fernandes
*
* @param ref - Référence de l'article à supprimer.
* @param tLogArticle - Taille logique du tableau des références.
* @param tRef - Tableau des références.
*/
void affichSupprimerArticle(int *ref);
void affichSupprimerArticle(int *ref, int tLogArticle, int tRef[]);
/**
* @brief Affiche les informations nécessaires pour modifier un article.
* @author Yannis Doumir Fernandes
*
* @param ref - Référence de l'article à modifier.
* @param poids - Nouveau poids de l'article.
@ -88,14 +83,12 @@ void affichModifierArticle(int *ref, float *poids, float *volume, float *prix);
/**
* @brief Affiche un message en cas de problème lors de la recherche d'un article.
* @author Yannis Doumir Fernandes
*
*/
void problemRechercheArticle(void);
/**
* @brief Affiche les informations nécessaires pour ajouter un nouveau client.
* @author Yannis Doumir Fernandes
*
* @param tNumClient - Tableau des numéros de clients.
* @param tLogique - Nombre de clients actuellement enregistrés.
@ -105,7 +98,6 @@ void affichAjoutClient(int tNumClient[], int tLogique, int *numC);
/**
* @brief Laisse le responsable choisir une option du menu.
* @author Yannis Doumir Fernandes
*
* @param[in, out] choix - L'option choisie par le responsable.
*/
@ -114,7 +106,6 @@ void menu_resp(int *choix);
/**
* @brief Affiche les informations nécessaires pour entrer le mod de passe responsable.
* @author Yannis Doumir Fernandes
*
* Cette fonction permet au responsable de confirmer son identité
*/
@ -122,14 +113,12 @@ int affichageConnexion(void);
/**
* @brief Affiche le menu qui permet de modifier l'état de la cagnotte d'un client.
* @author Yannis Doumir Fernandes
*
*/
void affichModifClient(int tNumClient[], int tSus[], int tLogique);
/**
* @brief Fonction principale de l'interface du responsable.
* @author Yannis Doumir Fernandes
*
* Cette fonction permet au responsable d'effectuer diverses actions telles que la gestion des articles et des clients.
*/
@ -137,7 +126,6 @@ void global_resp(void);
/**
* @brief Affiche le menu principal de l'interface du responsable.
* @author Yannis Doumir Fernandes
*/
void affiche_resp(void);

Loading…
Cancel
Save