';
-
- // Ref
- print '';
- if ($conf->commande->enabled)
- {
- print $langs->trans("RefOrder").' '.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref;
- }
- else
- {
- print $langs->trans("RefProposal").' '.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref;
+ /*
+ * Document source
+ */
+ print ' ';
- print " \n";
- // Ref client
- print '';
- print $langs->trans('RefCustomer').' ';
- print $object->ref_client;
- print ' ';
- print ' ';
+ print '";
+ if ($object->note && ! $user->societe_id)
+ {
+ print ''.$langs->trans("NotePrivate").': '.nl2br($object->note)." ";
+ }
- /*
- * Lignes de commandes
- *
- */
- print ' ";
- /* Lecture des expeditions déjà effectuées */
- $object->loadExpeditions();
+ /*
+ * Lignes de commandes
+ *
+ */
+ print '';
- if ($numAsked)
- {
- print '';
- print ''.$langs->trans("Description").' ';
- print ''.$langs->trans("QtyOrdered").' ';
- print ''.$langs->trans("QtyShipped").' ';
- print ''.$langs->trans("QtyToShip").' ';
- if ($conf->stock->enabled)
- {
- if ($_GET["entrepot_id"])
- {
- print ''.$langs->trans("Stock").' ';
- }
- else
- {
- print ''.$langs->trans("Warehouse").' ';
- }
- }
- print " \n";
- }
+ //$lignes = $object->fetch_lines(1);
+ $numAsked = sizeof($object->lignes);
- $var=true;
- $indiceAsked = 0;
- while ($indiceAsked < $numAsked)
- {
- $ligne = $object->lignes[$indiceAsked];
- $var=!$var;
- print "\n";
- if ($ligne->fk_product > 0)
- {
- $product = new Product($db);
- $product->fetch($ligne->fk_product);
+ /* Lecture des expeditions déjà effectuées */
+ $object->loadExpeditions();
- print '';
- print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
- if ($ligne->desc) print nl2br($ligne->desc);
- print ' ';
- }
- else
- {var_dump($ligne);
- print "".nl2br($ligne->desc)." \n";
- }
-
- print ''.$ligne->qty.' ';
-
- print '';
- $quantityDelivered = $object->expeditions[$ligne->fk_product];
- print $quantityDelivered;
- print ' ';
-
- $quantityAsked = $ligne->qty;
- $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
-
- if ($conf->stock->enabled)
- {
- $defaultqty=0;
- if ($_GET["entrepot_id"])
- {
- $stock = $product->stock_entrepot[$_GET["entrepot_id"]];
- $stock+=0; // Convertit en numérique
- $defaultqty=min($quantityToBeDelivered, $stock);
- if ($defaultqty < 0) $defaultqty=0;
- }
+ if ($numAsked)
+ {
+ print ' ';
+ print ''.$langs->trans("Description").' ';
+ print ''.$langs->trans("QtyOrdered").' ';
+ print ''.$langs->trans("QtyShipped").' ';
+ print ''.$langs->trans("QtyToShip").' ';
+ if ($conf->stock->enabled)
+ {
+ if ($_GET["entrepot_id"])
+ {
+ print ''.$langs->trans("Stock").' ';
+ }
+ else
+ {
+ print ''.$langs->trans("Warehouse").' ';
+ }
+ }
+ print " \n";
+ }
- // Quantité à livrer
- print '';
- print ' ';
- print ' ';
- print ' ';
+ $var=true;
+ $indiceAsked = 0;
+ while ($indiceAsked < $numAsked)
+ {
+ $ligne = $object->lignes[$indiceAsked];
+ $var=!$var;
+ print "\n";
+ if ($ligne->fk_product > 0)
+ {
+ $product = new Product($db);
+ $product->fetch($ligne->fk_product);
- // Stock
- if ($_GET["entrepot_id"])
- {
- print ''.$stock;
- if ($stock < $quantityToBeDelivered)
- {
- print ' '.img_warning($langs->trans("StockTooLow"));
- }
- print ' ';
- }
- else
- {
- $array=array();
+ print '';
+ print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
+ if ($ligne->desc) print nl2br($ligne->desc);
+ print ' ';
+ }
+ else
+ {var_dump($ligne);
+ print "".nl2br($ligne->desc)." \n";
+ }
- $sql = "SELECT e.rowid, e.label, ps.reel";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."entrepot as e";
- $sql.= " WHERE ps.fk_entrepot = e.rowid AND fk_product = '".$product->id."'";
- $result = $db->query($sql) ;
- if ($result)
- {
- $num = $db->num_rows($result);
- $i=0;
- if ($num > 0)
- {
- while ($i < $num)
- {
- $obj = $db->fetch_object($result);
- $array[$obj->rowid] = $obj->label.' ('.$obj->reel.')';
- $i++;
- }
- }
- $db->free($result);
- }
- else
- {
- $this->error=$db->error();
- return -1;
- }
+ print ''.$ligne->qty.' ';
- print '';
- $html->select_array('entl'.$i,$array,'',1,0,0);
- print ' ';
- }
- }
- else
- {
- // Quantité à livrer
- print '';
- print ' ';
- print ' ';
- print ' ';
- }
-
- print " \n";
-
- $indiceAsked++;
- }
+ print '';
+ $quantityDelivered = $object->expeditions[$ligne->id];
+ print $quantityDelivered;
+ print ' ';
+
+ $quantityAsked = $ligne->qty;
+ $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
+
+ if ($conf->stock->enabled)
+ {
+ $defaultqty=0;
+ if ($_GET["entrepot_id"])
+ {
+ $stock = $product->stock_entrepot[$_GET["entrepot_id"]];
+ $stock+=0; // Convertit en numérique
+ $defaultqty=min($quantityToBeDelivered, $stock);
+ if ($defaultqty < 0) $defaultqty=0;
+ }
+
+ // Quantité à livrer
+ print '';
+ print ' ';
+ print ' ';
+ print ' ';
+
+ // Stock
+ if ($_GET["entrepot_id"])
+ {
+ print ''.$stock;
+ if ($stock < $quantityToBeDelivered)
+ {
+ print ' '.img_warning($langs->trans("StockTooLow"));
+ }
+ print ' ';
+ }
+ else
+ {
+ $array=array();
+
+ $sql = "SELECT e.rowid, e.label, ps.reel";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."entrepot as e";
+ $sql.= " WHERE ps.fk_entrepot = e.rowid AND fk_product = '".$product->id."'";
+ $result = $db->query($sql) ;
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ $i=0;
+ if ($num > 0)
+ {
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($result);
+ $array[$obj->rowid] = $obj->label.' ('.$obj->reel.')';
+ $i++;
+ }
+ }
+ $db->free($result);
+ }
+ else
+ {
+ $this->error=$db->error();
+ return -1;
+ }
+
+ print '';
+ $html->select_array('entl'.$i,$array,'',1,0,0);
+ print ' ';
+ }
+ }
+ else
+ {
+ // Quantité à livrer
+ print '';
+ print ' ';
+ print ' ';
+ print ' ';
+ }
+
+ print "\n";
+
+ $indiceAsked++;
+ }
/*
*
@@ -449,7 +448,7 @@ if ($_GET["action"] == 'create')
}
else
{
- dolibarr_print_error($db);
+ dolibarr_print_error($db);
}
}
}
@@ -462,7 +461,7 @@ else
{
if ($_GET["id"] > 0)
{
- $expedition = New Expedition($db);
+ $expedition = new Expedition($db);
$result = $expedition->fetch($_GET["id"]);
if ($result < 0)
{
@@ -582,7 +581,7 @@ else
// Date
print ''.$langs->trans("Date").' ';
- print ''.dolibarr_print_date($expedition->date,"day")." \n";
+ print ''.dolibarr_print_date($expedition->date,"daytext")." \n";
print ' ';
// Poids Total
@@ -715,7 +714,7 @@ else
/*
- * Documents générés
+ * Documents generated
*/
if ($conf->expedition_bon->enabled)
{
@@ -740,8 +739,9 @@ else
print '
';
print ' ';
- show_list_sending_receive($expedition->origin,$expedition->origin_id," AND e.rowid <> ".$expedition->id);
-
+ //show_list_sending_receive($expedition->origin,$expedition->origin_id," AND e.rowid <> ".$expedition->id);
+ show_list_sending_receive($expedition->origin,$expedition->origin_id);
+
}
else
{
diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
index 329a29b2e09..7cacec03055 100644
--- a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
+++ b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
@@ -167,7 +167,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetFont('Arial','', 7);
//Insertion de l entete
- $this->_pagehead($pdf, $this->expe);
+ $this->_pagehead($pdf, $this->expe, $outputlangs);
//Initialisation des coordonnées
$tab_top = 53;
@@ -180,7 +180,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$curY = $pdf->GetY();
$nexY = $pdf->GetY();
//Generation du tableau
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
+ $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
//Recuperation des produits de la commande.
$this->expe->commande->fetch_lines(1);
$Produits = $this->expe->commande->lignes;
@@ -199,27 +199,32 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//Insertion du libelle
$pdf->SetFont('Arial','', 7);
$pdf->SetXY (50, $curY );
- $pdf->MultiCell(130, 5, $Prod->libelle, 0, 'L', 0);
- //Insertion de la quantite
+ $pdf->MultiCell(90, 5, $Prod->libelle, 0, 'L', 0);
+ //Insertion de la quantite commandée
$pdf->SetFont('Arial','', 7);
- $pdf->SetXY (180, $curY );
- $pdf->MultiCell(20, 5, $Produits[$i]->qty, 0, 'L', 0);
+ $pdf->SetXY (140, $curY );
+ $pdf->MultiCell(30, 5, $this->expe->lignes[$i]->qty_asked, 0, 'C', 0);
+ //Insertion de la quantite à envoyer
+ $pdf->SetFont('Arial','', 7);
+ $pdf->SetXY (170, $curY );
+ $pdf->MultiCell(30, 5, $this->expe->lignes[$i]->qty_shipped, 0, 'C', 0);
+
//Generation de la page 2
$curY += 4;
$nexY = $curY;
if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1){
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
- $this->_pagefoot($pdf);
+ $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
+ $this->_pagefoot($pdf, $outputlangs);
$pdf->AliasNbPages();
$pdf->AddPage();
$nexY = $iniY;
- $this->_pagehead($pdf, $this->expe);
+ $this->_pagehead($pdf, $this->expe, $outputlangs);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 7);
}
}
//Insertion du pied de page
- $this->_pagefoot($pdf);
+ $this->_pagefoot($pdf, $outputlangs);
$pdf->AliasNbPages();
@@ -252,7 +257,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//********************************
// Generation du tableau
//********************************
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
{
global $langs;
@@ -267,18 +272,20 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->MultiCell(10,5,"LR",0,'C',1);
$pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
$pdf->SetXY(30,$tab_top);
- $pdf->MultiCell(20,5,$langs->transnoentities("Ref"),0,'C',1);
+ $pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1);
$pdf->SetXY(50,$tab_top);
- $pdf->MultiCell(130,5,$langs->transnoentities("Description"),0,'L',1);
- $pdf->SetXY(180,$tab_top);
- $pdf->MultiCell(20,5,$langs->transnoentities("Quantity"),0,'L',1);
+ $pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1);
+ $pdf->SetXY(140,$tab_top);
+ $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1);
+ $pdf->SetXY(170,$tab_top);
+ $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1);
$pdf->Rect(10, $tab_top, 190, $tab_height);
}
//********************************
// Generation du Pied de page
//********************************
- function _pagefoot(&$pdf)
+ function _pagefoot(&$pdf, $outputlangs)
{
$pdf->SetFont('Arial','',8);
$pdf->SetY(-23);
@@ -295,7 +302,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//********************************
// Generation de l entete
//********************************
- function _pagehead(&$pdf, $exp)
+ function _pagehead(&$pdf, $exp, $outputlangs)
{
global $conf, $langs;
@@ -331,7 +338,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetXY(60,7);
$pdf->SetFont('Arial','B',14);
$pdf->SetTextColor(0,0,0);
- $pdf->MultiCell(0, 8, $langs->transnoentities("SendingSheet"), '' , 'L'); // Bordereau expedition
+ $pdf->MultiCell(0, 8, $outputlangs->transnoentities("SendingSheet"), '' , 'L'); // Bordereau expedition
//Num Expedition
$Yoff = $Yoff+7;
$Xoff = 140;
@@ -339,7 +346,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetXY($Xoff,$Yoff);
$pdf->SetFont('Arial','',8);
$pdf->SetTextColor(0,0,0);
- $pdf->MultiCell(0, 8, $langs->transnoentities("RefSending").': '.$exp->ref, '' , 'L');
+ $pdf->MultiCell(0, 8, $outputlangs->transnoentities("RefSending").': '.$exp->ref, '' , 'L');
//$this->Code39($Xoff+43, $Yoff+1, $this->expe->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
//Num Commande
$Yoff = $Yoff+4;
@@ -347,7 +354,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetXY($Xoff,$Yoff);
$pdf->SetFont('Arial','',8);
$pdf->SetTextColor(0,0,0);
- $pdf->MultiCell(0, 8, $langs->transnoentities("RefOrder").': '.$exp->commande->ref, '' , 'L');
+ $pdf->MultiCell(0, 8, $outputlangs->transnoentities("RefOrder").': '.$exp->commande->ref, '' , 'L');
$Xoff = 115;
//$this->Code39($Xoff+43, $Yoff+1, $exp->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
@@ -491,7 +498,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//Tel Client
$pdf->SetXY($blDestX,$Yoff+$blSocY);
$pdf->SetFont('Arial','',7);
- $pdf->MultiCell($blW,3, "Tel : ".$this->destinataire->phone_pro, 0, 'L');
+ $pdf->MultiCell($blW,3, $outputlangs->trans("Tel")." : ".$this->destinataire->phone_pro, 0, 'L');
}
}
?>
diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang
index 5a570a47a13..4fbe394d624 100644
--- a/htdocs/langs/en_US/deliveries.lang
+++ b/htdocs/langs/en_US/deliveries.lang
@@ -5,6 +5,7 @@ DeliveryCard=Delivery card
DeliveryOrder=Delivery order
DeliveryOrders=Delivery orders
DeliveryDate=Delivery date
+DeliveryDateShort=Deliv. date
CreateDeliveryOrder=Generate delivery order
SetDeliveryDate=Set shipping date
ValidateDeliveryReceipt=Validate delivery receipt
diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang
index 3d3fd8b7d85..91814da1ded 100644
--- a/htdocs/langs/en_US/sendings.lang
+++ b/htdocs/langs/en_US/sendings.lang
@@ -21,7 +21,8 @@ QtyToShip=Qty to ship
QtyReceived=Qty received
KeepToShip=Keep to ship
OtherSendingsForSameOrder=Other sendings for this order
-DateSending=Date sending
+DateSending=Date sending order
+DateSendingShort=Date sending order
SendingsForSameOrder=Sendings for this order
SendingsAndReceivingForSameOrder=Sendings and receivings for this order
SendingsToValidate=Sending to validate
diff --git a/htdocs/langs/fr_FR/deliveries.lang b/htdocs/langs/fr_FR/deliveries.lang
index b577ec8057c..59557dbab97 100644
--- a/htdocs/langs/fr_FR/deliveries.lang
+++ b/htdocs/langs/fr_FR/deliveries.lang
@@ -5,6 +5,7 @@ DeliveryCard=Fiche livraison
DeliveryOrder=Bon de livraison
DeliveryOrders=Bons de livraison
DeliveryDate=Date de livraison
+DeliveryDateShort=Date livr.
CreateDeliveryOrder=Générer bon de livraison
QtyDelivered=Qté livrée
SetDeliveryDate=Définir la date de livraison
diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang
index 59fc73e3f07..bc218afa927 100644
--- a/htdocs/langs/fr_FR/sendings.lang
+++ b/htdocs/langs/fr_FR/sendings.lang
@@ -13,15 +13,16 @@ StatisticsOfSendings=Statistiques des exp
NbOfSendings=Nombre d'expéditions
SendingCard=Fiche expédition
NewSending=Nouvelle expédition
-CreateASending=Créer une expedition
-CreateSending=Créer expedition
+CreateASending=Créer une expédition
+CreateSending=Créer expédition
QtyOrdered=Qté commandée
QtyShipped=Qté expédiée
QtyToShip=Qté à expédier
QtyReceived=Qté reçue
KeepToShip=Reste à expédier
OtherSendingsForSameOrder=Autres expéditions pour cette commande
-DateSending=Date d'expedition
+DateSending=Date ordre d'expédition
+DateSendingShort=Date ordre expéd.
SendingsForSameOrder=Expéditions pour cette commande
SendingsAndReceivingForSameOrder=Expéditions et réceptions pour cette commande
SendingsToValidate=Expéditions à valider
diff --git a/htdocs/lib/sendings.lib.php b/htdocs/lib/sendings.lib.php
index 01cb3a7e26e..51cab637d63 100644
--- a/htdocs/lib/sendings.lib.php
+++ b/htdocs/lib/sendings.lib.php
@@ -17,10 +17,10 @@
*/
/**
- \file htdocs/lib/sendings.lib.php
- \ingroup expedition
- \brief Library for expedition module
- \version $Id$
+ * \file htdocs/lib/sendings.lib.php
+ * \ingroup expedition
+ * \brief Library for expedition module
+ * \version $Id$
*/
@@ -37,10 +37,11 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
$sql = "SELECT obj.rowid, obj.fk_product, obj.description, obj.qty as qty_asked";
$sql.= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id";
$sql.= ", e.ref, ".$db->pdate("e.date_expedition")." as date_expedition";
- if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref";
- $sql.= " FROM ".MAIN_DB_PREFIX.$origin."det as obj";
- $sql.= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e";
- if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid";
+ if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, ".$db->pdate("l.date_livraison")." as date_delivery, ld.qty as qty_received";
+ $sql.= " FROM (".MAIN_DB_PREFIX."expeditiondet as ed,";
+ $sql.= " ".MAIN_DB_PREFIX.$origin."det as obj,";
+ $sql.= " ".MAIN_DB_PREFIX."expedition as e)";
+ if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line";
$sql.= " WHERE obj.fk_".$origin." = ".$origin_id;
if ($filter) $sql.=$filter;
$sql.= " AND obj.rowid = ed.fk_origin_line";
@@ -63,17 +64,16 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
print '';
print '';
- print ''.$langs->trans("Ref").' ';
- print ''.$langs->trans("Description").' ';
- print ''.$langs->trans("Qty").' ';
+ print ''.$langs->trans("Description").' ';
+ //print ''.$langs->trans("QtyOrdered").' ';
+ print ''.$langs->trans("SendingSheet").' ';
+ print ''.$langs->trans("QtyShipped").' ';
print ''.$langs->trans("DateSending").' ';
- if ($conf->expedition_bon->enabled)
- {
- print ''.$langs->trans("SendingSheet").' ';
- }
- if ($conf->livraison_bon->enabled)
+ if ($conf->livraison_bon->enabled)
{
print ''.$langs->trans("DeliveryOrder").' ';
+ print ''.$langs->trans("QtyReceived").' ';
+ print ''.$langs->trans("DeliveryDate").' ';
}
print " \n";
@@ -83,7 +83,8 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
$var=!$var;
$objp = $db->fetch_object($resql);
print "";
- print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' ';
+
+ // Description
if ($objp->fk_product > 0)
{
$product = new Product($db);
@@ -98,21 +99,28 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
{
print "".dol_htmlentitiesbr(dolibarr_trunc($objp->description,24))." \n";
}
+
+ //print ''.$objp->qty_asked.' ';
+
+ // Sending id
+ print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' ';
+
print ''.$objp->qty_shipped.' ';
+
print ''.dolibarr_print_date($objp->date_expedition,'dayhour').' ';
- if ($conf->expedition_bon->enabled)
- {
- print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' ';
- }
if ($conf->livraison_bon->enabled)
{
if ($objp->livraison_id)
{
print ''.img_object($langs->trans("ShowSending"),'generic').' '.$objp->livraison_ref.' ';
+ print ''.$objp->qty_received.' ';
+ print ''.dolibarr_print_date($objp->date_delivery,'dayhour').' ';
}
else
{
print ' ';
+ print ' ';
+ print ' ';
}
}
print ' ';
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index 21ee602b83b..c7a6430cfee 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -21,15 +21,16 @@
*/
/**
- \file htdocs/livraison/fiche.php
- \ingroup livraison
- \brief Fiche descriptive d'un bon de livraison
- \version $Id$
+ * \file htdocs/livraison/fiche.php
+ * \ingroup livraison
+ * \brief Fiche descriptive d'un bon de livraison
+ * \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/livraison/mods/modules_livraison.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/sendings.lib.php");
if ($conf->produit->enabled) require_once(DOL_DOCUMENT_ROOT."/product.class.php");
if ($conf->expedition_bon->enabled) require_once(DOL_DOCUMENT_ROOT."/expedition/expedition.class.php");
if ($conf->stock->enabled) require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
@@ -42,7 +43,7 @@ if (!$user->rights->expedition->livraison->lire)
accessforbidden();
-// S�curit� acc�s client
+// Security check
if ($user->societe_id > 0)
{
$action = '';
@@ -125,6 +126,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
{
Header("Location: liste.php");
}
+ exit;
}
}
@@ -234,7 +236,7 @@ if ($_GET["action"] == 'create')
if ($commande->note)
{
- print 'Note : '.nl2br($commande->note)." ";
+ print 'Note : '.nl2br($commande->note)." ";
}
print "
";
@@ -254,84 +256,84 @@ if ($_GET["action"] == 'create')
if ($num)
{
- print '';
- print ''.$langs->trans("Description").' ';
- print 'Quan. command�e ';
- print 'Quan. livr�e ';
- print 'Quan. � livrer ';
- if ($conf->stock->enabled)
- {
- print ''.$langs->trans("Stock").' ';
- }
- print " \n";
+ print '';
+ print ''.$langs->trans("Description").' ';
+ print 'Quan. command�e ';
+ print 'Quan. livr�e ';
+ print 'Quan. � livrer ';
+ if ($conf->stock->enabled)
+ {
+ print ''.$langs->trans("Stock").' ';
+ }
+ print " \n";
}
$var=true;
while ($i < $num)
{
- $ligne = $commande->lignes[$i];
- $var=!$var;
- print "\n";
- if ($ligne->fk_product > 0)
- {
- $product = new Product($db);
- $product->fetch($ligne->fk_product);
-
- print '';
- print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
- if ($ligne->description) print nl2br($ligne->description);
- print ' ';
- }
- else
- {
- print "".nl2br($ligne->description)." \n";
- }
-
- print ''.$ligne->qty.' ';
- /*
- *
- */
- print '';
- $quantite_livree = $commande->livraisons[$ligne->fk_product];
- print $quantite_livree;;
- print ' ';
+ $ligne = $commande->lignes[$i];
+ $var=!$var;
+ print " \n";
+ if ($ligne->fk_product > 0)
+ {
+ $product = new Product($db);
+ $product->fetch($ligne->fk_product);
- $quantite_commandee = $ligne->qty;
- $quantite_a_livrer = $quantite_commandee - $quantite_livree;
-
- if ($conf->stock->enabled)
- {
- $stock = $product->stock_entrepot[$_GET["entrepot_id"]];
- $stock+=0; // Convertit en num�rique
+ print '';
+ print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
+ if ($ligne->description) print nl2br($ligne->description);
+ print ' ';
+ }
+ else
+ {
+ print "".nl2br($ligne->description)." \n";
+ }
- // Quantit� � livrer
- print '';
- print ' ';
- print ' ';
- print ' ';
+ print ''.$ligne->qty.' ';
+ /*
+ *
+ */
+ print '';
+ $quantite_livree = $commande->livraisons[$ligne->id];
+ print $quantite_livree;;
+ print ' ';
- // Stock
- if ($stock < $quantite_a_livrer)
- {
- print ''.$stock.' '.img_alerte().' ';
- }
- else
- {
- print ''.$stock.' ';
- }
- }
- else
- {
- // Quantit� � livrer
- print '';
- print ' ';
- print ' ';
- print ' ';
- }
+ $quantite_commandee = $ligne->qty;
+ $quantite_a_livrer = $quantite_commandee - $quantite_livree;
- print " \n";
-
- $i++;
- $var=!$var;
+ if ($conf->stock->enabled)
+ {
+ $stock = $product->stock_entrepot[$_GET["entrepot_id"]];
+ $stock+=0; // Convertit en num�rique
+
+ // Quantit� � livrer
+ print '';
+ print ' ';
+ print ' ';
+ print ' ';
+
+ // Stock
+ if ($stock < $quantite_a_livrer)
+ {
+ print ''.$stock.' '.img_alerte().' ';
+ }
+ else
+ {
+ print ''.$stock.' ';
+ }
+ }
+ else
+ {
+ // Quantit� � livrer
+ print '';
+ print ' ';
+ print ' ';
+ print ' ';
+ }
+
+ print "\n";
+
+ $i++;
+ $var=!$var;
}
/*
@@ -359,6 +361,9 @@ else
$livraison = new Livraison($db);
$result = $livraison->fetch($_GET["id"]);
$livraison->fetch_client();
+
+ $expedition=new Expedition($db);
+ $result = $expedition->fetch($livraison->expedition_id);
if ($livraison->origin_id)
{
@@ -370,7 +375,7 @@ else
{
$soc = new Societe($db);
$soc->fetch($livraison->socid);
-
+
$h=0;
if ($conf->expedition_bon->enabled)
{
@@ -378,7 +383,7 @@ else
$head[$h][1] = $langs->trans("SendingCard");
$h++;
}
-
+
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$livraison->id;
$head[$h][1] = $langs->trans("DeliveryCard");
$hselected = $h;
@@ -427,7 +432,7 @@ else
{
print ''.$langs->trans("RefOrder").' ';
$order=new Commande($db);
- $order->fetch($livraison->origin_id);
+ $order->fetch($expedition->origin_id);
print '';
print $order->getNomUrl(1,4);
print " \n";
@@ -481,13 +486,13 @@ else
if ($num_prod)
{
$i = 0;
-
+
print '';
print ''.$langs->trans("Products").' ';
print ''.$langs->trans("QtyOrdered").' ';
print ''.$langs->trans("QtyReceived").' ';
print " \n";
-
+
$var=true;
while ($i < $num_prod)
{
@@ -497,7 +502,7 @@ else
{
$product = new Product($db);
$product->fetch($livraison->lignes[$i]->fk_product);
-
+
print '';
print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
if ($livraison->lignes[$i]->description) print ' '.$livraison->lignes[$i]->description;
@@ -529,7 +534,7 @@ else
if ($user->societe_id == 0)
{
print '';
-
+
if (! eregi('^(valid|delete)',$_REQUEST["action"]))
{
if ($livraison->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
@@ -549,15 +554,15 @@ else
}
}
}
-
+
print '
';
}
print "\n";
-
+
print "";
-
+
/*
- * Documents g�n�r�s
+ * Documents generated
*/
$livraisonref = sanitize_string($livraison->ref);
@@ -568,81 +573,17 @@ else
$delallowed=$user->rights->expedition->livraison->supprimer;
$somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
-
- /*
- * D�j� livre
- */
- $sql = "SELECT ld.fk_product, ld.description, ld.qty as qty_shipped, ld.fk_livraison as livraison_id";
- $sql.= ", l.ref, ".$db->pdate("l.date_livraison")." as date_livraison";
- $sql.= ", cd.rowid, cd.qty as qty_commande";
- $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
- $sql.= " , ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l";
- $sql.= " WHERE l.rowid <> ".$livraison->id;
- $sql.= " AND cd.rowid = ld.fk_origin_line";
- $sql.= " AND ld.fk_livraison = l.rowid";
- $sql.= " AND l.fk_statut > 0";
- $sql.= " ORDER BY cd.fk_product";
-
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0;
-
- if ($num)
- {
- print ' ';
-
- print_titre($langs->trans("OtherSendingsForSameOrder"));
- print '';
- print '';
- print ''.$langs->trans("Sending").' ';
- print ''.$langs->trans("Description").' ';
- print ''.$langs->trans("QtyShipped").' ';
- print ''.$langs->trans("Date").' ';
- print " \n";
-
- $var=True;
- while ($i < $num)
- {
- $var=!$var;
- $objp = $db->fetch_object($resql);
- print "";
- print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' ';
- if ($objp->fk_product > 0)
- {
- $product = new Product($db);
- $product->fetch($objp->fk_product);
-
- print '';
- print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
- if ($objp->description) print nl2br($objp->description);
- print ' ';
- }
- else
- {
- print "".stripslashes(nl2br($objp->description))." \n";
- }
- print ''.$objp->qty_shipped.' ';
- print ''.dolibarr_print_date($objp->date_livraison,"dayhour").' ';
- print ' ';
- $i++;
- }
-
- print '
';
- }
- $db->free($resql);
- }
- else
- {
- dolibarr_print_error($db);
- }
+ if ($genallowed && ! $somethingshown) $somethingshown=1;
print ' ';
- // Rien � droite
-
+ // Rien a droite
+
print '
';
+
+ print ' ';
+ //show_list_sending_receive($expedition->origin,$expedition->origin_id," AND e.rowid <> ".$expedition->id);
+ show_list_sending_receive($expedition->origin,$expedition->origin_id);
}
else
{
diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php
index ec197b6b2f9..6a865afa62d 100644
--- a/htdocs/livraison/livraison.class.php
+++ b/htdocs/livraison/livraison.class.php
@@ -633,10 +633,11 @@ class Livraison extends CommonObject
$this->lignes = array();
$sql = "SELECT p.label, p.ref,";
- $sql.= " l.description, l.fk_product, l.subprice, l.total_ht, l.qty as qty_shipped";
- $sql.= " FROM ".MAIN_DB_PREFIX."livraisondet as l";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on p.rowid = l.fk_product";
- $sql.= " WHERE l.fk_livraison = ".$this->id;
+ $sql.= " cd.qty as qty_asked,";
+ $sql.= " ld.description, ld.fk_product, ld.subprice, ld.total_ht, ld.qty as qty_shipped";
+ $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;
dolibarr_syslog("Livraison::fetch_lignes sql=".$sql);
$resql = $this->db->query($sql);
diff --git a/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php b/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php
index e2dece74534..522737af296 100644
--- a/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php
+++ b/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php
@@ -153,7 +153,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname);
- $this->_pagehead($pdf, $delivery);
+ $this->_pagehead($pdf, $delivery, $outputlangs);
$pagenb = 1;
$tab_top = 100;