30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
43$langs->loadLangs(array(
'orders',
'sendings'));
48$hookmanager->initHooks(array(
'sendingindex'));
56$companystatic =
new Societe($db);
59$helpurl =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
60llxHeader(
'', $langs->trans(
"Shipment"), $helpurl,
'', 0, 0,
'',
'',
'',
'mod-expedition page-index');
65print
'<div class="fichecenter"><div class="fichethirdleft">';
73$sql =
"SELECT e.rowid, e.ref, e.ref_customer,";
74$sql .=
" s.nom as name, s.rowid as socid,";
75$sql .=
" c.ref as commande_ref, c.rowid as commande_id";
76$sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
77$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'";
78$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande as c ON el.fk_source = c.rowid";
79$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
80if (!$user->hasRight(
'societe',
'client',
'voir')) {
81 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
82 $sql .= $clause.
" sc.fk_user = ".((int) $user->id);
86$sql .=
" AND e.entity IN (".getEntity(
'expedition').
")";
88 $sql .=
" AND c.fk_soc = ".((int) $socid);
91$resql = $db->query($sql);
93 $num = $db->num_rows($resql);
95 print
'<div class="div-table-responsive-no-min">';
96 print
'<table class="noborder centpercent">';
97 print
'<tr class="liste_titre">';
98 print
'<th colspan="3">';
99 print $langs->trans(
"SendingsToValidate").
' ';
101 print
'<span class="badge">'.$num.
'</span>';
109 $obj = $db->fetch_object($resql);
111 $shipment->id = $obj->rowid;
112 $shipment->ref = $obj->ref;
113 $shipment->ref_customer = $obj->ref_customer;
115 print
'<tr class="oddeven"><td class="nowrap">';
116 print $shipment->getNomUrl(1);
119 print
'<a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$obj->name.
'</a>';
122 if ($obj->commande_id) {
123 print
'<a href="'.DOL_URL_ROOT.
'/commande/card.php?id='.$obj->commande_id.
'">'.$obj->commande_ref.
'</a>';
129 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td></tr>';
132 print
"</table></div><br>";
138print
'</div><div class="fichetwothirdright">';
145$sql =
"SELECT e.rowid, e.ref, e.ref_customer,";
146$sql .=
" s.nom as name, s.rowid as socid,";
147$sql .=
" c.ref as commande_ref, c.rowid as commande_id";
148$sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
149$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')";
150$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
151$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
152if (!$user->hasRight(
'societe',
'client',
'voir')) {
153 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
155$sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
156if (!$user->hasRight(
'societe',
'client',
'voir')) {
157 $sql .=
" AND sc.fk_user = ".((int) $user->id);
159$sql .=
" AND e.fk_statut = ".Expedition::STATUS_VALIDATED;
161 $sql .=
" AND c.fk_soc = ".((int) $socid);
163$sql .=
" ORDER BY e.date_delivery DESC";
164$sql .= $db->plimit($max, 0);
166$resql = $db->query($sql);
168 $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="4">';
174 print $langs->trans(
"LastSendings").
' ';
176 print
'<span class="badge">'.$num.
'</span>';
184 $obj = $db->fetch_object($resql);
186 $shipment->id = $obj->rowid;
187 $shipment->ref = $obj->ref;
188 $shipment->ref_customer = $obj->ref_customer;
190 print
'<tr class="oddeven"><td>';
191 print $shipment->getNomUrl(1);
193 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
195 if ($obj->commande_id > 0) {
196 $orderstatic->id = $obj->commande_id;
197 $orderstatic->ref = $obj->commande_ref;
198 print $orderstatic->getNomUrl(1);
201 print
'<td class="">';
208 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td><td></td></tr>';
210 print
"</table></div><br>";
219$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";
220$sql .=
" FROM ".MAIN_DB_PREFIX.
"commande as c,";
221$sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
222if (!$user->hasRight(
'societe',
'client',
'voir')) {
223 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
225$sql .=
" WHERE c.fk_soc = s.rowid";
226$sql .=
" AND c.entity IN (".getEntity(
'order').
")";
229 $sql .=
" AND c.fk_soc = ".((int) $socid);
231if (!$user->hasRight(
'societe',
'client',
'voir')) {
232 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
234$sql .=
" ORDER BY c.rowid ASC";
236$resql = $db->query($sql);
238 $langs->load(
"orders");
240 $num = $db->num_rows($resql);
242 print
'<div class="div-table-responsive-no-min">';
243 print
'<table class="noborder centpercent">';
245 print
'<tr class="liste_titre">';
246 print
'<th colspan="3">'.$langs->trans(
"OrdersToProcess").
' ';
248 print
'<span class="badge">'.$num.
'</span>';
255 while ($i < $num && $i < 10) {
256 $obj = $db->fetch_object($resql);
258 $orderstatic->id = $obj->rowid;
259 $orderstatic->ref = $obj->ref;
260 $orderstatic->ref_customer = $obj->ref_customer;
261 $orderstatic->statut = $obj->status;
262 $orderstatic->billed = $obj->billed;
264 $companystatic->name = $obj->name;
265 $companystatic->id = $obj->socid;
267 print
'<tr class="oddeven"><td>';
268 print $orderstatic->getNomUrl(1);
271 print $companystatic->getNomUrl(1,
'customer', 32);
273 print
'<td class="right">';
274 print $orderstatic->getLibStatut(3);
281 print
'<tr class="opacitymedium">';
282 print
'<td>'.$langs->trans(
"More").
'...</td>';
288 print
'<tr><td>'.$langs->trans(
"None").
'</td><td></td><td></td></tr>';
291 print
"</table></div><br>";
299$parameters = array(
'user' => $user);
300$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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_VALIDATED
Validated status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status -> parcel is ready to be sent prev status : draft next status : closed or shipment_i...
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...