Sponge Document Template

We are using “Sponge Document Template” for customer invoice. It will be good not to print Tax information and remaining unpaid if the values are Zero. It will save space of the Invoice. please find attached image

which dolibarr and php version?

Dolibarr - 20.0.2
PHP version - 8.1.31

Would be great if the following logic implemented in the Invoice printing (Tax details)…
If Tax-2 & Tax-3 used then no need to print Tax-1
Since In India either Tax-1 used OR Tax-2 & Tax-3 used.for both Sales and Purchase (All 3 tax are not used anywhere).
Also if Remaining unpaid=0 then need not to print this line (to save the space)
thank you

core/modules/facture/doc/pdf_sponge.modules.php
Inside the class pdf_sponge , locate the method drawTotalTable and find the section that displays the VAT breakdown.

if (!getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) {
    // VAT
    foreach ($this->tva_array as $tvakey => $tvaval) {
        if ($tvakey != 0 || getDolGlobalString('INVOICE_SHOW_ALSO_VAT_LINE_IF_ZERO')) {
            // ... output the line
        }
    }
}

Replace the if condition with one that also checks that the tax amount is not zero:

if (($tvakey != 0 || getDolGlobalString('INVOICE_SHOW_ALSO_VAT_LINE_IF_ZERO')) && $tvaval['amount'] != 0) {
2 Likes

Respected Ghanshyam Parmar

Well Done !!! Great Work!!!

“0” valued tax lines are hided now. The invoice is nice looking and saved printing cost