29require 
'../main.inc.php';
 
   30require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
 
   31require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
 
   36$hookmanager->initHooks(array(
'receptionindex'));
 
   38$langs->loadLangs(array(
"orders", 
"receptions"));
 
   45  $socid = $user->socid;
 
   55$companystatic = 
new Societe($db);
 
   57$helpurl = 
'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
 
   58llxHeader(
'', $langs->trans(
"Reception"), $helpurl);
 
   63print 
'<div class="fichecenter"><div class="fichethirdleft">';
 
   67  print 
'<form method="post" action="list.php">';
 
   68  print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
   69  print 
'<div class="div-table-responsive-no-min">';
 
   70  print 
'<table class="noborder nohover centpercent">';
 
   71  print 
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
 
   72  print 
'<tr class="oddeven"><td>';
 
   73  print $langs->trans(
"Reception").
':</td><td><input type="text" class="flat" name="sall" size="18"></td><td><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
 
   74  print 
"</table></div></form><br>\n";
 
   84$sql = 
"SELECT e.rowid, e.ref, e.ref_supplier,";
 
   85$sql .= 
" s.nom as name, s.rowid as socid,";
 
   86$sql .= 
" c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
 
   87$sql .= 
" FROM ".MAIN_DB_PREFIX.
"reception as e";
 
   88$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'reception'";
 
   89$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseur as c ON el.fk_source = c.rowid";
 
   90$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
 
   91if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) {
 
   92  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
 
   93  $sql .= $clause.
" sc.fk_user = ".((int) $user->id);
 
   96$sql .= $clause.
" e.fk_statut = 0";
 
   97$sql .= 
" AND e.entity IN (".getEntity(
'reception').
")";
 
   99  $sql .= 
" AND c.fk_soc = ".((int) $socid);
 
  102$resql = $db->query($sql);
 
  104  print 
'<div class="div-table-responsive-no-min">';
 
  105  print 
'<table class="noborder centpercent">';
 
  106  print 
'<tr class="liste_titre">';
 
  107  print 
'<th colspan="3">'.$langs->trans(
"ReceptionsToValidate").
'</th></tr>';
 
  109  $num = $db->num_rows($resql);
 
  113      $obj = $db->fetch_object($resql);
 
  115      $reception->id = $obj->rowid;
 
  116      $reception->ref = $obj->ref;
 
  117      $reception->ref_supplier = $obj->ref_supplier;
 
  119      print 
'<tr class="oddeven"><td class="nowrap">';
 
  120      print $reception->getNomUrl(1);
 
  123      print 
'<a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$obj->name.
'</a>';
 
  126      if ($obj->commande_fournisseur_id) {
 
  127        print 
'<a href="'.DOL_URL_ROOT.
'/commande_fournisseur/card.php?id='.$obj->commande_fournisseur_id.
'">'.$obj->commande_fournisseur_ref.
'</a>';
 
  133    print 
'<tr><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td><td></td><td></td></tr>';
 
  136  print 
"</table></div><br>";
 
  140print 
'</div><div class="fichetwothirdright">';
 
  148$sql = 
"SELECT e.rowid, e.ref, e.ref_supplier,";
 
  149$sql .= 
" s.nom as name, s.rowid as socid,";
 
  150$sql .= 
" c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
 
  151$sql .= 
" FROM ".MAIN_DB_PREFIX.
"reception as e";
 
  152$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'reception' AND el.sourcetype IN ('order_supplier')";
 
  153$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseur as c ON el.fk_source = c.rowid AND el.sourcetype IN ('order_supplier') AND el.targettype = 'reception'";
 
  154$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
 
  155if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) {
 
  156  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
 
  158$sql .= 
" WHERE e.entity IN (".getEntity(
'reception').
")";
 
  159if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) {
 
  160  $sql .= 
" AND sc.fk_user = ".((int) $user->id);
 
  162$sql .= 
" AND e.fk_statut = 1";
 
  164  $sql .= 
" AND c.fk_soc = ".((int) $socid);
 
  166$sql .= 
" ORDER BY e.date_delivery DESC";
 
  167$sql .= $db->plimit($max, 0);
 
  169$resql = $db->query($sql);
 
  171  $num = $db->num_rows($resql);
 
  174    print 
'<div class="div-table-responsive-no-min">';
 
  175    print 
'<table class="noborder centpercent">';
 
  176    print 
'<tr class="liste_titre">';
 
  177    print 
'<th colspan="3">'.$langs->trans(
"LastReceptions", $num).
'</th></tr>';
 
  179      $obj = $db->fetch_object($resql);
 
  181      $reception->id = $obj->rowid;
 
  182      $reception->ref = $obj->ref;
 
  183      $reception->ref_supplier = $obj->ref_supplier;
 
  185      print 
'<tr class="oddeven"><td>';
 
  186      print $reception->getNomUrl(1);
 
  188      print 
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"), 
"company").
' '.$obj->name.
'</a></td>';
 
  190      if ($obj->commande_fournisseur_id > 0) {
 
  191        $orderstatic->id = $obj->commande_fournisseur_id;
 
  192        $orderstatic->ref = $obj->commande_fournisseur_ref;
 
  193        print $orderstatic->getNomUrl(1);
 
  200    print 
"</table></div><br>";
 
  213$sql = 
"SELECT c.rowid, c.ref, c.ref_supplier as ref_supplier, c.fk_statut as status, c.billed as billed, s.nom as name, s.rowid as socid";
 
  214$sql .= 
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as c,";
 
  215$sql .= 
" ".MAIN_DB_PREFIX.
"societe as s";
 
  216if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) {
 
  217  $sql .= 
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
 
  219$sql .= 
" WHERE c.fk_soc = s.rowid";
 
  220$sql .= 
" AND c.entity IN (".getEntity(
'supplier_order').
")";
 
  223  $sql .= 
" AND c.fk_soc = ".((int) $socid);
 
  225if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) {
 
  226  $sql .= 
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
 
  228$sql .= 
" ORDER BY c.rowid ASC";
 
  229$resql = $db->query($sql);
 
  231  $num = $db->num_rows($resql);
 
  233    $langs->load(
"orders");
 
  236    print 
'<div class="div-table-responsive-no-min">';
 
  237    print 
'<table class="noborder centpercent">';
 
  238    print 
'<tr class="liste_titre">';
 
  239    print 
'<th colspan="3">'.$langs->trans(
"SuppliersOrdersToProcess").
' <span class="badge">'.$num.
'</span></th></tr>';
 
  241      $obj = $db->fetch_object($resql);
 
  243      $orderstatic->id = $obj->rowid;
 
  244      $orderstatic->ref = $obj->ref;
 
  245      $orderstatic->ref_supplier = $obj->ref_supplier;
 
  246      $orderstatic->statut = $obj->status;
 
  247      $orderstatic->facturee = $obj->billed;
 
  249      $companystatic->name = $obj->name;
 
  250      $companystatic->id = $obj->socid;
 
  252      print 
'<tr class="oddeven">';
 
  253      print 
'<td class="nowrap">';
 
  254      print $orderstatic->getNomUrl(1);
 
  257      print $companystatic->getNomUrl(1, 
'customer', 32);
 
  259      print 
'<td class="right">';
 
  260      print $orderstatic->getLibStatut(3);
 
  265    print 
"</table></div><br>";
 
  271$parameters = array(
'user' => $user);
 
  272$reshook = $hookmanager->executeHooks(
'dashboardWarehouseReceptions', $parameters, $object); 
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
Class to manage predefined suppliers products.
 
const STATUS_RECEIVED_PARTIALLY
Received partially.
 
Class to manage receptions.
 
Class to manage third parties objects (customers, suppliers, prospects...)
 
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.