37require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
47if (isModEnabled(
'invoice')) {
48 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
51if (isModEnabled(
"propal")) {
52 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
54if (isModEnabled(
'order')) {
55 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
57if (isModEnabled(
"shipping")) {
58 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
60if (isModEnabled(
'contract')) {
61 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
63if (isModEnabled(
'member')) {
64 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
66if (isModEnabled(
'intervention')) {
67 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
71$langs->loadLangs(array(
'companies',
'banks'));
73if (isModEnabled(
'contract')) {
74 $langs->load(
"contracts");
76if (isModEnabled(
'order')) {
77 $langs->load(
"orders");
79if (isModEnabled(
"shipping")) {
80 $langs->load(
"sendings");
82if (isModEnabled(
'invoice')) {
83 $langs->load(
"bills");
85if (isModEnabled(
'project')) {
86 $langs->load(
"projects");
88if (isModEnabled(
'intervention')) {
89 $langs->load(
"interventions");
91if (isModEnabled(
'notification')) {
92 $langs->load(
"mails");
95$action =
GETPOST(
'action',
'aZ09');
100$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
101$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
103if (empty($page) || $page == -1) {
106$offset = $limit * $page;
107$pageprev = $page - 1;
108$pagenext = $page + 1;
115$cancel =
GETPOST(
'cancel',
'alpha');
122$extrafields->fetch_name_optionals_label(
$object->table_element);
125$hookmanager->initHooks(array(
'thirdpartycomm',
'globalcard'));
129if ($id > 0 && empty(
$object->id)) {
137 if (!(
$object->client > 0) || !$user->hasRight(
'societe',
'lire')) {
143if ($user->socid > 0) {
153$parameters = array(
'id' => $id,
'socid' => $id);
154$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
159if (empty($reshook)) {
165 if ($action ==
'setcustomeraccountancycode' && $user->hasRight(
'societe',
'creer')) {
172 $action =
'editcustomeraccountancycode';
177 if ($action ==
'setconditions' && $user->hasRight(
'societe',
'creer')) {
186 if ($action ==
'setmode' && $user->hasRight(
'societe',
'creer')) {
195 if ($action ==
'settransportmode' && $user->hasRight(
'societe',
'creer')) {
197 $result =
$object->setTransportMode(
GETPOST(
'transport_mode_id',
'alpha'));
204 if ($action ==
'setbankaccount' && $user->hasRight(
'societe',
'creer')) {
213 if ($action ==
'setshippingmethod' && $user->hasRight(
'societe',
'creer')) {
222 if ($action ==
'setassujtva' && $user->hasRight(
'societe',
'creer')) {
232 if ($action ==
'setprospectlevel' && $user->hasRight(
'societe',
'creer')) {
234 $object->fk_prospectlevel =
GETPOST(
'prospect_level_id',
'alpha');
242 if ($action ==
'setstcomm' && $user->hasRight(
'societe',
'creer')) {
254 if ($action ==
'setoutstanding_limit' && $user->hasRight(
'societe',
'creer')) {
264 if ($action ==
'setorder_min_amount' && $user->hasRight(
'societe',
'creer')) {
274 if ($action ==
'set_salesrepresentatives' && $user->hasRight(
'societe',
'creer')) {
279 if ($action ==
'update_extras' && $user->hasRight(
'societe',
'creer')) {
285 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
290 $result =
$object->insertExtraFields(
'COMPANY_MODIFY');
297 $action =
'edit_extras';
302 if ($action ==
'setwarehouse' && $user->hasRight(
'societe',
'creer')) {
312$contactstatic =
new Contact($db);
313$userstatic =
new User($db);
314$form =
new Form($db);
318$title = $langs->trans(
"ThirdParty").
" - ".$langs->trans(
'Customer');
320 $title =
$object->name.
" - ".$langs->trans(
'Customer');
323$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
330 print
dol_get_fiche_head($head,
'customer', $langs->trans(
"ThirdParty"), -1,
'company');
332 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
334 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
336 print
'<div class="fichecenter"><div class="fichehalfleft">';
338 print
'<div class="underbanner clearboth"></div>';
339 print
'<table class="border centpercent tableforfield">';
342 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
348 print
'<tr><td>'.$langs->trans(
"Prefix").
'</td><td>';
354 $langs->load(
"compta");
357 print $langs->trans(
'CustomerCode').
'</td><td>';
359 $tmpcheck =
$object->check_codeclient();
360 if ($tmpcheck != 0 && $tmpcheck != -5) {
361 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
367 print $form->editfieldkey(
"CustomerAccountancyCode",
'customeraccountancycode',
$object->code_compta_client,
$object, $user->hasRight(
'societe',
'creer'));
369 print $form->editfieldval(
"CustomerAccountancyCode",
'customeraccountancycode',
$object->code_compta_client,
$object, $user->hasRight(
'societe',
'creer'));
390 if ($mysoc->country_code ==
'ES') {
392 if ($mysoc->localtax1_assuj ==
"1") {
393 print
'<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
397 if ($mysoc->localtax1_assuj ==
"1") {
398 print
'<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
405 print
'<tr><td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
410 $langs->load(
'bills');
412 print
'<table width="100%" class="nobordernopadding"><tr><td>';
413 print $langs->trans(
'PaymentConditions');
415 if (($action !=
'editconditions') && $user->hasRight(
'societe',
'creer')) {
416 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editconditions&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetConditions'), 1).
'</a></td>';
418 print
'</tr></table>';
420 if ($action ==
'editconditions') {
421 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->cond_reglement_id,
'cond_reglement_id', 1,
'', 1,
$object->deposit_percent);
423 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->cond_reglement_id,
'none', 0,
'', 1,
$object->deposit_percent);
429 print
'<tr><td class="nowrap">';
430 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
431 print $langs->trans(
'PaymentMode');
433 if (($action !=
'editmode') && $user->hasRight(
'societe',
'creer')) {
434 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmode&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
436 print
'</tr></table>';
438 if ($action ==
'editmode') {
439 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
441 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->mode_reglement_id,
'none');
446 if (isModEnabled(
"bank")) {
448 print
'<tr><td class="nowrap">';
449 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
450 print $langs->trans(
'PaymentBankAccount');
452 if (($action !=
'editbankaccount') && $user->hasRight(
'societe',
'creer')) {
453 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editbankaccount&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetBankAccount'), 1).
'</a></td>';
455 print
'</tr></table>';
457 if ($action ==
'editbankaccount') {
458 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->fk_account,
'fk_account', 1);
460 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->fk_account,
'none');
470 print
'<tr><td class="nowrap">';
471 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
472 print $langs->trans(
"CustomerRelativeDiscountShort");
473 print
'<td><td class="right">';
474 if ($user->hasRight(
'societe',
'creer') && !$user->socid > 0) {
475 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?socid='.
$object->id).
'&action=create&token='.
newToken().
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
477 print
'</td></tr></table>';
478 print
'</td><td>'.($object->remise_percent ?
'<a href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.
$object->id.
'">'.
$object->remise_percent.
'%</a>' :
'').
'</td>';
482 print
'<tr><td class="nowrap">';
483 print
'<table width="100%" class="nobordernopadding">';
484 print
'<tr><td class="nowrap">';
485 print $langs->trans(
"CustomerAbsoluteDiscountShort");
486 print
'<td><td class="right">';
487 if ($user->hasRight(
'societe',
'creer') && !$user->socid > 0) {
488 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?socid='.
$object->id).
'&action=create_remise&token='.
newToken().
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
490 print
'</td></tr></table>';
493 $amount_discount =
$object->getAvailableDiscounts();
494 if ($amount_discount < 0) {
497 if ($amount_discount > 0) {
498 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?socid='.
$object->id).
'&action=create&token='.
newToken().
'">'.
price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).
'</a>';
505 $limit_field_type =
'';
508 print
'<tr class="nowrap">';
510 print $form->editfieldkey(
"OutstandingBill",
'outstanding_limit',
$object->outstanding_limit,
$object, $user->hasRight(
'societe',
'creer'));
512 $limit_field_type = (
getDolGlobalString(
'MAIN_USE_JQUERY_JEDITABLE')) ?
'numeric' :
'amount';
513 print $form->editfieldval(
"OutstandingBill",
'outstanding_limit',
$object->outstanding_limit,
$object, $user->hasRight(
'societe',
'creer'), $limit_field_type, (
$object->outstanding_limit !=
'' ?
price(
$object->outstanding_limit) :
''));
520 print
'<!-- Minimum amount for orders -->'.
"\n";
521 print
'<tr class="nowrap">';
523 print $form->editfieldkey(
"OrderMinAmount",
'order_min_amount',
$object->order_min_amount,
$object, $user->hasRight(
'societe',
'creer'));
525 print $form->editfieldval(
"OrderMinAmount",
'order_min_amount',
$object->order_min_amount,
$object, $user->hasRight(
'societe',
'creer'), $limit_field_type, (
$object->order_min_amount !=
'' ?
price(
$object->order_min_amount) :
''));
534 print
'<tr><td class="nowrap">';
535 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
536 print $langs->trans(
"PriceLevel");
537 print
'<td><td class="right">';
538 if ($user->hasRight(
'societe',
'creer')) {
539 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/multiprix.php?id='.
$object->id.
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
541 print
'</td></tr></table>';
544 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
554 $langs->load(
'stocks');
555 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
557 print
'<tr class="nowrap">';
559 print $form->editfieldkey(
"Warehouse",
'warehouse',
'',
$object, $user->hasRight(
'societe',
'creer'));
561 if ($action ==
'editwarehouse') {
562 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'fk_warehouse', 1);
564 if (
$object->fk_warehouse > 0) {
565 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
567 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'none');
575 print
'<tr><td class="nowrap">';
576 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
577 print $langs->trans(
'SendingMethod');
579 if (($action !=
'editshipping') && $user->hasRight(
'societe',
'creer')) {
580 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editshipping&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
582 print
'</tr></table>';
584 if ($action ==
'editshipping') {
585 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->shipping_method_id,
'shipping_method_id', 1);
587 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->shipping_method_id,
'none');
593 if (isModEnabled(
'intracommreport')) {
595 print
'<tr><td class="nowrap">';
596 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
597 print $langs->trans(
'IntracommReportTransportMode');
599 if (($action !=
'edittransportmode') && $user->hasRight(
'societe',
'creer')) {
600 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edittransportmode&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
602 print
'</tr></table>';
604 if ($action ==
'edittransportmode') {
605 $form->formSelectTransportMode($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (!empty(
$object->transport_mode_id) ?
$object->transport_mode_id :
''),
'transport_mode_id', 1);
607 $form->formSelectTransportMode($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (!empty(
$object->transport_mode_id) ?
$object->transport_mode_id :
''),
'none');
614 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
615 $langs->load(
"categories");
616 print
'<tr><td>'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
618 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
623 $parameters = array(
'socid' =>
$object->id);
624 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
627 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
630 if (isModEnabled(
'member')) {
631 $langs->load(
"members");
632 $langs->load(
"users");
634 print
'<tr><td class="titlefield">'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
637 $result = $adh->fetch(0,
'',
$object->id);
639 $adh->ref = $adh->getFullName($langs);
640 print $adh->getNomUrl(-1);
642 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
650 print
'</div><div class="fichehalfright">';
654 print
'<div class="underbanner clearboth"></div>';
655 print
'<table class="border centpercent tableforfield">';
658 print
'<tr><td class="titlefield nowrap">';
659 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
660 print $langs->trans(
'ProspectLevel');
662 if ($action !=
'editlevel' && $user->hasRight(
'societe',
'creer')) {
663 print
'<td class="right"><a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editlevel&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->trans(
'Modify'), 1).
'</a></td>';
665 print
'</tr></table>';
667 if ($action ==
'editlevel') {
668 $formcompany->form_prospect_level($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->fk_prospectlevel,
'prospect_level_id', 1);
670 print
$object->getLibProspLevel();
676 $object->loadCacheOfProspStatus();
677 print
'<tr><td>'.$langs->trans(
"StatusProsp").
'</td><td>'.
$object->getLibProspCommStatut(4,
$object->cacheprospectstatus[
$object->stcomm_id][
'label']);
678 print
' ';
679 print
'<div class="floatright">';
680 foreach (
$object->cacheprospectstatus as $key => $val) {
681 $titlealt =
'default';
682 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) {
683 $titlealt = $val[
'label'];
685 if (
$object->stcomm_id != $val[
'id']) {
686 print
'<a class="pictosubstatus reposition" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&stcomm='.$val[
'code'].
'&action=setstcomm&token='.
newToken().
'">'.
img_action($titlealt, $val[
'code'], $val[
'picto']).
'</a>';
689 print
'</div></td></tr>';
694 print
'<div class="underbanner underbanner-before-box clearboth"></div><br>';
703 $boxstat .=
'<div class="box divboxtable box-halfright">';
704 $boxstat .=
'<table summary="'.dol_escape_htmltag($langs->trans(
"DolibarrStateBoard")).
'" class="border boxtable boxtablenobottom boxtablenotop boxtablenomarginbottom centpercent">';
705 $boxstat .=
'<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
707 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
709 $tmp =
$object->getOutstandingProposals();
710 $outstandingOpened = $tmp[
'opened'];
711 $outstandingTotal = $tmp[
'total_ht'];
712 $outstandingTotalIncTax = $tmp[
'total_ttc'];
713 $text = $langs->trans(
"OverAllProposals");
714 $link = DOL_URL_ROOT.
'/comm/propal/list.php?socid='.
$object->id;
717 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
719 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
720 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
721 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
722 $boxstat .=
'</div>';
728 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
730 $tmp =
$object->getOutstandingOrders();
731 $outstandingOpened = $tmp[
'opened'];
732 $outstandingTotal = $tmp[
'total_ht'];
733 $outstandingTotalIncTax = $tmp[
'total_ttc'];
734 $text = $langs->trans(
"OverAllOrders");
735 $link = DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->id;
738 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
740 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
741 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
742 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
743 $boxstat .=
'</div>';
749 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
751 $tmp =
$object->getOutstandingBills(
'customer', 0);
752 $outstandingOpened = $tmp[
'opened'];
753 $outstandingTotal = $tmp[
'total_ht'];
754 $outstandingTotalIncTax = $tmp[
'total_ttc'];
756 $text = $langs->trans(
"OverAllInvoices");
757 $link = DOL_URL_ROOT.
'/compta/facture/list.php?socid='.
$object->id;
760 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
762 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
763 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
764 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
765 $boxstat .=
'</div>';
772 if (
$object->outstanding_limit !=
'' &&
$object->outstanding_limit < $outstandingOpened) {
773 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
775 $text = $langs->trans(
"CurrentOutstandingBill");
776 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.
$object->id;
779 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
781 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
782 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
783 $boxstat .=
'<span class="boxstatsindicator'.($outstandingOpened > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.
'</span>';
784 $boxstat .=
'</div>';
789 $tmp =
$object->getOutstandingBills(
'customer', 1);
790 $outstandingOpenedLate = $tmp[
'opened'];
791 if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
793 if (
$object->outstanding_limit !=
'' &&
$object->outstanding_limit < $outstandingOpenedLate) {
794 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
796 $text = $langs->trans(
"CurrentOutstandingBillLate");
797 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.
$object->id;
800 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
802 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
803 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
804 $boxstat .=
'<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.
'</span>';
805 $boxstat .=
'</div>';
812 $parameters = array();
813 $reshook = $hookmanager->executeHooks(
'addMoreBoxStatsCustomer', $parameters,
$object, $action);
814 if (empty($reshook)) {
815 $boxstat .= $hookmanager->resPrint;
818 $boxstat .=
'</td></tr>';
819 $boxstat .=
'</table>';
820 $boxstat .=
'</div>';
828 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
829 $langs->load(
"propal");
831 $sql =
"SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_projet, p.fk_statut, p.total_ht";
832 $sql .=
", p.total_tva";
833 $sql .=
", p.total_ttc";
834 $sql .=
", p.ref, p.ref_client, p.remise";
835 $sql .=
", p.datep as dp, p.fin_validite as date_limit, p.entity";
836 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"propal as p, ".MAIN_DB_PREFIX.
"c_propalst as c";
837 $sql .=
" WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
838 $sql .=
" AND s.rowid = ".((int)
$object->id);
839 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
840 $sql .=
" ORDER BY p.datep DESC";
842 $resql = $db->query($sql);
844 $propal_static =
new Propal($db);
846 $num = $db->num_rows($resql);
848 print
'<div class="div-table-responsive-no-min">';
849 print
'<table class="noborder centpercent lastrecordtable">';
851 print
'<tr class="liste_titre">';
852 print
'<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
"LastPropals", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/comm/propal/list.php?socid='.
$object->id.
'"><span class="hideonsmartphone">'.$langs->trans(
"AllPropals").
'</span><span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
853 print
'<td width="20px" class="right"><a href="'.DOL_URL_ROOT.
'/comm/propal/stats/index.php?socid='.
$object->id.
'">'.
img_picto($langs->trans(
"Statistics"),
'stats').
'</a></td>';
854 print
'</tr></table></td>';
859 while ($i < $num && $i < $MAXLIST) {
860 $objp = $db->fetch_object($resql);
862 print
'<tr class="oddeven">';
863 print
'<td class="nowraponall">';
864 $propal_static->id = $objp->propalid;
865 $propal_static->ref = $objp->ref;
866 $propal_static->ref_client = $objp->ref_client;
867 $propal_static->ref_customer = $objp->ref_client;
868 $propal_static->fk_project = $objp->fk_projet;
869 $propal_static->total_ht = $objp->total_ht;
870 $propal_static->total_tva = $objp->total_tva;
871 $propal_static->total_ttc = $objp->total_ttc;
872 print $propal_static->getNomUrl(1);
877 if (!empty($filedir)) {
878 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
880 if (is_array($file_list)) {
884 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
885 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
892 if (!empty($sortfield) && !empty($sortorder)) {
897 print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0);
899 print
'</td><td class="left">';
900 if ($propal_static->fk_project > 0) {
901 $project->fetch($propal_static->fk_project);
902 print $project->getNomUrl(1);
908 if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
909 print
" ".img_warning();
911 print
'</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
912 print
'<td class="right nowraponall">'.price($objp->total_ht).
'</td>';
913 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).
'</td></tr>';
927 $orders2invoice =
null;
932 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
933 $sql =
"SELECT s.nom, s.rowid";
934 $sql .=
", c.rowid as cid, c.entity, c.fk_projet, c.total_ht";
935 $sql .=
", c.total_tva";
936 $sql .=
", c.total_ttc";
937 $sql .=
", c.ref, c.ref_client, c.fk_statut, c.facture";
938 $sql .=
", c.date_commande as dc";
939 $sql .=
", c.facture as billed";
940 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"commande as c";
941 $sql .=
" WHERE c.fk_soc = s.rowid ";
942 $sql .=
" AND s.rowid = ".((int)
$object->id);
943 $sql .=
" AND c.entity IN (".getEntity(
'commande').
')';
944 $sql .=
" ORDER BY c.date_commande DESC";
946 $resql = $db->query($sql);
948 $commande_static =
new Commande($db);
950 $num = $db->num_rows($resql);
953 $sql2 =
'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
954 $sql2 .=
' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
955 $sql2 .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
956 $sql2 .=
', '.MAIN_DB_PREFIX.
'commande as c';
957 $sql2 .=
' WHERE c.fk_soc = s.rowid';
958 $sql2 .=
' AND s.rowid = '.((int)
$object->id);
960 $sql2 .=
" AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
962 $resql2 = $db->query($sql2);
963 $orders2invoice = $db->num_rows($resql2);
966 print
'<div class="div-table-responsive-no-min">';
967 print
'<table class="noborder centpercent lastrecordtable">';
969 print
'<tr class="liste_titre">';
970 print
'<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
"LastCustomerOrders", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->id.
'"><span class="hideonsmartphone">'.$langs->trans(
"AllOrders").
'</span><span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
971 print
'<td width="20px" class="right"><a href="'.DOL_URL_ROOT.
'/commande/stats/index.php?socid='.
$object->id.
'">'.
img_picto($langs->trans(
"Statistics"),
'stats').
'</a></td>';
972 print
'</tr></table></td>';
977 while ($i < $num && $i < $MAXLIST) {
978 $objp = $db->fetch_object($resql);
980 $commande_static->id = $objp->cid;
981 $commande_static->ref = $objp->ref;
982 $commande_static->ref_client = $objp->ref_client;
983 $commande_static->fk_project = $objp->fk_projet;
984 $commande_static->total_ht = $objp->total_ht;
985 $commande_static->total_tva = $objp->total_tva;
986 $commande_static->total_ttc = $objp->total_ttc;
987 $commande_static->billed = $objp->billed;
989 print
'<tr class="oddeven">';
990 print
'<td class="nowraponall">';
991 print $commande_static->getNomUrl(1);
993 $filedir = $conf->commande->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
995 if (!empty($filedir)) {
996 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
998 if (is_array($file_list)) {
1002 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1003 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1010 if (!empty($sortfield) && !empty($sortorder)) {
1015 print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param);
1017 print
'</td><td class="left">';
1018 if ($commande_static->fk_project > 0) {
1019 $project->fetch($commande_static->fk_project);
1020 print $project->getNomUrl(1);
1028 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc),
'day').
"</td>\n";
1029 print
'<td class="right nowraponall">'.price($objp->total_ht).
'</td>';
1030 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).
'</td></tr>';
1047 if (isModEnabled(
"shipping") && $user->hasRight(
'expedition',
'lire')) {
1048 $sql =
'SELECT e.rowid as id';
1049 $sql .=
', e.ref, e.entity, e.fk_projet';
1050 $sql .=
', e.date_creation';
1051 $sql .=
', e.fk_statut as statut';
1053 $sql .=
', s.rowid as socid';
1054 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"expedition as e";
1055 $sql .=
" WHERE e.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1056 $sql .=
" AND e.entity IN (".getEntity(
'expedition').
")";
1057 $sql .=
' GROUP BY e.rowid';
1058 $sql .=
', e.ref, e.entity, e.fk_projet';
1059 $sql .=
', e.date_creation';
1060 $sql .=
', e.fk_statut';
1062 $sql .=
', s.rowid';
1063 $sql .=
" ORDER BY e.date_creation DESC";
1065 $resql = $db->query($sql);
1069 $num = $db->num_rows($resql);
1071 print
'<div class="div-table-responsive-no-min">';
1072 print
'<table class="noborder centpercent lastrecordtable">';
1074 print
'<tr class="liste_titre">';
1075 print
'<td colspan="5"><table class="centpercent nobordernopadding"><tr><td>'.$langs->trans(
"LastSendings", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/expedition/list.php?socid='.
$object->id.
'"><span class="hideonsmartphone">'.$langs->trans(
"AllSendings").
'</span><span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
1076 print
'<td width="20px" class="right"><a href="'.DOL_URL_ROOT.
'/expedition/stats/index.php?socid='.
$object->id.
'">'.
img_picto($langs->trans(
"Statistics"),
'stats').
'</a></td>';
1077 print
'</tr></table></td>';
1082 while ($i < $num && $i < $MAXLIST) {
1083 $objp = $db->fetch_object($resql);
1085 $sendingstatic->id = $objp->id;
1086 $sendingstatic->ref = $objp->ref;
1087 $sendingstatic->fk_project = $objp->fk_projet;
1089 print
'<tr class="oddeven">';
1090 print
'<td class="nowraponall">';
1091 print $sendingstatic->getNomUrl(1);
1093 $filedir = $conf->expedition->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1095 if (!empty($filedir)) {
1096 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
1098 if (is_array($file_list)) {
1102 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1103 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1110 if (!empty($sortfield) && !empty($sortorder)) {
1115 print $formfile->showPreview($file_list, $sendingstatic->table_element, $relativepath, 0, $param);
1117 print
'</td><td class="left">';
1118 if ($sendingstatic->fk_project > 0) {
1119 $project->fetch($sendingstatic->fk_project);
1120 print $project->getNomUrl(1);
1127 if ($objp->date_creation > 0) {
1128 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation),
'day').
'</td>';
1130 print
'<td class="right"><b>!!!</b></td>';
1133 print
'<td class="nowrap right">'.$sendingstatic->LibStatut($objp->statut, 5).
'</td>';
1151 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
1152 $sql =
"SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.fk_projet, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
1153 $sql .=
" c.last_main_doc, c.model_pdf";
1154 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"contrat as c";
1155 $sql .=
" WHERE c.fk_soc = s.rowid ";
1156 $sql .=
" AND s.rowid = ".((int)
$object->id);
1157 $sql .=
" AND c.entity IN (".getEntity(
'contract').
")";
1158 $sql .=
" ORDER BY c.datec DESC";
1160 $resql = $db->query($sql);
1164 $num = $db->num_rows($resql);
1166 print
'<div class="div-table-responsive-no-min">';
1167 print
'<table class="noborder centpercent lastrecordtable">';
1169 print
'<tr class="liste_titre">';
1170 print
'<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
"LastContracts", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td>';
1171 print
'<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/contrat/list.php?socid='.
$object->id.
'">'.$langs->trans(
"AllContracts").
'<span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
1173 print
'</tr></table></td>';
1178 while ($i < $num && $i < $MAXLIST) {
1179 $objp = $db->fetch_object($resql);
1181 $contrat->id = $objp->id;
1182 $contrat->ref = $objp->ref ? $objp->ref : $objp->id;
1183 $contrat->ref_customer = $objp->refcus;
1184 $contrat->ref_supplier = $objp->refsup;
1185 $contrat->fk_project = $objp->fk_projet;
1186 $contrat->statut = $objp->contract_status;
1187 $contrat->status = $objp->contract_status;
1188 $contrat->last_main_doc = $objp->last_main_doc;
1189 $contrat->model_pdf = $objp->model_pdf;
1190 $contrat->fetch_lines();
1193 foreach ($contrat->lines as $line) {
1194 if ($contrat->status == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
1195 if (((!empty($line->date_end) ? $line->date_end : 0) + $conf->contrat->services->expires->warning_delay) < $now) {
1201 print
'<tr class="oddeven">';
1202 print
'<td class="nowraponall">';
1203 print $contrat->getNomUrl(1, 12);
1204 if (!empty($contrat->model_pdf)) {
1206 $filedir = $conf->contrat->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1208 if (!empty($filedir)) {
1209 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
1211 if (is_array($file_list)) {
1215 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1216 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1223 if (!empty($sortfield) && !empty($sortorder)) {
1228 print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
1236 print
'</td><td class="tdoverflowmax100">';
1237 if ($contrat->fk_project > 0) {
1238 $project->fetch($contrat->fk_project);
1239 print $project->getNomUrl(1);
1242 print
'<td class="nowrap">';
1243 print
dol_trunc(strtolower(get_class(
$object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12);
1246 print
'<td class="right" width="80px"><span title="'.$langs->trans(
"DateContract").
'">'.
dol_print_date($db->jdate($objp->dcon),
'day').
"</span></td>\n";
1247 print
'<td width="20"> </td>';
1248 print
'<td class="nowraponall right">';
1249 print $contrat->getLibStatut(4);
1268 if (isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
1269 $sql =
"SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_projet, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity";
1270 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"fichinter as f";
1271 $sql .=
" WHERE f.fk_soc = s.rowid";
1272 $sql .=
" AND s.rowid = ".((int)
$object->id);
1273 $sql .=
" AND f.entity IN (".getEntity(
'intervention').
")";
1274 $sql .=
" ORDER BY f.tms DESC";
1276 $resql = $db->query($sql);
1280 $num = $db->num_rows($resql);
1282 print
'<div class="div-table-responsive-no-min">';
1283 print
'<table class="noborder centpercent lastrecordtable">';
1285 print
'<tr class="liste_titre">';
1286 print
'<td colspan="4"><table class="centpercent nobordernopadding"><tr><td>'.$langs->trans(
"LastInterventions", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/fichinter/list.php?socid='.
$object->id.
'"><span class="hideonsmartphone">'.$langs->trans(
"AllInterventions").
'</span><span class="badge marginleftonlyshort">'.$num.
'</span></td>';
1287 print
'<td width="20px" class="right"><a href="'.DOL_URL_ROOT.
'/fichinter/stats/index.php?socid='.
$object->id.
'">'.
img_picto($langs->trans(
"Statistics"),
'stats').
'</a></td>';
1288 print
'</tr></table></td>';
1293 while ($i < $num && $i < $MAXLIST) {
1294 $objp = $db->fetch_object($resql);
1296 $fichinter_static->id = $objp->id;
1297 $fichinter_static->ref = $objp->ref;
1298 $fichinter_static->statut = $objp->fk_statut;
1299 $fichinter_static->fk_project = $objp->fk_projet;
1301 print
'<tr class="oddeven">';
1302 print
'<td class="nowraponall">';
1303 print $fichinter_static->getNomUrl(1);
1305 $filedir = $conf->ficheinter->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1307 if (!empty($filedir)) {
1308 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
1310 if (is_array($file_list)) {
1314 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1315 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1322 if (!empty($sortfield) && !empty($sortorder)) {
1327 print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0);
1329 print
'</td><td class="left">';
1330 if ($fichinter_static->fk_project > 0) {
1331 $project->fetch($fichinter_static->fk_project);
1332 print $project->getNomUrl(1);
1340 print
'<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).
'</td>'.
"\n";
1341 print
'<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).
'</td>'.
"\n";
1360 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1361 $sql =
'SELECT f.rowid as id, f.titre as ref, f.fk_projet';
1362 $sql .=
', f.total_ht';
1363 $sql .=
', f.total_tva';
1364 $sql .=
', f.total_ttc';
1365 $sql .=
', f.datec as dc';
1366 $sql .=
', f.date_last_gen, f.date_when';
1367 $sql .=
', f.frequency';
1368 $sql .=
', f.unit_frequency';
1369 $sql .=
', f.suspended as suspended';
1370 $sql .=
', s.nom, s.rowid as socid';
1371 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_rec as f";
1372 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1373 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1374 $sql .=
' GROUP BY f.rowid, f.titre, f.fk_projet, f.total_ht, f.total_tva, f.total_ttc,';
1375 $sql .=
' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
1376 $sql .=
' f.suspended, f.date_when,';
1377 $sql .=
' s.nom, s.rowid';
1378 $sql .=
" ORDER BY f.date_last_gen, f.datec DESC";
1380 $resql = $db->query($sql);
1384 $num = $db->num_rows($resql);
1386 print
'<div class="div-table-responsive-no-min">';
1387 print
'<table class="noborder centpercent lastrecordtable">';
1388 print
'<tr class="liste_titre">';
1393 print
'<td colspan="'.$colspan.
'">';
1394 print
'<table class="centpercent nobordernopadding"><tr>';
1395 print
'<td>'.$langs->trans(
"LatestCustomerTemplateInvoices", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php?socid='.
$object->id.
'"><span class="hideonsmartphone">'.$langs->trans(
"AllCustomerTemplateInvoices").
'</span><span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
1396 print
'</tr></table>';
1402 while ($i < $num && $i < $MAXLIST) {
1403 $objp = $db->fetch_object($resql);
1405 $invoicetemplate->id = $objp->id;
1406 $invoicetemplate->ref = $objp->ref;
1407 $invoicetemplate->fk_project = $objp->fk_projet;
1408 $invoicetemplate->suspended = $objp->suspended;
1409 $invoicetemplate->frequency = $objp->frequency;
1410 $invoicetemplate->unit_frequency = $objp->unit_frequency;
1411 $invoicetemplate->total_ht = $objp->total_ht;
1412 $invoicetemplate->total_tva = $objp->total_tva;
1413 $invoicetemplate->total_ttc = $objp->total_ttc;
1414 $invoicetemplate->date_last_gen = $objp->date_last_gen;
1415 $invoicetemplate->date_when = $objp->date_when;
1417 print
'<tr class="oddeven">';
1418 print
'<td class="tdoverflowmax250">';
1419 print $invoicetemplate->getNomUrl(1);
1420 print
'</td><td class="left">';
1421 if ($invoicetemplate->fk_project > 0) {
1422 $project->fetch($invoicetemplate->fk_project);
1423 print $project->getNomUrl(1);
1427 if ($objp->frequency && $objp->date_last_gen > 0) {
1428 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen),
'day').
'</td>';
1430 if ($objp->dc > 0) {
1431 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc),
'day').
'</td>';
1433 print
'<td class="right"><b>!!!</b></td>';
1436 print
'<td class="right nowraponall">';
1437 print
price($objp->total_ht);
1441 print
'<td class="right nowraponall">';
1442 print
price($objp->total_ttc);
1446 print
'<td class="nowrap right" style="min-width: 60px">';
1447 print $langs->trans(
'FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).
' - ';
1448 print($invoicetemplate->LibStatut($invoicetemplate->frequency, $invoicetemplate->suspended, 5, 0));
1467 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1468 $sql =
'SELECT f.rowid as facid, f.ref, f.type, f.ref_client, f.fk_projet';
1469 $sql .=
', f.total_ht';
1470 $sql .=
', f.total_tva';
1471 $sql .=
', f.total_ttc';
1472 $sql .=
', f.entity';
1473 $sql .=
', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status';
1474 $sql .=
', s.nom, s.rowid as socid';
1475 $sql .=
', SUM(pf.amount) as am';
1476 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture as f";
1477 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiement_facture as pf ON f.rowid=pf.fk_facture';
1478 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1479 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1480 $sql .=
' GROUP BY f.rowid, f.ref, f.type, f.ref_client, f.fk_projet, f.total_ht, f.total_tva, f.total_ttc,';
1481 $sql .=
' f.entity, f.datef, f.date_lim_reglement, f.datec, f.paye, f.fk_statut,';
1482 $sql .=
' s.nom, s.rowid';
1483 $sql .=
" ORDER BY f.datef DESC, f.datec DESC";
1485 $resql = $db->query($sql);
1487 $facturestatic =
new Facture($db);
1489 $num = $db->num_rows($resql);
1491 print
'<div class="div-table-responsive-no-min">';
1492 print
'<table class="noborder centpercent lastrecordtable">';
1493 print
'<tr class="liste_titre">';
1501 print
'<td colspan="'.$colspan.
'">';
1502 print
'<table class="centpercent nobordernopadding"><tr><td>'.$langs->trans(
"LastCustomersBills", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.
'/compta/facture/list.php?socid='.
$object->id.
'"><span class="hideonsmartphone">'.$langs->trans(
"AllBills").
'</span><span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
1503 print
'<td width="20px" class="right"><a href="'.DOL_URL_ROOT.
'/compta/facture/stats/index.php?socid='.
$object->id.
'">'.
img_picto($langs->trans(
"Statistics"),
'stats').
'</a></td>';
1504 print
'</tr></table>';
1510 while ($i < $num && $i < $MAXLIST) {
1511 $objp = $db->fetch_object($resql);
1513 $facturestatic->id = $objp->facid;
1514 $facturestatic->ref = $objp->ref;
1515 $facturestatic->ref_client = $objp->ref_client;
1516 $facturestatic->fk_project = $objp->fk_projet;
1517 $facturestatic->type = $objp->type;
1518 $facturestatic->total_ht = $objp->total_ht;
1519 $facturestatic->total_tva = $objp->total_tva;
1520 $facturestatic->total_ttc = $objp->total_ttc;
1521 $facturestatic->statut = $objp->status;
1522 $facturestatic->status = $objp->status;
1523 $facturestatic->paye = $objp->paye;
1524 $facturestatic->alreadypaid = $objp->am;
1525 $facturestatic->totalpaid = $objp->am;
1526 $facturestatic->date = $db->jdate($objp->df);
1527 $facturestatic->date_lim_reglement = $db->jdate($objp->dl);
1529 print
'<tr class="oddeven">';
1530 print
'<td class="nowraponall">';
1531 print $facturestatic->getNomUrl(1);
1533 $filedir = $conf->facture->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1535 if (!empty($filedir)) {
1536 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
1538 if (is_array($file_list)) {
1542 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1543 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1550 if (!empty($sortfield) && !empty($sortorder)) {
1555 print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0);
1557 print
'</td><td class="left">';
1558 if ($facturestatic->fk_project > 0) {
1559 $project->fetch($facturestatic->fk_project);
1560 print $project->getNomUrl(1);
1568 print
'<td class="left nowraponall">';
1569 print $objp->ref_client;
1572 if ($objp->df > 0) {
1573 print
'<td width="80px" title="'.dol_escape_htmltag($langs->trans(
'DateInvoice')).
'">'.
dol_print_date($db->jdate($objp->df),
'day').
'</td>';
1575 print
'<td><b>!!!</b></td>';
1577 if ($objp->dl > 0) {
1578 print
'<td width="80px" title="'.dol_escape_htmltag($langs->trans(
'DateMaxPayment')).
'">'.
dol_print_date($db->jdate($objp->dl),
'day').
'</td>';
1580 print
'<td><b>!!!</b></td>';
1583 print
'<td class="right nowraponall">';
1584 print
price($objp->total_ht);
1588 print
'<td class="right nowraponall">';
1589 print
price($objp->total_ttc);
1593 print
'<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->status, 5, $objp->am)).
'</td>';
1609 $parameters = array();
1610 $reshook = $hookmanager->executeHooks(
'addMoreRecentObjects', $parameters,
$object, $action);
1614 print $hookmanager->resPrint;
1617 print
'</div></div>';
1618 print
'<div class="clearboth"></div>';
1626 print
'<div class="tabsAction">';
1628 $parameters = array();
1629 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1631 if (empty($reshook)) {
1633 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyIsClosed")).
'" href="#">'.$langs->trans(
"ThirdPartyIsClosed").
'</a></div>';
1636 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'creer') &&
$object->status == 1) {
1637 $langs->load(
"propal");
1638 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/comm/propal/card.php?socid='.
$object->id.
'&action=create">'.$langs->trans(
"AddProp").
'</a></div>';
1641 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'creer') &&
$object->status == 1) {
1642 $langs->load(
"orders");
1643 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/commande/card.php?socid='.
$object->id.
'&action=create">'.$langs->trans(
"AddOrder").
'</a></div>';
1646 if ($user->hasRight(
'contrat',
'creer') &&
$object->status == 1) {
1647 $langs->load(
"contracts");
1648 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/contrat/card.php?socid='.
$object->id.
'&action=create">'.$langs->trans(
"AddContract").
'</a></div>';
1651 if (isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'creer') &&
$object->status == 1) {
1652 $langs->load(
"interventions");
1653 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/fichinter/card.php?socid='.
$object->id.
'&action=create">'.$langs->trans(
"AddIntervention").
'</a></div>';
1657 if ($user->socid == 0) {
1658 if (isModEnabled(
'deplacement') &&
$object->status == 1) {
1659 $langs->load(
"trips");
1660 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/deplacement/card.php?socid='.
$object->id.
'&action=create">'.$langs->trans(
"AddTrip").
'</a></div>';
1663 if (isModEnabled(
'invoice') &&
$object->status == 1) {
1664 if (!$user->hasRight(
'facture',
'creer')) {
1665 $langs->load(
"bills");
1666 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1668 $langs->loadLangs(array(
"orders",
"bills"));
1670 if (isModEnabled(
'order')) {
1672 if (!empty($orders2invoice) && $orders2invoice > 0) {
1673 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->id.
'&search_billed=0&autoselectall=1">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1675 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NoOrdersToInvoice")).
'" href="#">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1678 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1683 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.
$object->id.
'">'.$langs->trans(
"AddBill").
'</a></div>';
1685 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1693 if ($user->hasRight(
'agenda',
'myactions',
'create')) {
1694 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/comm/action/card.php?action=create&socid='.
$object->id.
'">'.$langs->trans(
"AddAction").
'</a></div>';
1696 print
'<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddAction").
'</a></div>';
1718 $langs->load(
"errors");
1719 print $langs->trans(
'ErrorRecordNotFound');
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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 members of a foundation.
Class to manage customers or prospects.
Class to manage customers orders.
Class to manage invoices.
Class to manage invoice templates.
Class to manage projects.
Class to manage proposals.
Class to manage Dolibarr users.
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
show_actions_done($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC', $module='')
Show html area with actions (done or not, ignore the name of function).
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
show_actions_todo($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='')
Show html area with actions to do.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
Complete $filearray with data from database.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_action($titlealt, $numaction, $picto='', $moreatt='')
Show logo action.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.