36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45if (isModEnabled(
'invoice')) {
46 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
49if (isModEnabled(
"propal")) {
50 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
52if (isModEnabled(
'order')) {
53 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
55if (isModEnabled(
"shipping")) {
56 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
58if (isModEnabled(
'contract')) {
59 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
61if (isModEnabled(
'member')) {
62 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
64if (isModEnabled(
'intervention')) {
65 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
69$langs->loadLangs(array(
'companies',
'banks'));
71if (isModEnabled(
'contract')) {
72 $langs->load(
"contracts");
74if (isModEnabled(
'order')) {
75 $langs->load(
"orders");
77if (isModEnabled(
"shipping")) {
78 $langs->load(
"sendings");
80if (isModEnabled(
'invoice')) {
81 $langs->load(
"bills");
83if (isModEnabled(
'project')) {
84 $langs->load(
"projects");
86if (isModEnabled(
'intervention')) {
87 $langs->load(
"interventions");
89if (isModEnabled(
'notification')) {
90 $langs->load(
"mails");
93$action =
GETPOST(
'action',
'aZ09');
98$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
99$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
101if (empty($page) || $page == -1) {
104$offset = $limit * $page;
105$pageprev = $page - 1;
106$pagenext = $page + 1;
113$cancel =
GETPOST(
'cancel',
'alpha');
120$extrafields->fetch_name_optionals_label(
$object->table_element);
123$hookmanager->initHooks(array(
'thirdpartycomm',
'globalcard'));
127if ($id > 0 && empty(
$object->id)) {
135 if (!(
$object->client > 0) || !$user->hasRight(
'societe',
'lire')) {
141if ($user->socid > 0) {
151$parameters = array(
'id' => $id,
'socid' => $id);
152$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
157if (empty($reshook)) {
163 if ($action ==
'setcustomeraccountancycode' && $user->hasRight(
'societe',
'creer')) {
170 $action =
'editcustomeraccountancycode';
175 if ($action ==
'setconditions' && $user->hasRight(
'societe',
'creer')) {
184 if ($action ==
'setmode' && $user->hasRight(
'societe',
'creer')) {
193 if ($action ==
'settransportmode' && $user->hasRight(
'societe',
'creer')) {
195 $result =
$object->setTransportMode(
GETPOST(
'transport_mode_id',
'alpha'));
202 if ($action ==
'setbankaccount' && $user->hasRight(
'societe',
'creer')) {
211 if ($action ==
'setshippingmethod' && $user->hasRight(
'societe',
'creer')) {
220 if ($action ==
'setassujtva' && $user->hasRight(
'societe',
'creer')) {
230 if ($action ==
'setprospectlevel' && $user->hasRight(
'societe',
'creer')) {
232 $object->fk_prospectlevel =
GETPOST(
'prospect_level_id',
'alpha');
240 if ($action ==
'setstcomm' && $user->hasRight(
'societe',
'creer')) {
252 if ($action ==
'setoutstanding_limit' && $user->hasRight(
'societe',
'creer')) {
262 if ($action ==
'setorder_min_amount' && $user->hasRight(
'societe',
'creer')) {
272 if ($action ==
'set_salesrepresentatives' && $user->hasRight(
'societe',
'creer')) {
277 if ($action ==
'update_extras' && $user->hasRight(
'societe',
'creer')) {
283 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
288 $result =
$object->insertExtraFields(
'COMPANY_MODIFY');
295 $action =
'edit_extras';
300 if ($action ==
'setwarehouse' && $user->hasRight(
'societe',
'creer')) {
310$contactstatic =
new Contact($db);
311$userstatic =
new User($db);
312$form =
new Form($db);
315$title = $langs->trans(
"ThirdParty").
" - ".$langs->trans(
'Customer');
317 $title =
$object->name.
" - ".$langs->trans(
'Customer');
320$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
327 print
dol_get_fiche_head($head,
'customer', $langs->trans(
"ThirdParty"), -1,
'company');
329 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
331 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
333 print
'<div class="fichecenter"><div class="fichehalfleft">';
335 print
'<div class="underbanner clearboth"></div>';
336 print
'<table class="border centpercent tableforfield">';
339 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
345 print
'<tr><td>'.$langs->trans(
"Prefix").
'</td><td>';
351 $langs->load(
"compta");
354 print $langs->trans(
'CustomerCode').
'</td><td>';
356 $tmpcheck =
$object->check_codeclient();
357 if ($tmpcheck != 0 && $tmpcheck != -5) {
358 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
364 print $form->editfieldkey(
"CustomerAccountancyCode",
'customeraccountancycode',
$object->code_compta_client,
$object, $user->hasRight(
'societe',
'creer'));
366 print $form->editfieldval(
"CustomerAccountancyCode",
'customeraccountancycode',
$object->code_compta_client,
$object, $user->hasRight(
'societe',
'creer'));
387 if ($mysoc->country_code ==
'ES') {
389 if ($mysoc->localtax1_assuj ==
"1") {
390 print
'<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
394 if ($mysoc->localtax1_assuj ==
"1") {
395 print
'<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
402 print
'<tr><td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
407 $langs->load(
'bills');
409 print
'<table width="100%" class="nobordernopadding"><tr><td>';
410 print $langs->trans(
'PaymentConditions');
412 if (($action !=
'editconditions') && $user->hasRight(
'societe',
'creer')) {
413 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>';
415 print
'</tr></table>';
417 if ($action ==
'editconditions') {
418 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->cond_reglement_id,
'cond_reglement_id', 1,
'', 1,
$object->deposit_percent);
420 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->cond_reglement_id,
'none', 0,
'', 1,
$object->deposit_percent);
426 print
'<tr><td class="nowrap">';
427 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
428 print $langs->trans(
'PaymentMode');
430 if (($action !=
'editmode') && $user->hasRight(
'societe',
'creer')) {
431 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>';
433 print
'</tr></table>';
435 if ($action ==
'editmode') {
436 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
438 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->mode_reglement_id,
'none');
443 if (isModEnabled(
"bank")) {
445 print
'<tr><td class="nowrap">';
446 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
447 print $langs->trans(
'PaymentBankAccount');
449 if (($action !=
'editbankaccount') && $user->hasRight(
'societe',
'creer')) {
450 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>';
452 print
'</tr></table>';
454 if ($action ==
'editbankaccount') {
455 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->fk_account,
'fk_account', 1);
457 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->fk_account,
'none');
467 print
'<tr><td class="nowrap">';
468 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
469 print $langs->trans(
"CustomerRelativeDiscountShort");
470 print
'<td><td class="right">';
471 if ($user->hasRight(
'societe',
'creer') && !$user->socid > 0) {
472 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>';
474 print
'</td></tr></table>';
475 print
'</td><td>'.($object->remise_percent ?
'<a href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.
$object->id.
'">'.
$object->remise_percent.
'%</a>' :
'').
'</td>';
479 print
'<tr><td class="nowrap">';
480 print
'<table width="100%" class="nobordernopadding">';
481 print
'<tr><td class="nowrap">';
482 print $langs->trans(
"CustomerAbsoluteDiscountShort");
483 print
'<td><td class="right">';
484 if ($user->hasRight(
'societe',
'creer') && !$user->socid > 0) {
485 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>';
487 print
'</td></tr></table>';
490 $amount_discount =
$object->getAvailableDiscounts();
491 if ($amount_discount < 0) {
494 if ($amount_discount > 0) {
495 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>';
504 print
'<tr class="nowrap">';
506 print $form->editfieldkey(
"OutstandingBill",
'outstanding_limit',
$object->outstanding_limit,
$object, $user->hasRight(
'societe',
'creer'));
508 $limit_field_type = (
getDolGlobalString(
'MAIN_USE_JQUERY_JEDITABLE')) ?
'numeric' :
'amount';
509 print $form->editfieldval(
"OutstandingBill",
'outstanding_limit',
$object->outstanding_limit,
$object, $user->hasRight(
'societe',
'creer'), $limit_field_type, (
$object->outstanding_limit !=
'' ?
price(
$object->outstanding_limit) :
''));
516 print
'<!-- Minimum amount for orders -->'.
"\n";
517 print
'<tr class="nowrap">';
519 print $form->editfieldkey(
"OrderMinAmount",
'order_min_amount',
$object->order_min_amount,
$object, $user->hasRight(
'societe',
'creer'));
521 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) :
''));
530 print
'<tr><td class="nowrap">';
531 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
532 print $langs->trans(
"PriceLevel");
533 print
'<td><td class="right">';
534 if ($user->hasRight(
'societe',
'creer')) {
535 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/multiprix.php?id='.
$object->id.
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
537 print
'</td></tr></table>';
540 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
550 $langs->load(
'stocks');
551 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
553 print
'<tr class="nowrap">';
555 print $form->editfieldkey(
"Warehouse",
'warehouse',
'',
$object, $user->hasRight(
'societe',
'creer'));
557 if ($action ==
'editwarehouse') {
558 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'fk_warehouse', 1);
560 if (
$object->fk_warehouse > 0) {
561 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
563 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'none');
571 print
'<tr><td class="nowrap">';
572 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
573 print $langs->trans(
'SendingMethod');
575 if (($action !=
'editshipping') && $user->hasRight(
'societe',
'creer')) {
576 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>';
578 print
'</tr></table>';
580 if ($action ==
'editshipping') {
581 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->shipping_method_id,
'shipping_method_id', 1);
583 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->shipping_method_id,
'none');
589 if (isModEnabled(
'intracommreport')) {
591 print
'<tr><td class="nowrap">';
592 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
593 print $langs->trans(
'IntracommReportTransportMode');
595 if (($action !=
'edittransportmode') && $user->hasRight(
'societe',
'creer')) {
596 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>';
598 print
'</tr></table>';
600 if ($action ==
'edittransportmode') {
601 $form->formSelectTransportMode($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (!empty(
$object->transport_mode_id) ?
$object->transport_mode_id :
''),
'transport_mode_id', 1);
603 $form->formSelectTransportMode($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (!empty(
$object->transport_mode_id) ?
$object->transport_mode_id :
''),
'none');
610 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
611 $langs->load(
"categories");
612 print
'<tr><td>'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
614 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
619 $parameters = array(
'socid'=>
$object->id);
620 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
623 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
626 if (isModEnabled(
'member')) {
627 $langs->load(
"members");
628 $langs->load(
"users");
630 print
'<tr><td class="titlefield">'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
633 $result = $adh->fetch(
'',
'',
$object->id);
635 $adh->ref = $adh->getFullName($langs);
636 print $adh->getNomUrl(-1);
638 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
646 print
'</div><div class="fichehalfright">';
650 print
'<div class="underbanner clearboth"></div>';
651 print
'<table class="border centpercent tableforfield">';
654 print
'<tr><td class="titlefield nowrap">';
655 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
656 print $langs->trans(
'ProspectLevel');
658 if ($action !=
'editlevel' && $user->hasRight(
'societe',
'creer')) {
659 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>';
661 print
'</tr></table>';
663 if ($action ==
'editlevel') {
664 $formcompany->form_prospect_level($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->fk_prospectlevel,
'prospect_level_id', 1);
666 print
$object->getLibProspLevel();
672 $object->loadCacheOfProspStatus();
673 print
'<tr><td>'.$langs->trans(
"StatusProsp").
'</td><td>'.
$object->getLibProspCommStatut(4,
$object->cacheprospectstatus[
$object->stcomm_id][
'label']);
674 print
' ';
675 print
'<div class="floatright">';
676 foreach (
$object->cacheprospectstatus as $key => $val) {
677 $titlealt =
'default';
678 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) {
679 $titlealt = $val[
'label'];
681 if (
$object->stcomm_id != $val[
'id']) {
682 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>';
685 print
'</div></td></tr>';
690 print
'<div class="underbanner underbanner-before-box clearboth"></div><br>';
699 $boxstat .=
'<div class="box divboxtable box-halfright">';
700 $boxstat .=
'<table summary="'.dol_escape_htmltag($langs->trans(
"DolibarrStateBoard")).
'" class="border boxtable boxtablenobottom boxtablenotop boxtablenomarginbottom centpercent">';
701 $boxstat .=
'<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
703 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
705 $tmp =
$object->getOutstandingProposals();
706 $outstandingOpened = $tmp[
'opened'];
707 $outstandingTotal = $tmp[
'total_ht'];
708 $outstandingTotalIncTax = $tmp[
'total_ttc'];
709 $text = $langs->trans(
"OverAllProposals");
710 $link = DOL_URL_ROOT.
'/comm/propal/list.php?socid='.
$object->id;
713 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
715 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
716 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
717 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
718 $boxstat .=
'</div>';
724 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
726 $tmp =
$object->getOutstandingOrders();
727 $outstandingOpened = $tmp[
'opened'];
728 $outstandingTotal = $tmp[
'total_ht'];
729 $outstandingTotalIncTax = $tmp[
'total_ttc'];
730 $text = $langs->trans(
"OverAllOrders");
731 $link = DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->id;
734 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
736 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
737 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
738 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
739 $boxstat .=
'</div>';
745 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
747 $tmp =
$object->getOutstandingBills(
'customer', 0);
748 $outstandingOpened = $tmp[
'opened'];
749 $outstandingTotal = $tmp[
'total_ht'];
750 $outstandingTotalIncTax = $tmp[
'total_ttc'];
752 $text = $langs->trans(
"OverAllInvoices");
753 $link = DOL_URL_ROOT.
'/compta/facture/list.php?socid='.
$object->id;
756 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
758 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
759 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
760 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
761 $boxstat .=
'</div>';
768 if (
$object->outstanding_limit !=
'' &&
$object->outstanding_limit < $outstandingOpened) {
769 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
771 $text = $langs->trans(
"CurrentOutstandingBill");
772 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.
$object->id;
775 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
777 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
778 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
779 $boxstat .=
'<span class="boxstatsindicator'.($outstandingOpened > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.
'</span>';
780 $boxstat .=
'</div>';
785 $tmp =
$object->getOutstandingBills(
'customer', 1);
786 $outstandingOpenedLate = $tmp[
'opened'];
787 if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
789 if (
$object->outstanding_limit !=
'' &&
$object->outstanding_limit < $outstandingOpenedLate) {
790 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
792 $text = $langs->trans(
"CurrentOutstandingBillLate");
793 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.
$object->id;
796 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
798 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
799 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
800 $boxstat .=
'<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.
'</span>';
801 $boxstat .=
'</div>';
808 $parameters = array();
809 $reshook = $hookmanager->executeHooks(
'addMoreBoxStatsCustomer', $parameters,
$object, $action);
810 if (empty($reshook)) {
811 $boxstat .= $hookmanager->resPrint;
814 $boxstat .=
'</td></tr>';
815 $boxstat .=
'</table>';
816 $boxstat .=
'</div>';
824 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
825 $langs->load(
"propal");
827 $sql =
"SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
828 $sql .=
", p.total_tva";
829 $sql .=
", p.total_ttc";
830 $sql .=
", p.ref, p.ref_client, p.remise";
831 $sql .=
", p.datep as dp, p.fin_validite as date_limit, p.entity";
832 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"propal as p, ".MAIN_DB_PREFIX.
"c_propalst as c";
833 $sql .=
" WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
834 $sql .=
" AND s.rowid = ".((int)
$object->id);
835 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
836 $sql .=
" ORDER BY p.datep DESC";
838 $resql = $db->query($sql);
840 $propal_static =
new Propal($db);
842 $num = $db->num_rows($resql);
844 print
'<div class="div-table-responsive-no-min">';
845 print
'<table class="noborder centpercent lastrecordtable">';
847 print
'<tr class="liste_titre">';
848 print
'<td colspan="4"><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>';
849 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>';
850 print
'</tr></table></td>';
855 while ($i < $num && $i < $MAXLIST) {
856 $objp = $db->fetch_object($resql);
858 print
'<tr class="oddeven">';
859 print
'<td class="nowraponall">';
860 $propal_static->id = $objp->propalid;
861 $propal_static->ref = $objp->ref;
862 $propal_static->ref_client = $objp->ref_client;
863 $propal_static->ref_customer = $objp->ref_client;
864 $propal_static->total_ht = $objp->total_ht;
865 $propal_static->total_tva = $objp->total_tva;
866 $propal_static->total_ttc = $objp->total_ttc;
867 print $propal_static->getNomUrl(1);
872 if (!empty($filedir)) {
875 if (is_array($file_list) && !empty($file_list)) {
879 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
880 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
887 if (!empty($sortfield) && !empty($sortorder)) {
892 print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0);
898 if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
899 print
" ".img_warning();
901 print
'</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
902 print
'<td class="right nowraponall">'.price($objp->total_ht).
'</td>';
903 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).
'</td></tr>';
920 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
923 $sql =
"SELECT s.nom, s.rowid";
924 $sql .=
", c.rowid as cid, c.entity, c.total_ht";
925 $sql .=
", c.total_tva";
926 $sql .=
", c.total_ttc";
927 $sql .=
", c.ref, c.ref_client, c.fk_statut, c.facture";
928 $sql .=
", c.date_commande as dc";
929 $sql .=
", c.facture as billed";
930 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"commande as c";
931 $sql .=
" WHERE c.fk_soc = s.rowid ";
932 $sql .=
" AND s.rowid = ".((int)
$object->id);
933 $sql .=
" AND c.entity IN (".getEntity(
'commande').
')';
934 $sql .=
" ORDER BY c.date_commande DESC";
936 $resql = $db->query($sql);
938 $commande_static =
new Commande($db);
940 $num = $db->num_rows($resql);
943 $sql2 =
'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
944 $sql2 .=
' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
945 $sql2 .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
946 $sql2 .=
', '.MAIN_DB_PREFIX.
'commande as c';
947 $sql2 .=
' WHERE c.fk_soc = s.rowid';
948 $sql2 .=
' AND s.rowid = '.((int)
$object->id);
950 $sql2 .=
" AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
952 $resql2 = $db->query($sql2);
953 $orders2invoice = $db->num_rows($resql2);
956 print
'<div class="div-table-responsive-no-min">';
957 print
'<table class="noborder centpercent lastrecordtable">';
959 print
'<tr class="liste_titre">';
960 print
'<td colspan="4"><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>';
961 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>';
962 print
'</tr></table></td>';
967 while ($i < $num && $i < $MAXLIST) {
968 $objp = $db->fetch_object($resql);
970 $commande_static->id = $objp->cid;
971 $commande_static->ref = $objp->ref;
972 $commande_static->ref_client = $objp->ref_client;
973 $commande_static->total_ht = $objp->total_ht;
974 $commande_static->total_tva = $objp->total_tva;
975 $commande_static->total_ttc = $objp->total_ttc;
976 $commande_static->billed = $objp->billed;
978 print
'<tr class="oddeven">';
979 print
'<td class="nowraponall">';
980 print $commande_static->getNomUrl(1);
982 $filedir = $conf->commande->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
984 if (!empty($filedir)) {
987 if (is_array($file_list) && !empty($file_list)) {
991 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
992 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
999 if (!empty($sortfield) && !empty($sortorder)) {
1004 print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param);
1012 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc),
'day').
"</td>\n";
1013 print
'<td class="right nowraponall">'.price($objp->total_ht).
'</td>';
1014 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).
'</td></tr>';
1031 if (isModEnabled(
"shipping") && $user->hasRight(
'expedition',
'lire')) {
1032 $sql =
'SELECT e.rowid as id';
1033 $sql .=
', e.ref, e.entity';
1034 $sql .=
', e.date_creation';
1035 $sql .=
', e.fk_statut as statut';
1037 $sql .=
', s.rowid as socid';
1038 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"expedition as e";
1039 $sql .=
" WHERE e.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1040 $sql .=
" AND e.entity IN (".getEntity(
'expedition').
")";
1041 $sql .=
' GROUP BY e.rowid';
1042 $sql .=
', e.ref, e.entity';
1043 $sql .=
', e.date_creation';
1044 $sql .=
', e.fk_statut';
1046 $sql .=
', s.rowid';
1047 $sql .=
" ORDER BY e.date_creation DESC";
1049 $resql = $db->query($sql);
1053 $num = $db->num_rows($resql);
1055 print
'<div class="div-table-responsive-no-min">';
1056 print
'<table class="noborder centpercent lastrecordtable">';
1058 print
'<tr class="liste_titre">';
1059 print
'<td colspan="4"><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>';
1060 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>';
1061 print
'</tr></table></td>';
1066 while ($i < $num && $i < $MAXLIST) {
1067 $objp = $db->fetch_object($resql);
1069 $sendingstatic->id = $objp->id;
1070 $sendingstatic->ref = $objp->ref;
1072 print
'<tr class="oddeven">';
1073 print
'<td class="nowraponall">';
1074 print $sendingstatic->getNomUrl(1);
1076 $filedir = $conf->expedition->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1078 if (!empty($filedir)) {
1081 if (is_array($file_list) && !empty($file_list)) {
1085 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1086 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1093 if (!empty($sortfield) && !empty($sortorder)) {
1098 print $formfile->showPreview($file_list, $sendingstatic->table_element, $relativepath, 0, $param);
1105 if ($objp->date_creation > 0) {
1106 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation),
'day').
'</td>';
1108 print
'<td class="right"><b>!!!</b></td>';
1111 print
'<td class="nowrap right centpercent">'.$sendingstatic->LibStatut($objp->statut, 5).
'</td>';
1129 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
1130 $sql =
"SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, 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,";
1131 $sql .=
" c.last_main_doc, c.model_pdf";
1132 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"contrat as c";
1133 $sql .=
" WHERE c.fk_soc = s.rowid ";
1134 $sql .=
" AND s.rowid = ".((int)
$object->id);
1135 $sql .=
" AND c.entity IN (".getEntity(
'contract').
")";
1136 $sql .=
" ORDER BY c.datec DESC";
1138 $resql = $db->query($sql);
1142 $num = $db->num_rows($resql);
1144 print
'<div class="div-table-responsive-no-min">';
1145 print
'<table class="noborder centpercent lastrecordtable">';
1147 print
'<tr class="liste_titre">';
1148 print
'<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
"LastContracts", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td>';
1149 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>';
1151 print
'</tr></table></td>';
1156 while ($i < $num && $i < $MAXLIST) {
1157 $objp = $db->fetch_object($resql);
1159 $contrat->id = $objp->id;
1160 $contrat->ref = $objp->ref ? $objp->ref : $objp->id;
1161 $contrat->ref_customer = $objp->refcus;
1162 $contrat->ref_supplier = $objp->refsup;
1163 $contrat->statut = $objp->contract_status;
1164 $contrat->last_main_doc = $objp->last_main_doc;
1165 $contrat->model_pdf = $objp->model_pdf;
1166 $contrat->fetch_lines();
1169 foreach ($contrat->lines as $line) {
1170 if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
1171 if (((!empty($line->date_end) ? $line->date_end : 0) + $conf->contrat->services->expires->warning_delay) < $now) {
1177 print
'<tr class="oddeven">';
1178 print
'<td class="nowraponall">';
1179 print $contrat->getNomUrl(1, 12);
1180 if (!empty($contrat->model_pdf)) {
1182 $filedir = $conf->contrat->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1184 if (!empty($filedir)) {
1187 if (is_array($file_list) && !empty($file_list)) {
1191 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1192 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1199 if (!empty($sortfield) && !empty($sortorder)) {
1204 print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
1213 print
'<td class="nowrap">'.dol_trunc($objp->refsup, 12).
"</td>\n";
1215 print
'<td class="right" width="80px"><span title="'.$langs->trans(
"DateContract").
'">'.
dol_print_date($db->jdate($objp->dcon),
'day').
"</span></td>\n";
1216 print
'<td width="20"> </td>';
1217 print
'<td class="nowraponall right">';
1218 print $contrat->getLibStatut(4);
1237 if (isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
1238 $sql =
"SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity";
1239 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"fichinter as f";
1240 $sql .=
" WHERE f.fk_soc = s.rowid";
1241 $sql .=
" AND s.rowid = ".((int)
$object->id);
1242 $sql .=
" AND f.entity IN (".getEntity(
'intervention').
")";
1243 $sql .=
" ORDER BY f.tms DESC";
1245 $resql = $db->query($sql);
1249 $num = $db->num_rows($resql);
1251 print
'<div class="div-table-responsive-no-min">';
1252 print
'<table class="noborder centpercent lastrecordtable">';
1254 print
'<tr class="liste_titre">';
1255 print
'<td colspan="3"><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>';
1256 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>';
1257 print
'</tr></table></td>';
1262 while ($i < $num && $i < $MAXLIST) {
1263 $objp = $db->fetch_object($resql);
1265 $fichinter_static->id = $objp->id;
1266 $fichinter_static->ref = $objp->ref;
1267 $fichinter_static->statut = $objp->fk_statut;
1269 print
'<tr class="oddeven">';
1270 print
'<td class="nowraponall">';
1271 print $fichinter_static->getNomUrl(1);
1273 $filedir = $conf->ficheinter->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1275 if (!empty($filedir)) {
1278 if (is_array($file_list) && !empty($file_list)) {
1282 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1283 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1290 if (!empty($sortfield) && !empty($sortorder)) {
1295 print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0);
1303 print
'<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).
'</td>'.
"\n";
1304 print
'<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).
'</td>'.
"\n";
1323 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1324 $sql =
'SELECT f.rowid as id, f.titre as ref';
1325 $sql .=
', f.total_ht';
1326 $sql .=
', f.total_tva';
1327 $sql .=
', f.total_ttc';
1328 $sql .=
', f.datec as dc';
1329 $sql .=
', f.date_last_gen, f.date_when';
1330 $sql .=
', f.frequency';
1331 $sql .=
', f.unit_frequency';
1332 $sql .=
', f.suspended as suspended';
1333 $sql .=
', s.nom, s.rowid as socid';
1334 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_rec as f";
1335 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1336 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1337 $sql .=
' GROUP BY f.rowid, f.titre, f.total_ht, f.total_tva, f.total_ttc,';
1338 $sql .=
' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
1339 $sql .=
' f.suspended, f.date_when,';
1340 $sql .=
' s.nom, s.rowid';
1341 $sql .=
" ORDER BY f.date_last_gen, f.datec DESC";
1343 $resql = $db->query($sql);
1347 $num = $db->num_rows($resql);
1349 print
'<div class="div-table-responsive-no-min">';
1350 print
'<table class="noborder centpercent lastrecordtable">';
1351 print
'<tr class="liste_titre">';
1356 print
'<td colspan="'.$colspan.
'">';
1357 print
'<table class="centpercent nobordernopadding"><tr>';
1358 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>';
1359 print
'</tr></table>';
1365 while ($i < $num && $i < $MAXLIST) {
1366 $objp = $db->fetch_object($resql);
1368 $invoicetemplate->id = $objp->id;
1369 $invoicetemplate->ref = $objp->ref;
1370 $invoicetemplate->suspended = $objp->suspended;
1371 $invoicetemplate->frequency = $objp->frequency;
1372 $invoicetemplate->unit_frequency = $objp->unit_frequency;
1373 $invoicetemplate->total_ht = $objp->total_ht;
1374 $invoicetemplate->total_tva = $objp->total_tva;
1375 $invoicetemplate->total_ttc = $objp->total_ttc;
1376 $invoicetemplate->date_last_gen = $objp->date_last_gen;
1377 $invoicetemplate->date_when = $objp->date_when;
1379 print
'<tr class="oddeven">';
1380 print
'<td class="tdoverflowmax250">';
1381 print $invoicetemplate->getNomUrl(1);
1384 if ($objp->frequency && $objp->date_last_gen > 0) {
1385 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen),
'day').
'</td>';
1387 if ($objp->dc > 0) {
1388 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc),
'day').
'</td>';
1390 print
'<td class="right"><b>!!!</b></td>';
1393 print
'<td class="right nowraponall">';
1394 print
price($objp->total_ht);
1398 print
'<td class="right nowraponall">';
1399 print
price($objp->total_ttc);
1403 print
'<td class="nowrap right" style="min-width: 60px">';
1404 print $langs->trans(
'FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).
' - ';
1405 print($invoicetemplate->LibStatut($invoicetemplate->frequency, $invoicetemplate->suspended, 5, 0));
1424 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1425 $sql =
'SELECT f.rowid as facid, f.ref, f.type';
1426 $sql .=
', f.total_ht';
1427 $sql .=
', f.total_tva';
1428 $sql .=
', f.total_ttc';
1429 $sql .=
', f.entity';
1430 $sql .=
', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status';
1431 $sql .=
', s.nom, s.rowid as socid';
1432 $sql .=
', SUM(pf.amount) as am';
1433 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture as f";
1434 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiement_facture as pf ON f.rowid=pf.fk_facture';
1435 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1436 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1437 $sql .=
' GROUP BY f.rowid, f.ref, f.type, f.total_ht, f.total_tva, f.total_ttc,';
1438 $sql .=
' f.entity, f.datef, f.date_lim_reglement, f.datec, f.paye, f.fk_statut,';
1439 $sql .=
' s.nom, s.rowid';
1440 $sql .=
" ORDER BY f.datef DESC, f.datec DESC";
1442 $resql = $db->query($sql);
1444 $facturestatic =
new Facture($db);
1446 $num = $db->num_rows($resql);
1448 print
'<div class="div-table-responsive-no-min">';
1449 print
'<table class="noborder centpercent lastrecordtable">';
1450 print
'<tr class="liste_titre">';
1455 print
'<td colspan="'.$colspan.
'">';
1456 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>';
1457 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>';
1458 print
'</tr></table>';
1464 while ($i < $num && $i < $MAXLIST) {
1465 $objp = $db->fetch_object($resql);
1467 $facturestatic->id = $objp->facid;
1468 $facturestatic->ref = $objp->ref;
1469 $facturestatic->type = $objp->type;
1470 $facturestatic->total_ht = $objp->total_ht;
1471 $facturestatic->total_tva = $objp->total_tva;
1472 $facturestatic->total_ttc = $objp->total_ttc;
1473 $facturestatic->statut = $objp->status;
1474 $facturestatic->status = $objp->status;
1475 $facturestatic->paye = $objp->paye;
1476 $facturestatic->alreadypaid = $objp->am;
1477 $facturestatic->totalpaid = $objp->am;
1478 $facturestatic->date = $db->jdate($objp->df);
1479 $facturestatic->date_lim_reglement = $db->jdate($objp->dl);
1481 print
'<tr class="oddeven">';
1482 print
'<td class="nowraponall">';
1483 print $facturestatic->getNomUrl(1);
1485 $filedir = $conf->facture->multidir_output[$objp->entity].
'/'.
dol_sanitizeFileName($objp->ref);
1487 if (!empty($filedir)) {
1490 if (is_array($file_list) && !empty($file_list)) {
1494 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1495 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1502 if (!empty($sortfield) && !empty($sortorder)) {
1507 print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0);
1514 if ($objp->df > 0) {
1515 print
'<td width="80px" title="'.dol_escape_htmltag($langs->trans(
'DateInvoice')).
'">'.
dol_print_date($db->jdate($objp->df),
'day').
'</td>';
1517 print
'<td><b>!!!</b></td>';
1519 if ($objp->dl > 0) {
1520 print
'<td width="80px" title="'.dol_escape_htmltag($langs->trans(
'DateMaxPayment')).
'">'.
dol_print_date($db->jdate($objp->dl),
'day').
'</td>';
1522 print
'<td><b>!!!</b></td>';
1524 print
'<td class="right nowraponall">';
1525 print
price($objp->total_ht);
1529 print
'<td class="right nowraponall">';
1530 print
price($objp->total_ttc);
1534 print
'<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->status, 5, $objp->am)).
'</td>';
1550 $parameters = array();
1551 $reshook = $hookmanager->executeHooks(
'addMoreRecentObjects', $parameters,
$object, $action);
1555 print $hookmanager->resPrint;
1558 print
'</div></div>';
1559 print
'<div class="clearboth"></div>';
1567 print
'<div class="tabsAction">';
1569 $parameters = array();
1570 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1572 if (empty($reshook)) {
1574 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyIsClosed")).
'" href="#">'.$langs->trans(
"ThirdPartyIsClosed").
'</a></div>';
1577 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'creer') &&
$object->status == 1) {
1578 $langs->load(
"propal");
1579 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>';
1582 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'creer') &&
$object->status == 1) {
1583 $langs->load(
"orders");
1584 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>';
1587 if ($user->hasRight(
'contrat',
'creer') &&
$object->status == 1) {
1588 $langs->load(
"contracts");
1589 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>';
1592 if (isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'creer') &&
$object->status == 1) {
1593 $langs->load(
"fichinter");
1594 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>';
1598 if ($user->socid == 0) {
1599 if (isModEnabled(
'deplacement') &&
$object->status == 1) {
1600 $langs->load(
"trips");
1601 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>';
1604 if (isModEnabled(
'invoice') &&
$object->status == 1) {
1605 if (!$user->hasRight(
'facture',
'creer')) {
1606 $langs->load(
"bills");
1607 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1609 $langs->loadLangs(array(
"orders",
"bills"));
1611 if (isModEnabled(
'order')) {
1613 if (!empty($orders2invoice) && $orders2invoice > 0) {
1614 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>';
1616 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NoOrdersToInvoice")).
'" href="#">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1619 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1624 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>';
1626 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1634 if ($user->hasRight(
'agenda',
'myactions',
'create')) {
1635 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>';
1637 print
'<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddAction").
'</a></div>';
1659 $langs->load(
"errors");
1660 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()
Empty header.
Class to manage members of a foundation.
Class to manage customers or prospects.
Class to manage customers orders.
Class to manage contracts.
Class to manage shipments.
Class to manage invoices.
Class to manage invoice templates.
Class to manage interventions.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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...
getDolGlobalString($key, $default='')
Return 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.