1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* LibreDTE: Biblioteca PHP (Núcleo). |
7
|
|
|
* Copyright (C) LibreDTE <https://www.libredte.cl> |
8
|
|
|
* |
9
|
|
|
* Este programa es software libre: usted puede redistribuirlo y/o modificarlo |
10
|
|
|
* bajo los términos de la Licencia Pública General Affero de GNU publicada por |
11
|
|
|
* la Fundación para el Software Libre, ya sea la versión 3 de la Licencia, o |
12
|
|
|
* (a su elección) cualquier versión posterior de la misma. |
13
|
|
|
* |
14
|
|
|
* Este programa se distribuye con la esperanza de que sea útil, pero SIN |
15
|
|
|
* GARANTÍA ALGUNA; ni siquiera la garantía implícita MERCANTIL o de APTITUD |
16
|
|
|
* PARA UN PROPÓSITO DETERMINADO. Consulte los detalles de la Licencia Pública |
17
|
|
|
* General Affero de GNU para obtener una información más detallada. |
18
|
|
|
* |
19
|
|
|
* Debería haber recibido una copia de la Licencia Pública General Affero de |
20
|
|
|
* GNU junto a este programa. |
21
|
|
|
* |
22
|
|
|
* En caso contrario, consulte <http://www.gnu.org/licenses/agpl.html>. |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace libredte\lib\Core\Package\Billing\Component\Document\Entity; |
26
|
|
|
|
27
|
|
|
use Derafu\Lib\Core\Package\Prime\Component\Entity\Entity\Entity; |
28
|
|
|
use Derafu\Lib\Core\Package\Prime\Component\Entity\Mapping as DEM; |
29
|
|
|
use libredte\lib\Core\Package\Billing\Component\Document\Repository\ImpuestoAdicionalRetencionRepository; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Entidad de impuesto adicional y retención. |
33
|
|
|
*/ |
34
|
|
|
#[DEM\Entity(repositoryClass: ImpuestoAdicionalRetencionRepository::class)] |
35
|
|
|
class ImpuestoAdicionalRetencion extends Entity |
36
|
|
|
{ |
37
|
|
|
/** |
38
|
|
|
* {@inheritDoc} |
39
|
|
|
*/ |
40
|
|
|
public function __toString(): string |
41
|
|
|
{ |
42
|
|
|
return $this->getAttribute('glosa'); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Obtiene el código del impuesto o retención. |
47
|
|
|
* |
48
|
|
|
* @return int |
49
|
|
|
*/ |
50
|
1 |
|
public function getCodigo(): int |
51
|
|
|
{ |
52
|
1 |
|
return (int) $this->getAttribute('codigo'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Obtiene el tipo de entidad: impuesto adicional o retención. |
57
|
|
|
* |
58
|
|
|
* @return string|false A: adicional, R: retención o `false` si no se pudo |
59
|
|
|
* determinar. |
60
|
|
|
*/ |
61
|
6 |
|
public function getTipo(): string|false |
62
|
|
|
{ |
63
|
6 |
|
if ($this->hasAttribute('tipo')) { |
64
|
6 |
|
return $this->getAttribute('tipo'); |
65
|
|
|
} |
66
|
|
|
|
67
|
1 |
|
return false; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Obtiene la glosa del impuesto adicional o retención. |
72
|
|
|
* |
73
|
|
|
* @return string Glosa del impuesto o glosa estándar si no se encontró una. |
74
|
|
|
*/ |
75
|
1 |
|
public function getGlosa(): string |
76
|
|
|
{ |
77
|
1 |
|
if ($this->hasAttribute('glosa')) { |
78
|
1 |
|
return $this->getAttribute('glosa'); |
79
|
|
|
} |
80
|
|
|
|
81
|
1 |
|
return 'Impto. cód. ' . $this->getCodigo(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Obtiene la tasa del impuesto adicional o retención. |
86
|
|
|
* |
87
|
|
|
* @return float|false Tasa del impuesto o =false si no se pudo determinar. |
88
|
|
|
*/ |
89
|
6 |
|
public function getTasa(): float|false |
90
|
|
|
{ |
91
|
6 |
|
if ($this->hasAttribute('tasa')) { |
92
|
6 |
|
return (float) $this->getAttribute('tasa'); |
93
|
|
|
} |
94
|
|
|
|
95
|
1 |
|
return false; |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|