|
@@ -87,7 +87,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
public function __construct($db)
|
|
|
{
|
|
|
global $conf,$langs,$mysoc;
|
|
|
-
|
|
|
+
|
|
|
// Load traductions files requiredby by page
|
|
|
$langs->loadLangs(array("main", "companies"));
|
|
|
|
|
@@ -114,12 +114,12 @@ class pdf_standard extends ModelePDFStock
|
|
|
// Recupere emetteur
|
|
|
$this->emetteur=$mysoc;
|
|
|
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
|
|
|
-
|
|
|
+
|
|
|
// Define position of columns
|
|
|
$this->wref = 15;
|
|
|
$this->posxdesc=$this->marge_gauche+1;
|
|
|
$this->posxlabel=$this->posxdesc+$this->wref;
|
|
|
- $this->posxtva=80;
|
|
|
+ $this->posxtva=80;
|
|
|
$this->posxqty=95;
|
|
|
$this->posxup=115;
|
|
|
$this->posxunit=135;
|
|
@@ -164,7 +164,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
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
|
|
|
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
|
|
-
|
|
|
+
|
|
|
// Load traductions files requiredby by page
|
|
|
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries"));
|
|
|
|
|
@@ -188,7 +188,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
$stockFournisseur = new ProductFournisseur($this->db);
|
|
|
$supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
|
|
|
$object->supplierprices = $supplierprices;
|
|
|
-
|
|
|
+
|
|
|
$productstatic=new Product($db);
|
|
|
|
|
|
if (! file_exists($dir))
|
|
@@ -268,8 +268,8 @@ class pdf_standard extends ModelePDFStock
|
|
|
/* Affichage de la liste des produits de l'entrepot */
|
|
|
/* */
|
|
|
/* ************************************************************************** */
|
|
|
-
|
|
|
- $nexY+=5;
|
|
|
+
|
|
|
+ $nexY+=5;
|
|
|
$nexY = $pdf->GetY();
|
|
|
$nexY+=10;
|
|
|
|
|
@@ -311,7 +311,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
if ($objtp->label != '') $objp->produit = $objtp->label;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$curY = $nexY;
|
|
|
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
|
|
|
$pdf->SetTextColor(0,0,0);
|
|
@@ -319,7 +319,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
$pdf->setTopMargin($tab_top_newpage);
|
|
|
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
|
|
$pageposbefore=$pdf->getPage();
|
|
|
-
|
|
|
+
|
|
|
// Description of product line
|
|
|
$curX = $this->posxdesc-1;
|
|
|
|
|
@@ -372,13 +372,13 @@ class pdf_standard extends ModelePDFStock
|
|
|
}
|
|
|
|
|
|
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
|
|
-
|
|
|
+
|
|
|
$productstatic->id=$objp->rowid;
|
|
|
$productstatic->ref = $objp->ref;
|
|
|
$productstatic->label = $objp->produit;
|
|
|
$productstatic->type=$objp->type;
|
|
|
$productstatic->entity=$objp->entity;
|
|
|
- $productstatic->status_batch=$objp->tobatch;
|
|
|
+ $productstatic->status_batch=$objp->tobatch;
|
|
|
|
|
|
// Ref.
|
|
|
$pdf->SetXY($this->posxdesc, $curY);
|
|
@@ -391,12 +391,12 @@ class pdf_standard extends ModelePDFStock
|
|
|
// Quantity
|
|
|
$valtoshow=price2num($objp->value, 'MS');
|
|
|
$towrite = (empty($valtoshow)?'0':$valtoshow);
|
|
|
-
|
|
|
+
|
|
|
$pdf->SetXY($this->posxqty, $curY);
|
|
|
- $pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $towrite, 0, 'R');
|
|
|
-
|
|
|
+ $pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $towrite, 0, 'R');
|
|
|
+
|
|
|
$totalunit+=$objp->value;
|
|
|
-
|
|
|
+
|
|
|
$pdf->SetXY($this->posxup, $curY);
|
|
|
$pdf->MultiCell($this->posxunit-$this->posxup-0.8, 3, price(price2num($objp->ppmp,'MU'), 0, $outputlangs), 0, 'R');
|
|
|
|
|
@@ -429,7 +429,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
}
|
|
|
|
|
|
$nexY+=2; // Passe espace entre les lignes
|
|
|
-
|
|
|
+
|
|
|
// Detect if some page were added automatically and output _tableau for past pages
|
|
|
while ($pagenb < $pageposafter)
|
|
|
{
|
|
@@ -466,20 +466,20 @@ class pdf_standard extends ModelePDFStock
|
|
|
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$db->free($resql);
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* footer table
|
|
|
*/
|
|
|
$nexY = $pdf->GetY();
|
|
|
$nexY+=2;
|
|
|
- $curY = $nexY;
|
|
|
-
|
|
|
- $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26)));
|
|
|
+ $curY = $nexY;
|
|
|
+
|
|
|
+ $pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26)));
|
|
|
$pdf->line($this->marge_gauche, $curY-1, $this->page_largeur-$this->marge_droite, $curY-1);
|
|
|
$pdf->SetLineStyle(array('dash'=>0));
|
|
|
-
|
|
|
+
|
|
|
$pdf->SetFont('','B',$default_font_size-1);
|
|
|
$pdf->SetTextColor(0,0,120);
|
|
|
|
|
@@ -487,7 +487,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
$pdf->SetXY($this->posxdesc, $curY);
|
|
|
$pdf->MultiCell($this->wref, 3, $langs->trans("Total"), 0, 'L');
|
|
|
|
|
|
- // Quantity
|
|
|
+ // Quantity
|
|
|
$valtoshow=price2num($totalunit, 'MS');
|
|
|
$towrite = empty($valtoshow)?'0':$valtoshow;
|
|
|
|
|
@@ -736,8 +736,8 @@ class pdf_standard extends ModelePDFStock
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
- $tab_top = $tab_top_newpage+21;
|
|
|
-
|
|
|
+ $tab_top = $tab_top_newpage+21;
|
|
|
+
|
|
|
// Show square
|
|
|
if ($pagenb == 1)
|
|
|
{
|
|
@@ -749,7 +749,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
|
|
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
|
|
|
|
|
// Affiche zone infos
|
|
@@ -836,21 +836,21 @@ class pdf_standard extends ModelePDFStock
|
|
|
|
|
|
// Output Rect
|
|
|
//$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
|
|
|
-
|
|
|
+
|
|
|
$pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26)));
|
|
|
- $pdf->SetDrawColor(220,26,26);
|
|
|
+ $pdf->SetDrawColor(220,26,26);
|
|
|
$pdf->line($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite, $tab_top);
|
|
|
$pdf->SetLineStyle(array('dash'=>0));
|
|
|
$pdf->SetDrawColor(128,128,128);
|
|
|
$pdf->SetTextColor(0,0,120);
|
|
|
-
|
|
|
+
|
|
|
if (empty($hidetop))
|
|
|
{
|
|
|
//$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
|
|
|
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
|
|
|
$pdf->MultiCell($this->wref,3, $outputlangs->transnoentities("Ref"),'','L');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//$pdf->line($this->posxlabel-1, $tab_top, $this->posxlabel-1, $tab_top + $tab_height);
|
|
|
if (empty($hidetop))
|
|
|
{
|
|
@@ -860,7 +860,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
|
|
|
//$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
|
|
if (empty($hidetop))
|
|
|
- {
|
|
|
+ {
|
|
|
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
|
|
$pdf->MultiCell($this->posxup-$this->posxqty-1,2, $outputlangs->transnoentities("Units"),'','C');
|
|
|
}
|
|
@@ -873,7 +873,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
}
|
|
|
|
|
|
//$pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
|
|
|
- if (empty($hidetop))
|
|
|
+ if (empty($hidetop))
|
|
|
{
|
|
|
$pdf->SetXY($this->posxunit - 1, $tab_top + 1);
|
|
|
$pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("EstimatedStockValueShort"), '',
|
|
@@ -887,18 +887,18 @@ class pdf_standard extends ModelePDFStock
|
|
|
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("SellPriceMin"),'','C');
|
|
|
}
|
|
|
|
|
|
- //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
|
|
+ //$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
|
|
if (empty($hidetop))
|
|
|
{
|
|
|
$pdf->SetXY($this->postotalht-1, $tab_top+1);
|
|
|
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht,2, $outputlangs->transnoentities("EstimatedStockValueSellShort"),'','C');
|
|
|
}
|
|
|
-
|
|
|
- $pdf->SetDrawColor(220,26,26);
|
|
|
+
|
|
|
+ $pdf->SetDrawColor(220,26,26);
|
|
|
$pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26)));
|
|
|
- $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11);
|
|
|
+ $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11);
|
|
|
$pdf->SetLineStyle(array('dash'=>0));
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -914,7 +914,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="")
|
|
|
{
|
|
|
global $conf,$langs,$db,$hookmanager;
|
|
|
-
|
|
|
+
|
|
|
// Load traductions files requiredby by page
|
|
|
$outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders", "stocks"));
|
|
|
|
|
@@ -961,7 +961,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
$text=$this->emetteur->name;
|
|
|
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$pdf->SetFont('','B', $default_font_size + 3);
|
|
|
$pdf->SetXY($posx,$posy);
|
|
|
$pdf->SetTextColor(0,0,60);
|
|
@@ -981,22 +981,22 @@ class pdf_standard extends ModelePDFStock
|
|
|
$pdf->SetXY($posx,$posy);
|
|
|
$pdf->SetTextColor(0,0,60);
|
|
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("LocationSummary").' :', '', 'R');
|
|
|
-
|
|
|
+
|
|
|
$posy+=4;
|
|
|
$pdf->SetXY($posx-50,$posy);
|
|
|
$pdf->MultiCell(150, 3, $object->lieu, '', 'R');
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// Parent entrepot
|
|
|
$posy+=4;
|
|
|
$pdf->SetXY($posx,$posy);
|
|
|
$pdf->SetTextColor(0,0,60);
|
|
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ParentWarehouse").' :', '', 'R');
|
|
|
-
|
|
|
+
|
|
|
$posy+=4;
|
|
|
$pdf->SetXY($posx-50,$posy);
|
|
|
$e = new Entrepot($db);
|
|
|
- if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0)
|
|
|
+ if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0)
|
|
|
{
|
|
|
$pdf->MultiCell(150, 3, $e->libelle, '', 'R');
|
|
|
}
|
|
@@ -1004,14 +1004,14 @@ class pdf_standard extends ModelePDFStock
|
|
|
{
|
|
|
$pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Description
|
|
|
$nexY = $pdf->GetY();
|
|
|
$nexY+=5;
|
|
|
$pdf->SetXY($posx,$posy);
|
|
|
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("Description").' : </b>'.nl2br($object->description), 0, 1);
|
|
|
$nexY = $pdf->GetY();
|
|
|
-
|
|
|
+
|
|
|
$calcproductsunique=$object->nb_different_products();
|
|
|
$calcproducts=$object->nb_products();
|
|
|
|
|
@@ -1023,12 +1023,12 @@ class pdf_standard extends ModelePDFStock
|
|
|
$valtoshow=price2num($calcproducts['nb'], 'MS');
|
|
|
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("NumberOfProducts").' : </b>'.(empty($valtoshow)?'0':$valtoshow), 0, 1);
|
|
|
$nexY = $pdf->GetY();
|
|
|
-
|
|
|
+
|
|
|
// Value
|
|
|
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("EstimatedStockValueShort").' : </b>'. price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency), 0, 1);
|
|
|
$nexY = $pdf->GetY();
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// Last movement
|
|
|
$sql = "SELECT max(m.datem) as datem";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
|
|
@@ -1056,7 +1056,7 @@ class pdf_standard extends ModelePDFStock
|
|
|
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("LastMovement").' : </b>'.$toWrite, 0, 1);
|
|
|
$nexY = $pdf->GetY();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/*if ($object->ref_client)
|
|
|
{
|
|
|
$posy+=5;
|
|
@@ -1147,4 +1147,3 @@ class pdf_standard extends ModelePDFStock
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|