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
--------------------------------------------------------------------------------
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');
----------------------------------------------------------------------------------
Anything written between transnoentities "$outputlangs->transnoentities" is the output that is going to print.
You can identify the correct text & replace that.
----------------------------------------------------------------------------------
You can use below method to insert any text.
$pdf->MultiCell($widthrecbox, 5, "Your Text Here",0,'L');
----------------------------------------------------------------------------------
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.
---------------------------------------------------------------
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
---------------------------------------------------------------
$pdf->SetXY($posx+2,$posy-5);
---------------------------------------------------------------
$pdf->SetFillColor(224,224,224);
Value is in RGB format.
---------------------------------------------------------------
$pdf->SetTextColor(0,0,60);
Value is in RGB format.
---------------------------------------------------------------
Comments
sebti
Ram
sebti
Bhaskar
Sai
XCC
Let's collaborate
write to us
contact@ucodice.com
PHP
Laravel
Angular
React Native
React JS
Python
Internet of Things (IOT)
Mobile App Development
Website/Software Development
Hire Dedicated Team/Developers
Artificial Intelligence
Customer Support