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';
121$langs->loadLangs(array(
'projects',
'companies',
'suppliers',
'compta'));
122if (isModEnabled(
'invoice')) {
123 $langs->load(
"bills");
125if (isModEnabled(
'order')) {
126 $langs->load(
"orders");
128if (isModEnabled(
"propal")) {
129 $langs->load(
"propal");
131if (isModEnabled(
'intervention')) {
132 $langs->load(
"interventions");
134if (isModEnabled(
'deplacement')) {
135 $langs->load(
"trips");
137if (isModEnabled(
'expensereport')) {
138 $langs->load(
"trips");
140if (isModEnabled(
'don')) {
141 $langs->load(
"donations");
143if (isModEnabled(
'loan')) {
144 $langs->load(
"loan");
146if (isModEnabled(
'salaries')) {
147 $langs->load(
"salaries");
149if (isModEnabled(
'mrp')) {
152if (isModEnabled(
'eventorganization')) {
153 $langs->load(
"eventorganization");
158$action =
GETPOST(
'action',
'aZ09');
159$datesrfc =
GETPOST(
'datesrfc');
160$dateerfc =
GETPOST(
'dateerfc');
163if (empty($dates) && !empty($datesrfc)) {
166if (empty($datee) && !empty($dateerfc)) {
169if (!GETPOSTISSET(
'datesrfc') && !GETPOSTISSET(
'datesday') &&
getDolGlobalString(
'PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR')) {
176if ($id ==
'' && $ref ==
'') {
178 header(
'Location: list.php');
189$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
194include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
195if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
202$hookmanager->initHooks(array(
'projectOverview'));
208$total_ttc_by_line = 0;
209$total_ht_by_line = 0;
210$expensereport =
null;
212$tmpprojtime = array();
226$title = $langs->trans(
'ProjectReferers').
' - '.
$object->ref.
' '.
$object->name;
228 $title =
$object->ref.
' '.
$object->name.
' - '.$langs->trans(
'ProjectReferers');
231$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
233llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project page-card_element');
235$form =
new Form($db);
239$userstatic =
new User($db);
242$userAccess =
$object->restrictedProjectArea($user);
250if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
251 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
252 $tmpurl = preg_replace(
'/__SOCID__/', (
string)
$object->socid, $tmpurl);
253 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
255 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
258$morehtmlref =
'<div class="refidno">';
262if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
263 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
265$morehtmlref .=
'</div>';
268if (!$user->hasRight(
'projet',
'all',
'lire')) {
269 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
270 $object->next_prev_filter =
"te.rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0').
")";
273dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
276print
'<div class="fichecenter">';
277print
'<div class="fichehalfleft">';
278print
'<div class="underbanner clearboth"></div>';
280print
'<table class="border tableforfield centpercent">';
284 print
'<tr><td class="tdtop">';
285 print $langs->trans(
"Usage");
289 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
290 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
291 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
295 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_task ?
' checked="checked"' :
'')).
'"> ';
296 $htmltext = $langs->trans(
"ProjectFollowTasks");
297 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
301 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"' :
'')).
'"> ';
302 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
303 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
306 if (isModEnabled(
'eventorganization')) {
307 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"' :
'')).
'"> ';
308 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
309 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
315print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
317 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
318 print $langs->trans(
'SharedProject');
320 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
321 print $langs->trans(
'PrivateProject');
327 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
330 print $langs->trans(
"OppStatus".$code);
335 print
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
336 if (!is_null(
$object->opp_percent) && strcmp(
$object->opp_percent,
'')) {
337 print
price(
$object->opp_percent, 0, $langs, 1, 0).
' %';
342 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
343 if (!is_null(
$object->opp_amount) && strcmp(
$object->opp_amount,
'')) {
344 print
'<span class="amount">'.price(
$object->opp_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
345 if (strcmp(
$object->opp_percent,
'')) {
346 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>';
353print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
354if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount,
'')) {
355 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
360print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
362print($start ? $start :
'?');
365print($end ? $end :
'?');
373include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
378print
'<div class="fichehalfright">';
379print
'<div class="underbanner clearboth"></div>';
381print
'<table class="border tableforfield centpercent">';
384print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
389if (isModEnabled(
'category')) {
390 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
391 print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
400print
'<div class="clearboth"></div>';
410$listofreferent = array(
412 'name' =>
"Warehouse",
413 'title' =>
"ListWarehouseAssociatedProject",
414 'class' =>
'Entrepot',
415 'table' =>
'entrepot',
416 'datefieldname' =>
'date_entrepot',
417 'urlnew' => DOL_URL_ROOT.
'/product/stock/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
418 'lang' =>
'entrepot',
419 'buttonnew' =>
'AddWarehouse',
420 'project_field' =>
'fk_project',
421 'testnew' => $user->hasRight(
'stock',
'creer'),
422 'test' => isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT')
425 'name' =>
"Proposals",
426 'title' =>
"ListProposalsAssociatedProject",
429 'datefieldname' =>
'datep',
430 'urlnew' => DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
432 'buttonnew' =>
'AddProp',
433 'testnew' => $user->hasRight(
'propal',
'creer'),
434 'test' => isModEnabled(
'propal') && $user->hasRight(
'propal',
'lire')
437 'name' =>
"CustomersOrders",
438 'title' =>
"ListOrdersAssociatedProject",
439 'class' =>
'Commande',
440 'table' =>
'commande',
441 'datefieldname' =>
'date_commande',
442 'urlnew' => DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
444 'buttonnew' =>
'CreateOrder',
445 'testnew' => $user->hasRight(
'commande',
'creer'),
446 'test' => isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')
449 'name' =>
"CustomersInvoices",
450 'title' =>
"ListInvoicesAssociatedProject",
451 'class' =>
'Facture',
453 'table' =>
'facture',
454 'datefieldname' =>
'datef',
455 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
457 'buttonnew' =>
'CreateBill',
458 'testnew' => $user->hasRight(
'facture',
'creer'),
459 'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
461 'invoice_predefined' => array(
462 'name' =>
"PredefinedInvoices",
463 'title' =>
"ListPredefinedInvoicesAssociatedProject",
464 'class' =>
'FactureRec',
465 'table' =>
'facture_rec',
466 'datefieldname' =>
'datec',
467 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
469 'buttonnew' =>
'CreateBill',
470 'testnew' => $user->hasRight(
'facture',
'creer'),
471 'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
473 'proposal_supplier' => array(
474 'name' =>
"SupplierProposals",
475 'title' =>
"ListSupplierProposalsAssociatedProject",
476 'class' =>
'SupplierProposal',
477 'table' =>
'supplier_proposal',
478 'datefieldname' =>
'date_valid',
479 'urlnew' => DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
480 'lang' =>
'supplier_proposal',
481 'buttonnew' =>
'AddSupplierProposal',
482 'testnew' => $user->hasRight(
'supplier_proposal',
'creer'),
483 'test' => isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')
485 'order_supplier' => array(
486 'name' =>
"SuppliersOrders",
487 'title' =>
"ListSupplierOrdersAssociatedProject",
488 'class' =>
'CommandeFournisseur',
489 'table' =>
'commande_fournisseur',
490 'datefieldname' =>
'date_commande',
491 'urlnew' => DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
492 'lang' =>
'suppliers',
493 'buttonnew' =>
'AddSupplierOrder',
494 'testnew' => $user->hasRight(
'fournisseur',
'commande',
'creer') || $user->hasRight(
'supplier_order',
'creer'),
495 'test' => isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'lire')
497 'invoice_supplier' => array(
498 'name' =>
"BillsSuppliers",
499 'title' =>
"ListSupplierInvoicesAssociatedProject",
500 'class' =>
'FactureFournisseur',
502 'table' =>
'facture_fourn',
503 'datefieldname' =>
'datef',
504 'urlnew' => DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
505 'lang' =>
'suppliers',
506 'buttonnew' =>
'AddSupplierInvoice',
507 'testnew' => $user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'),
508 'test' => isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')
511 'name' =>
"Contracts",
512 'title' =>
"ListContractAssociatedProject",
513 'class' =>
'Contrat',
514 'table' =>
'contrat',
515 'datefieldname' =>
'date_contrat',
516 'urlnew' => DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
517 'lang' =>
'contracts',
518 'buttonnew' =>
'AddContract',
519 'testnew' => $user->hasRight(
'contrat',
'creer'),
520 'test' => isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')
522 'intervention' => array(
523 'name' =>
"Interventions",
524 'title' =>
"ListFichinterAssociatedProject",
525 'class' =>
'Fichinter',
526 'table' =>
'fichinter',
527 'datefieldname' =>
'date_valid',
528 'disableamount' => 0,
530 'urlnew' => DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
531 'lang' =>
'interventions',
532 'buttonnew' =>
'AddIntervention',
533 'testnew' => $user->hasRight(
'ficheinter',
'creer'),
534 'test' => isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')
537 'name' =>
"Shippings",
538 'title' =>
"ListShippingAssociatedProject",
539 'class' =>
'Expedition',
540 'table' =>
'expedition',
541 'datefieldname' =>
'date_valid',
542 'urlnew' => DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
543 'lang' =>
'sendings',
544 'buttonnew' =>
'CreateShipment',
546 'test' => isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')
550 'title' =>
"ListMOAssociatedProject",
553 'datefieldname' =>
'date_valid',
554 'urlnew' => DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
556 'buttonnew' =>
'CreateMO',
557 'testnew' => $user->hasRight(
'mrp',
'write'),
558 'project_field' =>
'fk_project',
560 'test' => isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')
563 'name' =>
"TripsAndExpenses",
564 'title' =>
"ListExpenseReportsAssociatedProject",
565 'class' =>
'Deplacement',
566 'table' =>
'deplacement',
567 'datefieldname' =>
'dated',
569 'disableamount' => 1,
570 'urlnew' => DOL_URL_ROOT.
'/deplacement/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
572 'buttonnew' =>
'AddTrip',
573 'testnew' => $user->hasRight(
'deplacement',
'creer'),
574 'test' => isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')
576 'expensereport' => array(
577 'name' =>
"ExpenseReports",
578 'title' =>
"ListExpenseReportsAssociatedProject",
579 'class' =>
'ExpenseReportLine',
580 'table' =>
'expensereport_det',
581 'datefieldname' =>
'date',
583 'disableamount' => 0,
584 'urlnew' => DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
586 'buttonnew' =>
'AddTrip',
587 'testnew' => $user->hasRight(
'expensereport',
'creer'),
588 'test' => isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')
591 'name' =>
"Donation",
592 'title' =>
"ListDonationsAssociatedProject",
596 'datefieldname' =>
'datedon',
597 'disableamount' => 0,
598 'urlnew' => DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
599 'lang' =>
'donations',
600 'buttonnew' =>
'AddDonation',
601 'testnew' => $user->hasRight(
'don',
'creer'),
602 'test' => isModEnabled(
'don') && $user->hasRight(
'don',
'lire')
606 'title' =>
"ListLoanAssociatedProject",
610 'datefieldname' =>
'datestart',
611 'disableamount' => 0,
612 'urlnew' => DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.
$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
614 'buttonnew' =>
'AddLoan',
615 'testnew' => $user->hasRight(
'loan',
'write'),
616 'test' => isModEnabled(
'loan') && $user->hasRight(
'loan',
'read')
618 'chargesociales' => array(
619 'name' =>
"SocialContribution",
620 'title' =>
"ListSocialContributionAssociatedProject",
621 'class' =>
'ChargeSociales',
623 'table' =>
'chargesociales',
624 'datefieldname' =>
'date_ech',
625 'disableamount' => 0,
626 'urlnew' => DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
628 'buttonnew' =>
'AddSocialContribution',
629 'testnew' => $user->hasRight(
'tax',
'charges',
'lire'),
630 'test' => isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')
632 'project_task' => array(
633 'name' =>
"TaskTimeSpent",
634 'title' =>
"ListTaskTimeUserProject",
637 'table' =>
'projet_task',
638 'datefieldname' =>
'element_date',
639 'disableamount' => 0,
640 'urlnew' => DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
641 'buttonnew' =>
'AddTimeSpent',
642 'testnew' => $user->hasRight(
'project',
'creer'),
643 'test' => isModEnabled(
'project') && $user->hasRight(
'projet',
'lire') && !
getDolGlobalString(
'PROJECT_HIDE_TASKS')
645 'stock_mouvement' => array(
646 'name' =>
"MouvementStockAssociated",
647 'title' =>
"ListMouvementStockProject",
648 'class' =>
'StockTransfer',
649 'table' =>
'stocktransfer_stocktransfer',
650 'datefieldname' =>
'datem',
652 'project_field' =>
'fk_project',
653 'disableamount' => 0,
654 'test' => isModEnabled(
'stock') && $user->hasRight(
'stock',
'mouvement',
'lire') &&
getDolGlobalString(
'STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW')
657 'name' =>
"Salaries",
658 'title' =>
"ListSalariesAssociatedProject",
661 'datefieldname' =>
'datesp',
663 'disableamount' => 0,
664 'urlnew' => DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
665 'lang' =>
'salaries',
666 'buttonnew' =>
'AddSalary',
667 'testnew' => $user->hasRight(
'salaries',
'write'),
668 'test' => isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read')
670 'variouspayment' => array(
671 'name' =>
"VariousPayments",
672 'title' =>
"ListVariousPaymentsAssociatedProject",
673 'class' =>
'PaymentVarious',
674 'table' =>
'payment_various',
675 'datefieldname' =>
'datev',
677 'disableamount' => 0,
678 'urlnew' => DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.
$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
680 'buttonnew' =>
'AddVariousPayment',
681 'testnew' => $user->hasRight(
'banque',
'modifier'),
682 'test' => isModEnabled(
"bank") && $user->hasRight(
'banque',
'lire') && !
getDolGlobalString(
'BANK_USE_OLD_VARIOUS_PAYMENT')
702 foreach ($listofreferent as $key => $element) {
703 if ($listofreferent[$key][
'margin'] ==
'add') {
704 unset($listofreferent[$key][
'margin']);
707 $newelementforplusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_PLUS_MARGIN'));
708 foreach ($newelementforplusmargin as $value) {
709 $listofreferent[trim($value)][
'margin'] =
'add';
713 foreach ($listofreferent as $key => $element) {
714 if ($listofreferent[$key][
'margin'] ==
'minus') {
715 unset($listofreferent[$key][
'margin']);
718 $newelementforminusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_MINUS_MARGIN'));
719 foreach ($newelementforminusmargin as $value) {
720 $listofreferent[trim($value)][
'margin'] =
'minus';
725$parameters = array(
'listofreferent' => $listofreferent);
726$resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
728if (!empty($hookmanager->resArray)) {
729 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
730} elseif ($resHook > 0 && !empty($hookmanager->resPrint)) {
731 $listofreferent = $hookmanager->resPrint;
734if ($action ==
"addelement") {
735 $tablename =
GETPOST(
"tablename");
736 $elementselectid =
GETPOST(
"elementselect");
737 $result =
$object->update_element($tablename, $elementselectid);
741} elseif ($action ==
"unlink") {
742 $tablename =
GETPOST(
"tablename",
"aZ09");
743 $projectField = GETPOSTISSET(
'projectfield') ?
GETPOST(
'projectfield',
'aZ09') :
'fk_projet';
744 $elementselectid =
GETPOSTINT(
"elementselect");
746 $result =
$object->remove_element($tablename, $elementselectid, $projectField);
752$elementuser =
new User($db);
758if (!$showdatefilter) {
759 print
'<div class="center centpercent">';
760 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
761 print
'<input type="hidden" name="token" value="'.newToken().
'">';
762 print
'<input type="hidden" name="tablename" value="'.(empty($tablename) ?
'' : $tablename).
'">';
763 print
'<input type="hidden" name="action" value="view">';
764 print
'<div class="inline-block">';
765 print $form->selectDate($dates,
'dates', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
767 print
'<div class="inline-block">';
768 print $form->selectDate($datee,
'datee', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
770 print
'<div class="inline-block">';
771 print
'<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button small">';
783$langs->loadLangs(array(
"suppliers",
"bills",
"orders",
"proposals",
"margins"));
785if (isModEnabled(
'stock')) {
786 $langs->load(
'stocks');
791print
'<table class="noborder centpercent">';
792print
'<tr class="liste_titre">';
793print
'<td class="left" width="200">';
794$tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
795$tooltiponprofitplus = $tooltiponprofitminus =
'';
796foreach ($listofreferent as $key => $value) {
797 if (!empty($value[
'lang'])) {
798 $langs->load($value[
'lang']);
800 $name = $langs->trans($value[
'name']);
801 $qualified = $value[
'test'];
802 $margin = empty($value[
'margin']) ?
'' : $value[
'margin'];
803 if ($qualified && isset($margin)) {
804 if ($margin ===
'add') {
805 $tooltiponprofitplus .=
' > '.$name.
" (+)<br>\n";
807 if ($margin ===
'minus') {
808 $tooltiponprofitminus .=
' > '.$name.
" (-)<br>\n";
812$tooltiponprofit .= $tooltiponprofitplus;
813$tooltiponprofit .= $tooltiponprofitminus;
814print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
816print
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
817print
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
818print
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
821$total_revenue_ht = 0;
826foreach ($listofreferent as $key => $value) {
828 'total_revenue_ht' => & $total_revenue_ht,
829 'balance_ht' => & $balance_ht,
830 'balance_ttc' => & $balance_ttc,
836 $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action);
839 } elseif ($reshook > 0) {
840 print $hookmanager->resPrint;
844 $name = $langs->trans($value[
'name']);
845 $title = $value[
'title'];
846 $classname = $value[
'class'];
847 $tablename = $value[
'table'];
848 $datefieldname = $value[
'datefieldname'];
849 $qualified = $value[
'test'];
850 $margin = empty($value[
'margin']) ? 0 : $value[
'margin'];
851 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
852 if ($qualified && isset($margin)) {
853 $element =
new $classname($db);
855 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
857 if (is_array($elementarray) && count($elementarray) > 0) {
862 $num = count($elementarray);
863 for ($i = 0; $i < $num; $i++) {
864 $tmp = explode(
'_', $elementarray[$i]);
865 $idofelement = $tmp[0];
866 $idofelementuser = !empty($tmp[1]) ? $tmp[1] :
"";
868 $element->fetch($idofelement);
869 if ($idofelementuser) {
870 $elementuser->fetch($idofelementuser);
874 $qualifiedfortotal =
true;
875 if ($key ==
'invoice') {
876 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
877 $qualifiedfortotal =
false;
880 $qualifiedfortotal =
false;
883 if ($key ==
'propal') {
885 $qualifiedfortotal =
false;
889 if ($tablename !=
'expensereport_det' && method_exists($element,
'fetch_thirdparty')) {
890 $element->fetch_thirdparty();
894 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
895 $total_ht_by_line = $element->amount;
896 } elseif ($tablename ==
'fichinter') {
897 $total_ht_by_line = $element->getAmount();
898 } elseif ($tablename ==
'stock_mouvement') {
899 $total_ht_by_line = $element->price * abs($element->qty);
900 } elseif ($tablename ==
'projet_task') {
901 $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', $dates, $datee);
902 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
903 } elseif ($key ==
'loan') {
904 if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
906 $total_ht_by_line = -$element->capital;
909 $total_ht_by_line = 0;
911 $loanScheduleStatic->fetchAll($element->id);
912 if (!empty($loanScheduleStatic->lines)) {
913 foreach ($loanScheduleStatic->lines as $loanSchedule) {
917 if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee)
918 || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <=
dol_now()
919 || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
921 $total_ht_by_line -= $loanSchedule->amount_capital;
927 $total_ht_by_line = $element->total_ht;
931 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
932 $total_ttc_by_line = $element->amount;
933 } elseif ($tablename ==
'fichinter') {
934 $total_ttc_by_line = $element->getAmount();
935 } elseif ($tablename ==
'stock_mouvement') {
936 $total_ttc_by_line = $element->price * abs($element->qty);
937 } elseif ($tablename ==
'projet_task') {
940 if (preg_replace(
'/^(\d+\.)\s\(.*\)/', $defaultvat, $reg)) {
942 $defaultvat = $reg[1];
944 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ((
float) $defaultvat / 100)),
'MT');
945 } elseif ($key ==
'loan') {
946 $total_ttc_by_line = $total_ht_by_line;
948 $total_ttc_by_line = $element->total_ttc;
952 if ($tablename ==
'payment_various') {
953 if ($element->sens == 1) {
954 $total_ht_by_line = -$total_ht_by_line;
955 $total_ttc_by_line = -$total_ttc_by_line;
960 if ($qualifiedfortotal) {
961 $total_ht += $total_ht_by_line;
962 $total_ttc += $total_ttc_by_line;
970 if ($margin ===
'add') {
971 $total_revenue_ht += $total_ht;
974 if ($margin ===
"minus") {
975 $total_ht = -$total_ht;
976 $total_ttc = -$total_ttc;
979 $balance_ht += $total_ht;
980 $balance_ttc += $total_ttc;
983 print
'<tr class="oddeven">';
985 print
'<td class="left">'.$name.
'</td>';
987 print
'<td class="right">'.$i.
'</td>';
989 print
'<td class="right">';
990 if ($key ==
'intervention' && !$margin) {
991 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
993 if ($key ==
'propal') {
994 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
996 print
price($total_ht);
1000 print
'<td class="right">';
1001 if ($key ==
'intervention' && !$margin) {
1002 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
1004 if ($key ==
'propal') {
1005 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
1007 print
price($total_ttc);
1015print
'<tr class="liste_total">';
1016print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
1017print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
1018print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
1022if (
$object->usage_organize_event) {
1023 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1025 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int)
$object->id).
') AND (t.status:=:'.ConferenceOrBoothAttendee::STATUS_VALIDATED.
')');
1027 if (!is_array($result) && $result < 0) {
1028 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
1030 $nbAttendees = count($result);
1033 if ($nbAttendees >= 2) {
1034 $costperattendee_ht = $balance_ht / $nbAttendees;
1035 $costperattendee_ttc = $balance_ttc / $nbAttendees;
1036 print
'<tr class="liste_total">';
1037 print
'<td class="right" colspan="2">'.$langs->trans(
"ProfitPerValidatedAttendee").
'</td>';
1038 print
'<td class="right">'.price(
price2num($costperattendee_ht,
'MT')).
'</td>';
1039 print
'<td class="right">'.price(
price2num($costperattendee_ttc,
'MT')).
'</td>';
1045if ($total_revenue_ht) {
1046 print
'<tr class="liste_total">';
1047 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
1048 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
1049 print
'<td class="right"></td>';
1063foreach ($listofreferent as $key => $value) {
1064 $parameters = array(
1066 'value' => & $value,
1070 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
1073 } elseif ($reshook > 0) {
1074 print $hookmanager->resPrint;
1078 $title = $value[
'title'];
1079 $classname = $value[
'class'];
1080 $tablename = $value[
'table'];
1081 $datefieldname = $value[
'datefieldname'];
1082 $qualified = $value[
'test'];
1083 $urlnew = empty($value[
'urlnew']) ?
'' : $value[
'urlnew'];
1084 $buttonnew = empty($value[
'buttonnew']) ?
'' : $value[
'buttonnew'];
1085 $testnew = empty($value[
'testnew']) ?
'' : $value[
'testnew'];
1086 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
1087 $nototal = empty($value[
'nototal']) ? 0 : 1;
1089 $exclude_select_element = array(
'payment_various');
1090 if (!empty($value[
'exclude_select_element'])) {
1091 $exclude_select_element[] = $value[
'exclude_select_element'];
1098 $element =
new $classname($db);
1102 $idtofilterthirdparty = 0;
1103 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
1104 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
1105 $idtofilterthirdparty = empty(
$object->thirdparty->id) ? 0 :
$object->thirdparty->id;
1107 $idtofilterthirdparty .=
',' .
getDolGlobalString(
'PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS');
1111 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
1114 if (!
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
1115 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, empty($project_field) ?
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
1116 if ((
int) $selectList < 0) {
1118 } elseif ($selectList) {
1120 $addform .=
'<div class="inline-block valignmiddle">';
1121 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1122 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1123 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
1124 $addform .=
'<input type="hidden" name="action" value="addelement">';
1125 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
1126 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
1127 $addform .=
'<table><tr>';
1129 $addform .=
'<td>'.$selectList.
'</td>';
1130 $addform .=
'<td><input type="submit" class="button button-linkto smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
1131 $addform .=
'</tr></table>';
1132 $addform .=
'</form>';
1133 $addform .=
'</div>';
1137 $addform .=
'<div class="inline-block valignmiddle">';
1139 $addform .=
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
1141 $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>';
1143 $addform .=
'<div>';
1146 if (is_array($elementarray) && count($elementarray) > 0 && $key ==
"order_supplier") {
1147 $addform =
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1148 <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
1151 $("#btnShow").on("click", function () {
1152 console.log("We click to show or hide the canceled lines");
1153 var attr = $(this).attr("data-canceledarehidden");
1154 if (typeof attr !== "undefined" && attr !== false) {
1155 console.log("Show canceled");
1156 $(".tr_canceled").show();
1157 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'");
1158 $("#btnShow").removeAttr("data-canceledarehidden");
1159 $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye");
1161 console.log("Hide canceled");
1162 $(".tr_canceled").hide();
1163 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'");
1164 $("#btnShow").attr("data-canceledarehidden", 1);
1165 $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash");
1168 </script></div> '.$addform;
1173 print
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
1174 print
'<div class="div-table-responsive">';
1175 print
'<table class="noborder centpercent">';
1177 print
'<tr class="liste_titre">';
1179 print
'<td style="width: 24px"></td>';
1181 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
'>'.$langs->trans(
"Ref").
'</td>';
1183 if (
'MouvementStock' == $classname) {
1184 print
'<td style="width: 200px">'.$langs->trans(
"Product").
'</td>';
1185 print
'<td style="width: 50px">'.$langs->trans(
"Qty").
'</td>';
1188 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
' class="center">';
1189 if (in_array($tablename, array(
'projet_task'))) {
1190 print $langs->trans(
"TimeSpent");
1192 if (!in_array($tablename, array(
'projet_task'))) {
1193 print $langs->trans(
"Date");
1198 if (in_array($tablename, array(
'projet_task')) && $key ==
'project_task') {
1200 } elseif (in_array($tablename, array(
'payment_various'))) {
1201 print $langs->trans(
"Label");
1202 } elseif (in_array($tablename, array(
'expensereport_det',
'don',
'projet_task',
'stock_mouvement',
'salary'))) {
1203 print $langs->trans(
"User");
1205 print $langs->trans(
"ThirdParty");
1209 if ($tablename ==
'fichinter') {
1211 print $langs->trans(
"TotalDuration");
1212 $total_duration = 0;
1218 if ($key ==
'loan') {
1219 print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
1220 } elseif (empty($value[
'disableamount'])) {
1221 print
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
1223 print
'<td width="120"></td>';
1227 if ($key ==
'loan') {
1228 print
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
1229 } elseif (empty($value[
'disableamount'])) {
1230 print
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
1232 print
'<td width="120"></td>';
1235 if (in_array($tablename, array(
'projet_task'))) {
1236 print
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
1238 print
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
1242 if (is_array($elementarray) && count($elementarray) > 0) {
1246 $total_ht_by_third = 0;
1247 $total_ttc_by_third = 0;
1249 $saved_third_id = 0;
1257 $num = count($elementarray);
1258 for ($i = 0; $i < $num; $i++) {
1259 $tmp = explode(
'_', $elementarray[$i]);
1260 $idofelement = $tmp[0];
1261 $idofelementuser = isset($tmp[1]) ? $tmp[1] :
"";
1263 $element->fetch($idofelement);
1264 if ($idofelementuser) {
1265 $elementuser->fetch($idofelementuser);
1269 if ($tablename !=
'expensereport_det') {
1270 if (method_exists($element,
'fetch_thirdparty')) {
1271 $element->fetch_thirdparty();
1275 $expensereport->fetch($element->fk_expensereport);
1280 if ($breakline && $saved_third_id != $element->thirdparty->id) {
1283 $saved_third_id = $element->thirdparty->id;
1286 $total_ht_by_third = 0;
1287 $total_ttc_by_third = 0;
1290 $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
1292 $qualifiedfortotal =
true;
1293 if ($key ==
'invoice') {
1294 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
1295 $qualifiedfortotal =
false;
1297 } elseif ($key ==
'order_supplier' && $element->status == 7) {
1298 $qualifiedfortotal =
false;
1301 if ($key ==
"order_supplier" && $element->status == 7) {
1302 print
'<tr class="oddeven tr_canceled" style=display:none>';
1304 print
'<tr class="oddeven" >';
1309 print
'<td style="width: 24px">';
1310 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement') {
1312 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1313 print
img_picto($langs->trans(
'Unlink'),
'unlink');
1320 print
'<td class="left nowraponall tdoverflowmax250">';
1321 if ($tablename ==
'expensereport_det') {
1322 print $expensereport->getNomUrl(1);
1325 if ($element instanceof
Task) {
1326 print $element->getNomUrl(1,
'withproject',
'time');
1327 print
' - '.dol_trunc($element->label, 48);
1328 } elseif ($key ==
'loan') {
1329 print $element->getNomUrl(1);
1330 print
' - '.dol_trunc($element->label, 48);
1332 print $element->getNomUrl(1);
1335 $element_doc = $element->element;
1337 if (!empty(
$conf->$element_doc)) {
1338 $confelementdoc =
$conf->$element_doc;
1339 $filedir = $confelementdoc->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1344 if ($element_doc ===
'order_supplier') {
1345 $element_doc =
'commande_fournisseur';
1347 } elseif ($element_doc ===
'invoice_supplier') {
1348 $element_doc =
'facture_fournisseur';
1349 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1350 $filedir =
$conf->fournisseur->facture->multidir_output[$element->entity].
'/'.$filename;
1353 print
'<div class="inline-block valignmiddle">';
1355 print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
1360 if (!empty($element->ref_supplier)) {
1361 print
' - '.$element->ref_supplier;
1364 if (!empty($element->ref_customer)) {
1365 print
' - '.$element->ref_customer;
1368 if (empty($element->ref_customer) && !empty($element->ref_client)) {
1369 print
' - '.$element->ref_client;
1374 if (
'MouvementStock' == $classname) {
1375 $mvsProd =
new Product($element->db);
1376 $mvsProd->fetch($element->product_id);
1377 print
'<td>'.$mvsProd->getNomUrl(1).
'</td>';
1378 print
'<td>'.$element->qty.
'</td>';
1382 $total_time_by_line =
null;
1383 if ($tablename ==
'expensereport_det') {
1384 $date = $element->date;
1385 } elseif ($tablename ==
'stock_mouvement') {
1386 $date = $element->datem;
1387 } elseif ($tablename ==
'salary') {
1388 $date = $element->datesp;
1389 } elseif ($tablename ==
'payment_various') {
1390 $date = $element->datev;
1391 } elseif ($tablename ==
'chargesociales') {
1392 $date = $element->date_ech;
1393 } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
1394 if ($tablename ==
'don') {
1395 $date = $element->datedon;
1397 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
1398 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1399 } elseif ($tablename ==
'supplier_proposal') {
1400 $date = $element->date_validation;
1401 } elseif ($tablename ==
'fichinter') {
1402 $date = $element->datev;
1403 } elseif ($tablename ==
'projet_task') {
1406 $date = $element->date;
1408 $date = $element->date_contrat;
1411 $date = $element->datev;
1413 if (empty($date) && !empty($datefieldname)) {
1414 $date = $element->$datefieldname;
1417 } elseif ($key ==
'loan') {
1418 $date = $element->datestart;
1421 print
'<td class="center">';
1422 if ($tablename ==
'actioncomm') {
1424 if ($element->datef && $element->datef > $element->datep) {
1425 print
" - ".dol_print_date($element->datef,
'dayhour');
1427 } elseif (in_array($tablename, array(
'projet_task'))) {
1428 $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', $dates, $datee);
1429 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1432 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1439 print
'<td class="tdoverflowmax150">';
1440 if (is_object($element->thirdparty)) {
1441 print $element->thirdparty->getNomUrl(1,
'', 48);
1442 } elseif ($tablename ==
'expensereport_det') {
1443 $tmpuser =
new User($db);
1444 $tmpuser->fetch($expensereport->fk_user_author);
1445 print $tmpuser->getNomUrl(1,
'', 48);
1446 } elseif ($tablename ==
'salary') {
1447 $tmpuser =
new User($db);
1448 $tmpuser->fetch($element->fk_user);
1449 print $tmpuser->getNomUrl(1,
'', 48);
1450 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement') {
1451 if ($element->fk_user_author > 0) {
1452 $tmpuser2 =
new User($db);
1453 $tmpuser2->fetch($element->fk_user_author);
1454 print $tmpuser2->getNomUrl(1,
'', 48);
1456 } elseif ($tablename ==
'projet_task' && $key ==
'element_time') {
1457 print $elementuser->getNomUrl(1);
1458 } elseif ($tablename ==
'payment_various') {
1459 print $element->label;
1464 if ($tablename ==
'fichinter') {
1467 $total_duration += $element->duration;
1473 if (empty($value[
'disableamount'])) {
1474 $total_ht_by_line =
null;
1476 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1477 $total_ht_by_line = $element->amount;
1478 } elseif ($tablename ==
'fichinter') {
1479 $total_ht_by_line = $element->getAmount();
1480 } elseif ($tablename ==
'stock_mouvement') {
1481 $total_ht_by_line = $element->price * abs($element->qty);
1482 } elseif (in_array($tablename, array(
'projet_task'))) {
1483 if (isModEnabled(
'salaries')) {
1485 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1486 if ($tmpprojtime[
'nblinesnull'] > 0) {
1487 $langs->load(
"errors");
1488 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate",
$conf->currency);
1491 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1493 } elseif ($key ==
'loan') {
1494 $total_ht_by_line = $element->capital;
1496 $total_ht_by_line = $element->total_ht;
1500 if ($tablename ==
'payment_various') {
1501 if ($element->sens == 0) {
1502 $total_ht_by_line = -$total_ht_by_line;
1506 print
'<td class="right">';
1507 if ($othermessage) {
1508 print
'<span class="opacitymedium">'.$othermessage.
'</span>';
1510 if (isset($total_ht_by_line)) {
1511 if (!$qualifiedfortotal) {
1514 print
'<span class="amount">'.price($total_ht_by_line).
'</span>';
1515 if (!$qualifiedfortotal) {
1520 print
' '.img_warning($warning);
1528 if (empty($value[
'disableamount'])) {
1529 $total_ttc_by_line =
null;
1530 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1531 $total_ttc_by_line = $element->amount;
1532 } elseif ($tablename ==
'fichinter') {
1533 $total_ttc_by_line = $element->getAmount();
1534 } elseif ($tablename ==
'stock_mouvement') {
1535 $total_ttc_by_line = $element->price * abs($element->qty);
1536 } elseif ($tablename ==
'projet_task') {
1537 if (isModEnabled(
'salaries')) {
1540 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1542 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1544 } elseif ($key ==
'loan') {
1545 $total_ttc_by_line = $element->capital - $element->getSumPayment();
1547 $total_ttc_by_line = $element->total_ttc;
1551 if ($tablename ==
'payment_various') {
1552 if ($element->sens == 0) {
1553 $total_ttc_by_line = -$total_ttc_by_line;
1557 print
'<td class="right">';
1558 if ($othermessage) {
1559 print $othermessage;
1561 if (isset($total_ttc_by_line)) {
1562 if (!$qualifiedfortotal) {
1565 print
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
1566 if (!$qualifiedfortotal) {
1571 print
' '.img_warning($warning);
1579 print
'<td class="right">';
1580 if ($tablename ==
'expensereport_det') {
1581 print $expensereport->getLibStatut(5);
1584 print $element->getLibStatut(5, $element->getSommePaiement());
1585 } elseif ($element instanceof
Task) {
1586 if ($element->progress !=
'') {
1587 print $element->progress.
' %';
1589 } elseif ($tablename ==
'stock_mouvement') {
1590 print $element->getLibStatut(3);
1592 print $element->getLibStatut(5);
1598 if ($qualifiedfortotal) {
1599 $total_ht += $total_ht_by_line;
1600 $total_ttc += $total_ttc_by_line;
1602 $total_ht_by_third += $total_ht_by_line;
1603 $total_ttc_by_third += $total_ttc_by_line;
1605 if (!isset($total_time)) {
1606 $total_time = $total_time_by_line;
1608 $total_time += $total_time_by_line;
1613 $breakline =
'<tr class="liste_total liste_sub_total">';
1614 $breakline .=
'<td colspan="2">';
1615 $breakline .=
'</td>';
1616 $breakline .=
'<td>';
1617 $breakline .=
'</td>';
1618 $breakline .=
'<td class="right">';
1619 $breakline .= $langs->trans(
'SubTotal').
' : ';
1620 if (is_object($element->thirdparty)) {
1621 $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1623 $breakline .=
'</td>';
1624 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1625 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1626 $breakline .=
'<td></td>';
1627 $breakline .=
'</tr>';
1638 if (empty($nototal)) {
1640 if (in_array($tablename, array(
'projet_task'))) {
1644 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1645 if (in_array($tablename, array(
'projet_task'))) {
1646 print
'<td class="center">';
1655 if ($tablename ==
'fichinter') {
1656 print
'<td class="left">'.convertSecondToTime($total_duration,
'all',
$conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1658 print
'<td class="right">';
1659 if (empty($value[
'disableamount'])) {
1660 if ($key ==
'loan') {
1661 print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1662 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1663 print
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
1669 print
'<td class="right">';
1670 if (empty($value[
'disableamount'])) {
1671 if ($key ==
'loan') {
1672 print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
1673 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1674 print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
1678 print
'<td> </td>';
1682 if (!is_array($elementarray)) {
1683 print
'<tr><td>'.$elementarray.
'</td></tr>';
1686 if ($tablename ==
'fichinter') {
1689 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1699if (
$conf->use_javascript_ajax) {
1700 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
1703 print $comboenhancement;
1725 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
1736 global $db, $classname;
1737 '@phan-var-force string $classname';
1739 $element =
new $classname($db);
1740 '@phan-var-force CommonObject $element';
1742 $clientname = array();
1743 foreach ($elementarray as $key =>
$id) {
1744 if (empty($clientname[
$id])) {
1745 $element->fetch(
$id);
1746 $element->fetch_thirdparty();
1748 $clientname[
$id] = $element->thirdparty->name;
1755 $elementarray = array();
1756 foreach ($clientname as
$id => $name) {
1757 $elementarray[] =
$id;
1760 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 invoice 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.