-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from josemmo/develop
v1.7.5
- Loading branch information
Showing
11 changed files
with
340 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Rectificativas | ||
parent: Propiedades de una factura | ||
nav_order: 9 | ||
permalink: /propiedades/rectificativas.html | ||
--- | ||
|
||
# Facturas rectificativas | ||
Por defecto, todos los documentos generados con la librería son facturas originales. Para generar una factura original | ||
**rectificativa** se deben añadir una serie de propiedades adicionales a través del método `$fac->setCorrective()`: | ||
```php | ||
$fac->setCorrective(new CorrectiveDetails([ | ||
// Serie y número de la factura a rectificar | ||
"invoiceSeriesCode" => "EMP201712", | ||
"invoiceNumber" => "0002", | ||
|
||
// Código del motivo de la rectificación según: | ||
// - RD 1496/2003 (del "01" al 16") | ||
// - Art. 80 Ley 37/92 (del "80" al "85") | ||
"reason" => "01", | ||
|
||
// Periodo de tributación de la factura a rectificar | ||
"taxPeriodStart" => "2017-10-01", | ||
"taxPeriodEnd" => "2017-10-31", | ||
|
||
// Modo del criterio empleado para la rectificación | ||
"correctionMethod" => CorrectiveDetails::METHOD_FULL | ||
])); | ||
``` | ||
|
||
Las razones (valores de `reason`) admitidas en la especificación de FacturaE son: | ||
|
||
- `01`: Número de la factura | ||
- `02`: Serie de la factura | ||
- `03`: Fecha expedición | ||
- `04`: Nombre y apellidos/Razón Social-Emisor | ||
- `05`: Nombre y apellidos/Razón Social-Receptor | ||
- `06`: Identificación fiscal Emisor/obligado | ||
- `07`: Identificación fiscal Receptor | ||
- `08`: Domicilio Emisor/Obligado | ||
- `09`: Domicilio Receptor | ||
- `10`: Detalle Operación | ||
- `11`: Porcentaje impositivo a aplicar | ||
- `12`: Cuota tributaria a aplicar | ||
- `13`: Fecha/Periodo a aplicar | ||
- `14`: Clase de factura | ||
- `15`: Literales legales | ||
- `16`: Base imponible | ||
- `80`: Cálculo de cuotas repercutidas | ||
- `81`: Cálculo de cuotas retenidas | ||
- `82`: Base imponible modificada por devolución de envases / embalajes | ||
- `83`: Base imponible modificada por descuentos y bonificaciones | ||
- `84`: Base imponible modificada por resolución firme, judicial o administrativa | ||
- `85`: Base imponible modificada cuotas repercutidas no satisfechas. Auto de declaración de concurso | ||
|
||
Los distintos modos de rectificación (valores de `correctionMethod`) se definen en las [constantes del anexo](../anexos/constantes.html#modos-de-rectificación). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<?php | ||
namespace josemmo\Facturae; | ||
|
||
class CorrectiveDetails { | ||
const METHOD_FULL = "01"; | ||
const METHOD_DIFFERENCES = "02"; | ||
const METHOD_VOLUME_DISCOUNT = "03"; | ||
const METHOD_AEAT_AUTHORIZED = "04"; | ||
|
||
/** | ||
* Invoice number | ||
* @var string|null | ||
*/ | ||
public $invoiceNumber = null; | ||
|
||
/** | ||
* Invoice series code | ||
* @var string|null | ||
*/ | ||
public $invoiceSeriesCode = null; | ||
|
||
/** | ||
* Reason | ||
* @var string | ||
*/ | ||
public $reason = "01"; | ||
|
||
/** | ||
* Reason description | ||
* | ||
* NOTE: Using a custom value might yield a non-compliant invoice. | ||
* | ||
* @var string|null | ||
*/ | ||
public $reasonDescription = null; | ||
|
||
/** | ||
* Start of tax period (as UNIX timestamp or parseable date string) | ||
* @var string|int|null | ||
*/ | ||
public $taxPeriodStart = null; | ||
|
||
/** | ||
* End of tax period (as UNIX timestamp or parseable date string) | ||
* @var string|int|null | ||
*/ | ||
public $taxPeriodEnd = null; | ||
|
||
/** | ||
* Correction method | ||
* @var string | ||
*/ | ||
public $correctionMethod = self::METHOD_FULL; | ||
|
||
/** | ||
* Correction method description | ||
* | ||
* NOTE: Using a custom value might yield a non-compliant invoice. | ||
* | ||
* @var string|null | ||
*/ | ||
public $correctionMethodDescription = null; | ||
|
||
/** | ||
* Class constructor | ||
* @param array $properties Corrective details properties as an array | ||
*/ | ||
public function __construct($properties=array()) { | ||
foreach ($properties as $key=>$value) { | ||
$this->{$key} = $value; | ||
} | ||
} | ||
|
||
/** | ||
* Get reason description | ||
* @return string Reason description | ||
*/ | ||
public function getReasonDescription() { | ||
// Use custom value if available | ||
if ($this->reasonDescription !== null) { | ||
return $this->reasonDescription; | ||
} | ||
|
||
// Fallback to default value per specification | ||
switch ($this->reason) { | ||
case "01": | ||
return "Número de la factura"; | ||
case "02": | ||
return "Serie de la factura"; | ||
case "03": | ||
return "Fecha expedición"; | ||
case "04": | ||
return "Nombre y apellidos/Razón Social-Emisor"; | ||
case "05": | ||
return "Nombre y apellidos/Razón Social-Receptor"; | ||
case "06": | ||
return "Identificación fiscal Emisor/obligado"; | ||
case "07": | ||
return "Identificación fiscal Receptor"; | ||
case "08": | ||
return "Domicilio Emisor/Obligado"; | ||
case "09": | ||
return "Domicilio Receptor"; | ||
case "10": | ||
return "Detalle Operación"; | ||
case "11": | ||
return "Porcentaje impositivo a aplicar"; | ||
case "12": | ||
return "Cuota tributaria a aplicar"; | ||
case "13": | ||
return "Fecha/Periodo a aplicar"; | ||
case "14": | ||
return "Clase de factura"; | ||
case "15": | ||
return "Literales legales"; | ||
case "16": | ||
return "Base imponible"; | ||
case "80": | ||
return "Cálculo de cuotas repercutidas"; | ||
case "81": | ||
return "Cálculo de cuotas retenidas"; | ||
case "82": | ||
return "Base imponible modificada por devolución de envases / embalajes"; | ||
case "83": | ||
return "Base imponible modificada por descuentos y bonificaciones"; | ||
case "84": | ||
return "Base imponible modificada por resolución firme, judicial o administrativa"; | ||
case "85": | ||
return "Base imponible modificada cuotas repercutidas no satisfechas. Auto de declaración de concurso"; | ||
} | ||
return ""; | ||
} | ||
|
||
/** | ||
* Get correction method description | ||
* @return string Correction method description | ||
*/ | ||
public function getCorrectionMethodDescription() { | ||
// Use custom value if available | ||
if ($this->correctionMethodDescription !== null) { | ||
return $this->correctionMethodDescription; | ||
} | ||
|
||
// Fallback to default value per specification | ||
switch ($this->correctionMethod) { | ||
case self::METHOD_FULL: | ||
return "Rectificación íntegra"; | ||
case self::METHOD_DIFFERENCES: | ||
return "Rectificación por diferencias"; | ||
case self::METHOD_VOLUME_DISCOUNT: | ||
return "Rectificación por descuento por volumen de operaciones durante un periodo"; | ||
case self::METHOD_AEAT_AUTHORIZED: | ||
return "Autorizadas por la Agencia Tributaria"; | ||
} | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.