29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
34 $socid =
GETPOST(
'socid',
'int');
37 $hookmanager->initHooks(array(
'sendingindex'));
40 $langs->loadLangs(array(
'orders',
'sendings'));
47 $companystatic =
new Societe($db);
50 $helpurl =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
51 llxHeader(
'', $langs->trans(
"Shipment"), $helpurl);
56 print
'<div class="fichecenter"><div class="fichethirdleft">';
64 $sql =
"SELECT e.rowid, e.ref, e.ref_customer,";
65 $sql .=
" s.nom as name, s.rowid as socid,";
66 $sql .=
" c.ref as commande_ref, c.rowid as commande_id";
67 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
68 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'";
69 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande as c ON el.fk_source = c.rowid";
70 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
71 if (empty($user->rights->societe->client->voir) && !$socid) {
72 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
73 $sql .= $clause.
" sc.fk_user = ".((int) $user->id);
77 $sql .=
" AND e.entity IN (".getEntity(
'expedition').
")";
79 $sql .=
" AND c.fk_soc = ".((int) $socid);
84 $num = $db->num_rows(
$resql);
86 print
'<div class="div-table-responsive-no-min">';
87 print
'<table class="noborder centpercent">';
88 print
'<tr class="liste_titre">';
89 print
'<th colspan="3">';
90 print $langs->trans(
"SendingsToValidate").
' ';
92 print
'<span class="badge">'.$num.
'</span>';
100 $obj = $db->fetch_object(
$resql);
102 $shipment->id = $obj->rowid;
103 $shipment->ref = $obj->ref;
104 $shipment->ref_customer = $obj->ref_customer;
106 print
'<tr class="oddeven"><td class="nowrap">';
107 print $shipment->getNomUrl(1);
110 print
'<a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$obj->name.
'</a>';
113 if ($obj->commande_id) {
114 print
'<a href="'.DOL_URL_ROOT.
'/commande/card.php?id='.$obj->commande_id.
'">'.$obj->commande_ref.
'</a>';
120 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td></tr>';
123 print
"</table></div><br>";
129 print
'</div><div class="fichetwothirdright">';
136 $sql =
"SELECT e.rowid, e.ref, e.ref_customer,";
137 $sql .=
" s.nom as name, s.rowid as socid,";
138 $sql .=
" c.ref as commande_ref, c.rowid as commande_id";
139 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
140 $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')";
141 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
142 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
143 if (empty($user->rights->societe->client->voir) && !$socid) {
144 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
146 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
147 if (empty($user->rights->societe->client->voir) && !$socid) {
148 $sql .=
" AND sc.fk_user = ".((int) $user->id);
150 $sql .=
" AND e.fk_statut = ".Expedition::STATUS_VALIDATED;
152 $sql .=
" AND c.fk_soc = ".((int) $socid);
154 $sql .=
" ORDER BY e.date_delivery DESC";
155 $sql .= $db->plimit($max, 0);
157 $resql = $db->query($sql);
159 $num = $db->num_rows(
$resql);
161 print
'<div class="div-table-responsive-no-min">';
162 print
'<table class="noborder centpercent">';
163 print
'<tr class="liste_titre">';
164 print
'<th colspan="4">';
165 print $langs->trans(
"LastSendings").
' ';
167 print
'<span class="badge">'.$num.
'</span>';
175 $obj = $db->fetch_object(
$resql);
177 $shipment->id = $obj->rowid;
178 $shipment->ref = $obj->ref;
179 $shipment->ref_customer = $obj->ref_customer;
181 print
'<tr class="oddeven"><td>';
182 print $shipment->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_id > 0) {
187 $orderstatic->id = $obj->commande_id;
188 $orderstatic->ref = $obj->commande_ref;
189 print $orderstatic->getNomUrl(1);
192 print
'<td class="">';
199 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td><td></td></tr>';
201 print
"</table></div><br>";
210 $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";
211 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande as c,";
212 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
213 if (empty($user->rights->societe->client->voir) && !$socid) {
214 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
216 $sql .=
" WHERE c.fk_soc = s.rowid";
217 $sql .=
" AND c.entity IN (".getEntity(
'order').
")";
218 $sql .=
" AND c.fk_statut IN (".Commande::STATUS_VALIDATED.
", ".Commande::STATUS_ACCEPTED.
")";
220 $sql .=
" AND c.fk_soc = ".((int) $socid);
222 if (empty($user->rights->societe->client->voir) && !$socid) {
223 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
225 $sql .=
" ORDER BY c.rowid ASC";
227 $resql = $db->query($sql);
229 $langs->load(
"orders");
231 $num = $db->num_rows(
$resql);
233 print
'<div class="div-table-responsive-no-min">';
234 print
'<table class="noborder centpercent">';
236 print
'<tr class="liste_titre">';
237 print
'<th colspan="3">'.$langs->trans(
"OrdersToProcess").
' ';
238 print
'<a href="'.DOL_URL_ROOT.
'/commande/list.php?search_status='.
Commande::STATUS_VALIDATED.
','.Commande::STATUS_ACCEPTED.
'">';
239 print
'<span class="badge">'.$num.
'</span>';
246 while ($i < $num && $i < 10) {
247 $obj = $db->fetch_object(
$resql);
249 $orderstatic->id = $obj->rowid;
250 $orderstatic->ref = $obj->ref;
251 $orderstatic->ref_customer = $obj->ref_customer;
252 $orderstatic->statut = $obj->status;
253 $orderstatic->billed = $obj->billed;
255 $companystatic->name = $obj->name;
256 $companystatic->id = $obj->socid;
258 print
'<tr class="oddeven"><td>';
259 print $orderstatic->getNomUrl(1);
262 print $companystatic->getNomUrl(1,
'customer', 32);
264 print
'<td class="right">';
265 print $orderstatic->getLibStatut(3);
272 print
'<tr class="opacitymedium">';
273 print
'<td>'.$langs->trans(
"More").
'...</td>';
279 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td></tr>';
282 print
"</table></div><br>";
288 print
'</div></div>';
290 $parameters = array(
'user' => $user);
291 $reshook = $hookmanager->executeHooks(
'dashboardWarehouseSendings', $parameters, $object);
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...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.