This repository was archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFacture.java
More file actions
132 lines (89 loc) · 3.44 KB
/
Facture.java
File metadata and controls
132 lines (89 loc) · 3.44 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
public class Facture {
protected Double montantTotalJournee = 0.0;
protected ArrayList<TicketResume> listeTickets = new ArrayList<TicketResume>();
protected int nbFactureDemandee = 1;
public void setNouveauTicket(int numTable, int numCommande, Double montant) {
TicketResume newTicket = new TicketResume(numTable, numCommande, montant);
listeTickets.add(newTicket);
}
public void incrNbFactureDemandee() {
nbFactureDemandee++;
}
public void affichageMenuStatsTickets() {
String texte = "\n\n# Statistiques journée\n\n";
texte += "Nb tables servies aujourd'hui " + listeTickets.size() + "\n\n";
for(int i = 0; i < listeTickets.size(); i++) {
texte += "- Table numero " + listeTickets.get(i).numTable + " - Commande numéro " + listeTickets.get(i).numCommande + "\n\t=> ";
texte += listeTickets.get(i).montantPaye + " euros\n";
montantTotalJournee += listeTickets.get(i).montantPaye;
}
texte += "\nTotal percu ce jour : " + montantTotalJournee;
if (montantTotalJournee >= 2) {
texte += " euros";
}
else {
texte += " euro";
}
System.out.print(texte);
System.out.println("\n");
}
public void editionFichier(int numJour) {
Charset charset = Charset.forName ("windows-1252");
String nomFichier = "Jour" + numJour + "\\Facture journaliere" + nbFactureDemandee;
nbFactureDemandee++;
String texte = "# Statistiques journee\n\n";
texte += "Nb tables servies aujourd'hui " + listeTickets.size() + "\n";
for(int i = 0; i < listeTickets.size(); i++) {
texte += "Table numero " + listeTickets.get(i).numTable + " - Commande numero " + listeTickets.get(i).numCommande + "\n";
texte += listeTickets.get(i).montantPaye + " euros\n\n";
montantTotalJournee += listeTickets.get(i).montantPaye;
}
texte += "\n\nTotal percu ce jour : " + montantTotalJournee;
if (montantTotalJournee >= 2) {
texte += " euros";
}
else {
texte += " euro";
}
try (BufferedWriter writer = Files.newBufferedWriter(Path.of(nomFichier), charset)) {
writer.write(texte);
System.out.println("Facture éditée avec succès");
}
catch (IOException x) {
System.err.format("IOException : %s%n", x);
}
}
// protected int listeAdditions[];
// // protected ArrayList<Integer> Additions = new ArrayList<Integer>();
// // protected ArrayList<Addition> Additions = new ArrayList<Addition>();
// protected Addition[] tabAdditions = new Addition[15];
// protected double sommeJournee;
// protected int nombreTables;
// public Facture() {
// this.sommeJournee = 0;
// this.nombreTables = 0;
// videTabAdditions;
// }
// public void videTabAdditions() {
// for (int i = 0; i < 15; i++) {
// tabAdditions[i].initAdditions();
// }
// }
// public void newAddition(int numTable, double montant) {
// Addition currentAddition = new Addition(numTable, montant);
// Additions.add(currentAddition);
// this.nombreTables += 1;
// }
// public void ajoutElementAddition(int numTable, int montant) {
// }
}