Skip to content

Commit

Permalink
Merge pull request #22 from horstoeko/validation150
Browse files Browse the repository at this point in the history
Move to Kosit Validation Tool 1.5.0 with Config for XRechnung 3.0
  • Loading branch information
horstoeko authored Sep 12, 2023
2 parents d63c94e + ef6c00f commit e23117b
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 13 deletions.
28 changes: 16 additions & 12 deletions build.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<project name="php-automate-build-ant" default="full-build" basedir=".">
<!-- By default the tools are managed by Composer in ${basedir}/vendor/bin -->
<property name="url.composer.download" value="https://getcomposer.org/download/2.2.6/composer.phar"/>
<property name="url.validator.download" value="https://github.com/itplr-kosit/validator/releases/download/v1.4.0/validationtool-1.4.0.zip"/>
<property name="url.validator.scenarios.download" value="https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2020-07-31/validator-configuration-xrechnung_2.0.0_2020-07-31.zip"/>
<property name="url.validator.download" value="https://github.com/itplr-kosit/validator/releases/download/v1.5.0/validator-1.5.0-distribution.zip"/>
<property name="url.validator.scenarios.download" value="https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2023-07-31/validator-configuration-xrechnung_3.0.0_2023-07-31.zip"/>
<property name="url.phpdocumentor.download" value="https://phpdoc.org/phpDocumentor.phar"/>
<property name="validatorzipdir" value="${basedir}/build/validator"/>
<property name="validatorconfigzipdir" value="${basedir}/build/validator"/>
Expand Down Expand Up @@ -309,17 +309,19 @@
<arg path="${validatorconfigzipdir}"/>
</exec>
<echo message="Unpacked."/>
<!-- XRechnung 2.0 -->
<echo message="Creating XRechnung 2.0..."/>
<!-- XRechnung 3.0 -->
<echo message="Creating XRechnung 3.0..."/>
<exec executable="php" dir="${basedir}/examples" failonerror="true">
<arg value="-f"/>
<arg path="./examples/XRechnung2SimpleQuick.php"/>
<arg path="./examples/XRechnung3SimpleQuick.php"/>
</exec>
<echo message="Created XRechnung 2.0."/>
<!-- Validate XRechnugn 2.0 -->
<exec executable="java" resultproperty="result.schematron.xrechnung">
<echo message="Created XRechnung 3.0."/>
<!-- Validate XRechnugn 3.0 -->
<exec executable="java" resultproperty="result.schematron.xrechnung" failonerror="false">
<arg value="-jar"/>
<arg path="${basedir}/build/validator/validationtool-1.4.0-standalone.jar"/>
<arg path="${basedir}/build/validator/validationtool-1.5.0-standalone.jar"/>
<arg value="-r"/>
<arg path="${basedir}/build/validator/"/>
<arg value="-s"/>
<arg path="${basedir}/build/validator/scenarios.xml"/>
<arg path="${basedir}/examples/factur-x.xml"/>
Expand All @@ -331,10 +333,12 @@
<arg path="./examples/En16931SimpleQuick.php"/>
</exec>
<echo message="Created EN16931."/>
<!-- Validate XRechnugn 2.0 -->
<exec executable="java" resultproperty="result.schematron.en16931">
<!-- Validate EN16931 -->
<exec executable="java" resultproperty="result.schematron.en16931" failonerror="false">
<arg value="-jar"/>
<arg path="${basedir}/build/validator/validationtool-1.4.0-standalone.jar"/>
<arg path="${basedir}/build/validator/validationtool-1.5.0-standalone.jar"/>
<arg value="-r"/>
<arg path="${basedir}/build/validator/"/>
<arg value="-s"/>
<arg path="${basedir}/build/validator/scenarios.xml"/>
<arg path="${basedir}/examples/factur-x.xml"/>
Expand Down
45 changes: 45 additions & 0 deletions examples/XRechnung3Simple.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

use horstoeko\zugferd\ZugferdDocumentBuilder;
use horstoeko\zugferd\ZugferdProfiles;
use horstoeko\zugferd\codelists\ZugferdPaymentMeans;

require getcwd() . "/../vendor/autoload.php";

$document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_3);
$document
->setDocumentInformation("471102", "380", \DateTime::createFromFormat("Ymd", "20180305"), "EUR")
->addDocumentNote('Rechnung gemäß Bestellung vom 01.03.2018.')
->addDocumentNote('Lieferant GmbH' . PHP_EOL . 'Lieferantenstraße 20' . PHP_EOL . '80333 München' . PHP_EOL . 'Deutschland' . PHP_EOL . 'Geschäftsführer: Hans Muster' . PHP_EOL . 'Handelsregisternummer: H A 123' . PHP_EOL . PHP_EOL, null, 'REG')
->setDocumentSupplyChainEvent(\DateTime::createFromFormat('Ymd', '20180305'))
->addDocumentPaymentMean(ZugferdPaymentMeans::UNTDID_4461_58, null, null, null, null, null, "DE12500105170648489890", null, null, null)
->setDocumentSeller("Lieferant GmbH", "549910")
->addDocumentSellerGlobalId("4000001123452", "0088")
->addDocumentSellerTaxRegistration("FC", "201/113/40209")
->addDocumentSellerTaxRegistration("VA", "DE123456789")
->setDocumentSellerAddress("Lieferantenstraße 20", "", "", "80333", "München", "DE")
->setDocumentSellerContact("Heinz Mükker", "Buchhaltung", "+49-111-2222222", "+49-111-3333333","[email protected]")
->setDocumentBuyer("Kunden AG Mitte", "GE2020211")
->setDocumentBuyerReference("34676-342323")
->setDocumentBuyerAddress("Kundenstraße 15", "", "", "69876", "Frankfurt", "DE")
->addDocumentTax("S", "VAT", 275.0, 19.25, 7.0)
->addDocumentTax("S", "VAT", 198.0, 37.62, 19.0)
->setDocumentSummation(529.87, 529.87, 473.00, 0.0, 0.0, 473.00, 56.87, null, 0.0)
->addDocumentPaymentTerm("Zahlbar innerhalb 30 Tagen netto bis 04.04.2018, 3% Skonto innerhalb 10 Tagen bis 15.03.2018")
->addNewPosition("1")
->setDocumentPositionNote("Bemerkung zu Zeile 1")
->setDocumentPositionProductDetails("Trennblätter A4", "", "TB100A4")
->setDocumentPositionGrossPrice(9.9000)
->setDocumentPositionNetPrice(9.9000)
->setDocumentPositionQuantity(20, "H87")
->addDocumentPositionTax('S', 'VAT', 19)
->setDocumentPositionLineSummation(198.0)
->addNewPosition("2")
->setDocumentPositionNote("Bemerkung zu Zeile 2")
->setDocumentPositionProductDetails("Joghurt Banane", "", "ARNR2", null, "0160", "4000050986428")
->SetDocumentPositionGrossPrice(5.5000)
->SetDocumentPositionNetPrice(5.5000)
->SetDocumentPositionQuantity(50, "H87")
->AddDocumentPositionTax('S', 'VAT', 7)
->SetDocumentPositionLineSummation(275.0)
->writeFile(getcwd() . "/factur-x.xml");
31 changes: 31 additions & 0 deletions examples/XRechnung3SimpleQuick.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use horstoeko\zugferd\quick\ZugferdQuickDescriptorXRechnung3;
use horstoeko\zugferd\codelists\ZugferdTextSubjectCodeQualifiers;

require getcwd() . "/../vendor/autoload.php";

$document = (ZugferdQuickDescriptorXRechnung3::doCreateNew())
->doCreateInvoice("471102", \DateTime::createFromFormat("Ymd", "20180305"), "EUR")
->doSetPaymentTerms("Zahlbar sofort", new \DateTime('+3 days'))
->doAddNote('Rechnung gemäß Bestellung vom 01.03.2018.')
->doAddNote('Lieferant GmbH' . PHP_EOL . 'Lieferantenstraße 20' . PHP_EOL . '80333 München' . PHP_EOL . 'Deutschland' . PHP_EOL . 'Geschäftsführer: Hans Muster' . PHP_EOL . 'Handelsregisternummer: H A 123' . PHP_EOL . PHP_EOL, ZugferdTextSubjectCodeQualifiers::UNTDID_4451_REG)
->doSetBuyer("Kunden AG Mitte", "69876", "Frankfurt", "Lieferantenstraße 20", "DE", "34676-342323")
->doSetBuyerContact("Hans Miller")
->doSetSeller("Lieferant GmbH", "80333", "München", "Lieferantenstraße 20", "DE", null, "4000001123452", "0088")
->doAddSellerTaxRegistration("FC", "201/113/40209")
->doAddSellerTaxRegistration("VA", "DE123456789")
->doSetSellerContact("Horst Meier", null, "[email protected]", "+49-0000-8888888")
->doAddTradeLineItem("1", "Zitronensäure 100ml", 1.0, 100.0, "H87", 0.0, "", "S", "VAT", 19.0)
->doAddTradeLineItem("2", "Gelierzucker Extra 250g", 1.45, 50.0, "H87", 0.0, "", "S", "VAT", 7.0)
->doAddTradeLineItem("3", "Gelierzucker Extra 250g", 0.0, 10.0, "H87", 0.0, "", "S", "VAT", 7.0)
->doSetDocumentPositionNote("Artikel wie vereinbart ohne Berechnung")
->doAddTradeLineItem("4", "Bierbrau Pils 20/0500", 12.0, 15.0, "XBC", 0.0, "", "S", "VAT", 19.0)
->doAddTradeLineItem("5", "Leergutpfand 20 x 0,5l", 3.10, 15.0, "C62", 0.0, "", "S", "VAT", 19.0)
->doAddTradeLineItem("6", "Mischpalette Joghurt Karton 3 x 20", 29.10, 2.0, "C62", 0.0, "", "S", "VAT", 7.0)
->doSetPaymentMeansForCreditTransfer(true, "DE12500105170648489890")
->doAddTradeAllowanceCharge(-5.60, "Rechnungsrabatt 1", "S", "VAT", 19.0)
->doAddTradeAllowanceCharge(-2.61, "Rechnungsrabatt 1", "S", "VAT", 7.0)
->doAddTradeAllowanceCharge(-2.50, "Rechnungsrabatt 2", "S", "VAT", 19.0)
->doAddTradeAllowanceCharge(-0.50, "Rechnungsrabatt 2", "S", "VAT", 7.0)
->writeFile(getcwd() . "/factur-x.xml");
2 changes: 1 addition & 1 deletion src/quick/ZugferdQuickDescriptorXRechnung2.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class ZugferdQuickDescriptorXRechnung2 extends ZugferdQuickDescriptor
*/
protected static function getProfile(): int
{
return ZugferdProfiles::PROFILE_XRECHNUNG_2;
return ZugferdProfiles::PROFILE_XRECHNUNG_2_3;
}
}
33 changes: 33 additions & 0 deletions src/quick/ZugferdQuickDescriptorXRechnung3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* This file is a part of horstoeko/zugferd.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace horstoeko\zugferd\quick;

use horstoeko\zugferd\ZugferdProfiles;
use horstoeko\zugferd\quick\ZugferdQuickDescriptor;

/**
* Class representing the document descriptor for outgoing documents in XRECHNUNG 2.x profile
*
* @category Zugferd
* @package Zugferd
* @author D. Erling <[email protected]>
* @license https://opensource.org/licenses/MIT MIT
* @link https://github.com/horstoeko/zugferd
*/
class ZugferdQuickDescriptorXRechnung3 extends ZugferdQuickDescriptor
{
/**
* @inheritDoc
*/
protected static function getProfile(): int
{
return ZugferdProfiles::PROFILE_XRECHNUNG_3;
}
}

0 comments on commit e23117b

Please sign in to comment.