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,
'', 0, 0,
'',
'',
'',
'mod-reception page-dashboard');
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";
82$sql =
"SELECT e.rowid, e.ref, e.ref_supplier,";
83$sql .=
" s.nom as name, s.rowid as socid,";
84$sql .=
" c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
85$sql .=
" FROM ".MAIN_DB_PREFIX.
"reception as e";
86$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'reception'";
87$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_fournisseur as c ON el.fk_source = c.rowid";
88$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
89if (!$user->hasRight(
'societe',
'client',
'voir')) {
90 $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).
")";
92$sql .=
" WHERE e.fk_statut = 0";
93$sql .=
" AND e.entity IN (".getEntity(
'reception').
")";
95 $sql .=
" AND c.fk_soc = ".((int) $socid);
98$resql = $db->query($sql);
100 print
'<div class="div-table-responsive-no-min">';
101 print
'<table class="noborder centpercent">';
102 print
'<tr class="liste_titre">';
103 print
'<th colspan="3">'.$langs->trans(
"ReceptionsToValidate").
'</th></tr>';
105 $num = $db->num_rows($resql);
109 $obj = $db->fetch_object($resql);
111 $reception->id = $obj->rowid;
112 $reception->ref = $obj->ref;
113 $reception->ref_supplier = $obj->ref_supplier;
115 print
'<tr class="oddeven"><td class="nowrap">';
116 print $reception->getNomUrl(1);
119 print
'<a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$obj->name.
'</a>';
122 if ($obj->commande_fournisseur_id) {
123 print
'<a href="'.DOL_URL_ROOT.
'/commande_fournisseur/card.php?id='.$obj->commande_fournisseur_id.
'">'.$obj->commande_fournisseur_ref.
'</a>';
129 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td><td></td><td></td></tr>';
132 print
"</table></div><br>";
136print
'</div><div class="fichetwothirdright">';
144$sql =
"SELECT e.rowid, e.ref, e.ref_supplier,";
145$sql .=
" s.nom as name, s.rowid as socid,";
146$sql .=
" c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
147$sql .=
" FROM ".MAIN_DB_PREFIX.
"reception as e";
148$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')";
149$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'";
150$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
151if (!$user->hasRight(
'societe',
'client',
'voir')) {
152 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
154$sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
155if (!$user->hasRight(
'societe',
'client',
'voir')) {
156 $sql .=
" AND sc.fk_user = ".((int) $user->id);
158$sql .=
" AND e.fk_statut = 1";
160 $sql .=
" AND c.fk_soc = ".((int) $socid);
162$sql .=
" ORDER BY e.date_delivery DESC";
163$sql .= $db->plimit($max, 0);
165$resql = $db->query($sql);
167 $num = $db->num_rows($resql);
170 print
'<div class="div-table-responsive-no-min">';
171 print
'<table class="noborder centpercent">';
172 print
'<tr class="liste_titre">';
173 print
'<th colspan="3">'.$langs->trans(
"LastReceptions", $num).
'</th></tr>';
175 $obj = $db->fetch_object($resql);
177 $reception->id = $obj->rowid;
178 $reception->ref = $obj->ref;
179 $reception->ref_supplier = $obj->ref_supplier;
181 print
'<tr class="oddeven"><td>';
182 print $reception->getNomUrl(1);
184 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
186 if ($obj->commande_fournisseur_id > 0) {
187 $orderstatic->id = $obj->commande_fournisseur_id;
188 $orderstatic->ref = $obj->commande_fournisseur_ref;
189 print $orderstatic->getNomUrl(1);
196 print
"</table></div><br>";
209$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";
210$sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as c,";
211$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
212$sql .=
" WHERE c.fk_soc = s.rowid";
213$sql .=
" AND c.entity IN (".getEntity(
'supplier_order').
")";
216 $sql .=
" AND c.fk_soc = ".((int) $socid);
218if (!$user->hasRight(
'societe',
'client',
'voir')) {
219 $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).
")";
221$sql .=
" ORDER BY c.rowid ASC";
222$resql = $db->query($sql);
224 $num = $db->num_rows($resql);
226 $langs->load(
"orders");
229 print
'<div class="div-table-responsive-no-min">';
230 print
'<table class="noborder centpercent">';
231 print
'<tr class="liste_titre">';
232 print
'<th colspan="3">'.$langs->trans(
"SuppliersOrdersToProcess");
233 print
' <a href="'.DOL_URL_ROOT.
'/reception/list.php?search_status=1" alt="'.$langs->trans(
"GoOnList").
'"><span class="badge">'.$num.
'</span></a>';
235 $obj = $db->fetch_object($resql);
237 $orderstatic->id = $obj->rowid;
238 $orderstatic->ref = $obj->ref;
239 $orderstatic->ref_supplier = $obj->ref_supplier;
240 $orderstatic->statut = $obj->status;
241 $orderstatic->facturee = $obj->billed;
243 $companystatic->name = $obj->name;
244 $companystatic->id = $obj->socid;
246 print
'<tr class="oddeven">';
247 print
'<td class="nowrap">';
248 print $orderstatic->getNomUrl(1);
251 print $companystatic->getNomUrl(1,
'customer', 32);
253 print
'<td class="right">';
254 print $orderstatic->getLibStatut(3);
259 print
"</table></div><br>";
265$parameters = array(
'user' => $user);
266$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.