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

CommandeFournisseurdet::c_unit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\Commande\Model\Commandedet;
23
use Dolibarr\Core\Base\Model;
24
use Dolibarr\Core\Model\CUnit;
25
use Illuminate\Database\Eloquent\Collection;
26
27
/**
28
 * Class CommandeFournisseurdet
29
 *
30
 * @property int $rowid
31
 * @property int $fk_commande
32
 * @property int|null $fk_parent_line
33
 * @property int|null $fk_product
34
 * @property string|null $ref
35
 * @property string|null $label
36
 * @property string|null $description
37
 * @property string|null $vat_src_code
38
 * @property float|null $tva_tx
39
 * @property float|null $localtax1_tx
40
 * @property string|null $localtax1_type
41
 * @property float|null $localtax2_tx
42
 * @property string|null $localtax2_type
43
 * @property float|null $qty
44
 * @property float|null $remise_percent
45
 * @property float|null $remise
46
 * @property float|null $subprice
47
 * @property float|null $total_ht
48
 * @property float|null $total_tva
49
 * @property float|null $total_localtax1
50
 * @property float|null $total_localtax2
51
 * @property float|null $total_ttc
52
 * @property int|null $product_type
53
 * @property Carbon|null $date_start
54
 * @property Carbon|null $date_end
55
 * @property int|null $info_bits
56
 * @property int|null $special_code
57
 * @property int|null $rang
58
 * @property string|null $import_key
59
 * @property int|null $fk_unit
60
 * @property int|null $fk_multicurrency
61
 * @property string|null $multicurrency_code
62
 * @property float|null $multicurrency_subprice
63
 * @property float|null $multicurrency_total_ht
64
 * @property float|null $multicurrency_total_tva
65
 * @property float|null $multicurrency_total_ttc
66
 *
67
 * @property CUnit|null $c_unit
68
 * @property Collection|Commandedet[] $commandedets
69
 */
70
class CommandeFournisseurdet extends Model
71
{
72
    public $timestamps = false;
73
    protected $table = 'commande_fournisseurdet';
74
    protected $casts = [
75
        'fk_commande' => 'int',
76
        'fk_parent_line' => 'int',
77
        'fk_product' => 'int',
78
        'tva_tx' => 'float',
79
        'localtax1_tx' => 'float',
80
        'localtax2_tx' => 'float',
81
        'qty' => 'float',
82
        'remise_percent' => 'float',
83
        'remise' => 'float',
84
        'subprice' => 'float',
85
        'total_ht' => 'float',
86
        'total_tva' => 'float',
87
        'total_localtax1' => 'float',
88
        'total_localtax2' => 'float',
89
        'total_ttc' => 'float',
90
        'product_type' => 'int',
91
        'date_start' => 'datetime',
92
        'date_end' => 'datetime',
93
        'info_bits' => 'int',
94
        'special_code' => 'int',
95
        'rang' => 'int',
96
        'fk_unit' => 'int',
97
        'fk_multicurrency' => 'int',
98
        'multicurrency_subprice' => 'float',
99
        'multicurrency_total_ht' => 'float',
100
        'multicurrency_total_tva' => 'float',
101
        'multicurrency_total_ttc' => 'float'
102
    ];
103
104
    protected $fillable = [
105
        'fk_commande',
106
        'fk_parent_line',
107
        'fk_product',
108
        'ref',
109
        'label',
110
        'description',
111
        'vat_src_code',
112
        'tva_tx',
113
        'localtax1_tx',
114
        'localtax1_type',
115
        'localtax2_tx',
116
        'localtax2_type',
117
        'qty',
118
        'remise_percent',
119
        'remise',
120
        'subprice',
121
        'total_ht',
122
        'total_tva',
123
        'total_localtax1',
124
        'total_localtax2',
125
        'total_ttc',
126
        'product_type',
127
        'date_start',
128
        'date_end',
129
        'info_bits',
130
        'special_code',
131
        'rang',
132
        'import_key',
133
        'fk_unit',
134
        'fk_multicurrency',
135
        'multicurrency_code',
136
        'multicurrency_subprice',
137
        'multicurrency_total_ht',
138
        'multicurrency_total_tva',
139
        'multicurrency_total_ttc'
140
    ];
141
142
    public function c_unit()
143
    {
144
        return $this->belongsTo(CUnit::class, 'fk_unit');
145
    }
146
147
    public function commandedets()
148
    {
149
        return $this->hasMany(Commandedet::class, 'fk_commandefourndet');
150
    }
151
}
152