blob: 28c08a12241e60668e9a4673272c3df8b4de9664 (
plain)
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
|
#!/usr/bin/env php
<?php
// bin/livre_recettes.php
//
// pour l'obtenir:
// php bin/livre_recettes.php > bin/livre_recettes.csv
//
// en ouvrant le CSV, choisir le pipe | comme séparateur
// chemins des dossiers et nom de la base
require('src/files.php');
require('src/Config.php'); // lit le config.ini et gère certaines erreurs (exemple les / aux chemins manquants)
Config::readFile('config/config.ini');
Config::hydrate();
// créer les dossiers si nécéssaire
makeFolder(Config::$db_path);
makeFolder(Config::$latex_path);
makeFolder(Config::$pdf_path);
//require 'src/model/doctrine-bootstrap.php';
require __DIR__ . '/../src/model/doctrine-bootstrap.php'; // chemin absolu
// requête
$date_debut = '2024-01-01';
$date_fin = '2024-12-31';
$debut = new DateTime($date_debut, new DateTimeZone('Europe/Paris'));
$fin = new DateTime($date_fin, new DateTimeZone('Europe/Paris'));;
$fin->setTime(23, 59, 59);
$dql = 'SELECT n FROM Prestation n WHERE n.date >= :debut AND n.date <= :fin';
$bulk_data = $entityManager
->createQuery($dql)
->setParameter('debut', $debut->getTimestamp())
->setParameter('fin', $fin->getTimestamp())
->getResult();
// affichage
echo "client|date|type|mode paiement|débours|total HT|salaire CESU|code presta\n";
foreach($bulk_data as $presta){
if($presta->getTypePresta() !== 'devis'){
$date = new DateTime()->setTimestamp($presta->getDate());
echo $presta->getClient()->getPrenomNom() . '|'
. $date->format('d/m/Y') . '|'
. $presta->getTypePresta() . '|'
. $presta->getModePaiement() . '|';
if($presta->getTypePresta() === 'facture'){
echo $presta->getFacture()->getTotalPieces() . '|';
echo $presta->getFacture()->getTotalHT() . '||';
}
elseif($presta->getTypePresta() === 'cesu'){
echo '||' . $presta->getCESU()->getSalaire() . '|';
}
elseif($presta->getTypePresta() === 'location'){
echo '|' . (string)($presta->getLocation()->getLoyer() * (float)$presta->getLocation()->getLoyersPayes()) . '||';
}
echo $presta->getCodePresta();
echo "\n";
}
}
|