diff --git a/examples/En16931PdfMerger.php b/examples/En16931PdfMerger.php index 588aa11..2da4233 100644 --- a/examples/En16931PdfMerger.php +++ b/examples/En16931PdfMerger.php @@ -2,7 +2,7 @@ use horstoeko\zugferd\ZugferdDocumentPdfMerger; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $pdfMerger = new ZugferdDocumentPdfMerger(dirname(__FILE__) . "/invoice_1.xml", dirname(__FILE__) . "/emptypdf.pdf"); $pdfMerger->generateDocument(); diff --git a/examples/En16931ReaderPdf.php b/examples/En16931ReaderPdf.php index a31ef07..18359c7 100644 --- a/examples/En16931ReaderPdf.php +++ b/examples/En16931ReaderPdf.php @@ -2,7 +2,7 @@ use horstoeko\zugferd\ZugferdDocumentPdfReader; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentPdfReader::readAndGuessFromFile(dirname(__FILE__) . "/invoice_1.pdf"); diff --git a/examples/En16931ReaderPdfWithJsonExport.php b/examples/En16931ReaderPdfWithJsonExport.php index e28931d..9b085af 100644 --- a/examples/En16931ReaderPdfWithJsonExport.php +++ b/examples/En16931ReaderPdfWithJsonExport.php @@ -3,7 +3,7 @@ use horstoeko\zugferd\ZugferdDocumentJsonExporter; use horstoeko\zugferd\ZugferdDocumentPdfReader; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentPdfReader::readAndGuessFromFile(dirname(__FILE__) . "/invoice_1.pdf"); diff --git a/examples/En16931Simple.php b/examples/En16931Simple.php index f635985..6674ab0 100644 --- a/examples/En16931Simple.php +++ b/examples/En16931Simple.php @@ -4,7 +4,7 @@ use horstoeko\zugferd\ZugferdProfiles; use horstoeko\zugferd\codelists\ZugferdPaymentMeans; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_EN16931); $document @@ -47,4 +47,4 @@ ->SetDocumentPositionQuantity(50, "H87") ->AddDocumentPositionTax('S', 'VAT', 7) ->SetDocumentPositionLineSummation(275.0) - ->writeFile(getcwd() . "/factur-x.xml"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/En16931SimpleQuick.php b/examples/En16931SimpleQuick.php index 63dd9f8..9ecf5b0 100644 --- a/examples/En16931SimpleQuick.php +++ b/examples/En16931SimpleQuick.php @@ -3,7 +3,7 @@ use horstoeko\zugferd\quick\ZugferdQuickDescriptorEn16931; use horstoeko\zugferd\codelists\ZugferdTextSubjectCodeQualifiers; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = (ZugferdQuickDescriptorEn16931::doCreateNew()) ->doCreateInvoice("471102", \DateTime::createFromFormat("Ymd", "20180305"), "EUR") @@ -30,4 +30,4 @@ ->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"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/En16931SimpleReader.php b/examples/En16931SimpleReader.php index 799a5f1..5f2bead 100644 --- a/examples/En16931SimpleReader.php +++ b/examples/En16931SimpleReader.php @@ -2,31 +2,22 @@ error_reporting(E_ERROR | E_WARNING | E_PARSE); -use horstoeko\zugferd\exception\ZugferdValidationFailed; use horstoeko\zugferd\ZugferdDocumentReader; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; -try { +$document = ZugferdDocumentReader::readAndGuessFromFile(dirname(__FILE__) . "/../tests/data/en16931_simple.xml", true); - $document = ZugferdDocumentReader::readAndGuessFromFile(dirname(__FILE__) . "/../tests/data/en16931_simple.xml", true); +$document->getDocumentInformation( + $documentno, + $documenttypecode, + $documentdate, + $duedate, + $invoiceCurrency, + $taxCurrency, + $documentname, + $documentlanguage, + $effectiveSpecifiedPeriod +); - $document->getDocumentInformation( - $documentno, - $documenttypecode, - $documentdate, - $duedate, - $invoiceCurrency, - $taxCurrency, - $documentname, - $documentlanguage, - $effectiveSpecifiedPeriod - ); - - echo "The Invoice No. is {$documentno}" . PHP_EOL; - -} catch (ZugferdValidationFailed $e) { - - var_dump($e->getValidationErrorList()); - -} +echo "The Invoice No. is {$documentno}" . PHP_EOL; diff --git a/examples/En16931SimpleToJson.php b/examples/En16931SimpleToJson.php index 16f3371..1725b49 100644 --- a/examples/En16931SimpleToJson.php +++ b/examples/En16931SimpleToJson.php @@ -5,7 +5,7 @@ use horstoeko\zugferd\codelists\ZugferdPaymentMeans; use horstoeko\zugferd\ZugferdDocumentJsonExporter; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_EN16931); $document @@ -48,7 +48,7 @@ ->SetDocumentPositionQuantity(50, "H87") ->AddDocumentPositionTax('S', 'VAT', 7) ->SetDocumentPositionLineSummation(275.0) - ->writeFile(getcwd() . "/factur-x.xml"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); $jsonExporter = new ZugferdDocumentJsonExporter($document); echo $jsonExporter->toPrettyJsonString(); \ No newline at end of file diff --git a/examples/En16931SimpleWithPdf.php b/examples/En16931SimpleWithPdf.php index fe136c0..bef1ee6 100644 --- a/examples/En16931SimpleWithPdf.php +++ b/examples/En16931SimpleWithPdf.php @@ -5,7 +5,7 @@ use horstoeko\zugferd\ZugferdProfiles; use horstoeko\zugferd\codelists\ZugferdPaymentMeans; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_EN16931); $document diff --git a/examples/ExtendedSimpleQuick.php b/examples/ExtendedSimpleQuick.php index aa52aa9..aa85939 100644 --- a/examples/ExtendedSimpleQuick.php +++ b/examples/ExtendedSimpleQuick.php @@ -3,7 +3,7 @@ use horstoeko\zugferd\quick\ZugferdQuickDescriptorExtended; use horstoeko\zugferd\codelists\ZugferdTextSubjectCodeQualifiers; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = (ZugferdQuickDescriptorExtended::doCreateNew()) ->doCreateInvoice("471102", \DateTime::createFromFormat("Ymd", "20180305"), "EUR") @@ -31,4 +31,4 @@ ->doAddTradeAllowanceCharge(-2.50, "Rechnungsrabatt 2", "S", "VAT", 19.0) ->doAddTradeAllowanceCharge(-0.50, "Rechnungsrabatt 2", "S", "VAT", 7.0) ->doAddLogisticsServiceCharge(10.0, "Transportkosten", "VAT", "S", 19.0) - ->writeFile(getcwd() . "/factur-x.xml"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/XRechnung2Simple.php b/examples/XRechnung2Simple.php index f47f73f..846df70 100644 --- a/examples/XRechnung2Simple.php +++ b/examples/XRechnung2Simple.php @@ -4,7 +4,7 @@ use horstoeko\zugferd\ZugferdProfiles; use horstoeko\zugferd\codelists\ZugferdPaymentMeans; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_2); $document @@ -42,4 +42,4 @@ ->SetDocumentPositionQuantity(50, "H87") ->AddDocumentPositionTax('S', 'VAT', 7) ->SetDocumentPositionLineSummation(275.0) - ->writeFile(getcwd() . "/factur-x.xml"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/XRechnung2SimpleQuick.php b/examples/XRechnung2SimpleQuick.php index 86c8e34..7a73317 100644 --- a/examples/XRechnung2SimpleQuick.php +++ b/examples/XRechnung2SimpleQuick.php @@ -3,7 +3,7 @@ use horstoeko\zugferd\quick\ZugferdQuickDescriptorXRechnung2; use horstoeko\zugferd\codelists\ZugferdTextSubjectCodeQualifiers; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = (ZugferdQuickDescriptorXRechnung2::doCreateNew()) ->doCreateInvoice("471102", \DateTime::createFromFormat("Ymd", "20180305"), "EUR") @@ -30,4 +30,4 @@ ->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"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/XRechnung3Simple.php b/examples/XRechnung3Simple.php index c961ec7..577ad51 100644 --- a/examples/XRechnung3Simple.php +++ b/examples/XRechnung3Simple.php @@ -4,7 +4,7 @@ use horstoeko\zugferd\ZugferdProfiles; use horstoeko\zugferd\codelists\ZugferdPaymentMeans; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_3); $document @@ -42,4 +42,4 @@ ->SetDocumentPositionQuantity(50, "H87") ->AddDocumentPositionTax('S', 'VAT', 7) ->SetDocumentPositionLineSummation(275.0) - ->writeFile(getcwd() . "/factur-x.xml"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/XRechnung3SimpleQuick.php b/examples/XRechnung3SimpleQuick.php index 968d234..1df65e6 100644 --- a/examples/XRechnung3SimpleQuick.php +++ b/examples/XRechnung3SimpleQuick.php @@ -3,7 +3,7 @@ use horstoeko\zugferd\quick\ZugferdQuickDescriptorXRechnung3; use horstoeko\zugferd\codelists\ZugferdTextSubjectCodeQualifiers; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = (ZugferdQuickDescriptorXRechnung3::doCreateNew()) ->doCreateInvoice("471102", \DateTime::createFromFormat("Ymd", "20180305"), "EUR") @@ -30,4 +30,4 @@ ->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"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/XRechnungSimple.php b/examples/XRechnungSimple.php index d1733c7..d1d9522 100644 --- a/examples/XRechnungSimple.php +++ b/examples/XRechnungSimple.php @@ -4,7 +4,7 @@ use horstoeko\zugferd\ZugferdProfiles; use horstoeko\zugferd\codelists\ZugferdPaymentMeans; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG); $document @@ -42,4 +42,4 @@ ->SetDocumentPositionQuantity(50, "H87") ->AddDocumentPositionTax('S', 'VAT', 7) ->SetDocumentPositionLineSummation(275.0) - ->writeFile(getcwd() . "/factur-x.xml"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml"); diff --git a/examples/XRechnungSimpleQuick.php b/examples/XRechnungSimpleQuick.php index 2af161e..f298c5d 100644 --- a/examples/XRechnungSimpleQuick.php +++ b/examples/XRechnungSimpleQuick.php @@ -3,7 +3,7 @@ use horstoeko\zugferd\quick\ZugferdQuickDescriptorXRechnung; use horstoeko\zugferd\codelists\ZugferdTextSubjectCodeQualifiers; -require getcwd() . "/../vendor/autoload.php"; +require dirname(__FILE__) . "/../vendor/autoload.php"; $document = (ZugferdQuickDescriptorXRechnung::doCreateNew()) ->doCreateInvoice("471102", \DateTime::createFromFormat("Ymd", "20180305"), "EUR") @@ -30,4 +30,4 @@ ->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"); + ->writeFile(dirname(__FILE__) . "/factur-x.xml");