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 ($qualifiedfortotal) {
932 $total_ht = $total_ht + $total_ht_by_line;
933 $total_ttc = $total_ttc + $total_ttc_by_line;
941 if ($margin ===
'add') {
942 $total_revenue_ht += $total_ht;
945 if ($margin ===
"minus") {
946 $total_ht = -$total_ht;
947 $total_ttc = -$total_ttc;
950 $balance_ht += $total_ht;
951 $balance_ttc += $total_ttc;
954 print
'<tr class="oddeven">';
956 print
'<td class="left">'.$name.
'</td>';
958 print
'<td class="right">'.$i.
'</td>';
960 print
'<td class="right">';
961 if ($key ==
'intervention' && !$margin) {
962 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
964 if ($key ==
'propal') {
965 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
967 print
price($total_ht);
971 print
'<td class="right">';
972 if ($key ==
'intervention' && !$margin) {
973 print
'<span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"NA"), $langs->trans(
"AmountOfInteventionNotIncludedByDefault")).
'</span>';
975 if ($key ==
'propal') {
976 print
'<span class="opacitymedium">'.$form->textwithpicto(
'', $langs->trans(
"SignedOnly")).
'</span>';
978 print
price($total_ttc);
986print
'<tr class="liste_total">';
987print
'<td class="right" colspan="2">'.$langs->trans(
"Profit").
'</td>';
988print
'<td class="right">'.price(
price2num($balance_ht,
'MT')).
'</td>';
989print
'<td class="right">'.price(
price2num($balance_ttc,
'MT')).
'</td>';
993if (
$object->usage_organize_event) {
994 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
996 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int)
$object->id).
') AND (t.status:=:'.ConferenceOrBoothAttendee::STATUS_VALIDATED.
')');
998 if (!is_array($result) && $result < 0) {
999 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
1001 $nbAttendees = count($result);
1004 if ($nbAttendees >= 2) {
1005 $costperattendee_ht = $balance_ht / $nbAttendees;
1006 $costperattendee_ttc = $balance_ttc / $nbAttendees;
1007 print
'<tr class="liste_total">';
1008 print
'<td class="right" colspan="2">'.$langs->trans(
"ProfitPerValidatedAttendee").
'</td>';
1009 print
'<td class="right">'.price(
price2num($costperattendee_ht,
'MT')).
'</td>';
1010 print
'<td class="right">'.price(
price2num($costperattendee_ttc,
'MT')).
'</td>';
1016if ($total_revenue_ht) {
1017 print
'<tr class="liste_total">';
1018 print
'<td class="right" colspan="2">'.$langs->trans(
"Margin").
'</td>';
1019 print
'<td class="right">'.round(100 * $balance_ht / $total_revenue_ht, 1).
'%</td>';
1020 print
'<td class="right"></td>';
1034foreach ($listofreferent as $key => $value) {
1035 $parameters = array(
1037 'value' => & $value,
1041 $reshook = $hookmanager->executeHooks(
'printOverviewDetail', $parameters, $object, $action);
1044 } elseif ($reshook > 0) {
1045 print $hookmanager->resPrint;
1049 $title = $value[
'title'];
1050 $classname = $value[
'class'];
1051 $tablename = $value[
'table'];
1052 $datefieldname = $value[
'datefieldname'];
1053 $qualified = $value[
'test'];
1054 $urlnew = empty($value[
'urlnew']) ?
'' : $value[
'urlnew'];
1055 $buttonnew = empty($value[
'buttonnew']) ?
'' : $value[
'buttonnew'];
1056 $testnew = empty($value[
'testnew']) ?
'' : $value[
'testnew'];
1057 $project_field = empty($value[
'project_field']) ?
'' : $value[
'project_field'];
1058 $nototal = empty($value[
'nototal']) ? 0 : 1;
1060 $exclude_select_element = array(
'payment_various');
1061 if (!empty($value[
'exclude_select_element'])) {
1062 $exclude_select_element[] = $value[
'exclude_select_element'];
1069 $element =
new $classname($db);
1073 $idtofilterthirdparty = 0;
1074 $array_of_element_linkable_with_different_thirdparty = array(
'facture_fourn',
'commande_fournisseur');
1075 if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) {
1076 $idtofilterthirdparty = empty(
$object->thirdparty->id) ? 0 :
$object->thirdparty->id;
1078 $idtofilterthirdparty .=
',' .
getDolGlobalString(
'PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS');
1082 $elementarray =
$object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field :
'fk_projet');
1085 if (!
getDolGlobalString(
'PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) {
1086 $selectList = $formproject->select_element($tablename, $idtofilterthirdparty,
'minwidth300 minwidth75imp', -2, empty($project_field) ?
'fk_projet' : $project_field, $langs->trans(
"SelectElement"));
1087 if ($selectList < 0) {
1089 } elseif ($selectList) {
1091 $addform .=
'<div class="inline-block valignmiddle">';
1092 $addform .=
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1093 $addform .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1094 $addform .=
'<input type="hidden" name="tablename" value="'.$tablename.
'">';
1095 $addform .=
'<input type="hidden" name="action" value="addelement">';
1096 $addform .=
'<input type="hidden" name="datesrfc" value="'.dol_print_date($dates,
'dayhourrfc').
'">';
1097 $addform .=
'<input type="hidden" name="dateerfc" value="'.dol_print_date($datee,
'dayhourrfc').
'">';
1098 $addform .=
'<table><tr>';
1100 $addform .=
'<td>'.$selectList.
'</td>';
1101 $addform .=
'<td><input type="submit" class="button button-linkto smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"LinkToElementShort")).
'"></td>';
1102 $addform .=
'</tr></table>';
1103 $addform .=
'</form>';
1104 $addform .=
'</div>';
1108 $addform .=
'<div class="inline-block valignmiddle">';
1110 $addform .=
'<a class="buttonxxx marginleftonly" href="'.$urlnew.
'" title="'.
dol_escape_htmltag($langs->trans($buttonnew)).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
1112 $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>';
1114 $addform .=
'<div>';
1117 if (is_array($elementarray) && count($elementarray) > 0 && $key ==
"order_supplier") {
1118 $addform =
'<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
1119 <span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans(
"CanceledShown").
'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
1122 $("#btnShow").on("click", function () {
1123 console.log("We click to show or hide the canceled lines");
1124 var attr = $(this).attr("data-canceledarehidden");
1125 if (typeof attr !== "undefined" && attr !== false) {
1126 console.log("Show canceled");
1127 $(".tr_canceled").show();
1128 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledShown")).
'");
1129 $("#btnShow").removeAttr("data-canceledarehidden");
1130 $("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye");
1132 console.log("Hide canceled");
1133 $(".tr_canceled").hide();
1134 $("#textBtnShow").text("'.
dol_escape_js($langs->transnoentitiesnoconv(
"CanceledHidden")).
'");
1135 $("#btnShow").attr("data-canceledarehidden", 1);
1136 $("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash");
1139 </script></div> '.$addform;
1144 print
"\n".
'<!-- Table for tablename = '.$tablename.
' -->'.
"\n";
1145 print
'<div class="div-table-responsive">';
1146 print
'<table class="noborder centpercent">';
1148 print
'<tr class="liste_titre">';
1150 print
'<td style="width: 24px"></td>';
1152 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
'>'.$langs->trans(
"Ref").
'</td>';
1154 if (
'MouvementStock' == $classname) {
1155 print
'<td style="width: 200px">'.$langs->trans(
"Product").
'</td>';
1156 print
'<td style="width: 50px">'.$langs->trans(
"Qty").
'</td>';
1159 print
'<td'.(($tablename !=
'actioncomm' && $tablename !=
'projet_task') ?
' style="width: 200px"' :
'').
' class="center">';
1160 if (in_array($tablename, array(
'projet_task'))) {
1161 print $langs->trans(
"TimeSpent");
1163 if (!in_array($tablename, array(
'projet_task'))) {
1164 print $langs->trans(
"Date");
1169 if (in_array($tablename, array(
'projet_task')) && $key ==
'project_task') {
1171 } elseif (in_array($tablename, array(
'payment_various'))) {
1173 } elseif (in_array($tablename, array(
'expensereport_det',
'don',
'projet_task',
'stock_mouvement',
'salary'))) {
1174 print $langs->trans(
"User");
1176 print $langs->trans(
"ThirdParty");
1180 if ($tablename ==
'fichinter') {
1182 print $langs->trans(
"TotalDuration");
1183 $total_duration = 0;
1189 if ($key ==
'loan') {
1190 print
'<td class="right" width="120">'.$langs->trans(
"LoanCapital").
'</td>';
1191 } elseif (empty($value[
'disableamount'])) {
1192 print
'<td class="right" width="120">'.$langs->trans(
"AmountHT").
'</td>';
1194 print
'<td width="120"></td>';
1198 if ($key ==
'loan') {
1199 print
'<td class="right" width="120">'.$langs->trans(
"RemainderToPay").
'</td>';
1200 } elseif (empty($value[
'disableamount'])) {
1201 print
'<td class="right" width="120">'.$langs->trans(
"AmountTTC").
'</td>';
1203 print
'<td width="120"></td>';
1206 if (in_array($tablename, array(
'projet_task'))) {
1207 print
'<td class="right" width="200">'.$langs->trans(
"ProgressDeclared").
'</td>';
1209 print
'<td class="right" width="200">'.$langs->trans(
"Status").
'</td>';
1213 if (is_array($elementarray) && count($elementarray) > 0) {
1217 $total_ht_by_third = 0;
1218 $total_ttc_by_third = 0;
1220 $saved_third_id = 0;
1228 $num = count($elementarray);
1229 for ($i = 0; $i < $num; $i++) {
1230 $tmp = explode(
'_', $elementarray[$i]);
1231 $idofelement = $tmp[0];
1232 $idofelementuser = isset($tmp[1]) ? $tmp[1] :
"";
1234 $element->fetch($idofelement);
1235 if ($idofelementuser) {
1236 $elementuser->fetch($idofelementuser);
1240 if ($tablename !=
'expensereport_det') {
1241 if (method_exists($element,
'fetch_thirdparty')) {
1242 $element->fetch_thirdparty();
1246 $expensereport->fetch($element->fk_expensereport);
1251 if ($breakline && $saved_third_id != $element->thirdparty->id) {
1254 $saved_third_id = $element->thirdparty->id;
1257 $total_ht_by_third = 0;
1258 $total_ttc_by_third = 0;
1261 $saved_third_id = empty($element->thirdparty->id) ? 0 : $element->thirdparty->id;
1263 $qualifiedfortotal =
true;
1264 if ($key ==
'invoice') {
1265 if (!empty($element->close_code) && $element->close_code ==
'replaced') {
1266 $qualifiedfortotal =
false;
1268 } elseif ($key ==
'order_supplier' && $element->status == 7) {
1269 $qualifiedfortotal =
false;
1272 if ($key ==
"order_supplier" && $element->status == 7) {
1273 print
'<tr class="oddeven tr_canceled" style=display:none>';
1275 print
'<tr class="oddeven" >';
1280 print
'<td style="width: 24px">';
1281 if ($tablename !=
'projet_task' && $tablename !=
'stock_mouvement') {
1283 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=unlink&tablename='.$tablename.
'&elementselect='.$element->id.($project_field ?
'&projectfield='.$project_field :
'').
'" class="reposition">';
1284 print
img_picto($langs->trans(
'Unlink'),
'unlink');
1291 print
'<td class="left nowraponall tdoverflowmax250">';
1292 if ($tablename ==
'expensereport_det') {
1293 print $expensereport->getNomUrl(1);
1296 if ($element instanceof
Task) {
1297 print $element->getNomUrl(1,
'withproject',
'time');
1298 print
' - '.dol_trunc($element->label, 48);
1299 } elseif ($key ==
'loan') {
1300 print $element->getNomUrl(1);
1301 print
' - '.dol_trunc($element->label, 48);
1303 print $element->getNomUrl(1);
1306 $element_doc = $element->element;
1308 if (!empty($conf->$element_doc)) {
1309 $confelementdoc = $conf->$element_doc;
1310 $filedir = $confelementdoc->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1315 if ($element_doc ===
'order_supplier') {
1316 $element_doc =
'commande_fournisseur';
1317 $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].
'/'.
dol_sanitizeFileName($element->ref);
1318 } elseif ($element_doc ===
'invoice_supplier') {
1319 $element_doc =
'facture_fournisseur';
1320 $filename =
get_exdir($element->id, 2, 0, 0, $element,
'invoice_supplier').dol_sanitizeFileName($element->ref);
1321 $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].
'/'.$filename;
1324 print
'<div class="inline-block valignmiddle">';
1326 print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
1331 if (!empty($element->ref_supplier)) {
1332 print
' - '.$element->ref_supplier;
1335 if (!empty($element->ref_customer)) {
1336 print
' - '.$element->ref_customer;
1339 if (empty($element->ref_customer) && !empty($element->ref_client)) {
1340 print
' - '.$element->ref_client;
1345 if (
'MouvementStock' == $classname) {
1346 $mvsProd =
new Product($element->db);
1347 $mvsProd->fetch($element->product_id);
1348 print
'<td>'.$mvsProd->getNomUrl(1).
'</td>';
1349 print
'<td>'.$element->qty.
'</td>';
1353 $total_time_by_line =
null;
1354 if ($tablename ==
'expensereport_det') {
1355 $date = $element->date;
1356 } elseif ($tablename ==
'stock_mouvement') {
1357 $date = $element->datem;
1358 } elseif ($tablename ==
'salary') {
1359 $date = $element->datesp;
1360 } elseif ($tablename ==
'payment_various') {
1361 $date = $element->datev;
1362 } elseif ($tablename ==
'chargesociales') {
1363 $date = $element->date_ech;
1364 } elseif (!empty($element->status) || !empty($element->statut) || !empty($element->fk_status)) {
1365 if ($tablename ==
'don') {
1366 $date = $element->datedon;
1368 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
1369 $date = ($element->date_commande ? $element->date_commande : $element->date_valid);
1370 } elseif ($tablename ==
'supplier_proposal') {
1371 $date = $element->date_validation;
1372 } elseif ($tablename ==
'fichinter') {
1373 $date = $element->datev;
1374 } elseif ($tablename ==
'projet_task') {
1377 $date = $element->date;
1379 $date = $element->date_contrat;
1382 $date = $element->datev;
1384 if (empty($date) && !empty($datefieldname)) {
1385 $date = $element->$datefieldname;
1388 } elseif ($key ==
'loan') {
1389 $date = $element->datestart;
1392 print
'<td class="center">';
1393 if ($tablename ==
'actioncomm') {
1395 if ($element->datef && $element->datef > $element->datep) {
1396 print
" - ".dol_print_date($element->datef,
'dayhour');
1398 } elseif (in_array($tablename, array(
'projet_task'))) {
1399 $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser :
'', $dates, $datee);
1400 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$idofelement.
'&withproject=1">';
1403 $total_time_by_line = $tmpprojtime[
'nbseconds'];
1410 print
'<td class="tdoverflowmax150">';
1411 if (is_object($element->thirdparty)) {
1412 print $element->thirdparty->getNomUrl(1,
'', 48);
1413 } elseif ($tablename ==
'expensereport_det') {
1414 $tmpuser =
new User($db);
1415 $tmpuser->fetch($expensereport->fk_user_author);
1416 print $tmpuser->getNomUrl(1,
'', 48);
1417 } elseif ($tablename ==
'salary') {
1418 $tmpuser =
new User($db);
1419 $tmpuser->fetch($element->fk_user);
1420 print $tmpuser->getNomUrl(1,
'', 48);
1421 } elseif ($tablename ==
'don' || $tablename ==
'stock_mouvement') {
1422 if ($element->fk_user_author > 0) {
1423 $tmpuser2 =
new User($db);
1424 $tmpuser2->fetch($element->fk_user_author);
1425 print $tmpuser2->getNomUrl(1,
'', 48);
1427 } elseif ($tablename ==
'projet_task' && $key ==
'element_time') {
1428 print $elementuser->getNomUrl(1);
1433 if ($tablename ==
'fichinter') {
1435 print
convertSecondToTime($element->duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
1436 $total_duration += $element->duration;
1442 if (empty($value[
'disableamount'])) {
1443 $total_ht_by_line =
null;
1445 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1446 $total_ht_by_line = $element->amount;
1447 } elseif ($tablename ==
'fichinter') {
1448 $total_ht_by_line = $element->getAmount();
1449 } elseif ($tablename ==
'stock_mouvement') {
1450 $total_ht_by_line = $element->price * abs($element->qty);
1451 } elseif (in_array($tablename, array(
'projet_task'))) {
1452 if (isModEnabled(
'salaries')) {
1454 $total_ht_by_line =
price2num($tmpprojtime[
'amount'],
'MT');
1455 if ($tmpprojtime[
'nblinesnull'] > 0) {
1456 $langs->load(
"errors");
1457 $warning = $langs->trans(
"WarningSomeLinesWithNullHourlyRate", $conf->currency);
1460 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1462 } elseif ($key ==
'loan') {
1463 $total_ht_by_line = $element->capital;
1465 $total_ht_by_line = $element->total_ht;
1469 if ($tablename ==
'payment_various') {
1470 if ($element->sens == 0) {
1471 $total_ht_by_line = -$total_ht_by_line;
1475 print
'<td class="right">';
1476 if ($othermessage) {
1477 print
'<span class="opacitymedium">'.$othermessage.
'</span>';
1479 if (isset($total_ht_by_line)) {
1480 if (!$qualifiedfortotal) {
1483 print
'<span class="amount">'.price($total_ht_by_line).
'</span>';
1484 if (!$qualifiedfortotal) {
1489 print
' '.img_warning($warning);
1497 if (empty($value[
'disableamount'])) {
1498 $total_ttc_by_line =
null;
1499 if ($tablename ==
'don' || $tablename ==
'chargesociales' || $tablename ==
'payment_various' || $tablename ==
'salary') {
1500 $total_ttc_by_line = $element->amount;
1501 } elseif ($tablename ==
'fichinter') {
1502 $total_ttc_by_line = $element->getAmount();
1503 } elseif ($tablename ==
'stock_mouvement') {
1504 $total_ttc_by_line = $element->price * abs($element->qty);
1505 } elseif ($tablename ==
'projet_task') {
1506 if (isModEnabled(
'salaries')) {
1509 $total_ttc_by_line =
price2num($total_ht_by_line * (1 + ($defaultvat / 100)),
'MT');
1511 $othermessage = $form->textwithpicto($langs->trans(
"NotAvailable"), $langs->trans(
"ModuleSalaryToDefineHourlyRateMustBeEnabled"));
1513 } elseif ($key ==
'loan') {
1514 $total_ttc_by_line = $element->capital - $element->getSumPayment();
1516 $total_ttc_by_line = $element->total_ttc;
1520 if ($tablename ==
'payment_various') {
1521 if ($element->sens == 0) {
1522 $total_ttc_by_line = -$total_ttc_by_line;
1526 print
'<td class="right">';
1527 if ($othermessage) {
1528 print $othermessage;
1530 if (isset($total_ttc_by_line)) {
1531 if (!$qualifiedfortotal) {
1534 print
'<span class="amount">'.price($total_ttc_by_line).
'</span>';
1535 if (!$qualifiedfortotal) {
1540 print
' '.img_warning($warning);
1548 print
'<td class="right">';
1549 if ($tablename ==
'expensereport_det') {
1550 print $expensereport->getLibStatut(5);
1553 print $element->getLibStatut(5, $element->getSommePaiement());
1554 } elseif ($element instanceof
Task) {
1555 if ($element->progress !=
'') {
1556 print $element->progress.
' %';
1558 } elseif ($tablename ==
'stock_mouvement') {
1559 print $element->getLibStatut(3);
1561 print $element->getLibStatut(5);
1567 if ($qualifiedfortotal) {
1568 $total_ht = $total_ht + $total_ht_by_line;
1569 $total_ttc = $total_ttc + $total_ttc_by_line;
1571 $total_ht_by_third += $total_ht_by_line;
1572 $total_ttc_by_third += $total_ttc_by_line;
1574 if (!isset($total_time)) {
1575 $total_time = $total_time_by_line;
1577 $total_time += $total_time_by_line;
1582 $breakline =
'<tr class="liste_total liste_sub_total">';
1583 $breakline .=
'<td colspan="2">';
1584 $breakline .=
'</td>';
1585 $breakline .=
'<td>';
1586 $breakline .=
'</td>';
1587 $breakline .=
'<td class="right">';
1588 $breakline .= $langs->trans(
'SubTotal').
' : ';
1589 if (is_object($element->thirdparty)) {
1590 $breakline .= $element->thirdparty->getNomUrl(0,
'', 48);
1592 $breakline .=
'</td>';
1593 $breakline .=
'<td class="right">'.price($total_ht_by_third).
'</td>';
1594 $breakline .=
'<td class="right">'.price($total_ttc_by_third).
'</td>';
1595 $breakline .=
'<td></td>';
1596 $breakline .=
'</tr>';
1607 if (empty($nototal)) {
1609 if (in_array($tablename, array(
'projet_task'))) {
1613 print
'<tr class="liste_total"><td colspan="'.$colspan.
'">'.$langs->trans(
"Number").
': '.$i.
'</td>';
1614 if (in_array($tablename, array(
'projet_task'))) {
1615 print
'<td class="center">';
1624 if ($tablename ==
'fichinter') {
1625 print
'<td class="left">'.convertSecondToTime($total_duration,
'all', $conf->global->MAIN_DURATION_OF_WORKDAY).
'</td>';
1627 print
'<td class="right">';
1628 if (empty($value[
'disableamount'])) {
1629 if ($key ==
'loan') {
1630 print $langs->trans(
"Total").
' '.$langs->trans(
"LoanCapital").
' : '.
price($total_ttc);
1631 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1632 print
''.$langs->trans(
"TotalHT").
' : '.
price($total_ht);
1638 print
'<td class="right">';
1639 if (empty($value[
'disableamount'])) {
1640 if ($key ==
'loan') {
1641 print $langs->trans(
"Total").
' '.$langs->trans(
"RemainderToPay").
' : '.
price($total_ttc);
1642 } elseif ($tablename !=
'projet_task' || isModEnabled(
'salaries')) {
1643 print $langs->trans(
"TotalTTC").
' : '.
price($total_ttc);
1647 print
'<td> </td>';
1651 if (!is_array($elementarray)) {
1652 print
'<tr><td>'.$elementarray.
'</td></tr>';
1655 if ($tablename ==
'fichinter') {
1658 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1668if ($conf->use_javascript_ajax) {
1669 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
1672 print $comboenhancement;
1694 return in_array($tablename, array(
'facture_fourn',
'commande_fournisseur'));
1705 global $db, $classname;
1707 $element =
new $classname($db);
1709 $clientname = array();
1710 foreach ($elementarray as $key => $id) {
1711 if (empty($clientname[$id])) {
1712 $element->fetch($id);
1713 $element->fetch_thirdparty();
1715 $clientname[$id] = $element->thirdparty->name;
1722 $elementarray = array();
1723 foreach ($clientname as $id => $name) {
1724 $elementarray[] = $id;
1727 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.