Hi Dolibarr enthusiastics!
How do you add the third party barcode on documents (proposals, Invoices, Shipment Notes, etc)?
Apprciated!
Hi Dolibarr enthusiastics!
How do you add the third party barcode on documents (proposals, Invoices, Shipment Notes, etc)?
Apprciated!
Hi
You can do it with the module ultimatepdf
I create an example
Regards
Philippe
PR1007-0002.pdf (13 KB)
Hi grandoc,
thank you fro your suggestion. I was wondering whether this can be natively (without use of external modules), and, I wanted to add the BARCODE of the Third Party (Customer) not that of the product!
Thank you
Hi
ultimatepdf can do it also. It works for barecode and QRcode
PROV238.pdf (18 KB)
regards
Philippe
find this code
// Description of product line
if ($this->getColumnStatus(‘desc’)) {
if ($object->lines[$i]->special_code != SUBTOTALS_SPECIAL_CODE) {
$this->printColDescContent($pdf, $curY, ‘desc’, $object, $i, $outputlangs, $hideref, $hidedesc);
$this->setAfterColsLinePositionsData(‘desc’, $pdf->GetY(), $pdf->getPage());
after this add
if (!getDolGlobalString(‘MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE’) && !empty($this->getBarcode($object->lines[$i]->fk_product))) {
$code = $this->getBarcode($object->lines[$i]->fk_product);
$barcodeType = ‘C128’;
$pdf->setXY($this->getColumnContentXStart(‘desc’),$curY + 15);
//$pdf->write2DBarcode($code, ‘QRCODE,M’, $this->getColumnContentXStart(‘desc’) , $curY + 15, 20, 20, $styleQr, ‘N’);
$pdf->write1DBarcode($code, $barcodeType, $this->getColumnContentXStart(‘desc’) , $curY + 13, 70, 10, 0.4, array(‘position’=>‘S’, ‘border’=>false, ‘padding’=>1, ‘fgcolor’=>array(0,0,0), ‘text’=>false, ‘font’=>‘helvetica’, ‘fontsize’=>8, ‘stretchtext’=>2), ‘N’);
$this->setAfterColsLinePositionsData(‘desc’, $nexY, $pdf->getPage());
$this->setAfterColsLinePositionsData(‘desc’, $pdf->GetY(), $pdf->getPage());
}
and place this code to get product barcode data outside this function
public function getBarcode($id)
{
$sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE rowid = ".((int) $id);
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$row = $this->db->fetch_row($resql);
$result = $row[0];
}
return $result;
}