diff options
author | polo <ordipolo@gmx.fr> | 2025-07-09 00:54:15 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2025-07-09 00:54:15 +0200 |
commit | 010702f67d2560d6435c4e7f39fe7a567aac080b (patch) | |
tree | 159f2abb3633a1e333d187f0c6862ce4ead047c5 | |
parent | 4accca2c57b5f12169afe6a75c74efadd86d835d (diff) | |
download | AppliGestionPHP-010702f67d2560d6435c4e7f39fe7a567aac080b.zip |
mieux comme ça
-rwxr-xr-x | bin/livre_recettes.php | 66 | ||||
-rw-r--r-- | src/model/entities/Facture.php | 8 |
2 files changed, 74 insertions, 0 deletions
diff --git a/bin/livre_recettes.php b/bin/livre_recettes.php new file mode 100755 index 0000000..28c08a1 --- /dev/null +++ b/bin/livre_recettes.php | |||
@@ -0,0 +1,66 @@ | |||
1 | #!/usr/bin/env php | ||
2 | <?php | ||
3 | // bin/livre_recettes.php | ||
4 | // | ||
5 | // pour l'obtenir: | ||
6 | // php bin/livre_recettes.php > bin/livre_recettes.csv | ||
7 | // | ||
8 | // en ouvrant le CSV, choisir le pipe | comme séparateur | ||
9 | |||
10 | |||
11 | // chemins des dossiers et nom de la base | ||
12 | require('src/files.php'); | ||
13 | require('src/Config.php'); // lit le config.ini et gère certaines erreurs (exemple les / aux chemins manquants) | ||
14 | Config::readFile('config/config.ini'); | ||
15 | Config::hydrate(); | ||
16 | |||
17 | // créer les dossiers si nécéssaire | ||
18 | makeFolder(Config::$db_path); | ||
19 | makeFolder(Config::$latex_path); | ||
20 | makeFolder(Config::$pdf_path); | ||
21 | |||
22 | //require 'src/model/doctrine-bootstrap.php'; | ||
23 | require __DIR__ . '/../src/model/doctrine-bootstrap.php'; // chemin absolu | ||
24 | |||
25 | // requête | ||
26 | $date_debut = '2024-01-01'; | ||
27 | $date_fin = '2024-12-31'; | ||
28 | |||
29 | $debut = new DateTime($date_debut, new DateTimeZone('Europe/Paris')); | ||
30 | $fin = new DateTime($date_fin, new DateTimeZone('Europe/Paris'));; | ||
31 | $fin->setTime(23, 59, 59); | ||
32 | |||
33 | $dql = 'SELECT n FROM Prestation n WHERE n.date >= :debut AND n.date <= :fin'; | ||
34 | $bulk_data = $entityManager | ||
35 | ->createQuery($dql) | ||
36 | ->setParameter('debut', $debut->getTimestamp()) | ||
37 | ->setParameter('fin', $fin->getTimestamp()) | ||
38 | ->getResult(); | ||
39 | |||
40 | // affichage | ||
41 | echo "client|date|type|mode paiement|débours|total HT|salaire CESU|code presta\n"; | ||
42 | |||
43 | foreach($bulk_data as $presta){ | ||
44 | if($presta->getTypePresta() !== 'devis'){ | ||
45 | $date = new DateTime()->setTimestamp($presta->getDate()); | ||
46 | |||
47 | echo $presta->getClient()->getPrenomNom() . '|' | ||
48 | . $date->format('d/m/Y') . '|' | ||
49 | . $presta->getTypePresta() . '|' | ||
50 | . $presta->getModePaiement() . '|'; | ||
51 | |||
52 | if($presta->getTypePresta() === 'facture'){ | ||
53 | echo $presta->getFacture()->getTotalPieces() . '|'; | ||
54 | echo $presta->getFacture()->getTotalHT() . '||'; | ||
55 | } | ||
56 | elseif($presta->getTypePresta() === 'cesu'){ | ||
57 | echo '||' . $presta->getCESU()->getSalaire() . '|'; | ||
58 | } | ||
59 | elseif($presta->getTypePresta() === 'location'){ | ||
60 | echo '|' . (string)($presta->getLocation()->getLoyer() * (float)$presta->getLocation()->getLoyersPayes()) . '||'; | ||
61 | } | ||
62 | |||
63 | echo $presta->getCodePresta(); | ||
64 | echo "\n"; | ||
65 | } | ||
66 | } | ||
diff --git a/src/model/entities/Facture.php b/src/model/entities/Facture.php index 75d1a6e..2eea0e5 100644 --- a/src/model/entities/Facture.php +++ b/src/model/entities/Facture.php | |||
@@ -65,6 +65,14 @@ class Facture | |||
65 | { | 65 | { |
66 | return $this->total_main_d_oeuvre; | 66 | return $this->total_main_d_oeuvre; |
67 | } | 67 | } |
68 | public function getTotalPieces(): float | ||
69 | { | ||
70 | return $this->total_pieces; | ||
71 | } | ||
72 | public function getTotalHT(): float | ||
73 | { | ||
74 | return $this->total_HT; | ||
75 | } | ||
68 | 76 | ||
69 | public function getAllWithWindowFields(): array | 77 | public function getAllWithWindowFields(): array |
70 | { | 78 | { |