38require
'../main.inc.php';
48require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/timespent.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
60 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
66 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
69 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
72 require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
75 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
78 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
81 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
82 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
85 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
88 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
89 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
92 require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
95 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
98 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
101 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
102 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
105 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
108 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
111 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
114 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
117 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
118 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransferline.class.php';
122$langs->loadLangs(array(
'projects',
'companies',
'suppliers',
'compta'));
124 $langs->load(
"bills");
127 $langs->load(
"orders");
130 $langs->load(
"propal");
133 $langs->load(
"interventions");
136 $langs->load(
"trips");
139 $langs->load(
"trips");
142 $langs->load(
"donations");
145 $langs->load(
"loan");
148 $langs->load(
"salaries");
154 $langs->load(
"eventorganization");
159$action =
GETPOST(
'action',
'aZ09');
160$datesrfc =
GETPOST(
'datesrfc');
161$dateerfc =
GETPOST(
'dateerfc');
164if (empty($dates) && !empty($datesrfc)) {
167if (empty($datee) && !empty($dateerfc)) {
177if ($id ==
'' && $ref ==
'') {
178 setEventMessage($langs->trans(
'ErrorBadParameters'),
'errors');
179 header(
'Location: list.php');
183$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
187include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
188if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
195$hookmanager->initHooks(array(
'projectOverview'));
202 (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire'))
203 || (
isModEnabled(
'supplier_invoice') && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')))
204 || (
isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read'))
205 || (
isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire'))
206 || (
isModEnabled(
'don') && $user->hasRight(
'don',
'lire'))
207 || (
isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire'))
208 || (
isModEnabled(
'bank') && $user->hasRight(
'banque',
'lire'))
212$total_ttc_by_line = 0;
213$total_ht_by_line = 0;
214$expensereport =
null;
216$tmpprojtime = array();
219$extrafields->fetch_name_optionals_label(
$object->table_element);
222$permissiontoadd = $user->hasRight(
'projet',
'creer');
223$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
224$permissiondellink = $user->hasRight(
'projet',
'creer');
225$permissiontoeditextra = $permissiontoadd;
226if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
228 $permissiontoeditextra =
dol_eval($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
236if ($action ==
'update_extras' && $permissiontoeditextra) {
240 $attribute_name =
GETPOST(
'attribute',
'aZ09');
243 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
249 $result =
$object->updateExtraField($attribute_name,
'PROJECT_MODIFY');
257 $action =
'edit_extras';
260if (($action ==
'updateundefinedwithlasthourlyrate' || $action ==
'updateallwithlasthourlyrate') && $permissiontoadd) {
268 $sql =
"SELECT et.rowid as id, u.thm as thmuser";
269 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as et";
270 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"user as u ON u.rowid = et.fk_user";
271 $sql .=
" WHERE et.elementtype = 'task'";
272 $sql .=
" AND et.fk_element = ".((int) $taskid);
273 if ($action ==
'updateundefinedwithlasthourlyrate') {
274 $sql .=
" AND et.thm IS NULL";
277 $resql = $db->query($sql);
279 $num = $db->num_rows($resql);
282 $obj = $db->fetch_object($resql);
283 if (empty($obj->thmuser)) {
288 $res = $timespent->fetch($obj->id);
290 setEventMessages($timespent->error, $timespent->errors,
'errors');
294 $timespent->thm = $obj->thmuser;
295 $res = $timespent->update($user);
297 setEventMessages($timespent->error, $timespent->errors,
'errors');
304 dol_print_error($db);
310 setEventMessages($langs->trans(
"TaskHourlyRateUpdated"),
null);
322$title = $langs->trans(
'ProjectReferers').
' - '.
$object->ref.
' '.
$object->name;
324 $title =
$object->ref.
' '.
$object->name.
' - '.$langs->trans(
'ProjectReferers');
327$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
329llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project page-card_element');
331$form =
new Form($db);
335$userstatic =
new User($db);
338$userAccess =
$object->restrictedProjectArea($user);
346if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
347 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
348 $tmpurl = preg_replace(
'/__SOCID__/', (
string)
$object->socid, $tmpurl);
349 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
351 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
354$morehtmlref =
'<div class="refidno">';
358if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
359 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
361$morehtmlref .=
'</div>';
364if (!$user->hasRight(
'projet',
'all',
'lire')) {
365 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
366 $object->next_prev_filter =
"te.rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
369dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
372print
'<div class="fichecenter">';
373print
'<div class="fichehalfleft">';
374print
'<div class="underbanner clearboth"></div>';
376print
'<table class="border tableforfield centpercent">';
380 print
'<tr><td class="tdtop">';
381 print $langs->trans(
"Usage");
385 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
386 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
387 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
391 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_task ?
' checked="checked"' :
'')).
'"> ';
392 $htmltext = $langs->trans(
"ProjectFollowTasks");
393 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
397 print
'<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
398 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
399 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
403 print
'<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_organize_event ?
' checked="checked"' :
'')).
'"> ';
404 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
405 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
412 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
414 print $formproject->formOpportunityStatus($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->opp_status, $percent_value,
'none',
'none',
'', 1);
418 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
419 if (strcmp(
$object->opp_amount,
'')) {
420 print
'<span class="amount">'.price(
$object->opp_amount, 0, $langs, 1, 0, -1,
$conf->currency).
'</span>';
421 if (strcmp(
$object->opp_percent,
'')) {
422 print
' <span title="'.dol_escape_htmltag($langs->trans(
'OpportunityWeightedAmount')).
'"><span class="opacitymedium">'.$langs->trans(
"OpportunityWeightedAmountShort").
'</span>: <span class="amount">'.
price(
$object->opp_amount *
$object->opp_percent / 100, 0, $langs, 1, 0, -1,
$conf->currency).
'</span></span>';
429print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
430if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount,
'')) {
431 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
436print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
438print($start ? $start :
'?');
441print($end ? $end :
'?');
443 print img_warning(
"Late");
448print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
450 print img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
451 print $langs->trans(
'SharedProject');
453 print img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
454 print $langs->trans(
'PrivateProject');
460include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
465print
'<div class="fichehalfright">';
466print
'<div class="underbanner clearboth"></div>';
468print
'<table class="border tableforfield centpercent">';
472 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
473 print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
478print
'<tr><td class="titlefield'.($object->description ?
' noborderbottom' :
'').
'" colspan="2">'.$langs->trans(
"Description").
'</td></tr>';
480 print
'<tr><td class="nottitleforfield" colspan="2">';
481 print
'<div class="longmessagecut">';
482 print dolPrintHTML(
$object->description);
492print
'<div class="clearboth"></div>';
502$listofreferent = array(
504 'name' =>
"Warehouse",
505 'title' =>
"ListWarehouseAssociatedProject",
506 'class' =>
'Entrepot',
507 'table' =>
'entrepot',
508 'datefieldname' =>
'date_entrepot',
509 'urlnew' => DOL_URL_ROOT.
'/product/stock/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
510 'lang' =>
'entrepot',
511 'buttonnew' =>
'AddWarehouse',
512 'project_field' =>
'fk_project',
513 'testnew' => $user->hasRight(
'stock',
'creer'),
517 'name' =>
"Proposals",
518 'title' =>
"ListProposalsAssociatedProject",
521 'datefieldname' =>
'datep',
522 'urlnew' => DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
524 'buttonnew' =>
'AddProp',
525 'testnew' => $user->hasRight(
'propal',
'creer'),
526 'test' =>
isModEnabled(
'propal') && $user->hasRight(
'propal',
'lire')
529 'name' =>
"CustomersOrders",
530 'title' =>
"ListOrdersAssociatedProject",
531 'class' =>
'Commande',
532 'table' =>
'commande',
533 'datefieldname' =>
'date_commande',
534 'urlnew' => DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
536 'buttonnew' =>
'CreateOrder',
537 'testnew' => $user->hasRight(
'commande',
'creer'),
538 'test' =>
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')
541 'name' =>
"CustomersInvoices",
542 'title' =>
"ListInvoicesAssociatedProject",
543 'class' =>
'Facture',
545 'table' =>
'facture',
546 'datefieldname' =>
'datef',
547 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
549 'buttonnew' =>
'CreateBill',
550 'testnew' => $user->hasRight(
'facture',
'creer'),
551 'test' =>
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
553 'invoice_predefined' => array(
554 'name' =>
"PredefinedInvoices",
555 'title' =>
"ListPredefinedInvoicesAssociatedProject",
556 'class' =>
'FactureRec',
557 'table' =>
'facture_rec',
558 'datefieldname' =>
'datec',
559 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
561 'buttonnew' =>
'CreateBill',
562 'testnew' => $user->hasRight(
'facture',
'creer'),
563 'test' =>
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
565 'proposal_supplier' => array(
566 'name' =>
"SupplierProposals",
567 'title' =>
"ListSupplierProposalsAssociatedProject",
568 'class' =>
'SupplierProposal',
569 'table' =>
'supplier_proposal',
570 'datefieldname' =>
'date_valid',
571 'urlnew' => DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
572 'lang' =>
'supplier_proposal',
573 'buttonnew' =>
'AddSupplierProposal',
574 'testnew' => $user->hasRight(
'supplier_proposal',
'creer'),
575 'test' =>
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')
577 'order_supplier' => array(
578 'name' =>
"SuppliersOrders",
579 'title' =>
"ListSupplierOrdersAssociatedProject",
580 'class' =>
'CommandeFournisseur',
581 'table' =>
'commande_fournisseur',
582 'datefieldname' =>
'date_commande',
583 'urlnew' => DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
584 'lang' =>
'suppliers',
585 'buttonnew' =>
'AddSupplierOrder',
586 'testnew' => $user->hasRight(
'fournisseur',
'commande',
'creer') || $user->hasRight(
'supplier_order',
'creer'),
587 'test' =>
isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'lire')
589 'invoice_supplier' => array(
590 'name' =>
"BillsSuppliers",
591 'title' =>
"ListSupplierInvoicesAssociatedProject",
592 'class' =>
'FactureFournisseur',
594 'table' =>
'facture_fourn',
595 'datefieldname' =>
'datef',
596 'urlnew' => DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
597 'lang' =>
'suppliers',
598 'buttonnew' =>
'AddSupplierInvoice',
599 'testnew' => $user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'),
600 'test' =>
isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')
603 'name' =>
"Contracts",
604 'title' =>
"ListContractAssociatedProject",
605 'class' =>
'Contrat',
606 'table' =>
'contrat',
607 'datefieldname' =>
'date_contrat',
608 'urlnew' => DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
609 'lang' =>
'contracts',
610 'buttonnew' =>
'AddContract',
611 'testnew' => $user->hasRight(
'contrat',
'creer'),
612 'test' =>
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')
614 'intervention' => array(
615 'name' =>
"Interventions",
616 'title' =>
"ListFichinterAssociatedProject",
617 'class' =>
'Fichinter',
618 'table' =>
'fichinter',
619 'datefieldname' =>
'date_valid',
620 'disableamount' => 0,
622 'urlnew' => DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
623 'lang' =>
'interventions',
624 'buttonnew' =>
'AddIntervention',
625 'testnew' => $user->hasRight(
'ficheinter',
'creer'),
626 'test' =>
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')
629 'name' =>
"Shippings",
630 'title' =>
"ListShippingAssociatedProject",
631 'class' =>
'Expedition',
632 'table' =>
'expedition',
633 'datefieldname' =>
'date_valid',
634 'urlnew' => DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
635 'lang' =>
'sendings',
636 'buttonnew' =>
'CreateShipment',
638 'test' =>
isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')
642 'title' =>
"ListMOAssociatedProject",
645 'datefieldname' =>
'date_valid',
646 'urlnew' => DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
648 'buttonnew' =>
'CreateMO',
649 'testnew' => $user->hasRight(
'mrp',
'write'),
650 'project_field' =>
'fk_project',
652 'test' =>
isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')
654 'expensereport' => array(
655 'name' =>
"ExpenseReports",
656 'title' =>
"ListExpenseReportsAssociatedProject",
657 'class' =>
'ExpenseReportLine',
658 'table' =>
'expensereport_det',
659 'datefieldname' =>
'date',
661 'disableamount' => 0,
662 'urlnew' => DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
664 'buttonnew' =>
'AddTrip',
665 'testnew' => $user->hasRight(
'expensereport',
'creer'),
666 'test' =>
isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')
669 'name' =>
"Donation",
670 'title' =>
"ListDonationsAssociatedProject",
674 'datefieldname' =>
'datedon',
675 'disableamount' => 0,
676 'urlnew' => DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
677 'lang' =>
'donations',
678 'buttonnew' =>
'AddDonation',
679 'testnew' => $user->hasRight(
'don',
'creer'),
680 'test' =>
isModEnabled(
'don') && $user->hasRight(
'don',
'lire')
684 'title' =>
"ListLoanAssociatedProject",
688 'datefieldname' =>
'datestart',
689 'disableamount' => 0,
690 'urlnew' => DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
692 'buttonnew' =>
'AddLoan',
693 'testnew' => $user->hasRight(
'loan',
'write'),
694 'test' =>
isModEnabled(
'loan') && $user->hasRight(
'loan',
'read')
696 'chargesociales' => array(
697 'name' =>
"SocialContribution",
698 'title' =>
"ListSocialContributionAssociatedProject",
699 'class' =>
'ChargeSociales',
701 'table' =>
'chargesociales',
702 'datefieldname' =>
'date_ech',
703 'disableamount' => 0,
704 'urlnew' => DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
706 'buttonnew' =>
'AddSocialContribution',
707 'testnew' => $user->hasRight(
'tax',
'charges',
'lire'),
708 'test' =>
isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')
710 'project_task' => array(
711 'name' =>
"TaskTimeSpent",
712 'title' =>
"ListTaskTimeUserProject",
715 'table' =>
'projet_task',
716 'datefieldname' =>
'element_date',
717 'disableamount' => ($canSeeFinancials ? 0 : 1),
718 'urlnew' => DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.
$id.
'&token='.
newToken().
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
719 'buttonnew' =>
'AddTimeSpent',
720 'testnew' => $user->hasRight(
'project',
'creer'),
723 'stocktransfer' => array(
724 'name' =>
"StockTransfer",
725 'title' =>
"ListStockTransferProject",
726 'class' =>
'StockTransfer',
727 'table' =>
'stocktransfer_stocktransfer',
728 'datefieldname' =>
'datem',
730 'project_field' =>
'fk_project',
731 'disableamount' => 1,
732 'urlnew' => DOL_URL_ROOT.
'/product/stock/stocktransfer/stocktransfer_card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
734 'buttonnew' =>
'StockTransferNew',
735 'testnew' => $user->hasRight(
'stocktransfer',
'stocktransfer',
'write'),
736 'test' =>
isModEnabled(
'stocktransfer') && $user->hasRight(
'stocktransfer',
'stocktransfer',
'read')
738 'stock_mouvement' => array(
739 'name' =>
"MouvementStockAssociated",
740 'title' =>
"ListMouvementStockProject",
741 'class' =>
'MouvementStock',
742 'table' =>
'stock_mouvement',
743 'datefieldname' =>
'datem',
745 'project_field' =>
'fk_project',
746 'disableamount' => 0,
750 'name' =>
"Salaries",
751 'title' =>
"ListSalariesAssociatedProject",
754 'datefieldname' =>
'datesp',
756 'disableamount' => 0,
757 'urlnew' => DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
758 'lang' =>
'salaries',
759 'buttonnew' =>
'AddSalary',
760 'testnew' => $user->hasRight(
'salaries',
'write'),
761 'test' =>
isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read')
763 'variouspayment' => array(
764 'name' =>
"VariousPayments",
765 'title' =>
"ListVariousPaymentsAssociatedProject",
766 'class' =>
'PaymentVarious',
767 'table' =>
'payment_various',
768 'datefieldname' =>
'datev',
770 'disableamount' => 0,
771 'urlnew' => DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$id),
773 'buttonnew' =>
'AddVariousPayment',
774 'testnew' => $user->hasRight(
'banque',
'modifier'),
795 foreach ($listofreferent as $key => $element) {
796 if ($listofreferent[$key][
'margin'] ==
'add') {
797 unset($listofreferent[$key][
'margin']);
800 $newelementforplusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_PLUS_MARGIN'));
801 foreach ($newelementforplusmargin as $value) {
802 $listofreferent[trim($value)][
'margin'] =
'add';
806 foreach ($listofreferent as $key => $element) {
807 if ($listofreferent[$key][
'margin'] ==
'minus') {
808 unset($listofreferent[$key][
'margin']);
811 $newelementforminusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_MINUS_MARGIN'));
812 foreach ($newelementforminusmargin as $value) {
813 $listofreferent[trim($value)][
'margin'] =
'minus';
818$parameters = array(
'listofreferent' => $listofreferent);
819$resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
821if (!empty($hookmanager->resArray)) {
822 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
823} elseif ($resHook > 0 && !empty($hookmanager->resPrint)) {
824 $listofreferent = $hookmanager->resPrint;
827if (in_array($action, [
'addelement',
'unlink'])) {
829 $tablename =
GETPOST(
"tablename",
"aZ09");
831 $excludeselect = [
'payment_various'];
832 foreach ($listofreferent as $value) {
833 if (!empty($value[
'test']) && isset($value[
'table']) && $value[
'table'] === $tablename) {
834 $projectField = empty($value[
'project_field']) ?
'fk_projet' : $value[
'project_field'];
835 if (!empty($value[
'exclude_select_element'])) {
836 $excludeselect[] = $value[
'exclude_select_element'];
841 if (!$permissiontoadd || $projectField ===
''
842 || ($action ==
'addelement' && (
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') || in_array($tablename, $excludeselect)))
843 || ($action ==
'unlink' && (in_array($tablename, [
'projet_task',
'stock_mouvement']) || (
getDolGlobalString(
'PROJECT_DISABLE_UNLINK_FROM_OVERVIEW') && !$user->admin)))) {
847 $elementselectid =
GETPOSTINT(
"elementselect");
848 if ($action ==
"addelement") {
849 $result =
$object->update_element($tablename, $elementselectid);
851 $result =
$object->remove_element($tablename, $elementselectid, $projectField);
858$elementuser =
new User($db);
864if (!$showdatefilter) {
865 print
'<div class="center centpercent">';
866 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
867 print
'<input type="hidden" name="token" value="'.newToken().
'">';
868 print
'<input type="hidden" name="tablename" value="'.(empty($tablename) ?
'' : $tablename).
'">';
869 print
'<input type="hidden" name="action" value="view">';
870 print
'<div class="inline-block">';
871 print $form->selectDate($dates,
'dates', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
873 print
'<div class="inline-block">';
874 print $form->selectDate($datee,
'datee', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
876 print
'<div class="inline-block">';
877 print
'<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button small">';
889$langs->loadLangs(array(
"suppliers",
"bills",
"orders",
"proposals",
"margins"));
892 $langs->load(
'stocks');
895print
'<!-- Begin PROFIT table -->';
898print
'<div class="div-table-responsive">';
899print
'<table class="noborder centpercent">';
900print
'<tr class="liste_titre">';
901print
'<td class="left" width="200">';
902$tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
903$tooltiponprofitplus = $tooltiponprofitminus =
'';
904foreach ($listofreferent as $key => $value) {
905 if (!empty($value[
'lang'])) {
906 $langs->load($value[
'lang']);
908 $name = $langs->trans($value[
'name']);
909 $qualified = $value[
'test'];
910 $margin = empty($value[
'margin']) ?
'' : $value[
'margin'];
911 if ($qualified && $margin) {
912 if ($margin ===
'add') {
913 $tooltiponprofitplus .=
' > '.$name.
" (+)<br>\n";
914 } elseif ($margin ===
'minus') {
915 $tooltiponprofitminus .=
' > '.$name.
" (-)<br>\n";
919$tooltiponprofit .= $tooltiponprofitplus;
920$tooltiponprofit .= $tooltiponprofitminus;
921print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
923print
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
924print
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
925print
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
928$total_revenue_ht = 0;
933foreach ($listofreferent as $key => $value) {
935 'total_revenue_ht' => & $total_revenue_ht,
936 'balance_ht' => & $balance_ht,
937 'balance_ttc' => & $balance_ttc,
943 $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action);
945 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
946 } elseif ($reshook > 0) {
947 print $hookmanager->resPrint;
951 $name = $langs->trans($value[
'name']);
952 $title = $value[
'title'];
953 $classname = $value[
'class'];
954 $tablename = $value[
'table'];
955 $datefieldname = $value[
'datefieldname'];
956 $qualified = $value[
'test'];
958 if ($key ===
'project_task' && !$canSeeFinancials) {
961 $margin = empty($value[
'margin']) ? 0 : $value[
'margin'];
962 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
964 $element =
new $classname($db);
966 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
968 if (is_array($elementarray) && count($elementarray) > 0) {
974 $num = count($elementarray);
975 for ($i = 0; $i < $num; $i++) {
976 $tmp = explode(
'_', $elementarray[$i]);
977 $idofelement = (int) $tmp[0];
978 $idofelementuser = !empty($tmp[1]) ? (int) $tmp[1] : 0;
980 $element->fetch($idofelement);
981 if ($idofelementuser) {
982 $elementuser->fetch($idofelementuser);
986 $qualifiedfortotal =
true;
987 if ($key ==
'invoice') {
988 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
989 $qualifiedfortotal =
false;
992 $qualifiedfortotal =
false;
995 $qualifiedfortotal =
false;
998 if ($key ==
'propal') {
1000 $qualifiedfortotal =
false;
1004 if ($tablename !=
'expensereport_det' && method_exists($element,
'fetch_thirdparty')) {
1005 $element->fetch_thirdparty();
1009 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1010 '@phan-var-force ChargeSociales|PaymentVarious|Salary $element';
1011 $total_ht_by_line = $element->amount;
1012 } elseif ($tablename ==
'fichinter') {
1013 '@phan-var-force Fichinter $element';
1014 $total_ht_by_line = $element->getAmount();
1015 } elseif ($tablename ==
'stock_mouvement') {
1016 '@phan-var-force MouvementStock $element';
1017 $total_ht_by_line = $element->price * abs($element->qty);
1018 } elseif ($tablename ==
'projet_task') {
1019 '@phan-var-force Task $element';
1020 $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', (string) $dates, (string) $datee);
1021 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
1022 } elseif ($key ==
'loan') {
1023 '@phan-var-force Loan $element';
1024 if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
1026 $total_ht_by_line = -$element->capital;
1029 $total_ht_by_line = 0;
1031 $loanScheduleStatic->fetchAll($element->id);
1032 if (!empty($loanScheduleStatic->lines)) {
1033 foreach ($loanScheduleStatic->lines as $loanSchedule) {
1037 if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee)
1038 || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <=
dol_now()
1039 || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
1041 $total_ht_by_line -= $loanSchedule->amount_capital;
1047 $total_ht_by_line = $element->total_ht;
1051 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1052 '@phan-var-force ChargeSociales|PaymentVarious|Salary $element';
1053 $total_ttc_by_line = $element->amount;
1054 } elseif ($tablename ==
'fichinter') {
1055 '@phan-var-force Fichinter $element';
1056 $total_ttc_by_line = $element->getAmount();
1057 } elseif ($tablename ==
'stock_mouvement') {
1058 '@phan-var-force MouvementStock $element';
1059 $total_ttc_by_line = $element->price * abs($element->qty);
1060 } elseif ($tablename ==
'projet_task') {
1061 '@phan-var-force Task $element';
1064 if (preg_replace(
'/^(\d+\.)\s\(.*\)/', $defaultvat, $reg)) {
1066 $defaultvat = $reg[1];
1068 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ((
float) $defaultvat / 100)),
'MT');
1069 } elseif ($key ==
'loan') {
1070 $total_ttc_by_line = $total_ht_by_line;
1072 $total_ttc_by_line = $element->total_ttc;
1076 if ($tablename ==
'payment_various') {
1077 if ($element->sens == 1) {
1078 $total_ht_by_line = -$total_ht_by_line;
1079 $total_ttc_by_line = -$total_ttc_by_line;
1087 if (($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_proposal') && $margin !==
'minus') {
1088 $total_ht_by_line = -$total_ht_by_line;
1089 $total_ttc_by_line = -$total_ttc_by_line;
1093 if ($qualifiedfortotal) {
1094 $total_ht += $total_ht_by_line;
1095 $total_ttc += $total_ttc_by_line;
1103 if ($margin ===
'add') {
1104 $total_revenue_ht += $total_ht;
1107 if ($margin ===
"minus") {
1108 $total_ht = -$total_ht;
1109 $total_ttc = -$total_ttc;
1112 $balance_ht += $total_ht;
1113 $balance_ttc += $total_ttc;
1116 print
'<tr class="oddeven">';
1118 print
'<!-- // Module '.$name.
' with tablename '.$tablename.
' -->';
1119 print
'<td class="left"><a href="#table_'.$tablename.
'">'.$name.
'</a></td>';
1121 print
'<td class="right">'.$i.
'</td>';
1123 print
'<td class="right">';
1124 if ($key ==
'intervention' && !$margin) {
1125 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
1126 } elseif ($key ==
'stocktransfer') {
1127 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"NoAmountforStockTransfer")).
'</span>';
1129 if ($key ==
'propal') {
1130 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
1132 print
price($total_ht);
1136 print
'<td class="right">';
1137 if ($key ==
'intervention' && !$margin) {
1138 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
1139 } elseif ($key ==
'stocktransfer') {
1140 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"NoAmountforStockTransfer")).
'</span>';
1142 if ($key ==
'propal') {
1143 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
1145 print
price($total_ttc);
1153print
'<tr class="liste_total">';
1154print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
1155print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
1156print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
1160if (
$object->usage_organize_event) {
1161 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1163 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int)
$object->id).
') AND (t.status:=:'.ConferenceOrBoothAttendee::STATUS_VALIDATED.
')');
1165 if (!is_array($result) && $result < 0) {
1166 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
1168 $nbAttendees = count($result);
1171 if ($nbAttendees >= 2) {
1172 $costperattendee_ht = $balance_ht / $nbAttendees;
1173 $costperattendee_ttc = $balance_ttc / $nbAttendees;
1174 print
'<tr class="liste_total">';
1175 print
'<td class="right" colspan="2">'.$langs->trans(
"ProfitPerValidatedAttendee").
'</td>';
1176 print
'<td class="right">'.price(
price2num($costperattendee_ht,
'MT')).
'</td>';
1177 print
'<td class="right">'.price(
price2num($costperattendee_ttc,
'MT')).
'</td>';
1183if ($total_revenue_ht) {
1184 print
'<tr class="liste_total">';
1185 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
1186 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
1187 print
'<td class="right"></td>';
1193print
'<!-- End PROFIT table -->';
1203foreach ($listofreferent as $key => $value) {
1204 $parameters = array(
1206 'value' => & $value,
1210 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
1212 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1213 } elseif ($reshook > 0) {
1214 print $hookmanager->resPrint;
1218 $title = $value[
'title'];
1219 $classname = $value[
'class'];
1220 $tablename = $value[
'table'];
1221 $datefieldname = $value[
'datefieldname'];
1222 $qualified = $value[
'test'];
1223 $urlnew = empty($value[
'urlnew']) ?
'' : $value[
'urlnew'];
1224 $buttonnew = empty($value[
'buttonnew']) ?
'' : $value[
'buttonnew'];
1225 $testnew = empty($value[
'testnew']) ?
'' : $value[
'testnew'];
1226 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
1227 $nototal = empty($value[
'nototal']) ? 0 : 1;
1229 $exclude_select_element = array(
'payment_various');
1230 if (!empty($value[
'exclude_select_element'])) {
1231 $exclude_select_element[] = $value[
'exclude_select_element'];
1234 if ($qualified && $tablename !==
null) {
1238 $element =
new $classname($db);
1242 $idtofilterthirdparty = 0;
1243 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
1244 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
1245 $idtofilterthirdparty = empty(
$object->thirdparty->id) ? 0 :
$object->thirdparty->id;
1247 $idtofilterthirdparty .=
',' .
getDolGlobalString(
'PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS');
1251 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
1254 if ($permissiontoadd && !
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
1255 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, empty($project_field) ?
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
1256 if ((
int) $selectList < 0) {
1257 setEventMessages($formproject->error, $formproject->errors,
'errors');
1258 } elseif ($selectList) {
1260 $addform .=
'<div class="inline-block valignmiddle">';
1261 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1262 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1263 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
1264 $addform .=
'<input type="hidden" name="action" value="addelement">';
1265 $addform .=
'<input type="hidden" name="page_y" value="">';
1266 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
1267 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
1268 $addform .=
'<table><tr>';
1270 $addform .=
'<td>'.$selectList.
'</td>';
1271 $addform .=
'<td><input type="submit" class="button button-linkto smallpaddingimp reposition" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
1272 $addform .=
'</tr></table>';
1273 $addform .=
'</form>';
1274 $addform .=
'</div>';
1278 $addform .=
'<div class="inline-block valignmiddle">';
1280 $addform .=
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
1282 $addform .=
'<span title="'.dol_escape_htmltag($langs->trans($buttonnew)).
'"><a class="buttonxxx marginleftonly buttonRefused" disabled="disabled" href="#"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a></span>';
1284 $addform .=
'<div>';
1287 if (is_array($elementarray) && count($elementarray) > 0 && $key ==
"order_supplier") {
1288 $addform .=
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1289 <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
1292 $("#btnShow").on("click", function () {
1293 console.log("We click to show or hide the canceled lines");
1294 var attr = $(this).attr("data-canceledarehidden");
1295 if (typeof attr !== "undefined" && attr !== false) {
1296 console.log("Show canceled");
1297 $(".tr_canceled").show();
1298 $("#textBtnShow").text(\''.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'\');
1299 $(
"#btnShow").removeAttr(
"data-canceledarehidden");
1300 $(
"#minus-circle").removeClass(
"fa-eye-slash").addClass(
"fa-eye");
1302 console.log(
"Hide canceled");
1303 $(
".tr_canceled").hide();
1304 $(
"#textBtnShow").text(\
''.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'\');
1305 $(
"#btnShow").attr(
"data-canceledarehidden", 1);
1306 $(
"#minus-circle").removeClass(
"fa-eye").addClass(
"fa-eye-slash");
1311 $addform .= '<div
class=
"inline-block valignmiddle"><a
id=
"btnShowPaid" class=
"buttonxxx marginleftonly" href=
"#" onClick=
"return false;">
1312 <span
id=
"textBtnShowPaid" class=
"valignmiddle text-plus-circle hideonsmartphone">
'.$langs->trans("PaidShown").'</span><span
id=
"minus-circle-paid" class=
"fa fa-eye valignmiddle paddingleft"></span>
1315 $(
"#btnShowPaid").on(
"click",
function () {
1316 console.log(
"We click to show or hide the paid lines");
1317 var attr = $(
this).attr(
"data-paidarehidden");
1318 if (typeof attr !==
"undefined" && attr !==
false) {
1319 console.log(
"Show paid");
1320 $(
".tr_paid").show();
1321 $(
"#textBtnShowPaid").text(\
''.
dol_escape_js($langs->transnoentitiesnoconv(
"PaidShown")).
'\');
1322 $(
"#btnShowPaid").removeAttr(
"data-paidarehidden");
1323 $(
"#minus-circle-paid").removeClass(
"fa-eye-slash").addClass(
"fa-eye");
1325 console.log(
"Hide paid");
1326 $(
".tr_paid").hide();
1327 $(
"#textBtnShowPaid").text(\
''.
dol_escape_js($langs->transnoentitiesnoconv(
"PaidHidden")).
'\');
1328 $(
"#btnShowPaid").attr(
"data-paidarehidden", 1);
1329 $(
"#minus-circle-paid").removeClass(
"fa-eye").addClass(
"fa-eye-slash");
1335 print '<a
id=
"table_'.$tablename.'"></a>
';
1336 print load_fiche_titre($langs->trans($title), $addform, '');
1338 print "\n".'<!-- Table
for tablename =
'.$tablename.' -->
'."\n";
1339 print '<div
class=
"div-table-responsive">
';
1340 print '<
table class=
"noborder centpercent">
';
1342 print '<tr
class=
"liste_titre">
';
1343 $stocktransfercolstyle = ($key == 'stocktransfer
' ? ' style=
"width: 9%"' : '');
1344 // Remove link column
1345 print '<td style=
"width: 24px"></td>
';
1347 if ($key == 'stocktransfer
') {
1348 print '<td
'.$stocktransfercolstyle.'>
'.$langs->trans("Ref").'</td>
';
1350 print '<td
'.(($tablename != 'actioncomm
' && $tablename != 'projet_task
') ? ' style=
"width: 200px"' : '').'>
'.$langs->trans("Ref").'</td>
';
1352 // Product and qty on stock_movement
1354 print '<td style=
"width: 200px">
'.$langs->trans("Product").'</td>
';
1355 print '<td style=
"width: 50px">
'.$langs->trans("Qty").'</td>
';
1358 if ($key != 'stocktransfer
') {
1359 print '<td
'.(($tablename != 'actioncomm
' && $tablename != 'projet_task
') ? ' style=
"width: 200px"' : '').' class=
"center">
';
1360 if (in_array($tablename, array('projet_task
'))) {
1361 print $langs->trans("TimeSpent");
1363 if (!in_array($tablename, array('projet_task
'))) {
1364 print $langs->trans("Date");
1368 if ($key == 'stocktransfer
') {
1369 print '<td
'.$stocktransfercolstyle.'>
'.$langs->trans("WarehouseSource").'</td>
';
1370 print '<td
'.$stocktransfercolstyle.'>
'.$langs->trans("WarehouseDestination").'</td>
';
1371 print '<td
class=
"center"'.$stocktransfercolstyle.'>
'.$langs->trans("DatePrevueDepart").'</td>
';
1372 print '<td
class=
"center"'.$stocktransfercolstyle.'>
'.$langs->trans("DateReelleDepart").'</td>
';
1373 print '<td
class=
"center"'.$stocktransfercolstyle.'>
'.$langs->trans("DatePrevueArrivee").'</td>
';
1374 print '<td
class=
"center"'.$stocktransfercolstyle.'>
'.$langs->trans("DateReelleArrivee").'</td>
';
1376 // Thirdparty or user
1377 print '<td
'.($key == 'stocktransfer
' ? $stocktransfercolstyle : '').'>
';
1378 if (in_array($tablename, array('projet_task
')) && $key == 'project_task
') {
1379 print ''; // if $key == 'project_task
', we don't want details per
user
1380 } elseif (in_array($tablename, array(
'payment_various'))) {
1381 print $langs->trans(
"Label");
1382 } elseif (in_array($tablename, array(
'expensereport_det',
'don',
'projet_task',
'stock_mouvement',
'salary'))) {
1383 print $langs->trans(
"User");
1385 print $langs->trans(
"ThirdParty");
1389 if ($tablename ==
'fichinter') {
1391 print $langs->trans(
"TotalDuration");
1392 $total_duration = 0;
1396 if ($tablename ==
'expensereport_det') {
1397 print
'<td id="expensereport_type">';
1398 print $langs->trans(
"Type");
1402 if ($tablename ==
'expensereport_det') {
1403 print
'<td id="expensereport_description">';
1404 print $langs->trans(
"Description");
1409 $parameters = array(
'key' => $key,
'value' => $value,
'tablename' => $tablename);
1410 $reshook = $hookmanager->executeHooks(
'printOverviewDetailTitle', $parameters, $object, $action);
1412 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1414 print $hookmanager->resPrint;
1419 if ($key ==
'loan') {
1420 print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
1421 } elseif (empty($value[
'disableamount'])) {
1422 if ($key ==
'stocktransfer') {
1423 print
'<td class="right"'.$stocktransfercolstyle.
'>'.$langs->trans(
"AmountHT").
'</td>';
1425 print
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
1428 if ($key ==
'stocktransfer') {
1429 print
'<td'.$stocktransfercolstyle.
'></td>';
1431 print
'<td width="120"></td>';
1436 if ($key ==
'loan') {
1437 print
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
1438 } elseif (empty($value[
'disableamount'])) {
1439 if ($key ==
'stocktransfer') {
1440 print
'<td class="right"'.$stocktransfercolstyle.
'>'.$langs->trans(
"AmountTTC").
'</td>';
1442 print
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
1445 if ($key ==
'stocktransfer') {
1446 print
'<td'.$stocktransfercolstyle.
'></td>';
1448 print
'<td width="120"></td>';
1452 if (in_array($tablename, array(
'projet_task'))) {
1453 print
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
1455 if ($key ==
'stocktransfer') {
1456 print
'<td class="right"'.$stocktransfercolstyle.
'>'.$langs->trans(
"Status").
'</td>';
1458 print
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
1463 if (is_array($elementarray) && count($elementarray) > 0) {
1468 $total_ht_by_third = 0;
1469 $total_ttc_by_third = 0;
1471 $saved_third_id = 0;
1479 $num = count($elementarray);
1481 for ($i = 0; $i < $num; $i++) {
1482 $tmp = explode(
'_', $elementarray[$i]);
1483 $idofelement = (int) $tmp[0];
1484 $idofelementuser = isset($tmp[1]) ? (int) $tmp[1] : 0;
1486 $element->fetch($idofelement);
1487 if ($idofelementuser) {
1488 $elementuser->fetch($idofelementuser);
1492 if ($tablename !=
'expensereport_det') {
1493 if (method_exists($element,
'fetch_thirdparty')) {
1494 $element->fetch_thirdparty();
1498 $expensereport->fetch($element->fk_expensereport);
1503 if ($breakline && $saved_third_id != $element->thirdparty->id) {
1506 $saved_third_id = $element->thirdparty->id;
1509 $total_ht_by_third = 0;
1510 $total_ttc_by_third = 0;
1513 $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
1515 $qualifiedfortotal =
true;
1516 if ($key ==
'invoice') {
1517 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
1518 $qualifiedfortotal =
false;
1520 } elseif ($key ==
'order_supplier' && ($element->status == 6 || $element->status == 7)) {
1521 $qualifiedfortotal =
false;
1524 if ($key ==
"order_supplier" && ($element->status == 6 || $element->status == 7)) {
1525 print
'<tr class="oddeven tr_canceled">';
1526 } elseif ($key ==
"order_supplier" && ($element->billed)) {
1527 print
'<tr class="oddeven tr_paid">';
1529 print
'<tr class="oddeven" >';
1534 print
'<td style="width: 24px">';
1535 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement') {
1536 if ($permissiontoadd && (!
getDolGlobalString(
'PROJECT_DISABLE_UNLINK_FROM_OVERVIEW') || $user->admin)) {
1537 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=unlink&token='.
newToken().
'&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1538 print img_picto($langs->trans(
'Unlink'),
'unlink');
1545 print
'<td class="left nowraponall">';
1546 if ($tablename ==
'expensereport_det') {
1547 print $expensereport->getNomUrl(1);
1549 print
'<table><tr><td style="border-bottom: none;">';
1551 if ($element instanceof
Task) {
1552 print $element->getNomUrl(1,
'withproject',
'time');
1553 print
' - '.dol_trunc($element->label, 48);
1554 } elseif ($key ==
'loan') {
1555 print $element->getNomUrl(1);
1556 print
' - '.dol_trunc($element->label, 48);
1558 print $element->getNomUrl(1);
1561 $element_doc = $element->element;
1563 if (!empty(
$conf->$element_doc)) {
1564 $confelementdoc =
$conf->$element_doc;
1570 if ($element_doc ===
'order_supplier') {
1571 $element_doc =
'commande_fournisseur';
1573 } elseif ($element_doc ===
'invoice_supplier') {
1574 $element_doc =
'facture_fournisseur';
1575 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1576 $filedir =
$conf->fournisseur->facture->multidir_output[$element->entity ??
$conf->entity].
'/'.$filename;
1579 print
'<div class="inline-block valignmiddle">';
1581 print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
1587 print
'<td class="tdoverflowmax250" style="border-bottom: none;">';
1590 if (!empty($element->ref_supplier)) {
1591 print
' - '.$element->ref_supplier;
1594 if (!empty($element->ref_customer)) {
1595 print
' - '.$element->ref_customer;
1598 if (empty($element->ref_customer) && !empty($element->ref_client)) {
1599 print
' - '.$element->ref_client;
1602 print
'</td></tr></table>';
1606 if (
'MouvementStock' == $classname) {
1607 '@phan-var-force MouvementStock $element';
1608 $mvsProd =
new Product($element->db);
1609 $mvsProd->fetch($element->product_id);
1610 print
'<td>'.$mvsProd->getNomUrl(1).
'</td>';
1611 print
'<td>'.$element->qty.
'</td>';
1615 $total_time_by_line = 0;
1616 if ($tablename ==
'expensereport_det') {
1617 '@phan-var-force ExpenseReportLine $element';
1618 $date = $element->date;
1619 } elseif ($tablename ==
'stock_mouvement') {
1620 '@phan-var-force MouvementStock $element';
1621 $date = $element->datem;
1622 } elseif ($tablename ==
'salary') {
1623 '@phan-var-force Salary $element';
1624 $date = $element->datesp;
1625 } elseif ($tablename ==
'payment_various') {
1626 '@phan-var-force PaymentVarious $element';
1627 $date = $element->datev;
1628 } elseif ($tablename ==
'chargesociales') {
1629 '@phan-var-force ChargeSociales $element';
1630 $date = $element->date_ech;
1631 } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
1632 if ($tablename ==
'don') {
1633 '@phan-var-force Don $element';
1634 $date = $element->date;
1636 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
1637 '@phan-var-force CommandeFournisseur $element';
1638 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1639 } elseif ($tablename ==
'supplier_proposal') {
1640 '@phan-var-force SupplierProposal $element';
1641 $date = $element->date_validation;
1642 } elseif ($tablename ==
'fichinter') {
1643 '@phan-var-force Fichinter $element';
1644 $date = $element->datev;
1645 } elseif ($tablename ==
'projet_task') {
1646 '@phan-var-force Task $element';
1649 $date = $element->date;
1651 $date = $element->date_contrat;
1654 $date = $element->datev;
1656 if (empty($date) && !empty($datefieldname)) {
1658 $date = $element->$datefieldname;
1661 } elseif ($key ==
'loan') {
1662 '@phan-var-force Loan $element';
1663 $date = $element->datestart;
1666 if ($key !=
'stocktransfer') {
1667 print
'<td class="center">';
1668 if ($tablename ==
'actioncomm') {
1669 '@phan-var-force ActionComm $element';
1671 if ($element->datef && $element->datef > $element->datep) {
1672 print
" - ".dol_print_date($element->datef,
'dayhour');
1674 } elseif (in_array($tablename, array(
'projet_task'))) {
1675 '@phan-var-force Task $element';
1676 $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', (string) $dates, (string) $datee);
1677 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1680 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1687 if ($key ==
'stocktransfer') {
1688 $warehouseSource =
new Entrepot($db);
1689 $warehouseDestination =
new Entrepot($db);
1690 print
'<td class="tdoverflowmax150">';
1691 if (!empty($element->fk_warehouse_source) && $warehouseSource->fetch($element->fk_warehouse_source) > 0) {
1692 print $warehouseSource->getNomUrl(1);
1695 print
'<td class="tdoverflowmax150">';
1696 if (!empty($element->fk_warehouse_destination) && $warehouseDestination->fetch($element->fk_warehouse_destination) > 0) {
1697 print $warehouseDestination->getNomUrl(1);
1700 print
'<td class="center">'.dol_print_date($element->date_prevue_depart,
'day').
'</td>';
1701 print
'<td class="center">'.dol_print_date($element->date_reelle_depart,
'day').
'</td>';
1702 print
'<td class="center">'.dol_print_date($element->date_prevue_arrivee,
'day').
'</td>';
1703 print
'<td class="center">'.dol_print_date($element->date_reelle_arrivee,
'day').
'</td>';
1707 print
'<td class="tdoverflowmax150">';
1708 if (is_object($element->thirdparty)) {
1709 print $element->thirdparty->getNomUrl(1,
'', 48);
1710 } elseif ($tablename ==
'expensereport_det') {
1711 $tmpuser =
new User($db);
1712 $tmpuser->fetch($expensereport->fk_user_author);
1713 print $tmpuser->getNomUrl(1,
'', 48);
1714 } elseif ($tablename ==
'salary') {
1715 $tmpuser =
new User($db);
1716 $tmpuser->fetch($element->fk_user);
1717 print $tmpuser->getNomUrl(1,
'', 48);
1718 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement') {
1719 '@phan-var-force Don|MouvementStock $element';
1720 if ($element->fk_user_author > 0) {
1721 $tmpuser2 =
new User($db);
1722 $tmpuser2->fetch($element->fk_user_author);
1723 print $tmpuser2->getNomUrl(1,
'', 48);
1725 } elseif ($tablename ==
'projet_task' && $key ==
'element_time') {
1726 print $elementuser->getNomUrl(1);
1727 } elseif ($tablename ==
'payment_various') {
1728 '@phan-var-force PaymentVarious $element';
1729 print $element->label;
1734 if ($tablename ==
'fichinter') {
1735 '@phan-var-force FichInter $element';
1738 $total_duration += $element->duration;
1743 if ($tablename ==
'expensereport_det') {
1744 print
'<td class="left linecoltype">';
1745 $labeltype = ($langs->trans(($element->type_fees_code)) == $element->type_fees_code ? $element->type_fees_libelle : $langs->trans($element->type_fees_code));
1746 print (
string) $labeltype;
1750 if ($tablename ==
'expensereport_det') {
1751 print
'<td class="left linecolcomment">';
1752 print (
string) $element->comments;
1757 $parameters = array(
'key' => $key,
'value' => $value,
'tablename' => $tablename,
'element' => $element,
'i' => $i,
'qualifiedfortotal' => $qualifiedfortotal);
1758 $reshook = $hookmanager->executeHooks(
'printOverviewDetailValue', $parameters, $object, $action);
1760 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1762 print $hookmanager->resPrint;
1766 if (empty($value[
'disableamount'])) {
1767 $total_ht_by_line =
null;
1769 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1770 '@phan-var-force Don|ChargeSociales|PaymentVarious|Salary $element';
1771 $total_ht_by_line = $element->amount;
1772 } elseif ($tablename ==
'fichinter') {
1773 '@phan-var-force FichInter $element';
1774 $total_ht_by_line = $element->getAmount();
1775 } elseif ($tablename ==
'stock_mouvement') {
1776 '@phan-var-force MouvementStock $element';
1777 $total_ht_by_line = $element->price * abs($element->qty);
1778 } elseif (in_array($tablename, array(
'projet_task'))) {
1781 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1782 if (isset($tmpprojtime[
'nblinesnull']) && ($tmpprojtime[
'nblinesnull'] > 0)) {
1783 $langs->load(
"errors");
1784 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate",
$conf->currency);
1787 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1789 } elseif ($key ==
'loan') {
1790 '@phan-var-force Loan $element';
1791 $total_ht_by_line = $element->capital;
1793 $total_ht_by_line = $element->total_ht;
1797 if ($tablename ==
'payment_various') {
1798 if ($element->sens == 0) {
1799 $total_ht_by_line = -$total_ht_by_line;
1803 print
'<td class="right">';
1804 if ($othermessage) {
1805 print
'<span class="opacitymedium">'.$othermessage.
'</span>';
1807 if (isset($total_ht_by_line)) {
1808 if (!$qualifiedfortotal) {
1811 print
'<span class="amount">'.price($total_ht_by_line).
'</span>';
1812 if (!$qualifiedfortotal) {
1817 print
' '.img_warning($warning);
1819 if (isset($tmpprojtime[
'nblinesnull']) && ($tmpprojtime[
'nblinesnull'] > 0)) {
1820 if ($tmpprojtime[
'nbuserthmnull'] > 0) {
1821 $title = $langs->trans(
"EnterUsersHourlyRateFirst");
1822 print
' '.img_picto($title,
"sync",
'', 0, 0, 0,
'',
'opacitymedium');
1824 $title = $langs->trans(
"UpdateUndefinedWithLastHourlyRate");
1825 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateundefinedwithlasthourlyrate&taskid='.$idofelement.
'&token='.
currentToken().
'">'.img_picto($title,
"sync",
'', 0, 0, 0,
'',
'warning').
'</a>';
1828 if (
getDolGlobalString(
'PROJECT_CAN_OVERWRITE_TIMESTPENT_HOURLY_RATE_WITH_LASTONE')) {
1829 $title = $langs->trans(
"UpdateWithLastHourlyRate");
1830 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateallwithlasthourlyrate&taskid='.$idofelement.
'&token='.
currentToken().
'">'.img_picto($title,
"sync",
'', 0, 0, 0,
'',
'').
'</a>';
1838 if (empty($value[
'disableamount'])) {
1839 $total_ttc_by_line =
null;
1840 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1841 '@phan-var-force Don|ChargeSociales|PaymentVarious $element';
1842 $total_ttc_by_line = $element->amount;
1843 } elseif ($tablename ==
'fichinter') {
1844 '@phan-var-force Fichinter $element';
1845 $total_ttc_by_line = $element->getAmount();
1846 } elseif ($tablename ==
'stock_mouvement') {
1847 '@phan-var-force MouvementStock $element';
1848 $total_ttc_by_line = $element->price * abs($element->qty);
1849 } elseif ($tablename ==
'projet_task') {
1853 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1855 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1857 } elseif ($key ==
'loan') {
1858 '@phan-var-force Loan $element';
1859 $total_ttc_by_line = $element->capital - $element->getSumPayment();
1861 $total_ttc_by_line = $element->total_ttc;
1865 if ($tablename ==
'payment_various') {
1866 if ($element->sens == 0) {
1867 $total_ttc_by_line = -$total_ttc_by_line;
1871 print
'<td class="right">';
1872 if ($othermessage) {
1873 print $othermessage;
1875 if (isset($total_ttc_by_line)) {
1876 if (!$qualifiedfortotal) {
1879 print
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
1880 if (!$qualifiedfortotal) {
1885 print
' '.img_warning($warning);
1887 if (isset($tmpprojtime[
'nblinesnull']) && ($tmpprojtime[
'nblinesnull'] > 0)) {
1888 if ($tmpprojtime[
'nbuserthmnull'] > 0) {
1889 $title = $langs->trans(
"EnterUsersHourlyRateFirst");
1890 print
' '.img_picto($title,
"sync",
'', 0, 0, 0,
'',
'opacitymedium');
1892 $title = $langs->trans(
"UpdateUndefinedWithLastHourlyRate");
1893 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateundefinedwithlasthourlyrate&taskid='.$idofelement.
'&token='.
currentToken().
'">'.img_picto($title,
"sync",
'', 0, 0, 0,
'',
'warning').
'</a>';
1896 if (
getDolGlobalString(
'PROJECT_CAN_OVERWRITE_TIMESTPENT_HOURLY_RATE_WITH_LASTONE')) {
1897 $title = $langs->trans(
"UpdateWithLastHourlyRate");
1898 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=updateallwithlasthourlyrate&taskid='.$idofelement.
'&token='.
currentToken().
'">'.img_picto($title,
"sync").
'</a>';
1906 print
'<td class="right">';
1907 if ($tablename ==
'expensereport_det') {
1908 print $expensereport->getLibStatut(5);
1911 print $element->getLibStatut(5, $element->getSommePaiement());
1912 } elseif ($element instanceof
Task) {
1913 if ($element->progress !=
'') {
1914 print $element->progress.
' %';
1916 } elseif ($tablename ==
'stock_mouvement') {
1917 '@phan-var-force MouvementStock $element';
1918 print $element->getLibStatut(3);
1920 print $element->getLibStatut(5);
1926 if ($qualifiedfortotal) {
1927 $total_ht += $total_ht_by_line;
1928 $total_ttc += $total_ttc_by_line;
1930 $total_ht_by_third += $total_ht_by_line;
1931 $total_ttc_by_third += $total_ttc_by_line;
1933 $total_time += $total_time_by_line;
1937 $breakline =
'<tr class="liste_total liste_sub_total">';
1938 $breakline .=
'<td colspan="2">';
1939 $breakline .=
'</td>';
1940 $breakline .=
'<td>';
1941 $breakline .=
'</td>';
1942 $breakline .=
'<td class="right">';
1943 $breakline .= $langs->trans(
'SubTotal').
' : ';
1944 if (is_object($element->thirdparty)) {
1945 $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1947 $breakline .=
'</td>';
1948 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1949 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1950 $breakline .=
'<td></td>';
1951 $breakline .=
'</tr>';
1962 if (empty($nototal)) {
1964 if (in_array($tablename, array(
'projet_task'))) {
1967 if ($key ==
'stocktransfer') {
1971 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1972 if (in_array($tablename, array(
'projet_task'))) {
1973 print
'<td class="center">';
1982 if ($tablename ==
'fichinter') {
1983 print
'<td class="left">'.convertSecondToTime($total_duration,
'all',
$conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1986 $parameters = array(
'key' => $key,
'value' => $value,
'tablename' => $tablename,
'nbelement' => $i);
1987 $reshook = $hookmanager->executeHooks(
'printOverviewDetailTotal', $parameters, $object, $action);
1989 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1991 print $hookmanager->resPrint;
1992 print
'<td class="right">';
1993 if (empty($value[
'disableamount'])) {
1994 if ($key ==
'loan') {
1995 print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1996 } elseif ($tablename !=
'projet_task' ||
isModEnabled(
'salaries')) {
1997 print
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
2003 print
'<td class="right">';
2004 if (empty($value[
'disableamount'])) {
2005 if ($key ==
'loan') {
2006 print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
2007 } elseif ($tablename !=
'projet_task' ||
isModEnabled(
'salaries')) {
2008 print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
2012 print
'<td> </td>';
2014 if ($tablename ==
'expensereport_det') {
2015 print
'<td> </td>';
2016 print
'<td> </td>';
2021 if (!is_array($elementarray)) {
2022 print
'<tr><td>'.$elementarray.
'</td></tr>';
2025 if ($tablename ==
'fichinter') {
2028 if ($key ==
'stocktransfer') {
2031 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
2041if (
$conf->use_javascript_ajax) {
2042 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
2045 print $comboenhancement;
2067 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
2078 global $db, $classname;
2079 '@phan-var-force string $classname';
2081 $element =
new $classname($db);
2082 '@phan-var-force CommonObject $element';
2084 $clientname = array();
2085 foreach ($elementarray as $key =>
$id) {
2086 if (empty($clientname[
$id])) {
2087 $element->fetch(
$id);
2088 $element->fetch_thirdparty();
2090 $clientname[
$id] = $element->thirdparty->name;
2097 $elementarray = array();
2098 foreach ($clientname as
$id => $name) {
2099 $elementarray[] =
$id;
2102 return $elementarray;
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
Convert a html select field into an ajax combobox.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Superclass for invoice classes.
Class for ConferenceOrBoothAttendee.
Class to manage warehouses.
Class to manage Trips and Expenses.
const TYPE_DEPOSIT
Deposit invoice.
const STATUS_CLOSED
Classified paid.
Class to manage Schedule of loans.
Class to manage stock movements.
Class to manage products or services.
Class to manage projects.
const STATUS_SIGNED
Signed quote.
const STATUS_BILLED
Billed or processed quote.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_stringtotime($string, $gm=1, $processnotimeasnoon=0)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
sortElementsByClientName($elementarray)
sortElementsByClientName
canApplySubtotalOn($tablename)
Return if we should do a group by customer with sub-total.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
$conf db user
Active Directory does not allow anonymous connections.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
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.
treeview li table
No Email.