NEW Add planned workload and declared progress on project summary list
on project home page (data aggregated from tasks of project)
This commit is contained in:
parent
7b0a9fabab
commit
e3c6e4ebe5
@ -895,9 +895,10 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$title=$langs->trans("Projects");
|
||||
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
|
||||
|
||||
$arrayidtypeofcontact=array();
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount, COUNT(DISTINCT t.rowid) as nb"; // We use DISTINCT here because line can be doubled if task has 2 links to same user
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
if ($mytasks)
|
||||
{
|
||||
@ -916,9 +917,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
{
|
||||
$sql.= " AND p.rowid = t.fk_projet";
|
||||
$sql.= " AND ec.element_id = t.rowid";
|
||||
$sql.= " AND ctc.rowid = ec.fk_c_type_contact";
|
||||
$sql.= " AND ctc.element = 'project_task'";
|
||||
$sql.= " AND ec.fk_socpeople = ".$user->id;
|
||||
$sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
|
||||
$sql.= " AND ctc.element = 'project_task'";
|
||||
}
|
||||
if ($statut >= 0)
|
||||
{
|
||||
@ -938,14 +939,40 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")";
|
||||
}
|
||||
}
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount";
|
||||
$sql.= " ORDER BY p.title, p.ref";
|
||||
|
||||
// Get id of project we must show tasks
|
||||
$arrayidofprojects=array();
|
||||
$sql1 = "SELECT p.rowid as projectid";
|
||||
$sql1.= $sql;
|
||||
$resql = $db->query($sql1);
|
||||
if ($resql)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($resql);
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$arrayidofprojects[$objp->projectid]=$objp->projectid;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1;
|
||||
|
||||
// Get list of project with calculation on tasks
|
||||
$sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
|
||||
$sql2.= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
|
||||
$sql2.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
|
||||
$sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")";
|
||||
$sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount";
|
||||
$sql2.= " ORDER BY p.title, p.ref";
|
||||
|
||||
$var=true;
|
||||
$resql = $db->query($sql);
|
||||
if ( $resql )
|
||||
$resql = $db->query($sql2);
|
||||
if ($resql)
|
||||
{
|
||||
$total_task = 0;
|
||||
$total_task = 0;
|
||||
$total_opp_amount = 0;
|
||||
$ponderated_opp_amount = 0;
|
||||
|
||||
@ -959,7 +986,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PlannedWorkload"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ProgressDeclared"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -993,7 +1025,22 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
print '</td>';
|
||||
}
|
||||
$projectstatic->statut = $objp->status;
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) print '<td align="right">'.$objp->nb.'</td>';
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
print '<td align="right">'.$objp->nb.'</td>';
|
||||
|
||||
$plannedworkload=$objp->planned_workload;
|
||||
$total_plannedworkload+=$plannedworkload;
|
||||
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
||||
|
||||
$declaredprogressworkload=$objp->declared_progess_workload;
|
||||
$total_declaredprogressworkload+=$declaredprogressworkload;
|
||||
print '<td align="right">';
|
||||
//print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>";
|
||||
print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':'');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1012,7 +1059,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
|
||||
print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmount"), 1).'</td>';
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) print '<td class="liste_total" align="right">'.$total_task.'</td>';
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
print '<td class="liste_total" align="right">'.$total_task.'</td>';
|
||||
print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>';
|
||||
print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>';
|
||||
}
|
||||
print '<td class="liste_total"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -366,7 +366,7 @@ HideAnyVATInformationOnPDF=Hide all information related to VAT on generated PDF
|
||||
HideDescOnPDF=Hide products description on generated PDF
|
||||
HideRefOnPDF=Hide products ref. on generated PDF
|
||||
HideDetailsOnPDF=Hide products lines details on generated PDF
|
||||
PlaceCustomerAddressToIsoLocation=Use ISO location for customer address
|
||||
PlaceCustomerAddressToIsoLocation=Use french standard position (La Posteà for customer address position
|
||||
Library=Library
|
||||
UrlGenerationParameters=Parameters to secure URLs
|
||||
SecurityTokenIsUnique=Use a unique securekey parameter for each URL
|
||||
@ -1116,7 +1116,7 @@ GetBarCode=Get barcode
|
||||
EmptyNumRefModelDesc=The code is free. This code can be modified at any time.
|
||||
##### Module password generation
|
||||
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
|
||||
PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.
|
||||
PasswordGenerationNone=Do not suggest any generated password. Password must be typed in manually.
|
||||
PasswordGenerationPerso=Return a password according to your personally defined configuration.
|
||||
SetupPerso=According to your configuration
|
||||
PasswordPatternDesc=Password pattern description
|
||||
@ -1674,6 +1674,7 @@ InstallModuleFromWebHasBeenDisabledByFile=Install of external module from applic
|
||||
ConfFileMuseContainCustom=Installing an external module from application save the module files into directory <strong>%s</strong>. To have this directory processed by Dolibarr, you must setup your <strong>conf/conf.php</strong> to have option<br>- <strong>$dolibarr_main_url_root_alt</strong> enabled to value <strong>$dolibarr_main_url_root_alt="/custom"</strong><br>- <strong>$dolibarr_main_document_root_alt</strong> enabled to value <strong>"%s/custom"</strong>
|
||||
HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
|
||||
HighlightLinesColor=Color of highlight line when mouse move passes over (keep empty for no highlight)
|
||||
LinkColor=Color of links
|
||||
PressF5AfterChangingThis=Press F5 on keyboard after changing this value to have it effective
|
||||
NotSupportedByAllThemes=Will works with eldy theme but is not supported by all themes
|
||||
BackgroundColor=Background color
|
||||
|
||||
@ -2459,7 +2459,6 @@ input.liste_titre {
|
||||
color: #332266;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
padding: 4px;
|
||||
}
|
||||
form.liste_total div {
|
||||
border-top: 1px solid #DDDDDD;
|
||||
|
||||
@ -707,11 +707,12 @@ img.photoref {
|
||||
box-shadow: 3px 3px 4px #DDD;
|
||||
}
|
||||
.underrefbanner {
|
||||
}
|
||||
.underbanner {
|
||||
border-bottom: 2px solid #888;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
/* Menu top et 1ere ligne tableau */
|
||||
/* ============================================================================== */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user