|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: Administrador |
|
5
|
|
|
* Date: 08/08/2017 |
|
6
|
|
|
* Time: 10:37 AM |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Greenter\Model\Retention; |
|
10
|
|
|
|
|
11
|
|
|
use Greenter\Model\Client\Client; |
|
12
|
|
|
use Greenter\Model\Company\Company; |
|
13
|
|
|
use Greenter\Xml\Validator\RetentionValidator; |
|
14
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class Retention |
|
18
|
|
|
* @package Greenter\Model\Retention |
|
19
|
|
|
*/ |
|
20
|
|
View Code Duplication |
class Retention |
|
|
|
|
|
|
21
|
|
|
{ |
|
22
|
|
|
use RetentionValidator; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Serie del Documento (ejem: R001) |
|
26
|
|
|
* |
|
27
|
|
|
* @Assert\NotBlank() |
|
28
|
|
|
* @Assert\Length(max="4") |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
private $serie; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @Assert\NotBlank() |
|
35
|
|
|
* @Assert\Length(max="8") |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
private $correlativo; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @Assert\Date() |
|
42
|
|
|
* @var \DateTime |
|
43
|
|
|
*/ |
|
44
|
|
|
private $fechaEmision; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @Assert\NotBlank() |
|
48
|
|
|
* @Assert\Valid() |
|
49
|
|
|
* @var Company |
|
50
|
|
|
*/ |
|
51
|
|
|
private $company; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @Assert\NotBlank() |
|
55
|
|
|
* @Assert\Valid() |
|
56
|
|
|
* @var Client |
|
57
|
|
|
*/ |
|
58
|
|
|
private $proveedor; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @Assert\NotBlank() |
|
62
|
|
|
* @Assert\Length(min="2", max="2") |
|
63
|
|
|
* @var string |
|
64
|
|
|
*/ |
|
65
|
|
|
private $regimen; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @Assert\NotBlank() |
|
69
|
|
|
* @var float |
|
70
|
|
|
*/ |
|
71
|
|
|
private $tasa; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Importe total Retenido |
|
75
|
|
|
* |
|
76
|
|
|
* @Assert\NotBlank() |
|
77
|
|
|
* @var float |
|
78
|
|
|
*/ |
|
79
|
|
|
private $impRetenido; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Importe total Pagado |
|
83
|
|
|
* |
|
84
|
|
|
* @Assert\NotBlank() |
|
85
|
|
|
* @var float |
|
86
|
|
|
*/ |
|
87
|
|
|
private $impPagado; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @Assert\Length(max="250") |
|
91
|
|
|
* @var string |
|
92
|
|
|
*/ |
|
93
|
|
|
private $observacion; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Dato del Comprobante relacionado. |
|
97
|
|
|
* |
|
98
|
|
|
* @Assert\NotBlank() |
|
99
|
|
|
* @Assert\Valid() |
|
100
|
|
|
* @var RetentionDetail[] |
|
101
|
|
|
*/ |
|
102
|
|
|
private $details; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
6 |
|
public function getSerie() |
|
108
|
|
|
{ |
|
109
|
6 |
|
return $this->serie; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @param string $serie |
|
114
|
|
|
* @return Retention |
|
115
|
|
|
*/ |
|
116
|
12 |
|
public function setSerie($serie) |
|
117
|
|
|
{ |
|
118
|
12 |
|
$this->serie = $serie; |
|
119
|
12 |
|
return $this; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @return string |
|
124
|
|
|
*/ |
|
125
|
6 |
|
public function getCorrelativo() |
|
126
|
|
|
{ |
|
127
|
6 |
|
return $this->correlativo; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* @param string $correlativo |
|
132
|
|
|
* @return Retention |
|
133
|
|
|
*/ |
|
134
|
12 |
|
public function setCorrelativo($correlativo) |
|
135
|
|
|
{ |
|
136
|
12 |
|
$this->correlativo = $correlativo; |
|
137
|
12 |
|
return $this; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @return \DateTime |
|
142
|
|
|
*/ |
|
143
|
4 |
|
public function getFechaEmision() |
|
144
|
|
|
{ |
|
145
|
4 |
|
return $this->fechaEmision; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* @param \DateTime $fechaEmision |
|
150
|
|
|
* @return Retention |
|
151
|
|
|
*/ |
|
152
|
12 |
|
public function setFechaEmision($fechaEmision) |
|
153
|
|
|
{ |
|
154
|
12 |
|
$this->fechaEmision = $fechaEmision; |
|
155
|
12 |
|
return $this; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @return Client |
|
160
|
|
|
*/ |
|
161
|
4 |
|
public function getProveedor() |
|
162
|
|
|
{ |
|
163
|
4 |
|
return $this->proveedor; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* @param Client $proveedor |
|
168
|
|
|
* @return Retention |
|
169
|
|
|
*/ |
|
170
|
12 |
|
public function setProveedor($proveedor) |
|
171
|
|
|
{ |
|
172
|
12 |
|
$this->proveedor = $proveedor; |
|
173
|
12 |
|
return $this; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @return Company |
|
178
|
|
|
*/ |
|
179
|
6 |
|
public function getCompany() |
|
180
|
|
|
{ |
|
181
|
6 |
|
return $this->company; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @param Company $company |
|
186
|
|
|
* @return Retention |
|
187
|
|
|
*/ |
|
188
|
12 |
|
public function setCompany($company) |
|
189
|
|
|
{ |
|
190
|
12 |
|
$this->company = $company; |
|
191
|
12 |
|
return $this; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @return string |
|
196
|
|
|
*/ |
|
197
|
4 |
|
public function getRegimen() |
|
198
|
|
|
{ |
|
199
|
4 |
|
return $this->regimen; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* @param string $regimen |
|
204
|
|
|
* @return Retention |
|
205
|
|
|
*/ |
|
206
|
12 |
|
public function setRegimen($regimen) |
|
207
|
|
|
{ |
|
208
|
12 |
|
$this->regimen = $regimen; |
|
209
|
12 |
|
return $this; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* @return float |
|
214
|
|
|
*/ |
|
215
|
4 |
|
public function getTasa() |
|
216
|
|
|
{ |
|
217
|
4 |
|
return $this->tasa; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* @param float $tasa |
|
222
|
|
|
* @return Retention |
|
223
|
|
|
*/ |
|
224
|
12 |
|
public function setTasa($tasa) |
|
225
|
|
|
{ |
|
226
|
12 |
|
$this->tasa = $tasa; |
|
227
|
12 |
|
return $this; |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
/** |
|
231
|
|
|
* @return float |
|
232
|
|
|
*/ |
|
233
|
4 |
|
public function getImpRetenido() |
|
234
|
|
|
{ |
|
235
|
4 |
|
return $this->impRetenido; |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* @param float $impRetenido |
|
240
|
|
|
* @return Retention |
|
241
|
|
|
*/ |
|
242
|
12 |
|
public function setImpRetenido($impRetenido) |
|
243
|
|
|
{ |
|
244
|
12 |
|
$this->impRetenido = $impRetenido; |
|
245
|
12 |
|
return $this; |
|
246
|
|
|
} |
|
247
|
|
|
|
|
248
|
|
|
/** |
|
249
|
|
|
* @return float |
|
250
|
|
|
*/ |
|
251
|
4 |
|
public function getImpPagado() |
|
252
|
|
|
{ |
|
253
|
4 |
|
return $this->impPagado; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
/** |
|
257
|
|
|
* @param float $impPagado |
|
258
|
|
|
* @return Retention |
|
259
|
|
|
*/ |
|
260
|
12 |
|
public function setImpPagado($impPagado) |
|
261
|
|
|
{ |
|
262
|
12 |
|
$this->impPagado = $impPagado; |
|
263
|
12 |
|
return $this; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* @return string |
|
268
|
|
|
*/ |
|
269
|
4 |
|
public function getObservacion() |
|
270
|
|
|
{ |
|
271
|
4 |
|
return $this->observacion; |
|
272
|
|
|
} |
|
273
|
|
|
|
|
274
|
|
|
/** |
|
275
|
|
|
* @param string $observacion |
|
276
|
|
|
* @return Retention |
|
277
|
|
|
*/ |
|
278
|
12 |
|
public function setObservacion($observacion) |
|
279
|
|
|
{ |
|
280
|
12 |
|
$this->observacion = $observacion; |
|
281
|
12 |
|
return $this; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* @return RetentionDetail[] |
|
286
|
|
|
*/ |
|
287
|
4 |
|
public function getDetails() |
|
288
|
|
|
{ |
|
289
|
4 |
|
return $this->details; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
/** |
|
293
|
|
|
* @param RetentionDetail[] $details |
|
294
|
|
|
* @return Retention |
|
295
|
|
|
*/ |
|
296
|
12 |
|
public function setDetails($details) |
|
297
|
|
|
{ |
|
298
|
12 |
|
$this->details = $details; |
|
299
|
12 |
|
return $this; |
|
300
|
|
|
} |
|
301
|
|
|
|
|
302
|
|
|
/** |
|
303
|
|
|
* Get FileName without extension. |
|
304
|
|
|
* |
|
305
|
|
|
* @return string |
|
306
|
|
|
*/ |
|
307
|
4 |
|
public function getFileName() |
|
308
|
|
|
{ |
|
309
|
|
|
$parts = [ |
|
310
|
4 |
|
$this->company->getRuc(), |
|
311
|
4 |
|
'20', |
|
312
|
4 |
|
$this->getSerie(), |
|
313
|
4 |
|
$this->getCorrelativo(), |
|
314
|
4 |
|
]; |
|
315
|
|
|
|
|
316
|
4 |
|
return join('-', $parts); |
|
317
|
|
|
} |
|
318
|
|
|
} |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.