Fix: A lot of bad values in shipping module
This commit is contained in:
parent
7d79116734
commit
357986f5fb
@ -771,7 +771,7 @@ else
|
||||
print '<td colspan="3">'.$expedition->ref_customer."</a></td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
// Date creation
|
||||
print '<tr><td>'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td colspan="3">'.dol_print_date($expedition->date_creation,"daytext")."</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
@ -123,10 +123,11 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
|
||||
global $html;
|
||||
|
||||
$product_static=new Product($db);
|
||||
$expedition=new Expedition($db);
|
||||
|
||||
$sql = "SELECT obj.rowid, obj.fk_product, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked";
|
||||
$sql.= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id";
|
||||
$sql.= ", e.ref as exp_ref, e.date_expedition,";
|
||||
$sql.= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line";
|
||||
$sql.= ", e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,";
|
||||
//if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,";
|
||||
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,';
|
||||
$sql.= ' p.description as product_desc';
|
||||
@ -160,13 +161,14 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
|
||||
//print '<td align="left">'.$langs->trans("QtyOrdered").'</td>';
|
||||
print '<td align="left">'.$langs->trans("SendingSheet").'</td>';
|
||||
print '<td align="left">'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateDeliveryPlanned").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateSending").'</td>';
|
||||
if ($conf->livraison_bon->enabled)
|
||||
{
|
||||
print '<td>'.$langs->trans("DeliveryOrder").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DeliveryDate").'</td>';
|
||||
//print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DeliveryDate").'</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -220,22 +222,48 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
|
||||
|
||||
//print '<td align="center">'.$objp->qty_asked.'</td>';
|
||||
|
||||
// Date creation
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->date_creation),'day').'</td>';
|
||||
|
||||
// Date shipping creation
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->date_delivery),'day').'</td>';
|
||||
|
||||
// Qty shipped
|
||||
print '<td align="center">'.$objp->qty_shipped.'</td>';
|
||||
|
||||
// Date shipping was planed
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->date_expedition),'day').'</td>';
|
||||
|
||||
|
||||
// Informations on receipt
|
||||
if ($conf->livraison_bon->enabled)
|
||||
{
|
||||
if ($objp->livraison_id)
|
||||
include_once(DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php');
|
||||
$expedition->id=$objp->sendingid;
|
||||
$expedition->load_object_linked($expedition->id,$expedition->element,-1,-1);
|
||||
$livraison_id=$expedition->linked_object['delivery'][0];
|
||||
|
||||
if ($livraison_id)
|
||||
{
|
||||
$receiving=new Livraison($db);
|
||||
$receiving->fetch($livraison_id);
|
||||
|
||||
// $expedition->fk_origin_line = id of det line of order
|
||||
// $receiving->fk_origin_line = id of det line of order
|
||||
// $receiving->origin may be 'shipping'
|
||||
// $receiving->origin_id may be id of shipping
|
||||
|
||||
// Ref
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->livraison_ref.'<a></td>';
|
||||
print '<td>';
|
||||
print $receiving->getNomUrl($db);
|
||||
//print '<a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$livraison_id.'">'.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.'<a>';
|
||||
print '</td>';
|
||||
// Qty received
|
||||
print '<td align="center">'.$objp->qty_received.'</td>';
|
||||
//print '<td align="center">';
|
||||
// TODO No solution for the moment to link a line det of receipt with a line det of shipping,
|
||||
// so no way to know the qty received for this line of shipping.
|
||||
//print $langs->trans("FeatureNotYetAvailable");
|
||||
//print '</td>';
|
||||
// Date shipping real
|
||||
print '<td>'.dol_print_date($objp->date_delivery,'day').'</td>';
|
||||
print '<td align="right">';
|
||||
print dol_print_date($receiving->date_delivery,'day');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -270,8 +270,8 @@ class Livraison extends CommonObject
|
||||
$this->note = $obj->note;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->origin = $obj->origin;
|
||||
$this->origin_id = $obj->origin_id;
|
||||
$this->origin = $obj->origin; // May be 'shipping'
|
||||
$this->origin_id = $obj->origin_id; // May be id of shipping
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -630,6 +630,31 @@ class Livraison extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* \return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$urlOption='';
|
||||
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
$picto='sending';
|
||||
$label=$langs->trans("ShowReceiving").': '.$this->ref;
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$lien.$this->ref.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@ -871,45 +896,6 @@ class Livraison extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie un tableau avec les livraisons par ligne
|
||||
* \param filtre_statut Filtre sur statut
|
||||
* \return int 0 si OK, <0 si KO
|
||||
* \TODO obsolete
|
||||
*/
|
||||
function livraison_array($filtre_statut=-1)
|
||||
{
|
||||
$this->livraisons = array();
|
||||
|
||||
$sql = 'SELECT cd.fk_product, SUM(ld.qty)';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'livraisondet as ld';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'livraison as l';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||
$sql.= ' WHERE ld.fk_livraison = l.rowid';
|
||||
$sql.= ' AND ld.fk_commande_ligne = cd .rowid';
|
||||
$sql.= ' AND cd.fk_commande = c.rowid';
|
||||
$sql.= ' AND cd.fk_commande =' .$this->id;
|
||||
if ($filtre_statut >= 0) $sql.=' AND l.fk_statut = '.$filtre_statut;
|
||||
$sql.= ' GROUP BY cd.fk_product ';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$this->livraisons[$row[0]] = $row[1];
|
||||
$i++;
|
||||
}
|
||||
$this->db->free();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user