35require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43if (isModEnabled(
'agenda')) {
44 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
46if (isModEnabled(
'bank')) {
47 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/paymentvarious.class.php';
49if (isModEnabled(
'category')) {
50 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
52if (isModEnabled(
'order')) {
53 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
55if (isModEnabled(
'contract')) {
56 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
58if (isModEnabled(
'deplacement')) {
59 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
61if (isModEnabled(
'don')) {
62 require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
64if (isModEnabled(
'shipping')) {
65 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
67if (isModEnabled(
'expensereport')) {
68 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
70if (isModEnabled(
'invoice')) {
71 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
72 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
74if (isModEnabled(
'intervention')) {
75 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
77if (isModEnabled(
'loan')) {
78 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
79 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
81if (isModEnabled(
'mrp')) {
82 require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
84if (isModEnabled(
'propal')) {
85 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
87if (isModEnabled(
'salaries')) {
88 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
90if (isModEnabled(
'stock')) {
91 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
92 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
94if (isModEnabled(
'supplier_invoice')) {
95 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
97if (isModEnabled(
'supplier_order')) {
98 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
100if (isModEnabled(
'supplier_proposal')) {
101 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
103if (isModEnabled(
'tax')) {
104 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
106if (isModEnabled(
'stocktransfer')) {
107 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
108 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransferline.class.php';
114$langs->loadLangs(array(
'projects',
'companies',
'suppliers',
'compta'));
115if (isModEnabled(
'invoice')) {
116 $langs->load(
"bills");
118if (isModEnabled(
'order')) {
119 $langs->load(
"orders");
121if (isModEnabled(
"propal")) {
122 $langs->load(
"propal");
124if (isModEnabled(
'intervention')) {
125 $langs->load(
"interventions");
127if (isModEnabled(
'deplacement')) {
128 $langs->load(
"trips");
130if (isModEnabled(
'expensereport')) {
131 $langs->load(
"trips");
133if (isModEnabled(
'don')) {
134 $langs->load(
"donations");
136if (isModEnabled(
'loan')) {
137 $langs->load(
"loan");
139if (isModEnabled(
'salaries')) {
140 $langs->load(
"salaries");
142if (isModEnabled(
'mrp')) {
145if (isModEnabled(
'eventorganization')) {
146 $langs->load(
"eventorganization");
151$action =
GETPOST(
'action',
'aZ09');
152$datesrfc =
GETPOST(
'datesrfc');
153$dateerfc =
GETPOST(
'dateerfc');
156if (empty($dates) && !empty($datesrfc)) {
159if (empty($datee) && !empty($dateerfc)) {
162if (!GETPOSTISSET(
'datesrfc') && !GETPOSTISSET(
'datesday') &&
getDolGlobalString(
'PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR')) {
169if ($id ==
'' && $ref ==
'') {
171 header(
'Location: list.php');
175$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
180include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
181if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
188$hookmanager->initHooks(array(
'projectOverview'));
205$title = $langs->trans(
'ProjectReferers').
' - '.
$object->ref.
' '.
$object->name;
207 $title =
$object->ref.
' '.
$object->name.
' - '.$langs->trans(
'ProjectReferers');
210$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
212llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project page-card_element');
214$form =
new Form($db);
218$userstatic =
new User($db);
221$userAccess =
$object->restrictedProjectArea($user);
229if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
230 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
231 $tmpurl = preg_replace(
'/__SOCID__/', (
string)
$object->socid, $tmpurl);
232 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
234 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
237$morehtmlref =
'<div class="refidno">';
241if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
242 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
244$morehtmlref .=
'</div>';
247if (!$user->hasRight(
'projet',
'all',
'lire')) {
248 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
249 $object->next_prev_filter =
"te.rowid IN (".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0').
")";
252dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
255print
'<div class="fichecenter">';
256print
'<div class="fichehalfleft">';
257print
'<div class="underbanner clearboth"></div>';
259print
'<table class="border tableforfield centpercent">';
263 print
'<tr><td class="tdtop">';
264 print $langs->trans(
"Usage");
268 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
269 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
270 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
274 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_task ?
' checked="checked"' :
'')).
'"> ';
275 $htmltext = $langs->trans(
"ProjectFollowTasks");
276 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
280 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"' :
'')).
'"> ';
281 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
282 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
285 if (isModEnabled(
'eventorganization')) {
286 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"' :
'')).
'"> ';
287 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
288 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
294print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
296 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
297 print $langs->trans(
'SharedProject');
299 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
300 print $langs->trans(
'PrivateProject');
306 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
309 print $langs->trans(
"OppStatus".$code);
314 print
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
315 if (!is_null(
$object->opp_percent) && strcmp(
$object->opp_percent,
'')) {
316 print
price(
$object->opp_percent, 0, $langs, 1, 0).
' %';
321 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
322 if (!is_null(
$object->opp_amount) && strcmp(
$object->opp_amount,
'')) {
323 print
'<span class="amount">'.price(
$object->opp_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
324 if (strcmp(
$object->opp_percent,
'')) {
325 print
' <span title="'.dol_escape_htmltag($langs->trans(
'OpportunityWeightedAmount')).
'"><span class="opacitymedium">'.$langs->trans(
"OpportunityWeightedAmountShort").
'</span>: <span class="amount">'.
price(
$object->opp_amount *
$object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).
'</span></span>';
332print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
333if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount,
'')) {
334 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
339print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
341print($start ? $start :
'?');
344print($end ? $end :
'?');
352include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
357print
'<div class="fichehalfright">';
358print
'<div class="underbanner clearboth"></div>';
360print
'<table class="border tableforfield centpercent">';
363print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
368if (isModEnabled(
'category')) {
369 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
370 print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
379print
'<div class="clearboth"></div>';
389$listofreferent = array(
391 'name' =>
"Warehouse",
392 'title' =>
"ListWarehouseAssociatedProject",
393 'class' =>
'Entrepot',
394 'table' =>
'entrepot',
395 'datefieldname' =>
'date_entrepot',
396 'urlnew' => DOL_URL_ROOT.
'/product/stock/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
397 'lang' =>
'entrepot',
398 'buttonnew' =>
'AddWarehouse',
399 'project_field' =>
'fk_project',
400 'testnew' => $user->hasRight(
'stock',
'creer'),
401 'test' => isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT')
404 'name' =>
"Proposals",
405 'title' =>
"ListProposalsAssociatedProject",
408 'datefieldname' =>
'datep',
409 'urlnew' => DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
411 'buttonnew' =>
'AddProp',
412 'testnew' => $user->hasRight(
'propal',
'creer'),
413 'test' => isModEnabled(
'propal') && $user->hasRight(
'propal',
'lire')
416 'name' =>
"CustomersOrders",
417 'title' =>
"ListOrdersAssociatedProject",
418 'class' =>
'Commande',
419 'table' =>
'commande',
420 'datefieldname' =>
'date_commande',
421 'urlnew' => DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
423 'buttonnew' =>
'CreateOrder',
424 'testnew' => $user->hasRight(
'commande',
'creer'),
425 'test' => isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')
428 'name' =>
"CustomersInvoices",
429 'title' =>
"ListInvoicesAssociatedProject",
430 'class' =>
'Facture',
432 'table' =>
'facture',
433 'datefieldname' =>
'datef',
434 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
436 'buttonnew' =>
'CreateBill',
437 'testnew' => $user->hasRight(
'facture',
'creer'),
438 'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
440 'invoice_predefined' => array(
441 'name' =>
"PredefinedInvoices",
442 'title' =>
"ListPredefinedInvoicesAssociatedProject",
443 'class' =>
'FactureRec',
444 'table' =>
'facture_rec',
445 'datefieldname' =>
'datec',
446 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
448 'buttonnew' =>
'CreateBill',
449 'testnew' => $user->hasRight(
'facture',
'creer'),
450 'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
452 'proposal_supplier' => array(
453 'name' =>
"SupplierProposals",
454 'title' =>
"ListSupplierProposalsAssociatedProject",
455 'class' =>
'SupplierProposal',
456 'table' =>
'supplier_proposal',
457 'datefieldname' =>
'date_valid',
458 'urlnew' => DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
459 'lang' =>
'supplier_proposal',
460 'buttonnew' =>
'AddSupplierProposal',
461 'testnew' => $user->hasRight(
'supplier_proposal',
'creer'),
462 'test' => isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')
464 'order_supplier' => array(
465 'name' =>
"SuppliersOrders",
466 'title' =>
"ListSupplierOrdersAssociatedProject",
467 'class' =>
'CommandeFournisseur',
468 'table' =>
'commande_fournisseur',
469 'datefieldname' =>
'date_commande',
470 'urlnew' => DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
471 'lang' =>
'suppliers',
472 'buttonnew' =>
'AddSupplierOrder',
473 'testnew' => $user->hasRight(
'fournisseur',
'commande',
'creer') || $user->hasRight(
'supplier_order',
'creer'),
474 'test' => isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'lire')
476 'invoice_supplier' => array(
477 'name' =>
"BillsSuppliers",
478 'title' =>
"ListSupplierInvoicesAssociatedProject",
479 'class' =>
'FactureFournisseur',
481 'table' =>
'facture_fourn',
482 'datefieldname' =>
'datef',
483 'urlnew' => DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
484 'lang' =>
'suppliers',
485 'buttonnew' =>
'AddSupplierInvoice',
486 'testnew' => $user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'),
487 'test' => isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')
490 'name' =>
"Contracts",
491 'title' =>
"ListContractAssociatedProject",
492 'class' =>
'Contrat',
493 'table' =>
'contrat',
494 'datefieldname' =>
'date_contrat',
495 'urlnew' => DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
496 'lang' =>
'contracts',
497 'buttonnew' =>
'AddContract',
498 'testnew' => $user->hasRight(
'contrat',
'creer'),
499 'test' => isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')
501 'intervention' => array(
502 'name' =>
"Interventions",
503 'title' =>
"ListFichinterAssociatedProject",
504 'class' =>
'Fichinter',
505 'table' =>
'fichinter',
506 'datefieldname' =>
'date_valid',
507 'disableamount' => 0,
509 'urlnew' => DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
510 'lang' =>
'interventions',
511 'buttonnew' =>
'AddIntervention',
512 'testnew' => $user->hasRight(
'ficheinter',
'creer'),
513 'test' => isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')
516 'name' =>
"Shippings",
517 'title' =>
"ListShippingAssociatedProject",
518 'class' =>
'Expedition',
519 'table' =>
'expedition',
520 'datefieldname' =>
'date_valid',
521 'urlnew' => DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
522 'lang' =>
'sendings',
523 'buttonnew' =>
'CreateShipment',
525 'test' => isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')
529 'title' =>
"ListMOAssociatedProject",
532 'datefieldname' =>
'date_valid',
533 'urlnew' => DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
535 'buttonnew' =>
'CreateMO',
536 'testnew' => $user->hasRight(
'mrp',
'write'),
537 'project_field' =>
'fk_project',
539 'test' => isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')
542 'name' =>
"TripsAndExpenses",
543 'title' =>
"ListExpenseReportsAssociatedProject",
544 'class' =>
'Deplacement',
545 'table' =>
'deplacement',
546 'datefieldname' =>
'dated',
548 'disableamount' => 1,
549 'urlnew' => DOL_URL_ROOT.
'/deplacement/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
551 'buttonnew' =>
'AddTrip',
552 'testnew' => $user->hasRight(
'deplacement',
'creer'),
553 'test' => isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')
555 'expensereport' => array(
556 'name' =>
"ExpenseReports",
557 'title' =>
"ListExpenseReportsAssociatedProject",
558 'class' =>
'ExpenseReportLine',
559 'table' =>
'expensereport_det',
560 'datefieldname' =>
'date',
562 'disableamount' => 0,
563 'urlnew' => DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
565 'buttonnew' =>
'AddTrip',
566 'testnew' => $user->hasRight(
'expensereport',
'creer'),
567 'test' => isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')
570 'name' =>
"Donation",
571 'title' =>
"ListDonationsAssociatedProject",
575 'datefieldname' =>
'datedon',
576 'disableamount' => 0,
577 'urlnew' => DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
578 'lang' =>
'donations',
579 'buttonnew' =>
'AddDonation',
580 'testnew' => $user->hasRight(
'don',
'creer'),
581 'test' => isModEnabled(
'don') && $user->hasRight(
'don',
'lire')
585 'title' =>
"ListLoanAssociatedProject",
589 'datefieldname' =>
'datestart',
590 'disableamount' => 0,
591 'urlnew' => DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
593 'buttonnew' =>
'AddLoan',
594 'testnew' => $user->hasRight(
'loan',
'write'),
595 'test' => isModEnabled(
'loan') && $user->hasRight(
'loan',
'read')
597 'chargesociales' => array(
598 'name' =>
"SocialContribution",
599 'title' =>
"ListSocialContributionAssociatedProject",
600 'class' =>
'ChargeSociales',
602 'table' =>
'chargesociales',
603 'datefieldname' =>
'date_ech',
604 'disableamount' => 0,
605 'urlnew' => DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
607 'buttonnew' =>
'AddSocialContribution',
608 'testnew' => $user->hasRight(
'tax',
'charges',
'lire'),
609 'test' => isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')
611 'project_task' => array(
612 'name' =>
"TaskTimeSpent",
613 'title' =>
"ListTaskTimeUserProject",
616 'table' =>
'projet_task',
617 'datefieldname' =>
'element_date',
618 'disableamount' => 0,
619 'urlnew' => DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
620 'buttonnew' =>
'AddTimeSpent',
621 'testnew' => $user->hasRight(
'project',
'creer'),
622 'test' => isModEnabled(
'project') && $user->hasRight(
'projet',
'lire') && !
getDolGlobalString(
'PROJECT_HIDE_TASKS')
624 'stock_mouvement' => array(
625 'name' =>
"MouvementStockAssociated",
626 'title' =>
"ListMouvementStockProject",
627 'class' =>
'StockTransfer',
628 'table' =>
'stocktransfer_stocktransfer',
629 'datefieldname' =>
'datem',
631 'project_field' =>
'fk_project',
632 'disableamount' => 0,
633 'test' => isModEnabled(
'stock') && $user->hasRight(
'stock',
'mouvement',
'lire') &&
getDolGlobalString(
'STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW')
636 'name' =>
"Salaries",
637 'title' =>
"ListSalariesAssociatedProject",
640 'datefieldname' =>
'datesp',
642 'disableamount' => 0,
643 'urlnew' => DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
644 'lang' =>
'salaries',
645 'buttonnew' =>
'AddSalary',
646 'testnew' => $user->hasRight(
'salaries',
'write'),
647 'test' => isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read')
649 'variouspayment' => array(
650 'name' =>
"VariousPayments",
651 'title' =>
"ListVariousPaymentsAssociatedProject",
652 'class' =>
'PaymentVarious',
653 'table' =>
'payment_various',
654 'datefieldname' =>
'datev',
656 'disableamount' => 0,
657 'urlnew' => DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
659 'buttonnew' =>
'AddVariousPayment',
660 'testnew' => $user->hasRight(
'banque',
'modifier'),
661 'test' => isModEnabled(
"bank") && $user->hasRight(
'banque',
'lire') && !
getDolGlobalString(
'BANK_USE_OLD_VARIOUS_PAYMENT')
681 foreach ($listofreferent as $key => $element) {
682 if ($listofreferent[$key][
'margin'] ==
'add') {
683 unset($listofreferent[$key][
'margin']);
686 $newelementforplusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_PLUS_MARGIN'));
687 foreach ($newelementforplusmargin as $value) {
688 $listofreferent[trim($value)][
'margin'] =
'add';
692 foreach ($listofreferent as $key => $element) {
693 if ($listofreferent[$key][
'margin'] ==
'minus') {
694 unset($listofreferent[$key][
'margin']);
697 $newelementforminusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_MINUS_MARGIN'));
698 foreach ($newelementforminusmargin as $value) {
699 $listofreferent[trim($value)][
'margin'] =
'minus';
704$parameters = array(
'listofreferent' => $listofreferent);
705$resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
707if (!empty($hookmanager->resArray)) {
708 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
709} elseif ($resHook > 0 && !empty($hookmanager->resPrint)) {
710 $listofreferent = $hookmanager->resPrint;
713if ($action ==
"addelement") {
714 $tablename =
GETPOST(
"tablename");
715 $elementselectid =
GETPOST(
"elementselect");
716 $result =
$object->update_element($tablename, $elementselectid);
720} elseif ($action ==
"unlink") {
721 $tablename =
GETPOST(
"tablename",
"aZ09");
722 $projectField = GETPOSTISSET(
'projectfield') ?
GETPOST(
'projectfield',
'aZ09') :
'fk_projet';
723 $elementselectid =
GETPOSTINT(
"elementselect");
725 $result =
$object->remove_element($tablename, $elementselectid, $projectField);
731$elementuser =
new User($db);
737if (!$showdatefilter) {
738 print
'<div class="center centpercent">';
739 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
740 print
'<input type="hidden" name="token" value="'.newToken().
'">';
741 print
'<input type="hidden" name="tablename" value="'.(empty($tablename) ?
'' : $tablename).
'">';
742 print
'<input type="hidden" name="action" value="view">';
743 print
'<div class="inline-block">';
744 print $form->selectDate($dates,
'dates', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
746 print
'<div class="inline-block">';
747 print $form->selectDate($datee,
'datee', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
749 print
'<div class="inline-block">';
750 print
'<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button small">';
762$langs->loadLangs(array(
"suppliers",
"bills",
"orders",
"proposals",
"margins"));
764if (isModEnabled(
'stock')) {
765 $langs->load(
'stocks');
770print
'<table class="noborder centpercent">';
771print
'<tr class="liste_titre">';
772print
'<td class="left" width="200">';
773$tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
774$tooltiponprofitplus = $tooltiponprofitminus =
'';
775foreach ($listofreferent as $key => $value) {
776 if (!empty($value[
'lang'])) {
777 $langs->load($value[
'lang']);
779 $name = $langs->trans($value[
'name']);
780 $qualified = $value[
'test'];
781 $margin = empty($value[
'margin']) ?
'' : $value[
'margin'];
782 if ($qualified && isset($margin)) {
783 if ($margin ===
'add') {
784 $tooltiponprofitplus .=
' > '.$name.
" (+)<br>\n";
786 if ($margin ===
'minus') {
787 $tooltiponprofitminus .=
' > '.$name.
" (-)<br>\n";
791$tooltiponprofit .= $tooltiponprofitplus;
792$tooltiponprofit .= $tooltiponprofitminus;
793print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
795print
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
796print
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
797print
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
800$total_revenue_ht = 0;
805foreach ($listofreferent as $key => $value) {
807 'total_revenue_ht' => & $total_revenue_ht,
808 'balance_ht' => & $balance_ht,
809 'balance_ttc' => & $balance_ttc,
815 $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action);
818 } elseif ($reshook > 0) {
819 print $hookmanager->resPrint;
823 $name = $langs->trans($value[
'name']);
824 $title = $value[
'title'];
825 $classname = $value[
'class'];
826 $tablename = $value[
'table'];
827 $datefieldname = $value[
'datefieldname'];
828 $qualified = $value[
'test'];
829 $margin = empty($value[
'margin']) ? 0 : $value[
'margin'];
830 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
831 if ($qualified && isset($margin)) {
832 $element =
new $classname($db);
834 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
836 if (is_array($elementarray) && count($elementarray) > 0) {
841 $num = count($elementarray);
842 for ($i = 0; $i < $num; $i++) {
843 $tmp = explode(
'_', $elementarray[$i]);
844 $idofelement = $tmp[0];
845 $idofelementuser = !empty($tmp[1]) ? $tmp[1] :
"";
847 $element->fetch($idofelement);
848 if ($idofelementuser) {
849 $elementuser->fetch($idofelementuser);
853 $qualifiedfortotal =
true;
854 if ($key ==
'invoice') {
855 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
856 $qualifiedfortotal =
false;
859 $qualifiedfortotal =
false;
862 if ($key ==
'propal') {
864 $qualifiedfortotal =
false;
868 if ($tablename !=
'expensereport_det' && method_exists($element,
'fetch_thirdparty')) {
869 $element->fetch_thirdparty();
873 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
874 $total_ht_by_line = $element->amount;
875 } elseif ($tablename ==
'fichinter') {
876 $total_ht_by_line = $element->getAmount();
877 } elseif ($tablename ==
'stock_mouvement') {
878 $total_ht_by_line = $element->price * abs($element->qty);
879 } elseif ($tablename ==
'projet_task') {
880 $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', $dates, $datee);
881 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
882 } elseif ($key ==
'loan') {
883 if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
885 $total_ht_by_line = -$element->capital;
888 $total_ht_by_line = 0;
890 $loanScheduleStatic->fetchAll($element->id);
891 if (!empty($loanScheduleStatic->lines)) {
892 foreach ($loanScheduleStatic->lines as $loanSchedule) {
896 if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee)
897 || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <=
dol_now()
898 || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
900 $total_ht_by_line -= $loanSchedule->amount_capital;
906 $total_ht_by_line = $element->total_ht;
910 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
911 $total_ttc_by_line = $element->amount;
912 } elseif ($tablename ==
'fichinter') {
913 $total_ttc_by_line = $element->getAmount();
914 } elseif ($tablename ==
'stock_mouvement') {
915 $total_ttc_by_line = $element->price * abs($element->qty);
916 } elseif ($tablename ==
'projet_task') {
919 if (preg_replace(
'/^(\d+\.)\s\(.*\)/', $defaultvat, $reg)) {
921 $defaultvat = $reg[1];
923 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ((
float) $defaultvat / 100)),
'MT');
924 } elseif ($key ==
'loan') {
925 $total_ttc_by_line = $total_ht_by_line;
927 $total_ttc_by_line = $element->total_ttc;
931 if ($tablename ==
'payment_various') {
932 if ($element->sens == 1) {
933 $total_ht_by_line = -$total_ht_by_line;
934 $total_ttc_by_line = -$total_ttc_by_line;
939 if ($qualifiedfortotal) {
940 $total_ht += $total_ht_by_line;
941 $total_ttc += $total_ttc_by_line;
949 if ($margin ===
'add') {
950 $total_revenue_ht += $total_ht;
953 if ($margin ===
"minus") {
954 $total_ht = -$total_ht;
955 $total_ttc = -$total_ttc;
958 $balance_ht += $total_ht;
959 $balance_ttc += $total_ttc;
962 print
'<tr class="oddeven">';
964 print
'<td class="left">'.$name.
'</td>';
966 print
'<td class="right">'.$i.
'</td>';
968 print
'<td class="right">';
969 if ($key ==
'intervention' && !$margin) {
970 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
972 if ($key ==
'propal') {
973 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
975 print
price($total_ht);
979 print
'<td class="right">';
980 if ($key ==
'intervention' && !$margin) {
981 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
983 if ($key ==
'propal') {
984 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
986 print
price($total_ttc);
994print
'<tr class="liste_total">';
995print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
996print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
997print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
1001if (
$object->usage_organize_event) {
1002 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1004 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int)
$object->id).
') AND (t.status:=:'.ConferenceOrBoothAttendee::STATUS_VALIDATED.
')');
1006 if (!is_array($result) && $result < 0) {
1007 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
1009 $nbAttendees = count($result);
1012 if ($nbAttendees >= 2) {
1013 $costperattendee_ht = $balance_ht / $nbAttendees;
1014 $costperattendee_ttc = $balance_ttc / $nbAttendees;
1015 print
'<tr class="liste_total">';
1016 print
'<td class="right" colspan="2">'.$langs->trans(
"ProfitPerValidatedAttendee").
'</td>';
1017 print
'<td class="right">'.price(
price2num($costperattendee_ht,
'MT')).
'</td>';
1018 print
'<td class="right">'.price(
price2num($costperattendee_ttc,
'MT')).
'</td>';
1024if ($total_revenue_ht) {
1025 print
'<tr class="liste_total">';
1026 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
1027 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
1028 print
'<td class="right"></td>';
1042foreach ($listofreferent as $key => $value) {
1043 $parameters = array(
1045 'value' => & $value,
1049 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
1052 } elseif ($reshook > 0) {
1053 print $hookmanager->resPrint;
1057 $title = $value[
'title'];
1058 $classname = $value[
'class'];
1059 $tablename = $value[
'table'];
1060 $datefieldname = $value[
'datefieldname'];
1061 $qualified = $value[
'test'];
1062 $urlnew = empty($value[
'urlnew']) ?
'' : $value[
'urlnew'];
1063 $buttonnew = empty($value[
'buttonnew']) ?
'' : $value[
'buttonnew'];
1064 $testnew = empty($value[
'testnew']) ?
'' : $value[
'testnew'];
1065 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
1066 $nototal = empty($value[
'nototal']) ? 0 : 1;
1068 $exclude_select_element = array(
'payment_various');
1069 if (!empty($value[
'exclude_select_element'])) {
1070 $exclude_select_element[] = $value[
'exclude_select_element'];
1077 $element =
new $classname($db);
1081 $idtofilterthirdparty = 0;
1082 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
1083 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
1084 $idtofilterthirdparty = empty(
$object->thirdparty->id) ? 0 :
$object->thirdparty->id;
1086 $idtofilterthirdparty .=
',' .
getDolGlobalString(
'PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS');
1090 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
1093 if (!
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
1094 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, empty($project_field) ?
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
1095 if ($selectList < 0) {
1097 } elseif ($selectList) {
1099 $addform .=
'<div class="inline-block valignmiddle">';
1100 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1101 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1102 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
1103 $addform .=
'<input type="hidden" name="action" value="addelement">';
1104 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
1105 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
1106 $addform .=
'<table><tr>';
1108 $addform .=
'<td>'.$selectList.
'</td>';
1109 $addform .=
'<td><input type="submit" class="button button-linkto smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
1110 $addform .=
'</tr></table>';
1111 $addform .=
'</form>';
1112 $addform .=
'</div>';
1116 $addform .=
'<div class="inline-block valignmiddle">';
1118 $addform .=
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
1120 $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>';
1122 $addform .=
'<div>';
1125 if (is_array($elementarray) && count($elementarray) > 0 && $key ==
"order_supplier") {
1126 $addform =
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1127 <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
1130 $("#btnShow").on("click", function () {
1131 console.log("We click to show or hide the canceled lines");
1132 var attr = $(this).attr("data-canceledarehidden");
1133 if (typeof attr !== "undefined" && attr !== false) {
1134 console.log("Show canceled");
1135 $(".tr_canceled").show();
1136 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'");
1137 $("#btnShow").removeAttr("data-canceledarehidden");
1138 $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye");
1140 console.log("Hide canceled");
1141 $(".tr_canceled").hide();
1142 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'");
1143 $("#btnShow").attr("data-canceledarehidden", 1);
1144 $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash");
1147 </script></div> '.$addform;
1152 print
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
1153 print
'<div class="div-table-responsive">';
1154 print
'<table class="noborder centpercent">';
1156 print
'<tr class="liste_titre">';
1158 print
'<td style="width: 24px"></td>';
1160 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
'>'.$langs->trans(
"Ref").
'</td>';
1162 if (
'MouvementStock' == $classname) {
1163 print
'<td style="width: 200px">'.$langs->trans(
"Product").
'</td>';
1164 print
'<td style="width: 50px">'.$langs->trans(
"Qty").
'</td>';
1167 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
' class="center">';
1168 if (in_array($tablename, array(
'projet_task'))) {
1169 print $langs->trans(
"TimeSpent");
1171 if (!in_array($tablename, array(
'projet_task'))) {
1172 print $langs->trans(
"Date");
1177 if (in_array($tablename, array(
'projet_task')) && $key ==
'project_task') {
1179 } elseif (in_array($tablename, array(
'payment_various'))) {
1180 print $langs->trans(
"Label");
1181 } elseif (in_array($tablename, array(
'expensereport_det',
'don',
'projet_task',
'stock_mouvement',
'salary'))) {
1182 print $langs->trans(
"User");
1184 print $langs->trans(
"ThirdParty");
1188 if ($tablename ==
'fichinter') {
1190 print $langs->trans(
"TotalDuration");
1191 $total_duration = 0;
1197 if ($key ==
'loan') {
1198 print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
1199 } elseif (empty($value[
'disableamount'])) {
1200 print
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
1202 print
'<td width="120"></td>';
1206 if ($key ==
'loan') {
1207 print
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
1208 } elseif (empty($value[
'disableamount'])) {
1209 print
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
1211 print
'<td width="120"></td>';
1214 if (in_array($tablename, array(
'projet_task'))) {
1215 print
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
1217 print
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
1221 if (is_array($elementarray) && count($elementarray) > 0) {
1225 $total_ht_by_third = 0;
1226 $total_ttc_by_third = 0;
1228 $saved_third_id = 0;
1236 $num = count($elementarray);
1237 for ($i = 0; $i < $num; $i++) {
1238 $tmp = explode(
'_', $elementarray[$i]);
1239 $idofelement = $tmp[0];
1240 $idofelementuser = isset($tmp[1]) ? $tmp[1] :
"";
1242 $element->fetch($idofelement);
1243 if ($idofelementuser) {
1244 $elementuser->fetch($idofelementuser);
1248 if ($tablename !=
'expensereport_det') {
1249 if (method_exists($element,
'fetch_thirdparty')) {
1250 $element->fetch_thirdparty();
1254 $expensereport->fetch($element->fk_expensereport);
1259 if ($breakline && $saved_third_id != $element->thirdparty->id) {
1262 $saved_third_id = $element->thirdparty->id;
1265 $total_ht_by_third = 0;
1266 $total_ttc_by_third = 0;
1269 $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
1271 $qualifiedfortotal =
true;
1272 if ($key ==
'invoice') {
1273 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
1274 $qualifiedfortotal =
false;
1276 } elseif ($key ==
'order_supplier' && $element->status == 7) {
1277 $qualifiedfortotal =
false;
1280 if ($key ==
"order_supplier" && $element->status == 7) {
1281 print
'<tr class="oddeven tr_canceled" style=display:none>';
1283 print
'<tr class="oddeven" >';
1288 print
'<td style="width: 24px">';
1289 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement') {
1291 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1292 print
img_picto($langs->trans(
'Unlink'),
'unlink');
1299 print
'<td class="left nowraponall tdoverflowmax250">';
1300 if ($tablename ==
'expensereport_det') {
1301 print $expensereport->getNomUrl(1);
1304 if ($element instanceof
Task) {
1305 print $element->getNomUrl(1,
'withproject',
'time');
1306 print
' - '.dol_trunc($element->label, 48);
1307 } elseif ($key ==
'loan') {
1308 print $element->getNomUrl(1);
1309 print
' - '.dol_trunc($element->label, 48);
1311 print $element->getNomUrl(1);
1314 $element_doc = $element->element;
1316 if (!empty($conf->$element_doc)) {
1317 $confelementdoc = $conf->$element_doc;
1318 $filedir = $confelementdoc->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1323 if ($element_doc ===
'order_supplier') {
1324 $element_doc =
'commande_fournisseur';
1325 $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1326 } elseif ($element_doc ===
'invoice_supplier') {
1327 $element_doc =
'facture_fournisseur';
1328 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1329 $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].
'/'.$filename;
1332 print
'<div class="inline-block valignmiddle">';
1334 print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
1339 if (!empty($element->ref_supplier)) {
1340 print
' - '.$element->ref_supplier;
1343 if (!empty($element->ref_customer)) {
1344 print
' - '.$element->ref_customer;
1347 if (empty($element->ref_customer) && !empty($element->ref_client)) {
1348 print
' - '.$element->ref_client;
1353 if (
'MouvementStock' == $classname) {
1354 $mvsProd =
new Product($element->db);
1355 $mvsProd->fetch($element->product_id);
1356 print
'<td>'.$mvsProd->getNomUrl(1).
'</td>';
1357 print
'<td>'.$element->qty.
'</td>';
1361 $total_time_by_line =
null;
1362 if ($tablename ==
'expensereport_det') {
1363 $date = $element->date;
1364 } elseif ($tablename ==
'stock_mouvement') {
1365 $date = $element->datem;
1366 } elseif ($tablename ==
'salary') {
1367 $date = $element->datesp;
1368 } elseif ($tablename ==
'payment_various') {
1369 $date = $element->datev;
1370 } elseif ($tablename ==
'chargesociales') {
1371 $date = $element->date_ech;
1372 } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
1373 if ($tablename ==
'don') {
1374 $date = $element->datedon;
1376 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
1377 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1378 } elseif ($tablename ==
'supplier_proposal') {
1379 $date = $element->date_validation;
1380 } elseif ($tablename ==
'fichinter') {
1381 $date = $element->datev;
1382 } elseif ($tablename ==
'projet_task') {
1385 $date = $element->date;
1387 $date = $element->date_contrat;
1390 $date = $element->datev;
1392 if (empty($date) && !empty($datefieldname)) {
1393 $date = $element->$datefieldname;
1396 } elseif ($key ==
'loan') {
1397 $date = $element->datestart;
1400 print
'<td class="center">';
1401 if ($tablename ==
'actioncomm') {
1403 if ($element->datef && $element->datef > $element->datep) {
1404 print
" - ".dol_print_date($element->datef,
'dayhour');
1406 } elseif (in_array($tablename, array(
'projet_task'))) {
1407 $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', $dates, $datee);
1408 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1411 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1418 print
'<td class="tdoverflowmax150">';
1419 if (is_object($element->thirdparty)) {
1420 print $element->thirdparty->getNomUrl(1,
'', 48);
1421 } elseif ($tablename ==
'expensereport_det') {
1422 $tmpuser =
new User($db);
1423 $tmpuser->fetch($expensereport->fk_user_author);
1424 print $tmpuser->getNomUrl(1,
'', 48);
1425 } elseif ($tablename ==
'salary') {
1426 $tmpuser =
new User($db);
1427 $tmpuser->fetch($element->fk_user);
1428 print $tmpuser->getNomUrl(1,
'', 48);
1429 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement') {
1430 if ($element->fk_user_author > 0) {
1431 $tmpuser2 =
new User($db);
1432 $tmpuser2->fetch($element->fk_user_author);
1433 print $tmpuser2->getNomUrl(1,
'', 48);
1435 } elseif ($tablename ==
'projet_task' && $key ==
'element_time') {
1436 print $elementuser->getNomUrl(1);
1437 } elseif ($tablename ==
'payment_various') {
1438 print $element->label;
1443 if ($tablename ==
'fichinter') {
1445 print
convertSecondToTime($element->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
1446 $total_duration += $element->duration;
1452 if (empty($value[
'disableamount'])) {
1453 $total_ht_by_line =
null;
1455 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1456 $total_ht_by_line = $element->amount;
1457 } elseif ($tablename ==
'fichinter') {
1458 $total_ht_by_line = $element->getAmount();
1459 } elseif ($tablename ==
'stock_mouvement') {
1460 $total_ht_by_line = $element->price * abs($element->qty);
1461 } elseif (in_array($tablename, array(
'projet_task'))) {
1462 if (isModEnabled(
'salaries')) {
1464 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1465 if ($tmpprojtime[
'nblinesnull'] > 0) {
1466 $langs->load(
"errors");
1467 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate", $conf->currency);
1470 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1472 } elseif ($key ==
'loan') {
1473 $total_ht_by_line = $element->capital;
1475 $total_ht_by_line = $element->total_ht;
1479 if ($tablename ==
'payment_various') {
1480 if ($element->sens == 0) {
1481 $total_ht_by_line = -$total_ht_by_line;
1485 print
'<td class="right">';
1486 if ($othermessage) {
1487 print
'<span class="opacitymedium">'.$othermessage.
'</span>';
1489 if (isset($total_ht_by_line)) {
1490 if (!$qualifiedfortotal) {
1493 print
'<span class="amount">'.price($total_ht_by_line).
'</span>';
1494 if (!$qualifiedfortotal) {
1499 print
' '.img_warning($warning);
1507 if (empty($value[
'disableamount'])) {
1508 $total_ttc_by_line =
null;
1509 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1510 $total_ttc_by_line = $element->amount;
1511 } elseif ($tablename ==
'fichinter') {
1512 $total_ttc_by_line = $element->getAmount();
1513 } elseif ($tablename ==
'stock_mouvement') {
1514 $total_ttc_by_line = $element->price * abs($element->qty);
1515 } elseif ($tablename ==
'projet_task') {
1516 if (isModEnabled(
'salaries')) {
1519 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1521 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1523 } elseif ($key ==
'loan') {
1524 $total_ttc_by_line = $element->capital - $element->getSumPayment();
1526 $total_ttc_by_line = $element->total_ttc;
1530 if ($tablename ==
'payment_various') {
1531 if ($element->sens == 0) {
1532 $total_ttc_by_line = -$total_ttc_by_line;
1536 print
'<td class="right">';
1537 if ($othermessage) {
1538 print $othermessage;
1540 if (isset($total_ttc_by_line)) {
1541 if (!$qualifiedfortotal) {
1544 print
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
1545 if (!$qualifiedfortotal) {
1550 print
' '.img_warning($warning);
1558 print
'<td class="right">';
1559 if ($tablename ==
'expensereport_det') {
1560 print $expensereport->getLibStatut(5);
1563 print $element->getLibStatut(5, $element->getSommePaiement());
1564 } elseif ($element instanceof
Task) {
1565 if ($element->progress !=
'') {
1566 print $element->progress.
' %';
1568 } elseif ($tablename ==
'stock_mouvement') {
1569 print $element->getLibStatut(3);
1571 print $element->getLibStatut(5);
1577 if ($qualifiedfortotal) {
1578 $total_ht += $total_ht_by_line;
1579 $total_ttc += $total_ttc_by_line;
1581 $total_ht_by_third += $total_ht_by_line;
1582 $total_ttc_by_third += $total_ttc_by_line;
1584 if (!isset($total_time)) {
1585 $total_time = $total_time_by_line;
1587 $total_time += $total_time_by_line;
1592 $breakline =
'<tr class="liste_total liste_sub_total">';
1593 $breakline .=
'<td colspan="2">';
1594 $breakline .=
'</td>';
1595 $breakline .=
'<td>';
1596 $breakline .=
'</td>';
1597 $breakline .=
'<td class="right">';
1598 $breakline .= $langs->trans(
'SubTotal').
' : ';
1599 if (is_object($element->thirdparty)) {
1600 $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1602 $breakline .=
'</td>';
1603 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1604 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1605 $breakline .=
'<td></td>';
1606 $breakline .=
'</tr>';
1617 if (empty($nototal)) {
1619 if (in_array($tablename, array(
'projet_task'))) {
1623 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1624 if (in_array($tablename, array(
'projet_task'))) {
1625 print
'<td class="center">';
1634 if ($tablename ==
'fichinter') {
1635 print
'<td class="left">'.convertSecondToTime($total_duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1637 print
'<td class="right">';
1638 if (empty($value[
'disableamount'])) {
1639 if ($key ==
'loan') {
1640 print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1641 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1642 print
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
1648 print
'<td class="right">';
1649 if (empty($value[
'disableamount'])) {
1650 if ($key ==
'loan') {
1651 print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
1652 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1653 print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
1657 print
'<td> </td>';
1661 if (!is_array($elementarray)) {
1662 print
'<tr><td>'.$elementarray.
'</td></tr>';
1665 if ($tablename ==
'fichinter') {
1668 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1678if ($conf->use_javascript_ajax) {
1679 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
1682 print $comboenhancement;
1704 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
1715 global $db, $classname;
1717 $element =
new $classname($db);
1719 $clientname = array();
1720 foreach ($elementarray as $key =>
$id) {
1721 if (empty($clientname[
$id])) {
1722 $element->fetch(
$id);
1723 $element->fetch_thirdparty();
1725 $clientname[
$id] = $element->thirdparty->name;
1732 $elementarray = array();
1733 foreach ($clientname as
$id => $name) {
1734 $elementarray[] =
$id;
1737 return $elementarray;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Superclass for invoices classes.
Class for ConferenceOrBoothAttendee.
Class to manage Trips and Expenses.
const TYPE_DEPOSIT
Deposit invoice.
Class to manage Schedule of loans.
Class to manage products or services.
Class to manage projects.
const STATUS_SIGNED
Signed quote.
const STATUS_BILLED
Billed or processed quote.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_stringtotime($string, $gm=1)
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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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, $attop=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_now($mode='auto')
Return date for now.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.