Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creditmemo needs to refer to origin invoice #325

Open
nige-one opened this issue Jun 13, 2016 · 2 comments
Open

Creditmemo needs to refer to origin invoice #325

nige-one opened this issue Jun 13, 2016 · 2 comments

Comments

@nige-one
Copy link

German law requires the invoice number and invoice date on the creditmemo it's based on.

See here

Die Stornorechnung muss sich eindeutig auf die Ursprungsrechnung beziehen. Anzugeben sind also

  • die ursprüngliche Rechnungsnummer
  • und das Datum der Ausstellung der alten Rechnung.

I will PR this with other things.

@sprankhub
Copy link
Member

Hmm okay, thank you!

Re "with other things": Please make your PRs small. One PR per bugfix / per feature please. This is much easier to check and merge.

@zuiko
Copy link

zuiko commented Sep 28, 2017

I propose to add this information as final note of the creditmemo, adding a little bit of code to:
function _insertNote
in
/app/code/community/FireGento/Pdf/Model/Engine/Abstract.php

if ($mode == 'creditmemo') {
    $i = 0;
    if ($order->hasInvoices()) {
        $invIncrementIDs = '';
        foreach ($order->getInvoiceCollection() as $inv) {
            $i++;
            $invIncrementIDs = Mage::helper('firegento_pdf')->__('Ref. ') . $inv->getIncrementId() . " "
                . Mage::helper('firegento_pdf')->__('issued on ') . date('d-m-Y', strtotime($inv->getCreatedAt()))
                . ' ';
        }
        if ($i === 1) {
            $note = Mage::helper('firegento_pdf')->__('This credit memo refers to the following invoice: ')
                . $invIncrementIDs;
        }
        if ($i > 1) {
            $note = Mage::helper('firegento_pdf')->__('This credit memo refers to the following invoices: ')
                . $invIncrementIDs;
        }
        if (!empty($note)) {
            $tmpNotes = explode("\n", $note);
            $notes    = array_merge($notes, $tmpNotes);
        }
    }
}
// Draw notes on PDF.

The problem is that Magento allows several invoices for one order and, in my mind, a creditmemo is not explicitly related to one of them but only related to the order. Most of the time, only one invoice will appear on the note I propose but sometime it could happen to have more. So, my solution covers the case (with plural in the text to add to FireGento_Pdf.csv) but it's not lawfully perfect. I think it's better than nothing. (In some langages, plural and singular text forms have more differencies than in english).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants