34 require
'../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
41 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
42 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
43 if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
44 if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
45 if (!empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
46 if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
47 if (!empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
48 if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
51 $langs->loadLangs(array(
'companies',
'banks'));
53 if (!empty($conf->contrat->enabled)) $langs->load(
"contracts");
54 if (!empty($conf->commande->enabled)) $langs->load(
"orders");
55 if (!empty($conf->expedition->enabled)) $langs->load(
"sendings");
56 if (!empty($conf->facture->enabled)) $langs->load(
"bills");
57 if (!empty($conf->projet->enabled)) $langs->load(
"projects");
58 if (!empty($conf->ficheinter->enabled)) $langs->load(
"interventions");
59 if (!empty($conf->notification->enabled)) $langs->load(
"mails");
63 if ($user->socid > 0) $id = $user->socid;
66 $action =
GETPOST(
'action',
'aZ09');
68 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
69 $sortfield =
GETPOST(
"sortfield",
'alpha');
70 $sortorder =
GETPOST(
"sortorder",
'alpha');
72 if (empty($page) || $page == -1) { $page = 0; }
73 $offset = $limit * $page;
74 $pageprev = $page - 1;
75 $pagenext = $page + 1;
76 if (!$sortorder) $sortorder =
"ASC";
77 if (!$sortfield) $sortfield =
"nom";
78 $cancelbutton =
GETPOST(
'cancel',
'alpha');
84 $extrafields->fetch_name_optionals_label($object->table_element);
87 $hookmanager->initHooks(array(
'thirdpartycomm',
'globalcard'));
90 $result =
restrictedArea($user,
'societe', $socid,
'&societe',
'',
'fk_soc',
'rowid', 0);
92 if ($object->id > 0) {
93 if (!($object->client > 0) || empty($user->rights->societe->lire)) {
105 $parameters = array(
'id' => $id,
'socid' => $id);
106 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
107 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
117 if ($action ==
'setcustomeraccountancycode')
119 $result = $object->fetch($id);
120 $object->code_compta = $_POST[
"customeraccountancycode"];
121 $result = $object->update($object->id, $user, 1, 1, 0);
122 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
126 if ($action ==
'setconditions' && $user->rights->societe->creer)
129 $result = $object->setPaymentTerms(
GETPOST(
'cond_reglement_id',
'int'));
130 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
134 if ($action ==
'setmode' && $user->rights->societe->creer)
137 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
138 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
142 if ($action ==
'setbankaccount' && $user->rights->societe->creer)
145 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
146 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
150 if ($action ==
'setshippingmethod' && $user->rights->societe->creer)
153 $result = $object->setShippingMethod(
GETPOST(
'shipping_method_id',
'int'));
154 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
158 if ($action ==
'setassujtva' && $user->rights->societe->creer)
161 $object->tva_assuj = $_POST[
'assujtva_value'];
162 $result = $object->update($object->id);
163 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
167 if ($action ==
'setprospectlevel' && $user->rights->societe->creer)
170 $object->fk_prospectlevel =
GETPOST(
'prospect_level_id',
'alpha');
171 $result = $object->update($object->id, $user);
172 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
176 if ($action ==
'setstcomm')
180 $result = $object->update($object->id, $user);
181 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
182 else $result = $object->fetch($object->id);
186 if ($action ==
'setoutstanding_limit')
189 $object->outstanding_limit =
GETPOST(
'outstanding_limit');
190 $result = $object->update($object->id, $user);
191 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
195 if ($action ==
'setorder_min_amount')
198 $object->order_min_amount =
price2num(
GETPOST(
'order_min_amount',
'alpha'));
199 $result = $object->update($object->id, $user);
200 if ($result < 0)
setEventMessages($object->error, $object->errors,
'errors');
204 if ($action ==
'set_salesrepresentatives' && $user->rights->societe->creer)
207 $result = $object->setSalesRep(
GETPOST(
'commercial',
'array'));
210 if ($action ==
'update_extras') {
216 $ret = $extrafields->setOptionalsFromPost(null, $object,
GETPOST(
'attribute',
'restricthtml'));
217 if ($ret < 0) $error++;
220 $result = $object->insertExtraFields(
'COMPANY_MODIFY');
227 if ($error) $action =
'edit_extras';
236 $contactstatic =
new Contact($db);
237 $userstatic =
new User($db);
238 $form =
new Form($db);
241 if ($id > 0 && empty($object->id))
244 $res = $object->fetch($id);
245 if ($object->id < 0)
dol_print_error($db, $object->error, $object->errors);
248 $title = $langs->trans(
"CustomerCard");
249 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name;
250 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
260 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
262 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
264 print '<div class="fichecenter"><div class="fichehalfleft">';
266 print '<div class="underbanner clearboth"></div>';
267 print '<table class="border centpercent tableforfield">';
270 print '<tr><td class="titlefield">'.$langs->trans(
'ProspectCustomer').
'</td><td>';
271 print $object->getLibCustProspStatut();
275 if (!empty($conf->global->SOCIETE_USEPREFIX))
277 print '<tr><td>'.$langs->trans(
"Prefix").
'</td><td>';
278 print ($object->prefix_comm ? $object->prefix_comm :
' ');
284 $langs->load(
"compta");
287 print $langs->trans(
'CustomerCode').
'</td><td>';
288 print $object->code_client;
289 $tmpcheck = $object->check_codeclient();
290 if ($tmpcheck != 0 && $tmpcheck != -5) {
291 print ' <font class="error">('.$langs->trans(
"WrongCustomerCode").
')</font>';
297 print $form->editfieldkey(
"CustomerAccountancyCode",
'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
299 print $form->editfieldval(
"CustomerAccountancyCode",
'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
320 if ($mysoc->country_code ==
'ES')
323 if ($mysoc->localtax1_assuj ==
"1")
325 print '<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
326 print yn($object->localtax1_assuj);
329 if ($mysoc->localtax1_assuj ==
"1")
331 print '<tr><td class="nowrap">'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
332 print yn($object->localtax2_assuj);
338 print '<tr><td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
339 print $object->tva_intra;
343 $langs->load(
'bills');
345 print '<table width="100%" class="nobordernopadding"><tr><td>';
346 print $langs->trans(
'PaymentConditions');
348 if (($action !=
'editconditions') && $user->rights->societe->creer)
print '<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editconditions&socid='.$object->id.
'">'.
img_edit($langs->trans(
'SetConditions'), 1).
'</a></td>';
349 print '</tr></table>';
351 if ($action ==
'editconditions')
353 $form->form_conditions_reglement(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->cond_reglement_id,
'cond_reglement_id', 1);
355 $form->form_conditions_reglement(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->cond_reglement_id,
'none');
361 print
'<tr><td class="nowrap">';
362 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
363 print $langs->trans(
'PaymentMode');
365 if (($action !=
'editmode') && $user->rights->societe->creer) print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmode&socid='.$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
366 print
'</tr></table>';
368 if ($action ==
'editmode')
370 $form->form_modes_reglement(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
372 $form->form_modes_reglement(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->mode_reglement_id,
'none');
377 if (!empty($conf->banque->enabled))
380 print
'<tr><td class="nowrap">';
381 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
382 print $langs->trans(
'PaymentBankAccount');
384 if (($action !=
'editbankaccount') && $user->rights->societe->creer) print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editbankaccount&socid='.$object->id.
'">'.
img_edit($langs->trans(
'SetBankAccount'), 1).
'</a></td>';
385 print
'</tr></table>';
387 if ($action ==
'editbankaccount')
389 $form->formSelectAccount(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->fk_account,
'fk_account', 1);
391 $form->formSelectAccount(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->fk_account,
'none');
397 $isCustomer = ($object->client == 1 || $object->client == 3);
402 print
'<tr><td class="nowrap">';
403 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
404 print $langs->trans(
"CustomerRelativeDiscountShort");
405 print
'<td><td class="right">';
406 if ($user->rights->societe->creer && !$user->socid > 0)
408 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.$object->id.
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
410 print
'</td></tr></table>';
411 print
'</td><td>'.($object->remise_percent ?
'<a href="'.DOL_URL_ROOT.
'/comm/remise.php?id='.$object->id.
'">'.$object->remise_percent.
'%</a>' :
'').
'</td>';
415 print
'<tr><td class="nowrap">';
416 print
'<table width="100%" class="nobordernopadding">';
417 print
'<tr><td class="nowrap">';
418 print $langs->trans(
"CustomerAbsoluteDiscountShort");
419 print
'<td><td class="right">';
420 if ($user->rights->societe->creer && !$user->socid > 0)
422 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$object->id.
'&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?socid='.$object->id).
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
424 print
'</td></tr></table>';
427 $amount_discount = $object->getAvailableDiscounts();
429 if ($amount_discount > 0) print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$object->id.
'&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?socid='.$object->id).
'">'.
price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).
'</a>';
438 print
'<tr class="nowrap">';
440 print $form->editfieldkey(
"OutstandingBill",
'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer);
442 $limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ?
'numeric' :
'amount';
443 print $form->editfieldval(
"OutstandingBill",
'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit !=
'' ?
price($object->outstanding_limit) :
''));
450 if (!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
452 print
'<!-- Minimim amount for orders -->'.
"\n";
453 print
'<tr class="nowrap">';
455 print $form->editfieldkey(
"OrderMinAmount",
'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
457 print $form->editfieldval(
"OrderMinAmount",
'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->order_min_amount !=
'' ?
price($object->order_min_amount) :
''));
465 if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
467 print
'<tr><td class="nowrap">';
468 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
469 print $langs->trans(
"PriceLevel");
470 print
'<td><td class="right">';
471 if ($user->rights->societe->creer)
473 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/comm/multiprix.php?id='.$object->id.
'">'.
img_edit($langs->trans(
"Modify")).
'</a>';
475 print
'</td></tr></table>';
477 print $object->price_level;
478 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
479 if (!empty($conf->global->$keyforlabel)) print
' - '.$langs->trans($conf->global->$keyforlabel);
485 if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
486 print
'<tr><td class="nowrap">';
487 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
488 print $langs->trans(
'SendingMethod');
490 if (($action !=
'editshipping') && $user->rights->societe->creer) print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editshipping&socid='.$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
491 print
'</tr></table>';
493 if ($action ==
'editshipping')
495 $form->formSelectShippingMethod(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->shipping_method_id,
'shipping_method_id', 1);
497 $form->formSelectShippingMethod(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->shipping_method_id,
'none');
503 if (!empty($conf->intracommreport->enabled))
506 print
'<tr><td class="nowrap">';
507 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
508 print $langs->trans(
'IntracommReportTransportMode');
510 if (($action !=
'edittransportmode') && $user->rights->societe->creer) print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edittransportmode&socid='.$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
511 print
'</tr></table>';
513 if ($action ==
'edittransportmode')
515 $form->formSelectTransportMode(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->fk_transport_mode,
'fk_transport_mode', 1);
518 $form->formSelectTransportMode(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->fk_transport_mode,
'none');
525 if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
526 $langs->load(
"categories");
527 print
'<tr><td>'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
529 print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
534 $parameters = array(
'socid'=>$object->id);
535 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
538 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
541 if (!empty($conf->adherent->enabled))
543 $langs->load(
"members");
544 $langs->load(
"users");
546 print
'<tr><td class="titlefield">'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
549 $result = $adh->fetch(
'',
'', $object->id);
552 $adh->ref = $adh->getFullName($langs);
553 print $adh->getNomUrl(1);
555 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
564 if ($object->client == 2 || $object->client == 3)
568 print
'<div class="underbanner clearboth"></div>';
569 print
'<table class="border centpercent tableforfield">';
572 print
'<tr><td class="titlefield nowrap">';
573 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
574 print $langs->trans(
'ProspectLevel');
576 if ($action !=
'editlevel' && $user->rights->societe->creer) print
'<td class="right"><a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editlevel&socid='.$object->id.
'">'.
img_edit($langs->trans(
'Modify'), 1).
'</a></td>';
577 print
'</tr></table>';
579 if ($action ==
'editlevel')
581 $formcompany->form_prospect_level(
$_SERVER[
'PHP_SELF'].
'?socid='.$object->id, $object->fk_prospectlevel,
'prospect_level_id', 1);
583 print $object->getLibProspLevel();
589 $object->loadCacheOfProspStatus();
590 print
'<tr><td>'.$langs->trans(
"StatusProsp").
'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id][
'label']);
591 print
' ';
592 print
'<div class="floatright">';
593 foreach ($object->cacheprospectstatus as $key => $val)
595 $titlealt =
'default';
596 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) $titlealt = $val[
'label'];
597 if ($object->stcomm_id != $val[
'id']) 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>';
599 print
'</div></td></tr>';
603 print
'</div><div class="fichehalfright"><div class="ficheaddleft">';
604 print
'<div class="underbanner clearboth"></div>';
609 $MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
612 $boxstat .=
'<div class="box">';
613 $boxstat .=
'<table summary="'.dol_escape_htmltag($langs->trans(
"DolibarrStateBoard")).
'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
614 $boxstat .=
'<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
616 if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
619 $tmp = $object->getOutstandingProposals();
620 $outstandingOpened = $tmp[
'opened'];
621 $outstandingTotal = $tmp[
'total_ht'];
622 $outstandingTotalIncTax = $tmp[
'total_ttc'];
623 $text = $langs->trans(
"OverAllProposals");
624 $link = DOL_URL_ROOT.
'/comm/propal/list.php?socid='.$object->id;
626 if ($link) $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
627 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
628 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
629 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
630 $boxstat .=
'</div>';
631 if ($link) $boxstat .=
'</a>';
634 if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
637 $tmp = $object->getOutstandingOrders();
638 $outstandingOpened = $tmp[
'opened'];
639 $outstandingTotal = $tmp[
'total_ht'];
640 $outstandingTotalIncTax = $tmp[
'total_ttc'];
641 $text = $langs->trans(
"OverAllOrders");
642 $link = DOL_URL_ROOT.
'/commande/list.php?socid='.$object->id;
644 if ($link) $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
645 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
646 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
647 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
648 $boxstat .=
'</div>';
649 if ($link) $boxstat .=
'</a>';
652 if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
655 $tmp = $object->getOutstandingBills(
'customer', 0);
656 $outstandingOpened = $tmp[
'opened'];
657 $outstandingTotal = $tmp[
'total_ht'];
658 $outstandingTotalIncTax = $tmp[
'total_ttc'];
660 $text = $langs->trans(
"OverAllInvoices");
661 $link = DOL_URL_ROOT.
'/compta/facture/list.php?socid='.$object->id;
663 if ($link) $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
664 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
665 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
666 $boxstat .=
'<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
667 $boxstat .=
'</div>';
668 if ($link) $boxstat .=
'</a>';
672 if ($object->outstanding_limit !=
'' && $object->outstanding_limit < $outstandingOpened)
674 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
676 $text = $langs->trans(
"CurrentOutstandingBill");
677 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.$object->id;
679 if ($link) $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
680 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
681 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
682 $boxstat .=
'<span class="boxstatsindicator'.($outstandingOpened > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.
'</span>';
683 $boxstat .=
'</div>';
684 if ($link) $boxstat .=
'</a>';
686 $tmp = $object->getOutstandingBills(
'customer', 1);
687 $outstandingOpenedLate = $tmp[
'opened'];
688 if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
690 if ($object->outstanding_limit !=
'' && $object->outstanding_limit < $outstandingOpenedLate) {
691 $warn =
' '.img_warning($langs->trans(
"OutstandingBillReached"));
693 $text = $langs->trans(
"CurrentOutstandingBillLate");
694 $link = DOL_URL_ROOT.
'/compta/recap-compta.php?socid='.$object->id;
696 if ($link) $boxstat .=
'<a href="'.$link.
'" class="boxstatsindicator thumbstat nobold nounderline">';
697 $boxstat .=
'<div class="boxstats" title="'.dol_escape_htmltag($text).
'">';
698 $boxstat .=
'<span class="boxstatstext">'.img_object(
"", $icon).
' <span>'.$text.
'</span></span><br>';
699 $boxstat .=
'<span class="boxstatsindicator'.($outstandingOpenedLate > 0 ?
' amountremaintopay' :
'').
'">'.
price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.
'</span>';
700 $boxstat .=
'</div>';
701 if ($link) $boxstat .=
'</a>';
705 $parameters = array();
706 $reshook = $hookmanager->executeHooks(
'addMoreBoxStatsCustomer', $parameters, $object, $action);
707 if (empty($reshook)) {
708 $boxstat .= $hookmanager->resPrint;
711 $boxstat .=
'</td></tr>';
712 $boxstat .=
'</table>';
713 $boxstat .=
'</div>';
721 if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
723 $langs->load(
"propal");
725 $sql =
"SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
726 $sql .=
", p.tva as total_tva";
727 $sql .=
", p.total as total_ttc";
728 $sql .=
", p.ref, p.ref_client, p.remise";
729 $sql .=
", p.datep as dp, p.fin_validite as date_limit";
730 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"propal as p, ".MAIN_DB_PREFIX.
"c_propalst as c";
731 $sql .=
" WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
732 $sql .=
" AND s.rowid = ".$object->id;
733 $sql .=
" AND p.entity IN (".getEntity(
'propal').
")";
734 $sql .=
" ORDER BY p.datep DESC";
736 $resql = $db->query($sql);
739 $propal_static =
new Propal($db);
741 $num = $db->num_rows(
$resql);
744 print
'<div class="div-table-responsive-no-min">';
745 print
'<table class="noborder centpercent lastrecordtable">';
747 print
'<tr class="liste_titre">';
748 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.
'">'.$langs->trans(
"AllPropals").
'<span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
749 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>';
750 print
'</tr></table></td>';
755 while ($i < $num && $i < $MAXLIST)
757 $objp = $db->fetch_object(
$resql);
759 print
'<tr class="oddeven">';
760 print
'<td class="nowrap">';
761 $propal_static->id = $objp->propalid;
762 $propal_static->ref = $objp->ref;
763 $propal_static->ref_client = $objp->ref_client;
764 $propal_static->total_ht = $objp->total_ht;
765 $propal_static->total_tva = $objp->total_tva;
766 $propal_static->total_ttc = $objp->total_ttc;
767 print $propal_static->getNomUrl(1);
768 if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
769 print
" ".img_warning();
771 print
'</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
772 print
'<td class="right" style="min-width: 60px">'.price($objp->total_ht).
'</td>';
773 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).
'</td></tr>';
791 if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
793 $sql =
"SELECT s.nom, s.rowid";
794 $sql .=
", c.rowid as cid, c.total_ht";
795 $sql .=
", c.tva as total_tva";
796 $sql .=
", c.total_ttc";
797 $sql .=
", c.ref, c.ref_client, c.fk_statut, c.facture";
798 $sql .=
", c.date_commande as dc";
799 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"commande as c";
800 $sql .=
" WHERE c.fk_soc = s.rowid ";
801 $sql .=
" AND s.rowid = ".$object->id;
802 $sql .=
" AND c.entity IN (".getEntity(
'commande').
')';
803 $sql .=
" ORDER BY c.date_commande DESC";
805 $resql = $db->query($sql);
808 $commande_static =
new Commande($db);
810 $num = $db->num_rows(
$resql);
814 $sql2 =
'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
815 $sql2 .=
' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
816 $sql2 .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
817 $sql2 .=
', '.MAIN_DB_PREFIX.
'commande as c';
818 $sql2 .=
' WHERE c.fk_soc = s.rowid';
819 $sql2 .=
' AND s.rowid = '.$object->id;
821 $sql2 .=
" AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
823 $resql2 = $db->query($sql2);
824 $orders2invoice = $db->num_rows($resql2);
827 print
'<div class="div-table-responsive-no-min">';
828 print
'<table class="noborder centpercent lastrecordtable">';
830 print
'<tr class="liste_titre">';
831 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.
'">'.$langs->trans(
"AllOrders").
'<span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
832 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>';
833 print
'</tr></table></td>';
838 while ($i < $num && $i < $MAXLIST)
840 $objp = $db->fetch_object(
$resql);
842 $commande_static->id = $objp->cid;
843 $commande_static->ref = $objp->ref;
844 $commande_static->ref_client = $objp->ref_client;
845 $commande_static->total_ht = $objp->total_ht;
846 $commande_static->total_tva = $objp->total_tva;
847 $commande_static->total_ttc = $objp->total_ttc;
848 $commande_static->billed = $objp->billed;
850 print
'<tr class="oddeven">';
851 print
'<td class="nowrap">';
852 print $commande_static->getNomUrl(1);
853 print
'</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc),
'day').
"</td>\n";
854 print
'<td class="right" style="min-width: 60px">'.price($objp->total_ht).
'</td>';
855 print
'<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).
'</td></tr>';
873 if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire)
875 $sql =
'SELECT e.rowid as id';
877 $sql .=
', e.date_creation';
878 $sql .=
', e.fk_statut as statut';
880 $sql .=
', s.rowid as socid';
881 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"expedition as e";
882 $sql .=
" WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
883 $sql .=
" AND e.entity IN (".getEntity(
'expedition').
")";
884 $sql .=
' GROUP BY e.rowid';
886 $sql .=
', e.date_creation';
887 $sql .=
', e.fk_statut';
890 $sql .=
" ORDER BY e.date_creation DESC";
892 $resql = $db->query($sql);
897 $num = $db->num_rows(
$resql);
899 print
'<div class="div-table-responsive-no-min">';
900 print
'<table class="noborder centpercent lastrecordtable">';
902 print
'<tr class="liste_titre">';
903 print
'<td colspan="4"><table width="100%" class="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.
'">'.$langs->trans(
"AllSendings").
'<span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
904 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>';
905 print
'</tr></table></td>';
910 while ($i < $num && $i < $MAXLIST)
912 $objp = $db->fetch_object(
$resql);
914 $sendingstatic->id = $objp->id;
915 $sendingstatic->ref = $objp->ref;
917 print
'<tr class="oddeven">';
918 print
'<td class="nowrap">';
919 print $sendingstatic->getNomUrl(1);
921 if ($objp->date_creation > 0) {
922 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation),
'day').
'</td>';
924 print
'<td class="right"><b>!!!</b></td>';
927 print
'<td class="nowrap right" width="100" >'.$sendingstatic->LibStatut($objp->statut, 5).
'</td>';
946 if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
948 $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";
949 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"contrat as c";
950 $sql .=
" WHERE c.fk_soc = s.rowid ";
951 $sql .=
" AND s.rowid = ".$object->id;
952 $sql .=
" AND c.entity IN (".getEntity(
'contract').
")";
953 $sql .=
" ORDER BY c.datec DESC";
955 $resql = $db->query($sql);
960 $num = $db->num_rows(
$resql);
963 print
'<div class="div-table-responsive-no-min">';
964 print
'<table class="noborder centpercent lastrecordtable">';
966 print
'<tr class="liste_titre">';
967 print
'<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
"LastContracts", ($num <= $MAXLIST ?
"" : $MAXLIST)).
'</td>';
968 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>';
970 print
'</tr></table></td>';
975 while ($i < $num && $i < $MAXLIST)
977 $objp = $db->fetch_object(
$resql);
979 $contrat->id = $objp->id;
980 $contrat->ref = $objp->ref ? $objp->ref : $objp->id;
981 $contrat->ref_customer = $objp->refcus;
982 $contrat->ref_supplier = $objp->refsup;
983 $contrat->statut = $objp->contract_status;
984 $contrat->fetch_lines();
987 foreach ($contrat->lines as $line) {
988 if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
989 if (((!empty($line->date_fin_validite) ? $line->date_fin_validite : 0) + $conf->contrat->services->expires->warning_delay) < $now) $late =
img_warning($langs->trans(
"Late"));
993 print
'<tr class="oddeven">';
994 print
'<td class="nowrap">';
995 print $contrat->getNomUrl(1, 12);
998 print
'<td class="nowrap">'.dol_trunc($objp->refsup, 12).
"</td>\n";
1000 print
'<td class="right" width="80px"><span title="'.$langs->trans(
"DateContract").
'">'.
dol_print_date($db->jdate($objp->dcon),
'day').
"</span></td>\n";
1001 print
'<td width="20"> </td>';
1002 print
'<td class="nowraponall right">';
1003 print $contrat->getLibStatut(4);
1023 if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
1025 $sql =
"SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate";
1026 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"fichinter as f";
1027 $sql .=
" WHERE f.fk_soc = s.rowid";
1028 $sql .=
" AND s.rowid = ".$object->id;
1029 $sql .=
" AND f.entity IN (".getEntity(
'intervention').
")";
1030 $sql .=
" ORDER BY f.tms DESC";
1032 $resql = $db->query($sql);
1037 $num = $db->num_rows(
$resql);
1040 print
'<div class="div-table-responsive-no-min">';
1041 print
'<table class="noborder centpercent lastrecordtable">';
1043 print
'<tr class="liste_titre">';
1044 print
'<td colspan="3"><table width="100%" class="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.
'">'.$langs->trans(
"AllInterventions").
'<span class="badge marginleftonlyshort">'.$num.
'</span></td>';
1045 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>';
1046 print
'</tr></table></td>';
1051 while ($i < $num && $i < $MAXLIST)
1053 $objp = $db->fetch_object(
$resql);
1055 $fichinter_static->id = $objp->id;
1056 $fichinter_static->statut = $objp->fk_statut;
1058 print
'<tr class="oddeven">';
1059 print
'<td class="nowrap"><a href="'.DOL_URL_ROOT.
'/fichinter/card.php?id='.$objp->id.
'">'.
img_object($langs->trans(
"ShowPropal"),
"propal").
' '.$objp->ref.
'</a></td>'.
"\n";
1061 print
'<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).
'</td>'.
"\n";
1062 print
'<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).
'</td>'.
"\n";
1082 if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
1084 $sql =
'SELECT f.rowid as id, f.titre as ref';
1085 $sql .=
', f.total as total_ht';
1086 $sql .=
', f.tva as total_tva';
1087 $sql .=
', f.total_ttc';
1088 $sql .=
', f.datec as dc';
1089 $sql .=
', f.date_last_gen, f.date_when';
1090 $sql .=
', f.frequency';
1091 $sql .=
', f.unit_frequency';
1092 $sql .=
', f.suspended as suspended';
1093 $sql .=
', s.nom, s.rowid as socid';
1094 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_rec as f";
1095 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
1096 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1097 $sql .=
' GROUP BY f.rowid, f.titre, f.total, f.tva, f.total_ttc,';
1098 $sql .=
' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
1099 $sql .=
' f.suspended, f.date_when,';
1100 $sql .=
' s.nom, s.rowid';
1101 $sql .=
" ORDER BY f.date_last_gen, f.datec DESC";
1103 $resql = $db->query($sql);
1108 $num = $db->num_rows(
$resql);
1111 print
'<div class="div-table-responsive-no-min">';
1112 print
'<table class="noborder centpercent lastrecordtable">';
1114 print
'<tr class="liste_titre">';
1115 print
'<td colspan="4"><table width="100%" class="nobordernopadding"><tr><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.
'">'.$langs->trans(
"AllCustomerTemplateInvoices").
'<span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
1116 print
'</tr></table></td>';
1121 while ($i < $num && $i < $MAXLIST)
1123 $objp = $db->fetch_object(
$resql);
1125 $invoicetemplate->id = $objp->id;
1126 $invoicetemplate->ref = $objp->ref;
1127 $invoicetemplate->suspended = $objp->suspended;
1128 $invoicetemplate->frequency = $objp->frequency;
1129 $invoicetemplate->unit_frequency = $objp->unit_frequency;
1130 $invoicetemplate->total_ht = $objp->total_ht;
1131 $invoicetemplate->total_tva = $objp->total_tva;
1132 $invoicetemplate->total_ttc = $objp->total_ttc;
1133 $invoicetemplate->date_last_gen = $objp->date_last_gen;
1134 $invoicetemplate->date_when = $objp->date_when;
1136 print
'<tr class="oddeven">';
1137 print
'<td class="nowrap">';
1138 print $invoicetemplate->getNomUrl(1);
1140 if ($objp->frequency && $objp->date_last_gen > 0)
1142 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen),
'day').
'</td>';
1146 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc),
'day').
'</td>';
1148 print
'<td class="right"><b>!!!</b></td>';
1151 print
'<td class="right" style="min-width: 60px">';
1152 print
price($objp->total_ht);
1155 if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
1157 print
'<td class="right" style="min-width: 60px">';
1158 print
price($objp->total_ttc);
1162 print
'<td class="nowrap right" style="min-width: 60px">';
1163 print $langs->trans(
'FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).
' - ';
1164 print ($invoicetemplate->LibStatut($invoicetemplate->frequency, $invoicetemplate->suspended, 5, 0));
1184 if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
1186 $sql =
'SELECT f.rowid as facid, f.ref, f.type';
1187 $sql .=
', f.total as total_ht';
1188 $sql .=
', f.tva as total_tva';
1189 $sql .=
', f.total_ttc';
1190 $sql .=
', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
1191 $sql .=
', s.nom, s.rowid as socid';
1192 $sql .=
', SUM(pf.amount) as am';
1193 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture as f";
1194 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiement_facture as pf ON f.rowid=pf.fk_facture';
1195 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
1196 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
1197 $sql .=
' GROUP BY f.rowid, f.ref, f.type, f.total, f.tva, f.total_ttc,';
1198 $sql .=
' f.datef, f.datec, f.paye, f.fk_statut,';
1199 $sql .=
' s.nom, s.rowid';
1200 $sql .=
" ORDER BY f.datef DESC, f.datec DESC";
1202 $resql = $db->query($sql);
1205 $facturestatic =
new Facture($db);
1207 $num = $db->num_rows(
$resql);
1210 print
'<div class="div-table-responsive-no-min">';
1211 print
'<table class="noborder centpercent lastrecordtable">';
1213 print
'<tr class="liste_titre">';
1214 print
'<td colspan="5"><table width="100%" class="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.
'">'.$langs->trans(
"AllBills").
'<span class="badge marginleftonlyshort">'.$num.
'</span></a></td>';
1215 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>';
1216 print
'</tr></table></td>';
1221 while ($i < $num && $i < $MAXLIST)
1223 $objp = $db->fetch_object(
$resql);
1225 $facturestatic->id = $objp->facid;
1226 $facturestatic->ref = $objp->ref;
1227 $facturestatic->type = $objp->type;
1228 $facturestatic->total_ht = $objp->total_ht;
1229 $facturestatic->total_tva = $objp->total_tva;
1230 $facturestatic->total_ttc = $objp->total_ttc;
1232 print
'<tr class="oddeven">';
1233 print
'<td class="nowrap">';
1234 print $facturestatic->getNomUrl(1);
1238 print
'<td class="right" width="80px">'.dol_print_date($db->jdate($objp->df),
'day').
'</td>';
1240 print
'<td class="right"><b>!!!</b></td>';
1242 print
'<td class="right" style="min-width: 60px">';
1243 print
price($objp->total_ht);
1246 if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
1248 print
'<td class="right" style="min-width: 60px">';
1249 print
price($objp->total_ttc);
1253 print
'<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).
'</td>';
1269 print
'</div></div></div>';
1270 print
'<div style="clear:both"></div>';
1279 print
'<div class="tabsAction">';
1281 $parameters = array();
1282 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1284 if (empty($reshook))
1286 if ($object->status != 1)
1288 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyIsClosed")).
'" href="#">'.$langs->trans(
"ThirdPartyIsClosed").
'</a></div>';
1291 if (!empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status == 1)
1293 $langs->load(
"propal");
1294 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>';
1297 if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1)
1299 $langs->load(
"orders");
1300 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>';
1303 if ($user->rights->contrat->creer && $object->status == 1)
1305 $langs->load(
"contracts");
1306 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>';
1309 if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1)
1311 $langs->load(
"fichinter");
1312 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>';
1316 if ($user->socid == 0)
1318 if (!empty($conf->deplacement->enabled) && $object->status == 1)
1320 $langs->load(
"trips");
1321 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>';
1324 if (!empty($conf->facture->enabled) && $object->status == 1)
1326 if (empty($user->rights->facture->creer))
1328 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1330 $langs->loadLangs(array(
"orders",
"bills"));
1332 if (!empty($conf->commande->enabled))
1334 if ($object->client != 0 && $object->client != 2) {
1335 if (!empty($orders2invoice) && $orders2invoice > 0) 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>';
1336 else print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"NoOrdersToInvoice")).
'" href="#">'.$langs->trans(
"CreateInvoiceForThisCustomer").
'</a></div>';
1337 }
else print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1340 if ($object->client != 0 && $object->client != 2) 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>';
1341 else print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans(
"ThirdPartyMustBeEditAsCustomer")).
'" href="#">'.$langs->trans(
"AddBill").
'</a></div>';
1347 if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
1349 if ($user->rights->agenda->myactions->create)
1351 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>';
1353 print
'<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans(
"NotAllowed")).
'" href="#">'.$langs->trans(
"AddAction").
'</a></div>';
1360 if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD))
1366 if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
1377 $langs->load(
"errors");
1378 print $langs->trans(
'ErrorRecordNotFound');
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
Class to manage interventions.
dol_now($mode= 'auto')
Return date for now.
Class to manage invoice templates.
Class to manage Dolibarr users.
Class to manage customers or prospects.
Class to manage contracts.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
show_actions_done($conf, $langs, $db, $filterobj, $objcon= '', $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).
show_contacts($conf, $langs, $db, $object, $backtopage= '')
Show html area for list of contacts.
img_action($titlealt, $numaction, $picto= '')
Show logo action.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
Class to manage shipments.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Class to manage customers orders.
Class to manage members of a foundation.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=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 Calling this function terminate execution ...
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage invoices.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
show_actions_todo($conf, $langs, $db, $filterobj, $objcon= '', $noprint=0, $actioncode= '')
Show html area with actions to do.
Class to manage proposals.