31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/propal.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
42if (isModEnabled(
'contrat')) {
43 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
45if (isModEnabled(
'ficheinter')) {
46 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
51$hookmanager->initHooks(array(
'commercialindex'));
54$langs->loadLangs(array(
"boxes",
"commercial",
"contracts",
"orders",
"propal",
"supplier_proposal"));
56$action =
GETPOST(
'action',
'aZ09');
60$socid =
GETPOST(
'socid',
'int');
61if (isset($user->socid) && $user->socid > 0) {
63 $socid = $user->socid;
68$maxofloop = (!
getDolGlobalString(
'MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
72if (!$user->hasRight(
'propal',
'read') && !$user->hasRight(
'supplier_proposal',
'read') && !$user->hasRight(
'commande',
'read') && !$user->hasRight(
'fournisseur',
'commande',
'read')
73 && !$user->hasRight(
'supplier_order',
'read') && !$user->hasRight(
'fichinter',
'read') && !$user->hasRight(
'contrat',
'read')) {
92$companystatic =
new Societe($db);
93if (isModEnabled(
"propal")) {
94 $propalstatic =
new Propal($db);
96if (isModEnabled(
'supplier_proposal')) {
99if (isModEnabled(
'commande')) {
102if (isModEnabled(
"supplier_order")) {
106if (isModEnabled(
'ficheinter')) {
110llxHeader(
"", $langs->trans(
"CommercialArea"));
114print
'<div class="fichecenter"><div class="fichethirdleft">';
131if (isModEnabled(
"propal") && $user->hasRight(
"propal",
"lire")) {
132 $sql =
"SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
133 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
134 $sql .=
", s.code_client, s.code_compta, s.client";
135 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
136 $sql .=
", s.logo, s.email, s.entity";
137 $sql .=
", s.canvas";
138 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p,";
139 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
140 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
141 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
143 $sql .=
" WHERE p.entity IN (".getEntity($propalstatic->element).
")";
144 $sql .=
" AND p.fk_soc = s.rowid";
145 $sql .=
" AND p.fk_statut = ".Propal::STATUS_DRAFT;
146 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
147 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
150 $sql .=
" AND s.rowid = ".((int) $socid);
153 $resql = $db->query($sql);
156 $num = $db->num_rows($resql);
157 $nbofloop = min($num, $maxofloop);
164 while ($i < $nbofloop) {
165 $obj = $db->fetch_object($resql);
170 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
174 $propalstatic->id = $obj->rowid;
175 $propalstatic->ref = $obj->ref;
176 $propalstatic->ref_client = $obj->ref_client;
177 $propalstatic->total_ht = $obj->total_ht;
178 $propalstatic->total_tva = $obj->total_tva;
179 $propalstatic->total_ttc = $obj->total_ttc;
180 $propalstatic->statut = $obj->status;
182 $companystatic->id = $obj->socid;
183 $companystatic->name = $obj->name;
184 $companystatic->name_alias = $obj->name_alias;
185 $companystatic->code_client = $obj->code_client;
186 $companystatic->code_compta = $obj->code_compta;
187 $companystatic->client = $obj->client;
188 $companystatic->code_fournisseur = $obj->code_fournisseur;
189 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
190 $companystatic->fournisseur = $obj->fournisseur;
191 $companystatic->logo = $obj->logo;
192 $companystatic->email = $obj->email;
193 $companystatic->entity = $obj->entity;
194 $companystatic->canvas = $obj->canvas;
196 print
'<tr class="oddeven">';
197 print
'<td class="nowraponall tdoverflowmax100">'.$propalstatic->getNomUrl(1).
'</td>';
198 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
199 print
'<td class="nowrap right tdamount amount">'.price((
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc)).
'</td>';
203 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
207 print
'<tr class="oddeven">';
208 print
'<td class="nowrap" colspan="5">';
209 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
229if (isModEnabled(
'supplier_proposal') && $user->hasRight(
"supplier_proposal",
"lire")) {
230 $sql =
"SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
231 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
232 $sql .=
", s.code_client, s.code_compta, s.client";
233 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
234 $sql .=
", s.logo, s.email, s.entity";
235 $sql .=
", s.canvas";
236 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal as p,";
237 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
238 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
239 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
241 $sql .=
" WHERE p.entity IN (".getEntity($supplierproposalstatic->element).
")";
242 $sql .=
" AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT;
243 $sql .=
" AND p.fk_soc = s.rowid";
244 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
245 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
248 $sql .=
" AND s.rowid = ".((int) $socid);
251 $resql = $db->query($sql);
254 $num = $db->num_rows($resql);
255 $nbofloop = min($num, $maxofloop);
262 while ($i < $nbofloop) {
263 $obj = $db->fetch_object($resql);
268 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
272 $supplierproposalstatic->id = $obj->rowid;
273 $supplierproposalstatic->ref = $obj->ref;
274 $supplierproposalstatic->total_ht = $obj->total_ht;
275 $supplierproposalstatic->total_tva = $obj->total_tva;
276 $supplierproposalstatic->total_ttc = $obj->total_ttc;
277 $supplierproposalstatic->statut = $obj->status;
279 $companystatic->id = $obj->socid;
280 $companystatic->name = $obj->name;
281 $companystatic->name_alias = $obj->name_alias;
282 $companystatic->code_client = $obj->code_client;
283 $companystatic->code_compta = $obj->code_compta;
284 $companystatic->client = $obj->client;
285 $companystatic->code_fournisseur = $obj->code_fournisseur;
286 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
287 $companystatic->fournisseur = $obj->fournisseur;
288 $companystatic->logo = $obj->logo;
289 $companystatic->email = $obj->email;
290 $companystatic->entity = $obj->entity;
291 $companystatic->canvas = $obj->canvas;
293 print
'<tr class="oddeven">';
294 print
'<td class="nowraponall tdoverflowmax100">'.$supplierproposalstatic->getNomUrl(1).
'</td>';
295 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
296 print
'<td class="nowrap right tdamount amount">'.price(
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).
'</td>';
300 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
304 print
'<tr class="oddeven">';
305 print
'<td class="nowrap" colspan="5">';
306 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
326if (isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
327 $sql =
"SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
328 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
329 $sql .=
", s.code_client, s.code_compta, s.client";
330 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
331 $sql .=
", s.logo, s.email, s.entity";
332 $sql .=
", s.canvas";
333 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande as c,";
334 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
335 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
336 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
338 $sql .=
" WHERE c.entity IN (".getEntity($orderstatic->element).
")";
339 $sql .=
" AND c.fk_statut = ".Commande::STATUS_DRAFT;
340 $sql .=
" AND c.fk_soc = s.rowid";
341 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
342 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
345 $sql .=
" AND c.fk_soc = ".((int) $socid);
348 $resql = $db->query($sql);
351 $num = $db->num_rows($resql);
352 $nbofloop = min($num, $maxofloop);
359 while ($i < $nbofloop) {
360 $obj = $db->fetch_object($resql);
365 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
369 $orderstatic->id = $obj->rowid;
370 $orderstatic->ref = $obj->ref;
371 $orderstatic->ref_client = $obj->ref_client;
372 $orderstatic->total_ht = $obj->total_ht;
373 $orderstatic->total_tva = $obj->total_tva;
374 $orderstatic->total_ttc = $obj->total_ttc;
375 $orderstatic->statut = $obj->status;
377 $companystatic->id = $obj->socid;
378 $companystatic->name = $obj->name;
379 $companystatic->name_alias = $obj->name_alias;
380 $companystatic->code_client = $obj->code_client;
381 $companystatic->code_compta = $obj->code_compta;
382 $companystatic->client = $obj->client;
383 $companystatic->code_fournisseur = $obj->code_fournisseur;
384 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
385 $companystatic->fournisseur = $obj->fournisseur;
386 $companystatic->logo = $obj->logo;
387 $companystatic->email = $obj->email;
388 $companystatic->entity = $obj->entity;
389 $companystatic->canvas = $obj->canvas;
391 print
'<tr class="oddeven">';
392 print
'<td class="nowraponall tdoverflowmax100">'.$orderstatic->getNomUrl(1).
'</td>';
393 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
394 print
'<td class="nowrap right tdamount amount">'.price(
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).
'</td>';
398 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
402 print
'<tr class="oddeven">';
403 print
'<td class="nowrap" colspan="5">';
404 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
424if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
"fournisseur",
"commande",
"lire")) || (isModEnabled(
"supplier_order") && $user->hasRight(
"supplier_order",
"lire"))) {
425 $sql =
"SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
426 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
427 $sql .=
", s.code_client, s.code_compta, s.client";
428 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
429 $sql .=
", s.logo, s.email, s.entity";
430 $sql .=
", s.canvas";
431 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf,";
432 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
433 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
434 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
436 $sql .=
" WHERE cf.entity IN (".getEntity($supplierorderstatic->element).
")";
437 $sql .=
" AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT;
438 $sql .=
" AND cf.fk_soc = s.rowid";
439 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
440 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
443 $sql .=
" AND cf.fk_soc = ".((int) $socid);
446 $resql = $db->query($sql);
449 $num = $db->num_rows($resql);
450 $nbofloop = min($num, $maxofloop);
457 while ($i < $nbofloop) {
458 $obj = $db->fetch_object($resql);
463 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
467 $supplierorderstatic->id = $obj->rowid;
468 $supplierorderstatic->ref = $obj->ref;
469 $supplierorderstatic->ref_supplier = $obj->ref_supplier;
470 $supplierorderstatic->total_ht = $obj->total_ht;
471 $supplierorderstatic->total_tva = $obj->total_tva;
472 $supplierorderstatic->total_ttc = $obj->total_ttc;
473 $supplierorderstatic->statut = $obj->status;
475 $companystatic->id = $obj->socid;
476 $companystatic->name = $obj->name;
477 $companystatic->name_alias = $obj->name_alias;
478 $companystatic->code_client = $obj->code_client;
479 $companystatic->code_compta = $obj->code_compta;
480 $companystatic->client = $obj->client;
481 $companystatic->code_fournisseur = $obj->code_fournisseur;
482 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
483 $companystatic->fournisseur = $obj->fournisseur;
484 $companystatic->logo = $obj->logo;
485 $companystatic->email = $obj->email;
486 $companystatic->entity = $obj->entity;
487 $companystatic->canvas = $obj->canvas;
489 print
'<tr class="oddeven">';
490 print
'<td class="nowraponall tdoverflowmax100">'.$supplierorderstatic->getNomUrl(1).
'</td>';
491 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
492 print
'<td class="nowrap right tdamount amount">'.price(
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).
'</td>';
496 $total += (
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc);
500 print
'<tr class="oddeven">';
501 print
'<td class="nowrap" colspan="5">';
502 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
521if (isModEnabled(
'ficheinter')) {
522 $sql =
"SELECT f.rowid, f.ref, s.nom as name, f.fk_statut, f.duree as duration";
523 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
524 $sql .=
", s.code_client, s.code_compta, s.client";
525 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
526 $sql .=
", s.logo, s.email, s.entity";
527 $sql .=
", s.canvas";
528 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
529 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
530 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
531 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
533 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
534 $sql .=
" AND f.fk_soc = s.rowid";
535 $sql .=
" AND f.fk_statut = 0";
537 $sql .=
" AND f.fk_soc = ".((int) $socid);
539 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
540 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
544 $resql = $db->query($sql);
546 $num = $db->num_rows($resql);
547 $nbofloop = min($num, $maxofloop);
555 while ($i < $nbofloop) {
556 $obj = $db->fetch_object($resql);
558 $fichinterstatic->id=$obj->rowid;
559 $fichinterstatic->ref=$obj->ref;
560 $fichinterstatic->statut=$obj->fk_statut;
562 $companystatic->id = $obj->socid;
563 $companystatic->name = $obj->name;
564 $companystatic->name_alias = $obj->name_alias;
565 $companystatic->code_client = $obj->code_client;
566 $companystatic->code_compta = $obj->code_compta;
567 $companystatic->client = $obj->client;
568 $companystatic->code_fournisseur = $obj->code_fournisseur;
569 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
570 $companystatic->fournisseur = $obj->fournisseur;
571 $companystatic->logo = $obj->logo;
572 $companystatic->email = $obj->email;
573 $companystatic->entity = $obj->entity;
574 $companystatic->canvas = $obj->canvas;
576 print
'<tr class="oddeven">';
577 print
'<td class="tdoverflowmax100">';
578 print $fichinterstatic->getNomUrl(1);
580 print
'<td class="tdoverflowmax100">';
581 print $companystatic->getNomUrl(1,
'customer');
583 print
'<td class="nowraponall tdoverflowmax100 right">';
598print
'</div><div class="fichetwothirdright">';
603if (isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
604 $sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
605 $sql .=
", s.code_client, s.code_compta, s.client";
606 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
607 $sql .=
", s.logo, s.email, s.entity";
608 $sql .=
", s.canvas";
609 $sql .=
", s.datec, s.tms";
610 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
611 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
612 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
614 $sql .=
" WHERE s.entity IN (".getEntity($companystatic->element).
")";
616 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
617 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
620 $parameters = array(
'socid' => $socid);
621 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $companystatic);
622 if (empty($reshook)) {
624 $sql .=
" AND s.rowid = ".((int) $socid);
627 $sql .= $hookmanager->resPrint;
628 $sql .=
" ORDER BY s.tms DESC";
629 $sql .= $db->plimit($max, 0);
631 $resql = $db->query($sql);
634 $header =
"BoxTitleLastCustomersOrProspects";
636 $header =
"BoxTitleLastModifiedProspects";
638 $header =
"BoxTitleLastModifiedCustomers";
641 $num = $db->num_rows($resql);
642 startSimpleTable($langs->trans($header, min($max, $num)),
"societe/list.php",
"type=p,c", 1);
647 while ($i < $num && $i < $max) {
648 $objp = $db->fetch_object($resql);
650 $companystatic->id = $objp->socid;
651 $companystatic->name = $objp->name;
652 $companystatic->name_alias = $objp->name_alias;
653 $companystatic->code_client = $objp->code_client;
654 $companystatic->code_compta = $objp->code_compta;
655 $companystatic->client = $objp->client;
656 $companystatic->code_fournisseur = $objp->code_fournisseur;
657 $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
658 $companystatic->fournisseur = $objp->fournisseur;
659 $companystatic->logo = $objp->logo;
660 $companystatic->email = $objp->email;
661 $companystatic->entity = $objp->entity;
662 $companystatic->canvas = $objp->canvas;
664 print
'<tr class="oddeven">';
665 print
'<td class="nowraponall tdoverflowmax100">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
666 print
'<td class="nowrap">';
669 $obj = $companystatic;
671 if (($obj->client == 2 || $obj->client == 3) && !
getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTS')) {
672 $s .=
'<a class="customer-back opacitymedium" title="'.$langs->trans(
"Prospect").
'" href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$companystatic->id.
'">'.
dol_substr($langs->trans(
"Prospect"), 0, 1).
'</a>';
674 if (($obj->client == 1 || $obj->client == 3) && !
getDolGlobalString(
'SOCIETE_DISABLE_CUSTOMERS')) {
675 $s .=
'<a class="customer-back" title="'.$langs->trans(
"Customer").
'" href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$companystatic->id.
'">'.
dol_substr($langs->trans(
"Customer"), 0, 1).
'</a>';
686 $datem = $db->jdate($objp->tms);
687 print
'<td class="right nowrap tddate" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
709if ((isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && $user->hasRight(
'societe',
'lire')) {
710 $sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
711 $sql .=
", s.code_client, s.code_compta, s.client";
712 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
713 $sql .=
", s.logo, s.email, s.entity";
714 $sql .=
", s.canvas";
715 $sql .=
", s.datec as dc, s.tms as dm";
716 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
717 if (!$user->hasRight(
'societe',
'client',
'voir') && !$user->socid) {
718 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
720 $sql .=
" WHERE s.entity IN (".getEntity($companystatic->element).
")";
721 $sql .=
" AND s.fournisseur = ".Societe::SUPPLIER;
722 if (!$user->hasRight(
'societe',
'client',
'voir') && !$user->socid) {
723 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
726 $parameters = array(
'socid' => $socid);
727 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $companystatic);
728 if (empty($reshook)) {
730 $sql .=
" AND s.rowid = ".((int) $socid);
733 $sql .= $hookmanager->resPrint;
734 $sql .=
" ORDER BY s.datec DESC";
735 $sql .= $db->plimit($max, 0);
737 $resql = $db->query($sql);
739 $num = $db->num_rows($resql);
740 startSimpleTable($langs->trans(
"BoxTitleLastModifiedSuppliers", min($max, $num)),
"societe/list.php",
"type=f", 1);
744 while ($i < $num && $i < $max) {
745 $objp = $db->fetch_object($resql);
747 $companystatic->id = $objp->socid;
748 $companystatic->name = $objp->name;
749 $companystatic->name_alias = $objp->name_alias;
750 $companystatic->code_client = $objp->code_client;
751 $companystatic->code_compta = $objp->code_compta;
752 $companystatic->client = $objp->client;
753 $companystatic->code_fournisseur = $objp->code_fournisseur;
754 $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
755 $companystatic->fournisseur = $objp->fournisseur;
756 $companystatic->logo = $objp->logo;
757 $companystatic->email = $objp->email;
758 $companystatic->entity = $objp->entity;
759 $companystatic->canvas = $objp->canvas;
761 print
'<tr class="oddeven">';
762 print
'<td class="nowraponall tdoverflowmax100">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
765 $obj = $companystatic;
774 if ((isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && $obj->fournisseur) {
775 $s .=
'<a class="vendor-back" title="'.$langs->trans(
"Supplier").
'" href="'.DOL_URL_ROOT.
'/fourn/card.php?socid='.$companystatic->id.
'">'.
dol_substr($langs->trans(
"Supplier"), 0, 1).
'</a>';
781 $datem = $db->jdate($objp->dm);
782 print
'<td class="right tddate" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
820if (isModEnabled(
'contrat') && $user->hasRight(
"contrat",
"lire") && 0) {
821 $staticcontrat =
new Contrat($db);
823 $sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
824 $sql .=
", s.code_client, s.code_compta, s.client";
825 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
826 $sql .=
", s.logo, s.email, s.entity";
827 $sql .=
", s.canvas";
828 $sql .=
", c.statut, c.rowid as contratid, p.ref, c.fin_validite as datefin, c.date_cloture as dateclo";
829 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
830 $sql .=
", ".MAIN_DB_PREFIX.
"contrat as c";
831 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
832 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
833 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
835 $sql .=
" WHERE c.entity IN (".getEntity($staticcontrat->element).
")";
836 $sql .=
" AND c.fk_soc = s.rowid";
837 $sql .=
" AND c.fk_product = p.rowid";
838 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
839 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
842 $sql .=
" AND s.rowid = ".((int) $socid);
844 $sql .=
" ORDER BY c.tms DESC";
845 $sql .= $db->plimit($max + 1, 0);
847 $resql = $db->query($sql);
849 $num = $db->num_rows($resql);
856 $obj = $db->fetch_object($resql);
858 $companystatic->id = $obj->socid;
859 $companystatic->name = $obj->name;
860 $companystatic->name_alias = $obj->name_alias;
861 $companystatic->code_client = $obj->code_client;
862 $companystatic->code_compta = $obj->code_compta;
863 $companystatic->client = $obj->client;
864 $companystatic->code_fournisseur = $obj->code_fournisseur;
865 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
866 $companystatic->fournisseur = $obj->fournisseur;
867 $companystatic->logo = $obj->logo;
868 $companystatic->email = $obj->email;
869 $companystatic->entity = $obj->entity;
870 $companystatic->canvas = $obj->canvas;
872 $staticcontrat->id = $obj->contratid;
873 $staticcontrat->ref = $obj->ref;
875 print
'<tr class="oddeven">';
876 print
'<td class="nowraponall">'.$staticcontrat->getNomUrl(1).
'</td>';
877 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
878 print
'<td class="right">'.$staticcontrat->LibStatut($obj->statut, 3).
'</td>';
898if (isModEnabled(
"propal") && $user->hasRight(
"propal",
"lire")) {
899 $sql =
"SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
900 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
901 $sql .=
", s.code_client, s.code_compta, s.client";
902 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
903 $sql .=
", s.logo, s.email, s.entity";
904 $sql .=
", s.canvas";
905 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
906 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
907 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
908 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
910 $sql .=
" WHERE p.entity IN (".getEntity($propalstatic->element).
")";
911 $sql .=
" AND p.fk_soc = s.rowid";
912 $sql .=
" AND p.fk_statut = ".Propal::STATUS_VALIDATED;
913 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
914 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
917 $sql .=
" AND s.rowid = ".((int) $socid);
919 $sql .=
" ORDER BY p.rowid DESC";
921 $resql = $db->query($sql);
923 $total = $total_ttc = 0;
924 $num = $db->num_rows($resql);
925 $nbofloop = min($num, (!
getDolGlobalString(
'MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
926 startSimpleTable(
"ProposalsOpened",
"comm/propal/list.php",
"search_status=1", 4, $num);
932 while ($i < $nbofloop) {
933 $obj = $db->fetch_object($resql);
938 $total += $obj->total_ht;
939 $total_ttc += $obj->total_ttc;
943 $propalstatic->id = $obj->propalid;
944 $propalstatic->ref = $obj->ref;
945 $propalstatic->ref_client = $obj->ref_client;
946 $propalstatic->total_ht = $obj->total_ht;
947 $propalstatic->total_tva = $obj->total_tva;
948 $propalstatic->total_ttc = $obj->total_ttc;
950 $companystatic->id = $obj->socid;
951 $companystatic->name = $obj->name;
952 $companystatic->name_alias = $obj->name_alias;
953 $companystatic->code_client = $obj->code_client;
954 $companystatic->code_compta = $obj->code_compta;
955 $companystatic->client = $obj->client;
956 $companystatic->code_fournisseur = $obj->code_fournisseur;
957 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
958 $companystatic->fournisseur = $obj->fournisseur;
959 $companystatic->logo = $obj->logo;
960 $companystatic->email = $obj->email;
961 $companystatic->entity = $obj->entity;
962 $companystatic->canvas = $obj->canvas;
967 $warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ?
img_warning($langs->trans(
"Late")) :
'';
969 print
'<tr class="oddeven">';
971 print
'<td class="nowrap" width="140">';
972 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
973 print
'<td class="nobordernopadding nowraponall">'.$propalstatic->getNomUrl(1).
'</td>';
974 print
'<td width="18" class="nobordernopadding nowrap">'.$warning.
'</td>';
975 print
'<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).
'</td>';
980 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
981 $datem = $db->jdate($obj->dp);
982 print
'<td class="center tddate" title="'.dol_escape_htmltag($langs->trans(
"Date").
': '.
dol_print_date($datem,
'day',
'tzserver')).
'">';
985 print
'<td class="right tdamount amount">'.price(
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).
'</td>';
986 print
'<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).
'</td>';
991 $total += $obj->total_ht;
992 $total_ttc += $obj->total_ttc;
996 print
'<tr class="oddeven">';
997 print
'<td class="nowrap" colspan="5">';
998 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1017if (isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
1018 $sql =
"SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
1019 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
1020 $sql .=
", s.code_client, s.code_compta, s.client";
1021 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
1022 $sql .=
", s.logo, s.email, s.entity";
1023 $sql .=
", s.canvas";
1024 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande as c";
1025 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
1026 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
1027 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1029 $sql .=
" WHERE c.entity IN (".getEntity($orderstatic->element).
")";
1030 $sql .=
" AND c.fk_soc = s.rowid";
1032 if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
1033 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1036 $sql .=
" AND s.rowid = ".((int) $socid);
1038 $sql .=
" ORDER BY c.rowid DESC";
1040 $resql = $db->query($sql);
1042 $total = $total_ttc = 0;
1043 $num = $db->num_rows($resql);
1044 $nbofloop = min($num, (!
getDolGlobalString(
'MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
1051 while ($i < $nbofloop) {
1052 $obj = $db->fetch_object($resql);
1057 $total += $obj->total_ht;
1058 $total_ttc += $obj->total_ttc;
1062 $orderstatic->id = $obj->commandeid;
1063 $orderstatic->ref = $obj->ref;
1064 $orderstatic->ref_client = $obj->ref_client;
1065 $orderstatic->statut = $obj->fk_statut;
1066 $orderstatic->total_ht = $obj->total_ht;
1067 $orderstatic->total_tva = $obj->total_tva;
1068 $orderstatic->total_ttc = $obj->total_ttc;
1070 $companystatic->id = $obj->socid;
1071 $companystatic->name = $obj->name;
1072 $companystatic->name_alias = $obj->name_alias;
1073 $companystatic->code_client = $obj->code_client;
1074 $companystatic->code_compta = $obj->code_compta;
1075 $companystatic->client = $obj->client;
1076 $companystatic->code_fournisseur = $obj->code_fournisseur;
1077 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1078 $companystatic->fournisseur = $obj->fournisseur;
1079 $companystatic->logo = $obj->logo;
1080 $companystatic->email = $obj->email;
1081 $companystatic->entity = $obj->entity;
1082 $companystatic->canvas = $obj->canvas;
1089 print
'<tr class="oddeven">';
1091 print
'<td class="nowrap" width="140">';
1092 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1093 print
'<td class="nobordernopadding nowraponall">'.$orderstatic->getNomUrl(1).
'</td>';
1094 print
'<td width="18" class="nobordernopadding nowrap"></td>';
1095 print
'<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($orderstatic->element, $filename, $filedir).
'</td>';
1100 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
1101 $datem = $db->jdate($obj->dv);
1102 print
'<td class="center tddate" title="'.dol_escape_htmltag($langs->trans(
"DateValue").
': '.
dol_print_date($datem,
'day',
'tzserver')).
'">';
1106 print
'<td class="right tdamount amount">'.price(
getDolGlobalString(
'MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).
'</td>';
1107 print
'<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).
'</td>';
1112 $total += $obj->total_ht;
1113 $total_ttc += $obj->total_ttc;
1117 print
'<tr class="oddeven">';
1118 print
'<td class="nowrap" colspan="5">';
1119 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1137$parameters = array(
'user' => $user);
1138$reshook = $hookmanager->executeHooks(
'dashboardCommercials', $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 predefined suppliers products.
const STATUS_DRAFT
Draft status.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage contracts.
Class to manage interventions.
const STATUS_DRAFT
Draft status.
Class to manage proposals.
const STATUS_DRAFT
Draft status.
Class to manage third parties objects (customers, suppliers, prospects...)
const PROSPECT
Third party type is a prospect.
const CUSTOMER_AND_PROSPECT
Third party type is a customer and a prospect.
Class to manage price ask supplier.
const STATUS_DRAFT
Draft status.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
finishSimpleTable($addLineBreak=false)
Add the correct HTML close tags for "startSimpleTable(...)" (use after the last table line)
startSimpleTable($header, $link="", $arguments="", $emptyRows=0, $number=-1)
Start a table with headers and a optinal clickable number (don't forget to use "finishSimpleTable()" ...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
addSummaryTableLine($tableColumnCount, $num, $nbofloop=0, $total=0, $noneWord="None", $extraRightColumn=false)
Add a summary line to the current open table ("None", "XMoreLines" or "Total xxx")
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getCustomerOrderPieChart($socid=0)
Return a HTML table that contains a pie chart of sales orders.
getCustomerProposalPieChart($socid=0)
Return a HTML table that contains a pie chart of customer proposals.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.