|
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\Societe\Model\Societe; |
|
23
|
|
|
use Dolibarr\Code\UserGroup\Model\User; |
|
24
|
|
|
use Dolibarr\Core\Base\Model; |
|
25
|
|
|
use Illuminate\Database\Eloquent\Collection; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class Contrat |
|
29
|
|
|
* |
|
30
|
|
|
* @property int $rowid |
|
31
|
|
|
* @property string|null $ref |
|
32
|
|
|
* @property string|null $ref_customer |
|
33
|
|
|
* @property string|null $ref_supplier |
|
34
|
|
|
* @property string|null $ref_ext |
|
35
|
|
|
* @property int $entity |
|
36
|
|
|
* @property Carbon|null $tms |
|
37
|
|
|
* @property Carbon|null $datec |
|
38
|
|
|
* @property Carbon|null $date_contrat |
|
39
|
|
|
* @property int|null $statut |
|
40
|
|
|
* @property Carbon|null $fin_validite |
|
41
|
|
|
* @property Carbon|null $date_cloture |
|
42
|
|
|
* @property int $fk_soc |
|
43
|
|
|
* @property int|null $fk_projet |
|
44
|
|
|
* @property int|null $fk_commercial_signature |
|
45
|
|
|
* @property int|null $fk_commercial_suivi |
|
46
|
|
|
* @property int $fk_user_author |
|
47
|
|
|
* @property int|null $fk_user_modif |
|
48
|
|
|
* @property int|null $fk_user_cloture |
|
49
|
|
|
* @property float|null $total_tva |
|
50
|
|
|
* @property float|null $localtax1 |
|
51
|
|
|
* @property float|null $localtax2 |
|
52
|
|
|
* @property float|null $revenuestamp |
|
53
|
|
|
* @property float|null $total_ht |
|
54
|
|
|
* @property float|null $total_ttc |
|
55
|
|
|
* @property int|null $signed_status |
|
56
|
|
|
* @property string|null $online_sign_ip |
|
57
|
|
|
* @property string|null $online_sign_name |
|
58
|
|
|
* @property string|null $note_private |
|
59
|
|
|
* @property string|null $note_public |
|
60
|
|
|
* @property string|null $model_pdf |
|
61
|
|
|
* @property string|null $last_main_doc |
|
62
|
|
|
* @property string|null $import_key |
|
63
|
|
|
* @property string|null $extraparams |
|
64
|
|
|
* |
|
65
|
|
|
* @property Societe $societe |
|
66
|
|
|
* @property User $user |
|
67
|
|
|
* @property Collection|Contratdet[] $contratdets |
|
68
|
|
|
*/ |
|
69
|
|
|
class Contrat extends Model |
|
70
|
|
|
{ |
|
71
|
|
|
public $timestamps = false; |
|
72
|
|
|
protected $table = 'contrat'; |
|
73
|
|
|
protected $casts = [ |
|
74
|
|
|
'entity' => 'int', |
|
75
|
|
|
'tms' => 'datetime', |
|
76
|
|
|
'datec' => 'datetime', |
|
77
|
|
|
'date_contrat' => 'datetime', |
|
78
|
|
|
'statut' => 'int', |
|
79
|
|
|
'fin_validite' => 'datetime', |
|
80
|
|
|
'date_cloture' => 'datetime', |
|
81
|
|
|
'fk_soc' => 'int', |
|
82
|
|
|
'fk_projet' => 'int', |
|
83
|
|
|
'fk_commercial_signature' => 'int', |
|
84
|
|
|
'fk_commercial_suivi' => 'int', |
|
85
|
|
|
'fk_user_author' => 'int', |
|
86
|
|
|
'fk_user_modif' => 'int', |
|
87
|
|
|
'fk_user_cloture' => 'int', |
|
88
|
|
|
'total_tva' => 'float', |
|
89
|
|
|
'localtax1' => 'float', |
|
90
|
|
|
'localtax2' => 'float', |
|
91
|
|
|
'revenuestamp' => 'float', |
|
92
|
|
|
'total_ht' => 'float', |
|
93
|
|
|
'total_ttc' => 'float', |
|
94
|
|
|
'signed_status' => 'int' |
|
95
|
|
|
]; |
|
96
|
|
|
|
|
97
|
|
|
protected $fillable = [ |
|
98
|
|
|
'ref', |
|
99
|
|
|
'ref_customer', |
|
100
|
|
|
'ref_supplier', |
|
101
|
|
|
'ref_ext', |
|
102
|
|
|
'entity', |
|
103
|
|
|
'tms', |
|
104
|
|
|
'datec', |
|
105
|
|
|
'date_contrat', |
|
106
|
|
|
'statut', |
|
107
|
|
|
'fin_validite', |
|
108
|
|
|
'date_cloture', |
|
109
|
|
|
'fk_soc', |
|
110
|
|
|
'fk_projet', |
|
111
|
|
|
'fk_commercial_signature', |
|
112
|
|
|
'fk_commercial_suivi', |
|
113
|
|
|
'fk_user_author', |
|
114
|
|
|
'fk_user_modif', |
|
115
|
|
|
'fk_user_cloture', |
|
116
|
|
|
'total_tva', |
|
117
|
|
|
'localtax1', |
|
118
|
|
|
'localtax2', |
|
119
|
|
|
'revenuestamp', |
|
120
|
|
|
'total_ht', |
|
121
|
|
|
'total_ttc', |
|
122
|
|
|
'signed_status', |
|
123
|
|
|
'online_sign_ip', |
|
124
|
|
|
'online_sign_name', |
|
125
|
|
|
'note_private', |
|
126
|
|
|
'note_public', |
|
127
|
|
|
'model_pdf', |
|
128
|
|
|
'last_main_doc', |
|
129
|
|
|
'import_key', |
|
130
|
|
|
'extraparams' |
|
131
|
|
|
]; |
|
132
|
|
|
|
|
133
|
|
|
public function societe() |
|
134
|
|
|
{ |
|
135
|
|
|
return $this->belongsTo(Societe::class, 'fk_soc'); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
public function user() |
|
139
|
|
|
{ |
|
140
|
|
|
return $this->belongsTo(User::class, 'fk_user_author'); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
public function contratdets() |
|
144
|
|
|
{ |
|
145
|
|
|
return $this->hasMany(Contratdet::class, 'fk_contrat'); |
|
146
|
|
|
} |
|
147
|
|
|
} |
|
148
|
|
|
|