Completed
Push — master ( 0a5559...4dd4d6 )
by Giancarlos
04:06
created

Despatch::setCorrelativo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 07/08/2017
6
 * Time: 21:42
7
 */
8
9
namespace Greenter\Model\Despatch;
10
11
use Greenter\Model\Client\Client;
12
use Greenter\Model\Sale\Document;
13
use Greenter\Xml\Validator\DespatchValidator;
14
use Symfony\Component\Validator\Constraints as Assert;
15
16
/**
17
 * Class Despatch
18
 * @package Greenter\Model\Despatch
19
 */
20
class Despatch
21
{
22
    use DespatchValidator;
23
24
    /**
25
     * @Assert\NotBlank()
26
     * @Assert\Length(max="2")
27
     * @var string
28
     */
29
    private $tipoDoc;
30
31
    /**
32
     * Serie del Documento (ejem: T001)
33
     *
34
     * @Assert\NotBlank()
35
     * @Assert\Length(max="4")
36
     * @var string
37
     */
38
    private $serie;
39
40
    /**
41
     * @Assert\NotBlank()
42
     * @Assert\Length(max="8")
43
     * @var string
44
     */
45
    private $correlativo;
46
47
    /**
48
     * @Assert\Length(max="250")
49
     * @var string
50
     */
51
    private $observacion;
52
    /**
53
     * @Assert\Date()
54
     * @var \DateTime
55
     */
56
    private $fechaEmision;
57
58
    /**
59
     * @Assert\NotBlank()
60
     * @Assert\Valid()
61
     * @var Client
62
     */
63
    private $destinatario;
64
65
    /**
66
     * Datos del Establecimiento del tercero (cuando se ingrese)
67
     *
68
     * @Assert\Valid()
69
     * @var Client
70
     */
71
    private $tercero;
72
73
    /**
74
     * @Assert\NotBlank()
75
     * @Assert\Valid()
76
     * @var Shipment
77
     */
78
    private $envio;
79
80
    /**
81
     * @Assert\Valid()
82
     * @var Document
83
     */
84
    private $docBaja;
85
86
    /**
87
     * @Assert\Valid()
88
     * @var Document
89
     */
90
    private $relDoc;
91
92
    /**
93
     * @Assert\NotBlank()
94
     * @Assert\Valid()
95
     * @var DespatchDetail[]
96
     */
97
    private $details;
98
99
    /**
100
     * @return string
101
     */
102 6
    public function getTipoDoc()
103
    {
104 6
        return $this->tipoDoc;
105
    }
106
107
    /**
108
     * @param string $tipoDoc
109
     * @return Despatch
110
     */
111 12
    public function setTipoDoc($tipoDoc)
112
    {
113 12
        $this->tipoDoc = $tipoDoc;
114 12
        return $this;
115
    }
116
117
    /**
118
     * @return string
119
     */
120 6
    public function getSerie()
121
    {
122 6
        return $this->serie;
123
    }
124
125
    /**
126
     * @param string $serie
127
     * @return Despatch
128
     */
129 12
    public function setSerie($serie)
130
    {
131 12
        $this->serie = $serie;
132 12
        return $this;
133
    }
134
135
    /**
136
     * @return string
137
     */
138 6
    public function getCorrelativo()
139
    {
140 6
        return $this->correlativo;
141
    }
142
143
    /**
144
     * @param string $correlativo
145
     * @return Despatch
146
     */
147 12
    public function setCorrelativo($correlativo)
148
    {
149 12
        $this->correlativo = $correlativo;
150 12
        return $this;
151
    }
152
153
    /**
154
     * @return string
155
     */
156 4
    public function getObservacion()
157
    {
158 4
        return $this->observacion;
159
    }
160
161
    /**
162
     * @param string $observacion
163
     * @return Despatch
164
     */
165 12
    public function setObservacion($observacion)
166
    {
167 12
        $this->observacion = $observacion;
168 12
        return $this;
169
    }
170
171
    /**
172
     * @return \DateTime
173
     */
174 4
    public function getFechaEmision()
175
    {
176 4
        return $this->fechaEmision;
177
    }
178
179
    /**
180
     * @param \DateTime $fechaEmision
181
     * @return Despatch
182
     */
183 12
    public function setFechaEmision($fechaEmision)
184
    {
185 12
        $this->fechaEmision = $fechaEmision;
186 12
        return $this;
187
    }
188
189
    /**
190
     * @return Client
191
     */
192 4
    public function getDestinatario()
193
    {
194 4
        return $this->destinatario;
195
    }
196
197
    /**
198
     * @param Client $destinatario
199
     * @return Despatch
200
     */
201 12
    public function setDestinatario($destinatario)
202
    {
203 12
        $this->destinatario = $destinatario;
204 12
        return $this;
205
    }
206
207
    /**
208
     * @return Client
209
     */
210 4
    public function getTercero()
211
    {
212 4
        return $this->tercero;
213
    }
214
215
    /**
216
     * @param Client $tercero
217
     * @return Despatch
218
     */
219 12
    public function setTercero($tercero)
220
    {
221 12
        $this->tercero = $tercero;
222 12
        return $this;
223
    }
224
225
    /**
226
     * @return Shipment
227
     */
228 4
    public function getEnvio()
229
    {
230 4
        return $this->envio;
231
    }
232
233
    /**
234
     * @param Shipment $envio
235
     * @return Despatch
236
     */
237 12
    public function setEnvio($envio)
238
    {
239 12
        $this->envio = $envio;
240 12
        return $this;
241
    }
242
243
    /**
244
     * @return Document
245
     */
246 4
    public function getDocBaja()
247
    {
248 4
        return $this->docBaja;
249
    }
250
251
    /**
252
     * @param Document $docBaja
253
     * @return Despatch
254
     */
255 12
    public function setDocBaja($docBaja)
256
    {
257 12
        $this->docBaja = $docBaja;
258 12
        return $this;
259
    }
260
261
    /**
262
     * @return Document
263
     */
264 4
    public function getRelDoc()
265
    {
266 4
        return $this->relDoc;
267
    }
268
269
    /**
270
     * @param Document $relDoc
271
     * @return Despatch
272
     */
273 12
    public function setRelDoc($relDoc)
274
    {
275 12
        $this->relDoc = $relDoc;
276 12
        return $this;
277
    }
278
279
    /**
280
     * @return DespatchDetail[]
281
     */
282 4
    public function getDetails()
283
    {
284 4
        return $this->details;
285
    }
286
287
    /**
288
     * @param DespatchDetail[] $details
289
     * @return Despatch
290
     */
291 12
    public function setDetails($details)
292
    {
293 12
        $this->details = $details;
294 12
        return $this;
295
    }
296
297
    /**
298
     * Get FileName without extension.
299
     *
300
     * @param string $ruc Ruc de la Empresa.
301
     * @return string
302
     */
303 4
    public function getFileName($ruc)
304
    {
305
        $parts = [
306 4
            $ruc,
307 4
            $this->getTipoDoc(), // 09
308 4
            $this->getSerie(),
309 4
            $this->getCorrelativo(),
310 4
        ];
311
312 4
        return join('-', $parts);
313
    }
314
}