Hinweistext eingefügt
This commit is contained in:
parent
2950cd9738
commit
6a91888426
@ -40,70 +40,70 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
{
|
||||
/**
|
||||
* @var DoliDb Database handler
|
||||
*/
|
||||
public $db;
|
||||
* @var DoliDb Database handler
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string model name
|
||||
*/
|
||||
public $name;
|
||||
* @var string model name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string model description (short text)
|
||||
*/
|
||||
public $description;
|
||||
* @var string model description (short text)
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string document type
|
||||
*/
|
||||
public $type;
|
||||
* @var string document type
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var array Minimum version of PHP required by module.
|
||||
* e.g.: PHP ≥ 5.5 = array(5, 5)
|
||||
*/
|
||||
/**
|
||||
* @var array Minimum version of PHP required by module.
|
||||
* e.g.: PHP ≥ 5.5 = array(5, 5)
|
||||
*/
|
||||
public $phpmin = array(5, 5);
|
||||
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr';
|
||||
|
||||
/**
|
||||
* @var int page_largeur
|
||||
*/
|
||||
public $page_largeur;
|
||||
* @var int page_largeur
|
||||
*/
|
||||
public $page_largeur;
|
||||
|
||||
/**
|
||||
* @var int page_hauteur
|
||||
*/
|
||||
public $page_hauteur;
|
||||
* @var int page_hauteur
|
||||
*/
|
||||
public $page_hauteur;
|
||||
|
||||
/**
|
||||
* @var array format
|
||||
*/
|
||||
public $format;
|
||||
* @var array format
|
||||
*/
|
||||
public $format;
|
||||
|
||||
/**
|
||||
* @var int marge_gauche
|
||||
*/
|
||||
public $marge_gauche;
|
||||
* @var int marge_gauche
|
||||
*/
|
||||
public $marge_gauche;
|
||||
|
||||
/**
|
||||
* @var int marge_droite
|
||||
*/
|
||||
* @var int marge_droite
|
||||
*/
|
||||
public $marge_droite;
|
||||
|
||||
/**
|
||||
* @var int marge_haute
|
||||
*/
|
||||
* @var int marge_haute
|
||||
*/
|
||||
public $marge_haute;
|
||||
|
||||
/**
|
||||
* @var int marge_basse
|
||||
*/
|
||||
* @var int marge_basse
|
||||
*/
|
||||
public $marge_basse;
|
||||
|
||||
/**
|
||||
@ -117,8 +117,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
public function __construct($db) {
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
// Translations
|
||||
@ -174,22 +173,21 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build pdf onto disk
|
||||
*
|
||||
* @param Object $object Object to generate
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1=OK, 0=KO
|
||||
*/
|
||||
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build pdf onto disk
|
||||
*
|
||||
* @param Object $object Object to generate
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1=OK, 0=KO
|
||||
*/
|
||||
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) {
|
||||
// phpcs:enable
|
||||
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
@ -198,37 +196,29 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
// Load translation files required by the page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries"));
|
||||
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
if ($conf->expedition->dir_output) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
if ($object->specimen) {
|
||||
$dir = $conf->expedition->dir_output."/receipt";
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
}
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
if (! file_exists($dir)) {
|
||||
if (dol_mkdir($dir) < 0) {
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (file_exists($dir)) {
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
if (! is_object($hookmanager)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
@ -241,33 +231,30 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
|
||||
// Create pdf instance
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||
$heightforinfotot = 30; // Height reserved to output the info and total part
|
||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
|
||||
$pdf->SetAutoPageBreak(1, 0);
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||
$heightforinfotot = 30; // Height reserved to output the info and total part
|
||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
|
||||
$pdf->SetAutoPageBreak(1, 0);
|
||||
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
// Set path to the background PDF File
|
||||
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
|
||||
{
|
||||
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
|
||||
$tplidx = $pdf->importPage(1);
|
||||
}
|
||||
if (class_exists('TCPDF')) {
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
// Set path to the background PDF File
|
||||
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
|
||||
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
|
||||
$tplidx = $pdf->importPage(1);
|
||||
}
|
||||
|
||||
// We get the shipment that is the origin of delivery receipt
|
||||
$expedition=new Expedition($this->db);
|
||||
$result = $expedition->fetch($object->origin_id);
|
||||
// Now we get the order that is origin of shipment
|
||||
$commande = new Commande($this->db);
|
||||
if ($expedition->origin == 'commande')
|
||||
{
|
||||
if ($expedition->origin == 'commande') {
|
||||
$commande->fetch($expedition->origin_id);
|
||||
}
|
||||
$object->commande=$commande; // We set order of shipment onto delivery.
|
||||
@ -327,11 +314,9 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
|
||||
// Incoterm
|
||||
$height_incoterms = 0;
|
||||
if ($conf->incoterm->enabled)
|
||||
{
|
||||
if ($conf->incoterm->enabled) {
|
||||
$desc_incoterms = $object->getIncotermsForPDF();
|
||||
if ($desc_incoterms)
|
||||
{
|
||||
if ($desc_incoterms) {
|
||||
$tab_top = 88;
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
@ -347,10 +332,20 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$height_incoterms += 4;
|
||||
}
|
||||
}
|
||||
|
||||
$hinweis_wichtig = "<strong>".
|
||||
"Für alle Artikel mit der Artikelnummer L-XXX oder L-XXX-XXX gilt:<br>".
|
||||
"Das hiermit ausgegebene Material wurde durch das Land Nordrhein-Westfalen beschafft. Durch den Rhein-Sieg-Kreis erfolgt lediglich die Verteilung an die Einrichtungen des Gesundheitswesens.".
|
||||
"</strong>";
|
||||
|
||||
if(empty($object->note_public)) {
|
||||
$object->note_public = $hinweis_wichtig;
|
||||
} else {
|
||||
$object->note_public = $hinweis_wichtig + "<br><br>" + $object->note_public;
|
||||
}
|
||||
|
||||
// Affiche notes
|
||||
if (! empty($object->note_public))
|
||||
{
|
||||
if (! empty($object->note_public)) {
|
||||
$tab_top = 88 + $height_incoterms;
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
@ -364,9 +359,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
|
||||
$tab_height = $tab_height - $height_note;
|
||||
$tab_top = $nexY+6;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$height_note=0;
|
||||
}
|
||||
|
||||
@ -375,8 +368,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$nexY = $tab_top + 11;
|
||||
|
||||
// Loop on each lines
|
||||
for ($i = 0 ; $i < $nblines ; $i++)
|
||||
{
|
||||
for ($i = 0 ; $i < $nblines ; $i++) {
|
||||
|
||||
|
||||
//var_dump($object->lines[$i]); die;
|
||||
@ -392,47 +384,40 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc-1;
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm-$curX, 3, $curX, $curY, $hideref, $hidedesc);
|
||||
$pageposafter=$pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm-$curX, 4, $curX, $curY, $hideref, $hidedesc);
|
||||
$posyafter=$pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
|
||||
{
|
||||
if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page
|
||||
{
|
||||
$pdf->AddPage('', '', true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We found a page break
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm-$curX, 3, $curX, $curY, $hideref, $hidedesc);
|
||||
$pageposafter=$pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) { // There is a pagebreak
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxcomm-$curX, 4, $curX, $curY, $hideref, $hidedesc);
|
||||
$posyafter=$pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) { // There is no space left for total+free text
|
||||
if ($i == ($nblines-1)) { // No more lines, and no space left to show total, so we create a new page
|
||||
$pdf->AddPage('', '', true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pageposafter+1);
|
||||
}
|
||||
} else {
|
||||
// We found a page break
|
||||
|
||||
// Allows data in the first page if description is long enough to break in multiples pages
|
||||
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||
$showpricebeforepagebreak = 1;
|
||||
else
|
||||
$showpricebeforepagebreak = 0;
|
||||
}
|
||||
}
|
||||
else // No pagebreak
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
}
|
||||
} else { // No pagebreak
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
$pageposafter=$pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
@ -444,48 +429,48 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
|
||||
|
||||
/*
|
||||
// TVA
|
||||
$pdf->SetXY($this->posxcomm, $curY);
|
||||
$pdf->MultiCell(10, 4, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R');
|
||||
/*
|
||||
// TVA
|
||||
$pdf->SetXY($this->posxcomm, $curY);
|
||||
$pdf->MultiCell(10, 4, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R');*/
|
||||
|
||||
*/// Prix unitaire HT avant remise
|
||||
//$pdf->SetXY($this->posxcomm, $curY);
|
||||
//$pdf->MultiCell($this->posxqty - $this->posxcomm, 4, print_r($arr_options, true), 0, 'R', 0);
|
||||
//#TODO
|
||||
// OTHER OPTIONES #TODO
|
||||
//$pdf->SetXY($this->posxcomm, $curY);
|
||||
//$pdf->MultiCell($this->posxqty - $this->posxcomm, 4, print_r($arr_options, true), 0, 'R', 0);
|
||||
|
||||
// Quantity
|
||||
//$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R');
|
||||
|
||||
/*
|
||||
// Remaining to ship
|
||||
/*$pdf->SetXY($this->posxremainingqty, $curY);
|
||||
$pdf->SetXY($this->posxremainingqty, $curY);
|
||||
$qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');
|
||||
*//*
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY($this->posxdiscount, $curY);
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$pdf->MultiCell(14, 3, $object->lines[$i]->remise_percent."%", 0, 'R');
|
||||
}
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R');*/
|
||||
|
||||
/*
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY($this->posxdiscount, $curY);
|
||||
if ($object->lines[$i]->remise_percent) {
|
||||
$pdf->MultiCell(14, 3, $object->lines[$i]->remise_percent."%", 0, 'R');
|
||||
}*/
|
||||
|
||||
// Total HT ligne
|
||||
$pdf->SetXY($this->postotalht, $curY);
|
||||
$total = price($object->lines[$i]->price * $object->lines[$i]->qty);
|
||||
$pdf->MultiCell(23, 3, $total, 0, 'R', 0);
|
||||
/*
|
||||
// Total HT ligne
|
||||
$pdf->SetXY($this->postotalht, $curY);
|
||||
$total = price($object->lines[$i]->price * $object->lines[$i]->qty);
|
||||
$pdf->MultiCell(23, 3, $total, 0, 'R', 0);*/
|
||||
|
||||
// Collecte des totaux par valeur de tva
|
||||
// dans le tableau tva["taux"]=total_tva
|
||||
$tvaligne=$object->lines[$i]->price * $object->lines[$i]->qty;
|
||||
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
|
||||
$this->tva[ (string) $object->lines[$i]->tva_tx ] += $tvaligne;
|
||||
*/
|
||||
/*
|
||||
// Collecte des totaux par valeur de tva
|
||||
// dans le tableau tva["taux"]=total_tva
|
||||
$tvaligne=$object->lines[$i]->price * $object->lines[$i]->qty;
|
||||
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
|
||||
$this->tva[ (string) $object->lines[$i]->tva_tx ] += $tvaligne;*/
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
@ -496,15 +481,11 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$nexY+=2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
{
|
||||
while ($pagenb < $pageposafter) {
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
@ -513,14 +494,10 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||
{
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) {
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
@ -533,13 +510,10 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
@ -566,29 +540,27 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$pdf-> SetY(90);
|
||||
|
||||
$w=array(40,100,50);
|
||||
$header=array($outputlangs->transnoentities('Reference'),
|
||||
$outputlangs->transnoentities('Label'),
|
||||
$outputlangs->transnoentities('Qty')
|
||||
);
|
||||
$header = array(
|
||||
$outputlangs->transnoentities('Reference'),
|
||||
$outputlangs->transnoentities('Label'),
|
||||
$outputlangs->transnoentities('Qty')
|
||||
);
|
||||
|
||||
// Header
|
||||
$num = count($header);
|
||||
for($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$pdf->Cell($w[$i],7,$header[$i],1,0,'C');
|
||||
}
|
||||
// Header
|
||||
$num = count($header);
|
||||
for($i = 0; $i < $num; $i++) {
|
||||
$pdf->Cell($w[$i],7,$header[$i],1,0,'C');
|
||||
}
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->Ln();
|
||||
|
||||
// Data
|
||||
foreach($waitingDelivery as $value)
|
||||
{
|
||||
// Data
|
||||
foreach($waitingDelivery as $value) {
|
||||
$pdf->Cell($w[0], 6, $value['ref'], 1, 0, 'L');
|
||||
$pdf->Cell($w[1], 6, $value['label'], 1, 0, 'L');
|
||||
$pdf->Cell($w[2], 6, $value['qty'], 1, 1, 'R');
|
||||
|
||||
if ($pdf->GetY() > 250)
|
||||
{
|
||||
if ($pdf->GetY() > 250) {
|
||||
$this->_pagefoot($pdf,$object,$outputlangs,1);
|
||||
|
||||
$pdf->AddPage('P', 'A4');
|
||||
@ -599,8 +571,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$pdf-> SetY(40);
|
||||
|
||||
$num = count($header);
|
||||
for($i = 0; $i < $num; $i++)
|
||||
{
|
||||
for($i = 0; $i < $num; $i++) {
|
||||
$pdf->Cell($w[$i],7,$header[$i],1,0,'C');
|
||||
}
|
||||
|
||||
@ -618,8 +589,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$pdf->Output($file, 'F');
|
||||
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
if (! is_object($hookmanager)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
@ -627,8 +597,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0)
|
||||
{
|
||||
if ($reshook < 0) {
|
||||
$this->error = $hookmanager->error;
|
||||
$this->errors = $hookmanager->errors;
|
||||
}
|
||||
@ -639,9 +608,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
return 1; // No error
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return 0;
|
||||
}
|
||||
@ -652,7 +619,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
@ -662,9 +629,8 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @return void
|
||||
*/
|
||||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
|
||||
{
|
||||
// phpcs:enable
|
||||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) {
|
||||
// phpcs:enable
|
||||
global $conf,$mysoc;
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
@ -674,11 +640,11 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
|
||||
$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
|
||||
$pdf->SetXY($this->marge_gauche + 2, $posy + 2);
|
||||
$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":", '', 'L');
|
||||
$pdf->MultiCell($larg_sign, 2, $outputlangs->convToOutputCharset($mysoc->name).":", '', 'L');
|
||||
|
||||
$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
|
||||
$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
|
||||
$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L');
|
||||
$pdf->MultiCell($larg_sign, 2, 'Kunde:', '', 'L');
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
@ -694,8 +660,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @return void
|
||||
*/
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
|
||||
{
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) {
|
||||
global $conf,$mysoc;
|
||||
|
||||
// Force to disable hidetop and hidebottom
|
||||
@ -711,16 +676,14 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
// Output Rec
|
||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10);
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128, 128, 128);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxcomm - $this->posxdesc, 2, $outputlangs->transnoentities("Designation"), '', 'L');
|
||||
}
|
||||
@ -757,8 +720,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @return void
|
||||
*/
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
{
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) {
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
@ -766,8 +728,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
||||
|
||||
// Show Draft Watermark
|
||||
if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
|
||||
{
|
||||
if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) {
|
||||
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
|
||||
}
|
||||
|
||||
@ -781,22 +742,17 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
|
||||
// Logo
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
if ($this->emetteur->logo) {
|
||||
if (is_readable($logo)) {
|
||||
$height=pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
|
||||
} else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 2);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
@ -808,19 +764,15 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
if ($object->date_valid)
|
||||
{
|
||||
if ($object->date_valid) {
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$pdf->SetTextColor(255, 0, 0);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
}
|
||||
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
if ($object->thirdparty->code_client) {
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
@ -834,8 +786,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
||||
@ -878,8 +829,7 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
// If SHIPPING contact defined on order, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->commande->getIdContact('external', 'SHIPPING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
@ -929,17 +879,16 @@ class pdf_thwlieferschein extends ModelePDFDeliveryOrder
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||
{
|
||||
global $conf;
|
||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
|
||||
}
|
||||
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) {
|
||||
global $conf;
|
||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user