Bonjour à tous,

Lorsque je veux créer des sections puis des lignes de facture le tableau des sections se remplit bizarrement aussi avec les lignes d' articles et vice-versa, les variables sont pourtant bien distinctes !!

Avez vous une idée de ce qui peut provoquer ça ?

Merci d'avance pour vos réponses

Voici le code des différentes méthodes :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
public static void creerSection(String[] tabSections, String varSection,
			String varSectionEnCours, String[] tabArticles,
			double[][] tabLignes, int varIndiceSection) {
 
				Terminal.ecrireString("  ==> " + "\t"
				+ "Veuillez rentrer le titre de la nouvelle section : ");
		varSection = Terminal.lireString();
		remplirTab1Dim(tabSections, varSection);
		varSectionEnCours = varSection;
 
		poursuivreCreation(tabArticles, varSectionEnCours, tabLignes,
				varSection, tabSections, varIndiceSection,varSection);
	}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
public static void creerLigne(String[] tabArticles, double[][] tabLignes,
			String varArticle, String varSectionEnCours, String[] tabSections,
			int varIndiceSection, String varSection) {
 
		// Recherche du numero d'indice de la section en cours
 
 
 
		// Creation de ligne
 
		double varPrix = 0;
		double varQuantite = 0;
 
		if (varSectionEnCours == null) {
			Terminal.ecrireString("\t"
					+ "==>   AVERTISSEMENT: Avant de creer une ligne vous devez au préalable avoir créé ou sélectionné une section.");
			poursuivreCreation(tabArticles, varSectionEnCours, tabLignes,
					varArticle, tabSections, varIndiceSection, varSection);
		} else {
 
			varIndiceSection=0;
			for (int i = 0; i < tabSections.length; i++) {
				if (tabSections[i] == varSectionEnCours) {
					varIndiceSection = (i + 1);
					break;
				}
			}
 
			// Affichage demande de donnees utilisateurs et section en cours
 
			Terminal.sautDeLigne();
			Terminal.ecrireStringln("\t"
					+ "Création d'une nouvelle ligne de devis / facture dans la section :"
					+ " ==> [" + varIndiceSection + " " + varSectionEnCours
					+ "] <== ");
			Terminal.sautDeLigne();
			Terminal.ecrireString("  Veuillez rentrer une description d'article : ");
			varArticle = Terminal.lireString();
			Terminal.ecrireString("  Veuillez spécifier la quantité : ");
			varQuantite = Terminal.lireDouble();
			Terminal.ecrireString("  Veuillez spécifier le prix de cet article : ");
			varPrix = Terminal.lireDouble();
 
			// Remplissage des tableaux
 
			remplirTab1Dim(tabArticles, varArticle);
			remplirTab2Dim(tabLignes, varQuantite, varPrix);
 
			// Demande à l'utilisateur s'il veut creer une autre
			// ligne à la suite de l'actuelle
 
			poursuivreCreation(tabArticles, varSectionEnCours, tabLignes,
					varArticle, tabSections, varIndiceSection,varSection);
		}
	}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
public static void remplirTab1Dim(String[] t, String varValeur) {
 
			for (int i = 0; i < t.length; i++)
			if (t[i] == null) {
				t[i] = varValeur;
				break;
			}
	}