Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-2039

This commit is contained in:
Victor Saisa Lopez
2015-04-20 11:50:39 -04:00
48 changed files with 2888 additions and 2157 deletions

View File

@@ -414,7 +414,7 @@ class calendar extends CalendarDefinition
$hoursDuration -= (float)($secondRes/3600);
//$dataLog[] = (float)($secondRes/3600);
} else {
$newDate = date('Y-m-d H:i:s', strtotime('+' . (((float)$hoursDuration)*3600) . ' seconds', strtotime($newDate)));
$newDate = date("Y-m-d H:i:s", strtotime("+" . round(((float)($hoursDuration)) * 3600) . " seconds", strtotime($newDate)));
//$dataLog[] = (float)($hoursDuration);
$hoursDuration = 0;
}

View File

@@ -337,6 +337,36 @@ class indicatorsCalculator
return $retval;
}
public function ueiCostHistoric($employeeId, $initDate, $endDate, $periodicity)
{
if (!is_a($initDate, 'DateTime')) throw new InvalidArgumentException ('initDate parameter must be a DateTime object.', 0);
if (!is_a($endDate, 'DateTime')) throw new InvalidArgumentException ('endDate parameter must be a DateTime object.', 0);
$periodicitySelectFields = $this->periodicityFieldsForSelect($periodicity);
$periodicityGroup = $this->periodicityFieldsForGrouping($periodicity);
$initYear = $initDate->format("Y");
$initMonth = $initDate->format("m");
$initDay = $endDay = 1;
$endYear = $endDate->format("Y");
$endMonth = $endDate->format("m");
//$params[":initYear"] = $initYear;
//$params[":initMonth"] = $initMonth;
$params[":endYear"] = $endYear;
$params[":endMonth"] = $endMonth;
$sqlString = "SELECT $periodicitySelectFields " . $this->ueiCostFormula . " as EEC
FROM USR_REPORTING
WHERE
IF(`YEAR` = :endYear, `MONTH`, `YEAR`) <= IF (`YEAR` = :endYear, :endMonth, :endYear)"
. $periodicityGroup;
$retval = $this->pdoExecutor($sqlString, $params);
//$retval = $this->propelExecutor($sqlString);
return $retval;
}
public function generalIndicatorData($indicatorId, $initDate, $endDate, $periodicity) {
if (!is_a($initDate, 'DateTime')) throw new InvalidArgumentException ('initDate parameter must be a DateTime object.', 0);
if (!is_a($endDate, 'DateTime')) throw new InvalidArgumentException ('endDate parameter must be a DateTime object.', 0);
@@ -443,14 +473,16 @@ class indicatorsCalculator
$sqlString = " select
i.TAS_UID as uid,
t.CON_VALUE as name,
i.efficienceIndex,
i.efficiencyIndex,
i.inefficiencyCost,
i.averageTime,
i.deviationTime,
i.configuredTime
FROM
( select
TAS_UID,
$this->peiFormula as efficienceIndex,
$this->peiFormula as efficiencyIndex,
$this->peiCostFormula as inefficiencyCost,
AVG(AVG_TIME) as averageTime,
AVG(SDV_TIME) as deviationTime,
CONFIGURED_TASK_TIME as configuredTime
@@ -468,6 +500,95 @@ class indicatorsCalculator
return $retval;
}
public function statusIndicatorGeneral ($usrUid)
{
$params[':usrUid'] = $usrUid;
$sqlString = "SELECT
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) < 0 ) , 0 ) AS OVERDUE,
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) > 0 ) , 0 ) AS ONTIME,
COALESCE( SUM( DATEDIFF( DEL_RISK_DATE , NOW( ) ) < 0 ) , 0 ) AS ATRISK
FROM LIST_INBOX
WHERE USR_UID = :usrUid
AND APP_STATUS = 'TO_DO'
AND DEL_DUE_DATE IS NOT NULL ";
return $this->pdoExecutor($sqlString, $params);
}
public function statusIndicatorDetail ($usrUid)
{
$params[':usrUid'] = $usrUid;
$sqlString = "SELECT
TAS_UID as tasUid,
PRO_UID as proUid,
APP_TAS_TITLE AS taskTitle,
APP_PRO_TITLE AS proTitle,
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) < 0 ) , 0 ) AS overdue,
COALESCE( SUM( DATEDIFF( DEL_DUE_DATE , NOW( ) ) > 0 ) , 0 ) AS onTime,
COALESCE( SUM( DATEDIFF( DEL_RISK_DATE , NOW( ) ) < 0 ) , 0 ) AS atRisk
FROM LIST_INBOX
WHERE USR_UID = :usrUid
AND APP_STATUS = 'TO_DO'
AND DEL_DUE_DATE IS NOT NULL
GROUP BY TAS_UID";
return $this->pdoExecutor($sqlString, $params);
}
public function statusIndicator($usrUid)
{
$response = array();
$result = $this->statusIndicatorGeneral($usrUid);
$response['overdue'] = 0;
$response['atRisk'] = 0;
$response['onTime'] = 0;
$response['percentageOverdue'] = 0;
$response['percentageAtRisk'] = 0;
$response['percentageOnTime'] = 0;
$response['dataList'] = array();
if (is_array($result) && isset($result[0])) {
$response['overdue'] = $result[0]['OVERDUE'];
$response['atRisk'] = $result[0]['ONTIME'];
$response['onTime'] = $result[0]['ATRISK'];
$total = $response['overdue'] + $response['atRisk'] + $response['onTime'];
if ($total != 0) {
$response['percentageOverdue'] = ($response['overdue']*100)/$total;
$response['percentageAtRisk'] = ($response['atRisk']*100)/$total;
$response['percentageOnTime'] = ($response['onTime']*100)/$total;
}
}
$result = $this->statusIndicatorDetail($usrUid);
foreach ($result as $key => $value) {
$result[$key]['overdue'] = $value['overdue'];
$result[$key]['atRisk'] = $value['atRisk'];
$result[$key]['onTime'] = $value['onTime'];
$result[$key]['percentageOverdue'] = 0;
$result[$key]['percentageAtRisk'] = 0;
$result[$key]['percentageOnTime'] = 0;
$result[$key]['percentageTotalOverdue'] = 0;
$result[$key]['percentageTotalAtRisk'] = 0;
$result[$key]['percentageTotalOnTime'] = 0;
$total = $value['overdue'] + $value['onTime'] + $value['atRisk'];
if ($total != 0) {
$result[$key]['percentageOverdue'] = ($value['overdue']*100)/$total;
$result[$key]['percentageAtRisk'] = ($value['atRisk']*100)/$total;
$result[$key]['percentageOnTime'] = ($value['onTime']*100)/$total;
$result[$key]['percentageTotalOverdue'] = $response['overdue'] != 0 ? ($value['overdue']*100)/$response['overdue']: 0;
$result[$key]['percentageTotalAtRisk'] = $response['atRisk'] != 0 ? ($value['atRisk']*100)/$response['atRisk'] : 0;
$result[$key]['percentageTotalOnTime'] = $response['onTime'] != 0 ? ($value['onTime']*100)/$response['onTime']: 0;
}
}
$response['dataList'] = $result;
return $response;
}
private function periodicityFieldsForSelect($periodicity) {
$periodicityFields = $this->periodicityFieldsString($periodicity);

View File

@@ -27,6 +27,127 @@ class PMLicensedFeatures
{
private $featuresDetails = array ();
private $features = array ();
private $newFeatures = array(
0 => array(
"description" => "Enables de Actions By Email feature.",
"enabled" => false,
"id" => "actionsByEmail",
"latest_version" => "",
"log" => null,
"name" => "actionsByEmail",
"nick" => "actionsByEmail",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010004",
"type" => "features",
"url" => "",
"version" => ""
),
1 => array(
"description" => "Enables de Batch Routing feature.",
"enabled" => false,
"id" => "pmConsolidatedCL",
"latest_version" => "",
"log" => null,
"name" => "pmConsolidatedCL",
"nick" => "pmConsolidatedCL",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010005",
"type" => "features",
"url" => "",
"version" => ""
),
2 => array(
"description" => "Dashboard with improved charting graphics and optimized to show strategic information like Process Efficiency and User Efficiency indicators.",
"enabled" => false,
"id" => "strategicDashboards",
"latest_version" => "",
"log" => null,
"name" => "strategicDashboards",
"nick" => "Strategic Dashboards",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010006",
"type" => "features",
"url" => "",
"version" => ""
),
3 => array(
"description" => "Enables the configuration of a second database connection in order to divide the database requests in read and write operations. This features is used with database clusters to improve the application performance.",
"enabled" => false,
"id" => "secondDatabaseConnection",
"latest_version" => "",
"log" => null,
"name" => "secondDatabaseConnection",
"nick" => "secondDatabaseConnection",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010000",
"type" => "features",
"url" => "",
"version" => ""
),
4 => array(
"description" => "Registers every admin action in a log. The actions in administration settings options are registered in the log.",
"enabled" => false,
"id" => "auditLog",
"latest_version" => "",
"log" => null,
"name" => "auditLog",
"nick" => "auditLog",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010001",
"type" => "features",
"url" => "",
"version" => ""
),
5 => array(
"description" => "A more secure option to store user passwords in ProcessMaker. The modern algorithm SHA-2 is used to store the passwords.",
"enabled" => false,
"id" => "secureUserPasswordHash",
"latest_version" => "",
"log" => null,
"name" => "secureUserPasswordHash",
"nick" => "secureUserPasswordHash",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010002",
"type" => "features",
"url" => "",
"version" => ""
),
6 => array(
"description" => "This functionality enables the flexibility to send mails from different email servers or configurations.",
"enabled" => false,
"id" => "sendEmailFromDifferentEmailServers",
"latest_version" => "",
"log" => null,
"name" => "sendEmailFromDifferentEmailServers",
"nick" => "sendEmailFromDifferentEmailServers",
"progress" => 0,
"publisher" => "Colosa",
"release_type" => "localRegistry",
"status" => "ready",
"store" => "00000000000000000000000000010003",
"type" => "features",
"url" => "",
"version" => ""
)
);
private static $instancefeature = null;
@@ -87,6 +208,132 @@ class PMLicensedFeatures
$this->featuresDetails[$value[0]]->enabled = $enable;
return $enable;
}
public function addNewFeatures ($data)
{
$newFeaturesList = $this->newFeatures;
$newData = array();
$newFeaturesIds = array();
foreach($newFeaturesList as $val) {
$newFeaturesIds[] = $val['id'];
}
$criteria = new Criteria();
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_ID);
$criteria->add(AddonsManagerPeer::ADDON_ID, $newFeaturesIds, Criteria::IN);
$criteria->add(AddonsManagerPeer::ADDON_TYPE, 'features');
$rs = AddonsManagerPeer::doSelectRS($criteria);
$rs->next();
$row = $rs->getRow();
if(sizeof($row)) {
while (is_array($row)) {
$ids[] = $row[0];
$rs->next();
$row = $rs->getRow();
}
$toUpdate = array_diff($newFeaturesIds,$ids);
if(sizeof($toUpdate)){
$newFeaturesListAux = array();
foreach($toUpdate as $index => $v) {
$newFeaturesListAux[] = $newFeaturesList[$index];
}
unset($newFeaturesList);
$newFeaturesList = array_values($newFeaturesListAux);
} else {
return $data;
}
}
foreach($newFeaturesList as $k => $newFeature){
$newData[] = array (
'db' => 'wf',
'table' => 'ADDONS_MANAGER',
'keys' =>
array (
0 => 'ADDON_ID',
),
'data' =>
array (
0 =>
array (
'field' => 'ADDON_DESCRIPTION',
'type' => 'text',
'value' => $newFeature['description'],
),
1 =>
array (
'field' => 'ADDON_ID',
'type' => 'text',
'value' => $newFeature['id'],
),
2 =>
array (
'field' => 'ADDON_NAME',
'type' => 'text',
'value' => $newFeature['name'],
),
3 =>
array (
'field' => 'ADDON_NICK',
'type' => 'text',
'value' => $newFeature['nick'],
),
4 =>
array (
'field' => 'ADDON_PUBLISHER',
'type' => 'text',
'value' => $newFeature['publisher'],
),
5 =>
array (
'field' => 'ADDON_RELEASE_TYPE',
'type' => 'text',
'value' => $newFeature['release_type'],
),
6 =>
array (
'field' => 'ADDON_STATUS',
'type' => 'text',
'value' => $newFeature['status'],
),
7 =>
array (
'field' => 'STORE_ID',
'type' => 'text',
'value' => $newFeature['store'],
),
8 =>
array (
'field' => 'ADDON_TYPE',
'type' => 'text',
'value' => $newFeature['type'],
),
9 =>
array (
'field' => 'ADDON_DOWNLOAD_URL',
'type' => 'text',
'value' => $newFeature['url'],
),
10 =>
array (
'field' => 'ADDON_VERSION',
'type' => 'text',
'value' => $newFeature['version'],
),
11 =>
array (
'field' => 'ADDON_DOWNLOAD_PROGRESS',
'type' => 'text',
'value' => $newFeature['progress'],
)
),
'action' => 1,
);
$i++;
}
return array_merge($data, $newData);
}
/*----------------------------------********---------------------------------*/
}

View File

@@ -3,7 +3,7 @@
/**
* class.pmDynaform.php
* Implementing pmDynaform library in the running case.
*
*
* @author Roly Rudy Gutierrez Pinto
* @package engine.classes
*/
@@ -80,19 +80,37 @@ class pmDynaform
public function jsonr(&$json)
{
foreach ($json as $key => $value) {
foreach ($json as $key => &$value) {
$sw1 = is_array($value);
$sw2 = is_object($value);
if ($sw1 || $sw2) {
$this->jsonr($value);
}
if (!$sw1 && !$sw2) {
//property
//set properties from trigger
$prefixs = array("@@", "@#", "@%", "@?", "@$", "@=");
if (is_string($value) && in_array(substr($value, 0, 2), $prefixs)) {
$triggerValue = substr($value, 2);
if (isset($this->fields["APP_DATA"][$triggerValue])) {
$json->$key = $this->fields["APP_DATA"][$triggerValue];
$json->{$key} = $this->fields["APP_DATA"][$triggerValue];
}
}
//set properties from 'formInstance' variable
if (isset($this->fields["APP_DATA"]["formInstance"])) {
$formInstance = $this->fields["APP_DATA"]["formInstance"];
if (!is_array($formInstance)) {
$formInstance = array($formInstance);
}
$nfi = count($formInstance);
for ($ifi = 0; $ifi < $nfi; $ifi++) {
$fi = $formInstance[$ifi];
if (is_object($fi) && isset($fi->id) && $key === "id" && $json->{$key} === $fi->id) {
foreach ($fi as $keyfi => $valuefi) {
if (isset($json->{$keyfi})) {
$json->{$keyfi} = $valuefi;
}
}
}
}
}
//query & options
@@ -136,11 +154,17 @@ class pmDynaform
array_push($json->options, $option);
}
} catch (Exception $e) {
}
}
if (isset($json->options[0])) {
$json->data = $json->options[0];
$no = count($json->options);
for ($io = 0; $io < $no; $io++) {
if ($json->options[$io]["value"] === $json->defaultValue) {
$json->data = $json->options[$io];
}
}
}
}
//data
@@ -187,7 +211,7 @@ class pmDynaform
if ($column->type === "text" || $column->type === "textarea" || $column->type === "dropdown" || $column->type === "datetime" || $column->type === "checkbox" || $column->type === "file" || $column->type === "link") {
array_push($cells, array(
"value" => isset($row[$column->name]) ? $row[$column->name] : "",
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : ""
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : (isset($row[$column->name]) ? $row[$column->name] : "")
));
}
if ($column->type === "suggest") {
@@ -208,11 +232,15 @@ class pmDynaform
$this->lang = $json->language;
}
if ($this->langs !== null) {
if (($key === "label" || $key === "hint" || $key === "placeholder" || $key === "validateMessage" || $key === "alternateText" || $key === "comment" || $key === "alt") && isset($json->{$key}) && isset($this->langs->{$this->lang})) {
if (($key === "label" || $key === "title" || $key === "hint" || $key === "placeholder" || $key === "validateMessage" || $key === "alternateText" || $key === "comment" || $key === "alt") && isset($this->langs->{$this->lang})) {
$langs = $this->langs->{$this->lang}->Labels;
foreach ($langs as $langsValue) {
if ($json->{$key} === $langsValue->msgid)
if (is_object($json) && $json->{$key} === $langsValue->msgid) {
$json->{$key} = $langsValue->msgstr;
}
if (is_array($json) && $json[$key] === $langsValue->msgid) {
$json[$key] = $langsValue->msgstr;
}
}
}
}
@@ -225,6 +253,72 @@ class pmDynaform
return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false;
}
public function printViewWithoutSubmit()
{
ob_clean();
$json = G::json_decode($this->record["DYN_CONTENT"]);
foreach ($json->items[0]->items as $key => $value) {
switch ($json->items[0]->items[$key][0]->type) {
case "submit":
unset($json->items[0]->items[$key]);
break;
}
}
$this->jsonr($json);
$javascript = "
<script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . ";
var pm_run_outside_main_app = \"\";
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\";
var app_uid = \"" . $this->fields["APP_UID"] . "\";
var prj_uid = \"" . $this->fields["PRO_UID"] . "\";
var step_mode = \"\";
var workspace = \"" . SYS_SYS . "\";
var credentials = " . G::json_encode($this->credentials) . ";
var filePost = \"\";
var fieldsRequired = null;
var triggerDebug = false;
$(window).load(function ()
{
var data = jsondata;
data.items[0].mode = \"disabled\";
window.project = new PMDynaform.core.Project({
data: data,
keys: {
server: location.host,
projectId: prj_uid,
workspace: workspace
},
token: credentials,
submitRest: false
});
$(document).find(\"form\").submit(function (e) {
e.preventDefault();
return false;
});
});
</script>
<div style=\"margin: 10px 20px 10px 0;\">
<div style=\"float: right\"><a href=\"javascript: window.history.go(-1);\" style=\"text-decoration: none;\">&lt; " . G::LoadTranslation("ID_BACK") . "</a></div>
<div style=\"clear: both\"></div>
</div>
";
$file = file_get_contents(PATH_HOME . "public_html" . PATH_SEP . "lib" . PATH_SEP . "pmdynaform" . PATH_SEP . "build" . PATH_SEP . "pmdynaform.html");
$file = str_replace("{javascript}", $javascript, $file);
echo $file;
exit(0);
}
public function printView()
{
ob_clean();
@@ -409,6 +503,8 @@ class pmDynaform
$json->name = $newVariable["VAR_NAME"];
if (isset($json->dbConnection) && $json->dbConnection === $oldVariable["VAR_DBCONNECTION"])
$json->dbConnection = $newVariable["VAR_DBCONNECTION"];
if (isset($json->dbConnectionLabel) && $json->dbConnectionLabel === $oldVariable["VAR_DBCONNECTION_LABEL"])
$json->dbConnectionLabel = $newVariable["VAR_DBCONNECTION_LABEL"];
if (isset($json->sql) && $json->sql === $oldVariable["VAR_SQL"])
$json->sql = $newVariable["VAR_SQL"];
if (isset($json->options) && G::json_encode($json->options) === $oldVariable["VAR_ACCEPTED_VALUES"]) {

View File

@@ -1588,8 +1588,9 @@ class processMap
$numRows = DynaformPeer::doCount($oCriteria);
if ($numRows == 0) {
echo "<div style=\"margin:1em;\"><strong>".G::LoadTranslation('ID_ALERT')."</strong><br />".G::LoadTranslation('ID_CONSOLIDATED_DYNAFORM_REQUIRED')."</div>";
die;
$aFields['TITLE_ALERT'] = G::LoadTranslation('ID_ALERT');
$aFields['SUBTITLE_MESSAGE'] = G::LoadTranslation('ID_CONSOLIDATED_DYNAFORM_REQUIRED');
$sFilename = 'tasks/tasks_Consolidated_Error.xml';
}
}

View File

@@ -919,6 +919,10 @@ class workspaceTools
if (file_exists(PATH_CORE . 'data' . PATH_SEP . 'check.data')) {
$checkData = unserialize(file_get_contents(PATH_CORE . 'data' . PATH_SEP . 'check.data'));
if (is_array($checkData)) {
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
$checkData = $licensedFeatures->addNewFeatures($checkData);
/*----------------------------------********---------------------------------*/
foreach ($checkData as $checkThis) {
$this->updateThisRegistry($checkThis);
}

View File

@@ -356,17 +356,18 @@ class AppDelegation extends BaseAppDelegation
$aCalendarUID = '';
}
//use the dates class to calculate dates
//Calendar - Use the dates class to calculate dates
$calendar = new calendar();
$arrayCalendarData = array();
if ($calendar->pmCalendarUid == "") {
$calendar->getCalendar(null, $task->getProUid(), $this->getTasUid());
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$arrayCalendarData = $calendar->getCalendarData();
}
//Due date
/*$iDueDate = $calendar->calculateDate( $this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'] //hours or days, ( we only accept this two types or maybe weeks
);*/
$dueDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData);
@@ -378,10 +379,22 @@ class AppDelegation extends BaseAppDelegation
public function calculateRiskDate($dueDate, $risk)
{
try {
$numDueDate = strtotime($dueDate); //Seconds
$numDueDate = $numDueDate - ($numDueDate * $risk);
$riskTime = strtotime($dueDate) - strtotime($this->getDelDelegateDate()); //Seconds
$riskTime = $riskTime - ($riskTime * $risk);
$riskDate = date("Y-m-d H:i:s", round($numDueDate));
//Calendar - Use the dates class to calculate dates
$calendar = new calendar();
$arrayCalendarData = array();
if ($calendar->pmCalendarUid == "") {
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$arrayCalendarData = $calendar->getCalendarData();
}
//Risk date
$riskDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), round($riskTime / (60 * 60)), "HOURS", $arrayCalendarData);
//Return
return $riskDate;

View File

@@ -70,6 +70,28 @@ class DashboardIndicator extends BaseDashboardIndicator
$oldValue = current(reset($calculator->ueiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
$row['DAS_IND_VARIATION'] = $value - $oldValue;
break;
case '1050':
$value = $calculator->statusIndicatorGeneral($userUid);
$row['OVERDUE'] = 0;
$row['ON_TIME'] = 0;
$row['AT_RISK'] = 0;
$row['PERCENTAGE_OVERDUE'] = 0;
$row['PERCENTAGE_AT_RISK'] = 0;
$row['PERCENTAGE_ON_TIME'] = 0;
if (is_array($value) && isset($value[0])) {
$row['OVERDUE'] = $value[0]['OVERDUE'];
$row['ON_TIME'] = $value[0]['ONTIME'];
$row['AT_RISK'] = $value[0]['ATRISK'];
$total = $row['OVERDUE'] + $row['AT_RISK'] + $row['ON_TIME'];
if ($total != 0) {
$row['PERCENTAGE_OVERDUE'] = ($row['OVERDUE']*100)/$total;
$row['PERCENTAGE_AT_RISK'] = ($row['AT_RISK']*100)/$total;
$row['PERCENTAGE_ON_TIME'] = ($row['ON_TIME']*100)/$total;
}
}
break;
default:
$arrResult = $calculator->generalIndicatorData($row['DAS_IND_UID'], $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
$value = $arrResult[0]['value'];