debut card create

This commit is contained in:
atm-quentin 2018-10-04 12:27:10 +02:00
parent bc07936d42
commit 5fe767d7bd
4 changed files with 328 additions and 223 deletions

View File

@ -2936,6 +2936,54 @@ class CommandeFournisseur extends CommonOrder
}
return 0;
}
/**
* Load array this->receptions of lines of shipments with nb of products sent for each order line
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
*
* @param int $filtre_statut Filter on shipment status
* @return int <0 if KO, Nb of lines found if OK
*/
function loadReceptions($filtre_statut=-1)
{
$this->receptions = array();
$sql = 'SELECT cd.rowid, cd.fk_product,';
$sql.= ' sum(cfd.qty) as qty';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch as cfd,';
if ($filtre_statut >= 0) $sql.= ' '.MAIN_DB_PREFIX.'reception as e,';
$sql.= ' '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
$sql.= ' WHERE';
if ($filtre_statut >= 0) $sql.= ' cfd.fk_reception = e.rowid AND';
$sql.= ' cfd.commandefourndet = cd.rowid';
$sql.= ' AND cd.fk_commande =' .$this->id;
if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product;
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut;
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
//print $sql;
dol_syslog(get_class($this)."::loadReceptions", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$this->receptions[$obj->rowid] = $obj->qty;
$i++;
}
$this->db->free();
return $num;
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
}

View File

@ -382,8 +382,8 @@ if ($id > 0 || ! empty($ref)) {
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
@ -452,9 +452,13 @@ if ($id > 0 || ! empty($ref)) {
$entrepot = new Entrepot($db);
$listwarehouses = $entrepot->list_array(1);
print '<form method="POST" action="dispatch.php?id=' . $object->id . '">';
if(empty($conf->reception->enabled))print '<form method="POST" action="dispatch.php?id=' . $object->id . '">';
else print '<form method="post" action="'.dol_buildpath('/reception/card.php',1).'?originid='.$object->id.'&origin=supplierorder">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="dispatch">';
if(empty($conf->reception->enabled))print '<input type="hidden" name="action" value="dispatch">';
else print '<input type="hidden" name="action" value="create">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
@ -703,7 +707,7 @@ if ($id > 0 || ! empty($ref)) {
if ($nbproduct)
{
$checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5]));
$checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5]));
print '<br><div class="center">';
print $langs->trans("Comment") . ' : ';
@ -712,9 +716,11 @@ if ($id > 0 || ! empty($ref)) {
// print ' / '.$object->ref_supplier; // Not yet available
print '" class="flat"><br>';
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
print '<br><input type="submit" class="button" value="' . $langs->trans("DispatchVerb") . '"';
if(empty($conf->reception->enabled))print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive");
print '<br><input type="submit" class="button" value="' . $dispatchBt. '"';
if (count($listwarehouses) <= 0)
print ' disabled';
print '>';
@ -784,13 +790,18 @@ if ($id > 0 || ! empty($ref)) {
print "<tr " . $bc[$var] . ">";
print '<td>';
if(!empty($conf->reception->enabled) && !empty($objp->fk_reception)){
$reception = new Reception($db);
$reception->fetch($objp->fk_reception);
print $reception->getNomUrl();
if(!empty($conf->reception->enabled) ){
print '<td>';
if (!empty($objp->fk_reception)){
$reception = new Reception($db);
$reception->fetch($objp->fk_reception);
print $reception->getNomUrl();
}
print "</td>";
}
print "</td>";
print '<td>';
print '<a href="' . DOL_URL_ROOT . '/product/fournisseurs.php?id=' . $objp->fk_product . '">' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . '</a>';
print ' - ' . $objp->label;

View File

@ -3,8 +3,8 @@ RefReception=Réf. réception
Reception=Réception
Receptions=Réceptions
AllReceptions=Toutes les réceptions
Shipment=Réception
Shipments=Réceptions
Reception=Réception
Receptions=Réceptions
ShowReception=Afficher Réceptions
Receivings=Bons de réceptions
ReceptionsArea=Espace réceptions
@ -13,15 +13,15 @@ ReceptionMethod=Méthode d'réception
LastReceptions=Les %s dernières réceptions
StatisticsOfReceptions=Statistiques des réceptions
NbOfReceptions=Nombre d'réceptions
NumberOfShipmentsByMonth=Nombre d'réceptions par mois
NumberOfReceptionsByMonth=Nombre d'réceptions par mois
ReceptionCard=Fiche réception
NewReception=Nouvelle réception
CreateShipment=Créer réception
CreateReception=Créer réception
QtyShipped=Qté. expédiée
QtyPreparedOrShipped=Quantité préparée ou envoyée
QtyToShip=Qté. à expédier
QtyToReceive=Qté. à recevoir
QtyReceived=Qté. reçue
QtyInOtherShipments=Qté dans les autres réceptions
QtyInOtherReceptions=Qté dans les autres réceptions
KeepToShip=Reste à expédier
OtherReceptionsForSameOrder=Autres réceptions pour cette commande
ReceptionsAndReceivingForSameOrder=Réceptions et réceptions pour cette commande
@ -39,24 +39,24 @@ ConfirmValidateReception=Êtes-vous sûr de vouloir valider cette réception sou
ConfirmCancelReception=Êtes-vous sûr de vouloir annuler cette réception ?
DocumentModelMerou=Modèle Merou A5
WarningNoQtyLeftToSend=Alerte, aucun produit en attente d'réception.
StatsOnShipmentsOnlyValidated=Statistiques effectuées sur les réceptions validées uniquement. La date prise en compte est la date de validation (la date de prévision de livraison n'étant pas toujours renseignée).
StatsOnReceptionsOnlyValidated=Statistiques effectuées sur les réceptions validées uniquement. La date prise en compte est la date de validation (la date de prévision de livraison n'étant pas toujours renseignée).
DateDeliveryPlanned=Date prévue de livraison
RefDeliveryReceipt=Ref bon de réception
StatusReceipt=Status du bon de réception
DateReceived=Date de réception réelle
SendShippingByEMail=Envoyer bon d'réception par email
SendShippingRef=Envoi du bordereau d'réception %s
ActionsOnShipping=Événements sur l'réception
SendReceptionByEMail=Envoyer bon d'réception par email
SendReceptionRef=Envoi du bordereau d'réception %s
ActionsOnReception=Événements sur l'réception
LinkToTrackYourPackage=Lien pour le suivi de votre colis
ShipmentCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle réception se fait depuis la fiche commande.
ShipmentLine=Ligne d'réception
ReceptionCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle réception se fait depuis la fiche commande fournisseur.
ReceptionLine=Ligne d'réception
ProductQtyInCustomersOrdersRunning=Quantité de produit en commandes client ouvertes
ProductQtyInSuppliersOrdersRunning=Quantité de produit en commandes fournisseur ouvertes
ProductQtyInShipmentAlreadySent=Quantité de produit en commande client ouverte déjà expédiée
ProductQtyInSuppliersShipmentAlreadyRecevied=Quantité de produit déjà reçu en commandes fournisseur ouvertes
ProductQtyInReceptionAlreadySent=Quantité de produit en commande client ouverte déjà expédiée
ProductQtyInSuppliersReceptionAlreadyRecevied=Quantité de produit déjà reçu en commandes fournisseur ouvertes
NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouver dans l'entrepôt <b>%s</b>. Corrigez l'inventaire ou retourner choisir un autre entrepôt.
WeightVolShort=Poids/vol.
ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une réception.
ValidateOrderFirstBeforeReception=Vous devez d'abord valider la commande pour pouvoir créer une réception.
# Reception methods
# ModelDocument

File diff suppressed because it is too large Load Diff