Add pre-tax variable to $subtotals at PDF Invoice

Awesome, glad to hear it!

I want to share my new solution with you. I will put this solution on GitHub (link from above - Branch: Casa-v4. 5. 17)

It is my solution for the application in Germany (I use it for a guesthouse) and the option Inclusive taxes have to enabled.

Rename subtotal to Netto

Works and tested with:

  • Enable specifying an invoice tax
  • Enable specifying line item taxes

Not tested or not intended:

  • Enable specifying a second tax rate
  • Include line item taxes in line total

My changes to “NINJA.subtotals = function(invoice, hideBalance)” in “resources/assets/js/pdf.pdfmake.js” after

    var account = invoice.account;
    var data = [];
    // SECTION Netto-Betrag: Rechnung und Ausgabe
    // NOTE Zwischensumme: deaktivieren
    // data.push([{text: invoiceLabels.subtotal, style: ['subtotalsLabel', 'subtotalLabel']}, {text: formatMoneyInvoice(invoice.subtotal_amount, invoice), style: ['subtotals', 'subtotal']}]);
    // NOTE Netto-Betrag: variable Definieren
    
    var pretax_amount = invoice.subtotal_amount;
    
    // SECTION Rabatt: Ausgabe & Abzug von Netto-Betrag   
    
    if (invoice.discount_amount != 0) {
        // NOTE Rabatt vom Netto-Betrag abziehen
        pretax_amount -= invoice.discount_amount;
        data.push([{text: invoiceLabels.discount , style: ['subtotalsLabel', 'discountLabel']}, {text: formatMoneyInvoice(invoice.discount_amount, invoice), style: ['subtotals', 'discount']}]);
    }

    // !SECTION
    // SECTION Artikel-Steuer: Abzug von Netto-Betrag

    for (var key in invoice.item_taxes) {
        if (invoice.item_taxes.hasOwnProperty(key)) {
            var taxRate = invoice.item_taxes[key];
            pretax_amount -= taxRate.amount;
        }
    }
    // !SECTION
    // SECTION Rechnungssteuer: Abzug vom Netto-Betrag
    if (parseFloat(invoice.tax_rate1 || 0) != 0 || invoice.tax_name1) {
        pretax_amount -= invoice.tax_amount1;
    }
    if (parseFloat(invoice.tax_rate2 || 0) != 0 || invoice.tax_name2) {
        pretax_amount -= invoice.tax_amount2;
    }
    // !SECTION

    // NOTE Ausgabe des echten Netto-Betrags als Zwischensumme
    data.push([{text: invoiceLabels.subtotal, style: ['subtotalsLabel', 'subtotalLabel']}, {text: formatMoneyInvoice(pretax_amount, invoice), style: ['subtotals', 'subtotal']}]);

    // !SECTION

Thanks for sharing!

Hey,

as promised i prepared a report to provide the tax VAT amount from expenses and invoices.
The report was implemented in the following branch
https://github.com/roterBulle/invoiceninja/tree/taxAmountreport

Nice! :slight_smile: