diff options
Diffstat (limited to 'php/Latex.php')
-rw-r--r-- | php/Latex.php | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/php/Latex.php b/php/Latex.php new file mode 100644 index 0000000..e8ed763 --- /dev/null +++ b/php/Latex.php | |||
@@ -0,0 +1,84 @@ | |||
1 | <?php | ||
2 | // php/Latex.php | ||
3 | // | ||
4 | // génération du code LaTeX | ||
5 | |||
6 | abstract class Latex | ||
7 | { | ||
8 | protected $fileName = ''; | ||
9 | protected $latexPath = ''; | ||
10 | protected $pdfPath = ''; | ||
11 | |||
12 | protected function createFile(string $latex, string $fileName, string $latexPath) | ||
13 | { | ||
14 | // nom du fichier créé = nom.tex | ||
15 | // pour les devis, factures et enveloppes, le nom est le code la prestation | ||
16 | // pour les livre de recettes et registres des achats mensuels: | ||
17 | // le nom du fichier suit cet exemple: "Recettes-2022-06-Juin.tex" | ||
18 | // pour le livre de recette ou le registre des achats annuel, même principe: "Achats-2022.tex" | ||
19 | // pour le bilan comptable annuel, ça donne: "Bilan-2022.tex" | ||
20 | $fichier = fopen($latexPath . $fileName, "w+"); | ||
21 | fputs($fichier, $latex); | ||
22 | fclose($fichier); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | |||
27 | abstract class PrestaLatex extends Latex | ||
28 | { | ||
29 | public function __construct(string $quoi, , string $codePresta) | ||
30 | { | ||
31 | nameTheFile($quoi, $codePresta); | ||
32 | } | ||
33 | |||
34 | // forme = code-presta.tex | ||
35 | protected function nameTheFile(string $quoi, string $codePresta) | ||
36 | { | ||
37 | $this->fileName = $quoi . '-' . $codePresta . '.tex'; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | class DevisLatex extends PrestaLatex | ||
42 | {} | ||
43 | |||
44 | class FactureLatex extends PrestaLatex | ||
45 | {} | ||
46 | |||
47 | class LocationLatex extends PrestaLatex | ||
48 | {} | ||
49 | |||
50 | class EnveloppeRectoLatex extends PrestaLatex | ||
51 | {} | ||
52 | class EnveloppeVersoLatex extends PrestaLatex | ||
53 | {} | ||
54 | |||
55 | |||
56 | abstract class ComptaLatex extends Latex | ||
57 | { | ||
58 | public function __construct(string $quoi, , string $annee, int $numeroMois = 0) | ||
59 | { | ||
60 | nameTheFile($quoi, $annee, $numeroMois); | ||
61 | } | ||
62 | |||
63 | // forme = Recettes-2022-06-Juin.tex ou Recettes-2022.tex | ||
64 | // type de 'annee'? | ||
65 | protected function nameTheFile(string $quoi, string $annee, int $numeroMois = 0) | ||
66 | { | ||
67 | $this->fileName = $quoi . '-' . $annee; | ||
68 | $mois = ['', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre']; | ||
69 | if($numeroMois > 0 && $numeroMois <= 12) | ||
70 | { | ||
71 | $this->fileName .= '-' . $numeroMois . '-' . $mois[$numeroMois]; | ||
72 | } | ||
73 | $this->fileName .= '.tex'; | ||
74 | } | ||
75 | } | ||
76 | |||
77 | class LivreRecettesLatex extends ComptaLatex | ||
78 | {} | ||
79 | |||
80 | class RegistreAchatsLatex extends ComptaLatex | ||
81 | {} | ||
82 | |||
83 | class BilanLatex extends ComptaLatex | ||
84 | {} | ||