summaryrefslogtreecommitdiff
path: root/src/model/DevisFactures.php
blob: 1ed3a5c8394147b072b89a344d4efcbc02da3817 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
// model/DevisFactures.php

class DevisFactures extends Model
{
    // lecture des données ou hydratation
    private $ID_devis_facture; // auto-incrémentée
    private $ID_presta = 0;
    private $validite_devis;
    private $signature_devis;
    private $taches;
    private $machine;
    private $OS;
    private $donnees;
    private $cles_licences;
    private $total_main_d_oeuvre;
    private $pieces;
    private $total_pieces;
    private $deplacement;
    private $total_HT;
    
    //~ use ModelChildren;
    
    public function __construct(int $ID_presta)
    {
        $this->table = 'devisfactures';
        $this->ID_presta = $ID_presta;
    }
    
    // setters
    public function setIDDevisFacture(int $value = 0)
    {
        if($value === 0)
        {
            $this->ID_devis_facture = $this->db->lastInsertId(); // méthode de PDO
        }
        else
        {
            $this->ID_devis_facture = $value;
        }
        return($this);
    }
    public function setIDPresta(int $value)
    {
        $this->ID_presta = $value;
        return($this);
    }
    public function setValiditeDdevis(string $value)
    {
        $this->validite_devis = $value;
        return($this);
    }
    public function setSignatureDevis(string $value)
    {
        $this->signature_devis = $value;
        return($this);
    }
    public function setTaches(string $value)
    {
        $this->taches = $value;
        return($this);
    }
    public function setMachine(string $value)
    {
        $this->machine = $value;
        return($this);
    }
    public function setOS(string $value)
    {
        $this->OS = $value;
        return($this);
    }
    public function setDonnees(string $value)
    {
        $this->donnees = $value;
        return($this);
    }
    public function setClesLicences(string $value)
    {
        $this->cles_licences = $value;
        return($this);
    }
    public function setTotalMainDOeuvre(float $value)
    {
        $this->total_main_d_oeuvre = $value;
        return($this);
    }
    public function setPieces(string $value)
    {
        $this->pieces = $value;
        return($this);
    }
    public function setTotalPieces(float $value)
    {
        $this->total_pieces = $value;
        return($this);
    }
    public function setDeplacement(float $value)
    {
        $this->deplacement = $value;
        return($this);
    }
    public function setTotalHT(float $value)
    {
        $this->total_HT = $value;
        return($this);
    }
    
    public function newRow(array $input, array $quotations_input = [])
    {
        if(!empty($quotations_input)) // cas d'un devis
        {
            $this->hydrate(['validite_devis' => $quotations_input[0], 'signature_devis' => $quotations_input[1]]);
        }
        $this->hydrate([]);
    }
}