Fix in sending pdfs
This commit is contained in:
parent
c7246461e6
commit
5bf4e90b98
@ -2605,7 +2605,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($objp->product_type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
if ($objp->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($objp->description);
|
||||
print_date_range($objp->date_start,$objp->date_end);
|
||||
|
||||
@ -592,7 +592,7 @@ class Expedition extends CommonObject
|
||||
|
||||
$sql = "SELECT cd.rowid, cd.fk_product, cd.description, cd.qty as qty_asked";
|
||||
$sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
||||
$sql.= ", p.ref, p.label, p.weight, p.weight_units, p.volume, p.volume_units";
|
||||
$sql.= ", p.ref, p.fk_product_type, p.label, p.weight, p.weight_units, p.volume, p.volume_units";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."commandedet as cd";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."expeditiondet as ed)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON (p.rowid = cd.fk_product)";
|
||||
@ -612,7 +612,9 @@ class Expedition extends CommonObject
|
||||
$ligne->origin_line_id = $obj->fk_origin_line;
|
||||
$ligne->entrepot_id = $obj->fk_entrepot;
|
||||
$ligne->fk_product = $obj->fk_product;
|
||||
$ligne->fk_product_type= $obj->fk_product_type;
|
||||
$ligne->ref = $obj->ref;
|
||||
$ligne->label = $obj->label; // deprecated
|
||||
$ligne->libelle = $obj->label;
|
||||
$ligne->description = $obj->description;
|
||||
$ligne->qty_asked = $obj->qty_asked;
|
||||
|
||||
@ -742,16 +742,34 @@ else
|
||||
for ($i = 0 ; $i < $num_prod ; $i++)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
if ($lignes[$i]->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lignes[$i]->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$lignes[$i]->ref.'</a> - '.$lignes[$i]->libelle;
|
||||
if ($lignes[$i]->description) print '<br>'.nl2br($lignes[$i]->description);
|
||||
print '</td>';
|
||||
|
||||
// Affiche ligne produit
|
||||
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lignes[$i]->fk_product.'">';
|
||||
if ($lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
|
||||
else $text.= img_object($langs->trans('ShowProduct'),'product');
|
||||
$text.= ' '.$lignes[$i]->ref.'</a>';
|
||||
$text.= ' - '.$lignes[$i]->label;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lignes[$i]->description));
|
||||
//print $description;
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
print_date_range($lignes[$i]->date_start,$lignes[$i]->date_end);
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($lignes[$i]->description && $lignes[$i]->description!=$lignes[$i]->product)?'<br>'.dol_htmlentitiesbr($lignes[$i]->description):'';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".nl2br($lignes[$i]->description)."</td>\n";
|
||||
print "<td>";
|
||||
if ($lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($lignes[$i]->description);
|
||||
print_date_range($lignes[$i]->date_start,$lignes[$i]->date_end);
|
||||
print "</td>\n";
|
||||
}
|
||||
|
||||
// Qte commande
|
||||
|
||||
@ -49,6 +49,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("sendings");
|
||||
$langs->load("companies");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "sirocco";
|
||||
@ -68,7 +69,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
|
||||
$this->error = "";
|
||||
$this->tva=array();
|
||||
}
|
||||
|
||||
|
||||
@ -93,6 +94,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
@ -118,6 +120,8 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
}
|
||||
}
|
||||
|
||||
$nblignes = sizeof($delivery->lignes);
|
||||
|
||||
$deliveryref = sanitizeFileName($delivery->ref);
|
||||
$dir = $conf->livraison_bon->dir_output;
|
||||
if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
|
||||
@ -159,28 +163,25 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
$pdf->SetKeyWords($outputlangs->convToOutputCharset($delivery->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
|
||||
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
$pagenb++;
|
||||
$this->_pagehead($pdf, $delivery, $outputlangs);
|
||||
$this->_pagehead($pdf, $delivery, 1, $outputlangs);
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$tab_top = 100;
|
||||
$tab_top_newpage = 50;
|
||||
$tab_height = 140;
|
||||
$tab_height_newpage = 190;
|
||||
|
||||
$pdf->SetFillColor(220,220,220);
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','', 10);
|
||||
|
||||
$pdf->SetXY (10, $tab_top + 10 );
|
||||
|
||||
$iniY = $pdf->GetY();
|
||||
$curY = $pdf->GetY();
|
||||
$nexY = $pdf->GetY();
|
||||
$nblignes = sizeof($delivery->lignes);
|
||||
$iniY = $tab_top + 7;
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
@ -189,51 +190,107 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=pdf_getlinedesc($delivery->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetXY (30, $curY );
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
||||
|
||||
$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY (10, $curY );
|
||||
|
||||
$pdf->MultiCell(20, 5, $outputlangs->convToOutputCharset($delivery->lignes[$i]->ref), 0, 'C');
|
||||
$pdf->MultiCell(20, 3, $outputlangs->convToOutputCharset($delivery->lignes[$i]->ref), 0, 'C');
|
||||
|
||||
// \TODO Field not yet saved in database
|
||||
//$pdf->SetXY (133, $curY );
|
||||
//$pdf->MultiCell(10, 5, $delivery->lignes[$i]->tva_tx, 0, 'C');
|
||||
|
||||
$pdf->SetXY (145, $curY );
|
||||
$pdf->MultiCell(10, 5, $delivery->lignes[$i]->qty_shipped, 0, 'C');
|
||||
$pdf->MultiCell(10, 3, $delivery->lignes[$i]->qty_shipped, 0, 'C');
|
||||
|
||||
// \TODO Field not yet saved in database
|
||||
//$pdf->SetXY (156, $curY );
|
||||
//$pdf->MultiCell(18, 5, price($delivery->lignes[$i]->price), 0, 'R', 0);
|
||||
//$pdf->MultiCell(18, 3, price($delivery->lignes[$i]->price), 0, 'R', 0);
|
||||
|
||||
// \TODO Field not yet saved in database
|
||||
//$pdf->SetXY (174, $curY );
|
||||
//$total = price($delivery->lignes[$i]->price * $delivery->lignes[$i]->qty_shipped);
|
||||
//$pdf->MultiCell(26, 5, $total, 0, 'R', 0);
|
||||
//$pdf->MultiCell(26, 3, $total, 0, 'R', 0);
|
||||
|
||||
$pdf->line(10, $curY, 200, $curY );
|
||||
$pdf->line(10, $curY-1, 200, $curY-1);
|
||||
|
||||
if ($nexY > 240 && $i < $nblignes - 1)
|
||||
|
||||
$nexY+=2; // Passe espace entre les lignes
|
||||
|
||||
// Cherche nombre de lignes a venir pour savoir si place suffisante
|
||||
if ($i < ($nblignes - 1)) // If it's not last line
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
//on récupère la description du produit suivant
|
||||
$follow_descproduitservice = $delivery->lignes[$i+1]->desc;
|
||||
//on compte le nombre de ligne afin de vérifier la place disponible (largeur de ligne 52 caracteres)
|
||||
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52)*4);
|
||||
}
|
||||
else // If it's last line
|
||||
{
|
||||
$nblineFollowDesc = 0;
|
||||
}
|
||||
|
||||
$nexY = $iniY;
|
||||
// Test if a new page is required
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$tab_top_in_current_page=$tab_top;
|
||||
$tab_height_in_current_page=$tab_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab_top_in_current_page=$tab_top_newpage;
|
||||
$tab_height_in_current_page=$tab_height_newpage;
|
||||
}
|
||||
|
||||
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1))
|
||||
{
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
}
|
||||
|
||||
$this->_pagefoot($pdf, $outputlangs);
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
$pagenb++;
|
||||
$this->_pagehead($pdf, $delivery, $outputlangs);
|
||||
$this->_pagehead($pdf, $delivery, 0, $outputlangs);
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$nexY = $tab_top_newpage + 7;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top + $tab_height + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pied de page
|
||||
*/
|
||||
$this->_pagefoot($pdf,$outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@ -250,7 +307,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Affiche la grille des lignes de propales
|
||||
* \brief Affiche la grille des lignes
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||
@ -283,17 +340,22 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Affiche en-tete propale
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet propale
|
||||
* \brief Affiche en-tete
|
||||
* \param pdf objet PDF
|
||||
* \param delivery object delivery
|
||||
* \param showadress 0=non, 1=oui
|
||||
*/
|
||||
function _pagehead(&$pdf, $delivery, $outputlangs)
|
||||
function _pagehead(&$pdf, $delivery, $showadress=1, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$outputlangs->load("deliveries");
|
||||
$pdf->SetXY(10,5);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('Arial','B',13);
|
||||
|
||||
$posy=$this->marge_haute;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
if (defined("MAIN_INFO_SOCIETE_NOM"))
|
||||
{
|
||||
$pdf->SetTextColor(0,0,200);
|
||||
@ -316,7 +378,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($this->emetteur->url);
|
||||
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->SetXY(10,10);
|
||||
$pdf->SetXY($this->marge_gauche,$posy+4);
|
||||
$pdf->MultiCell(80,3, $carac_emetteur);
|
||||
|
||||
/*
|
||||
|
||||
@ -53,6 +53,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("sendings");
|
||||
$langs->load("companies");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "typhon";
|
||||
@ -79,8 +80,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
|
||||
$this->tva=array();
|
||||
|
||||
// Defini position des colonnes
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
$this->posxcomm=120;
|
||||
@ -90,6 +89,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=177;
|
||||
|
||||
$this->tva=array();
|
||||
$this->atleastoneratenotnull=0;
|
||||
$this->atleastonediscount=0;
|
||||
}
|
||||
@ -115,6 +115,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
@ -252,8 +253,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
/*
|
||||
// TVA
|
||||
$pdf->SetXY ($this->posxtva, $curY);
|
||||
@ -265,19 +266,19 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
*/
|
||||
// Quantity
|
||||
$pdf->SetXY ($this->posxqty, $curY);
|
||||
$pdf->MultiCell(30, 4, $delivery->lignes[$i]->qty_shipped, 0, 'R');
|
||||
$pdf->MultiCell(30, 3, $delivery->lignes[$i]->qty_shipped, 0, 'R');
|
||||
/*
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY ($this->posxdiscount, $curY);
|
||||
if ($delivery->lignes[$i]->remise_percent)
|
||||
{
|
||||
$pdf->MultiCell(14, 4, $delivery->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
$pdf->MultiCell(14, 3, $delivery->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT ligne
|
||||
$pdf->SetXY ($this->postotalht, $curY);
|
||||
$total = price($delivery->lignes[$i]->price * $delivery->lignes[$i]->qty);
|
||||
$pdf->MultiCell(23, 4, $total, 0, 'R', 0);
|
||||
$pdf->MultiCell(23, 3, $total, 0, 'R', 0);
|
||||
|
||||
// Collecte des totaux par valeur de tva
|
||||
// dans le tableau tva["taux"]=total_tva
|
||||
@ -287,6 +288,19 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
*/
|
||||
$nexY+=2; // Passe espace entre les lignes
|
||||
|
||||
// Cherche nombre de lignes a venir pour savoir si place suffisante
|
||||
if ($i < ($nblignes - 1)) // If it's not last line
|
||||
{
|
||||
//on récupère la description du produit suivant
|
||||
$follow_descproduitservice = $delivery->lignes[$i+1]->desc;
|
||||
//on compte le nombre de ligne afin de vérifier la place disponible (largeur de ligne 52 caracteres)
|
||||
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52)*4);
|
||||
}
|
||||
else // If it's last line
|
||||
{
|
||||
$nblineFollowDesc = 0;
|
||||
}
|
||||
|
||||
// Test if a new page is required
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
@ -314,7 +328,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
$pagenb++;
|
||||
$this->_pagehead($pdf, $delivery, 1, $outputlangs);
|
||||
$this->_pagehead($pdf, $delivery, 0, $outputlangs);
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
@ -363,7 +377,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
|
||||
/*
|
||||
* \brief Affiche la grille des lignes de propales
|
||||
* \brief Affiche la grille des lignes
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||
@ -413,9 +427,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
/**
|
||||
* \brief Affiche en-tete bon livraison
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet propale
|
||||
* \param showadress 0=non, 1=oui
|
||||
* \param pdf objet PDF
|
||||
* \param delivery object delivery
|
||||
* \param showadress 0=non, 1=oui
|
||||
*/
|
||||
function _pagehead(&$pdf, $delivery, $showadress=1, $outputlangs)
|
||||
{
|
||||
|
||||
@ -202,7 +202,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$pagenb++;
|
||||
$this->_pagehead($pdf, $propale, 1, $outputlangs);
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
|
||||
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 4
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$tab_top = 90;
|
||||
|
||||
@ -12,6 +12,8 @@ QtyDelivered=Qté livrée
|
||||
SetDeliveryDate=Définir la date de livraison
|
||||
ValidateDeliveryReceipt=Valider le bon de livraison
|
||||
ValidateDeliveryReceiptConfirm=Etes-vous sur de vouloir valider ce bon de livraison ?
|
||||
DeleteDeliveryReceipt=Supprimer le bon de livraison
|
||||
DeleteDeliveryReceiptConfirm=Etes-vous sur de vouloir supprimer ce bon de livraison ?
|
||||
DeliveryMethod=Méthode de livraison
|
||||
TrackingNumber=Numero de suivi
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||
@ -399,7 +399,7 @@ else
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
$expedition_id = $_GET["expid"];
|
||||
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&expid='.$expedition_id,'Supprimer le bon de livraison','Etes-vous s<>r de vouloir supprimer ce bon de livraison ?','confirm_delete');
|
||||
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm"),'confirm_delete');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@ -475,14 +475,16 @@ else
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "</table><br>\n";
|
||||
|
||||
/*
|
||||
* Lignes produits
|
||||
*/
|
||||
print '<br><table class="noborder" width="100%">';
|
||||
|
||||
$num_prod = sizeof($livraison->lignes);
|
||||
$i = 0; $total = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
if ($num_prod)
|
||||
{
|
||||
@ -493,34 +495,51 @@ else
|
||||
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num_prod)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
$var=true;
|
||||
while ($i < $num_prod)
|
||||
print "<tr $bc[$var]>";
|
||||
if ($livraison->lignes[$i]->fk_product > 0)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
if ($livraison->lignes[$i]->fk_product > 0)
|
||||
$product = new Product($db);
|
||||
$product->fetch($livraison->lignes[$i]->fk_product);
|
||||
|
||||
print '<td>';
|
||||
|
||||
// Affiche ligne produit
|
||||
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$livraison->lignes[$i]->fk_product.'">';
|
||||
if ($livraison->lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
|
||||
else $text.= img_object($langs->trans('ShowProduct'),'product');
|
||||
$text.= ' '.$livraison->lignes[$i]->ref.'</a>';
|
||||
$text.= ' - '.$livraison->lignes[$i]->label;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($livraison->lignes[$i]->description));
|
||||
//print $description;
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
print_date_range($livraison->lignes[$i]->date_start,$livraison->lignes[$i]->date_end);
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($livraison->lignes[$i]->fk_product);
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$livraison->lignes[$i]->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
if ($livraison->lignes[$i]->description) print '<br>'.$livraison->lignes[$i]->description;
|
||||
print '</td>';
|
||||
print ($livraison->lignes[$i]->description && $livraison->lignes[$i]->description!=$livraison->lignes[$i]->label)?'<br>'.dol_htmlentitiesbr($livraison->lignes[$i]->description):'';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".$livraison->lignes[$i]->description."</td>\n";
|
||||
}
|
||||
|
||||
print '<td align="center">'.$livraison->lignes[$i]->qty_asked.'</td>';
|
||||
print '<td align="center">'.$livraison->lignes[$i]->qty_shipped.'</td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>";
|
||||
if ($livraison->lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($livraison->lignes[$i]->description);
|
||||
print_date_range($objp->date_start,$objp->date_end);
|
||||
print "</td>\n";
|
||||
}
|
||||
|
||||
print '<td align="center">'.$livraison->lignes[$i]->qty_asked.'</td>';
|
||||
print '<td align="center">'.$livraison->lignes[$i]->qty_shipped.'</td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -99,6 +99,7 @@ class Livraison extends CommonObject
|
||||
if ($this->expedition_id) $sql.= ", $this->expedition_id";
|
||||
$sql.= ")";
|
||||
|
||||
dolibarr_syslog("Livraison::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -107,6 +108,8 @@ class Livraison extends CommonObject
|
||||
$numref="(PROV".$this->id.")";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."livraison ";
|
||||
$sql.= "SET ref='".addslashes($numref)."' WHERE rowid=".$this->id;
|
||||
|
||||
dolibarr_syslog("Livraison::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -126,29 +129,19 @@ class Livraison extends CommonObject
|
||||
$origin_id=$this->lignes[$i]->origin_line_id;
|
||||
if (! $origin_id) $origin_id=$this->lignes[$i]->commande_ligne_id; // For backward compatibility
|
||||
|
||||
if (! $this->create_line(0, $origin_id, $this->lignes[$i]->qty, $this->lignes[$i]->fk_product))
|
||||
if (! $this->create_line(0, $origin_id, $this->lignes[$i]->qty, $this->lignes[$i]->fk_product, $this->lignes[$i]->description))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($conf->livraison->enabled && $this->origin_id)
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'co_liv (fk_livraison, fk_commande) VALUES ('.$this->id.','.$this->origin_id.')';
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
if (! $conf->expedition->enabled)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " SET fk_statut = 2";
|
||||
$sql.= " WHERE rowid=".$this->commande_id;
|
||||
|
||||
dolibarr_syslog("Livraison::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -193,19 +186,20 @@ class Livraison extends CommonObject
|
||||
*
|
||||
*
|
||||
*/
|
||||
function create_line($transaction, $commande_ligne_id, $qty, $fk_product=0)
|
||||
function create_line($transaction, $commande_ligne_id, $qty, $fk_product=0, $description)
|
||||
{
|
||||
$error = 0;
|
||||
$idprod = $fk_product;
|
||||
$j = 0;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."livraisondet (fk_livraison, fk_origin_line,";
|
||||
if ($idprod) $sql.=" fk_product,";
|
||||
$sql.= " qty)";
|
||||
$sql.= " fk_product, description, qty)";
|
||||
$sql.= " VALUES (".$this->id.",".$commande_ligne_id.",";
|
||||
if ($idprod) $sql.=" ".$idprod.",";
|
||||
$sql.= " ".($idprod>0?$idprod:"null").",";
|
||||
$sql.= " ".($description?"'".addslashes($description)."'":"null").",";
|
||||
$sql.= $qty.")";
|
||||
|
||||
dolibarr_syslog("Livraison::create_line sql=".$sql, LOG_DEBUG);
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
$error++;
|
||||
@ -218,8 +212,7 @@ class Livraison extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Lit un bon de livraison
|
||||
*
|
||||
* \brief Read a delivery receipt
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
@ -633,9 +626,9 @@ class Livraison extends CommonObject
|
||||
{
|
||||
$this->lignes = array();
|
||||
|
||||
$sql = "SELECT p.label, p.ref,";
|
||||
$sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,";
|
||||
$sql.= " cd.qty as qty_asked,";
|
||||
$sql.= " ld.description, ld.fk_product, ld.subprice, ld.total_ht, ld.qty as qty_shipped";
|
||||
$sql.= " p.ref, p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."livraisondet as ld";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on p.rowid = ld.fk_product";
|
||||
$sql.= " WHERE ld.fk_origin_line = cd.rowid AND ld.fk_livraison = ".$this->id;
|
||||
@ -652,12 +645,17 @@ class Livraison extends CommonObject
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$ligne->description = $obj->description;
|
||||
$ligne->fk_product = $obj->fk_product;
|
||||
$ligne->qty_asked = $obj->qty_asked;
|
||||
$ligne->qty_shipped = $obj->qty_shipped;
|
||||
|
||||
$ligne->ref = $obj->ref;
|
||||
$ligne->libelle = $obj->label; // Label produit
|
||||
$ligne->label = $obj->label;
|
||||
$ligne->description = $obj->description;
|
||||
$ligne->product_desc = $obj->product_desc; // Description produit
|
||||
$ligne->product_type = $obj->fk_product_type;
|
||||
|
||||
$ligne->price = $obj->price;
|
||||
$ligne->total_ht = $obj->total_ht;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user