33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40if (isModEnabled(
'stock')) {
41 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
43if (isModEnabled(
"propal")) {
44 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
46if (isModEnabled(
'facture')) {
47 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
50if (isModEnabled(
'commande')) {
51 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
53if (isModEnabled(
'supplier_proposal')) {
54 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
56if (isModEnabled(
"supplier_invoice")) {
57 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
59if (isModEnabled(
"supplier_order")) {
60 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
62if (isModEnabled(
'contrat')) {
63 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
65if (isModEnabled(
'ficheinter')) {
66 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
68if (isModEnabled(
"expedition")) {
69 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
71if (isModEnabled(
'deplacement')) {
72 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
74if (isModEnabled(
'expensereport')) {
75 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
77if (isModEnabled(
'agenda')) {
78 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
80if (isModEnabled(
'don')) {
81 require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
83if (isModEnabled(
'loan')) {
84 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
85 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
87if (isModEnabled(
'stock')) {
88 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
90if (isModEnabled(
'tax')) {
91 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
93if (isModEnabled(
"banque")) {
94 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
96if (isModEnabled(
'salaries')) {
97 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
99if (isModEnabled(
'categorie')) {
100 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
102if (isModEnabled(
'mrp')) {
103 require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
107$langs->loadLangs(array(
'projects',
'companies',
'suppliers',
'compta'));
108if (isModEnabled(
'facture')) {
109 $langs->load(
"bills");
111if (isModEnabled(
'commande')) {
112 $langs->load(
"orders");
114if (isModEnabled(
"propal")) {
115 $langs->load(
"propal");
117if (isModEnabled(
'ficheinter')) {
118 $langs->load(
"interventions");
120if (isModEnabled(
'deplacement')) {
121 $langs->load(
"trips");
123if (isModEnabled(
'expensereport')) {
124 $langs->load(
"trips");
126if (isModEnabled(
'don')) {
127 $langs->load(
"donations");
129if (isModEnabled(
'loan')) {
130 $langs->load(
"loan");
132if (isModEnabled(
'salaries')) {
133 $langs->load(
"salaries");
135if (isModEnabled(
'mrp')) {
138if (isModEnabled(
'eventorganization')) {
139 $langs->load(
"eventorganization");
144$action =
GETPOST(
'action',
'aZ09');
145$datesrfc =
GETPOST(
'datesrfc');
146$dateerfc =
GETPOST(
'dateerfc');
149if (empty($dates) && !empty($datesrfc)) {
152if (empty($datee) && !empty($dateerfc)) {
155if (!GETPOSTISSET(
'datesrfc') && !GETPOSTISSET(
'datesday') && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR)) {
162if ($id ==
'' && $ref ==
'') {
164 header(
'Location: list.php');
168$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
173include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
174if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) {
175 $object->fetchComments();
179$socid = $object->socid;
181$result =
restrictedArea($user,
'projet', $object->id,
'projet&project');
183$hookmanager->initHooks(array(
'projectOverview'));
190$title = $langs->trans(
'ProjectReferers').
' - '.$object->ref.
' '.$object->name;
191if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
192 $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
'ProjectReferers');
195$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
199$form =
new Form($db);
203$userstatic =
new User($db);
206$userAccess = $object->restrictedProjectArea($user);
209print
dol_get_fiche_head($head,
'element', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
214if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
215 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
216 $tmpurl = preg_replace(
'/__SOCID__/', $object->socid, $tmpurl);
217 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
219 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
222$morehtmlref =
'<div class="refidno">';
224$morehtmlref .= $object->title;
226if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
227 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
229$morehtmlref .=
'</div>';
232if (empty($user->rights->projet->all->lire)) {
233 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
234 $object->next_prev_filter =
"te.rowid IN (".$db->sanitize(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
237dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
240print
'<div class="fichecenter">';
241print
'<div class="fichehalfleft">';
242print
'<div class="underbanner clearboth"></div>';
244print
'<table class="border tableforfield centpercent">';
247if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled(
'eventorganization')) {
248 print
'<tr><td class="tdtop">';
249 print $langs->trans(
"Usage");
252 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
253 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
254 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
255 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
258 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
259 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
260 $htmltext = $langs->trans(
"ProjectFollowTasks");
261 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
264 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
265 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"' :
'')).
'"> ';
266 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
267 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
270 if (isModEnabled(
'eventorganization')) {
271 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"' :
'')).
'"> ';
272 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
273 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
279print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
280if ($object->public) {
281 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
282 print $langs->trans(
'SharedProject');
284 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
285 print $langs->trans(
'PrivateProject');
289if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
291 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
292 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
294 print $langs->trans(
"OppStatus".$code);
299 print
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
300 if (!is_null($object->opp_percent) && strcmp($object->opp_percent,
'')) {
301 print
price($object->opp_percent,
'', $langs, 1, 0).
' %';
306 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
307 if (!is_null($object->opp_amount) && strcmp($object->opp_amount,
'')) {
308 print
'<span class="amount">'.price($object->opp_amount,
'', $langs, 1, 0, 0, $conf->currency).
'</span>';
309 if (strcmp($object->opp_percent,
'')) {
310 print
' <span title="'.dol_escape_htmltag($langs->trans(
'OpportunityWeightedAmount')).
'"><span class="opacitymedium">'.$langs->trans(
"Weighted").
'</span>: <span class="amount">'.
price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).
'</span></span>';
317print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
318if (!is_null($object->budget_amount) && strcmp($object->budget_amount,
'')) {
319 print
'<span class="amount">'.price($object->budget_amount,
'', $langs, 1, 0, 0, $conf->currency).
'</span>';
324print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
326print ($start ? $start :
'?');
329print ($end ? $end :
'?');
330if ($object->hasDelay()) {
337include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
342print
'<div class="fichehalfright">';
343print
'<div class="underbanner clearboth"></div>';
345print
'<table class="border tableforfield centpercent">';
348print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
353if (isModEnabled(
'categorie')) {
354 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
355 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
364print
'<div class="clearboth"></div>';
374$listofreferent = array(
377 'title'=>
"ListWarehouseAssociatedProject",
380 'datefieldname'=>
'date_entrepot',
381 'urlnew'=>DOL_URL_ROOT.
'/product/stock/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
383 'buttonnew'=>
'AddWarehouse',
384 'project_field'=>
'fk_project',
385 'testnew'=>$user->hasRight(
'stock',
'creer'),
386 'test'=>isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT)
390 'title'=>
"ListProposalsAssociatedProject",
393 'datefieldname'=>
'datep',
394 'urlnew'=>DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
396 'buttonnew'=>
'AddProp',
397 'testnew'=>$user->hasRight(
'propal',
'creer'),
398 'test'=>isModEnabled(
'propal') && $user->hasRight(
'propal',
'lire')
401 'name'=>
"CustomersOrders",
402 'title'=>
"ListOrdersAssociatedProject",
405 'datefieldname'=>
'date_commande',
406 'urlnew'=>DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
408 'buttonnew'=>
'CreateOrder',
409 'testnew'=>$user->hasRight(
'commande',
'creer'),
410 'test'=>isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')
413 'name'=>
"CustomersInvoices",
414 'title'=>
"ListInvoicesAssociatedProject",
418 'datefieldname'=>
'datef',
419 'urlnew'=>DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
421 'buttonnew'=>
'CreateBill',
422 'testnew'=>$user->hasRight(
'facture',
'creer'),
423 'test'=>isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')
425 'invoice_predefined'=>array(
426 'name'=>
"PredefinedInvoices",
427 'title'=>
"ListPredefinedInvoicesAssociatedProject",
428 'class'=>
'FactureRec',
429 'table'=>
'facture_rec',
430 'datefieldname'=>
'datec',
431 'urlnew'=>DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
433 'buttonnew'=>
'CreateBill',
434 'testnew'=>$user->hasRight(
'facture',
'creer'),
435 'test'=>isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')
437 'proposal_supplier'=>array(
438 'name'=>
"SupplierProposals",
439 'title'=>
"ListSupplierProposalsAssociatedProject",
440 'class'=>
'SupplierProposal',
441 'table'=>
'supplier_proposal',
442 'datefieldname'=>
'date_valid',
443 'urlnew'=>DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
444 'lang'=>
'supplier_proposal',
445 'buttonnew'=>
'AddSupplierProposal',
446 'testnew'=>$user->hasRight(
'supplier_proposal',
'creer'),
447 'test'=>isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')
449 'order_supplier'=>array(
450 'name'=>
"SuppliersOrders",
451 'title'=>
"ListSupplierOrdersAssociatedProject",
452 'class'=>
'CommandeFournisseur',
453 'table'=>
'commande_fournisseur',
454 'datefieldname'=>
'date_commande',
455 'urlnew'=>DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
457 'buttonnew'=>
'AddSupplierOrder',
458 'testnew'=>$user->hasRight(
'fournisseur',
'commande',
'creer') || $user->hasRight(
'supplier_order',
'creer'),
459 'test'=>isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'lire')
461 'invoice_supplier'=>array(
462 'name'=>
"BillsSuppliers",
463 'title'=>
"ListSupplierInvoicesAssociatedProject",
464 'class'=>
'FactureFournisseur',
466 'table'=>
'facture_fourn',
467 'datefieldname'=>
'datef',
468 'urlnew'=>DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
470 'buttonnew'=>
'AddSupplierInvoice',
471 'testnew'=>$user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'),
472 'test'=>isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')
476 'title'=>
"ListContractAssociatedProject",
479 'datefieldname'=>
'date_contrat',
480 'urlnew'=>DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
482 'buttonnew'=>
'AddContract',
483 'testnew'=>$user->hasRight(
'contrat',
'creer'),
484 'test'=>isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')
486 'intervention'=>array(
487 'name'=>
"Interventions",
488 'title'=>
"ListFichinterAssociatedProject",
489 'class'=>
'Fichinter',
490 'table'=>
'fichinter',
491 'datefieldname'=>
'date_valid',
494 'urlnew'=>DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
495 'lang'=>
'interventions',
496 'buttonnew'=>
'AddIntervention',
497 'testnew'=>$user->hasRight(
'ficheinter',
'creer'),
498 'test'=>isModEnabled(
'ficheinter') && $user->hasRight(
'ficheinter',
'lire')
502 'title'=>
"ListShippingAssociatedProject",
503 'class'=>
'Expedition',
504 'table'=>
'expedition',
505 'datefieldname'=>
'date_valid',
506 'urlnew'=>DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
508 'buttonnew'=>
'CreateShipment',
510 'test'=>isModEnabled(
'expedition') && $user->hasRight(
'expedition',
'lire')
514 'title'=>
"ListMOAssociatedProject",
517 'datefieldname'=>
'date_valid',
518 'urlnew'=>DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
520 'buttonnew'=>
'CreateMO',
521 'testnew'=>$user->hasRight(
'mrp',
'write'),
522 'project_field'=>
'fk_project',
524 'test'=>isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')
527 'name'=>
"TripsAndExpenses",
528 'title'=>
"ListExpenseReportsAssociatedProject",
529 'class'=>
'Deplacement',
530 'table'=>
'deplacement',
531 'datefieldname'=>
'dated',
534 'urlnew'=>DOL_URL_ROOT.
'/deplacement/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
536 'buttonnew'=>
'AddTrip',
537 'testnew'=>$user->hasRight(
'deplacement',
'creer'),
538 'test'=>isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')
540 'expensereport'=>array(
541 'name'=>
"ExpenseReports",
542 'title'=>
"ListExpenseReportsAssociatedProject",
543 'class'=>
'ExpenseReportLine',
544 'table'=>
'expensereport_det',
545 'datefieldname'=>
'date',
548 'urlnew'=>DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
550 'buttonnew'=>
'AddTrip',
551 'testnew'=>$user->hasRight(
'expensereport',
'creer'),
552 'test'=>isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')
556 'title'=>
"ListDonationsAssociatedProject",
560 'datefieldname'=>
'datedon',
562 'urlnew'=>DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
564 'buttonnew'=>
'AddDonation',
565 'testnew'=>$user->hasRight(
'don',
'creer'),
566 'test'=>isModEnabled(
'don') && $user->hasRight(
'don',
'lire')
570 'title'=>
"ListLoanAssociatedProject",
574 'datefieldname'=>
'datestart',
576 'urlnew'=>DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
578 'buttonnew'=>
'AddLoan',
579 'testnew'=>$user->hasRight(
'loan',
'write'),
580 'test'=>isModEnabled(
'loan') && $user->hasRight(
'loan',
'read')
582 'chargesociales'=>array(
583 'name'=>
"SocialContribution",
584 'title'=>
"ListSocialContributionAssociatedProject",
585 'class'=>
'ChargeSociales',
587 'table'=>
'chargesociales',
588 'datefieldname'=>
'date_ech',
590 'urlnew'=>DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
592 'buttonnew'=>
'AddSocialContribution',
593 'testnew'=>$user->hasRight(
'tax',
'charges',
'lire'),
594 'test'=>isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')
596 'project_task'=>array(
597 'name'=>
"TaskTimeSpent",
598 'title'=>
"ListTaskTimeUserProject",
601 'table'=>
'projet_task',
602 'datefieldname'=>
'element_date',
604 'urlnew'=>DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
605 'buttonnew'=>
'AddTimeSpent',
606 'testnew'=>$user->hasRight(
'project',
'creer'),
607 'test'=>isModEnabled(
'project') && $user->hasRight(
'projet',
'lire') && empty($conf->global->PROJECT_HIDE_TASKS)
609 'stock_mouvement'=>array(
610 'name'=>
"MouvementStockAssociated",
611 'title'=>
"ListMouvementStockProject",
612 'class'=>
'MouvementStock',
613 'table'=>
'stock_mouvement',
614 'datefieldname'=>
'datem',
617 'test'=>isModEnabled(
'stock') && $user->hasRight(
'stock',
'mouvement',
'lire') && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)
621 'title'=>
"ListSalariesAssociatedProject",
624 'datefieldname'=>
'datesp',
627 'urlnew'=>DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
629 'buttonnew'=>
'AddSalary',
630 'testnew'=>$user->hasRight(
'salaries',
'write'),
631 'test'=>isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read')
633 'variouspayment'=>array(
634 'name'=>
"VariousPayments",
635 'title'=>
"ListVariousPaymentsAssociatedProject",
636 'class'=>
'PaymentVarious',
637 'table'=>
'payment_various',
638 'datefieldname'=>
'datev',
641 'urlnew'=>DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
643 'buttonnew'=>
'AddVariousPayment',
644 'testnew'=>$user->hasRight(
'banque',
'modifier'),
645 'test'=>isModEnabled(
"banque") && $user->hasRight(
'banque',
'lire') && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)
664if (!empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) {
665 foreach ($listofreferent as $key => $element) {
666 if ($listofreferent[$key][
'margin'] ==
'add') {
667 unset($listofreferent[$key][
'margin']);
670 $newelementforplusmargin = explode(
',', $conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN);
671 foreach ($newelementforplusmargin as $value) {
672 $listofreferent[trim($value)][
'margin'] =
'add';
675if (!empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) {
676 foreach ($listofreferent as $key => $element) {
677 if ($listofreferent[$key][
'margin'] ==
'minus') {
678 unset($listofreferent[$key][
'margin']);
681 $newelementforminusmargin = explode(
',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN);
682 foreach ($newelementforminusmargin as $value) {
683 $listofreferent[trim($value)][
'margin'] =
'minus';
688$parameters = array(
'listofreferent'=>$listofreferent);
689$resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
691if (!empty($hookmanager->resArray)) {
692 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
695if ($action ==
"addelement") {
696 $tablename =
GETPOST(
"tablename");
697 $elementselectid =
GETPOST(
"elementselect");
698 $result = $object->update_element($tablename, $elementselectid);
702} elseif ($action ==
"unlink") {
703 $tablename =
GETPOST(
"tablename",
"aZ09");
704 $projectField = GETPOSTISSET(
'projectfield') ?
GETPOST(
'projectfield',
'aZ09') :
'fk_projet';
705 $elementselectid =
GETPOST(
"elementselect",
"int");
707 $result = $object->remove_element($tablename, $elementselectid, $projectField);
713$elementuser =
new User($db);
719if (!$showdatefilter) {
720 print
'<div class="center centpercent">';
721 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="POST">';
722 print
'<input type="hidden" name="token" value="'.newToken().
'">';
723 print
'<input type="hidden" name="tablename" value="'.(empty($tablename) ?
'' : $tablename).
'">';
724 print
'<input type="hidden" name="action" value="view">';
725 print
'<div class="inline-block">';
726 print $form->selectDate($dates,
'dates', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
728 print
'<div class="inline-block">';
729 print $form->selectDate($datee,
'datee', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
731 print
'<div class="inline-block">';
732 print
'<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button small">';
744$langs->loadLangs(array(
"suppliers",
"bills",
"orders",
"proposals",
"margins"));
746if (isModEnabled(
'stock')) {
747 $langs->load(
'stocks');
752print
'<table class="noborder centpercent">';
753print
'<tr class="liste_titre">';
754print
'<td class="left" width="200">';
755$tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
756$tooltiponprofitplus = $tooltiponprofitminus =
'';
757foreach ($listofreferent as $key => $value) {
758 if (!empty($value[
'lang'])) {
759 $langs->load($value[
'lang']);
761 $name = $langs->trans($value[
'name']);
762 $qualified = $value[
'test'];
763 $margin = empty($value[
'margin']) ?
'' : $value[
'margin'];
764 if ($qualified && isset($margin)) {
765 if ($margin ===
'add') {
766 $tooltiponprofitplus .=
' > '.$name.
" (+)<br>\n";
768 if ($margin ===
'minus') {
769 $tooltiponprofitminus .=
' > '.$name.
" (-)<br>\n";
773$tooltiponprofit .= $tooltiponprofitplus;
774$tooltiponprofit .= $tooltiponprofitminus;
775print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
777print
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
778print
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
779print
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
782$total_revenue_ht = 0;
787foreach ($listofreferent as $key => $value) {
789 'total_revenue_ht' =>& $total_revenue_ht,
790 'balance_ht' =>& $balance_ht,
791 'balance_ttc' =>& $balance_ttc,
797 $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action);
800 } elseif ($reshook > 0) {
801 print $hookmanager->resPrint;
805 $name = $langs->trans($value[
'name']);
806 $title = $value[
'title'];
807 $classname = $value[
'class'];
808 $tablename = $value[
'table'];
809 $datefieldname = $value[
'datefieldname'];
810 $qualified = $value[
'test'];
811 $margin = empty($value[
'margin']) ? 0 : $value[
'margin'];
812 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
813 if ($qualified && isset($margin)) {
814 $element =
new $classname($db);
816 $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
818 if (is_array($elementarray) && count($elementarray) > 0) {
823 $num = count($elementarray);
824 for ($i = 0; $i < $num; $i++) {
825 $tmp = explode(
'_', $elementarray[$i]);
826 $idofelement = $tmp[0];
827 $idofelementuser = !empty($tmp[1]) ? $tmp[1] :
"";
829 $element->fetch($idofelement);
830 if ($idofelementuser) {
831 $elementuser->fetch($idofelementuser);
835 $qualifiedfortotal =
true;
836 if ($key ==
'invoice') {
837 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
838 $qualifiedfortotal =
false;
840 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type ==
Facture::TYPE_DEPOSIT) {
841 $qualifiedfortotal =
false;
844 if ($key ==
'propal') {
846 $qualifiedfortotal =
false;
850 if ($tablename !=
'expensereport_det' && method_exists($element,
'fetch_thirdparty')) {
851 $element->fetch_thirdparty();
855 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
856 $total_ht_by_line = $element->amount;
857 } elseif ($tablename ==
'fichinter') {
858 $total_ht_by_line = $element->getAmount();
859 } elseif ($tablename ==
'stock_mouvement') {
860 $total_ht_by_line = $element->price * abs($element->qty);
861 } elseif ($tablename ==
'projet_task') {
862 if ($idofelementuser) {
863 $tmp = $element->getSumOfAmount($elementuser, $dates, $datee);
864 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
866 $tmp = $element->getSumOfAmount(
'', $dates, $datee);
867 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
869 } elseif ($key ==
'loan') {
870 if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
872 $total_ht_by_line = -$element->capital;
875 $total_ht_by_line = 0;
877 $loanScheduleStatic->fetchAll($element->id);
878 if (!empty($loanScheduleStatic->lines)) {
879 foreach ($loanScheduleStatic->lines as $loanSchedule) {
883 if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee)
884 || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <=
dol_now()
885 || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
887 $total_ht_by_line -= $loanSchedule->amount_capital;
893 $total_ht_by_line = $element->total_ht;
897 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
898 $total_ttc_by_line = $element->amount;
899 } elseif ($tablename ==
'fichinter') {
900 $total_ttc_by_line = $element->getAmount();
901 } elseif ($tablename ==
'stock_mouvement') {
902 $total_ttc_by_line = $element->price * abs($element->qty);
903 } elseif ($tablename ==
'projet_task') {
905 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
906 } elseif ($key ==
'loan') {
907 $total_ttc_by_line = $total_ht_by_line;
909 $total_ttc_by_line = $element->total_ttc;
913 if ($tablename ==
'payment_various') {
914 if ($element->sens == 1) {
915 $total_ht_by_line = -$total_ht_by_line;
916 $total_ttc_by_line = -$total_ttc_by_line;
921 if ($qualifiedfortotal) {
922 $total_ht = $total_ht + $total_ht_by_line;
923 $total_ttc = $total_ttc + $total_ttc_by_line;
931 if ($margin ===
'add') {
932 $total_revenue_ht += $total_ht;
935 if ($margin ===
"minus") {
936 $total_ht = -$total_ht;
937 $total_ttc = -$total_ttc;
940 $balance_ht += $total_ht;
941 $balance_ttc += $total_ttc;
944 print
'<tr class="oddeven">';
946 print
'<td class="left">'.$name.
'</td>';
948 print
'<td class="right">'.$i.
'</td>';
950 print
'<td class="right">';
951 if ($key ==
'intervention' && !$margin) {
952 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
954 if ($key ==
'propal') {
955 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
957 print
price($total_ht);
961 print
'<td class="right">';
962 if ($key ==
'intervention' && !$margin) {
963 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
965 if ($key ==
'propal') {
966 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
968 print
price($total_ttc);
976print
'<tr class="liste_total">';
977print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
978print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
979print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
983if ($total_revenue_ht) {
984 print
'<tr class="liste_total">';
985 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
986 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
987 print
'<td class="right"></td>';
1000foreach ($listofreferent as $key => $value) {
1001 $parameters = array(
1007 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
1010 } elseif ($reshook > 0) {
1011 print $hookmanager->resPrint;
1015 $title = $value[
'title'];
1016 $classname = $value[
'class'];
1017 $tablename = $value[
'table'];
1018 $datefieldname = $value[
'datefieldname'];
1019 $qualified = $value[
'test'];
1020 $urlnew = empty($value[
'urlnew']) ?
'' : $value[
'urlnew'];
1021 $buttonnew = empty($value[
'buttonnew']) ?
'' : $value[
'buttonnew'];
1022 $testnew = empty($value[
'testnew']) ?
'' : $value[
'testnew'];
1023 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
1024 $nototal = empty($value[
'nototal']) ? 0 : 1;
1026 $exclude_select_element = array(
'payment_various');
1027 if (!empty($value[
'exclude_select_element'])) {
1028 $exclude_select_element[] = $value[
'exclude_select_element'];
1035 $element =
new $classname($db);
1039 $idtofilterthirdparty = 0;
1040 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
1041 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
1042 $idtofilterthirdparty = empty($object->thirdparty->id) ? 0 : $object->thirdparty->id;
1043 if (!empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) {
1044 $idtofilterthirdparty .=
','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
1048 $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
1051 if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
1052 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, empty($project_field) ?
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
1053 if ($selectList < 0) {
1055 } elseif ($selectList) {
1057 $addform .=
'<div class="inline-block valignmiddle">';
1058 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1059 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1060 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
1061 $addform .=
'<input type="hidden" name="action" value="addelement">';
1062 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
1063 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
1064 $addform .=
'<table><tr>';
1066 $addform .=
'<td>'.$selectList.
'</td>';
1067 $addform .=
'<td><input type="submit" class="button button-linkto smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
1068 $addform .=
'</tr></table>';
1069 $addform .=
'</form>';
1070 $addform .=
'</div>';
1073 if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew) {
1074 $addform .=
'<div class="inline-block valignmiddle">';
1076 $addform .=
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
1077 } elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
1078 $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>';
1080 $addform .=
'<div>';
1083 if (is_array($elementarray) && count($elementarray) > 0 && $key ==
"order_supplier") {
1084 $addform =
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1085 <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
1088 $("#btnShow").on("click", function () {
1089 console.log("We click to show or hide the canceled lines");
1090 var attr = $(this).attr("data-canceledarehidden");
1091 if (typeof attr !== "undefined" && attr !== false) {
1092 console.log("Show canceled");
1093 $(".tr_canceled").show();
1094 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'");
1095 $("#btnShow").removeAttr("data-canceledarehidden");
1096 $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye");
1098 console.log("Hide canceled");
1099 $(".tr_canceled").hide();
1100 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'");
1101 $("#btnShow").attr("data-canceledarehidden", 1);
1102 $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash");
1105 </script></div> '.$addform;
1110 print
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
1111 print
'<div class="div-table-responsive">';
1112 print
'<table class="noborder centpercent">';
1114 print
'<tr class="liste_titre">';
1116 print
'<td style="width: 24px"></td>';
1118 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
'>'.$langs->trans(
"Ref").
'</td>';
1120 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
' class="center">';
1121 if (in_array($tablename, array(
'projet_task'))) {
1122 print $langs->trans(
"TimeSpent");
1124 if (!in_array($tablename, array(
'projet_task'))) {
1125 print $langs->trans(
"Date");
1130 if (in_array($tablename, array(
'projet_task')) && $key ==
'project_task') {
1132 } elseif (in_array($tablename, array(
'payment_various'))) {
1134 } elseif (in_array($tablename, array(
'expensereport_det',
'don',
'projet_task',
'stock_mouvement',
'salary'))) {
1135 print $langs->trans(
"User");
1137 print $langs->trans(
"ThirdParty");
1141 if ($tablename ==
'fichinter') {
1143 print $langs->trans(
"TotalDuration");
1144 $total_duration = 0;
1150 if ($key ==
'loan') {
1151 print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
1152 } elseif (empty($value[
'disableamount'])) {
1153 print
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
1155 print
'<td width="120"></td>';
1159 if ($key ==
'loan') {
1160 print
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
1161 } elseif (empty($value[
'disableamount'])) {
1162 print
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
1164 print
'<td width="120"></td>';
1167 if (in_array($tablename, array(
'projet_task'))) {
1168 print
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
1170 print
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
1174 if (is_array($elementarray) && count($elementarray) > 0) {
1178 $total_ht_by_third = 0;
1179 $total_ttc_by_third = 0;
1181 $saved_third_id = 0;
1189 $num = count($elementarray);
1190 for ($i = 0; $i < $num; $i++) {
1191 $tmp = explode(
'_', $elementarray[$i]);
1192 $idofelement = $tmp[0];
1193 $idofelementuser = isset($tmp[1]) ? $tmp[1] :
"";
1195 $element->fetch($idofelement);
1196 if ($idofelementuser) {
1197 $elementuser->fetch($idofelementuser);
1201 if ($tablename !=
'expensereport_det') {
1202 if (method_exists($element,
'fetch_thirdparty')) {
1203 $element->fetch_thirdparty();
1207 $expensereport->fetch($element->fk_expensereport);
1212 if ($breakline && $saved_third_id != $element->thirdparty->id) {
1215 $saved_third_id = $element->thirdparty->id;
1218 $total_ht_by_third = 0;
1219 $total_ttc_by_third = 0;
1222 $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
1224 $qualifiedfortotal =
true;
1225 if ($key ==
'invoice') {
1226 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
1227 $qualifiedfortotal =
false;
1229 } elseif ($key ==
'order_supplier' && $element->status == 7) {
1230 $qualifiedfortotal =
false;
1233 if ($key ==
"order_supplier" && $element->status == 7) {
1234 print
'<tr class="oddeven tr_canceled" style=display:none>';
1236 print
'<tr class="oddeven" >';
1241 print
'<td style="width: 24px">';
1242 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement') {
1243 if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) {
1244 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1245 print
img_picto($langs->trans(
'Unlink'),
'unlink');
1252 print
'<td class="left nowraponall">';
1253 if ($tablename ==
'expensereport_det') {
1254 print $expensereport->getNomUrl(1);
1257 if ($element instanceof
Task) {
1258 print $element->getNomUrl(1,
'withproject',
'time');
1259 print
' - '.dol_trunc($element->label, 48);
1260 } elseif ($key ==
'loan') {
1261 print $element->getNomUrl(1);
1262 print
' - '.dol_trunc($element->label, 48);
1264 print $element->getNomUrl(1);
1267 $element_doc = $element->element;
1269 if (!empty($conf->$element_doc)) {
1270 $confelementdoc = $conf->$element_doc;
1271 $filedir = $confelementdoc->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1276 if ($element_doc ===
'order_supplier') {
1277 $element_doc =
'commande_fournisseur';
1278 $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1279 } elseif ($element_doc ===
'invoice_supplier') {
1280 $element_doc =
'facture_fournisseur';
1281 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1282 $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].
'/'.$filename;
1285 print
'<div class="inline-block valignmiddle">';
1287 print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
1292 if (!empty($element->ref_supplier)) {
1293 print
' - '.$element->ref_supplier;
1296 if (!empty($element->ref_customer)) {
1297 print
' - '.$element->ref_customer;
1300 if (empty($element->ref_customer) && !empty($element->ref_client)) {
1301 print
' - '.$element->ref_client;
1307 $date =
''; $total_time_by_line =
null; $total_time = 0;
1308 if ($tablename ==
'expensereport_det') {
1309 $date = $element->date;
1310 } elseif ($tablename ==
'stock_mouvement') {
1311 $date = $element->datem;
1312 } elseif ($tablename ==
'salary') {
1313 $date = $element->datesp;
1314 } elseif ($tablename ==
'payment_various') {
1315 $date = $element->datev;
1316 } elseif ($tablename ==
'chargesociales') {
1317 $date = $element->date_ech;
1318 } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
1319 if ($tablename ==
'don') {
1320 $date = $element->datedon;
1322 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
1323 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1324 } elseif ($tablename ==
'supplier_proposal') {
1325 $date = $element->date_validation;
1326 } elseif ($tablename ==
'fichinter') {
1327 $date = $element->datev;
1328 } elseif ($tablename ==
'projet_task') {
1331 $date = $element->date;
1333 $date = $element->date_contrat;
1336 $date = $element->datev;
1338 if (empty($date) && !empty($datefieldname)) {
1339 $date = $element->$datefieldname;
1342 } elseif ($key ==
'loan') {
1343 $date = $element->datestart;
1346 print
'<td class="center">';
1347 if ($tablename ==
'actioncomm') {
1349 if ($element->datef && $element->datef > $element->datep) {
1350 print
" - ".dol_print_date($element->datef,
'dayhour');
1352 } elseif (in_array($tablename, array(
'projet_task'))) {
1353 $tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee);
1354 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1357 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1364 print
'<td class="left">';
1365 if (is_object($element->thirdparty)) {
1366 print $element->thirdparty->getNomUrl(1,
'', 48);
1367 } elseif ($tablename ==
'expensereport_det') {
1368 $tmpuser =
new User($db);
1369 $tmpuser->fetch($expensereport->fk_user_author);
1370 print $tmpuser->getNomUrl(1,
'', 48);
1371 } elseif ($tablename ==
'salary') {
1372 $tmpuser =
new User($db);
1373 $tmpuser->fetch($element->fk_user);
1374 print $tmpuser->getNomUrl(1,
'', 48);
1375 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement') {
1376 if ($element->fk_user_author > 0) {
1377 $tmpuser2 =
new User($db);
1378 $tmpuser2->fetch($element->fk_user_author);
1379 print $tmpuser2->getNomUrl(1,
'', 48);
1381 } elseif ($tablename ==
'projet_task' && $key ==
'element_time') {
1382 print $elementuser->getNomUrl(1);
1387 if ($tablename ==
'fichinter') {
1389 print
convertSecondToTime($element->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
1390 $total_duration += $element->duration;
1396 if (empty($value[
'disableamount'])) {
1397 $total_ht_by_line =
null;
1399 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1400 $total_ht_by_line = $element->amount;
1401 } elseif ($tablename ==
'fichinter') {
1402 $total_ht_by_line = $element->getAmount();
1403 } elseif ($tablename ==
'stock_mouvement') {
1404 $total_ht_by_line = $element->price * abs($element->qty);
1405 } elseif (in_array($tablename, array(
'projet_task'))) {
1406 if (isModEnabled(
'salaries')) {
1408 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1409 if ($tmpprojtime[
'nblinesnull'] > 0) {
1410 $langs->load(
"errors");
1411 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate", $conf->currency);
1414 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1416 } elseif ($key ==
'loan') {
1417 $total_ht_by_line = $element->capital;
1419 $total_ht_by_line = $element->total_ht;
1423 if ($tablename ==
'payment_various') {
1424 if ($element->sens == 0) {
1425 $total_ht_by_line = -$total_ht_by_line;
1429 print
'<td class="right">';
1430 if ($othermessage) {
1431 print $othermessage;
1433 if (isset($total_ht_by_line)) {
1434 if (!$qualifiedfortotal) {
1437 print
'<span class="amount">'.price($total_ht_by_line).
'</span>';
1438 if (!$qualifiedfortotal) {
1443 print
' '.img_warning($warning);
1451 if (empty($value[
'disableamount'])) {
1452 $total_ttc_by_line =
null;
1453 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1454 $total_ttc_by_line = $element->amount;
1455 } elseif ($tablename ==
'fichinter') {
1456 $total_ttc_by_line = $element->getAmount();
1457 } elseif ($tablename ==
'stock_mouvement') {
1458 $total_ttc_by_line = $element->price * abs($element->qty);
1459 } elseif ($tablename ==
'projet_task') {
1460 if (isModEnabled(
'salaries')) {
1463 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1465 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1467 } elseif ($key ==
'loan') {
1468 $total_ttc_by_line = $element->capital - $element->getSumPayment();
1470 $total_ttc_by_line = $element->total_ttc;
1474 if ($tablename ==
'payment_various') {
1475 if ($element->sens == 0) {
1476 $total_ttc_by_line = -$total_ttc_by_line;
1480 print
'<td class="right">';
1481 if ($othermessage) {
1482 print $othermessage;
1484 if (isset($total_ttc_by_line)) {
1485 if (!$qualifiedfortotal) {
1488 print
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
1489 if (!$qualifiedfortotal) {
1494 print
' '.img_warning($warning);
1502 print
'<td class="right">';
1503 if ($tablename ==
'expensereport_det') {
1504 print $expensereport->getLibStatut(5);
1507 print $element->getLibStatut(5, $element->getSommePaiement());
1508 } elseif ($element instanceof
Task) {
1509 if ($element->progress !=
'') {
1510 print $element->progress.
' %';
1512 } elseif ($tablename ==
'stock_mouvement') {
1513 print $element->getLibStatut(3);
1515 print $element->getLibStatut(5);
1521 if ($qualifiedfortotal) {
1522 $total_ht = $total_ht + $total_ht_by_line;
1523 $total_ttc = $total_ttc + $total_ttc_by_line;
1525 $total_ht_by_third += $total_ht_by_line;
1526 $total_ttc_by_third += $total_ttc_by_line;
1528 if (!isset($total_time)) $total_time = $total_time_by_line;
1529 else $total_time += $total_time_by_line;
1533 $breakline =
'<tr class="liste_total liste_sub_total">';
1534 $breakline .=
'<td colspan="2">';
1535 $breakline .=
'</td>';
1536 $breakline .=
'<td>';
1537 $breakline .=
'</td>';
1538 $breakline .=
'<td class="right">';
1539 $breakline .= $langs->trans(
'SubTotal').
' : ';
1540 if (is_object($element->thirdparty)) {
1541 $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1543 $breakline .=
'</td>';
1544 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1545 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1546 $breakline .=
'<td></td>';
1547 $breakline .=
'</tr>';
1558 if (empty($nototal)) {
1560 if (in_array($tablename, array(
'projet_task'))) {
1564 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1565 if (in_array($tablename, array(
'projet_task'))) {
1566 print
'<td class="center">';
1575 if ($tablename ==
'fichinter') {
1576 print
'<td class="left">'.convertSecondToTime($total_duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1578 print
'<td class="right">';
1579 if (empty($value[
'disableamount'])) {
1580 if ($key ==
'loan') {
1581 print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1582 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1583 print
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
1589 print
'<td class="right">';
1590 if (empty($value[
'disableamount'])) {
1591 if ($key ==
'loan') {
1592 print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
1593 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1594 print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
1598 print
'<td> </td>';
1602 if (!is_array($elementarray)) {
1603 print
'<tr><td>'.$elementarray.
'</td></tr>';
1606 if (in_array($tablename, array(
'projet_task'))) {
1609 if ($tablename ==
'fichinter') {
1612 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1622if ($conf->use_javascript_ajax) {
1623 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
1626 print $comboenhancement;
1645 if (empty($conf->global->PROJECT_ADD_SUBTOTAL_LINES)) {
1648 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
1659 global $db, $classname;
1661 $element =
new $classname($db);
1663 $clientname = array();
1664 foreach ($elementarray as $key => $id) {
1665 if (empty($clientname[$id])) {
1666 $element->fetch($id);
1667 $element->fetch_thirdparty();
1669 $clientname[$id] = $element->thirdparty->name;
1676 $elementarray = array();
1677 foreach ($clientname as $id => $name) {
1678 $elementarray[] = $id;
1681 return $elementarray;
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Superclass for invoices classes.
Class to manage Trips and Expenses.
const TYPE_DEPOSIT
Deposit invoice.
Class to manage Schedule of loans.
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)
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_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.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.