Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Add pre-tax variable to $subtotals at PDF Invoice #23031

    dennker
    Participant

    Hi cocacoola,

    yep, i managed to develop a working solution. At first i fixed psycho0verload’s code, guess just like you did, but on invoices with more than 1 page it just went blank or threw some other errors. Maybe you can check?

    I then went for a more ‘raw’ approach and changed the built.js directly. As calulations weren’t possible with the normal variables i parsed them and made my own.. Then just style them like formatMoneyInvoice normally does.

    		var total_float = parseFloat(invoice.subtotal_amount).toFixed(2);
    		var tax_float = parseFloat(invoice.tax_amount1).toFixed(2);
    		var true_netto = (total_float - tax_float).toFixed(2).replace(".", ",");
    		true_netto += " €";
    

    Display with

            data.push([{
                        text: "Netto",
                        style: ["subtotalsLabel", "tax1Label"]
                    }, {
                        text: true_netto,
                        style: ["subtotals", "tax1"]
                    }
                ])
        }
    

    Using subtotal_amount works indeed well without any refresh or having the invoice amount change upon payment.
    I also removed any other unnessecary code from the whole subtotals function, so just Netto, Tax and Brutto.

    Text me when you need any help with getting it running, i spend some good amount of time figuring it out.
    Invoice Ninja is great, but has a few but severe flaws for european users..

    Greetings
    dennker

    • This reply was modified 3 months ago by  dennker.
    in reply to: Add pre-tax variable to $subtotals at PDF Invoice #22880

    dennker
    Participant

    20 hours of trial & error, no solution here. I set up another installation with just the custom code from Github. I displays “Netto: ” but the displayed value is just the negative of my inclusive tax amount!

    I guess the variable invoice.amount in “var netto = invoice.amount – invoice.tax_amount1 – invoice.tax_amount2;” is zero so it becomes negative?

    Also pdf.pdfmake.js doesn’t seem to change anything, it’s all in built.js? /update or ?clear_cache don’t seem to start the build..

    Is there anybody able to help me? I’m offering some bucks via PayPal for a working solution.

    in reply to: Add pre-tax variable to $subtotals at PDF Invoice #22853

    dennker
    Participant

    Hello psycho0verlord,

    i do have the exact same need for a netto variable. I replaced my code with the one from your git, but i can’t get it to work.
    Using $netto in a custom design just returns nothing and it’s also not added to $subtotals.

    How do i use it?

    Thank you very much for your efforts.


    dennker
    Participant

    Hello Titanfail,

    thanks for your input.

    Using your info and invoiceninja.com/forums/topic/number-formatting-invoice/, i nearly got everything to work. I am able to change the texts without altering the localisation.

    However i still didn’t get the netto value to work. I found this Thread which is exactly what i need, but so far it’s not working as intended. I will ask the author in the respectively thread for more information.

    I guess i’ll come back to this when i put everything sucessfully together and make some sort of How-To for our fellow EU users.

    Greets

Viewing 4 posts - 1 through 4 (of 4 total)

Posted in: