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\Fourn\Model; |
20
|
|
|
|
21
|
|
|
use Carbon\Carbon; |
22
|
|
|
use Dolibarr\Code\Societe\Model\Societe; |
23
|
|
|
use Dolibarr\Core\Base\Model; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class CommandeFournisseur |
27
|
|
|
* |
28
|
|
|
* @property int $rowid |
29
|
|
|
* @property string $ref |
30
|
|
|
* @property int $entity |
31
|
|
|
* @property string|null $ref_ext |
32
|
|
|
* @property string|null $ref_supplier |
33
|
|
|
* @property int $fk_soc |
34
|
|
|
* @property int|null $fk_projet |
35
|
|
|
* @property Carbon|null $tms |
36
|
|
|
* @property Carbon|null $date_creation |
37
|
|
|
* @property Carbon|null $date_valid |
38
|
|
|
* @property Carbon|null $date_approve |
39
|
|
|
* @property Carbon|null $date_approve2 |
40
|
|
|
* @property Carbon|null $date_commande |
41
|
|
|
* @property int|null $fk_user_author |
42
|
|
|
* @property int|null $fk_user_modif |
43
|
|
|
* @property int|null $fk_user_valid |
44
|
|
|
* @property int|null $fk_user_approve |
45
|
|
|
* @property int|null $fk_user_approve2 |
46
|
|
|
* @property int $source |
47
|
|
|
* @property int|null $fk_statut |
48
|
|
|
* @property int|null $billed |
49
|
|
|
* @property float|null $amount_ht |
50
|
|
|
* @property float|null $remise_percent |
51
|
|
|
* @property float|null $remise |
52
|
|
|
* @property float|null $total_tva |
53
|
|
|
* @property float|null $localtax1 |
54
|
|
|
* @property float|null $localtax2 |
55
|
|
|
* @property float|null $total_ht |
56
|
|
|
* @property float|null $total_ttc |
57
|
|
|
* @property string|null $note_private |
58
|
|
|
* @property string|null $note_public |
59
|
|
|
* @property string|null $model_pdf |
60
|
|
|
* @property string|null $last_main_doc |
61
|
|
|
* @property Carbon|null $date_livraison |
62
|
|
|
* @property int|null $fk_account |
63
|
|
|
* @property int|null $fk_cond_reglement |
64
|
|
|
* @property int|null $fk_mode_reglement |
65
|
|
|
* @property int|null $fk_input_method |
66
|
|
|
* @property int|null $fk_incoterms |
67
|
|
|
* @property string|null $location_incoterms |
68
|
|
|
* @property string|null $import_key |
69
|
|
|
* @property string|null $extraparams |
70
|
|
|
* @property int|null $fk_multicurrency |
71
|
|
|
* @property string|null $multicurrency_code |
72
|
|
|
* @property float|null $multicurrency_tx |
73
|
|
|
* @property float|null $multicurrency_total_ht |
74
|
|
|
* @property float|null $multicurrency_total_tva |
75
|
|
|
* @property float|null $multicurrency_total_ttc |
76
|
|
|
* |
77
|
|
|
* @property Societe $societe |
78
|
|
|
*/ |
79
|
|
|
class CommandeFournisseur extends Model |
80
|
|
|
{ |
81
|
|
|
public $timestamps = false; |
82
|
|
|
protected $table = 'commande_fournisseur'; |
83
|
|
|
protected $casts = [ |
84
|
|
|
'entity' => 'int', |
85
|
|
|
'fk_soc' => 'int', |
86
|
|
|
'fk_projet' => 'int', |
87
|
|
|
'tms' => 'datetime', |
88
|
|
|
'date_creation' => 'datetime', |
89
|
|
|
'date_valid' => 'datetime', |
90
|
|
|
'date_approve' => 'datetime', |
91
|
|
|
'date_approve2' => 'datetime', |
92
|
|
|
'date_commande' => 'datetime', |
93
|
|
|
'fk_user_author' => 'int', |
94
|
|
|
'fk_user_modif' => 'int', |
95
|
|
|
'fk_user_valid' => 'int', |
96
|
|
|
'fk_user_approve' => 'int', |
97
|
|
|
'fk_user_approve2' => 'int', |
98
|
|
|
'source' => 'int', |
99
|
|
|
'fk_statut' => 'int', |
100
|
|
|
'billed' => 'int', |
101
|
|
|
'amount_ht' => 'float', |
102
|
|
|
'remise_percent' => 'float', |
103
|
|
|
'remise' => 'float', |
104
|
|
|
'total_tva' => 'float', |
105
|
|
|
'localtax1' => 'float', |
106
|
|
|
'localtax2' => 'float', |
107
|
|
|
'total_ht' => 'float', |
108
|
|
|
'total_ttc' => 'float', |
109
|
|
|
'date_livraison' => 'datetime', |
110
|
|
|
'fk_account' => 'int', |
111
|
|
|
'fk_cond_reglement' => 'int', |
112
|
|
|
'fk_mode_reglement' => 'int', |
113
|
|
|
'fk_input_method' => 'int', |
114
|
|
|
'fk_incoterms' => 'int', |
115
|
|
|
'fk_multicurrency' => 'int', |
116
|
|
|
'multicurrency_tx' => 'float', |
117
|
|
|
'multicurrency_total_ht' => 'float', |
118
|
|
|
'multicurrency_total_tva' => 'float', |
119
|
|
|
'multicurrency_total_ttc' => 'float' |
120
|
|
|
]; |
121
|
|
|
|
122
|
|
|
protected $fillable = [ |
123
|
|
|
'ref', |
124
|
|
|
'entity', |
125
|
|
|
'ref_ext', |
126
|
|
|
'ref_supplier', |
127
|
|
|
'fk_soc', |
128
|
|
|
'fk_projet', |
129
|
|
|
'tms', |
130
|
|
|
'date_creation', |
131
|
|
|
'date_valid', |
132
|
|
|
'date_approve', |
133
|
|
|
'date_approve2', |
134
|
|
|
'date_commande', |
135
|
|
|
'fk_user_author', |
136
|
|
|
'fk_user_modif', |
137
|
|
|
'fk_user_valid', |
138
|
|
|
'fk_user_approve', |
139
|
|
|
'fk_user_approve2', |
140
|
|
|
'source', |
141
|
|
|
'fk_statut', |
142
|
|
|
'billed', |
143
|
|
|
'amount_ht', |
144
|
|
|
'remise_percent', |
145
|
|
|
'remise', |
146
|
|
|
'total_tva', |
147
|
|
|
'localtax1', |
148
|
|
|
'localtax2', |
149
|
|
|
'total_ht', |
150
|
|
|
'total_ttc', |
151
|
|
|
'note_private', |
152
|
|
|
'note_public', |
153
|
|
|
'model_pdf', |
154
|
|
|
'last_main_doc', |
155
|
|
|
'date_livraison', |
156
|
|
|
'fk_account', |
157
|
|
|
'fk_cond_reglement', |
158
|
|
|
'fk_mode_reglement', |
159
|
|
|
'fk_input_method', |
160
|
|
|
'fk_incoterms', |
161
|
|
|
'location_incoterms', |
162
|
|
|
'import_key', |
163
|
|
|
'extraparams', |
164
|
|
|
'fk_multicurrency', |
165
|
|
|
'multicurrency_code', |
166
|
|
|
'multicurrency_tx', |
167
|
|
|
'multicurrency_total_ht', |
168
|
|
|
'multicurrency_total_tva', |
169
|
|
|
'multicurrency_total_ttc' |
170
|
|
|
]; |
171
|
|
|
|
172
|
|
|
public function societe() |
173
|
|
|
{ |
174
|
|
|
return $this->belongsTo(Societe::class, 'fk_soc'); |
175
|
|
|
} |
176
|
|
|
} |
177
|
|
|
|