29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
35$socid =
GETPOST(
'socid',
'int');
38$hookmanager->initHooks(array(
'sendingindex'));
41$langs->loadLangs(array(
'orders',
'sendings'));
48$companystatic =
new Societe($db);
51$helpurl =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
52llxHeader(
'', $langs->trans(
"Shipment"), $helpurl);
57print
'<div class="fichecenter"><div class="fichethirdleft">';
65$sql =
"SELECT e.rowid, e.ref, e.ref_customer,";
66$sql .=
" s.nom as name, s.rowid as socid,";
67$sql .=
" c.ref as commande_ref, c.rowid as commande_id";
68$sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
69$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'";
70$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande as c ON el.fk_source = c.rowid";
71$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
72if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
73 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
74 $sql .= $clause.
" sc.fk_user = ".((int) $user->id);
78$sql .=
" AND e.entity IN (".getEntity(
'expedition').
")";
80 $sql .=
" AND c.fk_soc = ".((int) $socid);
83$resql = $db->query($sql);
85 $num = $db->num_rows($resql);
87 print
'<div class="div-table-responsive-no-min">';
88 print
'<table class="noborder centpercent">';
89 print
'<tr class="liste_titre">';
90 print
'<th colspan="3">';
91 print $langs->trans(
"SendingsToValidate").
' ';
93 print
'<span class="badge">'.$num.
'</span>';
101 $obj = $db->fetch_object($resql);
103 $shipment->id = $obj->rowid;
104 $shipment->ref = $obj->ref;
105 $shipment->ref_customer = $obj->ref_customer;
107 print
'<tr class="oddeven"><td class="nowrap">';
108 print $shipment->getNomUrl(1);
111 print
'<a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$obj->name.
'</a>';
114 if ($obj->commande_id) {
115 print
'<a href="'.DOL_URL_ROOT.
'/commande/card.php?id='.$obj->commande_id.
'">'.$obj->commande_ref.
'</a>';
121 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td></tr>';
124 print
"</table></div><br>";
130print
'</div><div class="fichetwothirdright">';
137$sql =
"SELECT e.rowid, e.ref, e.ref_customer,";
138$sql .=
" s.nom as name, s.rowid as socid,";
139$sql .=
" c.ref as commande_ref, c.rowid as commande_id";
140$sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
141$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
142$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
143$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
144if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
145 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
147$sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
148if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
149 $sql .=
" AND sc.fk_user = ".((int) $user->id);
151$sql .=
" AND e.fk_statut = ".Expedition::STATUS_VALIDATED;
153 $sql .=
" AND c.fk_soc = ".((int) $socid);
155$sql .=
" ORDER BY e.date_delivery DESC";
156$sql .= $db->plimit($max, 0);
158$resql = $db->query($sql);
160 $num = $db->num_rows($resql);
162 print
'<div class="div-table-responsive-no-min">';
163 print
'<table class="noborder centpercent">';
164 print
'<tr class="liste_titre">';
165 print
'<th colspan="4">';
166 print $langs->trans(
"LastSendings").
' ';
168 print
'<span class="badge">'.$num.
'</span>';
176 $obj = $db->fetch_object($resql);
178 $shipment->id = $obj->rowid;
179 $shipment->ref = $obj->ref;
180 $shipment->ref_customer = $obj->ref_customer;
182 print
'<tr class="oddeven"><td>';
183 print $shipment->getNomUrl(1);
185 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
187 if ($obj->commande_id > 0) {
188 $orderstatic->id = $obj->commande_id;
189 $orderstatic->ref = $obj->commande_ref;
190 print $orderstatic->getNomUrl(1);
193 print
'<td class="">';
200 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td><td></td></tr>';
202 print
"</table></div><br>";
211$sql =
"SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid";
212$sql .=
" FROM ".MAIN_DB_PREFIX.
"commande as c,";
213$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
214if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
215 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
217$sql .=
" WHERE c.fk_soc = s.rowid";
218$sql .=
" AND c.entity IN (".getEntity(
'order').
")";
219$sql .=
" AND c.fk_statut IN (".Commande::STATUS_VALIDATED.
", ".Commande::STATUS_ACCEPTED.
")";
221 $sql .=
" AND c.fk_soc = ".((int) $socid);
223if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
224 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
226$sql .=
" ORDER BY c.rowid ASC";
228$resql = $db->query($sql);
230 $langs->load(
"orders");
232 $num = $db->num_rows($resql);
234 print
'<div class="div-table-responsive-no-min">';
235 print
'<table class="noborder centpercent">';
237 print
'<tr class="liste_titre">';
238 print
'<th colspan="3">'.$langs->trans(
"OrdersToProcess").
' ';
239 print
'<a href="'.DOL_URL_ROOT.
'/commande/list.php?search_status='.
Commande::STATUS_VALIDATED.
','.Commande::STATUS_ACCEPTED.
'">';
240 print
'<span class="badge">'.$num.
'</span>';
247 while ($i < $num && $i < 10) {
248 $obj = $db->fetch_object($resql);
250 $orderstatic->id = $obj->rowid;
251 $orderstatic->ref = $obj->ref;
252 $orderstatic->ref_customer = $obj->ref_customer;
253 $orderstatic->statut = $obj->status;
254 $orderstatic->billed = $obj->billed;
256 $companystatic->name = $obj->name;
257 $companystatic->id = $obj->socid;
259 print
'<tr class="oddeven"><td>';
260 print $orderstatic->getNomUrl(1);
263 print $companystatic->getNomUrl(1,
'customer', 32);
265 print
'<td class="right">';
266 print $orderstatic->getLibStatut(3);
273 print
'<tr class="opacitymedium">';
274 print
'<td>'.$langs->trans(
"More").
'...</td>';
280 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td></tr>';
283 print
"</table></div><br>";
291$parameters = array(
'user' => $user);
292$reshook = $hookmanager->executeHooks(
'dashboardWarehouseSendings', $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 customers orders.
const STATUS_VALIDATED
Validated status.
Class to manage shipments.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
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)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.