Fix: A lot of fix on sendings features
This commit is contained in:
parent
d89644a579
commit
ef0ced5b2c
@ -50,7 +50,7 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$exp = new Expedition($db);
|
||||
$exp->initAsSpecimen();
|
||||
$exp->fetch_commande();
|
||||
//$exp->fetch_commande();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/expedition/mods/pdf/";
|
||||
|
||||
@ -57,7 +57,7 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$exp = new Expedition($db);
|
||||
$exp->initAsSpecimen();
|
||||
$exp->fetch_commande();
|
||||
//$exp->fetch_commande();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/livraison/mods/pdf/";
|
||||
|
||||
@ -16,10 +16,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
// Code identique a /expedition/fiche.php
|
||||
@ -27,7 +23,7 @@
|
||||
/**
|
||||
\file htdocs/expedition/commande.php
|
||||
\ingroup expedition
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -396,6 +392,7 @@ if ($_GET["id"] > 0)
|
||||
/*
|
||||
* Boutons Actions
|
||||
*/
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
@ -403,11 +400,12 @@ if ($_GET["id"] > 0)
|
||||
// Bouton expedier sans gestion des stocks
|
||||
if (! $conf->stock->enabled && $reste_a_livrer_total > 0 && ! $commande->brouillon && $user->rights->expedition->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&object_id='.$_GET["id"].'">'.$langs->trans("NewSending").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&origin=commande&object_id='.$_GET["id"].'">'.$langs->trans("NewSending").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
|
||||
/*
|
||||
@ -435,7 +433,7 @@ if ($_GET["id"] > 0)
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="id" value="'.$commande->id.'">';
|
||||
print '<input type="hidden" name="origin" value="commande">';
|
||||
print '<input type="hidden" name="origin_id" value="'.$commande->id.'">';
|
||||
print '<input type="hidden" name="object_id" value="'.$commande->id.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$entrepot = new Entrepot($db);
|
||||
|
||||
@ -87,10 +87,10 @@ class Expedition extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (date_creation, fk_user_author, date_expedition";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (ref, date_creation, fk_user_author, date_expedition";
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (now(), $user->id, ".$this->db->idate($this->date_expedition);
|
||||
$sql.= " VALUES ('(PROV)', now(), $user->id, ".$this->db->idate($this->date_expedition);
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ")";
|
||||
|
||||
@ -105,13 +105,13 @@ class Expedition extends CommonObject
|
||||
// Insertion des lignes
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
{
|
||||
if (! $this->create_line($this->lignes[$i]->entrepot_id, $this->lignes[$i]->origin_line_id, $this->lignes[$i]->qty))
|
||||
if (! $this->create_line($this->lignes[$i]->entrepot_id, $this->lignes[$i]->origin_line_id, $this->lignes[$i]->qty) > 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->id && $this->origin_id)
|
||||
if (! $error && $this->id && $this->origin_id)
|
||||
{
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
@ -126,10 +126,10 @@ class Expedition extends CommonObject
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'pr_exp (fk_expedition, fk_propal) VALUES ('.$this->id.','.$this->origin_id.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'pr_exp (fk_expedition, fk_propal) VALUES ('.$this->id.','.$this->origin_id.')';
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$error++;
|
||||
@ -142,9 +142,9 @@ class Expedition extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error==0)
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
@ -152,7 +152,7 @@ class Expedition extends CommonObject
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->error()." - sql=$sql";
|
||||
$this->error=$this->db->lasterror()." - sql=$sql";
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@ -160,7 +160,7 @@ class Expedition extends CommonObject
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->error()." - sql=$sql";
|
||||
$this->error=$this->db->lasterror()." - sql=$sql";
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -183,17 +183,15 @@ class Expedition extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (fk_expedition, fk_entrepot, fk_origin_line, qty)";
|
||||
$sql .= " VALUES (".$this->id.", ".$entrepot_id.", ".$origin_line_id.", ".$qty.")";
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
$sql .= " VALUES (".$this->id.", ".($entrepot_id?$entrepot_id:'null').", ".$origin_line_id.", ".$qty.")";
|
||||
//print 'x'.$sql;
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error == 0 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (! $error) return 1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -640,6 +638,11 @@ class Expedition extends CommonObject
|
||||
if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft');
|
||||
if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return $langs->trans('StatusSendingDraftShort').' '.img_picto($langs->trans('StatusSendingDraft'),'statut0');
|
||||
if ($statut==1) return $langs->trans('StatusSendingValidatedShort').' '.img_picto($langs->trans('StatusSendingValidated'),'statut4');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -683,13 +686,15 @@ class Expedition extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$order=new Commande($this->db);
|
||||
$order->initAsSpecimen();
|
||||
|
||||
// Initialise paramètres
|
||||
$this->id=0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$socid = rand(1, $num_socs);
|
||||
$this->statut = 1;
|
||||
$this->commande_id = 0;
|
||||
if ($conf->livraison->enabled)
|
||||
{
|
||||
$this->livraison_id = 0;
|
||||
@ -699,6 +704,9 @@ class Expedition extends CommonObject
|
||||
$this->adresse_livraison_id = 0;
|
||||
$this->socid = $socids[$socid];
|
||||
|
||||
$this->commande_id = 0;
|
||||
$this->commande = $order;
|
||||
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
|
||||
@ -17,8 +17,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
// Code identique a /expedition/commande.php
|
||||
@ -27,7 +25,7 @@
|
||||
\file htdocs/expedition/fiche.php
|
||||
\ingroup expedition
|
||||
\brief Fiche descriptive d'une expedition
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -56,8 +54,8 @@ if ($user->societe_id > 0)
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"];
|
||||
$origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"];
|
||||
$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal
|
||||
$origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -81,6 +79,7 @@ if ($_POST["action"] == 'add')
|
||||
$object = new $class($db);
|
||||
$object->fetch($expedition->origin_id);
|
||||
//$object->fetch_lines();
|
||||
|
||||
|
||||
$expedition->socid = $object->socid;
|
||||
|
||||
@ -188,239 +187,246 @@ if ($_GET["action"] == 'create')
|
||||
{
|
||||
|
||||
print_titre($langs->trans("CreateASending"));
|
||||
|
||||
if (! $origin)
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorBadParameters").'</div>';
|
||||
}
|
||||
|
||||
if ($mesg)
|
||||
{
|
||||
print $mesg.'<br>';
|
||||
}
|
||||
|
||||
$class = ucfirst($origin);
|
||||
|
||||
$object = new $class($db);
|
||||
$object->loadExpeditions();
|
||||
|
||||
if ( $object->fetch($origin_id))
|
||||
if ($origin)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$author = new User($db);
|
||||
$author->id = $object->user_author_id;
|
||||
$author->fetch();
|
||||
|
||||
$entrepot = new Entrepot($db);
|
||||
|
||||
/*
|
||||
* Document source
|
||||
*/
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||
print '<input type="hidden" name="origin_id" value="'.$object->id.'">';
|
||||
if ($_GET["entrepot_id"])
|
||||
$class = ucfirst($origin);
|
||||
|
||||
$object = new $class($db);
|
||||
$object->loadExpeditions();
|
||||
|
||||
if ( $object->fetch($origin_id))
|
||||
{
|
||||
print '<input type="hidden" name="entrepot_id" value="'.$_GET["entrepot_id"].'">';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>';
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
print $langs->trans("RefOrder").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref;
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$author = new User($db);
|
||||
$author->id = $object->user_author_id;
|
||||
$author->fetch();
|
||||
|
||||
if ($conf->stock->enabled) $entrepot = new Entrepot($db);
|
||||
|
||||
/*
|
||||
* Document source
|
||||
*/
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'">';
|
||||
print '<input type="hidden" name="object_id" value="'.$object->id.'">';
|
||||
if ($_GET["entrepot_id"])
|
||||
{
|
||||
print '<input type="hidden" name="entrepot_id" value="'.$_GET["entrepot_id"].'">';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>';
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
print $langs->trans("RefOrder").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("RefProposal").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/comm/fiche.php?propalid='.$object->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref;
|
||||
}
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print $langs->trans('RefCustomer').'</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Tiers
|
||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print "<tr><td>".$langs->trans("Date")."</td>";
|
||||
print '<td colspan="3">'.dolibarr_print_date($object->date,"day")."</td></tr>\n";
|
||||
|
||||
// Entrepot (si forcé)
|
||||
if ($conf->stock->enabled && $_GET["entrepot_id"])
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$ents = $entrepot->list_array();
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$_GET["entrepot_id"].'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].'</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->note && ! $user->societe_id)
|
||||
{
|
||||
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
* Lignes de commandes
|
||||
*
|
||||
*/
|
||||
print '<br><table class="noborder" width="100%">';
|
||||
|
||||
//$lignes = $object->fetch_lines(1);
|
||||
$numAsked = sizeof($object->lignes);
|
||||
|
||||
/* Lecture des expeditions déjà effectuées */
|
||||
$object->loadExpeditions();
|
||||
|
||||
if ($numAsked)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyToShip").'</td>';
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
if ($_GET["entrepot_id"])
|
||||
{
|
||||
print '<td align="right">'.$langs->trans("Stock").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="left">'.$langs->trans("Warehouse").'</td>';
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$var=true;
|
||||
$indiceAsked = 0;
|
||||
while ($indiceAsked < $numAsked)
|
||||
{
|
||||
$ligne = $object->lignes[$indiceAsked];
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>\n";
|
||||
if ($ligne->fk_product > 0)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($ligne->fk_product);
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
if ($ligne->description) print nl2br($ligne->description);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".nl2br($ligne->description)."</td>\n";
|
||||
}
|
||||
|
||||
print '<td align="center">'.$ligne->qty.'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
$quantityDelivered = $object->expeditions[$ligne->fk_product];
|
||||
print $quantityDelivered;
|
||||
print '</td>';
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
// Quantité à livrer
|
||||
print '<td align="center">';
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$ligne->id.'">';
|
||||
print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$defaultqty.'">';
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
if ($_GET["entrepot_id"])
|
||||
{
|
||||
print '<td align="right">'.$stock;
|
||||
if ($stock < $quantityToBeDelivered)
|
||||
{
|
||||
print ' '.img_warning($langs->trans("StockTooLow"));
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
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 '<td align="left">';
|
||||
$html->select_array('entl'.$i,$array,'',1,0,0);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Quantité à livrer
|
||||
print '<td align="center">';
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$ligne->id.'">';
|
||||
print '<input name="qtyl'.$indiceAsked.'" type="text" size="6" value="'.$quantityToBeDelivered.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$indiceAsked++;
|
||||
$var=!$var;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
print '<tr><td align="center" colspan="5"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("RefProposal").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/comm/fiche.php?propalid='.$object->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref;
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print $langs->trans('RefCustomer').'</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Tiers
|
||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print "<tr><td>".$langs->trans("Date")."</td>";
|
||||
print '<td colspan="3">'.dolibarr_print_date($object->date,"day")."</td></tr>\n";
|
||||
|
||||
// Entrepot (si forcé)
|
||||
if ($conf->stock->enabled && $_GET["entrepot_id"])
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$ents = $entrepot->list_array();
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$_GET["entrepot_id"].'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].'</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->note && ! $user->societe_id)
|
||||
{
|
||||
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
* Lignes de commandes
|
||||
*
|
||||
*/
|
||||
print '<br><table class="noborder" width="100%">';
|
||||
|
||||
//$lignes = $object->fetch_lines(1);
|
||||
$numAsked = sizeof($object->lignes);
|
||||
|
||||
/* Lecture des expeditions déjà effectuées */
|
||||
$object->loadExpeditions();
|
||||
|
||||
if ($numAsked)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyToShip").'</td>';
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
if ($_GET["entrepot_id"])
|
||||
{
|
||||
print '<td align="right">'.$langs->trans("Stock").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="left">'.$langs->trans("Warehouse").'</td>';
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$var=true;
|
||||
$indiceAsked = 0;
|
||||
while ($indiceAsked < $numAsked)
|
||||
{
|
||||
$ligne = $object->lignes[$indiceAsked];
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>\n";
|
||||
if ($ligne->fk_product > 0)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($ligne->fk_product);
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
|
||||
if ($ligne->description) print nl2br($ligne->description);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".nl2br($ligne->description)."</td>\n";
|
||||
}
|
||||
|
||||
print '<td align="center">'.$ligne->qty.'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
$quantityDelivered = $object->expeditions[$ligne->fk_product];
|
||||
print $quantityDelivered;
|
||||
print '</td>';
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
// Quantité à livrer
|
||||
print '<td align="center">';
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$ligne->id.'">';
|
||||
print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$defaultqty.'">';
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
if ($_GET["entrepot_id"])
|
||||
{
|
||||
print '<td align="right">'.$stock;
|
||||
if ($stock < $quantityToBeDelivered)
|
||||
{
|
||||
print ' '.img_warning($langs->trans("StockTooLow"));
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
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 '<td align="left">';
|
||||
$html->select_array('entl'.$i,$array,'',1,0,0);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Quantité à livrer
|
||||
print '<td align="center">';
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$ligne->id.'">';
|
||||
print '<input name="qtyl'.$indiceAsked.'" type="text" size="6" value="'.$quantityToBeDelivered.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$indiceAsked++;
|
||||
$var=!$var;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
print '<tr><td align="center" colspan="5"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -114,7 +114,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Proposal"),"liste.php","ori.ref", "", "&socid=$socid",'width="25%" align="left"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","","&socid=$socid", 'width="25%" align="right" colspan="2"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&socid=$socid",'width="10%" align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&socid=$socid",'width="10%" align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
@ -158,7 +158,7 @@ if ($resql)
|
||||
print " <a href=\"propal.php?year=$y\">";
|
||||
print strftime("%Y",$objp->date_expedition)."</a></TD>\n";
|
||||
|
||||
print '<td align="center">'.$expedition->statuts[$objp->fk_statut].'</td>';
|
||||
print '<td align="right">'.$expedition->LibStatut($objp->fk_statut,5).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
@ -17,16 +17,13 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php
|
||||
\ingroup expedition
|
||||
\brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Merou
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
|
||||
|
||||
@ -16,16 +16,13 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
|
||||
\ingroup expedition
|
||||
\brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Rouget
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
|
||||
|
||||
@ -18,16 +18,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/livraison/fiche.php
|
||||
\ingroup livraison
|
||||
\brief Fiche descriptive d'un bon de livraison
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user