예제 #1
0
     if ($status != $element) {
         continue;
     }
     $key = preg_replace('/(\\-|\\/)/', '_', strtolower($element));
     $outputData[DEFAULT_ORG]['activity_status'][$key]['count'] += 1;
     $outputData[$reportingOrgName]['activity_status'][$key]['count'] += 1;
 }
 // Transactions
 $transElements = array('total_commitments', 'total_disbursements', 'total_expenditure', 'total_incoming_funds', 'total_reimbursements');
 foreach ($transElements as $transElement) {
     $currency = $out['default_currency_for_amounts'];
     $rate = 1;
     if ($out[$transElement] && $currency && $currency != DEFAULT_CURRENCY) {
         if ($out['start_actual_iso_date'] && strtotime($out['start_actual_iso_date']) <= strtotime(date('Y-m-d'))) {
             $valueDate = date('Y-m-d', strtotime($out['start_actual_iso_date']));
             $rate = $exchange->getExchangeRateFor($valueDate, DEFAULT_CURRENCY, $currency);
         } else {
             $valueDate = date('Y-m-d');
             $rate = $exchange->getExchangeRateFor($valueDate, DEFAULT_CURRENCY, $currency);
         }
     }
     $transValue = $out[$transElement] * $rate;
     $outputData[DEFAULT_ORG]['transaction'][$transElement]['value'] += $transValue;
     $outputData[$reportingOrgName]['transaction'][$transElement]['value'] += $transValue;
 }
 // Sectors
 $sectorData = $out['sector_codes'];
 if ($sectorData) {
     $sectors = explode(';', $sectorData);
     foreach ($sectors as $sectorCode) {
         $sectorCode = trim($sectorCode);