|
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\Compta\Model; |
|
20
|
|
|
|
|
21
|
|
|
use Carbon\Carbon; |
|
22
|
|
|
use Dolibarr\Code\Societe\Model\SocieteRemiseExcept; |
|
23
|
|
|
use Dolibarr\Core\Base\Model; |
|
24
|
|
|
use Dolibarr\Core\Model\CUnit; |
|
25
|
|
|
use Illuminate\Database\Eloquent\Collection; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class Facturedet |
|
29
|
|
|
* |
|
30
|
|
|
* @property int $rowid |
|
31
|
|
|
* @property int $fk_facture |
|
32
|
|
|
* @property int|null $fk_parent_line |
|
33
|
|
|
* @property int|null $fk_product |
|
34
|
|
|
* @property string|null $label |
|
35
|
|
|
* @property string|null $description |
|
36
|
|
|
* @property string|null $vat_src_code |
|
37
|
|
|
* @property float|null $tva_tx |
|
38
|
|
|
* @property float|null $localtax1_tx |
|
39
|
|
|
* @property string|null $localtax1_type |
|
40
|
|
|
* @property float|null $localtax2_tx |
|
41
|
|
|
* @property string|null $localtax2_type |
|
42
|
|
|
* @property float|null $qty |
|
43
|
|
|
* @property float|null $remise_percent |
|
44
|
|
|
* @property float|null $remise |
|
45
|
|
|
* @property int|null $fk_remise_except |
|
46
|
|
|
* @property float|null $subprice |
|
47
|
|
|
* @property float|null $price |
|
48
|
|
|
* @property float|null $total_ht |
|
49
|
|
|
* @property float|null $total_tva |
|
50
|
|
|
* @property float|null $total_localtax1 |
|
51
|
|
|
* @property float|null $total_localtax2 |
|
52
|
|
|
* @property float|null $total_ttc |
|
53
|
|
|
* @property int|null $product_type |
|
54
|
|
|
* @property Carbon|null $date_start |
|
55
|
|
|
* @property Carbon|null $date_end |
|
56
|
|
|
* @property int|null $info_bits |
|
57
|
|
|
* @property float|null $buy_price_ht |
|
58
|
|
|
* @property int|null $fk_product_fournisseur_price |
|
59
|
|
|
* @property string|null $batch |
|
60
|
|
|
* @property int|null $fk_warehouse |
|
61
|
|
|
* @property int|null $special_code |
|
62
|
|
|
* @property int|null $rang |
|
63
|
|
|
* @property int|null $fk_contract_line |
|
64
|
|
|
* @property int|null $fk_unit |
|
65
|
|
|
* @property string|null $import_key |
|
66
|
|
|
* @property int $fk_code_ventilation |
|
67
|
|
|
* @property float|null $situation_percent |
|
68
|
|
|
* @property int|null $fk_prev_id |
|
69
|
|
|
* @property int|null $fk_user_author |
|
70
|
|
|
* @property int|null $fk_user_modif |
|
71
|
|
|
* @property int|null $fk_multicurrency |
|
72
|
|
|
* @property string|null $multicurrency_code |
|
73
|
|
|
* @property float|null $multicurrency_subprice |
|
74
|
|
|
* @property float|null $multicurrency_total_ht |
|
75
|
|
|
* @property float|null $multicurrency_total_tva |
|
76
|
|
|
* @property float|null $multicurrency_total_ttc |
|
77
|
|
|
* @property string|null $ref_ext |
|
78
|
|
|
* |
|
79
|
|
|
* @property Facture $facture |
|
80
|
|
|
* @property CUnit|null $c_unit |
|
81
|
|
|
* @property Collection|SocieteRemiseExcept[] $societe_remise_excepts |
|
82
|
|
|
*/ |
|
83
|
|
|
class Facturedet extends Model |
|
84
|
|
|
{ |
|
85
|
|
|
public $timestamps = false; |
|
86
|
|
|
protected $table = 'facturedet'; |
|
87
|
|
|
protected $casts = [ |
|
88
|
|
|
'fk_facture' => 'int', |
|
89
|
|
|
'fk_parent_line' => 'int', |
|
90
|
|
|
'fk_product' => 'int', |
|
91
|
|
|
'tva_tx' => 'float', |
|
92
|
|
|
'localtax1_tx' => 'float', |
|
93
|
|
|
'localtax2_tx' => 'float', |
|
94
|
|
|
'qty' => 'float', |
|
95
|
|
|
'remise_percent' => 'float', |
|
96
|
|
|
'remise' => 'float', |
|
97
|
|
|
'fk_remise_except' => 'int', |
|
98
|
|
|
'subprice' => 'float', |
|
99
|
|
|
'price' => 'float', |
|
100
|
|
|
'total_ht' => 'float', |
|
101
|
|
|
'total_tva' => 'float', |
|
102
|
|
|
'total_localtax1' => 'float', |
|
103
|
|
|
'total_localtax2' => 'float', |
|
104
|
|
|
'total_ttc' => 'float', |
|
105
|
|
|
'product_type' => 'int', |
|
106
|
|
|
'date_start' => 'datetime', |
|
107
|
|
|
'date_end' => 'datetime', |
|
108
|
|
|
'info_bits' => 'int', |
|
109
|
|
|
'buy_price_ht' => 'float', |
|
110
|
|
|
'fk_product_fournisseur_price' => 'int', |
|
111
|
|
|
'fk_warehouse' => 'int', |
|
112
|
|
|
'special_code' => 'int', |
|
113
|
|
|
'rang' => 'int', |
|
114
|
|
|
'fk_contract_line' => 'int', |
|
115
|
|
|
'fk_unit' => 'int', |
|
116
|
|
|
'fk_code_ventilation' => 'int', |
|
117
|
|
|
'situation_percent' => 'float', |
|
118
|
|
|
'fk_prev_id' => 'int', |
|
119
|
|
|
'fk_user_author' => 'int', |
|
120
|
|
|
'fk_user_modif' => 'int', |
|
121
|
|
|
'fk_multicurrency' => 'int', |
|
122
|
|
|
'multicurrency_subprice' => 'float', |
|
123
|
|
|
'multicurrency_total_ht' => 'float', |
|
124
|
|
|
'multicurrency_total_tva' => 'float', |
|
125
|
|
|
'multicurrency_total_ttc' => 'float' |
|
126
|
|
|
]; |
|
127
|
|
|
|
|
128
|
|
|
protected $fillable = [ |
|
129
|
|
|
'fk_facture', |
|
130
|
|
|
'fk_parent_line', |
|
131
|
|
|
'fk_product', |
|
132
|
|
|
'label', |
|
133
|
|
|
'description', |
|
134
|
|
|
'vat_src_code', |
|
135
|
|
|
'tva_tx', |
|
136
|
|
|
'localtax1_tx', |
|
137
|
|
|
'localtax1_type', |
|
138
|
|
|
'localtax2_tx', |
|
139
|
|
|
'localtax2_type', |
|
140
|
|
|
'qty', |
|
141
|
|
|
'remise_percent', |
|
142
|
|
|
'remise', |
|
143
|
|
|
'fk_remise_except', |
|
144
|
|
|
'subprice', |
|
145
|
|
|
'price', |
|
146
|
|
|
'total_ht', |
|
147
|
|
|
'total_tva', |
|
148
|
|
|
'total_localtax1', |
|
149
|
|
|
'total_localtax2', |
|
150
|
|
|
'total_ttc', |
|
151
|
|
|
'product_type', |
|
152
|
|
|
'date_start', |
|
153
|
|
|
'date_end', |
|
154
|
|
|
'info_bits', |
|
155
|
|
|
'buy_price_ht', |
|
156
|
|
|
'fk_product_fournisseur_price', |
|
157
|
|
|
'batch', |
|
158
|
|
|
'fk_warehouse', |
|
159
|
|
|
'special_code', |
|
160
|
|
|
'rang', |
|
161
|
|
|
'fk_contract_line', |
|
162
|
|
|
'fk_unit', |
|
163
|
|
|
'import_key', |
|
164
|
|
|
'fk_code_ventilation', |
|
165
|
|
|
'situation_percent', |
|
166
|
|
|
'fk_prev_id', |
|
167
|
|
|
'fk_user_author', |
|
168
|
|
|
'fk_user_modif', |
|
169
|
|
|
'fk_multicurrency', |
|
170
|
|
|
'multicurrency_code', |
|
171
|
|
|
'multicurrency_subprice', |
|
172
|
|
|
'multicurrency_total_ht', |
|
173
|
|
|
'multicurrency_total_tva', |
|
174
|
|
|
'multicurrency_total_ttc', |
|
175
|
|
|
'ref_ext' |
|
176
|
|
|
]; |
|
177
|
|
|
|
|
178
|
|
|
public function facture() |
|
179
|
|
|
{ |
|
180
|
|
|
return $this->belongsTo(Facture::class, 'fk_facture'); |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
public function c_unit() |
|
184
|
|
|
{ |
|
185
|
|
|
return $this->belongsTo(CUnit::class, 'fk_unit'); |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
public function societe_remise_excepts() |
|
189
|
|
|
{ |
|
190
|
|
|
return $this->hasMany(SocieteRemiseExcept::class, 'fk_facture_line'); |
|
191
|
|
|
} |
|
192
|
|
|
} |
|
193
|
|
|
|