You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.8 KiB
58 lines
1.8 KiB
#include "fonctionsCommande.h"
|
|
#include "fonctionsArticle.h"
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
int ajoutPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], int n)
|
|
{
|
|
int refP,code,quantite;
|
|
printf("Saisir la référence du produit à ajouter au panier: ");
|
|
scanf("%d",&refP);
|
|
|
|
code = posRef(Tref,refP,n);
|
|
while (code == -1)
|
|
{
|
|
printf("Erreur ; Cette référence n'existe pas dans la base de donnée; retapez : ");
|
|
scanf("%d",&refP);
|
|
code = posRef(Tref,refP,n);
|
|
}
|
|
|
|
printf("Saisir la quantité souhaité pour le produit: ");
|
|
scanf("%d",&quantite);
|
|
while (quantite < 1)
|
|
{
|
|
printf("Erreur ; La quantité peut seulement être positive; retapez : ");
|
|
scanf("%d",&quantite);
|
|
}
|
|
printf("\nRéférence : %d\n",refP);
|
|
printf("Quantité : %d\n",quantite);
|
|
TrefC[nArticle] = refP;
|
|
TquanC[nArticle] = quantite;
|
|
return nArticle +=1;
|
|
}
|
|
|
|
void affichPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], float Tpoid[],float Tvolume[],float Tprix[],int n)
|
|
{
|
|
printf("\nRéf\tQté\tPoids\tVol\tPrixU\tPoidsTot\tVolTot\tPrixTot\tCagnotte\n");
|
|
int i, pos,cagnotte;
|
|
float prixtot;
|
|
int cfinal=0;
|
|
float prixfinal=0,volfinal=0,chargefinal=0;
|
|
for (i=0;i <nArticle;i++)
|
|
{
|
|
pos = posRef(Tref,TrefC[i],n);
|
|
prixtot=Tprix[pos]*TquanC[i];
|
|
cagnotte=prixtot*0.1;
|
|
prixfinal+=prixtot;
|
|
cfinal+=cagnotte;
|
|
volfinal+=Tvolume[pos];
|
|
chargefinal+=Tpoid[pos];
|
|
printf("%d\t%d\t%.3f\t%.2f\t%.2f\t%.3f\t%.2f\t%.2f\t%d\n",TrefC[i],TquanC[i],Tpoid[pos],Tvolume[pos],Tprix[pos],Tprix[pos]*TquanC[i],Tvolume[pos]*TquanC[i],prixtot,cagnotte);
|
|
}
|
|
printf("\n\t\t\t\t\t\tPrix total à payer:\t%.2f\n",prixfinal);
|
|
printf("\t\t\t\t\t\tCagnotte totale:\t%d\n",cfinal);
|
|
printf("Volume utilisé: %.2f\n",volfinal);
|
|
printf("Volume restant: %.2f\n",volfinal);
|
|
printf("Charge Actuelle: %.2f\n",chargefinal);
|
|
printf("Charge restante: %.2f\n",chargefinal);
|
|
} |