From f27c09fa6fcb39547c865f756951b5f031ecb784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Tue, 31 Oct 2023 18:36:16 +0100 Subject: [PATCH 1/3] fixed delete article MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- app | Bin 52816 -> 52816 bytes src/app/core_logic/client.c | 151 ------------------------ src/app/core_logic/client.h | 33 +----- src/app/interface/interface_client.c | 167 ++++++++++++++++++++++++++- src/app/interface/interface_client.h | 40 +++++++ 5 files changed, 207 insertions(+), 184 deletions(-) diff --git a/app b/app index 490afcb349638e3f68ef2d523db7409db8f661b4..1e4860e1386ae6643b084d4bedaf449c41a8dfc8 100755 GIT binary patch delta 6960 zcmZu$3tZGy_P@X1{N@D=f*>gG5tN7WMo>T)9t9c_D)>Sk<1jo7VI078HD?SfYe~6X z%Jf4m+6$Avx?u&bsD*80lv7!e)&5c08r!z0Wp|;Z*>isn#gxxyX3qDXbH4Z7bI-lM zdwD3Xr7zBi}%Xzs-xGAvuj43Syf{qDB&2o->NIDBX{LEYQ9?cpRS z+TGF-jE9}k#4E0-EeN4j)CpLLCSH*6_rbUWda1MS-lAoQ6_epX=C~lEtRT$PjE`iZ7{HP?ihT~?CJDSVJcae{x!-B@b@fK)+ z?0a@X<8>LrVGNq!BTkLLW-=?rz!Z>&V!XZhw%iDu5B6U;9Nv@LGmkj>$+|U<1dpQe z2plHzP>xO+`w``Vl#C+a32`OA#dt9@fXL6ibsqKr+wXyc_Uq(I(v04uWbHKWs55FK zrnSDwqsTfRPijyb%!?=e*ua=4YmdbLg?8%5cjR$-bsvX10$Zu0 zFEq5HZtc1#MmdUxqi~CctSSx%d1f@WYRIF-ksyym;|2{mRUGL(icZAfO0hG(bC}Z& z8uD9l6z5MPjai?>jRtMXCJ(I71JA9oI8H;(tj`D?MT4<8Nc6N<>3UUi4IyFiuH>-x~S*#UOQF)W!$ z-p6eL9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%GK;#@cQu8sK+FoG z-J7Tz$2JlJu9aC_Bh0QW@ybu5>B!NjI@i+RNM%8E`>z-=H!J}+%pNDdjW;XX#KOUw zFNny;4=O&Vu0VR#jxI;lR~$^SjPB~FsTl?TyCMwgEFn-_;|1OiALPoR@8LxJ|AYN^ z#a3H**i)U^wd`>ZUc2K(_Up-jYHOs9eIlBLuCuEYc3UIj8%4s+bS8Y2Ga(HDgzF0; z{M8^r;vW{YgYeE>(5Sz*vB4$w5}l{*}ef|!e`bsn9Hh7 zM3+@!Bq;p*&89ll#w>wsd>s32 z7W_L?Kf-!-R<%_!zfvSeH!&M+#c1yIQ6@HHKKL@DrNm;aL2H<+dJEaXVVmsIvs|5t zyvz~jOcF1TT2C_bYRkHnP zHIPrAgoN_FTNp70eF=CUesjALPqTO_4VkxVufrML}J@7jn>Xat1?$qAT7&OZ>%Hl3AN=o;k=poq!)SJ zA2UW7IU$sV;g#4&$oTrb=U7Ir&_}>WJ)e!Z>#@%ctLD zmX%T zt|>RIDIs6s(rYU|%GtO}nm#z&n=Cfz26^!PAk-R^CV#fYgCFt0F}G*Rc)EhuOp|e* zg7Z^lyi~!LvSeJV;CTEZhGxi<3f_nt8N<62oS!7)H)U)kXYk82BOFl(M`y_R3k9oR zs4ptGuvG46$1Ub?^Sv^5Mw#Kp*)nElEryfk$#{Z-OABS3DPjC9?SmT|%A`OcgcQiQ zLczTiGG49V&UhKK3S|S>lmYfAIAnp`|E7YwO)~xu1-DL?v5jFX{;H(lI+XixVKfBoS3 zRi~R%K8hSw*XrZ;?zUyY+QX$!Cd|*Qn|i@7?LfzC@9#YKwny`exv^)zX!~RDV0h~! zbIbT6jZ=R*QGVj`>C8PVx9j#q{k`l(?kap chargeMaximale) { - depassementCharge = poidsTotal - chargeMaximale; - } - - if (volumeTotal > volumeCoffre) { - depassementVolume = volumeTotal - volumeCoffre; - } - - if (budget > 0 && montantTotal > budget) { - depassementBudget = montantTotal - budget; - } - - if (depassementCharge || depassementVolume || depassementBudget) { - printf("Attention : \n"); - if (depassementCharge) { - printf("\tDépassement de la charge autorisée de %.2f kg \n", depassementCharge); - } - if (depassementVolume) { - printf("\tDépassement du volume autorisé de %.2f litres \n", depassementVolume); - } - if (depassementBudget) { - printf("\tDépassement du budget autorisé de %.2f euros \n", depassementBudget); - } - printf("\n"); - } else { - float montantTotal = prixUnitaire[articleIndex] * quantite; - - int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); - - if (clientIndex != -1) { - cagnottes[clientIndex] += 0.1 * montantTotal; - } - - panier[*taillePanier] = reference; - quantites[*taillePanier] = quantite; - (*taillePanier)++; - - printf("Contenu du panier : "); - for (int i = 0; i < *taillePanier; i++) { - printf("%d ", panier[i]); - } - printf("\n"); - - printf("Référence : %d\nQuantité : %d\n", reference, quantite); - printf("Récap :\n"); - printf("Réf Qté Poids Vol PrixU PoidsTot VolTot PrixTot Cagnotte\n"); - printf("%d %d %.2f %.2f %.2f %.2f %.2f %.2f %.2f\n", - reference, quantite, poids[articleIndex], volume[articleIndex], - prixUnitaire[articleIndex], poidsTotal, volumeTotal, montantTotal, - cagnottes[clientIndex]); - printf("Prix total à payer: %.2f euros\n", montantTotal); - printf("Cagnotte totale : %.2f euros\n", cagnottes[clientIndex]); - printf("Volume utilise : %.2f litres\n", volumeTotal); - printf("Volume restant : %.2f litres\n", volumeCoffre - volumeTotal); - printf("Charge Actuelle: %.2f kg\n", poidsTotal); - printf("Charge restante: %.2f kg\n", chargeMaximale - poidsTotal); - } -} - - -/** - * @brief Supprime un article du panier du client. - * - * Cette fonction permet de supprimer un article du panier du client. - * - * @param panier - Tableau des références des articles dans le panier. - * @param quantites - Tableau des quantités de chaque article dans le panier. - * @param taillePanier - Taille du panier. - */ -void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanier) { - int reference; - printf("Entrez la référence de l'article à supprimer : "); - while (scanf("%d", &reference) != 1) { - while (getchar() != '\n'); - printf("ERREUR : Veuillez entrer une référence valide (nombre) : "); - } - while (getchar() != '\n'); - - int articleIndex = trouver_index_article(reference, panier, *taillePanier); - - if (articleIndex == -1) { - printf("Article non trouvé dans le panier. Veuillez entrer une référence valide.\n"); - return; - } - - for (int i = articleIndex; i < (*taillePanier - 1); i++) { - panier[i] = panier[i + 1]; - quantites[i] = quantites[i + 1]; - } - - (*taillePanier)--; - - printf("Article supprimé du panier avec succès.\n"); -} /** * @brief Affiche un récapitulatif du contenu du panier. diff --git a/src/app/core_logic/client.h b/src/app/core_logic/client.h index c3f9717..20941fb 100644 --- a/src/app/core_logic/client.h +++ b/src/app/core_logic/client.h @@ -3,6 +3,7 @@ #include #include +#include "../interface/interface_client.h" /** * @file client.h @@ -34,38 +35,6 @@ int charger_clients(int numeros[], float cagnottes[], int suspendues[], int tPhy */ void sauvegarde_clients(int numeros[], float cagnottes[], int suspendus[], int nombreClients); -/** - * @brief Ajoute un article au panier du client. - * - * @param numeroClient - Numéro du client. - * @param references - Tableau des références des articles. - * @param poids - Tableau des poids des articles. - * @param volume - Tableau des volumes des articles. - * @param prixUnitaire - Tableau des prix unitaires des articles. - * @param numeros - Tableau des numéros de clients. - * @param cagnottes - Tableau des cagnottes des clients. - * @param suspendues - Tableau des états de suspension des clients. - * @param nombreArticles - Nombre d'articles disponibles. - * @param nombreClients - Nombre de clients. - * @param volumeCoffre - Volume total du coffre. - * @param chargeMaximale - Charge maximale du coffre. - * @param panier - Tableau des références des articles dans le panier. - * @param quantites - Tableau des quantités de chaque article dans le panier. - * @param taillePanier - Taille du panier. - * @param budget - Budget du client. - */ -void ajouter_article_au_panier(int numeroClient, int references[], float poids[], float volume[], float prixUnitaire[], - int numeros[], float cagnottes[], int suspendues[], int nombreArticles, int nombreClients, - float volumeCoffre, float chargeMaximale, int panier[], int quantites[], int *taillePanier, float budget); - -/** - * @brief Supprime un article du panier du client. - * - * @param panier - Tableau des références des articles dans le panier. - * @param quantites - Tableau des quantités de chaque article dans le panier. - * @param taillePanier - Taille du panier. - */ -void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanier); /** * @brief Affiche un récapitulatif du contenu du panier. diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index 060c539..1097bd3 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -41,6 +41,170 @@ void menu_client(int *choix) { } } +/** + * @brief Ajoute un article au panier du client. + * + * Cette fonction permet d'ajouter un article au panier du client. + * + * @param numeroClient - Numéro du client. + * @param references - Tableau des références des articles. + * @param poids - Tableau des poids des articles. + * @param volume - Tableau des volumes des articles. + * @param prixUnitaire - Tableau des prix unitaires des articles. + * @param numeros - Tableau des numéros de clients. + * @param cagnottes - Tableau des cagnottes des clients. + * @param suspendues - Tableau des états de suspension des clients. + * @param nombreArticles - Nombre d'articles disponibles. + * @param nombreClients - Nombre de clients. + * @param volumeCoffre - Volume total du coffre. + * @param chargeMaximale - Charge maximale du coffre. + * @param panier - Tableau des références des articles dans le panier. + * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param taillePanier - Taille du panier. + * @param budget - Budget du client. + */ +void ajouter_article_au_panier(int numeroClient, int references[], float poids[], float volume[], float prixUnitaire[], + int numeros[], float cagnottes[], int suspendues[], int nombreArticles, int nombreClients, + float volumeCoffre, float chargeMaximale, int panier[], int quantites[], int *taillePanier, float budget) { + + int reference, quantite, articleIndex; + float poidsTotal, montantTotal, volumeTotal, depassementCharge = 0, depassementVolume, depassementBudget = 0; + + while (1) { + printf("Entrez la référence de l'article : "); + while (scanf("%d", &reference) != 1) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer une référence valide (nombre) : "); + } + while (getchar() != '\n'); + + articleIndex = trouver_index_article(reference, references, nombreArticles); + + if (articleIndex == -1) { + printf("ERREUR : Article non trouvé. Veuillez entrer une référence valide.\n"); + } else { + break; + } + } + + printf("Entrez la quantité : "); + while (scanf("%d", &quantite) != 1) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer une quantité valide (nombre) : "); + } + while (getchar() != '\n'); + + poidsTotal = poids[articleIndex] * quantite; + volumeTotal = volume[articleIndex] * quantite; + montantTotal = prixUnitaire[articleIndex] * quantite; + + if (poidsTotal > chargeMaximale) { + depassementCharge = poidsTotal - chargeMaximale; + } + + if (volumeTotal > volumeCoffre) { + depassementVolume = volumeTotal - volumeCoffre; + } + + if (budget > 0 && montantTotal > budget) { + depassementBudget = montantTotal - budget; + } + + if (depassementCharge || depassementVolume || depassementBudget) { + printf("Attention : \n"); + if (depassementCharge) { + printf("\tDépassement de la charge autorisée de %.2f kg \n", depassementCharge); + } + if (depassementVolume) { + printf("\tDépassement du volume autorisé de %.2f litres \n", depassementVolume); + } + if (depassementBudget) { + printf("\tDépassement du budget autorisé de %.2f euros \n", depassementBudget); + } + printf("\n"); + } else { + float montantTotal = prixUnitaire[articleIndex] * quantite; + + int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); + + if (clientIndex != -1) { + cagnottes[clientIndex] += 0.1 * montantTotal; + } + + panier[*taillePanier] = reference; + quantites[*taillePanier] = quantite; + (*taillePanier)++; + + printf("Contenu du panier : "); + for (int i = 0; i < *taillePanier; i++) { + printf("%d ", panier[i]); + } + printf("\n"); + + printf("Référence : %d\nQuantité : %d\n", reference, quantite); + printf("Récap :\n"); + printf("Réf Qté Poids Vol PrixU PoidsTot VolTot PrixTot Cagnotte\n"); + printf("%d %d %.2f %.2f %.2f %.2f %.2f %.2f %.2f\n", + reference, quantite, poids[articleIndex], volume[articleIndex], + prixUnitaire[articleIndex], poidsTotal, volumeTotal, montantTotal, + cagnottes[clientIndex]); + printf("Prix total à payer: %.2f euros\n", montantTotal); + printf("Cagnotte totale : %.2f euros\n", cagnottes[clientIndex]); + printf("Volume utilise : %.2f litres\n", volumeTotal); + printf("Volume restant : %.2f litres\n", volumeCoffre - volumeTotal); + printf("Charge Actuelle: %.2f kg\n", poidsTotal); + printf("Charge restante: %.2f kg\n", chargeMaximale - poidsTotal); + } +} + + +/** + * @brief Supprime un article du panier du client. + * + * Cette fonction permet de supprimer un article du panier du client. + * + * @param panier - Tableau des références des articles dans le panier. + * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param taillePanier - Taille du panier. + */ +void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanier, float cagnottes[], int numeroClient, int numeros[], int nombreClients, int references[], float prixUnitaire[]) { + int reference; + printf("Entrez la référence de l'article à supprimer : "); + while (scanf("%d", &reference) != 1) { + while (getchar() != '\n'); + printf("ERREUR : Veuillez entrer une référence valide (nombre) : "); + } + while (getchar() != '\n'); + + int articleIndex = trouver_index_article(reference, references, MAX_ARTICLES); + + if (articleIndex == -1) { + printf("Article non trouvé dans le panier. Veuillez entrer une référence valide.\n"); + return; + } + + int quantite = 0; + for (int i = 0; i < *taillePanier; i++) { + if (panier[i] == reference) { + quantite = quantites[i]; + for (int j = i; j < *taillePanier - 1; j++) { + panier[j] = panier[j + 1]; + quantites[j] = quantites[j + 1]; + } + break; + } + } + + (*taillePanier)--; + + int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); + if (clientIndex != -1) { + float montantTotal = prixUnitaire[articleIndex] * quantite; + cagnottes[clientIndex] -= 0.1 * montantTotal; // Retirer 10% du montant + } + + printf("Article supprimé du panier avec succès.\n"); +} /** * @brief Affiche le récapitulatif du panier. @@ -141,7 +305,8 @@ void global_client() { suspendus, nombreArticles, nombreClients, volumeCoffre, chargeMaximale, panier, quantites, &taillePanier, budget); break; case 3: - supprimer_article_du_panier(panier, quantites, &taillePanier); + //supprimer_article_du_panier(panier, quantites, &taillePanier, prixUnitaire, numeroClient, cagnottes); + supprimer_article_du_panier(panier, quantites, &taillePanier, cagnottes, numeroClient, numeros, nombreClients, references, prixUnitaire); break; case 4: modifier_quantite_article_panier(panier, quantites, &taillePanier); diff --git a/src/app/interface/interface_client.h b/src/app/interface/interface_client.h index ebe7eca..66985b2 100644 --- a/src/app/interface/interface_client.h +++ b/src/app/interface/interface_client.h @@ -20,6 +20,46 @@ void affiche_client(); void menu_client(int *choix); +/** + * @brief Ajoute un article au panier du client. + * + * Cette fonction permet d'ajouter un article au panier du client. + * + * @param numeroClient - Numéro du client. + * @param references - Tableau des références des articles. + * @param poids - Tableau des poids des articles. + * @param volume - Tableau des volumes des articles. + * @param prixUnitaire - Tableau des prix unitaires des articles. + * @param numeros - Tableau des numéros de clients. + * @param cagnottes - Tableau des cagnottes des clients. + * @param suspendues - Tableau des états de suspension des clients. + * @param nombreArticles - Nombre d'articles disponibles. + * @param nombreClients - Nombre de clients. + * @param volumeCoffre - Volume total du coffre. + * @param chargeMaximale - Charge maximale du coffre. + * @param panier - Tableau des références des articles dans le panier. + * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param taillePanier - Taille du panier. + * @param budget - Budget du client. + */ +void ajouter_article_au_panier(int numeroClient, int references[], float poids[], float volume[], float prixUnitaire[], + int numeros[], float cagnottes[], int suspendues[], int nombreArticles, int nombreClients, + float volumeCoffre, float chargeMaximale, int panier[], int quantites[], int *taillePanier, float budget); + + +/** + * @brief Supprime un article du panier du client. + * + * Cette fonction permet de supprimer un article du panier du client. + * + * @param panier - Tableau des références des articles dans le panier. + * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param taillePanier - Taille du panier. + */ +//void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanier, float prixUnitaire[], int clientIndex, float cagnottes[]); + +void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanier, float cagnottes[], int numeroClient, int numeros[], int nombreClients, int references[], float prixUnitaire[]); + /** * @brief Affiche le récapitulatif du panier. * From d158941843f4016a4c252c2af27cdb323996b3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Tue, 31 Oct 2023 19:00:35 +0100 Subject: [PATCH 2/3] fixed delete article MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- app | Bin 52816 -> 52880 bytes src/app/core_logic/client.c | 87 ++++++++++----------------- src/app/core_logic/client.h | 33 +++++----- src/app/interface/interface_client.c | 78 +++++++++++++++++++----- src/app/interface/interface_client.h | 25 ++++++++ 5 files changed, 133 insertions(+), 90 deletions(-) diff --git a/app b/app index 1e4860e1386ae6643b084d4bedaf449c41a8dfc8..e0e5f5cbc0ae7e39dceac6274871cd7596809b66 100755 GIT binary patch delta 5238 zcmZ8l30zdy^}hGL8D@q>P%$iH009LwAcCME%fP5C3Zl5x2*U^?PDDVKM4}B7F;F-eR{UCN0ZM(+Me_D9E82V2szQ|zK zSm)n&Lcxad?3iMAj%Obz_Rb0HsAA`Yup^4C4P}QV+qa(dgtB)PM|~J;Lc6if)b|HC z6fueZ9xg}d=?-`hQAn#{{$zhz32P_6H9?fzH<4u_8}sXVk0-2&=Prj*(l7cFCbEnX zkRSUDjmK(ZJ?ba1>Bzl5G~^}lCu5-(*dje>93L zgV?WNT=Zn_GiO*3{TsRjx}($REC`$GPZJ?yYKTuX(nV@P6pK{sEm15SwoX03soWqU z#+MF4MobXxg*7pH`T(|~eFxr0`xbnH_EmTg|CUAG`jXMn^7TLK;OMrtw3_i}j-K!M<28cr#Y(_6~BDH15Mv?=fD6 z_U_S!{*A7-1zkFvDx*oeV>Dcf_09P$az|rIg#q2ioBHSZKsi_rIM?z;Z{BpIzF2$wN(Si(NnfH(z$!sK6=$0p2fUv&02y<0})a8ji9UesM z3J=rt@XPoR`VhLOd%^K|ZTNi`DTo;04#ymb1yv4AozRQn0q(%J@kV+SKL@(I-cxVTz^|arntUE}{{#8kthcnq8^HiA) z%ObH%)Nn?{GEjqTc?J}G&w|&{a z4tTOVg(FxQHX(+0II&4Ca3L{pR3OrE50qNHp<#Y5@HjCEyOWqSul5o0iI8V`&-y{Z zxM%$bZDG&)R(Ru{^^M|__pGlKjC+;?ZL!@VExW7Oy_gEcw&~bE6cqDE3rW)}`2OuI!>>7r3ztXbVdM$0&K4+cCuxJc4}yyOLkhiK4cT zU^~FaU>q+Zl{?#nJY}zQ92hqGn0*_(YM3!fWIEhgiOei=hD!!tXR#QAo1Ni1!|x(Q zxXOdY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rA6u7)5+U#1lwYqPTEMBD7|R_;U&O z!@cwRB^7hTRadmlhgtlri22{uJPuwd;z<(T5+UM536o_aUM^wx99VfFaKfe;;xdz# zPe^8(WZG)jcOlTbc$P?WO3O8i;WF+%hEIvOLheh;t=S^}S;CFagWJVGu6G4Yz8F}Y zyz@OCRH`vzZI~)O-YxbM{zQ_Lh z!p)N}k+PpEj`kW`Y%BjhbK|84e?C3s-OkJ@UF};(w{0?1|0{iGYmGT&%BE1f1A%gBfkw>y7Oa?of+c}JkzuCR4dhwy_=OE^8Y&u B-Bthq diff --git a/src/app/core_logic/client.c b/src/app/core_logic/client.c index 171c08b..e2ffba0 100644 --- a/src/app/core_logic/client.c +++ b/src/app/core_logic/client.c @@ -105,70 +105,47 @@ int trouver_index_client(int numeroClient, int numeros[], int nombreClients) { return -1; // Retourne -1 si le client n'est pas trouvé } - - /** - * @brief Affiche un récapitulatif du contenu du panier. - * - * Cette fonction permet d'afficher un récapitulatif détaillé du contenu du panier du client, y compris les références des articles, - * les quantités, les poids, les volumes, les prix unitaires, les totaux de poids, de volume, de prix, et la cagnotte du client. - * - * @param panier - Tableau des références des articles dans le panier. - * @param taillePanier - Taille du panier. - * @param references - Tableau des références des articles. - * @param poids - Tableau des poids des articles. - * @param volume - Tableau des volumes des articles. - * @param prixUnitaire - Tableau des prix unitaires des articles. - * @param quantites - Tableau des quantités de chaque article dans le panier. - * @param cagnottes - Tableau des cagnottes des clients. - * @param numeroClient - Numéro du client. - * @param numeros - Tableau des numéros de clients. - * @param nombreClients - Nombre de clients. - * @param volumeCoffre - Volume total du coffre. - * @param chargeMaximale - Charge maximale du coffre. + * @brief Supprime un article du panier du client. + * + * Cette fonction permet de supprimer un article du panier du client tout en metant a jour la cagnotte. + * + * @param panier + * @param quantites + * @param taillePanier + * @param reference + * @param numeroClient + * @param numeros + * @param nombreClients + * @param references + * @param prixUnitaire + * @param cagnottes */ -void affiche_recap_panier(int panier[], int taillePanier, int references[], float poids[], float volume[], - float prixUnitaire[], int quantites[], float cagnottes[], int numeroClient, - int numeros[], int nombreClients, float volumeCoffre, float chargeMaximale) { - printf("Contenu du panier : "); - for (int i = 0; i < taillePanier; i++) { - printf("%d ", panier[i]); +void supprimer_article(int panier[], int quantites[], int *taillePanier, int reference, int numeroClient, int numeros[], int nombreClients, int references[], float prixUnitaire[], float cagnottes[]) { + int articleIndex = trouver_index_article(reference, references, MAX_ARTICLES); + int quantite = 0; + for (int i = 0; i < *taillePanier; i++) { + if (panier[i] == reference) { + quantite = quantites[i]; + for (int j = i; j < *taillePanier - 1; j++) { + panier[j] = panier[j + 1]; + quantites[j] = quantites[j + 1]; + } + break; + } } - printf("\n"); - - printf("Récap :\n"); - printf("Réf Qté Poids Vol PrixU PoidsTot VolTot PrixTot\n"); - - float poidsTotal = 0, volumeTotal = 0, montantTotal = 0; - for (int i = 0; i < taillePanier; i++) { - int reference = panier[i]; - int articleIndex = trouver_index_article(reference, references, MAX_ARTICLES); - - float poidsArticle = poids[articleIndex]; - float volumeArticle = volume[articleIndex]; - float prixArticle = prixUnitaire[articleIndex]; - int quantite = quantites[i]; - - printf("%d\t %d\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\n", - reference, quantite, poidsArticle, volumeArticle, - prixArticle, poidsArticle * quantite, volumeArticle * quantite, prixArticle * quantite); - - poidsTotal += poidsArticle * quantite; - volumeTotal += volumeArticle * quantite; - montantTotal += prixArticle * quantite; - } + (*taillePanier)--; int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); + if (clientIndex != -1) { + float montantTotal = prixUnitaire[articleIndex] * quantite; + cagnottes[clientIndex] -= 0.1 * montantTotal; + } - printf("Prix total à payer: %.2f euros\n", montantTotal); - printf("Cagnotte totale : %.2f euros\n", cagnottes[clientIndex]); - printf("Volume utilise : %.2f litres\n", volumeTotal); - printf("Volume restant : %.2f litres\n", volumeCoffre - volumeTotal); - printf("Charge Actuelle: %.2f kg\n", poidsTotal); - printf("Charge restante: %.2f kg\n", chargeMaximale - poidsTotal); } + /** * @brief Modifie la quantité d'un article dans le panier du client. * diff --git a/src/app/core_logic/client.h b/src/app/core_logic/client.h index 20941fb..06a4448 100644 --- a/src/app/core_logic/client.h +++ b/src/app/core_logic/client.h @@ -37,28 +37,23 @@ void sauvegarde_clients(int numeros[], float cagnottes[], int suspendus[], int n /** - * @brief Affiche un récapitulatif du contenu du panier. + * @brief Supprime un article du panier du client. * - * Cette fonction permet d'afficher un récapitulatif détaillé du contenu du panier du client, y compris les références des articles, - * les quantités, les poids, les volumes, les prix unitaires, les totaux de poids, de volume, de prix, et la cagnotte du client. + * Cette fonction permet de supprimer un article du panier du client tout en metant a jour la cagnotte. * - * @param panier - Tableau des références des articles dans le panier. - * @param taillePanier - Taille du panier. - * @param references - Tableau des références des articles. - * @param poids - Tableau des poids des articles. - * @param volume - Tableau des volumes des articles. - * @param prixUnitaire - Tableau des prix unitaires des articles. - * @param quantites - Tableau des quantités de chaque article dans le panier. - * @param cagnottes - Tableau des cagnottes des clients. - * @param numeroClient - Numéro du client. - * @param numeros - Tableau des numéros de clients. - * @param nombreClients - Nombre de clients. - * @param volumeCoffre - Volume total du coffre. - * @param chargeMaximale - Charge maximale du coffre. + * @param panier + * @param quantites + * @param taillePanier + * @param reference + * @param numeroClient + * @param numeros + * @param nombreClients + * @param references + * @param prixUnitaire + * @param cagnottes */ -void affiche_recap_panier(int panier[], int taillePanier, int references[], float poids[], float volume[], - float prixUnitaire[], int quantites[], float cagnottes[], int numeroClient, - int numeros[], int nombreClients, float volumeCoffre, float chargeMaximale); +void supprimer_article(int panier[], int quantites[], int *taillePanier, int reference, int numeroClient, int numeros[], int nombreClients, int references[], float prixUnitaire[], float cagnottes[]); + /** * @brief Modifie la quantité d'un article dans le panier du client. * diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index 1097bd3..d625b34 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -183,27 +183,73 @@ void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanie return; } - int quantite = 0; - for (int i = 0; i < *taillePanier; i++) { - if (panier[i] == reference) { - quantite = quantites[i]; - for (int j = i; j < *taillePanier - 1; j++) { - panier[j] = panier[j + 1]; - quantites[j] = quantites[j + 1]; - } - break; - } + supprimer_article(panier, quantites, taillePanier, reference, numeroClient, numeros, nombreClients, references, prixUnitaire, cagnottes); + + + printf("Article supprimé du panier avec succès.\n"); +} + + +/** + * @brief Affiche un récapitulatif du contenu du panier. + * + * Cette fonction permet d'afficher un récapitulatif détaillé du contenu du panier du client, y compris les références des articles, + * les quantités, les poids, les volumes, les prix unitaires, les totaux de poids, de volume, de prix, et la cagnotte du client. + * + * @param panier - Tableau des références des articles dans le panier. + * @param taillePanier - Taille du panier. + * @param references - Tableau des références des articles. + * @param poids - Tableau des poids des articles. + * @param volume - Tableau des volumes des articles. + * @param prixUnitaire - Tableau des prix unitaires des articles. + * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param cagnottes - Tableau des cagnottes des clients. + * @param numeroClient - Numéro du client. + * @param numeros - Tableau des numéros de clients. + * @param nombreClients - Nombre de clients. + * @param volumeCoffre - Volume total du coffre. + * @param chargeMaximale - Charge maximale du coffre. + */ +void affiche_recap_panier(int panier[], int taillePanier, int references[], float poids[], float volume[], + float prixUnitaire[], int quantites[], float cagnottes[], int numeroClient, + int numeros[], int nombreClients, float volumeCoffre, float chargeMaximale) { + printf("Contenu du panier : "); + for (int i = 0; i < taillePanier; i++) { + printf("%d ", panier[i]); } + printf("\n"); - (*taillePanier)--; + printf("Récap :\n"); + printf("Réf Qté Poids Vol PrixU PoidsTot VolTot PrixTot\n"); - int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); - if (clientIndex != -1) { - float montantTotal = prixUnitaire[articleIndex] * quantite; - cagnottes[clientIndex] -= 0.1 * montantTotal; // Retirer 10% du montant + float poidsTotal = 0, volumeTotal = 0, montantTotal = 0; + + for (int i = 0; i < taillePanier; i++) { + int reference = panier[i]; + int articleIndex = trouver_index_article(reference, references, MAX_ARTICLES); + + float poidsArticle = poids[articleIndex]; + float volumeArticle = volume[articleIndex]; + float prixArticle = prixUnitaire[articleIndex]; + int quantite = quantites[i]; + + printf("%d\t %d\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\n", + reference, quantite, poidsArticle, volumeArticle, + prixArticle, poidsArticle * quantite, volumeArticle * quantite, prixArticle * quantite); + + poidsTotal += poidsArticle * quantite; + volumeTotal += volumeArticle * quantite; + montantTotal += prixArticle * quantite; } - printf("Article supprimé du panier avec succès.\n"); + int clientIndex = trouver_index_client(numeroClient, numeros, nombreClients); + + printf("Prix total à payer: %.2f euros\n", montantTotal); + printf("Cagnotte totale : %.2f euros\n", cagnottes[clientIndex]); + printf("Volume utilise : %.2f litres\n", volumeTotal); + printf("Volume restant : %.2f litres\n", volumeCoffre - volumeTotal); + printf("Charge Actuelle: %.2f kg\n", poidsTotal); + printf("Charge restante: %.2f kg\n", chargeMaximale - poidsTotal); } /** diff --git a/src/app/interface/interface_client.h b/src/app/interface/interface_client.h index 66985b2..6e15306 100644 --- a/src/app/interface/interface_client.h +++ b/src/app/interface/interface_client.h @@ -60,6 +60,31 @@ void ajouter_article_au_panier(int numeroClient, int references[], float poids[] void supprimer_article_du_panier(int panier[], int quantites[], int *taillePanier, float cagnottes[], int numeroClient, int numeros[], int nombreClients, int references[], float prixUnitaire[]); +/** + * @brief Affiche un récapitulatif du contenu du panier. + * + * Cette fonction permet d'afficher un récapitulatif détaillé du contenu du panier du client, y compris les références des articles, + * les quantités, les poids, les volumes, les prix unitaires, les totaux de poids, de volume, de prix, et la cagnotte du client. + * + * @param panier - Tableau des références des articles dans le panier. + * @param taillePanier - Taille du panier. + * @param references - Tableau des références des articles. + * @param poids - Tableau des poids des articles. + * @param volume - Tableau des volumes des articles. + * @param prixUnitaire - Tableau des prix unitaires des articles. + * @param quantites - Tableau des quantités de chaque article dans le panier. + * @param cagnottes - Tableau des cagnottes des clients. + * @param numeroClient - Numéro du client. + * @param numeros - Tableau des numéros de clients. + * @param nombreClients - Nombre de clients. + * @param volumeCoffre - Volume total du coffre. + * @param chargeMaximale - Charge maximale du coffre. + */ + +void affiche_recap_panier(int panier[], int taillePanier, int references[], float poids[], float volume[], + float prixUnitaire[], int quantites[], float cagnottes[], int numeroClient, + int numeros[], int nombreClients, float volumeCoffre, float chargeMaximale); + /** * @brief Affiche le récapitulatif du panier. * From 9c856425d0beab9110419b374ca59c1a9ee30ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Tue, 31 Oct 2023 19:10:24 +0100 Subject: [PATCH 3/3] fixed reset basket MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- app | Bin 52880 -> 52880 bytes src/app/core_logic/client.c | 6 ++++-- src/app/core_logic/client.h | 2 +- src/app/interface/interface_client.c | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app b/app index e0e5f5cbc0ae7e39dceac6274871cd7596809b66..26acba90bd3f5c2c3ddcde406b9842c224b8ac77 100755 GIT binary patch delta 5504 zcmZu#30PEDvOf3r?Plq21!Ph7MFEi=8f4REQ4|*xC4&n#ZPP+4HlzWAaTJU=ACAUw zraEq;2DkSxnmingLLO!`8b=csj5;x6;=?6RVoXBbsF4ZE)ZNg0Fa5#o`p@~RPF0;c z%kAb}ie~)lb~_wN2tx>IO~VI%4o4oj^8@RWn}2X-f}`$Am~ldmQxref+mt-~WT$7dx7^tP6PhK*stp^u8=# z7(?&L^0rWVTb5^q(Oa_Y7*21BvUfA-3#T{aj^?rSI?65U3{S6uYxFqg9ArfMFlS(1 zw29dZC!zzG7Wg`PtKaL$!Z_W(RS?>$V6TKTq+bXlJ%X+P8so*3A=}rbc^ow(_2J;4 z7f)Y^jb6|e%Ryg^hE3JL^BC_8L9Zc_<|C0s693`}?q>r?O(4+8Xd<=V74IjmC zW*T8eLM~&2w-W-GrSL&Q*r*bu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dnJgFanVE-peN*R3|87R+aJ{XrObGs#(40BiE!ljRtCR2U%~j<6zlqml1eji zNvo_dSFI=RDzd8%Qcii)4?H8VUc^yyr1yD&D^s#6%vQxLk0S@SGekuOHsjZD{TPoH znO@5g8}20)v8_Z;JtqaRbrTXxOctZXRE6HiE~dsp_A;oGq5#HPZzcyAqDdio$xjVQ z&8;r2SVNZP*IF#rigmvPv9_R!{N7Y%POGk}GH+fpqS_#YtR?V#5iB zF_!*3TR-r>L^jAP(@92AEoHS{T0-O=FDx6fLyc2YyTM#$vX+voys(_eVKwIan9$F| z_k>{NH9@YbrAWvZYT{^IS8gL&Do+ zd@x&bAkr1(H4*s>&iS;oo_S2tvwQ!KR$zq<$lwkAnfgR+2kFO{(H z@nKjT*)AonsLt8IA_?ME43SuSBM9+-mnmJ$g^%GhI>gwte z!XPSz4`Z@eNRchiu%Yhe2ESw3srTN$Rq*k~J9`c#zw!m&wB<(eQHfKXx4JL753+p~*D{0mM%3;5?7)FGuP^foKK$OEJ@Ha?)||wk zxdzL!rWJP<%=3C9Bfss*eg9spvHE|bwVa{<8oqWkH0Wk^wdeo78;NJOU3~hv zkH37UGHq4u>iosk6%%~|H-EeO*{>Ef4$tv(GaG@dK nyTOxBjBKC$OnBF#wy5_%X#d^TFY>4U-qyjj-O|0OHmLp|p16td diff --git a/src/app/core_logic/client.c b/src/app/core_logic/client.c index e2ffba0..bfb7e97 100644 --- a/src/app/core_logic/client.c +++ b/src/app/core_logic/client.c @@ -199,9 +199,11 @@ void modifier_quantite_article_panier(int panier[], int quantites[], int *taille * @param quantites - Tableau des quantités de chaque article dans le panier. * @param taillePanier - Taille du panier. */ -void reinitialiser_panier(int panier[], int quantites[], int *taillePanier) { +void reinitialiser_panier(int panier[], int quantites[], int *taillePanier, float cagnottes[], int numeroClient, int numeros[], int nombreClients, int references[], float prixUnitaire[]) { + for (int i = 0; i < *taillePanier; i++) { + supprimer_article(panier, quantites, taillePanier, panier[i], numeroClient, numeros, nombreClients, references, prixUnitaire, cagnottes); + } *taillePanier = 0; - printf("Panier réinitialisé avec succès.\n"); } /** diff --git a/src/app/core_logic/client.h b/src/app/core_logic/client.h index 06a4448..6023f49 100644 --- a/src/app/core_logic/client.h +++ b/src/app/core_logic/client.h @@ -70,7 +70,7 @@ void modifier_quantite_article_panier(int panier[], int quantites[], int *taille * @param quantites - Tableau des quantités de chaque article dans le panier. * @param taillePanier - Taille du panier. */ -void reinitialiser_panier(int panier[], int quantites[], int *taillePanier); +void reinitialiser_panier(int panier[], int quantites[], int *taillePanier, float cagnottes[], int numeroClient, int numeros[], int nombreClients, int references[], float prixUnitaire[]); /** * @brief Déduit un montant de la cagnotte du client. diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index d625b34..6818059 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -358,7 +358,8 @@ void global_client() { modifier_quantite_article_panier(panier, quantites, &taillePanier); break; case 5: - reinitialiser_panier(panier, quantites, &taillePanier); + reinitialiser_panier(panier, quantites, &taillePanier, cagnottes, numeroClient, numeros, nombreClients, references, prixUnitaire); + printf("Le panier a été réinitialisé.\n") break; case 9: printf("Voulez-vous déduire de votre cagnotte avant de quitter ? (1 pour Oui, 0 pour Non) : ");