| @@ 20-314 (lines=295) @@ | ||
| 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 $relDocs; |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @Assert\NotBlank() |
|
| 94 | * @Assert\Valid() |
|
| 95 | * @var DespatchDetail[] |
|
| 96 | */ |
|
| 97 | private $details; |
|
| 98 | ||
| 99 | /** |
|
| 100 | * @return string |
|
| 101 | */ |
|
| 102 | public function getTipoDoc() |
|
| 103 | { |
|
| 104 | return $this->tipoDoc; |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * @param string $tipoDoc |
|
| 109 | * @return Despatch |
|
| 110 | */ |
|
| 111 | public function setTipoDoc($tipoDoc) |
|
| 112 | { |
|
| 113 | $this->tipoDoc = $tipoDoc; |
|
| 114 | return $this; |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * @return string |
|
| 119 | */ |
|
| 120 | public function getSerie() |
|
| 121 | { |
|
| 122 | return $this->serie; |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * @param string $serie |
|
| 127 | * @return Despatch |
|
| 128 | */ |
|
| 129 | public function setSerie($serie) |
|
| 130 | { |
|
| 131 | $this->serie = $serie; |
|
| 132 | return $this; |
|
| 133 | } |
|
| 134 | ||
| 135 | /** |
|
| 136 | * @return string |
|
| 137 | */ |
|
| 138 | public function getCorrelativo() |
|
| 139 | { |
|
| 140 | return $this->correlativo; |
|
| 141 | } |
|
| 142 | ||
| 143 | /** |
|
| 144 | * @param string $correlativo |
|
| 145 | * @return Despatch |
|
| 146 | */ |
|
| 147 | public function setCorrelativo($correlativo) |
|
| 148 | { |
|
| 149 | $this->correlativo = $correlativo; |
|
| 150 | return $this; |
|
| 151 | } |
|
| 152 | ||
| 153 | /** |
|
| 154 | * @return string |
|
| 155 | */ |
|
| 156 | public function getObservacion() |
|
| 157 | { |
|
| 158 | return $this->observacion; |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * @param string $observacion |
|
| 163 | * @return Despatch |
|
| 164 | */ |
|
| 165 | public function setObservacion($observacion) |
|
| 166 | { |
|
| 167 | $this->observacion = $observacion; |
|
| 168 | return $this; |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * @return \DateTime |
|
| 173 | */ |
|
| 174 | public function getFechaEmision() |
|
| 175 | { |
|
| 176 | return $this->fechaEmision; |
|
| 177 | } |
|
| 178 | ||
| 179 | /** |
|
| 180 | * @param \DateTime $fechaEmision |
|
| 181 | * @return Despatch |
|
| 182 | */ |
|
| 183 | public function setFechaEmision($fechaEmision) |
|
| 184 | { |
|
| 185 | $this->fechaEmision = $fechaEmision; |
|
| 186 | return $this; |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|
| 190 | * @return Client |
|
| 191 | */ |
|
| 192 | public function getDestinatario() |
|
| 193 | { |
|
| 194 | return $this->destinatario; |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|
| 198 | * @param Client $destinatario |
|
| 199 | * @return Despatch |
|
| 200 | */ |
|
| 201 | public function setDestinatario($destinatario) |
|
| 202 | { |
|
| 203 | $this->destinatario = $destinatario; |
|
| 204 | return $this; |
|
| 205 | } |
|
| 206 | ||
| 207 | /** |
|
| 208 | * @return Client |
|
| 209 | */ |
|
| 210 | public function getTercero() |
|
| 211 | { |
|
| 212 | return $this->tercero; |
|
| 213 | } |
|
| 214 | ||
| 215 | /** |
|
| 216 | * @param Client $tercero |
|
| 217 | * @return Despatch |
|
| 218 | */ |
|
| 219 | public function setTercero($tercero) |
|
| 220 | { |
|
| 221 | $this->tercero = $tercero; |
|
| 222 | return $this; |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| 226 | * @return Shipment |
|
| 227 | */ |
|
| 228 | public function getEnvio() |
|
| 229 | { |
|
| 230 | return $this->envio; |
|
| 231 | } |
|
| 232 | ||
| 233 | /** |
|
| 234 | * @param Shipment $envio |
|
| 235 | * @return Despatch |
|
| 236 | */ |
|
| 237 | public function setEnvio($envio) |
|
| 238 | { |
|
| 239 | $this->envio = $envio; |
|
| 240 | return $this; |
|
| 241 | } |
|
| 242 | ||
| 243 | /** |
|
| 244 | * @return Document |
|
| 245 | */ |
|
| 246 | public function getDocBaja() |
|
| 247 | { |
|
| 248 | return $this->docBaja; |
|
| 249 | } |
|
| 250 | ||
| 251 | /** |
|
| 252 | * @param Document $docBaja |
|
| 253 | * @return Despatch |
|
| 254 | */ |
|
| 255 | public function setDocBaja($docBaja) |
|
| 256 | { |
|
| 257 | $this->docBaja = $docBaja; |
|
| 258 | return $this; |
|
| 259 | } |
|
| 260 | ||
| 261 | /** |
|
| 262 | * @return Document[] |
|
| 263 | */ |
|
| 264 | public function getRelDocs() |
|
| 265 | { |
|
| 266 | return $this->relDocs; |
|
| 267 | } |
|
| 268 | ||
| 269 | /** |
|
| 270 | * @param Document[] $relDocs |
|
| 271 | * @return Despatch |
|
| 272 | */ |
|
| 273 | public function setRelDocs($relDocs) |
|
| 274 | { |
|
| 275 | $this->relDocs = $relDocs; |
|
| 276 | return $this; |
|
| 277 | } |
|
| 278 | ||
| 279 | /** |
|
| 280 | * @return DespatchDetail[] |
|
| 281 | */ |
|
| 282 | public function getDetails() |
|
| 283 | { |
|
| 284 | return $this->details; |
|
| 285 | } |
|
| 286 | ||
| 287 | /** |
|
| 288 | * @param DespatchDetail[] $details |
|
| 289 | * @return Despatch |
|
| 290 | */ |
|
| 291 | public function setDetails($details) |
|
| 292 | { |
|
| 293 | $this->details = $details; |
|
| 294 | return $this; |
|
| 295 | } |
|
| 296 | ||
| 297 | /** |
|
| 298 | * Get FileName without extension. |
|
| 299 | * |
|
| 300 | * @param string $ruc Ruc de la Empresa. |
|
| 301 | * @return string |
|
| 302 | */ |
|
| 303 | public function getFileName($ruc) |
|
| 304 | { |
|
| 305 | $parts = [ |
|
| 306 | $ruc, |
|
| 307 | $this->getTipoDoc(), // 09 |
|
| 308 | $this->getSerie(), |
|
| 309 | $this->getCorrelativo(), |
|
| 310 | ]; |
|
| 311 | ||
| 312 | return join('-', $parts); |
|
| 313 | } |
|
| 314 | } |
|
| @@ 18-319 (lines=302) @@ | ||
| 15 | * Class Perception |
|
| 16 | * @package Greenter\Model\Perception |
|
| 17 | */ |
|
| 18 | class Perception |
|
| 19 | { |
|
| 20 | use PerceptionValidator; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * Serie del Documento (ejem: P001) |
|
| 24 | * |
|
| 25 | * @Assert\NotBlank() |
|
| 26 | * @Assert\Length(max="4") |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | private $serie; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @Assert\NotBlank() |
|
| 33 | * @Assert\Length(max="8") |
|
| 34 | * @var string |
|
| 35 | */ |
|
| 36 | private $correlativo; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @Assert\Date() |
|
| 40 | * @var \DateTime |
|
| 41 | */ |
|
| 42 | private $fechaEmision; |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @Assert\NotBlank() |
|
| 46 | * @Assert\Valid() |
|
| 47 | * @var Client |
|
| 48 | */ |
|
| 49 | private $proveedor; |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @Assert\NotBlank() |
|
| 53 | * @Assert\Length(min="2", max="2") |
|
| 54 | * @var string |
|
| 55 | */ |
|
| 56 | private $regimen; |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @Assert\NotBlank() |
|
| 60 | * @var float |
|
| 61 | */ |
|
| 62 | private $tasa; |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Importe total Percibido. |
|
| 66 | * |
|
| 67 | * @Assert\NotBlank() |
|
| 68 | * @var float |
|
| 69 | */ |
|
| 70 | private $impPercibido; |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Importe total Cobrado. |
|
| 74 | * |
|
| 75 | * @Assert\NotBlank() |
|
| 76 | * @var float |
|
| 77 | */ |
|
| 78 | private $impCobrado; |
|
| 79 | ||
| 80 | /** |
|
| 81 | * Moneda del Importe total Cobrado. |
|
| 82 | * |
|
| 83 | * @Assert\NotBlank() |
|
| 84 | * @Assert\Length(min="3", max="3") |
|
| 85 | * @var string |
|
| 86 | */ |
|
| 87 | private $moneda; |
|
| 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 PerceptionDetail[] |
|
| 101 | */ |
|
| 102 | private $details; |
|
| 103 | ||
| 104 | /** |
|
| 105 | * @return string |
|
| 106 | */ |
|
| 107 | public function getSerie() |
|
| 108 | { |
|
| 109 | return $this->serie; |
|
| 110 | } |
|
| 111 | ||
| 112 | /** |
|
| 113 | * @param string $serie |
|
| 114 | * @return Perception |
|
| 115 | */ |
|
| 116 | public function setSerie($serie) |
|
| 117 | { |
|
| 118 | $this->serie = $serie; |
|
| 119 | return $this; |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * @return string |
|
| 124 | */ |
|
| 125 | public function getCorrelativo() |
|
| 126 | { |
|
| 127 | return $this->correlativo; |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * @param string $correlativo |
|
| 132 | * @return Perception |
|
| 133 | */ |
|
| 134 | public function setCorrelativo($correlativo) |
|
| 135 | { |
|
| 136 | $this->correlativo = $correlativo; |
|
| 137 | return $this; |
|
| 138 | } |
|
| 139 | ||
| 140 | /** |
|
| 141 | * @return \DateTime |
|
| 142 | */ |
|
| 143 | public function getFechaEmision() |
|
| 144 | { |
|
| 145 | return $this->fechaEmision; |
|
| 146 | } |
|
| 147 | ||
| 148 | /** |
|
| 149 | * @param \DateTime $fechaEmision |
|
| 150 | * @return Perception |
|
| 151 | */ |
|
| 152 | public function setFechaEmision($fechaEmision) |
|
| 153 | { |
|
| 154 | $this->fechaEmision = $fechaEmision; |
|
| 155 | return $this; |
|
| 156 | } |
|
| 157 | ||
| 158 | /** |
|
| 159 | * @return Client |
|
| 160 | */ |
|
| 161 | public function getProveedor() |
|
| 162 | { |
|
| 163 | return $this->proveedor; |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|
| 167 | * @param Client $proveedor |
|
| 168 | * @return Perception |
|
| 169 | */ |
|
| 170 | public function setProveedor($proveedor) |
|
| 171 | { |
|
| 172 | $this->proveedor = $proveedor; |
|
| 173 | return $this; |
|
| 174 | } |
|
| 175 | ||
| 176 | /** |
|
| 177 | * @return string |
|
| 178 | */ |
|
| 179 | public function getRegimen() |
|
| 180 | { |
|
| 181 | return $this->regimen; |
|
| 182 | } |
|
| 183 | ||
| 184 | /** |
|
| 185 | * @param string $regimen |
|
| 186 | * @return Perception |
|
| 187 | */ |
|
| 188 | public function setRegimen($regimen) |
|
| 189 | { |
|
| 190 | $this->regimen = $regimen; |
|
| 191 | return $this; |
|
| 192 | } |
|
| 193 | ||
| 194 | /** |
|
| 195 | * @return float |
|
| 196 | */ |
|
| 197 | public function getTasa() |
|
| 198 | { |
|
| 199 | return $this->tasa; |
|
| 200 | } |
|
| 201 | ||
| 202 | /** |
|
| 203 | * @param float $tasa |
|
| 204 | * @return Perception |
|
| 205 | */ |
|
| 206 | public function setTasa($tasa) |
|
| 207 | { |
|
| 208 | $this->tasa = $tasa; |
|
| 209 | return $this; |
|
| 210 | } |
|
| 211 | ||
| 212 | /** |
|
| 213 | * @return float |
|
| 214 | */ |
|
| 215 | public function getImpPercibido() |
|
| 216 | { |
|
| 217 | return $this->impPercibido; |
|
| 218 | } |
|
| 219 | ||
| 220 | /** |
|
| 221 | * @param float $impPercibido |
|
| 222 | * @return Perception |
|
| 223 | */ |
|
| 224 | public function setImpPercibido($impPercibido) |
|
| 225 | { |
|
| 226 | $this->impPercibido = $impPercibido; |
|
| 227 | return $this; |
|
| 228 | } |
|
| 229 | ||
| 230 | /** |
|
| 231 | * @return float |
|
| 232 | */ |
|
| 233 | public function getImpCobrado() |
|
| 234 | { |
|
| 235 | return $this->impCobrado; |
|
| 236 | } |
|
| 237 | ||
| 238 | /** |
|
| 239 | * @param float $impCobrado |
|
| 240 | * @return Perception |
|
| 241 | */ |
|
| 242 | public function setImpCobrado($impCobrado) |
|
| 243 | { |
|
| 244 | $this->impCobrado = $impCobrado; |
|
| 245 | return $this; |
|
| 246 | } |
|
| 247 | ||
| 248 | /** |
|
| 249 | * @return string |
|
| 250 | */ |
|
| 251 | public function getMoneda() |
|
| 252 | { |
|
| 253 | return $this->moneda; |
|
| 254 | } |
|
| 255 | ||
| 256 | /** |
|
| 257 | * @param string $moneda |
|
| 258 | * @return Perception |
|
| 259 | */ |
|
| 260 | public function setMoneda($moneda) |
|
| 261 | { |
|
| 262 | $this->moneda = $moneda; |
|
| 263 | return $this; |
|
| 264 | } |
|
| 265 | ||
| 266 | /** |
|
| 267 | * @return string |
|
| 268 | */ |
|
| 269 | public function getObservacion() |
|
| 270 | { |
|
| 271 | return $this->observacion; |
|
| 272 | } |
|
| 273 | ||
| 274 | /** |
|
| 275 | * @param string $observacion |
|
| 276 | * @return Perception |
|
| 277 | */ |
|
| 278 | public function setObservacion($observacion) |
|
| 279 | { |
|
| 280 | $this->observacion = $observacion; |
|
| 281 | return $this; |
|
| 282 | } |
|
| 283 | ||
| 284 | /** |
|
| 285 | * @return PerceptionDetail[] |
|
| 286 | */ |
|
| 287 | public function getDetails() |
|
| 288 | { |
|
| 289 | return $this->details; |
|
| 290 | } |
|
| 291 | ||
| 292 | /** |
|
| 293 | * @param PerceptionDetail[] $details |
|
| 294 | * @return Perception |
|
| 295 | */ |
|
| 296 | public function setDetails($details) |
|
| 297 | { |
|
| 298 | $this->details = $details; |
|
| 299 | return $this; |
|
| 300 | } |
|
| 301 | ||
| 302 | /** |
|
| 303 | * Get FileName without extension. |
|
| 304 | * |
|
| 305 | * @param string $ruc Ruc de la Empresa. |
|
| 306 | * @return string |
|
| 307 | */ |
|
| 308 | public function getFileName($ruc) |
|
| 309 | { |
|
| 310 | $parts = [ |
|
| 311 | $ruc, |
|
| 312 | '40', |
|
| 313 | $this->getSerie(), |
|
| 314 | $this->getCorrelativo(), |
|
| 315 | ]; |
|
| 316 | ||
| 317 | return join('-', $parts); |
|
| 318 | } |
|
| 319 | } |
|