Skip to content

Fresh-Advance/Invoice

Repository files navigation

PDF Invoice module for OXID eShop

Development Latest Version PHP Version

Quality Gate Status Coverage Technical Debt

Features

  • Adjustable invoice pages margins
  • Adjustable invoice pages header and footer (images are possible in inlined CSS)
  • Invoice numbering automation (uses the order's oxbillnr field)
  • Several fields are adjustable before invoice generation:
    • Invoice number template (or number itself, if number automation is not used)
    • Invoice date (with configurable format for automatic calculation)
    • Invoice signer person
  • PDF Invoice file generated in shop Default language
    • Currently we have DE, EN and LT translations available. Feel free to add yours.
  • PDF Invoice can be automatically generated and attached to order confirmation email
    • Invoice filename configurable through settings
  • Total sum shown in words in the invoice.
  • Only Twig shop installations supported
  • Tested with:
    • Shop 7.0 - PHP 8.0, 8.1, MySQL 5.7 and 8.0
    • Shop 7.1 - PHP 8.1, 8.2, MySQL 5.7 and 8.0
    • Shop 7.2 - PHP 8.2, 8.3, MySQL 5.7 and 8.0

Branch compatibility

  • Branch b-7.0.x is compatible with OXID Shop compilation 7.0.0-rc.2 and up
  • Branch b-7.1.x is compatible with OXID Shop compilation 7.1.0 and up

What to expect in next versions

  • Possibility to automatically generate and send the invoice with order confirmation email
  • Show Vat for every product in list
  • The Credit note issuing functionality
  • Possibility to send generated invoice or credit note by email with button click.
  • Other improvements? (feel free to ask in Issues section for possible additional functions)

Installation

Module is available on packagist and installable via composer

composer require fresh-advance/invoice

Development installation

To be able running the tests and other preconfigured quality tools, please install the module as a root package.

The next section shows how to install the module as a root package by using the Fresh Advance Development Base.

In case of different environment usage, please adjust by your own needs.

Development installation on Fresh Advance Development Base

The installation instructions below are shown for the current Fresh Advance Development Base for shop 7.0. Make sure your system meets the requirements of the Development Base.

  1. Ensure all docker containers are down to avoid port conflicts

  2. Clone the SDK for the new project

echo MyProject && git clone https://github.com/Fresh-Advance/development.git $_ && cd $_
  1. Clone the repository to the source directory
git clone --recurse-submodules https://github.com/Fresh-Advance/Invoice.git --branch=b-7.1.x ./source
  1. Run the recipe to setup the development environment
./source/recipes/setup-development.sh

You should be able to access the shop with http://localhost.local and the admin panel with http://localhost.local/admin (credentials: noreply@oxid-esales.com / admin)

Running the tests and quality tools

Check the "scripts" section in the composer.json file for the available commands. Those commands can be executed by connecting to the php container and running the command from there, example:

make php
composer tests-coverage

Commands can be also triggered directly on the container with docker compose, example:

docker compose exec -T php composer tests-coverage

## Overwriting the template

For customizing the template, start from creating the template extension in your module
`views/twig/extensions/modules/fa_invoice/invoice/body.html.twig` with example content:

```twig
{% extends '@fa_invoice/invoice/body.html.twig' %}

{% block fa_invoice_invoice_body_order_number %}
    <div id="number">example overwrite</div>
{% endblock %}

Next, check the original template, and overwrite the blocks you need.

Troubles during overwrite?

If overwrite doesnt work: first, clear the cache; second, might be the issue with module loading order. If so, create the file var/configuration/shops/1/template_extension_chain.yaml with content:

'@fa_invoice/invoice/body.html.twig':
  - oe_moduletemplate(please put your module id instead of the module template example)

More information you might need for the template

The order variable in the template is the Order model object, so you can access all its fields and methods.

Some examples you might need for achieving the desired result:

  • Customer number: {{ order.getOrderUser().getFieldData('oxcustnr') }}
  • Payment method: {{ order.getPaymentType().oxpayments__oxdesc.value }}
  • Order net sum: {{ order.getOrderNetSum() }}

License

Please make sure you checked the License before using the module. License subscription can be bought on MB Arbatos Klubas website