37require
'../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
50require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
55require_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
61 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
64 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
67 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
70 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
73 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
76 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
79 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
80 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
84$langs->loadLangs(array(
'companies',
'banks',
'commercial'));
87 $langs->load(
"contracts");
90 $langs->load(
"orders");
93 $langs->load(
"sendings");
96 $langs->load(
"bills");
99 $langs->load(
"projects");
102 $langs->load(
"interventions");
105 $langs->load(
"mails");
108$action =
GETPOST(
'action',
'aZ09');
113$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
114$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
116if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
120$offset = $limit * $page;
121$pageprev = $page - 1;
122$pagenext = $page + 1;
129$cancel =
GETPOST(
'cancel',
'alpha');
135$extrafields->fetch_name_optionals_label(
$object->table_element);
138$hookmanager->initHooks(array(
'thirdpartycomm',
'globalcard'));
142if ($id > 0 && empty(
$object->id)) {
150 if (!(
$object->client > 0) || !$user->hasRight(
'societe',
'lire')) {
156if ($user->socid > 0) {
161$permissiontoadd = $user->hasRight(
'societe',
'creer');
162$permissiontoeditextra = $permissiontoadd;
163if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
165 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
174$parameters = array(
'id' => $id,
'socid' => $id);
175$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
180if (empty($reshook)) {
186 if ($action ==
'setcustomeraccountancycodegeneral' && $permissiontoadd) {
188 $object->accountancy_code_customer_general =
GETPOST(
"customeraccountancycodegeneral");
196 if ($action ==
'setcustomeraccountancycode' && $permissiontoadd) {
203 $action =
'editcustomeraccountancycode';
208 if ($action ==
'setconditions' && $permissiontoadd) {
217 if ($action ==
'setmode' && $permissiontoadd) {
226 if ($action ==
'settransportmode' && $permissiontoadd) {
235 if ($action ==
'setbankaccount' && $permissiontoadd) {
244 if ($action ==
'setshippingmethod' && $permissiontoadd) {
253 if ($action ==
'setassujtva' && $permissiontoadd) {
263 if ($action ==
'setprospectlevel' && $permissiontoadd) {
265 $object->fk_prospectlevel =
GETPOST(
'prospect_level_id',
'alpha');
273 if ($action ==
'setstcomm' && $permissiontoadd) {
285 if ($action ==
'setoutstanding_limit' && $permissiontoadd) {
295 if ($action ==
'setorder_min_amount' && $permissiontoadd) {
305 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
310 if ($action ==
'update_extras' && $permissiontoeditextra) {
315 $attribute_name =
GETPOST(
'attribute',
'aZ09');
318 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
324 $result =
$object->updateExtraField($attribute_name,
'COMPANY_MODIFY');
332 $action =
'edit_extras';
337 if ($action ==
'setwarehouse' && $permissiontoadd) {
353$title = $langs->trans(
"ThirdParty").
" - ".$langs->trans(
'Customer');
355 $title =
$object->name.
" - ".$langs->trans(
'Customer');
358$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
365 print
dol_get_fiche_head($head,
'customer', $langs->trans(
"ThirdParty"), -1,
'company');
367 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
369 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
371 print
'<div class="fichecenter"><div class="fichehalfleft">';
373 print
'<div class="underbanner clearboth"></div>';
374 print
'<table class="border centpercent tableforfield">';
377 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
382 $langs->loadLangs(array(
"compta",
"accountancy"));
385 print $langs->trans(
'CustomerCode').
'</td><td>';
387 $tmpcheck =
$object->check_codeclient();
388 if ($tmpcheck != 0 && $tmpcheck != -5) {
389 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
398 print $form->editfieldkey(
"CustomerAccountancyCodeGeneral",
'customeraccountancycodegeneral',
length_accountg(
$object->accountancy_code_customer_general), $object, $permissiontoadd);
400 if ($action ==
'editcustomeraccountancycodegeneral' && $permissiontoadd) {
401 print $formaccounting->formAccountingAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->accountancy_code_customer_general,
'customeraccountancycodegeneral', 0, 1,
'', 1);
403 if (
$object->accountancy_code_customer_general > 0) {
405 $accountingaccount->fetch(0,
$object->accountancy_code_customer_general, 1);
407 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
410 if (
$object->accountancy_code_customer_general > 0) {
413 $accountingAccountByDefault =
'<span class="opacitymedium">' . $langs->trans(
"AccountingAccountByDefaultShort") .
": " .
length_accountg(
getDolGlobalString(
'ACCOUNTING_ACCOUNT_CUSTOMER')) .
'</span>';
414 print $accountingAccountByDefault;
423 print $form->editfieldkey(
"CustomerAccountancyCode",
'customeraccountancycode',
$object->code_compta_client, $object, $permissiontoadd);
425 print $form->editfieldval(
"CustomerAccountancyCode",
'customeraccountancycode',
$object->code_compta_client, $object, $permissiontoadd);
445 if (
$mysoc->country_code ==
'ES') {
447 if (
$mysoc->localtax1_assuj ==
"1") {
448 print
'<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
452 if (
$mysoc->localtax1_assuj ==
"1") {
453 print
'<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
460 print
'<tr><td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
465 $langs->load(
'bills');
467 print
'<table width="100%" class="nobordernopadding"><tr><td>';
468 print $langs->trans(
'PaymentConditions');
470 if (($action !=
'editconditions') && $permissiontoadd) {
471 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>';
473 print
'</tr></table>';
475 if ($action ==
'editconditions') {
476 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->cond_reglement_id,
'cond_reglement_id', 1,
'', 1,
$object->deposit_percent);
478 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->cond_reglement_id,
'none', 0,
'', 1,
$object->deposit_percent);
484 print
'<tr><td class="nowrap">';
485 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
486 print $langs->trans(
'PaymentMode');
488 if (($action !=
'editmode') && $permissiontoadd) {
489 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>';
491 print
'</tr></table>';
493 if ($action ==
'editmode') {
494 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
496 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->mode_reglement_id,
'none');
503 print
'<tr><td class="nowrap">';
504 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
505 print $langs->trans(
'PaymentBankAccount');
507 if (($action !=
'editbankaccount') && $permissiontoadd) {
508 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>';
510 print
'</tr></table>';
512 if ($action ==
'editbankaccount') {
513 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->fk_account,
'fk_account', 1);
515 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->fk_account,
'none');
525 print
'<tr><td class="nowrap">';
526 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
527 print $langs->trans(
"CustomerRelativeDiscountShort");
528 print
'<td><td class="right">';
529 if ($permissiontoadd && !$user->socid > 0) {
530 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>';
532 print
'</td></tr></table>';
533 print
'</td><td>'.($object->remise_percent ?
'<a href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.
$object->id.
'">'.
$object->remise_percent.
'%</a>' :
'').
'</td>';
537 print
'<tr><td class="nowrap">';
538 print
'<table width="100%" class="nobordernopadding">';
539 print
'<tr><td class="nowrap">';
540 print $langs->trans(
"CustomerAbsoluteDiscountShort");
541 print
'<td><td class="right">';
542 if ($permissiontoadd && !$user->socid > 0) {
543 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>';
545 print
'</td></tr></table>';
548 $amount_discount =
$object->getAvailableDiscounts();
549 if ($amount_discount < 0) {
552 if ($amount_discount > 0) {
553 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>';
560 $limit_field_type =
'';
563 print
'<tr class="nowrap">';
565 print $form->editfieldkey(
"OutstandingBill",
'outstanding_limit',
$object->outstanding_limit, $object, $permissiontoadd);
568 $limit_field_type =
'amount';
569 print $form->editfieldval(
"OutstandingBill",
'outstanding_limit',
$object->outstanding_limit, $object, $permissiontoadd, $limit_field_type, (
$object->outstanding_limit !=
'' ?
price(
$object->outstanding_limit) :
''));
576 print
'<!-- Minimum amount for orders -->'.
"\n";
577 print
'<tr class="nowrap">';
579 print $form->editfieldkey(
"OrderMinAmount",
'order_min_amount',
$object->order_min_amount, $object, $permissiontoadd);
581 print $form->editfieldval(
"OrderMinAmount",
'order_min_amount',
$object->order_min_amount, $object, $permissiontoadd, $limit_field_type, (
$object->order_min_amount !=
'' ?
price(
$object->order_min_amount) :
''));
590 print
'<tr><td class="nowrap">';
591 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
592 print $langs->trans(
"PriceLevel");
593 print
'<td><td class="right">';
594 if ($permissiontoadd) {
595 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/multiprix.php?id='.
$object->id.
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
597 print
'</td></tr></table>';
600 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
610 $langs->load(
'stocks');
611 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
613 print
'<tr class="nowrap">';
615 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $permissiontoadd);
617 if ($action ==
'editwarehouse') {
618 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
620 if (
$object->fk_warehouse > 0) {
621 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
623 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
631 print
'<tr><td class="nowrap">';
632 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
633 print $langs->trans(
'SendingMethod');
635 if (($action !=
'editshipping') && $permissiontoadd) {
636 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>';
638 print
'</tr></table>';
640 if ($action ==
'editshipping') {
641 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->shipping_method_id,
'shipping_method_id', 1);
643 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->shipping_method_id,
'none');
650 $langs->load(
"intracommreport");
653 print
'<tr><td class="nowrap">';
654 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
655 print $langs->trans(
'IntracommReportTransportMode');
657 if (($action !=
'edittransportmode') && $permissiontoadd) {
658 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>';
660 print
'</tr></table>';
662 if ($action ==
'edittransportmode') {
663 $form->formSelectTransportMode($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (!empty(
$object->transport_mode_id) ?
$object->transport_mode_id :
''),
'transport_mode_id', 1, 1);
665 $form->formSelectTransportMode($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (!empty(
$object->transport_mode_id) ?
$object->transport_mode_id :
''),
'none');
672 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
673 $langs->load(
"categories");
674 print
'<tr><td>'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
676 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
681 $parameters = array(
'socid' =>
$object->id);
682 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
685 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
689 $langs->load(
"members");
690 $langs->load(
"users");
692 print
'<tr><td class="titlefield">'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
695 $result = $adh->fetch(0,
'',
$object->id);
697 $adh->ref = $adh->getFullName($langs);
698 print $adh->getNomUrl(-1);
700 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
708 print
'</div><div class="fichehalfright">';
712 print
'<div class="underbanner clearboth"></div>';
713 print
'<table class="border centpercent tableforfield">';
716 print
'<tr><td class="titlefield nowrap">';
717 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
718 print $langs->trans(
'ProspectLevel');
720 if ($action !=
'editlevel' && $permissiontoadd) {
721 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>';
723 print
'</tr></table>';
725 if ($action ==
'editlevel') {
726 $formcompany->form_prospect_level($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
int)
$object->fk_prospectlevel,
'prospect_level_id', 1);
728 print
$object->getLibProspLevel();
734 $object->loadCacheOfProspStatus();
735 print
'<tr><td>'.$langs->trans(
"StatusProsp").
'</td><td>'.
$object->getLibProspCommStatut(4,
$object->cacheprospectstatus[
$object->stcomm_id][
'label']);
736 print
' ';
737 print
'<div class="floatright">';
738 foreach (
$object->cacheprospectstatus as $key => $val) {
739 $titlealt =
'default';
740 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) {
741 $titlealt = $val[
'label'];
743 if (
$object->stcomm_id != $val[
'id']) {
744 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>';
747 print
'</div></td></tr>';
752 print
'<div class="underbanner underbanner-before-box clearboth"></div><br>';
761 $boxstat .=
'<div class="box divboxtable box-halfright">';
762 $boxstat .=
'<table summary="'.dol_escape_htmltag($langs->trans(
"DolibarrStateBoard")).
'" class="border boxtable boxtablenobottom boxtablenotop boxtablenomarginbottom centpercent">';
763 $boxstat .=
'<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
765 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
767 $tmp =
$object->getOutstandingProposals();
768 $outstandingOpened = $tmp[
'opened'];
769 $outstandingTotal = $tmp[
'total_ht'];
770 $outstandingTotalIncTax = $tmp[
'total_ttc'];
771 $text = $langs->trans(
"OverAllProposals");
772 $link = DOL_URL_ROOT.
'/comm/propal/list.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">'.price($outstandingTotal, 1, $langs, 1, -1, -1,
$conf->currency).
'</span>';
780 $boxstat .=
'</div>';
786 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
788 $tmp =
$object->getOutstandingOrders();
789 $outstandingOpened = $tmp[
'opened'];
790 $outstandingTotal = $tmp[
'total_ht'];
791 $outstandingTotalIncTax = $tmp[
'total_ttc'];
792 $text = $langs->trans(
"OverAllOrders");
793 $link = DOL_URL_ROOT.
'/commande/list.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">'.price($outstandingTotal, 1, $langs, 1, -1, -1,
$conf->currency).
'</span>';
801 $boxstat .=
'</div>';
807 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
809 $tmp =
$object->getOutstandingBills(
'customer', 0);
810 $outstandingOpened = $tmp[
'opened'];
811 $outstandingTotal = $tmp[
'total_ht'];
812 $outstandingTotalIncTax = $tmp[
'total_ttc'];
814 $text = $langs->trans(
"OverAllInvoices");
815 $link = DOL_URL_ROOT.
'/compta/facture/list.php?socid='.
$object->id;
818 $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
820 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
821 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
822 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1,
$conf->currency).
'</span>';
823 $boxstat .=
'</div>';
830 if (
$object->outstanding_limit !=
'' &&
$object->outstanding_limit < $outstandingOpened) {
831 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
833 $text = $langs->trans(
"CurrentOutstandingBill");
835 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.
$object->id;
837 $boxstattmp =
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
838 $boxstattmp .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
839 $boxstattmp .=
'<span class="boxstatsindicator'.($outstandingOpened > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpened, 1, $langs, 1, -1, -1,
$conf->currency).$warn.
'</span>';
840 $boxstattmp .=
'</div>';
844 $boxstat .= $boxstattmp;
847 $tmp =
$object->getOutstandingBills(
'customer', 1);
848 $outstandingOpenedLate = $tmp[
'opened'];
849 if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
851 if (
$object->outstanding_limit !=
'' &&
$object->outstanding_limit < $outstandingOpenedLate) {
852 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
854 $text = $langs->trans(
"CurrentOutstandingBillLate");
856 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.
$object->id;
858 $boxstattmp =
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
859 $boxstattmp .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
860 $boxstattmp .=
'<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpenedLate, 1, $langs, 1, -1, -1,
$conf->currency).$warn.
'</span>';
861 $boxstattmp .=
'</div>';
865 $boxstat .= $boxstattmp;
871 if (
isModEnabled(
'margin') && $user->hasRight(
'margin',
'liretous')) {
874 $sql .=
" sum(d.total_ht) as selling_price,";
875 $sql .=
" sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,";
876 $sql .=
" sum(d.total_ht - (".$db->ifsql(
'f.type = '.
Facture::TYPE_CREDIT_NOTE,
'-1',
'1').
" * (d.buy_price_ht * d.qty * (d.situation_percent / 100)))) as marge";
877 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f,";
878 $sql .=
" ".MAIN_DB_PREFIX.
"facturedet as d";
879 $sql .=
" WHERE f.fk_soc = ".((int) $id);
880 $sql .=
" AND f.fk_statut > 0";
881 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
882 $sql .=
" AND d.fk_facture = f.rowid";
883 $sql .=
" AND d.buy_price_ht IS NOT NULL";
887 $sql .=
" AND d.buy_price_ht <> 0";
892 $resql =
$db->query($sql);
894 $obj =
$db->fetch_object($resql);
896 $marginTotal = $obj->marge;
900 $text = $langs->transnoentitiesnoconv(
"Margins");
902 $link = DOL_URL_ROOT.
'/margin/tabs/thirdpartyMargins.php?socid='.
$object->id;
904 $boxstattmp =
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
905 $boxstattmp .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
906 $boxstattmp .=
'<span class="boxstatsindicator">'.price($marginTotal, 1, $langs, 1, -1, -1,
$conf->currency).
'</span>';
907 $boxstattmp .=
'</div>';
911 $boxstat .= $boxstattmp;
916 $parameters = array();
917 $reshook = $hookmanager->executeHooks(
'addMoreBoxStatsCustomer', $parameters, $object, $action);
918 if (empty($reshook)) {
919 $boxstat .= $hookmanager->resPrint;
922 $boxstat .=
'</td></tr>';
923 $boxstat .=
'</table>';
924 $boxstat .=
'</div>';
933 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
935 $langs->load(
"propal");
937 $sql =
"SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_projet, p.fk_statut, p.total_ht";
938 $sql .=
", p.total_tva";
939 $sql .=
", p.total_ttc";
940 $sql .=
", p.ref, p.ref_client, p.remise";
941 $sql .=
", p.datep as dp, p.fin_validite as date_limit, p.entity";
942 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"propal as p, ".MAIN_DB_PREFIX.
"c_propalst as c";
943 $sql .=
" WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
944 $sql .=
" AND s.rowid = ".((int)
$object->id);
945 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
946 $parameters = array();
947 $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $propal_static);
948 $sql .= $hookmanager->resPrint;
949 $sql .=
" ORDER BY p.datep DESC";
951 $resql =
$db->query($sql);
953 $num =
$db->num_rows($resql);
955 print
'<div class="div-table-responsive-no-min">';
956 print
'<table class="noborder centpercent lastrecordtable">';
958 print
'<tr class="liste_titre">';
959 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>';
960 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>';
961 print
'</tr></table></td>';
966 while ($i < $num && $i < $MAXLIST) {
967 $objp =
$db->fetch_object($resql);
969 print
'<tr class="oddeven">';
970 print
'<td class="nowraponall">';
971 $propal_static->id = $objp->propalid;
972 $propal_static->ref = $objp->ref;
973 $propal_static->ref_client = $objp->ref_client;
974 $propal_static->ref_customer = $objp->ref_client;
975 $propal_static->fk_project = $objp->fk_projet;
976 $propal_static->total_ht = $objp->total_ht;
977 $propal_static->total_tva = $objp->total_tva;
978 $propal_static->total_ttc = $objp->total_ttc;
979 print $propal_static->getNomUrl(1);
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);
997 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1000 if (!empty($sortfield) && !empty($sortorder)) {
1005 print $formfile->showPreview($file_list[0], $propal_static->element, $relativepath, 0,
'entity=' . $objp->entity);
1007 print
'</td><td class="tdoverflowmax125">';
1008 if ($propal_static->fk_project > 0) {
1009 $project->fetch($propal_static->fk_project);
1010 print $project->getNomUrl(1);
1016 if ((
$db->jdate($objp->date_limit) < ($now -
getWarningDelay(
'propal',
'cloture'))) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
1017 print
" ".img_warning();
1019 print
'</td><td class="right" width="80px">'.dol_print_date(
$db->jdate($objp->dp),
'day').
"</td>\n";
1020 print
'<td class="right nowraponall">'.price($objp->total_ht).
'</td>';
1021 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).
'</td></tr>';
1035 $orders2invoice =
null;
1041 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
1043 $sql =
"SELECT s.nom, s.rowid";
1044 $sql .=
", c.rowid as cid, c.entity, c.fk_projet, c.total_ht";
1045 $sql .=
", c.total_tva";
1046 $sql .=
", c.total_ttc";
1047 $sql .=
", c.ref, c.ref_client, c.fk_statut, c.facture";
1048 $sql .=
", c.date_commande as dc";
1049 $sql .=
", c.facture as billed";
1050 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"commande as c";
1051 $sql .=
" WHERE c.fk_soc = s.rowid ";
1052 $sql .=
" AND s.rowid = ".((int)
$object->id);
1053 $sql .=
" AND c.entity IN (".getEntity(
'commande').
')';
1054 $parameters = array();
1055 $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $commande_static);
1056 $sql .= $hookmanager->resPrint;
1057 $sql .=
" ORDER BY c.date_commande DESC";
1059 $resql =
$db->query($sql);
1061 $num =
$db->num_rows($resql);
1064 $sql2 =
'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
1065 $sql2 .=
' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
1066 $sql2 .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
1067 $sql2 .=
', '.MAIN_DB_PREFIX.
'commande as c';
1068 $sql2 .=
' WHERE c.fk_soc = s.rowid';
1069 $sql2 .=
' AND s.rowid = '.((int)
$object->id);
1071 $sql2 .=
" AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
1073 $resql2 =
$db->query($sql2);
1074 $orders2invoice =
$db->num_rows($resql2);
1077 print
'<div class="div-table-responsive-no-min">';
1078 print
'<table class="noborder centpercent lastrecordtable">';
1080 print
'<tr class="liste_titre">';
1081 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>';
1082 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>';
1083 print
'</tr></table></td>';
1088 while ($i < $num && $i < $MAXLIST) {
1089 $objp =
$db->fetch_object($resql);
1091 $commande_static->id = $objp->cid;
1092 $commande_static->ref = $objp->ref;
1093 $commande_static->ref_client = $objp->ref_client;
1094 $commande_static->fk_project = $objp->fk_projet;
1095 $commande_static->total_ht = $objp->total_ht;
1096 $commande_static->total_tva = $objp->total_tva;
1097 $commande_static->total_ttc = $objp->total_ttc;
1098 $commande_static->billed = $objp->billed;
1100 print
'<tr class="oddeven">';
1101 print
'<td class="nowraponall">';
1102 print $commande_static->getNomUrl(1);
1106 if (!empty($filedir)) {
1109 if (is_array($file_list) && !empty($file_list)) {
1113 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1114 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1119 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1122 if (!empty($sortfield) && !empty($sortorder)) {
1127 print $formfile->showPreview($file_list[0], $commande_static->element, $relativepath, 0,
'entity=' . $objp->entity);
1129 print
'</td><td class="tdoverflowmax125">';
1130 if ($commande_static->fk_project > 0) {
1131 $project->fetch($commande_static->fk_project);
1132 print $project->getNomUrl(1);
1140 print
'<td class="right" width="80px">'.dol_print_date(
$db->jdate($objp->dc),
'day').
"</td>\n";
1141 print
'<td class="right nowraponall">'.price($objp->total_ht).
'</td>';
1142 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).
'</td></tr>';
1159 if (
isModEnabled(
"shipping") && $user->hasRight(
'expedition',
'lire')) {
1162 $sql =
'SELECT e.rowid as id';
1163 $sql .=
', e.ref, e.entity, e.fk_projet';
1164 $sql .=
', e.date_creation';
1165 $sql .=
', e.fk_statut as statut';
1167 $sql .=
', s.rowid as socid';
1168 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"expedition as e";
1169 $sql .=
" WHERE e.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1170 $sql .=
" AND e.entity IN (".getEntity(
'expedition').
")";
1171 $sql .=
' GROUP BY e.rowid';
1172 $sql .=
', e.ref, e.entity, e.fk_projet';
1173 $sql .=
', e.date_creation';
1174 $sql .=
', e.fk_statut';
1176 $sql .=
', s.rowid';
1177 $sql .=
" ORDER BY e.date_creation DESC";
1179 $resql =
$db->query($sql);
1183 $num =
$db->num_rows($resql);
1185 print
'<div class="div-table-responsive-no-min">';
1186 print
'<table class="noborder centpercent lastrecordtable">';
1188 print
'<tr class="liste_titre">';
1189 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>';
1190 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>';
1191 print
'</tr></table></td>';
1196 while ($i < $num && $i < $MAXLIST) {
1197 $objp =
$db->fetch_object($resql);
1199 $param =
'entity=' . ((int) $objp->entity);
1201 $sendingstatic->id = $objp->id;
1202 $sendingstatic->ref = $objp->ref;
1203 $sendingstatic->fk_project = $objp->fk_projet;
1205 print
'<tr class="oddeven">';
1206 print
'<td class="nowraponall">';
1207 print $sendingstatic->getNomUrl(1);
1211 if (!empty($filedir)) {
1214 if (is_array($file_list) && !empty($file_list)) {
1218 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1219 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1224 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1227 if (!empty($sortfield) && !empty($sortorder)) {
1233 print $formfile->showPreview($file_list[0], $sendingstatic->element, $relativepath, 0, $param);
1235 print
'</td><td class="tdoverflowmax125">';
1236 if ($sendingstatic->fk_project > 0) {
1237 $project->fetch($sendingstatic->fk_project);
1238 print $project->getNomUrl(1);
1245 if ($objp->date_creation > 0) {
1246 print
'<td class="right" width="80px">'.dol_print_date(
$db->jdate($objp->date_creation),
'day').
'</td>';
1248 print
'<td class="right"><b>!!!</b></td>';
1251 print
'<td class="nowrap right">'.$sendingstatic->LibStatut($objp->statut, 5).
'</td>';
1269 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
1270 $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,";
1271 $sql .=
" c.last_main_doc, c.model_pdf";
1272 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"contrat as c";
1273 $sql .=
" WHERE c.fk_soc = s.rowid ";
1274 $sql .=
" AND s.rowid = ".((int)
$object->id);
1275 $sql .=
" AND c.entity IN (".getEntity(
'contract').
")";
1276 $sql .=
" ORDER BY c.datec DESC";
1278 $resql =
$db->query($sql);
1282 $num =
$db->num_rows($resql);
1284 print
'<div class="div-table-responsive-no-min">';
1285 print
'<table class="noborder centpercent lastrecordtable">';
1287 print
'<tr class="liste_titre">';
1288 print
'<td colspan="6"><table class="centpercent nobordernopadding"><tr><td>'.$langs->trans(
"LastContracts", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td>';
1289 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>';
1291 print
'</tr></table></td>';
1296 while ($i < $num && $i < $MAXLIST) {
1297 $objp =
$db->fetch_object($resql);
1299 $contrat->id = $objp->id;
1300 $contrat->ref = $objp->ref ? $objp->ref : $objp->id;
1301 $contrat->ref_customer = $objp->refcus;
1302 $contrat->ref_supplier = $objp->refsup;
1303 $contrat->fk_project = $objp->fk_projet;
1304 $contrat->statut = $objp->contract_status;
1305 $contrat->status = $objp->contract_status;
1306 $contrat->last_main_doc = $objp->last_main_doc;
1307 $contrat->model_pdf = $objp->model_pdf;
1308 $contrat->fetch_lines();
1311 foreach ($contrat->lines as $line) {
1312 if ($contrat->status == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
1313 if (((!empty($line->date_end) ? $line->date_end : 0) +
getWarningDelay(
'contract',
'service',
'expires')) < $now) {
1319 print
'<tr class="oddeven">';
1320 print
'<td class="nowraponall">';
1321 print $contrat->getNomUrl(1, 12);
1322 if (!empty($contrat->model_pdf)) {
1326 if (!empty($filedir)) {
1329 if (is_array($file_list) && !empty($file_list)) {
1333 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1334 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1339 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1342 if (!empty($sortfield) && !empty($sortorder)) {
1347 print $formfile->showPreview($file_list[0], $contrat->element, $relativepath, 0,
'entity=' . $objp->entity);
1355 print
'</td><td class="tdoverflowmax125">';
1356 if ($contrat->fk_project > 0) {
1357 $project->fetch($contrat->fk_project);
1358 print $project->getNomUrl(1);
1361 print
'<td class="nowrap">';
1362 print
dol_trunc(strtolower(get_class($object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12);
1365 print
'<td class="right" width="80px"><span title="'.$langs->trans(
"DateContract").
'">'.
dol_print_date(
$db->jdate($objp->dcon),
'day').
"</span></td>\n";
1366 print
'<td width="20"> </td>';
1367 print
'<td class="nowraponall right">';
1368 print $contrat->getLibStatut(4);
1387 if (
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
1388 $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";
1389 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"fichinter as f";
1390 $sql .=
" WHERE f.fk_soc = s.rowid";
1391 $sql .=
" AND s.rowid = ".((int)
$object->id);
1392 $sql .=
" AND f.entity IN (".getEntity(
'intervention').
")";
1393 $sql .=
" ORDER BY f.tms DESC";
1395 $resql =
$db->query($sql);
1399 $num =
$db->num_rows($resql);
1401 print
'<div class="div-table-responsive-no-min">';
1402 print
'<table class="noborder centpercent lastrecordtable">';
1404 print
'<tr class="liste_titre">';
1405 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>';
1406 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>';
1407 print
'</tr></table></td>';
1412 while ($i < $num && $i < $MAXLIST) {
1413 $objp =
$db->fetch_object($resql);
1415 $fichinter_static->id = $objp->id;
1416 $fichinter_static->ref = $objp->ref;
1417 $fichinter_static->statut = $objp->fk_statut;
1418 $fichinter_static->status = $objp->fk_statut;
1419 $fichinter_static->fk_project = $objp->fk_projet;
1421 print
'<tr class="oddeven">';
1422 print
'<td class="nowraponall">';
1423 print $fichinter_static->getNomUrl(1);
1427 if (!empty($filedir)) {
1430 if (is_array($file_list) && !empty($file_list)) {
1434 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1435 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1440 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1443 if (!empty($sortfield) && !empty($sortorder)) {
1448 print $formfile->showPreview($file_list[0], $fichinter_static->element, $relativepath, 0,
'entity=' . $objp->entity);
1450 print
'</td><td class="tdoverflowmax125">';
1451 if ($fichinter_static->fk_project > 0) {
1452 $project->fetch($fichinter_static->fk_project);
1453 print $project->getNomUrl(1);
1461 print
'<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).
'</td>'.
"\n";
1462 print
'<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).
'</td>'.
"\n";
1481 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1482 $sql =
'SELECT f.rowid as id, f.titre as ref, f.fk_projet';
1483 $sql .=
', f.total_ht';
1484 $sql .=
', f.total_tva';
1485 $sql .=
', f.total_ttc';
1486 $sql .=
', f.datec as dc';
1487 $sql .=
', f.date_last_gen, f.date_when';
1488 $sql .=
', f.frequency';
1489 $sql .=
', f.unit_frequency';
1490 $sql .=
', f.suspended as suspended';
1491 $sql .=
', s.nom, s.rowid as socid';
1492 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_rec as f";
1493 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1494 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1495 $sql .=
' GROUP BY f.rowid, f.titre, f.fk_projet, f.total_ht, f.total_tva, f.total_ttc,';
1496 $sql .=
' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
1497 $sql .=
' f.suspended, f.date_when,';
1498 $sql .=
' s.nom, s.rowid';
1499 $sql .=
" ORDER BY f.date_last_gen, f.datec DESC";
1501 $resql =
$db->query($sql);
1505 $num =
$db->num_rows($resql);
1507 print
'<div class="div-table-responsive-no-min">';
1508 print
'<table class="noborder centpercent lastrecordtable">';
1509 print
'<tr class="liste_titre">';
1514 print
'<td colspan="'.$colspan.
'">';
1515 print
'<table class="centpercent nobordernopadding"><tr>';
1516 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>';
1517 print
'</tr></table>';
1523 while ($i < $num && $i < $MAXLIST) {
1524 $objp =
$db->fetch_object($resql);
1526 $invoicetemplate->id = $objp->id;
1527 $invoicetemplate->ref = $objp->ref;
1528 $invoicetemplate->fk_project = $objp->fk_projet;
1529 $invoicetemplate->suspended = $objp->suspended;
1530 $invoicetemplate->frequency = $objp->frequency;
1531 $invoicetemplate->unit_frequency = $objp->unit_frequency;
1532 $invoicetemplate->total_ht = $objp->total_ht;
1533 $invoicetemplate->total_tva = $objp->total_tva;
1534 $invoicetemplate->total_ttc = $objp->total_ttc;
1535 $invoicetemplate->date_last_gen = $objp->date_last_gen;
1536 $invoicetemplate->date_when = $objp->date_when;
1538 print
'<tr class="oddeven">';
1539 print
'<td class="tdoverflowmax250">';
1540 print $invoicetemplate->getNomUrl(1);
1541 print
'</td><td class="tdoverflowmax125">';
1542 if ($invoicetemplate->fk_project > 0) {
1543 $project->fetch($invoicetemplate->fk_project);
1544 print $project->getNomUrl(1);
1548 if ($objp->frequency && $objp->date_last_gen > 0) {
1549 print
'<td class="right" width="80px">'.dol_print_date(
$db->jdate($objp->date_last_gen),
'day').
'</td>';
1551 if ($objp->dc > 0) {
1552 print
'<td class="right" width="80px">'.dol_print_date(
$db->jdate($objp->dc),
'day').
'</td>';
1554 print
'<td class="right"><b>!!!</b></td>';
1557 print
'<td class="right nowraponall">';
1558 print
price($objp->total_ht);
1562 print
'<td class="right nowraponall">';
1563 print
price($objp->total_ttc);
1567 print
'<td class="nowrap right" style="min-width: 60px">';
1568 print $langs->trans(
'FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).
' - ';
1569 print($invoicetemplate->LibStatut($invoicetemplate->frequency, $invoicetemplate->suspended, 5, 0));
1588 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1589 $sql =
'SELECT f.rowid as facid, f.ref, f.type, f.ref_client, f.fk_projet';
1590 $sql .=
', f.total_ht';
1591 $sql .=
', f.total_tva';
1592 $sql .=
', f.total_ttc';
1593 $sql .=
', f.entity';
1594 $sql .=
', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status';
1595 $sql .=
', s.nom, s.rowid as socid';
1596 $sql .=
', SUM(pf.amount) as am';
1597 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture as f";
1598 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiement_facture as pf ON f.rowid=pf.fk_facture';
1599 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int)
$object->id);
1600 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1601 $sql .=
' GROUP BY f.rowid, f.ref, f.type, f.ref_client, f.fk_projet, f.total_ht, f.total_tva, f.total_ttc,';
1602 $sql .=
' f.entity, f.datef, f.date_lim_reglement, f.datec, f.paye, f.fk_statut,';
1603 $sql .=
' s.nom, s.rowid';
1604 $sql .=
" ORDER BY f.datef DESC, f.datec DESC";
1606 $resql =
$db->query($sql);
1610 $num =
$db->num_rows($resql);
1612 print
'<div class="div-table-responsive-no-min">';
1613 print
'<table class="noborder centpercent lastrecordtable">';
1614 print
'<tr class="liste_titre">';
1622 print
'<td colspan="'.$colspan.
'">';
1623 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>';
1624 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>';
1625 print
'</tr></table>';
1631 while ($i < $num && $i < $MAXLIST) {
1632 $objp =
$db->fetch_object($resql);
1634 $facturestatic->id = $objp->facid;
1635 $facturestatic->ref = $objp->ref;
1636 $facturestatic->ref_client = $objp->ref_client;
1637 $facturestatic->fk_project = $objp->fk_projet;
1638 $facturestatic->type = $objp->type;
1639 $facturestatic->total_ht = $objp->total_ht;
1640 $facturestatic->total_tva = $objp->total_tva;
1641 $facturestatic->total_ttc = $objp->total_ttc;
1642 $facturestatic->statut = $objp->status;
1643 $facturestatic->status = $objp->status;
1644 $facturestatic->paye = $objp->paye;
1646 $facturestatic->alreadypaid = $objp->am;
1647 $facturestatic->totalpaid = $objp->am;
1649 $facturestatic->date =
$db->jdate($objp->df);
1650 $facturestatic->date_lim_reglement =
$db->jdate($objp->dl);
1652 print
'<tr class="oddeven">';
1653 print
'<td class="nowraponall">';
1654 print $facturestatic->getNomUrl(1);
1658 if (!empty($filedir)) {
1661 if (is_array($file_list) && !empty($file_list)) {
1665 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
1666 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1671 '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $file_list';
1674 if (!empty($sortfield) && !empty($sortorder)) {
1679 print $formfile->showPreview($file_list[0], $facturestatic->element, $relativepath, 0,
'entity=' . $objp->entity);
1681 print
'</td><td class="tdoverflowmax125">';
1682 if ($facturestatic->fk_project > 0) {
1683 $project->fetch($facturestatic->fk_project);
1684 print $project->getNomUrl(1);
1692 print
'<td class="nowraponall">';
1696 if ($objp->df > 0) {
1697 print
'<td width="80px" title="'.dol_escape_htmltag($langs->trans(
'DateInvoice')).
'">'.
dol_print_date(
$db->jdate($objp->df),
'day').
'</td>';
1699 print
'<td><b>!!!</b></td>';
1701 if ($objp->dl > 0) {
1702 print
'<td width="80px" title="'.dol_escape_htmltag($langs->trans(
'DateMaxPayment')).
'">'.
dol_print_date(
$db->jdate($objp->dl),
'day').
'</td>';
1704 print
'<td><b>!!!</b></td>';
1707 print
'<td class="right nowraponall">';
1708 print
price($objp->total_ht);
1712 print
'<td class="right nowraponall">';
1713 print
price($objp->total_ttc);
1717 print
'<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->status, 5, $objp->am)).
'</td>';
1733 $parameters = array();
1734 $reshook = $hookmanager->executeHooks(
'addMoreRecentObjects', $parameters, $object, $action);
1738 print $hookmanager->resPrint;
1741 print
'</div></div>';
1742 print
'<div class="clearboth"></div>';
1750 print
'<div class="tabsAction">';
1752 $parameters = array();
1753 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1755 if (empty($reshook)) {
1757 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyIsClosed")).
'" href="#">'.$langs->trans(
"ThirdPartyIsClosed").
'</a></div>';
1760 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'creer') &&
$object->status == 1) {
1761 $langs->load(
"propal");
1762 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>';
1765 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'creer') &&
$object->status == 1) {
1766 $langs->load(
"orders");
1767 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>';
1770 if ($user->hasRight(
'contrat',
'creer') &&
$object->status == 1) {
1771 $langs->load(
"contracts");
1772 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>';
1775 if (
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'creer') &&
$object->status == 1) {
1776 $langs->load(
"interventions");
1777 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>';
1781 if (!$user->hasRight(
'facture',
'creer')) {
1782 $langs->load(
"bills");
1783 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1785 $langs->loadLangs(array(
"orders",
"bills"));
1788 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>';
1790 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1796 if ($user->hasRight(
'facture',
'creer')) {
1799 if (!empty($orders2invoice) && $orders2invoice > 0) {
1800 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>';
1802 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NoOrdersToInvoice")).
'" href="#">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1805 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1813 if ($user->hasRight(
'agenda',
'myactions',
'create')) {
1814 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>';
1816 print
'<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddAction").
'</a></div>';
1838 recordNotFound(
'', 0);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 accounting accounts.
Class to manage members of a foundation.
Class to manage customers or prospects.
Class to manage customers orders.
Class to manage invoices.
const TYPE_CREDIT_NOTE
Credit note invoice.
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, $subtabs='')
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.
completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object=null)
Complete $filearray with data from database.
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.
dol_now($mode='gmt')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_action($titlealt, $numaction, $picto='', $moreatt='')
Show logo action.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
isModEnabled($module)
Is Dolibarr module enabled.
getWarningDelay($module, $parmlevel1, $parmlevel2='')
Return a warning delay You can use it like this: if (getWarningDelay('module', 'paramlevel1')) It rep...
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.