Giter Club home page Giter Club logo

ubl-invoice's People

Contributors

antal-levente avatar bbrunekreeft avatar brtdv avatar christianvermeulen avatar christopheg avatar homer8173 avatar it-can avatar japsen avatar jorisdebonnet avatar karstennilsen avatar mabjavaid avatar markovic131 avatar p1eterdeboer avatar pjcarly avatar rodehoed avatar stedekay avatar stormyy avatar tgeorgel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ubl-invoice's Issues

Rounding values

Hi,

We are running into a little issue with rounding. We receive invoice data from one application, create a UBL file for it and then forward it to another accounting software.

However, the lineExtensionAmount value for each individual invoice lines will be rounded when serializing the XML (see InvoiceLine#247). Because the data we receive is keeping 4 decimals for quantities and monetary values, this will end up inserting a different value in some invoice lines in the generated UBL.

This results in a different total when you add them all up. That means that the total we pass to Invoice::setLegalMonetaryTotal() will not always match with the sum of each invoice line.

I was trying to find some guidelines on how many decimals are allowed according to the specs, but I could not find any definitive answers. Do you know if it is actually required to restrict these values to 2 decimals according to the standards definition?

Thanks,
Steven

PS: for good measure, some example numbers:

Original	After number_format()
70.4145		70.41
54.1645		54.16
21.6645		21.66
330.4145	330.41
----------------------
476.658		476.64

PHP 8 Support?

Hi, Are there any plans for compatibility with PHP 8?

How to set a unitCode?

Hi!

I am trying to set a unit code on a invoice line, but can't seem to be able to get it right. How can I declare a custom unit code?

What I have so far

$productClassified = (new \NumNum\UBL\ClassifiedTaxCategory())
->setID('S')
->setPercent($response['cota_tva'])
->setTaxScheme($taxScheme);

$productItem = (new \NumNum\UBL\Item())
->setName($val['nume_produs'])
->setClassifiedTaxCategory($productClassified);

$price = (new \NumNum\UBL\Price())
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount($val['pret']);

$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId($val['id_unic'])
->setItem($productItem)
->setPrice($price)
->setInvoicedQuantity($val['cant_aviz'])
->setLineExtensionAmount($val['total_unitar']);

If I try to change this line setUnitCode(\NumNum\UBL\UnitCode::UNIT) with ->setUnitCode($val['unit_m']), nothing happens, every time the value, MON is inserted in the XML. If I try to play with the InvoiceLine.php file (where MON is declared as private $unitCode = 'MON';) I keep getting an error.

Thanks,
Chris

TaxTotal Class doesn't have roundingAmount node

TaxTotal Class doesn't have roundingAmount node, for example:

<cac:TaxTotal>
   <cbc:TaxAmount currencyID="USD">30.00</cbc:TaxAmount>
   <cbc:RoundingAmount currencyID="USD">230.00</cbc:RoundingAmount>
</cac:TaxTotal>

Rounding Amount is a total amount of line item.

Attaching a PDF with binary data

Hi,
I'm trying to attach a file to an ubl file. This works when i have my file locally:

$ublInvoice->setAdditionalDocumentReference(
            (new AdditionalDocumentReference())
            //->setDocumentType('application/pdf')
            ->setAttachment(
                (new Attachment())
                ->setFilePath(
                    getcwd()."/test.pdf"
                )
            )
        );

Now i'm storing my files on amazon s3, i'm using flysystem to store and read my files from amazon.
How do I attach a file without having to pass the path, but instead passing the binary data?

PartyIdentification doesn't have attribute schemeID

In Party Class, the PartyIdentificationID may have an attribute for schemeID, such as:

$writer->write([
    Schema::CAC . 'PartyIdentification' => [
        'name' => Schema::CBC . 'ID',
        'value' => $this->partyIdentificationId,
        'attributes' => [
            'schemeID' => $this->partyIdentificationSchemeId ?? 'OTH'
        ]
    ],
]);

Price tag doesn't have AllowanceCharge on InvoiceLine level

Price tag inside invoiceLine doesn't have AllowanceCharge, for example:

<cac:InvoiceLine>
   ...
   <cac:Price>
        <cbc:PriceAmount currencyID="USD">22.00</cbc:PriceAmount>
        <cac:AllowanceCharge>
            <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
            <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
            <cbc:Amount currencyID="USD">2.00</cbc:Amount>
        </cac:AllowanceCharge>
    </cac:Price>
</cac:InvoiceLine>

Multiple PaymentMeans

Hello!

I am trying to find a way to put multiple payment means in an invoice but I can get it to work. What I am doing wrong?

$supplier_bank_details = (new \NumNum\UBL\FinancialInstitutionBranch())
->setID('Bank Name 1');

$supplier_iban_details = (new \NumNum\UBL\PayeeFinancialAccount())
->setID('IBAN1')
->setFinancialInstitutionBranch($supplier_bank_details);

$supplier_bank_details2 = (new \NumNum\UBL\FinancialInstitutionBranch())
->setID('Bank Name 2');

$supplier_iban_details2 = (new \NumNum\UBL\PayeeFinancialAccount())
->setID('IBAN2')
->setFinancialInstitutionBranch($supplier_bank_details2);

.....

$supplier_payment_means = (new \NumNum\UBL\PaymentMeans())
->setPaymentMeansCode(21)
->setPayeeFinancialAccount($supplier_iban_details);

$supplier_payment_means2 = (new \NumNum\UBL\PaymentMeans())
->setPaymentMeansCode(21)
->setPayeeFinancialAccount($supplier_iban_details2);
.....

$invoice = (new \NumNum\UBL\Invoice())
.....
->setAccountingCustomerParty($clientCompany)
->setPaymentMeans($supplier_payment_means)
->setPaymentMeans($supplier_payment_means2)
->setTaxTotal($taxTotal)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setInvoiceLines($invoiceLines);

there is no ubl extensions

This package to support the UBL 2.1 Invoice? Because exists fields not mapped... for example: UBL Extensions... or do i see bad?

how to use it

Hello Dear

Thanks for the library, but I don't know how to use it!

Any help!

Thanks

Validation error due TaxTotal in InvoiceLine

Using the sample of Version 1.5 to test your wonderful plugin.

The generated file does not pass UBL validation.

https://peppol.helger.com/public/locale-en_US/menuitem-validation-upload
UBL Invoice 2.1

XML Schema - schemas/ubl21/maindoc/UBL-Invoice-2.1.xsd
Error
Location: file:///root/sample.php01.xml(71:18)
Error message: [SAX] cvc-complex-type.2.4.b: The content of element 'cac:TaxTotal' is not complete. One of '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":TaxAmount}' is expected.
Technical details: cvc-complex-type.2.4.b: The content of element 'cac:TaxTotal' is not complete. One of '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":TaxAmount}' is expected.

This is due the presence of a cac:TaxTotal/ tag in InvoiceLine. If I comment out this line the file passes validation.

InvoiceLine.php#L195

        Schema::CAC . 'TaxTotal' => $this->taxTotal,

Is this a bug or did you add that line for a reason please?

Deprecation error composer

On mac os: PHP 7.4.3
composer version: Composer version 1.10.0 2020-03-10 14:08:05

Getting this error...

Deprecation Notice: Class NumNum\UBL\TaxTotal located in ./vendor/num-num/ubl-invoice/src/classes/TaxTotal.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\InvoiceLine located in ./vendor/num-num/ubl-invoice/src/classes/InvoiceLine.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\PaymentTerms located in ./vendor/num-num/ubl-invoice/src/classes/PaymentTerms.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\TaxScheme located in ./vendor/num-num/ubl-invoice/src/classes/TaxScheme.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\SettlementPeriod located in ./vendor/num-num/ubl-invoice/src/classes/SettlementPeriod.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Country located in ./vendor/num-num/ubl-invoice/src/classes/Country.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Address located in ./vendor/num-num/ubl-invoice/src/classes/Address.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\TaxSubTotal located in ./vendor/num-num/ubl-invoice/src/classes/TaxSubTotal.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\LegalMonetaryTotal located in ./vendor/num-num/ubl-invoice/src/classes/LegalMonetaryTotal.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Party located in ./vendor/num-num/ubl-invoice/src/classes/Party.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\ClassifiedTaxCategory located in ./vendor/num-num/ubl-invoice/src/classes/ClassifiedTaxCategory.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Contact located in ./vendor/num-num/ubl-invoice/src/classes/Contact.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\LegalEntity located in ./vendor/num-num/ubl-invoice/src/classes/LegalEntity.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\AllowanceCharge located in ./vendor/num-num/ubl-invoice/src/classes/AllowanceCharge.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\TaxCategory located in ./vendor/num-num/ubl-invoice/src/classes/TaxCategory.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Price located in ./vendor/num-num/ubl-invoice/src/classes/Price.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Invoice located in ./vendor/num-num/ubl-invoice/src/classes/Invoice.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Item located in ./vendor/num-num/ubl-invoice/src/classes/Item.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Schema located in ./vendor/num-num/ubl-invoice/src/classes/Schema.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\PaymentMeans located in ./vendor/num-num/ubl-invoice/src/classes/PaymentMeans.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\AdditionalDocumentReference located in ./vendor/num-num/ubl-invoice/src/classes/AdditionalDocumentReference.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185
Deprecation Notice: Class NumNum\UBL\Attachment located in ./vendor/num-num/ubl-invoice/src/classes/Attachment.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.0/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:185

setUBLVersionID not available in version 1.6.2

While testing the creation of an xml i got the following error:

Call to undefined method NumNum\UBL\Invoice::setUBLVersionID()

I've added the package with composer and it shows i have version: * 1.6.2
Any idea what went wrong?

DocumentType not allowed in AdditionalDocumentReference

Hi,

When using AdditionalDocumentReference for adding an attachment, it also adds the DocumentType xml key. Although it's empty and does not contain anything it's should not be there. It gives the following warning:

[UBL-CR-114]-A UBL invoice should not include the AdditionalDocumentReference DocumentType

So I think it's best to hide that element when it's not set.

Schema::CBC . 'DocumentType' => $this->documentType,

Are you sure that cbc:MultiplierFactorNumeric is restricted to be integer value only?

image

    /**
     * @return int
     */
    public function getMultiplierFactorNumeric(): ?int
    {
        return $this->multiplierFactorNumeric;
    }

    /**
     * @param int $multiplierFactorNumeric
     * @return AllowanceCharge
     */
    public function setMultiplierFactorNumeric(?int $multiplierFactorNumeric): AllowanceCharge
    {
        $this->multiplierFactorNumeric = $multiplierFactorNumeric;
        return $this;
    }

I think it should be a real number. For example, if you have a fixed value discount $35 on an item with net price $456, you have to calculate the corresponding percentage 7.675438596% which is not an integer value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.