Passed
Push — MODEL_LIB_240928 ( 143dd3...d1103d )
by Rafael
57:04 queued 21s
created

Contratdet   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 89
c 2
b 0
f 0
dl 0
loc 104
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A product() 0 3 1
A c_unit() 0 3 1
A contrat() 0 3 1
1
<?php
2
3
/* Copyright (C) 2024       Rafael San José         <[email protected]>
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
namespace Dolibarr\Code\Contrat\Model;
20
21
use Carbon\Carbon;
22
use Dolibarr\Code\Product\Model\Product;
23
use Dolibarr\Core\Base\Model;
24
use Dolibarr\Core\Model\CUnit;
25
26
/**
27
 * Class Contratdet
28
 *
29
 * @property int $rowid
30
 * @property Carbon|null $tms
31
 * @property int $fk_contrat
32
 * @property int|null $fk_product
33
 * @property int|null $statut
34
 * @property string|null $label
35
 * @property string|null $description
36
 * @property int|null $fk_remise_except
37
 * @property Carbon|null $date_commande
38
 * @property Carbon|null $date_ouverture_prevue
39
 * @property Carbon|null $date_ouverture
40
 * @property Carbon|null $date_fin_validite
41
 * @property Carbon|null $date_cloture
42
 * @property string|null $vat_src_code
43
 * @property float|null $tva_tx
44
 * @property float|null $localtax1_tx
45
 * @property string|null $localtax1_type
46
 * @property float|null $localtax2_tx
47
 * @property string|null $localtax2_type
48
 * @property float $qty
49
 * @property float|null $remise_percent
50
 * @property float|null $subprice
51
 * @property float|null $price_ht
52
 * @property float|null $remise
53
 * @property float|null $total_ht
54
 * @property float|null $total_tva
55
 * @property float|null $total_localtax1
56
 * @property float|null $total_localtax2
57
 * @property float|null $total_ttc
58
 * @property int|null $product_type
59
 * @property int|null $info_bits
60
 * @property int|null $rang
61
 * @property float|null $buy_price_ht
62
 * @property int|null $fk_product_fournisseur_price
63
 * @property int $fk_user_author
64
 * @property int|null $fk_user_ouverture
65
 * @property int|null $fk_user_cloture
66
 * @property string|null $commentaire
67
 * @property int|null $fk_unit
68
 * @property int|null $fk_multicurrency
69
 * @property string|null $multicurrency_code
70
 * @property float|null $multicurrency_subprice
71
 * @property float|null $multicurrency_total_ht
72
 * @property float|null $multicurrency_total_tva
73
 * @property float|null $multicurrency_total_ttc
74
 *
75
 * @property Contrat $contrat
76
 * @property Product|null $product
77
 * @property CUnit|null $c_unit
78
 */
79
class Contratdet extends Model
80
{
81
    public $timestamps = false;
82
    protected $table = 'contratdet';
83
    protected $casts = [
84
        'tms' => 'datetime',
85
        'fk_contrat' => 'int',
86
        'fk_product' => 'int',
87
        'statut' => 'int',
88
        'fk_remise_except' => 'int',
89
        'date_commande' => 'datetime',
90
        'date_ouverture_prevue' => 'datetime',
91
        'date_ouverture' => 'datetime',
92
        'date_fin_validite' => 'datetime',
93
        'date_cloture' => 'datetime',
94
        'tva_tx' => 'float',
95
        'localtax1_tx' => 'float',
96
        'localtax2_tx' => 'float',
97
        'qty' => 'float',
98
        'remise_percent' => 'float',
99
        'subprice' => 'float',
100
        'price_ht' => 'float',
101
        'remise' => 'float',
102
        'total_ht' => 'float',
103
        'total_tva' => 'float',
104
        'total_localtax1' => 'float',
105
        'total_localtax2' => 'float',
106
        'total_ttc' => 'float',
107
        'product_type' => 'int',
108
        'info_bits' => 'int',
109
        'rang' => 'int',
110
        'buy_price_ht' => 'float',
111
        'fk_product_fournisseur_price' => 'int',
112
        'fk_user_author' => 'int',
113
        'fk_user_ouverture' => 'int',
114
        'fk_user_cloture' => 'int',
115
        'fk_unit' => 'int',
116
        'fk_multicurrency' => 'int',
117
        'multicurrency_subprice' => 'float',
118
        'multicurrency_total_ht' => 'float',
119
        'multicurrency_total_tva' => 'float',
120
        'multicurrency_total_ttc' => 'float'
121
    ];
122
123
    protected $fillable = [
124
        'tms',
125
        'fk_contrat',
126
        'fk_product',
127
        'statut',
128
        'label',
129
        'description',
130
        'fk_remise_except',
131
        'date_commande',
132
        'date_ouverture_prevue',
133
        'date_ouverture',
134
        'date_fin_validite',
135
        'date_cloture',
136
        'vat_src_code',
137
        'tva_tx',
138
        'localtax1_tx',
139
        'localtax1_type',
140
        'localtax2_tx',
141
        'localtax2_type',
142
        'qty',
143
        'remise_percent',
144
        'subprice',
145
        'price_ht',
146
        'remise',
147
        'total_ht',
148
        'total_tva',
149
        'total_localtax1',
150
        'total_localtax2',
151
        'total_ttc',
152
        'product_type',
153
        'info_bits',
154
        'rang',
155
        'buy_price_ht',
156
        'fk_product_fournisseur_price',
157
        'fk_user_author',
158
        'fk_user_ouverture',
159
        'fk_user_cloture',
160
        'commentaire',
161
        'fk_unit',
162
        'fk_multicurrency',
163
        'multicurrency_code',
164
        'multicurrency_subprice',
165
        'multicurrency_total_ht',
166
        'multicurrency_total_tva',
167
        'multicurrency_total_ttc'
168
    ];
169
170
    public function contrat()
171
    {
172
        return $this->belongsTo(Contrat::class, 'fk_contrat');
173
    }
174
175
    public function product()
176
    {
177
        return $this->belongsTo(Product::class, 'fk_product');
178
    }
179
180
    public function c_unit()
181
    {
182
        return $this->belongsTo(CUnit::class, 'fk_unit');
183
    }
184
}
185