Ucodice Technologies
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.

How to modify dolibarr invoice

Recently had to make amendments in dolibarr CRM Invoice design & text.

 

At first galance it seems that it is going to be too hard for me to manage this.

 

After some research on internet I came to know that there are 2 ways to change Invoice.

 

First option - Changing Odt file.
Second option - Changing the php code directly.

 

Being a PHP Professional I have chosen php way.  

 

I have learnt a lot of things that can be modified easyly so I thought to inform others who are willing to change the dolibarr invoice too. You may follow below steps to edit invoice.

 

All you need to make changes in 1 php file by going to:

/public_html/db/core/modules/facture/doc/pdf_crabe.modules.php

--------------------------------------------------------------------------------

 

 

How to change date format in dolibarr invoice

 

First change that I made is changed the Date format of Invoice from MM/DD/YYYY to DD/MM/YYYY

 

To do so I have defined my own function

 

function _changeDateFormat($str)
{
    $str=explode("/", $str);
    $str2=$str[1]."/".$str[0]."/".$str[2];
    return $str2;
}

 

Then I have replaced below line & added my defined function with date output:

 

$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateInvoice")." : " . $this->_changeDateFormat(dol_print_date($object->date,"day",false,$outputlangs)), '', 'R');


----------------------------------------------------------------------------------

 

 

How to change a particular text in dolibarr invoice?

 

Anything written between transnoentities "$outputlangs->transnoentities" is the output that is going to print.  
You can identify the correct text & replace that.


----------------------------------------------------------------------------------

 

 

How to insert new text in dolibarr invoice?

 

You can use below method to insert any text.

 

$pdf->MultiCell($widthrecbox, 5, "Your Text Here",0,'L');

----------------------------------------------------------------------------------

 

 

How to set font size in dolibarr invoice?

 

To change the font size of text in dolibarr invoice you can use setFont methode

 

$pdf->SetFont('','', $default_font_size - 1);

 

You can plus & minus the number above as per your desired size.

---------------------------------------------------------------

 

 

How to draw rectangle in dolibarr Invoice?

 

You can also draw rectange in dolibarr invoice using below.

 

$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);

 

First parameter is x cordinates
Second parameter is y cordinates
Third parameter is rectange width
Fourth parameter is rectange height

---------------------------------------------------------------

 

How to set postion in dolibarr invoice?

 

$pdf->SetXY($posx+2,$posy-5);

---------------------------------------------------------------

 

 

How to fill color in particular area of dolibarr invoice?

 

$pdf->SetFillColor(224,224,224);

 

Value is in RGB format.

---------------------------------------------------------------

 

 

How you can set text color in dolibarr invoice?

 

$pdf->SetTextColor(0,0,60);

 

Value is in RGB format.

---------------------------------------------------------------

 

 

Ucodice Technologies
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Menu

Comments

  • sebti

    Thank your for this code to customize invoice. How I can change the size of colums in the invoice Thank you in advance

    • sebti
    • 4
  • Ram

    You can create the Rectangular & set its height & width. Example given above.

    • Ram
    • 4
  • sebti

    Thank you Ram,what I need is to change width of colonne priceU.HT and colonne of description.Thank you in advance

    • sebti
    • 4
  • Bhaskar

    how to display tax 2 colum?

    • Bhaskar
    • 4
  • Sai

    How do i change the font size of free text in invoice pdf

    • Sai
    • 4
  • XCC

    Hi, you know how to move the VAT number in the box instead of in the footer

    • XCC
    • 4

Please share your views with us

Check if you want to display your email-id.

Let's collaborate

write to us

contact@ucodice.com

Contact Form