30 require
'../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37 if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
38 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
39 if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
40 if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
41 if (!empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
42 if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
43 if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
44 if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
45 if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
46 if (!empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
47 if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
48 if (!empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
49 if (!empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
50 if (!empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
51 if (!empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
52 if (!empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
53 if (!empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
54 if (!empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
55 if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
56 if (!empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
57 if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
58 if (!empty($conf->mrp->enabled)) require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
61 $langs->loadLangs(array(
'projects',
'companies',
'suppliers',
'compta'));
62 if (!empty($conf->facture->enabled)) $langs->load(
"bills");
63 if (!empty($conf->commande->enabled)) $langs->load(
"orders");
64 if (!empty($conf->propal->enabled)) $langs->load(
"propal");
65 if (!empty($conf->ficheinter->enabled)) $langs->load(
"interventions");
66 if (!empty($conf->deplacement->enabled)) $langs->load(
"trips");
67 if (!empty($conf->expensereport->enabled)) $langs->load(
"trips");
68 if (!empty($conf->don->enabled)) $langs->load(
"donations");
69 if (!empty($conf->loan->enabled)) $langs->load(
"loan");
70 if (!empty($conf->salaries->enabled)) $langs->load(
"salaries");
71 if (!empty($conf->mrp->enabled)) $langs->load(
"mrp");
75 $action =
GETPOST(
'action',
'aZ09');
76 $datesrfc =
GETPOST(
'datesrfc');
77 $dateerfc =
GETPOST(
'dateerfc');
80 if (empty($dates) && !empty($datesrfc)) $dates =
dol_stringtotime($datesrfc);
81 if (empty($datee) && !empty($dateerfc)) $datee =
dol_stringtotime($dateerfc);
82 if (!
GETPOSTISSET(
'datesrfc') && !
GETPOSTISSET(
'datesday') && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR)) {
89 if ($id ==
'' && $ref ==
'')
92 header(
'Location: list.php');
96 $mine = $_REQUEST[
'mode'] ==
'mine' ? 1 : 0;
101 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
102 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) $object->fetchComments();
105 $socid = $object->socid;
107 $result =
restrictedArea($user,
'projet', $object->id,
'projet&project');
109 $hookmanager->initHooks(array(
'projectOverview'));
116 $title = $langs->trans(
"ProjectReferers").
' - '.$object->ref.
' '.$object->name;
117 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
"ProjectReferers");
118 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
119 llxHeader(
"", $langs->trans(
"Referers"), $help_url);
121 $form =
new Form($db);
125 $userstatic =
new User($db);
128 $userAccess = $object->restrictedProjectArea($user);
131 print dol_get_fiche_head($head,
'element', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
136 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
138 $morehtmlref =
'<div class="refidno">';
140 $morehtmlref .= $object->title;
142 if ($object->thirdparty->id > 0)
144 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1,
'project');
146 $morehtmlref .=
'</div>';
149 if (!$user->rights->projet->all->lire)
151 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
152 $object->next_prev_filter =
" te.rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
155 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
158 print '<div class="fichecenter">';
159 print '<div class="fichehalfleft">';
160 print '<div class="underbanner clearboth"></div>';
162 print '<table class="border tableforfield centpercent">';
165 print '<tr><td class="tdtop">';
166 print $langs->trans(
"Usage");
169 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
171 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
172 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
173 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
176 if (empty($conf->global->PROJECT_HIDE_TASKS))
178 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
179 $htmltext = $langs->trans(
"ProjectFollowTasks");
180 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
183 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
185 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"' :
'')).
'"> ';
186 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
187 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
193 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
194 if ($object->public)
print $langs->trans(
'SharedProject');
195 else print $langs->trans(
'PrivateProject');
198 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
201 print '<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
202 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
203 if ($code)
print $langs->trans(
"OppStatus".$code);
207 print '<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
208 if (strcmp($object->opp_percent,
''))
print price($object->opp_percent,
'', $langs, 1, 0).
' %';
212 print '<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
213 if (strcmp($object->opp_amount,
''))
print price($object->opp_amount,
'', $langs, 1, 0, 0, $conf->currency);
218 print '<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
220 print ($start ? $start :
'?');
223 print ($end ? $end :
'?');
228 print '<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
229 if (strcmp($object->budget_amount,
''))
print price($object->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
234 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
239 print '<div class="fichehalfright">';
240 print '<div class="ficheaddleft">';
241 print '<div class="underbanner clearboth"></div>';
243 print '<table class="border tableforfield" width="100%">';
246 print '<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
247 print nl2br($object->description);
251 if ($conf->categorie->enabled) {
252 print '<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
253 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
263 print '<div class="clearboth"></div>';
273 $listofreferent = array(
276 'title'=>
"ListProposalsAssociatedProject",
279 'datefieldname'=>
'datep',
280 'urlnew'=>DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid,
282 'buttonnew'=>
'AddProp',
283 'testnew'=>$user->rights->propal->creer,
284 'test'=>$conf->propal->enabled && $user->rights->propale->lire),
286 'name'=>
"CustomersOrders",
287 'title'=>
"ListOrdersAssociatedProject",
290 'datefieldname'=>
'date_commande',
291 'urlnew'=>DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.$id.
'&socid='.$socid,
293 'buttonnew'=>
'CreateOrder',
294 'testnew'=>$user->rights->commande->creer,
295 'test'=>$conf->commande->enabled && $user->rights->commande->lire),
297 'name'=>
"CustomersInvoices",
298 'title'=>
"ListInvoicesAssociatedProject",
302 'datefieldname'=>
'datef',
303 'urlnew'=>DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid,
305 'buttonnew'=>
'CreateBill',
306 'testnew'=>$user->rights->facture->creer,
307 'test'=>$conf->facture->enabled && $user->rights->facture->lire),
308 'invoice_predefined'=>array(
309 'name'=>
"PredefinedInvoices",
310 'title'=>
"ListPredefinedInvoicesAssociatedProject",
311 'class'=>
'FactureRec',
312 'table'=>
'facture_rec',
313 'datefieldname'=>
'datec',
314 'urlnew'=>DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid,
316 'buttonnew'=>
'CreateBill',
317 'testnew'=>$user->rights->facture->creer,
318 'test'=>$conf->facture->enabled && $user->rights->facture->lire),
319 'proposal_supplier'=>array(
320 'name'=>
"SuppliersProposals",
321 'title'=>
"ListSupplierProposalsAssociatedProject",
322 'class'=>
'SupplierProposal',
323 'table'=>
'supplier_proposal',
324 'datefieldname'=>
'date_valid',
325 'urlnew'=>DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.$id,
326 'lang'=>
'supplier_proposal',
327 'buttonnew'=>
'AddSupplierProposal',
328 'testnew'=>$user->rights->supplier_proposal->creer,
329 'test'=>$conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire),
330 'order_supplier'=>array(
331 'name'=>
"SuppliersOrders",
332 'title'=>
"ListSupplierOrdersAssociatedProject",
333 'class'=>
'CommandeFournisseur',
334 'table'=>
'commande_fournisseur',
335 'datefieldname'=>
'date_commande',
336 'urlnew'=>DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.$id,
338 'buttonnew'=>
'AddSupplierOrder',
339 'testnew'=>$user->rights->fournisseur->commande->creer,
340 'test'=>$conf->supplier_order->enabled && $user->rights->fournisseur->commande->lire),
341 'invoice_supplier'=>array(
342 'name'=>
"BillsSuppliers",
343 'title'=>
"ListSupplierInvoicesAssociatedProject",
344 'class'=>
'FactureFournisseur',
346 'table'=>
'facture_fourn',
347 'datefieldname'=>
'datef',
348 'urlnew'=>DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.$id,
350 'buttonnew'=>
'AddSupplierInvoice',
351 'testnew'=>$user->rights->fournisseur->facture->creer,
352 'test'=>$conf->supplier_invoice->enabled && $user->rights->fournisseur->facture->lire),
355 'title'=>
"ListContractAssociatedProject",
358 'datefieldname'=>
'date_contrat',
359 'urlnew'=>DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.$id.
'&socid='.$socid,
361 'buttonnew'=>
'AddContract',
362 'testnew'=>$user->rights->contrat->creer,
363 'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
364 'intervention'=>array(
365 'name'=>
"Interventions",
366 'title'=>
"ListFichinterAssociatedProject",
367 'class'=>
'Fichinter',
368 'table'=>
'fichinter',
369 'datefieldname'=>
'date_valid',
372 'urlnew'=>DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid,
373 'lang'=>
'interventions',
374 'buttonnew'=>
'AddIntervention',
375 'testnew'=>$user->rights->ficheinter->creer,
376 'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
379 'title'=>
"ListShippingAssociatedProject",
380 'class'=>
'Expedition',
381 'table'=>
'expedition',
382 'datefieldname'=>
'date_valid',
383 'urlnew'=>DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid,
385 'buttonnew'=>
'CreateShipment',
387 'test'=>$conf->expedition->enabled && $user->rights->expedition->lire),
390 'title'=>
"ListMOAssociatedProject",
393 'datefieldname'=>
'date_valid',
394 'urlnew'=>DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid,
396 'buttonnew'=>
'CreateMO',
397 'testnew'=>
'$user->rights->mrp->write',
398 'project_field'=>
'fk_project',
399 'test'=>$conf->mrp->enabled && $user->rights->mrp->read),
401 'name'=>
"TripsAndExpenses",
402 'title'=>
"ListExpenseReportsAssociatedProject",
403 'class'=>
'Deplacement',
404 'table'=>
'deplacement',
405 'datefieldname'=>
'dated',
408 'urlnew'=>DOL_URL_ROOT.
'/deplacement/card.php?action=create&projectid='.$id.
'&socid='.$socid,
410 'buttonnew'=>
'AddTrip',
411 'testnew'=>$user->rights->deplacement->creer,
412 'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
413 'expensereport'=>array(
414 'name'=>
"ExpenseReports",
415 'title'=>
"ListExpenseReportsAssociatedProject",
416 'class'=>
'ExpenseReportLine',
417 'table'=>
'expensereport_det',
418 'datefieldname'=>
'date',
421 'urlnew'=>DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.$id.
'&socid='.$socid,
423 'buttonnew'=>
'AddTrip',
424 'testnew'=>$user->rights->expensereport->creer,
425 'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire),
428 'title'=>
"ListDonationsAssociatedProject",
432 'datefieldname'=>
'datedon',
434 'urlnew'=>DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.$id.
'&socid='.$socid,
436 'buttonnew'=>
'AddDonation',
437 'testnew'=>$user->rights->don->creer,
438 'test'=>$conf->don->enabled && $user->rights->don->lire),
441 'title'=>
"ListLoanAssociatedProject",
445 'datefieldname'=>
'datestart',
447 'urlnew'=>DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.$id.
'&socid='.$socid,
449 'buttonnew'=>
'AddLoan',
450 'testnew'=>$user->rights->loan->write,
451 'test'=>$conf->loan->enabled && $user->rights->loan->read),
452 'chargesociales'=>array(
453 'name'=>
"SocialContribution",
454 'title'=>
"ListSocialContributionAssociatedProject",
455 'class'=>
'ChargeSociales',
457 'table'=>
'chargesociales',
458 'datefieldname'=>
'date_ech',
460 'urlnew'=>DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.$id,
462 'buttonnew'=>
'AddSocialContribution',
463 'testnew'=>$user->rights->tax->charges->lire,
464 'test'=>$conf->tax->enabled && $user->rights->tax->charges->lire),
465 'project_task'=>array(
466 'name'=>
"TaskTimeSpent",
467 'title'=>
"ListTaskTimeUserProject",
470 'table'=>
'projet_task',
471 'datefieldname'=>
'task_date',
473 'urlnew'=>DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id,
474 'buttonnew'=>
'AddTimeSpent',
475 'testnew'=>$user->rights->projet->creer,
476 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))),
477 'stock_mouvement'=>array(
478 'name'=>
"MouvementStockAssociated",
479 'title'=>
"ListMouvementStockProject",
480 'class'=>
'MouvementStock',
482 'table'=>
'stock_mouvement',
483 'datefieldname'=>
'datem',
485 'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))),
488 'title'=>
"ListSalariesAssociatedProject",
489 'class'=>
'PaymentSalary',
490 'table'=>
'payment_salary',
491 'datefieldname'=>
'datev',
494 'urlnew'=>DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.$id,
496 'buttonnew'=>
'AddSalaryPayment',
497 'testnew'=>$user->rights->salaries->write,
498 'test'=>$conf->salaries->enabled && $user->rights->salaries->read),
499 'variouspayment'=>array(
500 'name'=>
"VariousPayments",
501 'title'=>
"ListVariousPaymentsAssociatedProject",
502 'class'=>
'PaymentVarious',
503 'table'=>
'payment_various',
504 'datefieldname'=>
'datev',
507 'urlnew'=>DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.$id,
509 'buttonnew'=>
'AddVariousPayment',
510 'testnew'=>$user->rights->banque->modifier,
511 'test'=>$conf->banque->enabled && $user->rights->banque->lire && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)),
529 if (!empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) {
530 foreach ($listofreferent as $key => $element) {
531 if ($listofreferent[$key][
'margin'] ==
'add') {
532 unset($listofreferent[$key][
'margin']);
535 $newelementforplusmargin = explode(
',', $conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN);
536 foreach ($newelementforplusmargin as $value) {
537 $listofreferent[trim($value)][
'margin'] =
'add';
540 if (!empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) {
541 foreach ($listofreferent as $key => $element) {
542 if ($listofreferent[$key][
'margin'] ==
'minus') {
543 unset($listofreferent[$key][
'margin']);
546 $newelementforminusmargin = explode(
',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN);
547 foreach ($newelementforminusmargin as $value) {
548 $listofreferent[trim($value)][
'margin'] =
'minus';
554 $parameters = array(
'listofreferent'=>$listofreferent);
555 $resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
557 if (!empty($hookmanager->resArray)) {
558 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
561 if ($action ==
"addelement")
563 $tablename =
GETPOST(
"tablename");
564 $elementselectid =
GETPOST(
"elementselect");
565 $result = $object->update_element($tablename, $elementselectid);
570 } elseif ($action ==
"unlink")
572 $tablename =
GETPOST(
"tablename",
"aZ09");
573 $projectField =
GETPOSTISSET(
'projectfield') ?
GETPOST(
'projectfield',
'aZ09') :
'fk_projet';
574 $elementselectid =
GETPOST(
"elementselect",
"int");
576 $result = $object->remove_element($tablename, $elementselectid, $projectField);
583 $elementuser =
new User($db);
589 if (!$showdatefilter)
591 print '<div class="center centpercent">';
592 print '<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="POST">';
593 print '<input type="hidden" name="token" value="'.newToken().
'">';
594 print '<input type="hidden" name="tablename" value="'.$tablename.
'">';
595 print '<input type="hidden" name="action" value="view">';
596 print '<div class="inline-block">';
597 print $form->selectDate($dates,
'dates', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
599 print '<div class="inline-block">';
600 print $form->selectDate($datee,
'datee', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
602 print '<div class="inline-block">';
603 print '<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button">';
615 $langs->loadLangs(array(
"suppliers",
"bills",
"orders",
"proposals",
"margins"));
617 if (!empty($conf->stock->enabled)) $langs->load(
'stocks');
621 print '<table class="noborder centpercent">';
622 print
'<tr class="liste_titre">';
623 print
'<td class="left" width="200">';
624 $tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
625 $tooltiponprofitplus = $tooltiponprofitminus =
'';
626 foreach ($listofreferent as $key => $value)
628 $name = $langs->trans($value[
'name']);
629 $qualified = $value[
'test'];
630 $margin = $value[
'margin'];
631 if ($qualified && isset($margin))
633 if ($margin ==
'add') {
634 $tooltiponprofitplus .=
' > '.$name.
" (+)<br>\n";
636 if ($margin ==
'minus') {
637 $tooltiponprofitminus .=
' > '.$name.
" (-)<br>\n";
641 $tooltiponprofit .= $tooltiponprofitplus;
642 $tooltiponprofit .= $tooltiponprofitminus;
643 print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
645 print
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
646 print
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
647 print
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
650 $total_revenue_ht = 0;
654 foreach ($listofreferent as $key => $value)
657 'total_revenue_ht' =>& $total_revenue_ht,
658 'balance_ht' =>& $balance_ht,
659 'balance_ttc' =>& $balance_ttc,
665 $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action);
668 } elseif ($reshook > 0) {
669 print $hookmanager->resPrint;
673 $name = $langs->trans($value[
'name']);
674 $title = $value[
'title'];
675 $classname = $value[
'class'];
676 $tablename = $value[
'table'];
677 $datefieldname = $value[
'datefieldname'];
678 $qualified = $value[
'test'];
679 $margin = $value[
'margin'];
680 $project_field = $value[
'project_field'];
681 if ($qualified && isset($margin)) {
682 $element =
new $classname($db);
684 $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
686 if (is_array($elementarray) && count($elementarray) > 0) {
690 $num = count($elementarray);
691 for ($i = 0; $i < $num; $i++) {
692 $tmp = explode(
'_', $elementarray[$i]);
693 $idofelement = $tmp[0];
694 $idofelementuser = $tmp[1];
696 $element->fetch($idofelement);
697 if ($idofelementuser) $elementuser->fetch($idofelementuser);
700 $qualifiedfortotal =
true;
701 if ($key ==
'invoice') {
702 if (!empty($element->close_code) && $element->close_code ==
'replaced') $qualifiedfortotal =
false;
703 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type ==
Facture::TYPE_DEPOSIT) $qualifiedfortotal =
false;
705 if ($key ==
'propal') {
709 if ($tablename !=
'expensereport_det' && method_exists($element,
'fetch_thirdparty')) $element->fetch_thirdparty();
712 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'payment_salary') $total_ht_by_line = $element->amount;
713 elseif ($tablename ==
'fichinter') $total_ht_by_line = $element->getAmount();
714 elseif ($tablename == 'stock_mouvement') $total_ht_by_line = $element->
price * abs($element->qty);
715 elseif ($tablename == 'projet_task') {
716 if ($idofelementuser) {
717 $tmp = $element->getSumOfAmount($elementuser, $dates, $datee);
718 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
720 $tmp = $element->getSumOfAmount(
'', $dates, $datee);
721 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
723 } elseif ($key ==
'loan') {
724 if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
726 $total_ht_by_line = -$element->capital;
729 $total_ht_by_line = 0;
731 $loanScheduleStatic->fetchAll($element->id);
732 if (!empty($loanScheduleStatic->lines)) {
733 foreach ($loanScheduleStatic->lines as $loanSchedule) {
737 if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee)
738 || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <=
dol_now()
739 || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
741 $total_ht_by_line -= $loanSchedule->amount_capital;
746 }
else $total_ht_by_line = $element->total_ht;
749 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'payment_salary') $total_ttc_by_line = $element->amount;
750 elseif ($tablename ==
'fichinter') $total_ttc_by_line = $element->getAmount();
751 elseif ($tablename == 'stock_mouvement') $total_ttc_by_line = $element->
price * abs($element->qty);
752 elseif ($tablename == 'projet_task') {
754 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
755 } elseif ($key ==
'loan') {
756 $total_ttc_by_line = $total_ht_by_line;
757 }
else $total_ttc_by_line = $element->total_ttc;
760 if ($tablename ==
'payment_various') {
761 if ($element->sens == 1) {
762 $total_ht_by_line = -$total_ht_by_line;
763 $total_ttc_by_line = -$total_ttc_by_line;
768 if ($qualifiedfortotal) {
769 $total_ht = $total_ht + $total_ht_by_line;
770 $total_ttc = $total_ttc + $total_ttc_by_line;
775 $qualifiedforfinalprofit =
true;
776 if ($key ==
'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) $qualifiedforfinalprofit =
false;
780 if ($qualifiedforfinalprofit) {
781 if ($margin ==
'add') {
782 $total_revenue_ht += $total_ht;
785 if ($margin !=
"add") {
786 $total_ht = -$total_ht;
787 $total_ttc = -$total_ttc;
790 $balance_ht += $total_ht;
791 $balance_ttc += $total_ttc;
794 print
'<tr class="oddeven">';
796 print
'<td class="left">'.$name.
'</td>';
798 print
'<td class="right">'.$i.
'</td>';
800 print
'<td class="right">';
801 if ($key ==
'intervention' && !$qualifiedforfinalprofit) print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
803 print
price($total_ht);
804 if ($key ==
'propal') print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
808 print
'<td class="right">';
809 if ($key ==
'intervention' && !$qualifiedforfinalprofit) print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
811 print
price($total_ttc);
812 if ($key ==
'propal') print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
820 print
'<tr class="liste_total">';
821 print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
822 print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
823 print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
827 if ($total_revenue_ht) {
828 print
'<tr class="liste_total">';
829 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
830 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
831 print
'<td class="right"></td>';
844 foreach ($listofreferent as $key => $value)
852 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
855 } elseif ($reshook > 0) {
856 print $hookmanager->resPrint;
860 $title = $value[
'title'];
861 $classname = $value[
'class'];
862 $tablename = $value[
'table'];
863 $datefieldname = $value[
'datefieldname'];
864 $qualified = $value[
'test'];
865 $langtoload = $value[
'lang'];
866 $urlnew = $value[
'urlnew'];
867 $buttonnew = $value[
'buttonnew'];
868 $testnew = $value[
'testnew'];
869 $project_field = $value[
'project_field'];
871 $exclude_select_element = array(
'payment_various');
872 if (!empty($value[
'exclude_select_element'])) $exclude_select_element[] = $value[
'exclude_select_element'];
878 if ($langtoload) $langs->load($langtoload);
880 $element =
new $classname($db);
884 $idtofilterthirdparty = 0;
885 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
886 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
888 $idtofilterthirdparty = $object->thirdparty->id;
889 if (!empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty .=
','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
892 if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element))
894 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, !empty($project_field) ? $project_field :
'fk_projet');
898 } elseif ($selectList)
901 $addform .=
'<div class="inline-block valignmiddle">';
902 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
903 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
904 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
905 $addform .=
'<input type="hidden" name="action" value="addelement">';
906 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
907 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
908 $addform .=
'<table><tr><td><span class="hideonsmartphone opacitymedium">'.$langs->trans(
"SelectElement").
'</span></td>';
909 $addform .=
'<td>'.$selectList.
'</td>';
910 $addform .=
'<td><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
911 $addform .=
'</tr></table>';
912 $addform .=
'</form>';
913 $addform .=
'</div>';
916 if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew)
918 $addform .=
'<div class="inline-block valignmiddle">';
919 if ($testnew) $addform .=
'<a class="buttonxxx" href="'.$urlnew.
'"><span class="valignmiddle text-plus-circle hideonsmartphone">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans(
"Create")).
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
920 elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
921 $addform .=
'<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle hideonsmartphone">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans(
"Create")).
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
928 print
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
929 print
'<div class="div-table-responsive">';
930 print
'<table class="noborder centpercent">';
932 print
'<tr class="liste_titre">';
934 print
'<td style="width: 24px"></td>';
936 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
'>'.$langs->trans(
"Ref").
'</td>';
938 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
' class="center">';
939 if (in_array($tablename, array(
'projet_task'))) print $langs->trans(
"TimeSpent");
940 if (!in_array($tablename, array(
'projet_task'))) print $langs->trans(
"Date");
944 if (in_array($tablename, array(
'projet_task')) && $key ==
'project_task') print
'';
945 elseif (in_array($tablename, array(
'payment_various'))) print '';
946 elseif (in_array($tablename, array('expensereport_det', 'don', 'projet_task', 'stock_mouvement', 'payment_salary'))) print $langs->trans("
User");
947 else print $langs->trans("ThirdParty");
950 if ($tablename == 'fichinter')
953 print $langs->trans(
"TotalDuration");
960 if ($key ==
'loan') print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
961 elseif (empty($value[
'disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountHT").'</td>';
962 else print '<td width="120"></td>';
965 if ($key == 'loan') print '<td class="right" width="120">'.$langs->trans("RemainderToPay").'</td>';
966 elseif (empty($value['disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountTTC").'</td>';
967 else print '<td width="120"></td>';
969 if (in_array($tablename, array('projet_task'))) print '<td class="right" width="200">'.$langs->trans("ProgressDeclared").'</td>';
970 else print '<td class="right" width="200">'.$langs->trans("
Status").'</td>';
973 $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet');
974 if (is_array($elementarray) && count($elementarray) > 0)
979 $total_ht_by_third = 0;
980 $total_ttc_by_third = 0;
991 $num = count($elementarray);
992 for ($i = 0; $i < $num; $i++)
994 $tmp = explode(
'_', $elementarray[$i]);
995 $idofelement = $tmp[0];
996 $idofelementuser = $tmp[1];
998 $element->fetch($idofelement);
999 if ($idofelementuser) $elementuser->fetch($idofelementuser);
1002 if ($tablename !=
'expensereport_det')
1004 if (method_exists($element,
'fetch_thirdparty')) $element->fetch_thirdparty();
1007 $expensereport->fetch($element->fk_expensereport);
1012 if ($breakline && $saved_third_id != $element->thirdparty->id)
1016 $saved_third_id = $element->thirdparty->id;
1019 $total_ht_by_third = 0;
1020 $total_ttc_by_third = 0;
1022 $saved_third_id = $element->thirdparty->id;
1024 $qualifiedfortotal =
true;
1025 if ($key ==
'invoice')
1027 if (!empty($element->close_code) && $element->close_code ==
'replaced') $qualifiedfortotal =
false;
1030 print
'<tr class="oddeven">';
1033 print
'<td style="width: 24px">';
1034 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement')
1036 if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin)
1038 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1039 print
img_picto($langs->trans(
'Unlink'),
'unlink');
1046 print
'<td class="left nowraponall">';
1047 if ($tablename ==
'expensereport_det')
1049 print $expensereport->getNomUrl(1);
1052 if ($element instanceof
Task)
1054 print $element->getNomUrl(1,
'withproject',
'time');
1055 print
' - '.dol_trunc($element->label, 48);
1056 } elseif ($key ==
'loan') {
1057 print $element->getNomUrl(1);
1058 print
' - '.dol_trunc($element->label, 48);
1059 }
else print $element->getNomUrl(1);
1061 $element_doc = $element->element;
1063 $filedir = $conf->{$element_doc}->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1065 if ($element_doc ===
'order_supplier') {
1066 $element_doc =
'commande_fournisseur';
1067 $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1068 } elseif ($element_doc ===
'invoice_supplier') {
1069 $element_doc =
'facture_fournisseur';
1070 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'product').dol_sanitizeFileName($element->ref);
1071 $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].
'/'.
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1074 print
'<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).
'</div>';
1077 if (!empty($element->ref_supplier)) print
' - '.$element->ref_supplier;
1079 if (!empty($element->ref_customer)) print
' - '.$element->ref_customer;
1084 $date =
''; $total_time_by_line = null;
1085 if ($tablename ==
'expensereport_det') $date = $element->date;
1086 elseif ($tablename ==
'stock_mouvement') $date = $element->datem;
1087 elseif ($tablename == 'payment_salary') $date = $element->datev;
1088 elseif ($tablename == 'payment_various') $date = $element->datev;
1089 elseif ($tablename == 'chargesociales') $date = $element->date_ech;
1090 elseif (!empty($element->status) || !empty($element->
statut) || !empty($element->fk_status))
1092 if ($tablename ==
'don') $date = $element->datedon;
1093 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order')
1095 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1096 } elseif ($tablename ==
'supplier_proposal') $date = $element->date_validation;
1097 elseif ($tablename == 'fichinter') $date = $element->datev;
1098 elseif ($tablename == 'projet_task') $date = '';
1100 $date = $element->date;
1101 if (empty($date)) $date = $element->date_contrat;
1102 if (empty($date)) $date = $element->datev;
1103 if (empty($date) && !empty($datefieldname)) {
1104 $date = $element->$datefieldname;
1107 } elseif ($key ==
'loan') {
1108 $date = $element->datestart;
1111 print
'<td class="center">';
1112 if ($tablename ==
'actioncomm')
1115 if ($element->datef && $element->datef > $element->datep) print
" - ".dol_print_date($element->datef,
'dayhour');
1116 } elseif (in_array($tablename, array(
'projet_task')))
1118 $tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee);
1119 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1122 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1127 print
'<td class="left">';
1128 if (is_object($element->thirdparty)) {
1129 print $element->thirdparty->getNomUrl(1,
'', 48);
1130 } elseif ($tablename ==
'expensereport_det') {
1131 $tmpuser =
new User($db);
1132 $tmpuser->fetch($expensereport->fk_user_author);
1133 print $tmpuser->getNomUrl(1,
'', 48);
1134 } elseif ($tablename ==
'payment_salary')
1136 $tmpuser =
new User($db);
1137 $tmpuser->fetch($element->fk_user);
1138 print $tmpuser->getNomUrl(1,
'', 48);
1139 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement')
1141 if ($element->fk_user_author > 0)
1143 $tmpuser2 =
new User($db);
1144 $tmpuser2->fetch($element->fk_user_author);
1145 print $tmpuser2->getNomUrl(1,
'', 48);
1147 } elseif ($tablename ==
'projet_task' && $key ==
'project_task_time')
1149 print $elementuser->getNomUrl(1);
1154 if ($tablename ==
'fichinter')
1157 print
convertSecondToTime($element->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
1158 $total_duration += $element->duration;
1164 if (empty($value[
'disableamount']))
1166 $total_ht_by_line = null;
1168 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'payment_salary') $total_ht_by_line = $element->amount;
1169 elseif ($tablename ==
'fichinter') $total_ht_by_line = $element->getAmount();
1170 elseif ($tablename == 'stock_mouvement') $total_ht_by_line = $element->
price * abs($element->qty);
1171 elseif (in_array($tablename, array('projet_task')))
1173 if (!empty($conf->salaries->enabled))
1176 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1177 if ($tmpprojtime[
'nblinesnull'] > 0)
1179 $langs->load(
"errors");
1180 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate", $conf->currency);
1183 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1185 } elseif ($key ==
'loan') $total_ht_by_line = $element->capital;
1187 $total_ht_by_line = $element->total_ht;
1191 if ($tablename ==
'payment_various')
1193 if ($element->sens == 0)
1195 $total_ht_by_line = -$total_ht_by_line;
1199 print
'<td class="right">';
1200 if ($othermessage) print $othermessage;
1201 if (isset($total_ht_by_line))
1203 if (!$qualifiedfortotal) print
'<strike>';
1204 print
price($total_ht_by_line);
1205 if (!$qualifiedfortotal) print
'</strike>';
1207 if ($warning) print
' '.img_warning($warning);
1209 }
else print
'<td></td>';
1212 if (empty($value[
'disableamount']))
1214 $total_ttc_by_line = null;
1215 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'payment_salary') $total_ttc_by_line = $element->amount;
1216 elseif ($tablename ==
'fichinter') $total_ttc_by_line = $element->getAmount();
1217 elseif ($tablename == 'stock_mouvement') $total_ttc_by_line = $element->
price * abs($element->qty);
1218 elseif ($tablename == 'projet_task')
1220 if (!empty($conf->salaries->enabled))
1224 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1226 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1228 } elseif ($key ==
'loan') $total_ttc_by_line = $element->capital - $element->getSumPayment();
1230 $total_ttc_by_line = $element->total_ttc;
1234 if ($tablename ==
'payment_various')
1236 if ($element->sens == 0)
1238 $total_ttc_by_line = -$total_ttc_by_line;
1242 print
'<td class="right">';
1243 if ($othermessage) print $othermessage;
1244 if (isset($total_ttc_by_line))
1246 if (!$qualifiedfortotal) print
'<strike>';
1247 print
price($total_ttc_by_line);
1248 if (!$qualifiedfortotal) print
'</strike>';
1250 if ($warning) print
' '.img_warning($warning);
1252 }
else print
'<td></td>';
1255 print
'<td class="right">';
1256 if ($tablename ==
'expensereport_det')
1258 print $expensereport->getLibStatut(5);
1262 print $element->getLibStatut(5, $element->getSommePaiement());
1263 } elseif ($element instanceof Task)
1265 if ($element->progress !=
'')
1267 print $element->progress.
' %';
1269 } elseif ($tablename ==
'stock_mouvement')
1271 print $element->getLibStatut(3);
1273 print $element->getLibStatut(5);
1279 if ($qualifiedfortotal)
1281 $total_ht = $total_ht + $total_ht_by_line;
1282 $total_ttc = $total_ttc + $total_ttc_by_line;
1284 $total_ht_by_third += $total_ht_by_line;
1285 $total_ttc_by_third += $total_ttc_by_line;
1287 $total_time = $total_time + $total_time_by_line;
1292 $breakline =
'<tr class="liste_total liste_sub_total">';
1293 $breakline .=
'<td colspan="2">';
1294 $breakline .=
'</td>';
1295 $breakline .=
'<td>';
1296 $breakline .=
'</td>';
1297 $breakline .=
'<td class="right">';
1298 $breakline .= $langs->trans(
'SubTotal').
' : ';
1299 if (is_object($element->thirdparty)) $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1300 $breakline .=
'</td>';
1301 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1302 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1303 $breakline .=
'<td></td>';
1304 $breakline .=
'</tr>';
1310 if ($breakline) print $breakline;
1314 if (in_array($tablename, array(
'projet_task'))) $colspan = 2;
1315 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1316 if (in_array($tablename, array(
'projet_task')))
1318 print
'<td class="center">';
1327 if ($tablename ==
'fichinter') print
'<td class="left">'.convertSecondToTime($total_duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1328 print
'<td class="right">';
1329 if (empty($value[
'disableamount']))
1331 if ($key ==
'loan') print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1332 elseif ($tablename !=
'projet_task' || !empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.
price($total_ht);
1337 print '<td class="right">';
1338 if (empty($value['disableamount']))
1340 if ($key ==
'loan') print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
1341 elseif ($tablename !=
'projet_task' || !empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.
price($total_ttc);
1344 print '<td> </td>';
1347 if (!is_array($elementarray))
1349 print $elementarray;
1359 if ($conf->use_javascript_ajax)
1361 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
1364 print $comboenhancement;
1383 if (empty($conf->global->PROJECT_ADD_SUBTOTAL_LINES))
return false;
1384 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
1395 global $db, $classname;
1397 $element =
new $classname($db);
1399 $clientname = array();
1400 foreach ($elementarray as $key => $id)
1402 if (empty($clientname[$id]))
1404 $element->fetch($id);
1405 $element->fetch_thirdparty();
1407 $clientname[$id] = $element->thirdparty->name;
1414 $elementarray = array();
1415 foreach ($clientname as $id => $name)
1417 $elementarray[] = $id;
1420 return $elementarray;
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
if(!empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort"u if(!empty($arrayfields['u.tms']['checked'])) print_liste_field_titre("DateModificationShort"u if(!empty($arrayfields['u.statut']['checked'])) print_liste_field_titre("Status"u statut
sortElementsByClientName($elementarray)
sortElementsByClientName
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
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...
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
Class to manage Schedule of loans.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
const STATUS_BILLED
Billed or processed quote.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
const STATUS_SIGNED
Signed quote.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
Class to manage Trips and Expenses.
Superclass for invoices classes.
const TYPE_DEPOSIT
Deposit invoice.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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) Si ...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.