diff options
Diffstat (limited to 'src/model/DevisFactures.php')
| -rw-r--r-- | src/model/DevisFactures.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/model/DevisFactures.php b/src/model/DevisFactures.php index c9b7d18..5769842 100644 --- a/src/model/DevisFactures.php +++ b/src/model/DevisFactures.php | |||
| @@ -22,12 +22,42 @@ class DevisFactures extends Model | |||
| 22 | protected $validite_devis; | 22 | protected $validite_devis; |
| 23 | protected $signature_devis; | 23 | protected $signature_devis; |
| 24 | 24 | ||
| 25 | //~ use ModelChildren; | ||
| 26 | |||
| 27 | public function __construct(string $table) | 25 | public function __construct(string $table) |
| 28 | { | 26 | { |
| 29 | $this->table = $table; // deux tables séparées devis et factures | 27 | $this->table = $table; // deux tables séparées devis et factures |
| 30 | } | 28 | } |
| 29 | public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) | ||
| 30 | { | ||
| 31 | $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, | ||
| 38 | "Pièces" => $this->pieces, | ||
| 39 | "Total des pièces" => $this->total_pieces, | ||
| 40 | "Déplacement" => $this->deplacement, | ||
| 41 | "Total HT" => $this->total_HT]; | ||
| 42 | |||
| 43 | if($this->table === 'factures') | ||
| 44 | { | ||
| 45 | return ["Numéro facture:" => $this->ID] + $champs_communs; | ||
| 46 | } | ||
| 47 | elseif($this->table === 'devis') | ||
| 48 | { | ||
| 49 | $champs_devis = [ | ||
| 50 | "Delai de livraison" => $this->delai_livraison, | ||
| 51 | "Durée de validité" => $this->validite_devis, | ||
| 52 | "Devis signé?" => $this->signature_devis]; | ||
| 53 | |||
| 54 | return ["Numéro devis:" => $this->ID] + $champs_communs + $champs_devis; | ||
| 55 | } | ||
| 56 | else | ||
| 57 | { | ||
| 58 | return []; | ||
| 59 | } | ||
| 60 | } | ||
| 31 | 61 | ||
| 32 | // setters | 62 | // setters |
| 33 | public function setIDPresta(int $value) | 63 | public function setIDPresta(int $value) |
