Fix: A lot of fix in sending/receiving module
This commit is contained in:
parent
dd3d8084b8
commit
7050187012
@ -1089,23 +1089,29 @@ class Commande extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge tableau avec les expeditions par ligne
|
* \brief Load array this->expeditions of nb of products sent by line in order
|
||||||
* \param filtre_statut Filtre sur statut
|
* \param filtre_statut Filter on status
|
||||||
* \return int <0 if KO, Nb of records if OK
|
* \return int <0 if KO, Nb of lines found if OK
|
||||||
*/
|
*/
|
||||||
function loadExpeditions($filtre_statut=-1)
|
function loadExpeditions($filtre_statut=-1)
|
||||||
{
|
{
|
||||||
$num=0;
|
$num=0;
|
||||||
$this->expeditions = array();
|
$this->expeditions = array();
|
||||||
|
|
||||||
$sql = 'SELECT fk_product, sum(ed.qty)';
|
$sql = 'SELECT cd.rowid, cd.fk_product,';
|
||||||
$sql.=' FROM '.MAIN_DB_PREFIX.'expeditiondet as ed, '.MAIN_DB_PREFIX.'expedition as e, '.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'commandedet as cd';
|
$sql.= ' sum(ed.qty) as qty';
|
||||||
$sql.=' WHERE ed.fk_expedition = e.rowid AND ed.fk_origin_line = cd.rowid AND cd.fk_commande = c.rowid';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'expeditiondet as ed,';
|
||||||
|
if ($filtre_statut >= 0) $sql.= ' '.MAIN_DB_PREFIX.'expedition as e,';
|
||||||
|
$sql.= ' '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||||
|
$sql.= ' WHERE';
|
||||||
|
if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND';
|
||||||
|
$sql.= ' ed.fk_origin_line = cd.rowid';
|
||||||
$sql.= ' AND cd.fk_commande =' .$this->id;
|
$sql.= ' AND cd.fk_commande =' .$this->id;
|
||||||
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut = '.$filtre_statut;
|
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut = '.$filtre_statut;
|
||||||
$sql .= ' GROUP BY fk_product ';
|
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
|
||||||
|
//print $sql;
|
||||||
|
|
||||||
dolibarr_syslog("Commande::loadExpedition sql=".$sql,LOG_DEBUG);
|
dolibarr_syslog("Commande::loadExpeditions sql=".$sql,LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -1113,8 +1119,8 @@ class Commande extends CommonObject
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$row = $this->db->fetch_row($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
$this->expeditions[$row[0]] = $row[1];
|
$this->expeditions[$obj->rowid] = $obj->qty;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
@ -1123,6 +1129,7 @@ class Commande extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
|
dolibarr_syslog("Commande::loadExpeditions ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ llxHeader('',$langs->trans("OrderCard"));
|
|||||||
|
|
||||||
if ($_GET["id"] > 0)
|
if ($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
$commande = New Commande($db);
|
$commande = new Commande($db);
|
||||||
if ( $commande->fetch($_GET["id"]) > 0)
|
if ( $commande->fetch($_GET["id"]) > 0)
|
||||||
{
|
{
|
||||||
$commande->loadExpeditions(1);
|
$commande->loadExpeditions(1);
|
||||||
@ -336,13 +336,14 @@ if ($_GET["id"] > 0)
|
|||||||
*/
|
*/
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
|
|
||||||
$sql = "SELECT cd.fk_product, cd.description, cd.price, cd.qty, cd.rowid, cd.tva_tx, cd.subprice";
|
$sql = "SELECT cd.rowid, cd.fk_product, cd.description, cd.price, cd.qty, cd.tva_tx, cd.subprice";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||||
$sql.= " WHERE cd.fk_commande = ".$commande->id;
|
$sql.= " WHERE cd.fk_commande = ".$commande->id;
|
||||||
$sql.= " AND p.fk_product_type <> 1";
|
// $sql.= " AND p.fk_product_type <> 1"; Why this line ?
|
||||||
$sql.= " ORDER BY cd.rowid";
|
$sql.= " ORDER BY cd.rowid";
|
||||||
|
|
||||||
|
dolibarr_syslog("commande.php sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -390,7 +391,8 @@ if ($_GET["id"] > 0)
|
|||||||
print '<td align="center">'.$objp->qty.'</td>';
|
print '<td align="center">'.$objp->qty.'</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
$quantite_livree = $commande->expeditions[$objp->fk_product];
|
// Nb of sending products for this line of order
|
||||||
|
$quantite_livree = $commande->expeditions[$objp->rowid];
|
||||||
print $quantite_livree;
|
print $quantite_livree;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -513,7 +515,6 @@ if ($_GET["id"] > 0)
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
show_list_sending_receive('commande',$commande->id);
|
show_list_sending_receive('commande',$commande->id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -214,7 +214,6 @@ if ($_GET["action"] == 'create')
|
|||||||
$class = ucfirst($origin);
|
$class = ucfirst($origin);
|
||||||
|
|
||||||
$object = new $class($db);
|
$object = new $class($db);
|
||||||
$object->loadExpeditions();
|
|
||||||
|
|
||||||
if ($object->fetch($origin_id))
|
if ($object->fetch($origin_id))
|
||||||
{
|
{
|
||||||
@ -357,7 +356,7 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<td align="center">'.$ligne->qty.'</td>';
|
print '<td align="center">'.$ligne->qty.'</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
$quantityDelivered = $object->expeditions[$ligne->fk_product];
|
$quantityDelivered = $object->expeditions[$ligne->id];
|
||||||
print $quantityDelivered;
|
print $quantityDelivered;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -462,7 +461,7 @@ else
|
|||||||
{
|
{
|
||||||
if ($_GET["id"] > 0)
|
if ($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
$expedition = New Expedition($db);
|
$expedition = new Expedition($db);
|
||||||
$result = $expedition->fetch($_GET["id"]);
|
$result = $expedition->fetch($_GET["id"]);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -582,7 +581,7 @@ else
|
|||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td colspan="3">'.dolibarr_print_date($expedition->date,"day")."</td>\n";
|
print '<td colspan="3">'.dolibarr_print_date($expedition->date,"daytext")."</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Poids Total
|
// Poids Total
|
||||||
@ -715,7 +714,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents générés
|
* Documents generated
|
||||||
*/
|
*/
|
||||||
if ($conf->expedition_bon->enabled)
|
if ($conf->expedition_bon->enabled)
|
||||||
{
|
{
|
||||||
@ -740,7 +739,8 @@ else
|
|||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
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
|
else
|
||||||
|
|||||||
@ -167,7 +167,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$pdf->SetFont('Arial','', 7);
|
$pdf->SetFont('Arial','', 7);
|
||||||
|
|
||||||
//Insertion de l entete
|
//Insertion de l entete
|
||||||
$this->_pagehead($pdf, $this->expe);
|
$this->_pagehead($pdf, $this->expe, $outputlangs);
|
||||||
|
|
||||||
//Initialisation des coordonnées
|
//Initialisation des coordonnées
|
||||||
$tab_top = 53;
|
$tab_top = 53;
|
||||||
@ -180,7 +180,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$curY = $pdf->GetY();
|
$curY = $pdf->GetY();
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
//Generation du tableau
|
//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.
|
//Recuperation des produits de la commande.
|
||||||
$this->expe->commande->fetch_lines(1);
|
$this->expe->commande->fetch_lines(1);
|
||||||
$Produits = $this->expe->commande->lignes;
|
$Produits = $this->expe->commande->lignes;
|
||||||
@ -199,27 +199,32 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
//Insertion du libelle
|
//Insertion du libelle
|
||||||
$pdf->SetFont('Arial','', 7);
|
$pdf->SetFont('Arial','', 7);
|
||||||
$pdf->SetXY (50, $curY );
|
$pdf->SetXY (50, $curY );
|
||||||
$pdf->MultiCell(130, 5, $Prod->libelle, 0, 'L', 0);
|
$pdf->MultiCell(90, 5, $Prod->libelle, 0, 'L', 0);
|
||||||
//Insertion de la quantite
|
//Insertion de la quantite commandée
|
||||||
$pdf->SetFont('Arial','', 7);
|
$pdf->SetFont('Arial','', 7);
|
||||||
$pdf->SetXY (180, $curY );
|
$pdf->SetXY (140, $curY );
|
||||||
$pdf->MultiCell(20, 5, $Produits[$i]->qty, 0, 'L', 0);
|
$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
|
//Generation de la page 2
|
||||||
$curY += 4;
|
$curY += 4;
|
||||||
$nexY = $curY;
|
$nexY = $curY;
|
||||||
if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1){
|
if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1){
|
||||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
|
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||||
$this->_pagefoot($pdf);
|
$this->_pagefoot($pdf, $outputlangs);
|
||||||
$pdf->AliasNbPages();
|
$pdf->AliasNbPages();
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
$nexY = $iniY;
|
$nexY = $iniY;
|
||||||
$this->_pagehead($pdf, $this->expe);
|
$this->_pagehead($pdf, $this->expe, $outputlangs);
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
$pdf->SetFont('Arial','', 7);
|
$pdf->SetFont('Arial','', 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Insertion du pied de page
|
//Insertion du pied de page
|
||||||
$this->_pagefoot($pdf);
|
$this->_pagefoot($pdf, $outputlangs);
|
||||||
|
|
||||||
$pdf->AliasNbPages();
|
$pdf->AliasNbPages();
|
||||||
|
|
||||||
@ -252,7 +257,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
//********************************
|
//********************************
|
||||||
// Generation du tableau
|
// Generation du tableau
|
||||||
//********************************
|
//********************************
|
||||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
|
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -267,18 +272,20 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$pdf->MultiCell(10,5,"LR",0,'C',1);
|
$pdf->MultiCell(10,5,"LR",0,'C',1);
|
||||||
$pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
|
$pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
|
||||||
$pdf->SetXY(30,$tab_top);
|
$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->SetXY(50,$tab_top);
|
||||||
$pdf->MultiCell(130,5,$langs->transnoentities("Description"),0,'L',1);
|
$pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1);
|
||||||
$pdf->SetXY(180,$tab_top);
|
$pdf->SetXY(140,$tab_top);
|
||||||
$pdf->MultiCell(20,5,$langs->transnoentities("Quantity"),0,'L',1);
|
$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);
|
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
//********************************
|
//********************************
|
||||||
// Generation du Pied de page
|
// Generation du Pied de page
|
||||||
//********************************
|
//********************************
|
||||||
function _pagefoot(&$pdf)
|
function _pagefoot(&$pdf, $outputlangs)
|
||||||
{
|
{
|
||||||
$pdf->SetFont('Arial','',8);
|
$pdf->SetFont('Arial','',8);
|
||||||
$pdf->SetY(-23);
|
$pdf->SetY(-23);
|
||||||
@ -295,7 +302,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
//********************************
|
//********************************
|
||||||
// Generation de l entete
|
// Generation de l entete
|
||||||
//********************************
|
//********************************
|
||||||
function _pagehead(&$pdf, $exp)
|
function _pagehead(&$pdf, $exp, $outputlangs)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -331,7 +338,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$pdf->SetXY(60,7);
|
$pdf->SetXY(60,7);
|
||||||
$pdf->SetFont('Arial','B',14);
|
$pdf->SetFont('Arial','B',14);
|
||||||
$pdf->SetTextColor(0,0,0);
|
$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
|
//Num Expedition
|
||||||
$Yoff = $Yoff+7;
|
$Yoff = $Yoff+7;
|
||||||
$Xoff = 140;
|
$Xoff = 140;
|
||||||
@ -339,7 +346,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$pdf->SetXY($Xoff,$Yoff);
|
$pdf->SetXY($Xoff,$Yoff);
|
||||||
$pdf->SetFont('Arial','',8);
|
$pdf->SetFont('Arial','',8);
|
||||||
$pdf->SetTextColor(0,0,0);
|
$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);
|
//$this->Code39($Xoff+43, $Yoff+1, $this->expe->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
|
||||||
//Num Commande
|
//Num Commande
|
||||||
$Yoff = $Yoff+4;
|
$Yoff = $Yoff+4;
|
||||||
@ -347,7 +354,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$pdf->SetXY($Xoff,$Yoff);
|
$pdf->SetXY($Xoff,$Yoff);
|
||||||
$pdf->SetFont('Arial','',8);
|
$pdf->SetFont('Arial','',8);
|
||||||
$pdf->SetTextColor(0,0,0);
|
$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;
|
$Xoff = 115;
|
||||||
//$this->Code39($Xoff+43, $Yoff+1, $exp->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
|
//$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
|
//Tel Client
|
||||||
$pdf->SetXY($blDestX,$Yoff+$blSocY);
|
$pdf->SetXY($blDestX,$Yoff+$blSocY);
|
||||||
$pdf->SetFont('Arial','',7);
|
$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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -5,6 +5,7 @@ DeliveryCard=Delivery card
|
|||||||
DeliveryOrder=Delivery order
|
DeliveryOrder=Delivery order
|
||||||
DeliveryOrders=Delivery orders
|
DeliveryOrders=Delivery orders
|
||||||
DeliveryDate=Delivery date
|
DeliveryDate=Delivery date
|
||||||
|
DeliveryDateShort=Deliv. date
|
||||||
CreateDeliveryOrder=Generate delivery order
|
CreateDeliveryOrder=Generate delivery order
|
||||||
SetDeliveryDate=Set shipping date
|
SetDeliveryDate=Set shipping date
|
||||||
ValidateDeliveryReceipt=Validate delivery receipt
|
ValidateDeliveryReceipt=Validate delivery receipt
|
||||||
|
|||||||
@ -21,7 +21,8 @@ QtyToShip=Qty to ship
|
|||||||
QtyReceived=Qty received
|
QtyReceived=Qty received
|
||||||
KeepToShip=Keep to ship
|
KeepToShip=Keep to ship
|
||||||
OtherSendingsForSameOrder=Other sendings for this order
|
OtherSendingsForSameOrder=Other sendings for this order
|
||||||
DateSending=Date sending
|
DateSending=Date sending order
|
||||||
|
DateSendingShort=Date sending order
|
||||||
SendingsForSameOrder=Sendings for this order
|
SendingsForSameOrder=Sendings for this order
|
||||||
SendingsAndReceivingForSameOrder=Sendings and receivings for this order
|
SendingsAndReceivingForSameOrder=Sendings and receivings for this order
|
||||||
SendingsToValidate=Sending to validate
|
SendingsToValidate=Sending to validate
|
||||||
|
|||||||
@ -5,6 +5,7 @@ DeliveryCard=Fiche livraison
|
|||||||
DeliveryOrder=Bon de livraison
|
DeliveryOrder=Bon de livraison
|
||||||
DeliveryOrders=Bons de livraison
|
DeliveryOrders=Bons de livraison
|
||||||
DeliveryDate=Date de livraison
|
DeliveryDate=Date de livraison
|
||||||
|
DeliveryDateShort=Date livr.
|
||||||
CreateDeliveryOrder=Générer bon de livraison
|
CreateDeliveryOrder=Générer bon de livraison
|
||||||
QtyDelivered=Qté livrée
|
QtyDelivered=Qté livrée
|
||||||
SetDeliveryDate=Définir la date de livraison
|
SetDeliveryDate=Définir la date de livraison
|
||||||
|
|||||||
@ -13,15 +13,16 @@ StatisticsOfSendings=Statistiques des exp
|
|||||||
NbOfSendings=Nombre d'expéditions
|
NbOfSendings=Nombre d'expéditions
|
||||||
SendingCard=Fiche expédition
|
SendingCard=Fiche expédition
|
||||||
NewSending=Nouvelle expédition
|
NewSending=Nouvelle expédition
|
||||||
CreateASending=Créer une expedition
|
CreateASending=Créer une expédition
|
||||||
CreateSending=Créer expedition
|
CreateSending=Créer expédition
|
||||||
QtyOrdered=Qté commandée
|
QtyOrdered=Qté commandée
|
||||||
QtyShipped=Qté expédiée
|
QtyShipped=Qté expédiée
|
||||||
QtyToShip=Qté à expédier
|
QtyToShip=Qté à expédier
|
||||||
QtyReceived=Qté reçue
|
QtyReceived=Qté reçue
|
||||||
KeepToShip=Reste à expédier
|
KeepToShip=Reste à expédier
|
||||||
OtherSendingsForSameOrder=Autres expéditions pour cette commande
|
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
|
SendingsForSameOrder=Expéditions pour cette commande
|
||||||
SendingsAndReceivingForSameOrder=Expéditions et réceptions pour cette commande
|
SendingsAndReceivingForSameOrder=Expéditions et réceptions pour cette commande
|
||||||
SendingsToValidate=Expéditions à valider
|
SendingsToValidate=Expéditions à valider
|
||||||
|
|||||||
@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/lib/sendings.lib.php
|
* \file htdocs/lib/sendings.lib.php
|
||||||
\ingroup expedition
|
* \ingroup expedition
|
||||||
\brief Library for expedition module
|
* \brief Library for expedition module
|
||||||
\version $Id$
|
* \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 = "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.= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id";
|
||||||
$sql.= ", e.ref, ".$db->pdate("e.date_expedition")." as date_expedition";
|
$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";
|
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.$origin."det as obj";
|
$sql.= " FROM (".MAIN_DB_PREFIX."expeditiondet as ed,";
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e";
|
$sql.= " ".MAIN_DB_PREFIX.$origin."det as obj,";
|
||||||
if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid";
|
$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;
|
$sql.= " WHERE obj.fk_".$origin." = ".$origin_id;
|
||||||
if ($filter) $sql.=$filter;
|
if ($filter) $sql.=$filter;
|
||||||
$sql.= " AND obj.rowid = ed.fk_origin_line";
|
$sql.= " AND obj.rowid = ed.fk_origin_line";
|
||||||
@ -63,17 +64,16 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
|
|||||||
|
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td align="left">'.$langs->trans("Ref").'</td>';
|
print '<td align="left">'.$langs->trans("Description").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
//print '<td align="left">'.$langs->trans("QtyOrdered").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
print '<td align="left">'.$langs->trans("SendingSheet").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("DateSending").'</td>';
|
print '<td align="center">'.$langs->trans("DateSending").'</td>';
|
||||||
if ($conf->expedition_bon->enabled)
|
|
||||||
{
|
|
||||||
print '<td>'.$langs->trans("SendingSheet").'</td>';
|
|
||||||
}
|
|
||||||
if ($conf->livraison_bon->enabled)
|
if ($conf->livraison_bon->enabled)
|
||||||
{
|
{
|
||||||
print '<td>'.$langs->trans("DeliveryOrder").'</td>';
|
print '<td>'.$langs->trans("DeliveryOrder").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("DeliveryDate").'</td>';
|
||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -83,7 +83,8 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td align="left" nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
|
|
||||||
|
// Description
|
||||||
if ($objp->fk_product > 0)
|
if ($objp->fk_product > 0)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -98,21 +99,28 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
|
|||||||
{
|
{
|
||||||
print "<td>".dol_htmlentitiesbr(dolibarr_trunc($objp->description,24))."</td>\n";
|
print "<td>".dol_htmlentitiesbr(dolibarr_trunc($objp->description,24))."</td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//print '<td align="center">'.$objp->qty_asked.'</td>';
|
||||||
|
|
||||||
|
// Sending id
|
||||||
|
print '<td align="left" nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
|
||||||
|
|
||||||
print '<td align="center">'.$objp->qty_shipped.'</td>';
|
print '<td align="center">'.$objp->qty_shipped.'</td>';
|
||||||
|
|
||||||
print '<td align="center" nowrap="nowrap">'.dolibarr_print_date($objp->date_expedition,'dayhour').'</td>';
|
print '<td align="center" nowrap="nowrap">'.dolibarr_print_date($objp->date_expedition,'dayhour').'</td>';
|
||||||
if ($conf->expedition_bon->enabled)
|
|
||||||
{
|
|
||||||
print '<td align="left"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
|
|
||||||
}
|
|
||||||
if ($conf->livraison_bon->enabled)
|
if ($conf->livraison_bon->enabled)
|
||||||
{
|
{
|
||||||
if ($objp->livraison_id)
|
if ($objp->livraison_id)
|
||||||
{
|
{
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'generic').' '.$objp->livraison_ref.'<a></td>';
|
print '<td><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'generic').' '.$objp->livraison_ref.'<a></td>';
|
||||||
|
print '<td align="center">'.$objp->qty_received.'</td>';
|
||||||
|
print '<td>'.dolibarr_print_date($objp->date_delivery,'dayhour').'</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -21,15 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/livraison/fiche.php
|
* \file htdocs/livraison/fiche.php
|
||||||
\ingroup livraison
|
* \ingroup livraison
|
||||||
\brief Fiche descriptive d'un bon de livraison
|
* \brief Fiche descriptive d'un bon de livraison
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/livraison/mods/modules_livraison.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."/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->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->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");
|
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();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
// S<EFBFBD>curit<EFBFBD> acc<63>s client
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -125,6 +126,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
|
|||||||
{
|
{
|
||||||
Header("Location: liste.php");
|
Header("Location: liste.php");
|
||||||
}
|
}
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +293,7 @@ if ($_GET["action"] == 'create')
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
$quantite_livree = $commande->livraisons[$ligne->fk_product];
|
$quantite_livree = $commande->livraisons[$ligne->id];
|
||||||
print $quantite_livree;;
|
print $quantite_livree;;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -360,6 +362,9 @@ else
|
|||||||
$result = $livraison->fetch($_GET["id"]);
|
$result = $livraison->fetch($_GET["id"]);
|
||||||
$livraison->fetch_client();
|
$livraison->fetch_client();
|
||||||
|
|
||||||
|
$expedition=new Expedition($db);
|
||||||
|
$result = $expedition->fetch($livraison->expedition_id);
|
||||||
|
|
||||||
if ($livraison->origin_id)
|
if ($livraison->origin_id)
|
||||||
{
|
{
|
||||||
$object = $livraison->origin;
|
$object = $livraison->origin;
|
||||||
@ -427,7 +432,7 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("RefOrder").'</td>';
|
print '<tr><td>'.$langs->trans("RefOrder").'</td>';
|
||||||
$order=new Commande($db);
|
$order=new Commande($db);
|
||||||
$order->fetch($livraison->origin_id);
|
$order->fetch($expedition->origin_id);
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $order->getNomUrl(1,4);
|
print $order->getNomUrl(1,4);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
@ -557,7 +562,7 @@ else
|
|||||||
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
|
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents g<EFBFBD>n<EFBFBD>r<EFBFBD>s
|
* Documents generated
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$livraisonref = sanitize_string($livraison->ref);
|
$livraisonref = sanitize_string($livraison->ref);
|
||||||
@ -568,81 +573,17 @@ else
|
|||||||
$delallowed=$user->rights->expedition->livraison->supprimer;
|
$delallowed=$user->rights->expedition->livraison->supprimer;
|
||||||
|
|
||||||
$somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
|
$somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
|
||||||
|
if ($genallowed && ! $somethingshown) $somethingshown=1;
|
||||||
/*
|
|
||||||
* D<EFBFBD>j<EFBFBD> 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 '<br>';
|
|
||||||
|
|
||||||
print_titre($langs->trans("OtherSendingsForSameOrder"));
|
|
||||||
print '<table class="liste" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td align="left">'.$langs->trans("Sending").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans("Date").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$var=True;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
$objp = $db->fetch_object($resql);
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td align="left"><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
|
|
||||||
if ($objp->fk_product > 0)
|
|
||||||
{
|
|
||||||
$product = new Product($db);
|
|
||||||
$product->fetch($objp->fk_product);
|
|
||||||
|
|
||||||
print '<td>';
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
|
||||||
if ($objp->description) print nl2br($objp->description);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
|
|
||||||
}
|
|
||||||
print '<td align="center">'.$objp->qty_shipped.'</td>';
|
|
||||||
print '<td align="center">'.dolibarr_print_date($objp->date_livraison,"dayhour").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
}
|
|
||||||
$db->free($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td><td valign="top" width="50%">';
|
print '</td><td valign="top" width="50%">';
|
||||||
|
|
||||||
// Rien <EFBFBD> droite
|
// Rien a droite
|
||||||
|
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
//show_list_sending_receive($expedition->origin,$expedition->origin_id," AND e.rowid <> ".$expedition->id);
|
||||||
|
show_list_sending_receive($expedition->origin,$expedition->origin_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -633,10 +633,11 @@ class Livraison extends CommonObject
|
|||||||
$this->lignes = array();
|
$this->lignes = array();
|
||||||
|
|
||||||
$sql = "SELECT p.label, p.ref,";
|
$sql = "SELECT p.label, p.ref,";
|
||||||
$sql.= " l.description, l.fk_product, l.subprice, l.total_ht, l.qty as qty_shipped";
|
$sql.= " cd.qty as qty_asked,";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."livraisondet as l";
|
$sql.= " ld.description, ld.fk_product, ld.subprice, ld.total_ht, ld.qty as qty_shipped";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on p.rowid = l.fk_product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."livraisondet as ld";
|
||||||
$sql.= " WHERE l.fk_livraison = ".$this->id;
|
$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);
|
dolibarr_syslog("Livraison::fetch_lignes sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -153,7 +153,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
|||||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||||
$pdf->SetAuthor($user->fullname);
|
$pdf->SetAuthor($user->fullname);
|
||||||
|
|
||||||
$this->_pagehead($pdf, $delivery);
|
$this->_pagehead($pdf, $delivery, $outputlangs);
|
||||||
|
|
||||||
$pagenb = 1;
|
$pagenb = 1;
|
||||||
$tab_top = 100;
|
$tab_top = 100;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user