Skip to content

Commit

Permalink
Fix new validations SUNTA - Summary v1,2
Browse files Browse the repository at this point in the history
  • Loading branch information
giansalex committed Dec 2, 2017
1 parent 665fa80 commit 2980d5a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
40 changes: 24 additions & 16 deletions src/Xml/Templates/summary-v2.xml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,30 @@
<cbc:ConditionCode>{{ det.estado }}</cbc:ConditionCode>
</cac:Status>
<sac:TotalAmount currencyID="PEN">{{ det.total|n_format }}</sac:TotalAmount>
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperGravadas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>01</cbc:InstructionID>
</sac:BillingPayment>
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperExoneradas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>02</cbc:InstructionID>
</sac:BillingPayment>
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperInafectas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>03</cbc:InstructionID>
</sac:BillingPayment>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:Amount currencyID="PEN">{{ det.mtoDescuentos|default(0)|n_format }}</cbc:Amount>
</cac:AllowanceCharge>
{% if det.mtoOperGravadas %}
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperGravadas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>01</cbc:InstructionID>
</sac:BillingPayment>
{% endif %}
{% if det.mtoOperExoneradas %}
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperExoneradas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>02</cbc:InstructionID>
</sac:BillingPayment>
{% endif %}
{% if det.mtoOperInafectas %}
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperInafectas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>03</cbc:InstructionID>
</sac:BillingPayment>
{% endif %}
{% if det.mtoOtrosCargos %}
<cac:AllowanceCharge>
<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
<cbc:Amount currencyID="PEN">{{ det.mtoOtrosCargos|n_format }}</cbc:Amount>
</cac:AllowanceCharge>
{% endif %}
{% set igv = det.mtoIGV|n_format %}
<cac:TaxTotal>
<cbc:TaxAmount currencyID="PEN">{{ igv }}</cbc:TaxAmount>
Expand Down
12 changes: 10 additions & 2 deletions src/Xml/Templates/summary.xml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,30 @@
<sac:StartDocumentNumberID>{{ det.docInicio }}</sac:StartDocumentNumberID>
<sac:EndDocumentNumberID>{{ det.docFin }}</sac:EndDocumentNumberID>
<sac:TotalAmount currencyID="PEN">{{ det.total|n_format }}</sac:TotalAmount>
{% if det.mtoOperGravadas %}
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperGravadas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>01</cbc:InstructionID>
</sac:BillingPayment>
{% endif %}
{% if det.mtoOperExoneradas %}
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperExoneradas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>02</cbc:InstructionID>
</sac:BillingPayment>
{% endif %}
{% if det.mtoOperInafectas %}
<sac:BillingPayment>
<cbc:PaidAmount currencyID="PEN">{{ det.mtoOperInafectas|n_format }}</cbc:PaidAmount>
<cbc:InstructionID>03</cbc:InstructionID>
</sac:BillingPayment>
{% endif %}
{% if det.mtoOtrosCargos %}
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:Amount currencyID="PEN">{{ det.mtoDescuentos|default(0)|n_format }}</cbc:Amount>
<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
<cbc:Amount currencyID="PEN">{{ det.mtoOtrosCargos|n_format }}</cbc:Amount>
</cac:AllowanceCharge>
{% endif %}
{% set igv = det.mtoIGV|n_format %}
<cac:TaxTotal>
<cbc:TaxAmount currencyID="PEN">{{ igv }}</cbc:TaxAmount>
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Builder/FeSummaryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function getSummary()
->setMtoOperInafectas(24.4)
->setMtoOperExoneradas(50)
->setMtoOtrosTributos(12.32)
->setMtoDescuentos(5)
->setMtoOtrosCargos(5)
->setMtoIGV(3.6);

$detiail2 = new SummaryDetail();
Expand Down
4 changes: 1 addition & 3 deletions tests/Xml/Builder/FeSummaryV2BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function testCreateXmlSummary()
$summary = $this->getSummary();

$xml = $this->build($summary);

$this->assertNotEmpty($xml);
}

Expand Down Expand Up @@ -60,11 +59,10 @@ private function getSummary()
->setTipoDoc('03')
->setNroDoc('B001-1'))
->setTotal(100)
->setMtoOperGravadas(20.555)
->setMtoOperInafectas(24.4)
->setMtoOperExoneradas(50)
->setMtoOtrosTributos(12.32)
->setMtoDescuentos(5)
->setMtoOtrosCargos(0)
->setMtoIGV(3.6);

$detiail2 = new SummaryDetailV2();
Expand Down

0 comments on commit 2980d5a

Please sign in to comment.