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\FactureFournisseur\Model; |
20
|
|
|
|
21
|
|
|
use Carbon\Carbon; |
22
|
|
|
use Dolibarr\Code\Projet\Model\Projet; |
23
|
|
|
use Dolibarr\Code\Societe\Model\Societe; |
24
|
|
|
use Dolibarr\Code\Societe\Model\SocieteRemiseExcept; |
25
|
|
|
use Dolibarr\Code\UserGroup\Model\User; |
26
|
|
|
use Dolibarr\Core\Base\Model; |
27
|
|
|
use Illuminate\Database\Eloquent\Collection; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class FactureFourn |
31
|
|
|
* |
32
|
|
|
* @property int $rowid |
33
|
|
|
* @property string $ref |
34
|
|
|
* @property string $ref_supplier |
35
|
|
|
* @property int $entity |
36
|
|
|
* @property string|null $ref_ext |
37
|
|
|
* @property int $type |
38
|
|
|
* @property int|null $subtype |
39
|
|
|
* @property int $fk_soc |
40
|
|
|
* @property Carbon|null $datec |
41
|
|
|
* @property Carbon|null $datef |
42
|
|
|
* @property Carbon|null $date_pointoftax |
43
|
|
|
* @property Carbon|null $date_valid |
44
|
|
|
* @property Carbon|null $tms |
45
|
|
|
* @property Carbon|null $date_closing |
46
|
|
|
* @property string|null $libelle |
47
|
|
|
* @property int $paye |
48
|
|
|
* @property float $amount |
49
|
|
|
* @property float|null $remise |
50
|
|
|
* @property string|null $close_code |
51
|
|
|
* @property float|null $close_missing_amount |
52
|
|
|
* @property string|null $close_note |
53
|
|
|
* @property int|null $vat_reverse_charge |
54
|
|
|
* @property float|null $tva |
55
|
|
|
* @property float|null $total_tva |
56
|
|
|
* @property float|null $localtax1 |
57
|
|
|
* @property float|null $localtax2 |
58
|
|
|
* @property float|null $revenuestamp |
59
|
|
|
* @property float|null $total_ht |
60
|
|
|
* @property float|null $total_ttc |
61
|
|
|
* @property int $fk_statut |
62
|
|
|
* @property int|null $fk_user_author |
63
|
|
|
* @property int|null $fk_user_modif |
64
|
|
|
* @property int|null $fk_user_valid |
65
|
|
|
* @property int|null $fk_user_closing |
66
|
|
|
* @property int|null $fk_fac_rec_source |
67
|
|
|
* @property int|null $fk_facture_source |
68
|
|
|
* @property int|null $fk_projet |
69
|
|
|
* @property int|null $fk_account |
70
|
|
|
* @property int|null $fk_cond_reglement |
71
|
|
|
* @property int|null $fk_mode_reglement |
72
|
|
|
* @property Carbon|null $date_lim_reglement |
73
|
|
|
* @property string|null $note_private |
74
|
|
|
* @property string|null $note_public |
75
|
|
|
* @property int|null $fk_incoterms |
76
|
|
|
* @property string|null $location_incoterms |
77
|
|
|
* @property int|null $fk_transport_mode |
78
|
|
|
* @property string|null $model_pdf |
79
|
|
|
* @property string|null $last_main_doc |
80
|
|
|
* @property string|null $import_key |
81
|
|
|
* @property string|null $extraparams |
82
|
|
|
* @property int|null $fk_multicurrency |
83
|
|
|
* @property string|null $multicurrency_code |
84
|
|
|
* @property float|null $multicurrency_tx |
85
|
|
|
* @property float|null $multicurrency_total_ht |
86
|
|
|
* @property float|null $multicurrency_total_tva |
87
|
|
|
* @property float|null $multicurrency_total_ttc |
88
|
|
|
* |
89
|
|
|
* @property Projet|null $projet |
90
|
|
|
* @property Societe $societe |
91
|
|
|
* @property User|null $user |
92
|
|
|
* @property Collection|FactureFournDet[] $facture_fourn_dets |
93
|
|
|
* @property Collection|SocieteRemiseExcept[] $societe_remise_excepts |
94
|
|
|
*/ |
95
|
|
|
class FactureFourn extends Model |
96
|
|
|
{ |
97
|
|
|
public $timestamps = false; |
98
|
|
|
protected $table = 'facture_fourn'; |
99
|
|
|
protected $casts = [ |
100
|
|
|
'entity' => 'int', |
101
|
|
|
'type' => 'int', |
102
|
|
|
'subtype' => 'int', |
103
|
|
|
'fk_soc' => 'int', |
104
|
|
|
'datec' => 'datetime', |
105
|
|
|
'datef' => 'datetime', |
106
|
|
|
'date_pointoftax' => 'datetime', |
107
|
|
|
'date_valid' => 'datetime', |
108
|
|
|
'tms' => 'datetime', |
109
|
|
|
'date_closing' => 'datetime', |
110
|
|
|
'paye' => 'int', |
111
|
|
|
'amount' => 'float', |
112
|
|
|
'remise' => 'float', |
113
|
|
|
'close_missing_amount' => 'float', |
114
|
|
|
'vat_reverse_charge' => 'int', |
115
|
|
|
'tva' => 'float', |
116
|
|
|
'total_tva' => 'float', |
117
|
|
|
'localtax1' => 'float', |
118
|
|
|
'localtax2' => 'float', |
119
|
|
|
'revenuestamp' => 'float', |
120
|
|
|
'total_ht' => 'float', |
121
|
|
|
'total_ttc' => 'float', |
122
|
|
|
'fk_statut' => 'int', |
123
|
|
|
'fk_user_author' => 'int', |
124
|
|
|
'fk_user_modif' => 'int', |
125
|
|
|
'fk_user_valid' => 'int', |
126
|
|
|
'fk_user_closing' => 'int', |
127
|
|
|
'fk_fac_rec_source' => 'int', |
128
|
|
|
'fk_facture_source' => 'int', |
129
|
|
|
'fk_projet' => 'int', |
130
|
|
|
'fk_account' => 'int', |
131
|
|
|
'fk_cond_reglement' => 'int', |
132
|
|
|
'fk_mode_reglement' => 'int', |
133
|
|
|
'date_lim_reglement' => 'datetime', |
134
|
|
|
'fk_incoterms' => 'int', |
135
|
|
|
'fk_transport_mode' => 'int', |
136
|
|
|
'fk_multicurrency' => 'int', |
137
|
|
|
'multicurrency_tx' => 'float', |
138
|
|
|
'multicurrency_total_ht' => 'float', |
139
|
|
|
'multicurrency_total_tva' => 'float', |
140
|
|
|
'multicurrency_total_ttc' => 'float' |
141
|
|
|
]; |
142
|
|
|
|
143
|
|
|
protected $fillable = [ |
144
|
|
|
'ref', |
145
|
|
|
'ref_supplier', |
146
|
|
|
'entity', |
147
|
|
|
'ref_ext', |
148
|
|
|
'type', |
149
|
|
|
'subtype', |
150
|
|
|
'fk_soc', |
151
|
|
|
'datec', |
152
|
|
|
'datef', |
153
|
|
|
'date_pointoftax', |
154
|
|
|
'date_valid', |
155
|
|
|
'tms', |
156
|
|
|
'date_closing', |
157
|
|
|
'libelle', |
158
|
|
|
'paye', |
159
|
|
|
'amount', |
160
|
|
|
'remise', |
161
|
|
|
'close_code', |
162
|
|
|
'close_missing_amount', |
163
|
|
|
'close_note', |
164
|
|
|
'vat_reverse_charge', |
165
|
|
|
'tva', |
166
|
|
|
'total_tva', |
167
|
|
|
'localtax1', |
168
|
|
|
'localtax2', |
169
|
|
|
'revenuestamp', |
170
|
|
|
'total_ht', |
171
|
|
|
'total_ttc', |
172
|
|
|
'fk_statut', |
173
|
|
|
'fk_user_author', |
174
|
|
|
'fk_user_modif', |
175
|
|
|
'fk_user_valid', |
176
|
|
|
'fk_user_closing', |
177
|
|
|
'fk_fac_rec_source', |
178
|
|
|
'fk_facture_source', |
179
|
|
|
'fk_projet', |
180
|
|
|
'fk_account', |
181
|
|
|
'fk_cond_reglement', |
182
|
|
|
'fk_mode_reglement', |
183
|
|
|
'date_lim_reglement', |
184
|
|
|
'note_private', |
185
|
|
|
'note_public', |
186
|
|
|
'fk_incoterms', |
187
|
|
|
'location_incoterms', |
188
|
|
|
'fk_transport_mode', |
189
|
|
|
'model_pdf', |
190
|
|
|
'last_main_doc', |
191
|
|
|
'import_key', |
192
|
|
|
'extraparams', |
193
|
|
|
'fk_multicurrency', |
194
|
|
|
'multicurrency_code', |
195
|
|
|
'multicurrency_tx', |
196
|
|
|
'multicurrency_total_ht', |
197
|
|
|
'multicurrency_total_tva', |
198
|
|
|
'multicurrency_total_ttc' |
199
|
|
|
]; |
200
|
|
|
|
201
|
|
|
public function projet() |
202
|
|
|
{ |
203
|
|
|
return $this->belongsTo(Projet::class, 'fk_projet'); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
public function societe() |
207
|
|
|
{ |
208
|
|
|
return $this->belongsTo(Societe::class, 'fk_soc'); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
public function user() |
212
|
|
|
{ |
213
|
|
|
return $this->belongsTo(User::class, 'fk_user_valid'); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
public function facture_fourn_dets() |
217
|
|
|
{ |
218
|
|
|
return $this->hasMany(FactureFournDet::class, 'fk_facture_fourn'); |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
public function societe_remise_excepts() |
222
|
|
|
{ |
223
|
|
|
return $this->hasMany(SocieteRemiseExcept::class, 'fk_invoice_supplier'); |
224
|
|
|
} |
225
|
|
|
} |
226
|
|
|
|