diff options
author | polo <ordipolo@gmx.fr> | 2023-09-01 12:00:23 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2023-09-01 12:00:23 +0200 |
commit | 45f1b99a1060ee43deb6055faef1f8b16b5d80a2 (patch) | |
tree | 2be0c73b839b220433280daaf29d41644ecd4851 /src/model | |
parent | 6f4cc3afffde36a13618458ffda72e6104624f36 (diff) | |
download | AppliGestionPHP-45f1b99a1060ee43deb6055faef1f8b16b5d80a2.zip |
section 3 bientôt terminée
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/Clients.php | 2 | ||||
-rw-r--r-- | src/model/DevisFactures.php | 66 | ||||
-rw-r--r-- | src/model/Prestations.php | 54 |
3 files changed, 109 insertions, 13 deletions
diff --git a/src/model/Clients.php b/src/model/Clients.php index 6a4dcf5..524070a 100644 --- a/src/model/Clients.php +++ b/src/model/Clients.php | |||
@@ -42,7 +42,7 @@ class Clients extends Model | |||
42 | "À propos:" => $this->apropos, | 42 | "À propos:" => $this->apropos, |
43 | "Client ou Prospect?" => $this->type]; | 43 | "Client ou Prospect?" => $this->type]; |
44 | } | 44 | } |
45 | public function getSetterAndSet(string $entry, string $input) | 45 | public function set(string $entry, string $input) |
46 | { | 46 | { |
47 | switch($entry) | 47 | switch($entry) |
48 | { | 48 | { |
diff --git a/src/model/DevisFactures.php b/src/model/DevisFactures.php index 5769842..2a5bf8d 100644 --- a/src/model/DevisFactures.php +++ b/src/model/DevisFactures.php | |||
@@ -28,12 +28,8 @@ class DevisFactures extends Model | |||
28 | } | 28 | } |
29 | public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) | 29 | public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) |
30 | { | 30 | { |
31 | $taches = ["Tâches:" => $this->taches]; | ||
31 | $champs_communs = [ | 32 | $champs_communs = [ |
32 | "Tâches:" => $this->taches, | ||
33 | "PC:" => $this->machine, | ||
34 | "OS:" => $this->OS, | ||
35 | "Données:" => $this->donnees, | ||
36 | "Clés de licences:" => $this->cles_licences, | ||
37 | "Total Main d'oeuvre:" => $this->total_main_d_oeuvre, | 33 | "Total Main d'oeuvre:" => $this->total_main_d_oeuvre, |
38 | "Pièces" => $this->pieces, | 34 | "Pièces" => $this->pieces, |
39 | "Total des pièces" => $this->total_pieces, | 35 | "Total des pièces" => $this->total_pieces, |
@@ -42,7 +38,13 @@ class DevisFactures extends Model | |||
42 | 38 | ||
43 | if($this->table === 'factures') | 39 | if($this->table === 'factures') |
44 | { | 40 | { |
45 | return ["Numéro facture:" => $this->ID] + $champs_communs; | 41 | $champs_facture = [ |
42 | "PC:" => $this->machine, | ||
43 | "OS:" => $this->OS, | ||
44 | "Données:" => $this->donnees, | ||
45 | "Clés de licences:" => $this->cles_licences]; | ||
46 | |||
47 | return $taches + $champs_facture + $champs_communs; | ||
46 | } | 48 | } |
47 | elseif($this->table === 'devis') | 49 | elseif($this->table === 'devis') |
48 | { | 50 | { |
@@ -51,15 +53,65 @@ class DevisFactures extends Model | |||
51 | "Durée de validité" => $this->validite_devis, | 53 | "Durée de validité" => $this->validite_devis, |
52 | "Devis signé?" => $this->signature_devis]; | 54 | "Devis signé?" => $this->signature_devis]; |
53 | 55 | ||
54 | return ["Numéro devis:" => $this->ID] + $champs_communs + $champs_devis; | 56 | return $champs_communs + $champs_devis; |
55 | } | 57 | } |
56 | else | 58 | else |
57 | { | 59 | { |
58 | return []; | 60 | return []; |
59 | } | 61 | } |
60 | } | 62 | } |
63 | public function set(string $entry, string $input) | ||
64 | { | ||
65 | switch($entry) | ||
66 | { | ||
67 | case "Tâches:": | ||
68 | $this->setTaches($input); | ||
69 | break; | ||
70 | case "PC:": | ||
71 | $this->setMachine($input); | ||
72 | break; | ||
73 | case "OS:": | ||
74 | $this->setOS($input); | ||
75 | break; | ||
76 | case "Données:": | ||
77 | $this->setDonnees($input); | ||
78 | break; | ||
79 | case "Clés de licences:": | ||
80 | $this->setClesLicences($input); | ||
81 | break; | ||
82 | case "Total Main d'oeuvre:": | ||
83 | $this->setTotalMainDOeuvre($input); | ||
84 | break; | ||
85 | case "Pièces:": | ||
86 | $this->setPieces($input); | ||
87 | break; | ||
88 | case "Total des pièces:": | ||
89 | $this->setTotalPieces($input); | ||
90 | break; | ||
91 | case "Déplacement:": | ||
92 | $this->setDeplacement($input); | ||
93 | break; | ||
94 | case "Total HT:": | ||
95 | $this->setTotalHT($input); | ||
96 | break; | ||
97 | case "Delai de livraison:": | ||
98 | $this->setDelaiLivraison($input); | ||
99 | break; | ||
100 | case "Durée de validité:": | ||
101 | $this->setValiditedevis($input); | ||
102 | break; | ||
103 | case "Devis signé?:": | ||
104 | $this->setSignatureDevis($input); | ||
105 | break; | ||
106 | } | ||
107 | } | ||
61 | 108 | ||
62 | // setters | 109 | // setters |
110 | //~ public function setID(int $value = 0) | ||
111 | //~ { | ||
112 | //~ $this->ID = $value; | ||
113 | //~ return($this); | ||
114 | //~ } | ||
63 | public function setIDPresta(int $value) | 115 | public function setIDPresta(int $value) |
64 | { | 116 | { |
65 | $this->ID_presta = $value; | 117 | $this->ID_presta = $value; |
diff --git a/src/model/Prestations.php b/src/model/Prestations.php index fe09133..e9ba7a1 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php | |||
@@ -11,6 +11,7 @@ class Prestations extends Model | |||
11 | protected $type_presta = ''; | 11 | protected $type_presta = ''; |
12 | protected $mode_paiement = ''; | 12 | protected $mode_paiement = ''; |
13 | protected $commentaires = ''; | 13 | protected $commentaires = ''; |
14 | //protected $numero_presta = 0; | ||
14 | 15 | ||
15 | public function __construct(int $ID_client) | 16 | public function __construct(int $ID_client) |
16 | { | 17 | { |
@@ -57,14 +58,33 @@ class Prestations extends Model | |||
57 | return [ | 58 | return [ |
58 | "Numéro prestation:" => end($code_presta_tableau), // dernière case | 59 | "Numéro prestation:" => end($code_presta_tableau), // dernière case |
59 | "Date:" => $Date->getDate(), | 60 | "Date:" => $Date->getDate(), |
60 | "Type de Presta:" => $this->type_presta, | 61 | //"Type de Presta:" => $this->type_presta, // choix impossible pour le moment |
61 | "Mode de paiement:" => $this->mode_paiement, | 62 | "Mode de paiement:" => $this->mode_paiement, |
62 | "Commentaires:" => $this->commentaires]; | 63 | "Commentaires:" => $this->commentaires]; |
63 | } | 64 | } |
65 | public function set(string $entry, string $input) | ||
66 | { | ||
67 | switch($entry) | ||
68 | { | ||
69 | case "Numéro prestation:": | ||
70 | $this->setNumeroPresta($input); | ||
71 | break; | ||
72 | //~ case "Date:": // inutile, setDate() est appelé directement après choix fenêtre calendrier | ||
73 | //~ $this->setDate($input); | ||
74 | //~ break; | ||
75 | //~ case "Type de Presta:": // choix impossible pour le moment | ||
76 | //~ $this->setTypePresta($input); | ||
77 | //~ break; | ||
78 | case "Mode de paiement:": | ||
79 | $this->setModePaiement($input); | ||
80 | break; | ||
81 | case "Commentaires:": | ||
82 | $this->setCommentaires($input); | ||
83 | break; | ||
84 | } | ||
85 | } | ||
64 | 86 | ||
65 | // setters | 87 | // setters |
66 | //~ public function setID() -> dans le trait ModelChildren | ||
67 | |||
68 | public function setIDClient(int $value) | 88 | public function setIDClient(int $value) |
69 | { | 89 | { |
70 | $this->ID_client = $value; | 90 | $this->ID_client = $value; |
@@ -80,9 +100,20 @@ class Prestations extends Model | |||
80 | $this->code_presta = $value; | 100 | $this->code_presta = $value; |
81 | return $this; | 101 | return $this; |
82 | } | 102 | } |
83 | public function setDate(int $value) | 103 | public function setDate($value, bool $set_code_presta = false) // attend un timestamp |
84 | { | 104 | { |
85 | $this->date = $value; | 105 | $this->date = (int) $value; |
106 | |||
107 | if($set_code_presta) | ||
108 | { | ||
109 | $code_presta_tableau = explode('-', $this->code_presta); | ||
110 | $Date = new Dates($value); | ||
111 | $code_presta_tableau[0] = $Date->getYear(); | ||
112 | $code_presta_tableau[1] = $Date->getMonth(); | ||
113 | $code_presta_tableau[2] = $Date->getDay(); | ||
114 | $this->code_presta = implode('-', $code_presta_tableau); | ||
115 | } | ||
116 | |||
86 | return $this; | 117 | return $this; |
87 | } | 118 | } |
88 | public function setTypePresta(string $value) | 119 | public function setTypePresta(string $value) |
@@ -100,6 +131,14 @@ class Prestations extends Model | |||
100 | $this->commentaires = $value; | 131 | $this->commentaires = $value; |
101 | return $this; | 132 | return $this; |
102 | } | 133 | } |
134 | public function setNumeroPresta($value) | ||
135 | { | ||
136 | // modifier le code presta, on pourrait aussi utiliser une regex | ||
137 | $code_presta_tableau = explode('-', $this->code_presta); | ||
138 | $code_presta_tableau[count($code_presta_tableau) - 1] = (int) $value; | ||
139 | $this->code_presta = implode('-', $code_presta_tableau); | ||
140 | return $this; | ||
141 | } | ||
103 | 142 | ||
104 | // code client = année-mois-jour-codeclient-typedepresta-combientièmefois | 143 | // code client = année-mois-jour-codeclient-typedepresta-combientièmefois |
105 | public function makeCodePresta(Dates $Date, string $code_client) | 144 | public function makeCodePresta(Dates $Date, string $code_client) |
@@ -112,3 +151,8 @@ class Prestations extends Model | |||
112 | $this->code_presta = implode('-', $array_code); | 151 | $this->code_presta = implode('-', $array_code); |
113 | } | 152 | } |
114 | } | 153 | } |
154 | |||
155 | class CodePresta extends Prestations | ||
156 | { | ||
157 | protected $numero_presta; | ||
158 | } | ||