diff options
Diffstat (limited to 'src/model/DevisFactures.php')
-rw-r--r-- | src/model/DevisFactures.php | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/model/DevisFactures.php b/src/model/DevisFactures.php index 259690b..7c31f13 100644 --- a/src/model/DevisFactures.php +++ b/src/model/DevisFactures.php | |||
@@ -17,6 +17,7 @@ class DevisFactures extends Model | |||
17 | protected $pieces; | 17 | protected $pieces; |
18 | protected $total_pieces; | 18 | protected $total_pieces; |
19 | protected $deplacement; | 19 | protected $deplacement; |
20 | protected $prix_devis; | ||
20 | protected $total_HT; | 21 | protected $total_HT; |
21 | protected $delai_livraison; | 22 | protected $delai_livraison; |
22 | protected $validite_devis; | 23 | protected $validite_devis; |
@@ -26,6 +27,7 @@ class DevisFactures extends Model | |||
26 | { | 27 | { |
27 | $this->table = $table; // deux tables séparées devis et factures | 28 | $this->table = $table; // deux tables séparées devis et factures |
28 | } | 29 | } |
30 | |||
29 | public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) | 31 | public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) |
30 | { | 32 | { |
31 | $taches = ["Tâches:" => $this->taches]; | 33 | $taches = ["Tâches:" => $this->taches]; |
@@ -60,7 +62,8 @@ class DevisFactures extends Model | |||
60 | return []; | 62 | return []; |
61 | } | 63 | } |
62 | } | 64 | } |
63 | public function set(string $entry, string $input) | 65 | |
66 | public function set(string $entry, string $input) // trouve la bonne méthode | ||
64 | { | 67 | { |
65 | switch($entry) | 68 | switch($entry) |
66 | { | 69 | { |
@@ -91,6 +94,9 @@ class DevisFactures extends Model | |||
91 | case "Déplacement:": | 94 | case "Déplacement:": |
92 | $this->setDeplacement($input); | 95 | $this->setDeplacement($input); |
93 | break; | 96 | break; |
97 | case "Prix du devis:": | ||
98 | $this->setPrixDevis($input); | ||
99 | break; | ||
94 | case "Total HT:": | 100 | case "Total HT:": |
95 | $this->setTotalHT($input); | 101 | $this->setTotalHT($input); |
96 | break; | 102 | break; |
@@ -142,11 +148,6 @@ class DevisFactures extends Model | |||
142 | $this->cles_licences = $value; | 148 | $this->cles_licences = $value; |
143 | return($this); | 149 | return($this); |
144 | } | 150 | } |
145 | //~ public function setTemps(string $value) | ||
146 | //~ { | ||
147 | //~ $this->temps = $value; | ||
148 | //~ return($this); | ||
149 | //~ } | ||
150 | public function setTotalMainDOeuvre($value) | 151 | public function setTotalMainDOeuvre($value) |
151 | { | 152 | { |
152 | $value = str_replace(',', '.', $value); | 153 | $value = str_replace(',', '.', $value); |
@@ -176,6 +177,12 @@ class DevisFactures extends Model | |||
176 | $this->total_HT = (float) $value; | 177 | $this->total_HT = (float) $value; |
177 | return($this); | 178 | return($this); |
178 | } | 179 | } |
180 | public function setPrixDevis($value) | ||
181 | { | ||
182 | $value = str_replace(',', '.', $value); | ||
183 | $this->prix_devis = (float) $value; | ||
184 | return($this); | ||
185 | } | ||
179 | public function setDelaiLivraison(string $value) | 186 | public function setDelaiLivraison(string $value) |
180 | { | 187 | { |
181 | $this->delai_livraison = $value; | 188 | $this->delai_livraison = $value; |
@@ -192,6 +199,19 @@ class DevisFactures extends Model | |||
192 | return($this); | 199 | return($this); |
193 | } | 200 | } |
194 | 201 | ||
202 | // création d'une facture à partir d'un devis | ||
203 | public function hydrateReceiptWithQuotation($ReceiptDetails) | ||
204 | { | ||
205 | $ReceiptDetails->hydrate([ | ||
206 | 'taches' => $this->taches, | ||
207 | 'total_main_d_oeuvre' => $this->total_main_d_oeuvre, | ||
208 | 'pieces' => $this->pieces, | ||
209 | 'total_pieces' => $this->total_pieces, | ||
210 | 'deplacement' => $this->deplacement, | ||
211 | 'total_HT' => $this->total_HT | ||
212 | ]); | ||
213 | } | ||
214 | |||
195 | //~ public function newRow(array $input) | 215 | //~ public function newRow(array $input) |
196 | //~ { | 216 | //~ { |
197 | //~ if($this->table === 'devis') // comme la table 'factures' avec deux champs en plus | 217 | //~ if($this->table === 'devis') // comme la table 'factures' avec deux champs en plus |