diff options
| author | polo <ordipolo@gmx.fr> | 2026-10-21 16:18:35 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-10-21 16:18:35 +0200 |
| commit | 26fbb91d0047e901afffbc6e21e7767d546fec9b (patch) | |
| tree | 5712b2b60d4d5dce9931b21578c4ba55cf231504 /bin | |
| parent | 30b3819db6742a1851ca8af8b9763cbd17bffeca (diff) | |
| download | AppliGestionPHP-polo1.tar.gz AppliGestionPHP-polo1.tar.bz2 AppliGestionPHP-polo1.zip | |
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/livre_recettes.php | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/bin/livre_recettes.php b/bin/livre_recettes.php index 85e3265..859725e 100755 --- a/bin/livre_recettes.php +++ b/bin/livre_recettes.php | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | // chemins des dossiers et nom de la base | 14 | // chemins des dossiers et nom de la base |
| 15 | require('src/File.php'); | 15 | require('src/File.php'); |
| 16 | require('src/Config.php'); // lit le config.ini et gère certaines erreurs (exemple les / aux chemins manquants) | 16 | require('src/Config.php'); // lit le config.ini et gère certaines erreurs (exemple les / aux chemins manquants) |
| 17 | require('src/functions.php'); | ||
| 17 | Config::readFile('config/config.ini'); | 18 | Config::readFile('config/config.ini'); |
| 18 | Config::hydrate(); | 19 | Config::hydrate(); |
| 19 | 20 | ||
| @@ -50,46 +51,5 @@ catch(Exception $e){ | |||
| 50 | die; | 51 | die; |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | 54 | // fichiers et sortie console | |
| 54 | // requête | 55 | makeRecipeBook($entityManager, $years); \ No newline at end of file |
| 55 | foreach($years as $year){ | ||
| 56 | /*$date_debut = $year . '-01-01'; | ||
| 57 | $date_fin = $year . '-12-31'; | ||
| 58 | |||
| 59 | $debut = new DateTime($date_debut, new DateTimeZone('Europe/Paris')); | ||
| 60 | $fin = new DateTime($date_fin, new DateTimeZone('Europe/Paris'));; | ||
| 61 | $fin->setTime(23, 59, 59);*/ | ||
| 62 | |||
| 63 | $dql = 'SELECT n FROM Prestation n WHERE n.date >= :debut AND n.date <= :fin'; | ||
| 64 | $bulk_data = $entityManager | ||
| 65 | ->createQuery($dql) | ||
| 66 | ->setParameter('debut', $year . '-01-01') | ||
| 67 | ->setParameter('fin', $year . '-12-31') | ||
| 68 | ->getResult(); | ||
| 69 | |||
| 70 | // affichage | ||
| 71 | $result = "client|date|type|mode paiement|débours|total HT|salaire CESU|code presta\n"; | ||
| 72 | |||
| 73 | foreach($bulk_data as $presta){ | ||
| 74 | if($presta->getTypePresta() !== 'devis' && $presta->getTypePresta() !== 'non_vendue'){ | ||
| 75 | $result .= $presta->getClient()->getPrenomNom() . '|' | ||
| 76 | . $presta->getDate() . '|' | ||
| 77 | . $presta->getTypePresta() . '|' | ||
| 78 | . $presta->getModePaiement() . '|'; | ||
| 79 | |||
| 80 | if($presta->getTypePresta() === 'facture'){ | ||
| 81 | $result .= $presta->getTotalPieces() . '|'; | ||
| 82 | $result .= $presta->getTotalHT() . '||'; | ||
| 83 | } | ||
| 84 | elseif($presta->getTypePresta() === 'cesu'){ | ||
| 85 | $result .= '||' . $presta->getSalaire() . '|'; | ||
| 86 | } | ||
| 87 | elseif($presta->getTypePresta() === 'location'){ | ||
| 88 | $result .= '|' . (string)($presta->getLoyer() * (float)$presta->getLoyersPayes()) . '||'; | ||
| 89 | } | ||
| 90 | $result .= $presta->getCodePresta() . "\n"; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | file_put_contents('data/livre_recettes_' . $year . '.csv', $result); // sortie fichier | ||
| 94 | echo $result . "\n"; // sortie console | ||
| 95 | } | ||
