Add & Update pdf_stdmouvement.modules.php
Fix Bug Generate pdf
This commit is contained in:
parent
837821ebb6
commit
2ba7bb9d4e
@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/stock/doc/pdf_standard.modules.php
|
* \file htdocs/core/modules/stock/doc/pdf_stdmouvement.modules.php
|
||||||
* \ingroup societe
|
* \ingroup societe
|
||||||
* \brief File of class to build PDF documents for stocks/services
|
* \brief File of class to build PDF documents for stocks movements
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/stock/modules_stock.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/stock/modules_movement.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
|||||||
/**
|
/**
|
||||||
* Class to build documents using ODF templates generator
|
* Class to build documents using ODF templates generator
|
||||||
*/
|
*/
|
||||||
class pdf_stdmouvement extends ModelePDFMouvement
|
class pdf_stdmouvement extends ModelePDFMovement
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var DoliDb Database handler
|
* @var DoliDb Database handler
|
||||||
@ -59,9 +59,9 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array() Minimum version of PHP required by module.
|
* @var array() Minimum version of PHP required by module.
|
||||||
* e.g.: PHP ≥ 5.3 = array(5, 3)
|
* e.g.: PHP ≥ 5.4 = array(5, 4)
|
||||||
*/
|
*/
|
||||||
public $phpmin = array(5, 2);
|
public $phpmin = array(5, 4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dolibarr version of the loaded document
|
* Dolibarr version of the loaded document
|
||||||
@ -69,15 +69,46 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
*/
|
*/
|
||||||
public $version = 'dolibarr';
|
public $version = 'dolibarr';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int page_largeur
|
||||||
|
*/
|
||||||
public $page_largeur;
|
public $page_largeur;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int page_hauteur
|
||||||
|
*/
|
||||||
public $page_hauteur;
|
public $page_hauteur;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array format
|
||||||
|
*/
|
||||||
public $format;
|
public $format;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_gauche
|
||||||
|
*/
|
||||||
public $marge_gauche;
|
public $marge_gauche;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_droite
|
||||||
|
*/
|
||||||
public $marge_droite;
|
public $marge_droite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_haute
|
||||||
|
*/
|
||||||
public $marge_haute;
|
public $marge_haute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_basse
|
||||||
|
*/
|
||||||
public $marge_basse;
|
public $marge_basse;
|
||||||
|
|
||||||
public $emetteur; // Objet societe qui emet
|
/**
|
||||||
|
* Issuer
|
||||||
|
* @var Societe
|
||||||
|
*/
|
||||||
|
public $emetteur;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,8 +120,8 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
{
|
{
|
||||||
global $conf,$langs,$mysoc;
|
global $conf,$langs,$mysoc;
|
||||||
|
|
||||||
$langs->load("main");
|
// Load traductions files requiredby by page
|
||||||
$langs->load("companies");
|
$langs->loadLangs(array("main", "companies"));
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->name = "stdmouvement";
|
$this->name = "stdmouvement";
|
||||||
@ -115,14 +146,14 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
// Recupere emetteur
|
// Recupere emetteur
|
||||||
$this->emetteur=$mysoc;
|
$this->emetteur=$mysoc;
|
||||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
|
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
|
||||||
|
|
||||||
// Define position of columns
|
// Define position of columns
|
||||||
$this->wref = 15;
|
$this->wref = 15;
|
||||||
$this->posxidref = $this->marge_gauche;
|
$this->posxidref = $this->marge_gauche;
|
||||||
$this->posxdatemouv = $this->marge_gauche+8;;
|
$this->posxdatemouv = $this->marge_gauche+8;
|
||||||
$this->posxdesc=37;
|
$this->posxdesc=37;
|
||||||
$this->posxlabel=50;
|
$this->posxlabel=50;
|
||||||
$this->posxtva=80;
|
$this->posxtva=80;
|
||||||
$this->posxqty=105;
|
$this->posxqty=105;
|
||||||
$this->posxup=119;
|
$this->posxup=119;
|
||||||
$this->posxunit=136;
|
$this->posxunit=136;
|
||||||
@ -149,6 +180,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Function to build a document on disk using the generic odt module.
|
* Function to build a document on disk using the generic odt module.
|
||||||
*
|
*
|
||||||
@ -160,22 +192,18 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
* @param int $hideref Do not show ref
|
* @param int $hideref Do not show ref
|
||||||
* @return int 1 if OK, <=0 if KO
|
* @return int 1 if OK, <=0 if KO
|
||||||
*/
|
*/
|
||||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
|
function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
|
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
|
||||||
|
|
||||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
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
|
// 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';
|
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||||
|
|
||||||
$outputlangs->load("main");
|
// Load traductions files requiredby by page
|
||||||
$outputlangs->load("dict");
|
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries"));
|
||||||
$outputlangs->load("companies");
|
|
||||||
$outputlangs->load("bills");
|
|
||||||
$outputlangs->load("stocks");
|
|
||||||
$outputlangs->load("orders");
|
|
||||||
$outputlangs->load("deliveries");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: get from object
|
* TODO: get from object
|
||||||
*/
|
*/
|
||||||
@ -219,7 +247,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('movement');
|
$extralabels = $extrafields->fetch_name_optionals_label('movement');
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
$search_array_options=$extrafields->getOptionalsFromPost('movement','','search_');
|
||||||
|
|
||||||
$productlot=new ProductLot($db);
|
$productlot=new ProductLot($db);
|
||||||
$productstatic=new Product($db);
|
$productstatic=new Product($db);
|
||||||
@ -259,7 +287,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
else
|
else
|
||||||
$sql.= " AND date_format(m.datem, '%m') = '$month'";
|
$sql.= " AND date_format(m.datem, '%m') = '$month'";
|
||||||
}
|
}
|
||||||
else if ($year > 0)
|
elseif ($year > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
$sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||||
}
|
}
|
||||||
@ -308,7 +336,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
if ($conf->stock->dir_output)
|
if ($conf->stock->dir_output)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -340,11 +368,11 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
if ($id) $texte.=' ('.$langs->trans("ForThisWarehouse").')';
|
if ($id) $texte.=' ('.$langs->trans("ForThisWarehouse").')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Definition of $dir and $file
|
// Definition of $dir and $file
|
||||||
if ($object->specimen)
|
if ($object->specimen)
|
||||||
{
|
{
|
||||||
$dir = $conf->stock->dir_output . "/mouvement";
|
$dir = $conf->stock->dir_output . "/movement";
|
||||||
$file = $dir . "/SPECIMEN.pdf";
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -352,14 +380,14 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode;
|
if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode;
|
||||||
if($search_type_mouvement) $objectref.="_".$search_type_mouvement;
|
if($search_type_mouvement) $objectref.="_".$search_type_mouvement;
|
||||||
$dir = $conf->stock->dir_output . "/mouvement/" . $objectref;
|
$dir = $conf->stock->dir_output . "/movement/" . $objectref;
|
||||||
$file = $dir . "/" . $objectref . ".pdf";
|
$file = $dir . "/" . $objectref . ".pdf";
|
||||||
}
|
}
|
||||||
|
|
||||||
$stockFournisseur = new ProductFournisseur($this->db);
|
$stockFournisseur = new ProductFournisseur($this->db);
|
||||||
$supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
|
$supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
|
||||||
$object->supplierprices = $supplierprices;
|
$object->supplierprices = $supplierprices;
|
||||||
|
|
||||||
$productstatic=new Product($db);
|
$productstatic=new Product($db);
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
@ -439,14 +467,15 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
/* Affichage de la liste des produits du MouvementStock */
|
/* Affichage de la liste des produits du MouvementStock */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
$nexY+=5;
|
$nexY+=5;
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
$nexY+=10;
|
$nexY+=10;
|
||||||
|
|
||||||
$totalunit=0;
|
$totalunit=0;
|
||||||
$totalvalue=$totalvaluesell=0;
|
$totalvalue=$totalvaluesell=0;
|
||||||
|
$arrayofuniqueproduct = array();
|
||||||
|
|
||||||
//dol_syslog('List products', LOG_DEBUG);
|
//dol_syslog('List products', LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -474,7 +503,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
if ($objtp->label != '') $objp->produit = $objtp->label;
|
if ($objtp->label != '') $objp->produit = $objtp->label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
|
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
@ -482,7 +511,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$pdf->setTopMargin($tab_top_newpage);
|
$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.
|
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||||
$pageposbefore=$pdf->getPage();
|
$pageposbefore=$pdf->getPage();
|
||||||
|
|
||||||
// Description of product line
|
// Description of product line
|
||||||
$curX = $this->posxdesc-1;
|
$curX = $this->posxdesc-1;
|
||||||
|
|
||||||
@ -535,7 +564,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||||
|
|
||||||
// $objp = $db->fetch_object($resql);
|
// $objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
$userstatic->id=$objp->fk_user_author;
|
$userstatic->id=$objp->fk_user_author;
|
||||||
@ -565,8 +594,8 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$origin = $movement->get_origin($objp->fk_origin, $objp->origintype);
|
$origin = $movement->get_origin($objp->fk_origin, $objp->origintype);
|
||||||
} else {
|
} else {
|
||||||
$origin = '';
|
$origin = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Id movement.
|
// Id movement.
|
||||||
$pdf->SetXY($this->posxidref, $curY);
|
$pdf->SetXY($this->posxidref, $curY);
|
||||||
$pdf->MultiCell($this->posxdesc-$this->posxidref-0.8, 3, $objp->mid, 0, 'L');
|
$pdf->MultiCell($this->posxdesc-$this->posxidref-0.8, 3, $objp->mid, 0, 'L');
|
||||||
@ -585,8 +614,8 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
// Lot/serie
|
// Lot/serie
|
||||||
$pdf->SetXY($this->posxqty, $curY);
|
$pdf->SetXY($this->posxqty, $curY);
|
||||||
$pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $productlot->batch, 0, 'R');
|
$pdf->MultiCell($this->posxup-$this->posxqty-0.8, 3, $productlot->batch, 0, 'R');
|
||||||
|
|
||||||
// Inv. code
|
// Inv. code
|
||||||
$pdf->SetXY($this->posxup, $curY);
|
$pdf->SetXY($this->posxup, $curY);
|
||||||
$pdf->MultiCell($this->posxunit-$this->posxup-0.8, 3, $objp->inventorycode, 0, 'R');
|
$pdf->MultiCell($this->posxunit-$this->posxup-0.8, 3, $objp->inventorycode, 0, 'R');
|
||||||
@ -595,7 +624,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$pdf->SetXY($this->posxunit, $curY);
|
$pdf->SetXY($this->posxunit, $curY);
|
||||||
$pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 3, $objp->label, 0, 'R');
|
$pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 3, $objp->label, 0, 'R');
|
||||||
$totalvalue+=price2num($objp->ppmp*$objp->value,'MT');
|
$totalvalue+=price2num($objp->ppmp*$objp->value,'MT');
|
||||||
|
|
||||||
// Origin
|
// Origin
|
||||||
$pricemin=$objp->price;
|
$pricemin=$objp->price;
|
||||||
$pdf->SetXY($this->posxdiscount, $curY);
|
$pdf->SetXY($this->posxdiscount, $curY);
|
||||||
@ -608,9 +637,9 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
$pdf->SetXY($this->postotalht, $curY);
|
$pdf->SetXY($this->postotalht, $curY);
|
||||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $objp->qty, 0, 'R', 0);
|
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $objp->qty, 0, 'R', 0);
|
||||||
|
|
||||||
$totalvaluesell+=price2num($pricemin*$objp->value,'MT');
|
$totalvaluesell+=price2num($pricemin*$objp->value,'MT');
|
||||||
|
|
||||||
$nexY+=3.5; // Passe espace entre les lignes
|
$nexY+=3.5; // Passe espace entre les lignes
|
||||||
// Add line
|
// Add line
|
||||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||||
@ -623,7 +652,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
}
|
}
|
||||||
|
|
||||||
$nexY+=2; // Passe espace entre les lignes
|
$nexY+=2; // Passe espace entre les lignes
|
||||||
|
|
||||||
// Detect if some page were added automatically and output _tableau for past pages
|
// Detect if some page were added automatically and output _tableau for past pages
|
||||||
while ($pagenb < $pageposafter)
|
while ($pagenb < $pageposafter)
|
||||||
{
|
{
|
||||||
@ -668,9 +697,9 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
*/
|
*/
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
$nexY+=5;
|
$nexY+=5;
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
$pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26)));
|
$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->line($this->marge_gauche, $curY-1, $this->page_largeur-$this->marge_droite, $curY-1);
|
||||||
$pdf->SetLineStyle(array('dash'=>0));
|
$pdf->SetLineStyle(array('dash'=>0));
|
||||||
|
|
||||||
@ -680,11 +709,10 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
// Total
|
// Total
|
||||||
$pdf->SetXY($this->posxidref, $curY);
|
$pdf->SetXY($this->posxidref, $curY);
|
||||||
$pdf->MultiCell($this->posxdesc-$this->posxidref, 3, $langs->trans("Total"), 0, 'L');
|
$pdf->MultiCell($this->posxdesc-$this->posxidref, 3, $langs->trans("Total"), 0, 'L');
|
||||||
|
|
||||||
// Total Qty
|
// Total Qty
|
||||||
$pdf->SetXY($this->postotalht, $curY);
|
$pdf->SetXY($this->postotalht, $curY);
|
||||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $totalunit, 0, 'R', 0);
|
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $totalunit, 0, 'R', 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -720,8 +748,8 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$curY = $tab_top + 7;
|
$curY = $tab_top + 7;
|
||||||
$nexY = $tab_top + 7;
|
$nexY = $tab_top + 7;
|
||||||
|
|
||||||
$tab_top = $tab_top_newpage+21;
|
$tab_top = $tab_top_newpage+21;
|
||||||
|
|
||||||
// Show square
|
// Show square
|
||||||
if ($pagenb == 1)
|
if ($pagenb == 1)
|
||||||
{
|
{
|
||||||
@ -733,7 +761,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||||
|
|
||||||
// Affiche zone infos
|
// Affiche zone infos
|
||||||
@ -790,7 +818,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
* @param string $currency Currency code
|
* @param string $currency Currency code
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
|
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -820,14 +848,14 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
// Output Rect
|
// 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
|
//$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->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->line($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite, $tab_top);
|
||||||
$pdf->SetLineStyle(array('dash'=>0));
|
$pdf->SetLineStyle(array('dash'=>0));
|
||||||
$pdf->SetDrawColor(128,128,128);
|
$pdf->SetDrawColor(128,128,128);
|
||||||
$pdf->SetTextColor(0,0,120);
|
$pdf->SetTextColor(0,0,120);
|
||||||
|
|
||||||
//Ref mouv
|
//Ref mouv
|
||||||
if (empty($hidetop))
|
if (empty($hidetop))
|
||||||
{
|
{
|
||||||
@ -835,7 +863,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$pdf->SetXY($this->posxidref, $tab_top+1);
|
$pdf->SetXY($this->posxidref, $tab_top+1);
|
||||||
$pdf->MultiCell($this->posxdatemouv-$this->posxdatemouv-0.8,3, $outputlangs->transnoentities("Ref"),'','L');
|
$pdf->MultiCell($this->posxdatemouv-$this->posxdatemouv-0.8,3, $outputlangs->transnoentities("Ref"),'','L');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Date mouv
|
//Date mouv
|
||||||
//$pdf->line($this->posxlabel-1, $tab_top, $this->posxlabel-1, $tab_top + $tab_height);
|
//$pdf->line($this->posxlabel-1, $tab_top, $this->posxlabel-1, $tab_top + $tab_height);
|
||||||
if (empty($hidetop))
|
if (empty($hidetop))
|
||||||
@ -847,7 +875,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
//Ref Product
|
//Ref Product
|
||||||
//$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
//$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
||||||
if (empty($hidetop))
|
if (empty($hidetop))
|
||||||
{
|
{
|
||||||
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
|
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
|
||||||
$pdf->MultiCell($this->posxlabel-$this->posxdesc,2, $outputlangs->transnoentities("Ref. Product"),'','C');
|
$pdf->MultiCell($this->posxlabel-$this->posxdesc,2, $outputlangs->transnoentities("Ref. Product"),'','C');
|
||||||
}
|
}
|
||||||
@ -862,7 +890,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
//Lot/serie Product
|
//Lot/serie Product
|
||||||
//$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
|
//$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
|
||||||
if (empty($hidetop))
|
if (empty($hidetop))
|
||||||
{
|
{
|
||||||
$pdf->SetXY($this->posxqty, $tab_top + 1);
|
$pdf->SetXY($this->posxqty, $tab_top + 1);
|
||||||
$pdf->MultiCell($this->posxup - $this->posxqty, 2, $outputlangs->transnoentities("Lot/Série"), '','C');
|
$pdf->MultiCell($this->posxup - $this->posxqty, 2, $outputlangs->transnoentities("Lot/Série"), '','C');
|
||||||
@ -877,34 +905,33 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Label mouvement
|
//Label mouvement
|
||||||
//$pdf->line($this->posxunit, $tab_top, $this->posxunit, $tab_top + $tab_height);
|
//$pdf->line($this->posxunit, $tab_top, $this->posxunit, $tab_top + $tab_height);
|
||||||
if (empty($hidetop))
|
if (empty($hidetop))
|
||||||
{
|
{
|
||||||
$pdf->SetXY($this->posxunit, $tab_top+1);
|
$pdf->SetXY($this->posxunit, $tab_top+1);
|
||||||
$pdf->MultiCell($this->posxdiscount-$this->posxunit,2, $outputlangs->transnoentities("Label Mouvement"),'','C');
|
$pdf->MultiCell($this->posxdiscount-$this->posxunit,2, $outputlangs->transnoentities("Label Mouvement"),'','C');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Origin
|
//Origin
|
||||||
//$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))
|
if (empty($hidetop))
|
||||||
{
|
{
|
||||||
$pdf->SetXY($this->posxdiscount+2, $tab_top+1);
|
$pdf->SetXY($this->posxdiscount+2, $tab_top+1);
|
||||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-0.8,2, $outputlangs->transnoentities("Origin"),'','C');
|
$pdf->MultiCell($this->postotalht-$this->posxdiscount-0.8,2, $outputlangs->transnoentities("Origin"),'','C');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Qty
|
//Qty
|
||||||
//$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))
|
if (empty($hidetop))
|
||||||
{
|
{
|
||||||
$pdf->SetXY($this->postotalht+2, $tab_top+1);
|
$pdf->SetXY($this->postotalht+2, $tab_top+1);
|
||||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht,2, $outputlangs->transnoentities("Qty"),'','C');
|
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht,2, $outputlangs->transnoentities("Qty"),'','C');
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetDrawColor(220,26,26);
|
$pdf->SetDrawColor(220,26,26);
|
||||||
$pdf->SetLineStyle(array('dash'=>'0','color'=>array(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));
|
$pdf->SetLineStyle(array('dash'=>0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -917,16 +944,13 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
* @param string $titlekey Translation key to show as title of document
|
* @param string $titlekey Translation key to show as title of document
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="")
|
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db,$hookmanager;
|
global $conf,$langs,$db,$hookmanager;
|
||||||
|
|
||||||
$outputlangs->load("main");
|
// Load traductions files requiredby by page
|
||||||
$outputlangs->load("bills");
|
$outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders", "stocks"));
|
||||||
$outputlangs->load("propal");
|
|
||||||
$outputlangs->load("companies");
|
|
||||||
$outputlangs->load("orders");
|
|
||||||
$outputlangs->load("stocks");
|
|
||||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||||
|
|
||||||
if ($object->type == 1) $titlekey='ServiceSheet';
|
if ($object->type == 1) $titlekey='ServiceSheet';
|
||||||
@ -990,22 +1014,22 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$pdf->SetXY($posx,$posy);
|
$pdf->SetXY($posx,$posy);
|
||||||
$pdf->SetTextColor(0,0,60);
|
$pdf->SetTextColor(0,0,60);
|
||||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("LocationSummary").' :', '', 'R');
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("LocationSummary").' :', '', 'R');
|
||||||
|
|
||||||
$posy+=4;
|
$posy+=4;
|
||||||
$pdf->SetXY($posx-50,$posy);
|
$pdf->SetXY($posx-50,$posy);
|
||||||
$pdf->MultiCell(150, 3, $object->lieu, '', 'R');
|
$pdf->MultiCell(150, 3, $object->lieu, '', 'R');
|
||||||
|
|
||||||
|
|
||||||
// Parent MouvementStock
|
// Parent MouvementStock
|
||||||
$posy+=4;
|
$posy+=4;
|
||||||
$pdf->SetXY($posx,$posy);
|
$pdf->SetXY($posx,$posy);
|
||||||
$pdf->SetTextColor(0,0,60);
|
$pdf->SetTextColor(0,0,60);
|
||||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ParentWarehouse").' :', '', 'R');
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ParentWarehouse").' :', '', 'R');
|
||||||
|
|
||||||
$posy+=4;
|
$posy+=4;
|
||||||
$pdf->SetXY($posx-50,$posy);
|
$pdf->SetXY($posx-50,$posy);
|
||||||
$e = new MouvementStock($db);
|
$e = new MouvementStock($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');
|
$pdf->MultiCell(150, 3, $e->libelle, '', 'R');
|
||||||
}
|
}
|
||||||
@ -1013,14 +1037,14 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
{
|
{
|
||||||
$pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R');
|
$pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
$nexY+=5;
|
$nexY+=5;
|
||||||
$pdf->SetXY($posx,$posy);
|
$pdf->SetXY($posx,$posy);
|
||||||
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("Description").' : </b>'.nl2br($object->description), 0, 1);
|
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("Description").' : </b>'.nl2br($object->description), 0, 1);
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
$calcproductsunique=$object->nb_different_products();
|
$calcproductsunique=$object->nb_different_products();
|
||||||
$calcproducts=$object->nb_products();
|
$calcproducts=$object->nb_products();
|
||||||
|
|
||||||
@ -1032,12 +1056,12 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$valtoshow=price2num($calcproducts['nb'], 'MS');
|
$valtoshow=price2num($calcproducts['nb'], 'MS');
|
||||||
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("NumberOfProducts").' : </b>'.(empty($valtoshow)?'0':$valtoshow), 0, 1);
|
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("NumberOfProducts").' : </b>'.(empty($valtoshow)?'0':$valtoshow), 0, 1);
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
// Value
|
// 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);
|
$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();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
|
|
||||||
// Last movement
|
// Last movement
|
||||||
$sql = "SELECT max(m.datem) as datem";
|
$sql = "SELECT max(m.datem) as datem";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
|
$sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
|
||||||
@ -1065,7 +1089,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("LastMovement").' : </b>'.$toWrite, 0, 1);
|
$pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, '<b>'.$outputlangs->transnoentities("LastMovement").' : </b>'.$toWrite, 0, 1);
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
|
|
||||||
/*if ($object->ref_client)
|
/*if ($object->ref_client)
|
||||||
{
|
{
|
||||||
$posy+=5;
|
$posy+=5;
|
||||||
@ -1148,12 +1172,10 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
* @param int $hidefreetext 1=Hide free text
|
* @param int $hidefreetext 1=Hide free text
|
||||||
* @return int Return height of bottom margin including footer text
|
* @return int Return height of bottom margin including footer text
|
||||||
*/
|
*/
|
||||||
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
|
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||||
return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
|
return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user