Merged in dashboards2 (pull request #2060)

Dashboard/KPIs stable version
This commit is contained in:
Julio Cesar Laura Avendaño
2015-04-30 17:32:58 -04:00
11 changed files with 34 additions and 19 deletions

View File

@@ -70,9 +70,9 @@ abstract class IndicatorDataSourcesEnum extends BasicEnum {
class indicatorsCalculator
{
private $userReportingMetadata = array("tableName" => "USR_REPORTING", "keyField" => "USR_UID");
private $userReportingMetadata = array("tableName" => "USR_REPORTING", "keyField" => "PRO_UID");
private $processReportingMetadata = array("tableName" => "PRO_REPORTING", "keyField" => "PRO_UID");
private $userGroupReportingMetadata = array("tableName" => "USR_REPORTING", "keyField" => "USR_UID");
private $userGroupReportingMetadata = array("tableName" => "USR_REPORTING", "keyField" => "PRO_UID");
private $processCategoryReportingMetadata = array("tableName" => "PRO_REPORTING", "keyField" => "PRO_UID");
private $peiCostFormula = "SUM(TOTAL_CASES_OUT * CONFIGURED_TASK_TIME - TOTAL_TIME_BY_TASK * USER_HOUR_COST)";
@@ -750,6 +750,7 @@ class indicatorsCalculator
}
/* For debug only:
* public function interpolateQuery($query, $params) {
$keys = array();

View File

@@ -523,10 +523,7 @@ class AppDelegation extends BaseAppDelegation
//getting the calendar
$calendar->getCalendar($row['USR_UID'], $row['PRO_UID'], $row['TAS_UID']);
$calData = $calendar->getCalendarData();
//Recalculating DueDate with the user calendar if it exist. It allways will take the derivation date like initial date.
$iDueDate = $calendar->dashCalculateDate($row['DEL_DELEGATE_DATE'], $fTaskDuration, $fTaskDurationUnit, $calData);
//if the task is not started
if ($isStarted == 0) {
if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') {
@@ -562,7 +559,6 @@ class AppDelegation extends BaseAppDelegation
//$delDuration = $this->getDiffDate( $iFinishDate, $iInitDate );
$delDuration = $calendar->dashCalculateDurationWithCalendar($row['DEL_INIT_DATE'], $row['DEL_FINISH_DATE'], $calData );//by jen
$delDuration = $delDuration / (24 * 60 * 60); //Saving the delDuration in days. The calculateDurationSLA func returns mins.
$oAppDel->setDelDuration( $delDuration );
//calculate due date if correspond
$dueDate = strtotime($iDueDate);
@@ -592,8 +588,12 @@ class AppDelegation extends BaseAppDelegation
//we are putting negative number if the task is not delayed, and positive number for the time the task is delayed
//$delayDuration = $this->getDiffDate( $now, $iDueDate );
$delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData );
$delayDuration = $delayDuration / (24 * 60 * 60); //Days
$delayDuration = 0;
if($now > $iDueDate){
$delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData );
$delayDuration = $delayDuration / (24 * 60 * 60);
}
//Days
$oAppDel->setDelDelayDuration( $delayDuration );
if ($fTaskDuration != 0) {
$overduePercentage = $delayDuration / $fTaskDuration;

View File

@@ -52,6 +52,7 @@ class DashboardIndicator extends BaseDashboardIndicator
$rs = DashboardIndicatorPeer::doSelectRS( $criteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$dashboardIndicator = array();
while ($rs->next()) {
$row = $rs->getRow();

View File

@@ -210,6 +210,13 @@ class StrategicDashboard extends Controller
$translation['ID_OVERDUE'] = G::LoadTranslation( 'ID_OVERDUE');
$translation['ID_AT_RISK'] = G::LoadTranslation( 'ID_AT_RISK');
$translation['ID_ON_TIME'] = G::LoadTranslation( 'ID_ON_TIME');
$translation['ID_NO_INEFFICIENT_PROCESSES'] = G::LoadTranslation('ID_NO_INEFFICIENT_PROCESSES');
$translation['ID_NO_INEFFICIENT_TASKS'] = G::LoadTranslation('ID_NO_INEFFICIENT_TASKS');
$translation['ID_NO_INEFFICIENT_USER_GROUPS'] = G::LoadTranslation('ID_NO_INEFFICIENT_USER_GROUPS');
$translation['ID_NO_INEFFICIENT_USERS'] = G::LoadTranslation('ID_NO_INEFFICIENT_USERS');
$translation['ID_DISPLAY_EMPTY'] = G::LoadTranslation('ID_DISPLAY_EMPTY');
$translation['ID_EMPTY'] = G::LoadTranslation('ID_EMPTY');
$translation['ID_INBOX'] = G::LoadTranslation('ID_INBOX');
$this->setVar('translation', $translation);
$this->render();
@@ -254,6 +261,14 @@ class StrategicDashboard extends Controller
$translation['ID_OVERDUE'] = G::LoadTranslation( 'ID_OVERDUE');
$translation['ID_AT_RISK'] = G::LoadTranslation( 'ID_AT_RISK');
$translation['ID_ON_TIME'] = G::LoadTranslation( 'ID_ON_TIME');
$translation['ID_NO_INEFFICIENT_PROCESSES'] = G::LoadTranslation('ID_NO_INEFFICIENT_PROCESSES');
$translation['ID_NO_INEFFICIENT_TASKS'] = G::LoadTranslation('ID_NO_INEFFICIENT_TASKS');
$translation['ID_NO_INEFFICIENT_USER_GROUPS'] = G::LoadTranslation('ID_NO_INEFFICIENT_USER_GROUPS');
$translation['ID_NO_INEFFICIENT_USERS'] = G::LoadTranslation('ID_NO_INEFFICIENT_USERS');
$translation['ID_DISPLAY_EMPTY'] = G::LoadTranslation('ID_DISPLAY_EMPTY');
$translation['ID_EMPTY'] = G::LoadTranslation('ID_EMPTY');
$translation['ID_INBOX'] = G::LoadTranslation('ID_INBOX');
$this->setVar('translation', $translation);
$this->render();

View File

@@ -6,7 +6,6 @@ var ViewDashboardHelper = function () {
ViewDashboardHelper.prototype.userDashboards = function(userId, callBack) {
};
//TODO refactor to a good name...
ViewDashboardHelper.prototype.stringIfNull = function (val){
if(val === null || val == undefined || val == "?"){
val = "?";

View File

@@ -269,7 +269,6 @@ ViewDashboardPresenter.prototype.statusViewModel = function(indicatorId, data) {
});
var retval = data;
//TODO selecte de 7 worst cases no the first 7
retval.graph1Data = this.orderGraphData(graph1Data, "down").splice(0,7)
retval.graph2Data = this.orderGraphData(graph2Data, "down").splice(0,7)
retval.graph3Data = this.orderGraphData(graph3Data, "down").splice(0,7)

View File

@@ -464,9 +464,9 @@ var loadIndicator = function (indicatorId, initDate, endDate) {
fillGeneralIndicatorFirstView(viewModel);
break;
}
hideScrollIfAllDivsAreVisible();
hideTitleAndSortDiv();
});
hideScrollIfAllDivsAreVisible();
hideTitleAndSortDiv();
}
var setIndicatorActiveMarker = function () {

View File

@@ -24,8 +24,8 @@ SELECT
APPLICATION.PRO_UID,
DATE_FORMAT(APPLICATION.APP_INIT_DATE, '%m') AS `MONTH`,
DATE_FORMAT(APPLICATION.APP_INIT_DATE, '%Y') AS `YEAR`,
AVG(APPLICATION.APP_DURATION) AS `AVG_TIME`,
STD(APPLICATION.APP_DURATION) AS `STD_TIME`,
AVG(APPLICATION.APP_DURATION*24) AS `AVG_TIME`,
STD(APPLICATION.APP_DURATION*24) AS `STD_TIME`,
COUNT(APPLICATION.APP_INIT_DATE) AS `TOTAL_CASES_IN`,
COUNT(APPLICATION.APP_FINISH_DATE) AS `TOTAL_CASES_OUT`,
NULL,

View File

@@ -29,12 +29,12 @@ SELECT
ACV.PRO_UID,
DATE_FORMAT(ACV.DEL_INIT_DATE, '%m') AS `MONTH`,
DATE_FORMAT(ACV.DEL_INIT_DATE, '%Y') AS `YEAR`,
SUM(ACV.DEL_DURATION) AS TOT_TIME_BY_TASK,
SUM(ACV.DEL_DURATION*24) AS TOT_TIME_BY_TASK,
COUNT(ACV.DEL_INIT_DATE) AS TOT_CASES_IN,
COUNT(ACV.DEL_FINISH_DATE) AS TOT_CASES_OUT,
NULL,
AVG(DEL_DURATION) AS `AVG_TIME`,
STD(DEL_DURATION) AS `STD_TIME`,
AVG(DEL_DURATION*24) AS `AVG_TIME`,
STD(DEL_DURATION*24) AS `STD_TIME`,
NULL,
count(if(ACV.DEL_DELAY_DURATION > 0, 1, NULL)) AS TOTAL_CASES_OVERDUE,
count(if(ACV.DEL_DELAY_DURATION <= 0, 1, NULL)) AS TOTAL_CASES_ON_TIME

View File

@@ -3,7 +3,6 @@ namespace ProcessMaker\BusinessModel;
use \G;
class ReportingIndicators
{
// /**et

View File

@@ -133,6 +133,7 @@ class ReportingIndicators extends Api
*
* @url GET /group-employee-data
*/
public function doGetGroupEmployeesData($group_uid, $init_date, $end_date, $language)
{
try {