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");
154$action =
GETPOST(
'action',
'aZ09');
155$datesrfc =
GETPOST(
'datesrfc');
156$dateerfc =
GETPOST(
'dateerfc');
159if (empty($dates) && !empty($datesrfc)) {
162if (empty($datee) && !empty($dateerfc)) {
165if (!GETPOSTISSET(
'datesrfc') && !GETPOSTISSET(
'datesday') &&
getDolGlobalString(
'PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR')) {
172if ($id ==
'' && $ref ==
'') {
174 header(
'Location: list.php');
178$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
183include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
184if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
193$hookmanager->initHooks(array(
'projectOverview'));
200$title = $langs->trans(
'ProjectReferers').
' - '.
$object->ref.
' '.
$object->name;
202 $title =
$object->ref.
' '.
$object->name.
' - '.$langs->trans(
'ProjectReferers');
205$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
209$form =
new Form($db);
213$userstatic =
new User($db);
216$userAccess =
$object->restrictedProjectArea($user);
224if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
225 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
226 $tmpurl = preg_replace(
'/__SOCID__/', (
string)
$object->socid, $tmpurl);
227 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
229 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
232$morehtmlref =
'<div class="refidno">';
236if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
237 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
239$morehtmlref .=
'</div>';
242if (!$user->hasRight(
'projet',
'all',
'lire')) {
243 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
244 $object->next_prev_filter =
"te.rowid IN (".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0').
")";
247dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
250print
'<div class="fichecenter">';
251print
'<div class="fichehalfleft">';
252print
'<div class="underbanner clearboth"></div>';
254print
'<table class="border tableforfield centpercent">';
258 print
'<tr><td class="tdtop">';
259 print $langs->trans(
"Usage");
263 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
264 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
265 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
269 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_task ?
' checked="checked"' :
'')).
'"> ';
270 $htmltext = $langs->trans(
"ProjectFollowTasks");
271 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
275 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"' :
'')).
'"> ';
276 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
277 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
280 if (isModEnabled(
'eventorganization')) {
281 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"' :
'')).
'"> ';
282 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
283 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
289print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
291 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
292 print $langs->trans(
'SharedProject');
294 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
295 print $langs->trans(
'PrivateProject');
301 print
'<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
304 print $langs->trans(
"OppStatus".$code);
309 print
'<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
310 if (!is_null(
$object->opp_percent) && strcmp(
$object->opp_percent,
'')) {
311 print
price(
$object->opp_percent, 0, $langs, 1, 0).
' %';
316 print
'<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
317 if (!is_null(
$object->opp_amount) && strcmp(
$object->opp_amount,
'')) {
318 print
'<span class="amount">'.price(
$object->opp_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
319 if (strcmp(
$object->opp_percent,
'')) {
320 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>';
327print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
328if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount,
'')) {
329 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
334print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
336print($start ? $start :
'?');
339print($end ? $end :
'?');
347include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
352print
'<div class="fichehalfright">';
353print
'<div class="underbanner clearboth"></div>';
355print
'<table class="border tableforfield centpercent">';
358print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
363if (isModEnabled(
'category')) {
364 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
365 print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
374print
'<div class="clearboth"></div>';
384$listofreferent = array(
386 'name' =>
"Warehouse",
387 'title' =>
"ListWarehouseAssociatedProject",
388 'class' =>
'Entrepot',
389 'table' =>
'entrepot',
390 'datefieldname' =>
'date_entrepot',
391 'urlnew' => DOL_URL_ROOT.
'/product/stock/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
392 'lang' =>
'entrepot',
393 'buttonnew' =>
'AddWarehouse',
394 'project_field' =>
'fk_project',
395 'testnew' => $user->hasRight(
'stock',
'creer'),
396 'test' => isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT')
399 'name' =>
"Proposals",
400 'title' =>
"ListProposalsAssociatedProject",
403 'datefieldname' =>
'datep',
404 'urlnew' => DOL_URL_ROOT.
'/comm/propal/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
406 'buttonnew' =>
'AddProp',
407 'testnew' => $user->hasRight(
'propal',
'creer'),
408 'test' => isModEnabled(
'propal') && $user->hasRight(
'propal',
'lire')
411 'name' =>
"CustomersOrders",
412 'title' =>
"ListOrdersAssociatedProject",
413 'class' =>
'Commande',
414 'table' =>
'commande',
415 'datefieldname' =>
'date_commande',
416 'urlnew' => DOL_URL_ROOT.
'/commande/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
418 'buttonnew' =>
'CreateOrder',
419 'testnew' => $user->hasRight(
'commande',
'creer'),
420 'test' => isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')
423 'name' =>
"CustomersInvoices",
424 'title' =>
"ListInvoicesAssociatedProject",
425 'class' =>
'Facture',
427 'table' =>
'facture',
428 'datefieldname' =>
'datef',
429 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
431 'buttonnew' =>
'CreateBill',
432 'testnew' => $user->hasRight(
'facture',
'creer'),
433 'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
435 'invoice_predefined' => array(
436 'name' =>
"PredefinedInvoices",
437 'title' =>
"ListPredefinedInvoicesAssociatedProject",
438 'class' =>
'FactureRec',
439 'table' =>
'facture_rec',
440 'datefieldname' =>
'datec',
441 'urlnew' => DOL_URL_ROOT.
'/compta/facture/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
443 'buttonnew' =>
'CreateBill',
444 'testnew' => $user->hasRight(
'facture',
'creer'),
445 'test' => isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')
447 'proposal_supplier' => array(
448 'name' =>
"SupplierProposals",
449 'title' =>
"ListSupplierProposalsAssociatedProject",
450 'class' =>
'SupplierProposal',
451 'table' =>
'supplier_proposal',
452 'datefieldname' =>
'date_valid',
453 'urlnew' => DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
454 'lang' =>
'supplier_proposal',
455 'buttonnew' =>
'AddSupplierProposal',
456 'testnew' => $user->hasRight(
'supplier_proposal',
'creer'),
457 'test' => isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')
459 'order_supplier' => array(
460 'name' =>
"SuppliersOrders",
461 'title' =>
"ListSupplierOrdersAssociatedProject",
462 'class' =>
'CommandeFournisseur',
463 'table' =>
'commande_fournisseur',
464 'datefieldname' =>
'date_commande',
465 'urlnew' => DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
466 'lang' =>
'suppliers',
467 'buttonnew' =>
'AddSupplierOrder',
468 'testnew' => $user->hasRight(
'fournisseur',
'commande',
'creer') || $user->hasRight(
'supplier_order',
'creer'),
469 'test' => isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'lire')
471 'invoice_supplier' => array(
472 'name' =>
"BillsSuppliers",
473 'title' =>
"ListSupplierInvoicesAssociatedProject",
474 'class' =>
'FactureFournisseur',
476 'table' =>
'facture_fourn',
477 'datefieldname' =>
'datef',
478 'urlnew' => DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
479 'lang' =>
'suppliers',
480 'buttonnew' =>
'AddSupplierInvoice',
481 'testnew' => $user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer'),
482 'test' => isModEnabled(
'supplier_invoice') && $user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'lire')
485 'name' =>
"Contracts",
486 'title' =>
"ListContractAssociatedProject",
487 'class' =>
'Contrat',
488 'table' =>
'contrat',
489 'datefieldname' =>
'date_contrat',
490 'urlnew' => DOL_URL_ROOT.
'/contrat/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
491 'lang' =>
'contracts',
492 'buttonnew' =>
'AddContract',
493 'testnew' => $user->hasRight(
'contrat',
'creer'),
494 'test' => isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')
496 'intervention' => array(
497 'name' =>
"Interventions",
498 'title' =>
"ListFichinterAssociatedProject",
499 'class' =>
'Fichinter',
500 'table' =>
'fichinter',
501 'datefieldname' =>
'date_valid',
502 'disableamount' => 0,
504 'urlnew' => DOL_URL_ROOT.
'/fichinter/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
505 'lang' =>
'interventions',
506 'buttonnew' =>
'AddIntervention',
507 'testnew' => $user->hasRight(
'ficheinter',
'creer'),
508 'test' => isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')
511 'name' =>
"Shippings",
512 'title' =>
"ListShippingAssociatedProject",
513 'class' =>
'Expedition',
514 'table' =>
'expedition',
515 'datefieldname' =>
'date_valid',
516 'urlnew' => DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
517 'lang' =>
'sendings',
518 'buttonnew' =>
'CreateShipment',
520 'test' => isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')
524 'title' =>
"ListMOAssociatedProject",
527 'datefieldname' =>
'date_valid',
528 'urlnew' => DOL_URL_ROOT.
'/mrp/mo_card.php?action=create&origin=project&originid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
530 'buttonnew' =>
'CreateMO',
531 'testnew' => $user->hasRight(
'mrp',
'write'),
532 'project_field' =>
'fk_project',
534 'test' => isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')
537 'name' =>
"TripsAndExpenses",
538 'title' =>
"ListExpenseReportsAssociatedProject",
539 'class' =>
'Deplacement',
540 'table' =>
'deplacement',
541 'datefieldname' =>
'dated',
543 'disableamount' => 1,
544 'urlnew' => DOL_URL_ROOT.
'/deplacement/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
546 'buttonnew' =>
'AddTrip',
547 'testnew' => $user->hasRight(
'deplacement',
'creer'),
548 'test' => isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')
550 'expensereport' => array(
551 'name' =>
"ExpenseReports",
552 'title' =>
"ListExpenseReportsAssociatedProject",
553 'class' =>
'ExpenseReportLine',
554 'table' =>
'expensereport_det',
555 'datefieldname' =>
'date',
557 'disableamount' => 0,
558 'urlnew' => DOL_URL_ROOT.
'/expensereport/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
560 'buttonnew' =>
'AddTrip',
561 'testnew' => $user->hasRight(
'expensereport',
'creer'),
562 'test' => isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')
565 'name' =>
"Donation",
566 'title' =>
"ListDonationsAssociatedProject",
570 'datefieldname' =>
'datedon',
571 'disableamount' => 0,
572 'urlnew' => DOL_URL_ROOT.
'/don/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
573 'lang' =>
'donations',
574 'buttonnew' =>
'AddDonation',
575 'testnew' => $user->hasRight(
'don',
'creer'),
576 'test' => isModEnabled(
'don') && $user->hasRight(
'don',
'lire')
580 'title' =>
"ListLoanAssociatedProject",
584 'datefieldname' =>
'datestart',
585 'disableamount' => 0,
586 'urlnew' => DOL_URL_ROOT.
'/loan/card.php?action=create&projectid='.$id.
'&socid='.$socid.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
588 'buttonnew' =>
'AddLoan',
589 'testnew' => $user->hasRight(
'loan',
'write'),
590 'test' => isModEnabled(
'loan') && $user->hasRight(
'loan',
'read')
592 'chargesociales' => array(
593 'name' =>
"SocialContribution",
594 'title' =>
"ListSocialContributionAssociatedProject",
595 'class' =>
'ChargeSociales',
597 'table' =>
'chargesociales',
598 'datefieldname' =>
'date_ech',
599 'disableamount' => 0,
600 'urlnew' => DOL_URL_ROOT.
'/compta/sociales/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
602 'buttonnew' =>
'AddSocialContribution',
603 'testnew' => $user->hasRight(
'tax',
'charges',
'lire'),
604 'test' => isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')
606 'project_task' => array(
607 'name' =>
"TaskTimeSpent",
608 'title' =>
"ListTaskTimeUserProject",
611 'table' =>
'projet_task',
612 'datefieldname' =>
'element_date',
613 'disableamount' => 0,
614 'urlnew' => DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
615 'buttonnew' =>
'AddTimeSpent',
616 'testnew' => $user->hasRight(
'project',
'creer'),
617 'test' => isModEnabled(
'project') && $user->hasRight(
'projet',
'lire') && !
getDolGlobalString(
'PROJECT_HIDE_TASKS')
619 'stock_mouvement' => array(
620 'name' =>
"MouvementStockAssociated",
621 'title' =>
"ListMouvementStockProject",
622 'class' =>
'StockTransfer',
623 'table' =>
'stocktransfer_stocktransfer',
624 'datefieldname' =>
'datem',
626 'project_field' =>
'fk_project',
627 'disableamount' => 0,
628 'test' => isModEnabled(
'stock') && $user->hasRight(
'stock',
'mouvement',
'lire') &&
getDolGlobalString(
'STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW')
631 'name' =>
"Salaries",
632 'title' =>
"ListSalariesAssociatedProject",
635 'datefieldname' =>
'datesp',
637 'disableamount' => 0,
638 'urlnew' => DOL_URL_ROOT.
'/salaries/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
639 'lang' =>
'salaries',
640 'buttonnew' =>
'AddSalary',
641 'testnew' => $user->hasRight(
'salaries',
'write'),
642 'test' => isModEnabled(
'salaries') && $user->hasRight(
'salaries',
'read')
644 'variouspayment' => array(
645 'name' =>
"VariousPayments",
646 'title' =>
"ListVariousPaymentsAssociatedProject",
647 'class' =>
'PaymentVarious',
648 'table' =>
'payment_various',
649 'datefieldname' =>
'datev',
651 'disableamount' => 0,
652 'urlnew' => DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?action=create&projectid='.$id.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.$id),
654 'buttonnew' =>
'AddVariousPayment',
655 'testnew' => $user->hasRight(
'banque',
'modifier'),
656 'test' => isModEnabled(
"bank") && $user->hasRight(
'banque',
'lire') && !
getDolGlobalString(
'BANK_USE_OLD_VARIOUS_PAYMENT')
676 foreach ($listofreferent as $key => $element) {
677 if ($listofreferent[$key][
'margin'] ==
'add') {
678 unset($listofreferent[$key][
'margin']);
681 $newelementforplusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_PLUS_MARGIN'));
682 foreach ($newelementforplusmargin as $value) {
683 $listofreferent[trim($value)][
'margin'] =
'add';
687 foreach ($listofreferent as $key => $element) {
688 if ($listofreferent[$key][
'margin'] ==
'minus') {
689 unset($listofreferent[$key][
'margin']);
692 $newelementforminusmargin = explode(
',',
getDolGlobalString(
'PROJECT_ELEMENTS_FOR_MINUS_MARGIN'));
693 foreach ($newelementforminusmargin as $value) {
694 $listofreferent[trim($value)][
'margin'] =
'minus';
699$parameters = array(
'listofreferent' => $listofreferent);
700$resHook = $hookmanager->executeHooks(
'completeListOfReferent', $parameters, $object, $action);
702if (!empty($hookmanager->resArray)) {
703 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
706if ($action ==
"addelement") {
707 $tablename =
GETPOST(
"tablename");
708 $elementselectid =
GETPOST(
"elementselect");
709 $result =
$object->update_element($tablename, $elementselectid);
713} elseif ($action ==
"unlink") {
714 $tablename =
GETPOST(
"tablename",
"aZ09");
715 $projectField = GETPOSTISSET(
'projectfield') ?
GETPOST(
'projectfield',
'aZ09') :
'fk_projet';
716 $elementselectid =
GETPOSTINT(
"elementselect");
718 $result =
$object->remove_element($tablename, $elementselectid, $projectField);
724$elementuser =
new User($db);
730if (!$showdatefilter) {
731 print
'<div class="center centpercent">';
732 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
733 print
'<input type="hidden" name="token" value="'.newToken().
'">';
734 print
'<input type="hidden" name="tablename" value="'.(empty($tablename) ?
'' : $tablename).
'">';
735 print
'<input type="hidden" name="action" value="view">';
736 print
'<div class="inline-block">';
737 print $form->selectDate($dates,
'dates', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
739 print
'<div class="inline-block">';
740 print $form->selectDate($datee,
'datee', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
742 print
'<div class="inline-block">';
743 print
'<input type="submit" name="refresh" value="'.$langs->trans(
"Refresh").
'" class="button small">';
755$langs->loadLangs(array(
"suppliers",
"bills",
"orders",
"proposals",
"margins"));
757if (isModEnabled(
'stock')) {
758 $langs->load(
'stocks');
763print
'<table class="noborder centpercent">';
764print
'<tr class="liste_titre">';
765print
'<td class="left" width="200">';
766$tooltiponprofit = $langs->trans(
"ProfitIsCalculatedWith").
"<br>\n";
767$tooltiponprofitplus = $tooltiponprofitminus =
'';
768foreach ($listofreferent as $key => $value) {
769 if (!empty($value[
'lang'])) {
770 $langs->load($value[
'lang']);
772 $name = $langs->trans($value[
'name']);
773 $qualified = $value[
'test'];
774 $margin = empty($value[
'margin']) ?
'' : $value[
'margin'];
775 if ($qualified && isset($margin)) {
776 if ($margin ===
'add') {
777 $tooltiponprofitplus .=
' > '.$name.
" (+)<br>\n";
779 if ($margin ===
'minus') {
780 $tooltiponprofitminus .=
' > '.$name.
" (-)<br>\n";
784$tooltiponprofit .= $tooltiponprofitplus;
785$tooltiponprofit .= $tooltiponprofitminus;
786print $form->textwithpicto($langs->trans(
"Element"), $tooltiponprofit);
788print
'<td class="right" width="100">'.$langs->trans(
"Number").
'</td>';
789print
'<td class="right" width="100">'.$langs->trans(
"AmountHT").
'</td>';
790print
'<td class="right" width="100">'.$langs->trans(
"AmountTTC").
'</td>';
793$total_revenue_ht = 0;
798foreach ($listofreferent as $key => $value) {
800 'total_revenue_ht' => & $total_revenue_ht,
801 'balance_ht' => & $balance_ht,
802 'balance_ttc' => & $balance_ttc,
808 $reshook = $hookmanager->executeHooks(
'printOverviewProfit', $parameters, $object, $action);
811 } elseif ($reshook > 0) {
812 print $hookmanager->resPrint;
816 $name = $langs->trans($value[
'name']);
817 $title = $value[
'title'];
818 $classname = $value[
'class'];
819 $tablename = $value[
'table'];
820 $datefieldname = $value[
'datefieldname'];
821 $qualified = $value[
'test'];
822 $margin = empty($value[
'margin']) ? 0 : $value[
'margin'];
823 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
824 if ($qualified && isset($margin)) {
825 $element =
new $classname($db);
827 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
829 if (is_array($elementarray) && count($elementarray) > 0) {
834 $num = count($elementarray);
835 for ($i = 0; $i < $num; $i++) {
836 $tmp = explode(
'_', $elementarray[$i]);
837 $idofelement = $tmp[0];
838 $idofelementuser = !empty($tmp[1]) ? $tmp[1] :
"";
840 $element->fetch($idofelement);
841 if ($idofelementuser) {
842 $elementuser->fetch($idofelementuser);
846 $qualifiedfortotal =
true;
847 if ($key ==
'invoice') {
848 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
849 $qualifiedfortotal =
false;
852 $qualifiedfortotal =
false;
855 if ($key ==
'propal') {
857 $qualifiedfortotal =
false;
861 if ($tablename !=
'expensereport_det' && method_exists($element,
'fetch_thirdparty')) {
862 $element->fetch_thirdparty();
866 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
867 $total_ht_by_line = $element->amount;
868 } elseif ($tablename ==
'fichinter') {
869 $total_ht_by_line = $element->getAmount();
870 } elseif ($tablename ==
'stock_mouvement') {
871 $total_ht_by_line = $element->price * abs($element->qty);
872 } elseif ($tablename ==
'projet_task') {
873 $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', $dates, $datee);
874 $total_ht_by_line =
price2num($tmp[
'amount'],
'MT');
875 } elseif ($key ==
'loan') {
876 if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) {
878 $total_ht_by_line = -$element->capital;
881 $total_ht_by_line = 0;
883 $loanScheduleStatic->fetchAll($element->id);
884 if (!empty($loanScheduleStatic->lines)) {
885 foreach ($loanScheduleStatic->lines as $loanSchedule) {
889 if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee)
890 || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <=
dol_now()
891 || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
893 $total_ht_by_line -= $loanSchedule->amount_capital;
899 $total_ht_by_line = $element->total_ht;
903 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
904 $total_ttc_by_line = $element->amount;
905 } elseif ($tablename ==
'fichinter') {
906 $total_ttc_by_line = $element->getAmount();
907 } elseif ($tablename ==
'stock_mouvement') {
908 $total_ttc_by_line = $element->price * abs($element->qty);
909 } elseif ($tablename ==
'projet_task') {
912 if (preg_replace(
'/^(\d+\.)\s\(.*\)/', $defaultvat, $reg)) {
913 $defaultvat = $reg[1];
915 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ((
float) $defaultvat / 100)),
'MT');
916 } elseif ($key ==
'loan') {
917 $total_ttc_by_line = $total_ht_by_line;
919 $total_ttc_by_line = $element->total_ttc;
923 if ($tablename ==
'payment_various') {
924 if ($element->sens == 1) {
925 $total_ht_by_line = -$total_ht_by_line;
926 $total_ttc_by_line = -$total_ttc_by_line;
931 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_proposal') {
932 $total_ht_by_line = -$total_ht_by_line;
933 $total_ttc_by_line = -$total_ttc_by_line;
937 if ($qualifiedfortotal) {
938 $total_ht = $total_ht + $total_ht_by_line;
939 $total_ttc = $total_ttc + $total_ttc_by_line;
947 if ($margin ===
'add') {
948 $total_revenue_ht += $total_ht;
951 if ($margin ===
"minus") {
952 $total_ht = -$total_ht;
953 $total_ttc = -$total_ttc;
956 $balance_ht += $total_ht;
957 $balance_ttc += $total_ttc;
960 print
'<tr class="oddeven">';
962 print
'<td class="left">'.$name.
'</td>';
964 print
'<td class="right">'.$i.
'</td>';
966 print
'<td class="right">';
967 if ($key ==
'intervention' && !$margin) {
968 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
970 if ($key ==
'propal') {
971 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
973 print
price($total_ht);
977 print
'<td class="right">';
978 if ($key ==
'intervention' && !$margin) {
979 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
981 if ($key ==
'propal') {
982 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
984 print
price($total_ttc);
992print
'<tr class="liste_total">';
993print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
994print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
995print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
999if (
$object->usage_organize_event) {
1000 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1002 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int)
$object->id).
') AND (t.status:=:'.ConferenceOrBoothAttendee::STATUS_VALIDATED.
')');
1004 if (!is_array($result) && $result < 0) {
1005 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
1007 $nbAttendees = count($result);
1010 if ($nbAttendees >= 2) {
1011 $costperattendee_ht = $balance_ht / $nbAttendees;
1012 $costperattendee_ttc = $balance_ttc / $nbAttendees;
1013 print
'<tr class="liste_total">';
1014 print
'<td class="right" colspan="2">'.$langs->trans(
"ProfitPerValidatedAttendee").
'</td>';
1015 print
'<td class="right">'.price(
price2num($costperattendee_ht,
'MT')).
'</td>';
1016 print
'<td class="right">'.price(
price2num($costperattendee_ttc,
'MT')).
'</td>';
1022if ($total_revenue_ht) {
1023 print
'<tr class="liste_total">';
1024 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
1025 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
1026 print
'<td class="right"></td>';
1040foreach ($listofreferent as $key => $value) {
1041 $parameters = array(
1043 'value' => & $value,
1047 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
1050 } elseif ($reshook > 0) {
1051 print $hookmanager->resPrint;
1055 $title = $value[
'title'];
1056 $classname = $value[
'class'];
1057 $tablename = $value[
'table'];
1058 $datefieldname = $value[
'datefieldname'];
1059 $qualified = $value[
'test'];
1060 $urlnew = empty($value[
'urlnew']) ?
'' : $value[
'urlnew'];
1061 $buttonnew = empty($value[
'buttonnew']) ?
'' : $value[
'buttonnew'];
1062 $testnew = empty($value[
'testnew']) ?
'' : $value[
'testnew'];
1063 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
1064 $nototal = empty($value[
'nototal']) ? 0 : 1;
1066 $exclude_select_element = array(
'payment_various');
1067 if (!empty($value[
'exclude_select_element'])) {
1068 $exclude_select_element[] = $value[
'exclude_select_element'];
1075 $element =
new $classname($db);
1079 $idtofilterthirdparty = 0;
1080 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
1081 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
1082 $idtofilterthirdparty = empty(
$object->thirdparty->id) ? 0 :
$object->thirdparty->id;
1084 $idtofilterthirdparty .=
',' .
getDolGlobalString(
'PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS');
1088 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
1091 if (!
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
1092 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, empty($project_field) ?
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
1093 if ($selectList < 0) {
1095 } elseif ($selectList) {
1097 $addform .=
'<div class="inline-block valignmiddle">';
1098 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1099 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1100 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
1101 $addform .=
'<input type="hidden" name="action" value="addelement">';
1102 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
1103 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
1104 $addform .=
'<table><tr>';
1106 $addform .=
'<td>'.$selectList.
'</td>';
1107 $addform .=
'<td><input type="submit" class="button button-linkto smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
1108 $addform .=
'</tr></table>';
1109 $addform .=
'</form>';
1110 $addform .=
'</div>';
1114 $addform .=
'<div class="inline-block valignmiddle">';
1116 $addform .=
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
1118 $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>';
1120 $addform .=
'<div>';
1123 if (is_array($elementarray) && count($elementarray) > 0 && $key ==
"order_supplier") {
1124 $addform =
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1125 <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
1128 $("#btnShow").on("click", function () {
1129 console.log("We click to show or hide the canceled lines");
1130 var attr = $(this).attr("data-canceledarehidden");
1131 if (typeof attr !== "undefined" && attr !== false) {
1132 console.log("Show canceled");
1133 $(".tr_canceled").show();
1134 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'");
1135 $("#btnShow").removeAttr("data-canceledarehidden");
1136 $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye");
1138 console.log("Hide canceled");
1139 $(".tr_canceled").hide();
1140 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'");
1141 $("#btnShow").attr("data-canceledarehidden", 1);
1142 $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash");
1145 </script></div> '.$addform;
1150 print
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
1151 print
'<div class="div-table-responsive">';
1152 print
'<table class="noborder centpercent">';
1154 print
'<tr class="liste_titre">';
1156 print
'<td style="width: 24px"></td>';
1158 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
'>'.$langs->trans(
"Ref").
'</td>';
1160 if (
'MouvementStock' == $classname) {
1161 print
'<td style="width: 200px">'.$langs->trans(
"Product").
'</td>';
1162 print
'<td style="width: 50px">'.$langs->trans(
"Qty").
'</td>';
1165 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
' class="center">';
1166 if (in_array($tablename, array(
'projet_task'))) {
1167 print $langs->trans(
"TimeSpent");
1169 if (!in_array($tablename, array(
'projet_task'))) {
1170 print $langs->trans(
"Date");
1175 if (in_array($tablename, array(
'projet_task')) && $key ==
'project_task') {
1177 } elseif (in_array($tablename, array(
'payment_various'))) {
1179 } elseif (in_array($tablename, array(
'expensereport_det',
'don',
'projet_task',
'stock_mouvement',
'salary'))) {
1180 print $langs->trans(
"User");
1182 print $langs->trans(
"ThirdParty");
1186 if ($tablename ==
'fichinter') {
1188 print $langs->trans(
"TotalDuration");
1189 $total_duration = 0;
1195 if ($key ==
'loan') {
1196 print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
1197 } elseif (empty($value[
'disableamount'])) {
1198 print
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
1200 print
'<td width="120"></td>';
1204 if ($key ==
'loan') {
1205 print
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
1206 } elseif (empty($value[
'disableamount'])) {
1207 print
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
1209 print
'<td width="120"></td>';
1212 if (in_array($tablename, array(
'projet_task'))) {
1213 print
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
1215 print
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
1219 if (is_array($elementarray) && count($elementarray) > 0) {
1223 $total_ht_by_third = 0;
1224 $total_ttc_by_third = 0;
1226 $saved_third_id = 0;
1234 $num = count($elementarray);
1235 for ($i = 0; $i < $num; $i++) {
1236 $tmp = explode(
'_', $elementarray[$i]);
1237 $idofelement = $tmp[0];
1238 $idofelementuser = isset($tmp[1]) ? $tmp[1] :
"";
1240 $element->fetch($idofelement);
1241 if ($idofelementuser) {
1242 $elementuser->fetch($idofelementuser);
1246 if ($tablename !=
'expensereport_det') {
1247 if (method_exists($element,
'fetch_thirdparty')) {
1248 $element->fetch_thirdparty();
1252 $expensereport->fetch($element->fk_expensereport);
1257 if ($breakline && $saved_third_id != $element->thirdparty->id) {
1260 $saved_third_id = $element->thirdparty->id;
1263 $total_ht_by_third = 0;
1264 $total_ttc_by_third = 0;
1267 $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
1269 $qualifiedfortotal =
true;
1270 if ($key ==
'invoice') {
1271 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
1272 $qualifiedfortotal =
false;
1274 } elseif ($key ==
'order_supplier' && $element->status == 7) {
1275 $qualifiedfortotal =
false;
1278 if ($key ==
"order_supplier" && $element->status == 7) {
1279 print
'<tr class="oddeven tr_canceled" style=display:none>';
1281 print
'<tr class="oddeven" >';
1286 print
'<td style="width: 24px">';
1287 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement') {
1289 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1290 print
img_picto($langs->trans(
'Unlink'),
'unlink');
1297 print
'<td class="left nowraponall tdoverflowmax250">';
1298 if ($tablename ==
'expensereport_det') {
1299 print $expensereport->getNomUrl(1);
1302 if ($element instanceof
Task) {
1303 print $element->getNomUrl(1,
'withproject',
'time');
1304 print
' - '.dol_trunc($element->label, 48);
1305 } elseif ($key ==
'loan') {
1306 print $element->getNomUrl(1);
1307 print
' - '.dol_trunc($element->label, 48);
1309 print $element->getNomUrl(1);
1312 $element_doc = $element->element;
1314 if (!empty($conf->$element_doc)) {
1315 $confelementdoc = $conf->$element_doc;
1316 $filedir = $confelementdoc->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1321 if ($element_doc ===
'order_supplier') {
1322 $element_doc =
'commande_fournisseur';
1323 $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1324 } elseif ($element_doc ===
'invoice_supplier') {
1325 $element_doc =
'facture_fournisseur';
1326 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1327 $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].
'/'.$filename;
1330 print
'<div class="inline-block valignmiddle">';
1332 print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
1337 if (!empty($element->ref_supplier)) {
1338 print
' - '.$element->ref_supplier;
1341 if (!empty($element->ref_customer)) {
1342 print
' - '.$element->ref_customer;
1345 if (empty($element->ref_customer) && !empty($element->ref_client)) {
1346 print
' - '.$element->ref_client;
1351 if (
'MouvementStock' == $classname) {
1352 $mvsProd =
new Product($element->db);
1353 $mvsProd->fetch($element->product_id);
1354 print
'<td>'.$mvsProd->getNomUrl(1).
'</td>';
1355 print
'<td>'.$element->qty.
'</td>';
1359 $total_time_by_line =
null;
1360 if ($tablename ==
'expensereport_det') {
1361 $date = $element->date;
1362 } elseif ($tablename ==
'stock_mouvement') {
1363 $date = $element->datem;
1364 } elseif ($tablename ==
'salary') {
1365 $date = $element->datesp;
1366 } elseif ($tablename ==
'payment_various') {
1367 $date = $element->datev;
1368 } elseif ($tablename ==
'chargesociales') {
1369 $date = $element->date_ech;
1370 } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
1371 if ($tablename ==
'don') {
1372 $date = $element->datedon;
1374 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
1375 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1376 } elseif ($tablename ==
'supplier_proposal') {
1377 $date = $element->date_validation;
1378 } elseif ($tablename ==
'fichinter') {
1379 $date = $element->datev;
1380 } elseif ($tablename ==
'projet_task') {
1383 $date = $element->date;
1385 $date = $element->date_contrat;
1388 $date = $element->datev;
1390 if (empty($date) && !empty($datefieldname)) {
1391 $date = $element->$datefieldname;
1394 } elseif ($key ==
'loan') {
1395 $date = $element->datestart;
1398 print
'<td class="center">';
1399 if ($tablename ==
'actioncomm') {
1401 if ($element->datef && $element->datef > $element->datep) {
1402 print
" - ".dol_print_date($element->datef,
'dayhour');
1404 } elseif (in_array($tablename, array(
'projet_task'))) {
1405 $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', $dates, $datee);
1406 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1409 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1416 print
'<td class="tdoverflowmax150">';
1417 if (is_object($element->thirdparty)) {
1418 print $element->thirdparty->getNomUrl(1,
'', 48);
1419 } elseif ($tablename ==
'expensereport_det') {
1420 $tmpuser =
new User($db);
1421 $tmpuser->fetch($expensereport->fk_user_author);
1422 print $tmpuser->getNomUrl(1,
'', 48);
1423 } elseif ($tablename ==
'salary') {
1424 $tmpuser =
new User($db);
1425 $tmpuser->fetch($element->fk_user);
1426 print $tmpuser->getNomUrl(1,
'', 48);
1427 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement') {
1428 if ($element->fk_user_author > 0) {
1429 $tmpuser2 =
new User($db);
1430 $tmpuser2->fetch($element->fk_user_author);
1431 print $tmpuser2->getNomUrl(1,
'', 48);
1433 } elseif ($tablename ==
'projet_task' && $key ==
'element_time') {
1434 print $elementuser->getNomUrl(1);
1439 if ($tablename ==
'fichinter') {
1441 print
convertSecondToTime($element->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
1442 $total_duration += $element->duration;
1448 if (empty($value[
'disableamount'])) {
1449 $total_ht_by_line =
null;
1451 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1452 $total_ht_by_line = $element->amount;
1453 } elseif ($tablename ==
'fichinter') {
1454 $total_ht_by_line = $element->getAmount();
1455 } elseif ($tablename ==
'stock_mouvement') {
1456 $total_ht_by_line = $element->price * abs($element->qty);
1457 } elseif (in_array($tablename, array(
'projet_task'))) {
1458 if (isModEnabled(
'salaries')) {
1460 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1461 if ($tmpprojtime[
'nblinesnull'] > 0) {
1462 $langs->load(
"errors");
1463 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate", $conf->currency);
1466 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1468 } elseif ($key ==
'loan') {
1469 $total_ht_by_line = $element->capital;
1471 $total_ht_by_line = $element->total_ht;
1475 if ($tablename ==
'payment_various') {
1476 if ($element->sens == 0) {
1477 $total_ht_by_line = -$total_ht_by_line;
1481 print
'<td class="right">';
1482 if ($othermessage) {
1483 print
'<span class="opacitymedium">'.$othermessage.
'</span>';
1485 if (isset($total_ht_by_line)) {
1486 if (!$qualifiedfortotal) {
1489 print
'<span class="amount">'.price($total_ht_by_line).
'</span>';
1490 if (!$qualifiedfortotal) {
1495 print
' '.img_warning($warning);
1503 if (empty($value[
'disableamount'])) {
1504 $total_ttc_by_line =
null;
1505 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1506 $total_ttc_by_line = $element->amount;
1507 } elseif ($tablename ==
'fichinter') {
1508 $total_ttc_by_line = $element->getAmount();
1509 } elseif ($tablename ==
'stock_mouvement') {
1510 $total_ttc_by_line = $element->price * abs($element->qty);
1511 } elseif ($tablename ==
'projet_task') {
1512 if (isModEnabled(
'salaries')) {
1515 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1517 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1519 } elseif ($key ==
'loan') {
1520 $total_ttc_by_line = $element->capital - $element->getSumPayment();
1522 $total_ttc_by_line = $element->total_ttc;
1526 if ($tablename ==
'payment_various') {
1527 if ($element->sens == 0) {
1528 $total_ttc_by_line = -$total_ttc_by_line;
1532 print
'<td class="right">';
1533 if ($othermessage) {
1534 print $othermessage;
1536 if (isset($total_ttc_by_line)) {
1537 if (!$qualifiedfortotal) {
1540 print
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
1541 if (!$qualifiedfortotal) {
1546 print
' '.img_warning($warning);
1554 print
'<td class="right">';
1555 if ($tablename ==
'expensereport_det') {
1556 print $expensereport->getLibStatut(5);
1559 print $element->getLibStatut(5, $element->getSommePaiement());
1560 } elseif ($element instanceof
Task) {
1561 if ($element->progress !=
'') {
1562 print $element->progress.
' %';
1564 } elseif ($tablename ==
'stock_mouvement') {
1565 print $element->getLibStatut(3);
1567 print $element->getLibStatut(5);
1573 if ($qualifiedfortotal) {
1574 $total_ht = $total_ht + $total_ht_by_line;
1575 $total_ttc = $total_ttc + $total_ttc_by_line;
1577 $total_ht_by_third += $total_ht_by_line;
1578 $total_ttc_by_third += $total_ttc_by_line;
1580 if (!isset($total_time)) {
1581 $total_time = $total_time_by_line;
1583 $total_time += $total_time_by_line;
1588 $breakline =
'<tr class="liste_total liste_sub_total">';
1589 $breakline .=
'<td colspan="2">';
1590 $breakline .=
'</td>';
1591 $breakline .=
'<td>';
1592 $breakline .=
'</td>';
1593 $breakline .=
'<td class="right">';
1594 $breakline .= $langs->trans(
'SubTotal').
' : ';
1595 if (is_object($element->thirdparty)) {
1596 $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1598 $breakline .=
'</td>';
1599 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1600 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1601 $breakline .=
'<td></td>';
1602 $breakline .=
'</tr>';
1613 if (empty($nototal)) {
1615 if (in_array($tablename, array(
'projet_task'))) {
1619 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1620 if (in_array($tablename, array(
'projet_task'))) {
1621 print
'<td class="center">';
1630 if ($tablename ==
'fichinter') {
1631 print
'<td class="left">'.convertSecondToTime($total_duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1633 print
'<td class="right">';
1634 if (empty($value[
'disableamount'])) {
1635 if ($key ==
'loan') {
1636 print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1637 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1638 print
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
1644 print
'<td class="right">';
1645 if (empty($value[
'disableamount'])) {
1646 if ($key ==
'loan') {
1647 print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
1648 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1649 print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
1653 print
'<td> </td>';
1657 if (!is_array($elementarray)) {
1658 print
'<tr><td>'.$elementarray.
'</td></tr>';
1661 if ($tablename ==
'fichinter') {
1664 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1674if ($conf->use_javascript_ajax) {
1675 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
1678 print $comboenhancement;
1700 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
1711 global $db, $classname;
1713 $element =
new $classname($db);
1715 $clientname = array();
1716 foreach ($elementarray as $key => $id) {
1717 if (empty($clientname[$id])) {
1718 $element->fetch($id);
1719 $element->fetch_thirdparty();
1721 $clientname[$id] = $element->thirdparty->name;
1728 $elementarray = array();
1729 foreach ($clientname as $id => $name) {
1730 $elementarray[] = $id;
1733 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()
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.
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)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return 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.