diff options
| author | polo <ordipolo@gmx.fr> | 2026-10-18 22:48:47 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-10-18 22:48:47 +0200 |
| commit | d76eace8bdc50e208d9754ff50acb58525887048 (patch) | |
| tree | 856e1def2a51587b264415a5a50fd7c61f6a53c7 | |
| parent | 983384a9be62eb694a8e1cf640685973c2a23ec2 (diff) | |
| download | AppliGestionPHP-d76eace8bdc50e208d9754ff50acb58525887048.tar.gz AppliGestionPHP-d76eace8bdc50e208d9754ff50acb58525887048.tar.bz2 AppliGestionPHP-d76eace8bdc50e208d9754ff50acb58525887048.zip | |
oublis MAJ fichiers dans bin
| -rwxr-xr-x | bin/doctrine | 8 | ||||
| -rwxr-xr-x | bin/livre_recettes.php | 52 |
2 files changed, 30 insertions, 30 deletions
diff --git a/bin/doctrine b/bin/doctrine index 40ff4e5..50d5b78 100755 --- a/bin/doctrine +++ b/bin/doctrine | |||
| @@ -4,15 +4,15 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | // chemins des dossiers et nom de la base | 6 | // chemins des dossiers et nom de la base |
| 7 | require('src/files.php'); | 7 | require('src/File.php'); |
| 8 | require('src/Config.php'); // lit le config.ini et gère certaines erreurs (exemple les / aux chemins manquants) | 8 | require('src/Config.php'); // lit le config.ini et gère certaines erreurs (exemple les / aux chemins manquants) |
| 9 | Config::readFile('config/config.ini'); | 9 | Config::readFile('config/config.ini'); |
| 10 | Config::hydrate(); | 10 | Config::hydrate(); |
| 11 | 11 | ||
| 12 | // créer les dossiers si nécéssaire | 12 | // créer les dossiers si nécéssaire |
| 13 | makeFolder(Config::$db_path); | 13 | File::makeFolder(Config::$db_path); |
| 14 | makeFolder(Config::$latex_path); | 14 | File::makeFolder(Config::$latex_path); |
| 15 | makeFolder(Config::$pdf_path); | 15 | File::makeFolder(Config::$pdf_path); |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | use Doctrine\ORM\Tools\Console\ConsoleRunner; | 18 | use Doctrine\ORM\Tools\Console\ConsoleRunner; |
diff --git a/bin/livre_recettes.php b/bin/livre_recettes.php index 54418a4..656aef6 100755 --- a/bin/livre_recettes.php +++ b/bin/livre_recettes.php | |||
| @@ -2,14 +2,17 @@ | |||
| 2 | <?php | 2 | <?php |
| 3 | // bin/livre_recettes.php | 3 | // bin/livre_recettes.php |
| 4 | // | 4 | // |
| 5 | // pour l'obtenir: | 5 | // commande pour l'obtenir (aucun paramètre = année en cours): |
| 6 | // php bin/livre_recettes.php > bin/livre_recettes.csv | 6 | // php bin/livre_recettes.php |
| 7 | // php bin/livre_recettes.php 2026 | ||
| 8 | // php bin/livre_recettes.php 2024 2025 2026 | ||
| 7 | // | 9 | // |
| 10 | // fichier CSV créé dans data/livre_recettes_année.csv | ||
| 8 | // en ouvrant le CSV, choisir le pipe | comme séparateur | 11 | // en ouvrant le CSV, choisir le pipe | comme séparateur |
| 9 | 12 | ||
| 10 | 13 | ||
| 11 | // chemins des dossiers et nom de la base | 14 | // chemins des dossiers et nom de la base |
| 12 | require('src/files.php'); | 15 | require('src/File.php'); |
| 13 | 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) |
| 14 | Config::readFile('config/config.ini'); | 17 | Config::readFile('config/config.ini'); |
| 15 | Config::hydrate(); | 18 | Config::hydrate(); |
| @@ -50,18 +53,18 @@ catch(Exception $e){ | |||
| 50 | 53 | ||
| 51 | // requête | 54 | // requête |
| 52 | foreach($years as $year){ | 55 | foreach($years as $year){ |
| 53 | $date_debut = $year . '-01-01'; | 56 | /*$date_debut = $year . '-01-01'; |
| 54 | $date_fin = $year . '-12-31'; | 57 | $date_fin = $year . '-12-31'; |
| 55 | 58 | ||
| 56 | $debut = new DateTime($date_debut, new DateTimeZone('Europe/Paris')); | 59 | $debut = new DateTime($date_debut, new DateTimeZone('Europe/Paris')); |
| 57 | $fin = new DateTime($date_fin, new DateTimeZone('Europe/Paris'));; | 60 | $fin = new DateTime($date_fin, new DateTimeZone('Europe/Paris'));; |
| 58 | $fin->setTime(23, 59, 59); | 61 | $fin->setTime(23, 59, 59);*/ |
| 59 | 62 | ||
| 60 | $dql = 'SELECT n FROM Prestation n WHERE n.date >= :debut AND n.date <= :fin'; | 63 | $dql = 'SELECT n FROM Prestation n WHERE n.date >= :debut AND n.date <= :fin'; |
| 61 | $bulk_data = $entityManager | 64 | $bulk_data = $entityManager |
| 62 | ->createQuery($dql) | 65 | ->createQuery($dql) |
| 63 | ->setParameter('debut', $debut->getTimestamp()) | 66 | ->setParameter('debut', $year . '-01-01') |
| 64 | ->setParameter('fin', $fin->getTimestamp()) | 67 | ->setParameter('fin', $year . '-12-31') |
| 65 | ->getResult(); | 68 | ->getResult(); |
| 66 | 69 | ||
| 67 | // affichage | 70 | // affichage |
| @@ -69,25 +72,22 @@ foreach($years as $year){ | |||
| 69 | 72 | ||
| 70 | foreach($bulk_data as $presta){ | 73 | foreach($bulk_data as $presta){ |
| 71 | if($presta->getTypePresta() !== 'devis' && $presta->getTypePresta() !== 'non_vendue'){ | 74 | if($presta->getTypePresta() !== 'devis' && $presta->getTypePresta() !== 'non_vendue'){ |
| 72 | $date = new DateTime()->setTimestamp($presta->getDate()); | 75 | $result .= $presta->getClient()->getPrenomNom() . '|' |
| 73 | 76 | . $presta->getDate() . '|' | |
| 74 | $result .= $presta->getClient()->getPrenomNom() . '|' | 77 | . $presta->getTypePresta() . '|' |
| 75 | . $date->format('d/m/Y') . '|' | 78 | . $presta->getModePaiement() . '|'; |
| 76 | . $presta->getTypePresta() . '|' | 79 | |
| 77 | . $presta->getModePaiement() . '|'; | 80 | if($presta->getTypePresta() === 'facture'){ |
| 78 | 81 | $result .= $presta->getFacture()->getTotalPieces() . '|'; | |
| 79 | if($presta->getTypePresta() === 'facture'){ | 82 | $result .= $presta->getFacture()->getTotalHT() . '||'; |
| 80 | $result .= $presta->getFacture()->getTotalPieces() . '|'; | 83 | } |
| 81 | $result .= $presta->getFacture()->getTotalHT() . '||'; | 84 | elseif($presta->getTypePresta() === 'cesu'){ |
| 82 | } | 85 | $result .= '||' . $presta->getCESU()->getSalaire() . '|'; |
| 83 | elseif($presta->getTypePresta() === 'cesu'){ | 86 | } |
| 84 | $result .= '||' . $presta->getCESU()->getSalaire() . '|'; | 87 | elseif($presta->getTypePresta() === 'location'){ |
| 85 | } | 88 | $result .= '|' . (string)($presta->getLocation()->getLoyer() * (float)$presta->getLocation()->getLoyersPayes()) . '||'; |
| 86 | elseif($presta->getTypePresta() === 'location'){ | 89 | } |
| 87 | $result .= '|' . (string)($presta->getLocation()->getLoyer() * (float)$presta->getLocation()->getLoyersPayes()) . '||'; | 90 | $result .= $presta->getCodePresta() . "\n"; |
| 88 | } | ||
| 89 | |||
| 90 | $result .= $presta->getCodePresta() . "\n"; | ||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | file_put_contents('data/livre_recettes_' . $year . '.csv', $result); // sortie fichier | 93 | file_put_contents('data/livre_recettes_' . $year . '.csv', $result); // sortie fichier |
