439
edits
(Added Custom tax per product) |
|||
| Line 562: | Line 562: | ||
To do that, you will need the CustomFields Pro module + ProductsEasyAccess. | To do that, you will need the CustomFields Pro module + ProductsEasyAccess. | ||
1- Create a product's custom fields called "custom_tax". Now, using ProductsEasyAccess, you can access this field wherever you wants, either to show it on the Dolibarr's interface (see previous chapter), or in a PDF template, which we will describe below. | 1- Create a product's custom fields called "custom_tax". Now, using ProductsEasyAccess, you can access this field wherever you wants, either to show it on the Dolibarr's interface (see previous chapter), or in a PDF template, which we will describe below. | ||
2- Modify your invoice's PDF template. You first need to load all the products' fields ''before'' the loop over the products' lines. To do this, search for a line like this: | 2- Modify your invoice's PDF template. You first need to load all the products' fields ''before'' the loop over the products' lines. To do this, search for a line like this: | ||
| Line 582: | Line 584: | ||
</source> | </source> | ||
4- You can now use your products' fields in your PDF. To access the custom_tax field, just use: | 4- You can now use your products' fields in your PDF. To access the custom_tax field, just use: | ||
| Line 594: | Line 597: | ||
$pdf->MultiCell(0,3, $object->productslines->$line_product_id->cf_custom_tax, 0, 'L'); | $pdf->MultiCell(0,3, $object->productslines->$line_product_id->cf_custom_tax, 0, 'L'); | ||
</source> | </source> | ||
5- Then, if you want to count the custom tax total and add it to your vat total, you can create a counter inside the for loop we cited in the first step: | 5- Then, if you want to count the custom tax total and add it to your vat total, you can create a counter inside the for loop we cited in the first step: | ||
| Line 619: | Line 623: | ||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc, 0, $outputlangs), $useborder, 'R', 1); | $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc, 0, $outputlangs), $useborder, 'R', 1); | ||
</source> | </source> | ||
Done. This should show your custom tax per product and your total including all custom taxes. | Done. This should show your custom tax per product and your total including all custom taxes. | ||
edits