1. We need to edit invoicepdf.tpl
file to achieve the same. The file is responsible for all the invoices PDF file generated.
2. The file can be found at whmcsfolder/templates/{your active template}/invoicepdf.tpl
3. Find the below code (around line number 64)
$pdf->Cell(0, 6, Lang::trans(‘invoicesdatecreated’) . ‘: ‘ . $datecreated, 0, 1, ‘L’, ‘1’);
$pdf->Cell(0, 6, Lang::trans(‘invoicesdatedue’) . ‘: ‘ . $duedate, 0, 1, ‘L’, ‘1’);
4. We need to replace the above code by the following lines of code :
if(!empty($datepaid)){ $pdf->Cell(0, 6, Lang::trans('invoicesdatecreated') . ': ' . $datepaid, 0, 1, 'L', '1'); }else{ $pdf->Cell(0, 6, Lang::trans('invoicesdatecreated') . ': ' . $datecreated, 0, 1, 'L', '1'); $pdf->Cell(0, 6, Lang::trans('invoicesdatedue') . ': ' . $duedate, 0, 1, 'L', '1'); }
5. Save the file.
Done!!