30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
43$hookmanager->initHooks(array(
'receptionindex'));
45$langs->loadLangs(array(
"orders",
"receptions"));
52 $socid = $user->socid;
62$companystatic =
new Societe($db);
64$helpurl =
'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
65llxHeader(
'', $langs->trans(
"Reception"), $helpurl,
'', 0, 0,
'',
'',
'',
'mod-reception page-dashboard');
70print
'<div class="fichecenter"><div class="fichethirdleft">';
74 print
'<form method="post" action="list.php">';
75 print
'<input type="hidden" name="token" value="'.newToken().
'">';
76 print
'<div class="div-table-responsive-no-min">';
77 print
'<table class="noborder nohover centpercent">';
78 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
79 print
'<tr class="oddeven"><td>';
80 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>';
81 print
"</table></div></form><br>\n";
89$sql =
"SELECT e.rowid, e.ref, e.ref_supplier,";
90$sql .=
" s.nom as name, s.rowid as socid,";
91$sql .=
" c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
92$sql .=
" FROM ".MAIN_DB_PREFIX.
"reception as e";
93$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'reception'";
94$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseur as c ON el.fk_source = c.rowid";
95$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
96if (!$user->hasRight(
'societe',
'client',
'voir')) {
97 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = e.fk_soc AND sc.fk_user = ".((int) $user->id).
")";
99$sql .=
" WHERE e.fk_statut = 0";
100$sql .=
" AND e.entity IN (".getEntity(
'reception').
")";
102 $sql .=
" AND c.fk_soc = ".((int) $socid);
105$resql = $db->query($sql);
107 print
'<div class="div-table-responsive-no-min">';
108 print
'<table class="noborder centpercent">';
109 print
'<tr class="liste_titre">';
110 print
'<th colspan="3">'.$langs->trans(
"ReceptionsToValidate").
'</th></tr>';
112 $num = $db->num_rows($resql);
116 $obj = $db->fetch_object($resql);
118 $reception->id = $obj->rowid;
119 $reception->ref = $obj->ref;
120 $reception->ref_supplier = $obj->ref_supplier;
122 print
'<tr class="oddeven"><td class="nowrap">';
123 print $reception->getNomUrl(1);
126 print
'<a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$obj->name.
'</a>';
129 if ($obj->commande_fournisseur_id) {
130 print
'<a href="'.DOL_URL_ROOT.
'/commande_fournisseur/card.php?id='.$obj->commande_fournisseur_id.
'">'.$obj->commande_fournisseur_ref.
'</a>';
136 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td><td></td><td></td></tr>';
139 print
"</table></div><br>";
143print
'</div><div class="fichetwothirdright">';
151$sql =
"SELECT e.rowid, e.ref, e.ref_supplier,";
152$sql .=
" s.nom as name, s.rowid as socid,";
153$sql .=
" c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
154$sql .=
" FROM ".MAIN_DB_PREFIX.
"reception as e";
155$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')";
156$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'";
157$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
158if (!$user->hasRight(
'societe',
'client',
'voir')) {
159 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
161$sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
162if (!$user->hasRight(
'societe',
'client',
'voir')) {
163 $sql .=
" AND sc.fk_user = ".((int) $user->id);
165$sql .=
" AND e.fk_statut = 1";
167 $sql .=
" AND c.fk_soc = ".((int) $socid);
169$sql .=
" ORDER BY e.date_delivery DESC";
170$sql .= $db->plimit($max, 0);
172$resql = $db->query($sql);
174 $num = $db->num_rows($resql);
177 print
'<div class="div-table-responsive-no-min">';
178 print
'<table class="noborder centpercent">';
179 print
'<tr class="liste_titre">';
180 print
'<th colspan="3">'.$langs->trans(
"LastReceptions", $num).
'</th></tr>';
182 $obj = $db->fetch_object($resql);
184 $reception->id = $obj->rowid;
185 $reception->ref = $obj->ref;
186 $reception->ref_supplier = $obj->ref_supplier;
188 print
'<tr class="oddeven"><td>';
189 print $reception->getNomUrl(1);
191 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
193 if ($obj->commande_fournisseur_id > 0) {
194 $orderstatic->id = $obj->commande_fournisseur_id;
195 $orderstatic->ref = $obj->commande_fournisseur_ref;
196 print $orderstatic->getNomUrl(1);
203 print
"</table></div><br>";
216$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";
217$sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as c,";
218$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
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')) {
226 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.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");
240 print
' <a href="'.DOL_URL_ROOT.
'/reception/list.php?search_status=1" alt="'.$langs->trans(
"GoOnList").
'"><span class="badge">'.$num.
'</span></a>';
242 $obj = $db->fetch_object($resql);
244 $orderstatic->id = $obj->rowid;
245 $orderstatic->ref = $obj->ref;
246 $orderstatic->ref_supplier = $obj->ref_supplier;
247 $orderstatic->statut = $obj->status;
248 $orderstatic->facturee = $obj->billed;
250 $companystatic->name = $obj->name;
251 $companystatic->id = $obj->socid;
253 print
'<tr class="oddeven">';
254 print
'<td class="nowrap">';
255 print $orderstatic->getNomUrl(1);
258 print $companystatic->getNomUrl(1,
'customer', 32);
260 print
'<td class="right">';
261 print $orderstatic->getLibStatut(3);
266 print
"</table></div><br>";
272$parameters = array(
'user' => $user);
273$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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a 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.