31 require
'../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/propal.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
49 $hookmanager->initHooks(array(
'commercialindex'));
52 $langs->loadLangs(array(
"boxes",
"commercial",
"contracts",
"orders",
"propal",
"supplier_proposal"));
54 $action =
GETPOST(
'action',
'aZ09');
58 $socid =
GETPOST(
'socid',
'int');
59 if (isset($user->socid) && $user->socid > 0) {
61 $socid = $user->socid;
64 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
68 $socid =
GETPOST(
"socid",
'int');
69 if ($user->socid > 0) {
77 if (!$user->hasRight(
'propal',
'read') && !$user->hasRight(
'supplier_proposal',
'read') && !$user->hasRight(
'commande',
'read') && !$user->hasRight(
'fournisseur',
'commande',
'read')
78 && !$user->hasRight(
'supplier_order',
'read') && !$user->hasRight(
'fichinter',
'read')) {
82 $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
98 $companystatic =
new Societe($db);
100 $propalstatic =
new Propal($db);
108 if ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order")) {
116 llxHeader(
"", $langs->trans(
"CommercialArea"));
120 print
'<div class="fichecenter"><div class="fichethirdleft">';
137 if (
isModEnabled(
"propal") && $user->hasRight(
"propal",
"lire")) {
138 $sql =
"SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
139 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
140 $sql .=
", s.code_client, s.code_compta, s.client";
141 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
142 $sql .=
", s.logo, s.email, s.entity";
143 $sql .=
", s.canvas";
144 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p,";
145 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
146 if (empty($user->rights->societe->client->voir) && !$socid) {
147 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
149 $sql .=
" WHERE p.entity IN (".getEntity($propalstatic->element).
")";
150 $sql .=
" AND p.fk_soc = s.rowid";
151 $sql .=
" AND p.fk_statut = ".Propal::STATUS_DRAFT;
152 if (empty($user->rights->societe->client->voir) && !$socid) {
153 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
156 $sql .=
" AND s.rowid = ".((int) $socid);
159 $resql = $db->query($sql);
162 $num = $db->num_rows(
$resql);
163 $nbofloop = min($num, $maxofloop);
170 while ($i < $nbofloop) {
171 $obj = $db->fetch_object(
$resql);
176 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
180 $propalstatic->id = $obj->rowid;
181 $propalstatic->ref = $obj->ref;
182 $propalstatic->ref_client = $obj->ref_client;
183 $propalstatic->total_ht = $obj->total_ht;
184 $propalstatic->total_tva = $obj->total_tva;
185 $propalstatic->total_ttc = $obj->total_ttc;
186 $propalstatic->statut = $obj->status;
188 $companystatic->id = $obj->socid;
189 $companystatic->name = $obj->name;
190 $companystatic->name_alias = $obj->name_alias;
191 $companystatic->code_client = $obj->code_client;
192 $companystatic->code_compta = $obj->code_compta;
193 $companystatic->client = $obj->client;
194 $companystatic->code_fournisseur = $obj->code_fournisseur;
195 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
196 $companystatic->fournisseur = $obj->fournisseur;
197 $companystatic->logo = $obj->logo;
198 $companystatic->email = $obj->email;
199 $companystatic->entity = $obj->entity;
200 $companystatic->canvas = $obj->canvas;
202 print
'<tr class="oddeven">';
203 print
'<td class="nowraponall tdoverflowmax100">'.$propalstatic->getNomUrl(1).
'</td>';
204 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
205 print
'<td class="nowrap right tdamount amount">'.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).
'</td>';
209 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
213 print
'<tr class="oddeven">';
214 print
'<td class="nowrap" colspan="5">';
215 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
235 if (
isModEnabled(
'supplier_proposal') && $user->hasRight(
"supplier_proposal",
"lire")) {
236 $sql =
"SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
237 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
238 $sql .=
", s.code_client, s.code_compta, s.client";
239 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
240 $sql .=
", s.logo, s.email, s.entity";
241 $sql .=
", s.canvas";
242 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal as p,";
243 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
244 if (empty($user->rights->societe->client->voir) && !$socid) {
245 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
247 $sql .=
" WHERE p.entity IN (".getEntity($supplierproposalstatic->element).
")";
248 $sql .=
" AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT;
249 $sql .=
" AND p.fk_soc = s.rowid";
250 if (empty($user->rights->societe->client->voir) && !$socid) {
251 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
254 $sql .=
" AND s.rowid = ".((int) $socid);
257 $resql = $db->query($sql);
260 $num = $db->num_rows(
$resql);
261 $nbofloop = min($num, $maxofloop);
268 while ($i < $nbofloop) {
269 $obj = $db->fetch_object(
$resql);
274 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
278 $supplierproposalstatic->id = $obj->rowid;
279 $supplierproposalstatic->ref = $obj->ref;
280 $supplierproposalstatic->total_ht = $obj->total_ht;
281 $supplierproposalstatic->total_tva = $obj->total_tva;
282 $supplierproposalstatic->total_ttc = $obj->total_ttc;
283 $supplierproposalstatic->statut = $obj->status;
285 $companystatic->id = $obj->socid;
286 $companystatic->name = $obj->name;
287 $companystatic->name_alias = $obj->name_alias;
288 $companystatic->code_client = $obj->code_client;
289 $companystatic->code_compta = $obj->code_compta;
290 $companystatic->client = $obj->client;
291 $companystatic->code_fournisseur = $obj->code_fournisseur;
292 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
293 $companystatic->fournisseur = $obj->fournisseur;
294 $companystatic->logo = $obj->logo;
295 $companystatic->email = $obj->email;
296 $companystatic->entity = $obj->entity;
297 $companystatic->canvas = $obj->canvas;
299 print
'<tr class="oddeven">';
300 print
'<td class="nowraponall tdoverflowmax100">'.$supplierproposalstatic->getNomUrl(1).
'</td>';
301 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
302 print
'<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).
'</td>';
306 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
310 print
'<tr class="oddeven">';
311 print
'<td class="nowrap" colspan="5">';
312 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
332 if (
isModEnabled(
'commande') && $user->rights->commande->lire) {
333 $sql =
"SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
334 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
335 $sql .=
", s.code_client, s.code_compta, s.client";
336 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
337 $sql .=
", s.logo, s.email, s.entity";
338 $sql .=
", s.canvas";
339 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande as c,";
340 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
341 if (empty($user->rights->societe->client->voir) && !$socid) {
342 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
344 $sql .=
" WHERE c.entity IN (".getEntity($orderstatic->element).
")";
345 $sql .=
" AND c.fk_statut = ".Commande::STATUS_DRAFT;
346 $sql .=
" AND c.fk_soc = s.rowid";
347 if (empty($user->rights->societe->client->voir) && !$socid) {
348 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
351 $sql .=
" AND c.fk_soc = ".((int) $socid);
354 $resql = $db->query($sql);
357 $num = $db->num_rows(
$resql);
358 $nbofloop = min($num, $maxofloop);
365 while ($i < $nbofloop) {
366 $obj = $db->fetch_object(
$resql);
371 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
375 $orderstatic->id = $obj->rowid;
376 $orderstatic->ref = $obj->ref;
377 $orderstatic->ref_client = $obj->ref_client;
378 $orderstatic->total_ht = $obj->total_ht;
379 $orderstatic->total_tva = $obj->total_tva;
380 $orderstatic->total_ttc = $obj->total_ttc;
381 $orderstatic->statut = $obj->status;
383 $companystatic->id = $obj->socid;
384 $companystatic->name = $obj->name;
385 $companystatic->name_alias = $obj->name_alias;
386 $companystatic->code_client = $obj->code_client;
387 $companystatic->code_compta = $obj->code_compta;
388 $companystatic->client = $obj->client;
389 $companystatic->code_fournisseur = $obj->code_fournisseur;
390 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
391 $companystatic->fournisseur = $obj->fournisseur;
392 $companystatic->logo = $obj->logo;
393 $companystatic->email = $obj->email;
394 $companystatic->entity = $obj->entity;
395 $companystatic->canvas = $obj->canvas;
397 print
'<tr class="oddeven">';
398 print
'<td class="nowraponall tdoverflowmax100">'.$orderstatic->getNomUrl(1).
'</td>';
399 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
400 print
'<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).
'</td>';
404 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
408 print
'<tr class="oddeven">';
409 print
'<td class="nowrap" colspan="5">';
410 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
430 if ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight(
"fournisseur",
"commande",
"lire")) || (
isModEnabled(
"supplier_order") && $user->hasRight(
"supplier_order",
"lire"))) {
431 $sql =
"SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
432 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
433 $sql .=
", s.code_client, s.code_compta, s.client";
434 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
435 $sql .=
", s.logo, s.email, s.entity";
436 $sql .=
", s.canvas";
437 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur as cf,";
438 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
439 if (empty($user->rights->societe->client->voir) && !$socid) {
440 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
442 $sql .=
" WHERE cf.entity IN (".getEntity($supplierorderstatic->element).
")";
443 $sql .=
" AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT;
444 $sql .=
" AND cf.fk_soc = s.rowid";
445 if (empty($user->rights->societe->client->voir) && !$socid) {
446 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
449 $sql .=
" AND cf.fk_soc = ".((int) $socid);
452 $resql = $db->query($sql);
455 $num = $db->num_rows(
$resql);
456 $nbofloop = min($num, $maxofloop);
463 while ($i < $nbofloop) {
464 $obj = $db->fetch_object(
$resql);
469 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
473 $supplierorderstatic->id = $obj->rowid;
474 $supplierorderstatic->ref = $obj->ref;
475 $supplierorderstatic->ref_supplier = $obj->ref_supplier;
476 $supplierorderstatic->total_ht = $obj->total_ht;
477 $supplierorderstatic->total_tva = $obj->total_tva;
478 $supplierorderstatic->total_ttc = $obj->total_ttc;
479 $supplierorderstatic->statut = $obj->status;
481 $companystatic->id = $obj->socid;
482 $companystatic->name = $obj->name;
483 $companystatic->name_alias = $obj->name_alias;
484 $companystatic->code_client = $obj->code_client;
485 $companystatic->code_compta = $obj->code_compta;
486 $companystatic->client = $obj->client;
487 $companystatic->code_fournisseur = $obj->code_fournisseur;
488 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
489 $companystatic->fournisseur = $obj->fournisseur;
490 $companystatic->logo = $obj->logo;
491 $companystatic->email = $obj->email;
492 $companystatic->entity = $obj->entity;
493 $companystatic->canvas = $obj->canvas;
495 print
'<tr class="oddeven">';
496 print
'<td class="nowraponall tdoverflowmax100">'.$supplierorderstatic->getNomUrl(1).
'</td>';
497 print
'<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
498 print
'<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).
'</td>';
502 $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
506 print
'<tr class="oddeven">';
507 print
'<td class="nowrap" colspan="5">';
508 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
528 $sql =
"SELECT f.rowid, f.ref, s.nom as name, f.fk_statut";
529 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
530 $sql .=
", s.code_client, s.code_compta, s.client";
531 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
532 $sql .=
", s.logo, s.email, s.entity";
533 $sql .=
", s.canvas";
534 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
535 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
536 if (empty($user->rights->societe->client->voir) && !$socid) {
537 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
539 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
540 $sql .=
" AND f.fk_soc = s.rowid";
541 $sql .=
" AND f.fk_statut = 0";
543 $sql .=
" AND f.fk_soc = ".((int) $socid);
545 if (empty($user->rights->societe->client->voir) && !$socid) {
546 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
550 $resql = $db->query($sql);
552 $num = $db->num_rows(
$resql);
553 $nbofloop = min($num, $maxofloop);
561 while ($i < $nbofloop) {
562 $obj = $db->fetch_object(
$resql);
564 $fichinterstatic->id=$obj->rowid;
565 $fichinterstatic->ref=$obj->ref;
566 $fichinterstatic->statut=$obj->fk_statut;
568 $companystatic->id = $obj->socid;
569 $companystatic->name = $obj->name;
570 $companystatic->name_alias = $obj->name_alias;
571 $companystatic->code_client = $obj->code_client;
572 $companystatic->code_compta = $obj->code_compta;
573 $companystatic->client = $obj->client;
574 $companystatic->code_fournisseur = $obj->code_fournisseur;
575 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
576 $companystatic->fournisseur = $obj->fournisseur;
577 $companystatic->logo = $obj->logo;
578 $companystatic->email = $obj->email;
579 $companystatic->entity = $obj->entity;
580 $companystatic->canvas = $obj->canvas;
582 print
'<tr class="oddeven">';
583 print
'<td class="nowraponall tdoverflowmax100">';
584 print $fichinterstatic->getNomUrl(1);
586 print
'<td class="nowrap tdoverflowmax100">';
587 print $companystatic->getNomUrl(1,
'customer');
596 print
"</table></div>";
600 print
'</div><div class="fichetwothirdright">';
605 if (
isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
606 $sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
607 $sql .=
", s.code_client, s.code_compta, s.client";
608 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
609 $sql .=
", s.logo, s.email, s.entity";
610 $sql .=
", s.canvas";
611 $sql .=
", s.datec, s.tms";
612 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
613 if (empty($user->rights->societe->client->voir) && !$socid) {
614 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
616 $sql .=
" WHERE s.entity IN (".getEntity($companystatic->element).
")";
618 if (empty($user->rights->societe->client->voir) && !$socid) {
619 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
622 $parameters = array(
'socid' => $socid);
623 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $companystatic);
624 if (empty($reshook)) {
626 $sql .=
" AND s.rowid = ".((int) $socid);
629 $sql .= $hookmanager->resPrint;
630 $sql .=
" ORDER BY s.tms DESC";
631 $sql .= $db->plimit($max, 0);
633 $resql = $db->query($sql);
635 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
636 $header =
"BoxTitleLastCustomersOrProspects";
637 } elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
638 $header =
"BoxTitleLastModifiedProspects";
640 $header =
"BoxTitleLastModifiedCustomers";
643 $num = $db->num_rows(
$resql);
644 startSimpleTable($langs->trans($header, min($max, $num)),
"societe/list.php",
"type=p,c", 1);
649 while ($i < $num && $i < $max) {
650 $objp = $db->fetch_object(
$resql);
652 $companystatic->id = $objp->socid;
653 $companystatic->name = $objp->name;
654 $companystatic->name_alias = $objp->name_alias;
655 $companystatic->code_client = $objp->code_client;
656 $companystatic->code_compta = $objp->code_compta;
657 $companystatic->client = $objp->client;
658 $companystatic->code_fournisseur = $objp->code_fournisseur;
659 $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
660 $companystatic->fournisseur = $objp->fournisseur;
661 $companystatic->logo = $objp->logo;
662 $companystatic->email = $objp->email;
663 $companystatic->entity = $objp->entity;
664 $companystatic->canvas = $objp->canvas;
666 print
'<tr class="oddeven">';
667 print
'<td class="nowraponall tdoverflowmax100">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
668 print
'<td class="nowrap">';
671 $obj = $companystatic;
673 if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
674 $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>';
676 if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
677 $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>';
688 $datem = $db->jdate($objp->tms);
689 print
'<td class="right nowrap tddate" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
711 if (((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice")) && $user->hasRight(
'societe',
'lire')) {
712 $sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
713 $sql .=
", s.code_client, s.code_compta, s.client";
714 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
715 $sql .=
", s.logo, s.email, s.entity";
716 $sql .=
", s.canvas";
717 $sql .=
", s.datec as dc, s.tms as dm";
718 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
719 if (empty($user->rights->societe->client->voir) && !$user->socid) {
720 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
722 $sql .=
" WHERE s.entity IN (".getEntity($companystatic->element).
")";
723 $sql .=
" AND s.fournisseur = ".Societe::SUPPLIER;
724 if (empty($user->rights->societe->client->voir) && !$user->socid) {
725 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
728 $parameters = array(
'socid' => $socid);
729 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $companystatic);
730 if (empty($reshook)) {
732 $sql .=
" AND s.rowid = ".((int) $socid);
735 $sql .= $hookmanager->resPrint;
736 $sql .=
" ORDER BY s.datec DESC";
737 $sql .= $db->plimit($max, 0);
739 $resql = $db->query($sql);
741 $num = $db->num_rows(
$resql);
742 startSimpleTable($langs->trans(
"BoxTitleLastModifiedSuppliers", min($max, $num)),
"societe/list.php",
"type=f", 1);
746 while ($i < $num && $i < $max) {
747 $objp = $db->fetch_object(
$resql);
749 $companystatic->id = $objp->socid;
750 $companystatic->name = $objp->name;
751 $companystatic->name_alias = $objp->name_alias;
752 $companystatic->code_client = $objp->code_client;
753 $companystatic->code_compta = $objp->code_compta;
754 $companystatic->client = $objp->client;
755 $companystatic->code_fournisseur = $objp->code_fournisseur;
756 $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
757 $companystatic->fournisseur = $objp->fournisseur;
758 $companystatic->logo = $objp->logo;
759 $companystatic->email = $objp->email;
760 $companystatic->entity = $objp->entity;
761 $companystatic->canvas = $objp->canvas;
763 print
'<tr class="oddeven">';
764 print
'<td class="nowraponall tdoverflowmax100">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
767 $obj = $companystatic;
776 if (((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice")) && $obj->fournisseur) {
777 $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>';
783 $datem = $db->jdate($objp->dm);
784 print
'<td class="right tddate" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
822 if (
isModEnabled(
'contrat') && $user->hasRight(
"contrat",
"lire") && 0) {
823 $staticcontrat =
new Contrat($db);
825 $sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias";
826 $sql .=
", s.code_client, s.code_compta, s.client";
827 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
828 $sql .=
", s.logo, s.email, s.entity";
829 $sql .=
", s.canvas";
830 $sql .=
", c.statut, c.rowid as contratid, p.ref, c.fin_validite as datefin, c.date_cloture as dateclo";
831 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
832 $sql .=
", ".MAIN_DB_PREFIX.
"contrat as c";
833 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
834 if (empty($user->rights->societe->client->voir) && !$socid) {
835 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
837 $sql .=
" WHERE c.entity IN (".getEntity($staticcontrat->element).
")";
838 $sql .=
" AND c.fk_soc = s.rowid";
839 $sql .=
" AND c.fk_product = p.rowid";
840 if (empty($user->rights->societe->client->voir) && !$socid) {
841 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
844 $sql .=
" AND s.rowid = ".((int) $socid);
846 $sql .=
" ORDER BY c.tms DESC";
847 $sql .= $db->plimit($max + 1, 0);
849 $resql = $db->query($sql);
851 $num = $db->num_rows(
$resql);
858 $obj = $db->fetch_object(
$resql);
860 $companystatic->id = $obj->socid;
861 $companystatic->name = $obj->name;
862 $companystatic->name_alias = $obj->name_alias;
863 $companystatic->code_client = $obj->code_client;
864 $companystatic->code_compta = $obj->code_compta;
865 $companystatic->client = $obj->client;
866 $companystatic->code_fournisseur = $obj->code_fournisseur;
867 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
868 $companystatic->fournisseur = $obj->fournisseur;
869 $companystatic->logo = $obj->logo;
870 $companystatic->email = $obj->email;
871 $companystatic->entity = $obj->entity;
872 $companystatic->canvas = $obj->canvas;
874 $staticcontrat->id = $obj->contratid;
875 $staticcontrat->ref = $obj->ref;
877 print
'<tr class="oddeven">';
878 print
'<td class="nowraponall">'.$staticcontrat->getNomUrl(1).
'</td>';
879 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer', 44).
'</td>';
880 print
'<td class="right">'.$staticcontrat->LibStatut($obj->statut, 3).
'</td>';
900 if (
isModEnabled(
"propal") && $user->hasRight(
"propal",
"lire")) {
901 $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";
902 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
903 $sql .=
", s.code_client, s.code_compta, s.client";
904 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
905 $sql .=
", s.logo, s.email, s.entity";
906 $sql .=
", s.canvas";
907 $sql .=
" FROM ".MAIN_DB_PREFIX.
"propal as p";
908 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
909 if (empty($user->rights->societe->client->voir) && !$socid) {
910 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
912 $sql .=
" WHERE p.entity IN (".getEntity($propalstatic->element).
")";
913 $sql .=
" AND p.fk_soc = s.rowid";
914 $sql .=
" AND p.fk_statut = ".Propal::STATUS_VALIDATED;
915 if (empty($user->rights->societe->client->voir) && !$socid) {
916 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
919 $sql .=
" AND s.rowid = ".((int) $socid);
921 $sql .=
" ORDER BY p.rowid DESC";
923 $resql = $db->query($sql);
925 $total = $total_ttc = 0;
926 $num = $db->num_rows(
$resql);
927 $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
928 startSimpleTable(
"ProposalsOpened",
"comm/propal/list.php",
"search_status=1", 4, $num);
934 while ($i < $nbofloop) {
935 $obj = $db->fetch_object(
$resql);
940 $total += $obj->total_ht;
941 $total_ttc += $obj->total_ttc;
945 $propalstatic->id = $obj->propalid;
946 $propalstatic->ref = $obj->ref;
947 $propalstatic->ref_client = $obj->ref_client;
948 $propalstatic->total_ht = $obj->total_ht;
949 $propalstatic->total_tva = $obj->total_tva;
950 $propalstatic->total_ttc = $obj->total_ttc;
952 $companystatic->id = $obj->socid;
953 $companystatic->name = $obj->name;
954 $companystatic->name_alias = $obj->name_alias;
955 $companystatic->code_client = $obj->code_client;
956 $companystatic->code_compta = $obj->code_compta;
957 $companystatic->client = $obj->client;
958 $companystatic->code_fournisseur = $obj->code_fournisseur;
959 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
960 $companystatic->fournisseur = $obj->fournisseur;
961 $companystatic->logo = $obj->logo;
962 $companystatic->email = $obj->email;
963 $companystatic->entity = $obj->entity;
964 $companystatic->canvas = $obj->canvas;
969 $warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ?
img_warning($langs->trans(
"Late")) :
'';
971 print
'<tr class="oddeven">';
973 print
'<td class="nowrap" width="140">';
974 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
975 print
'<td class="nobordernopadding nowraponall">'.$propalstatic->getNomUrl(1).
'</td>';
976 print
'<td width="18" class="nobordernopadding nowrap">'.$warning.
'</td>';
977 print
'<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).
'</td>';
982 print
'<td class="nowrap">'.$companystatic->getNomUrl(1,
'customer', 44).
'</td>';
983 $datem = $db->jdate($obj->dp);
984 print
'<td class="center tddate" title="'.dol_escape_htmltag($langs->trans(
"Date").
': '.
dol_print_date($datem,
'day',
'tzserver')).
'">';
987 print
'<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).
'</td>';
988 print
'<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).
'</td>';
993 $total += $obj->total_ht;
994 $total_ttc += $obj->total_ttc;
998 print
'<tr class="oddeven">';
999 print
'<td class="nowrap" colspan="5">';
1000 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1006 addSummaryTableLine(5, $num, $nbofloop, empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $total_ttc : $total,
"NoProposal",
true);
1019 if (
isModEnabled(
'commande') && $user->rights->commande->lire) {
1020 $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";
1021 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
1022 $sql .=
", s.code_client, s.code_compta, s.client";
1023 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
1024 $sql .=
", s.logo, s.email, s.entity";
1025 $sql .=
", s.canvas";
1026 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande as c";
1027 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
1028 if (empty($user->rights->societe->client->voir) && !$socid) {
1029 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1031 $sql .=
" WHERE c.entity IN (".getEntity($orderstatic->element).
")";
1032 $sql .=
" AND c.fk_soc = s.rowid";
1034 if (empty($user->rights->societe->client->voir) && !$socid) {
1035 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1038 $sql .=
" AND s.rowid = ".((int) $socid);
1040 $sql .=
" ORDER BY c.rowid DESC";
1042 $resql = $db->query($sql);
1044 $total = $total_ttc = 0;
1045 $num = $db->num_rows(
$resql);
1046 $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
1053 while ($i < $nbofloop) {
1054 $obj = $db->fetch_object(
$resql);
1059 $total += $obj->total_ht;
1060 $total_ttc += $obj->total_ttc;
1064 $orderstatic->id = $obj->commandeid;
1065 $orderstatic->ref = $obj->ref;
1066 $orderstatic->ref_client = $obj->ref_client;
1067 $orderstatic->statut = $obj->fk_statut;
1068 $orderstatic->total_ht = $obj->total_ht;
1069 $orderstatic->total_tva = $obj->total_tva;
1070 $orderstatic->total_ttc = $obj->total_ttc;
1072 $companystatic->id = $obj->socid;
1073 $companystatic->name = $obj->name;
1074 $companystatic->name_alias = $obj->name_alias;
1075 $companystatic->code_client = $obj->code_client;
1076 $companystatic->code_compta = $obj->code_compta;
1077 $companystatic->client = $obj->client;
1078 $companystatic->code_fournisseur = $obj->code_fournisseur;
1079 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1080 $companystatic->fournisseur = $obj->fournisseur;
1081 $companystatic->logo = $obj->logo;
1082 $companystatic->email = $obj->email;
1083 $companystatic->entity = $obj->entity;
1084 $companystatic->canvas = $obj->canvas;
1091 print
'<tr class="oddeven">';
1093 print
'<td class="nowrap" width="140">';
1094 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1095 print
'<td class="nobordernopadding nowraponall">'.$orderstatic->getNomUrl(1).
'</td>';
1096 print
'<td width="18" class="nobordernopadding nowrap"></td>';
1097 print
'<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($orderstatic->element, $filename, $filedir).
'</td>';
1102 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer', 44).
'</td>';
1103 $datem = $db->jdate($obj->dv);
1104 print
'<td class="center tddate" title="'.dol_escape_htmltag($langs->trans(
"DateValue").
': '.
dol_print_date($datem,
'day',
'tzserver')).
'">';
1108 print
'<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).
'</td>';
1109 print
'<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).
'</td>';
1114 $total += $obj->total_ht;
1115 $total_ttc += $obj->total_ttc;
1119 print
'<tr class="oddeven">';
1120 print
'<td class="nowrap" colspan="5">';
1121 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1127 addSummaryTableLine(5, $num, $nbofloop, empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $total_ttc : $total,
"None",
true);
1139 $parameters = array(
'user' => $user);
1140 $reshook = $hookmanager->executeHooks(
'dashboardCommercials', $parameters, $object);
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.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length, $stringencoding='', $trunconbytes=0)
Make a substring.
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")
isModEnabled($module)
Is Dolibarr module enabled.
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.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.