← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16537: tracker capture - more reorganization/modularization of controllers

 

------------------------------------------------------------
revno: 16537
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-08-27 13:18:35 +0200
message:
  tracker capture - more reorganization/modularization of controllers
removed:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html
added:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/column-display-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/header-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/leftbar-menu-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/report-types-controller.js
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js	2014-08-26 16:39:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js	1970-01-01 00:00:00 +0000
@@ -1,389 +0,0 @@
-trackerCapture.controller('ReportController',
-        function($scope,
-                $modal,
-                DateUtils,
-                EventUtils,
-                TEIService,
-                TEIGridService,
-                TranslationService,
-                AttributesFactory,
-                ProgramFactory,
-                DHIS2EventFactory,
-                storage) {
-
-    TranslationService.translate();
-    
-    $scope.today = DateUtils.format(moment());
-    
-    $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
-    $scope.selectedOuMode = $scope.ouModes[0];
-    $scope.report = {};
-    
-    //watch for selection of org unit from tree
-    $scope.$watch('selectedOrgUnit', function() {        
-        if( angular.isObject($scope.selectedOrgUnit)){            
-            storage.set('SELECTED_OU', $scope.selectedOrgUnit);            
-            $scope.loadPrograms($scope.selectedOrgUnit);
-        }
-    });
-    
-    //load programs associated with the selected org unit.
-    $scope.loadPrograms = function(orgUnit) {                
-        
-        $scope.selectedOrgUnit = orgUnit;
-        
-        if (angular.isObject($scope.selectedOrgUnit)) {   
-
-            ProgramFactory.getAll().then(function(programs){
-                $scope.programs = [];
-                angular.forEach(programs, function(program){                            
-                    if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id)){                                
-                        $scope.programs.push(program);
-                    }
-                });
-
-                if($scope.programs.length === 0){
-                    $scope.selectedProgram = null;
-                }
-                else{
-                    if($scope.selectedProgram){
-                        angular.forEach($scope.programs, function(program){                            
-                            if(program.id === $scope.selectedProgram.id){                                
-                                $scope.selectedProgram = program;
-                            }
-                        });
-                    }
-                    else{                        
-                        if($scope.programs.length === 1){
-                            $scope.selectedProgram = $scope.programs[0];
-                        }                        
-                    }
-                } 
-            });
-        }        
-    };
-    
-    //watch for selection of org unit from tree
-    $scope.$watch('selectedProgram', function() {        
-        if( angular.isObject($scope.selectedProgram)){            
-            $scope.dataReady = false;
-        }
-    });
-    
-    $scope.generateReport = function(){
-        
-        $scope.dataReady = false;
-        
-        //check for form validity
-        $scope.outerForm.submitted = true;        
-        if( $scope.outerForm.$invalid || !$scope.selectedProgram){
-            return false;
-        }
-        
-        $scope.programStages = [];
-        angular.forEach($scope.selectedProgram.programStages, function(stage){
-            $scope.programStages[stage.id] = stage;
-        });
-            
-        AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
-            $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);      
-        });  
-        
-        //fetch TEIs for the selected program and orgunit/mode
-        TEIService.search($scope.selectedOrgUnit.id, 
-                            $scope.selectedOuMode.name,
-                            null,
-                            'program=' + $scope.selectedProgram.id,
-                            null,
-                            $scope.pager,
-                            false).then(function(data){
-            if(data.rows){
-                $scope.teiCount = data.rows.length;
-                $scope.dataReady = true;
-            }
-            
-            
-            //process tei grid
-            $scope.teiList = TEIGridService.format(data);          
-            
-            DHIS2EventFactory.getByOrgUnitAndProgram($scope.selectedOrgUnit.id, $scope.selectedOuMode.name, $scope.selectedProgram.id).then(function(eventList){
-                $scope.dhis2Events = [];
-                angular.forEach(eventList, function(ev){
-                    if(ev.trackedEntityInstance){
-                        ev.name = $scope.programStages[ev.programStage].name;
-                        ev.programName = $scope.selectedProgram.name;
-                        ev.statusColor = EventUtils.getEventStatusColor(ev); 
-                        ev.eventDate = DateUtils.format(ev.eventDate);
-                        
-                        if($scope.dhis2Events[ev.trackedEntityInstance]){
-                            $scope.dhis2Events[ev.trackedEntityInstance].push(ev);
-                        }
-                        else{
-                            $scope.dhis2Events[ev.trackedEntityInstance] = [ev];
-                        }
-                        ev = EventUtils.setEventOrgUnitName(ev);
-                    }
-                });
-                
-            });
-        });
-    };
-    
-    $scope.showEventDetails = function(dhis2Event, selectedTei){
-        
-        var modalInstance = $modal.open({
-            templateUrl: 'components/report/event-details.html',
-            controller: 'EventDetailsController',
-            resolve: {
-                dhis2Event: function () {
-                    return dhis2Event;
-                },
-                gridColumns: function(){
-                    return $scope.gridColumns;
-                },
-                selectedTei: function(){
-                    return selectedTei;
-                },
-                entityName: function(){
-                    return $scope.selectedProgram.trackedEntity.name;
-                },
-                reportMode: function(){
-                    return 'PROGRAM';
-                }
-            }
-        });
-
-        modalInstance.result.then({
-        });
-    };   
-    
-})
-
-//Controller for event details
-.controller('EventDetailsController', 
-    function($scope, 
-            $modalInstance,
-            orderByFilter,
-            ProgramStageFactory,
-            dhis2Event,
-            selectedTei,
-            gridColumns,
-            entityName,
-            reportMode){
-    
-    $scope.selectedTei = selectedTei;
-    $scope.gridColumns = gridColumns;
-    $scope.entityName = entityName;
-    $scope.reportMode = reportMode;
-    $scope.currentEvent = dhis2Event;
-    $scope.currentEvent.providedElsewhere = [];
-    
-    if(!angular.isUndefined( $scope.currentEvent.notes)){
-        $scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate');            
-        angular.forEach($scope.currentEvent.notes, function(note){
-            note.storedDate = moment(note.storedDate).format('YYYY-MM-DD @ hh:mm A');
-        });
-    }
-    
-    ProgramStageFactory.get($scope.currentEvent.programStage).then(function(stage){
-        $scope.currentStage = stage;
-
-        $scope.allowProvidedElsewhereExists = false;
-        angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
-            $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
-            if(prStDe.allowProvidedElsewhere){
-                $scope.allowProvidedElsewhereExists = true;
-                $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = '';   
-            }                
-        });
-        angular.forEach($scope.currentEvent.dataValues, function(dataValue){
-            var val = dataValue.value;
-            if(val){
-                var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
-                if( de && de.type === 'int' && val){
-                    val = parseInt(val);
-                    dataValue.value = val;
-                }
-                $scope.currentEvent[dataValue.dataElement] = val;
-            }                    
-        });
-    });
-    
-    $scope.close = function () {
-        $modalInstance.close();
-    };
-})
-
-
-//conroller for tei report
-.controller('TeiReportController',
-        function($scope,
-                $filter,
-                CurrentSelection,
-                storage,
-                DateUtils,
-                EventUtils,
-                TEIService,
-                TranslationService,
-                ProgramFactory,
-                ProgramStageFactory,
-                EnrollmentService,
-                DHIS2EventFactory) {
-
-    TranslationService.translate();    
-    $scope.showProgramReportDetailsDiv = false;
-    $scope.programs = [];  
-    $scope.programNames = [];  
-    $scope.programStageNames = [];
-    ProgramFactory.getAll().then(function(programs){     
-        $scope.programs = programs;
-        angular.forEach($scope.programs, function(pr){
-            delete pr.organisationUnits;
-            $scope.programNames[pr.id] = {id: pr.id, name: pr.name};
-            angular.forEach(pr.programStages, function(stage){                
-                $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name};
-            });
-        });
-    });
-        
-    $scope.$on('dashboardWidgets', function(event, args) {
-        $scope.showProgramReportDetailsDiv = false;
-        var selections = CurrentSelection.get();
-        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
-        $scope.selectedTei = selections.tei;  
-        $scope.selectedEntity = selections.te;
-        $scope.selectedProgram = selections.pr;        
-        $scope.selectedEnrollment = selections.enrollment; 
-    
-        if($scope.selectedTei){            
-            $scope.getEvents();
-        }       
-    });
-    
-    $scope.getEvents = function(){
-        
-        $scope.dataFetched = false;
-        $scope.dataExists = false;
-        var programId = null, orgUnitId = null;
-        
-        if($scope.selectedProgram){
-            programId = $scope.selectedProgram.id;
-        }
-        
-        $scope.report = [];
-        angular.forEach($scope.programs, function(pr){
-            $scope.report[pr.id] = {};
-        });
-        
-        DHIS2EventFactory.getEventsByProgram($scope.selectedTei.trackedEntityInstance, orgUnitId, programId).then(function(eventList){
-            angular.forEach(eventList, function(ev){
-                if(ev.program){       
-                    ev.visited = true;
-                    ev.dueDate = DateUtils.format(ev.dueDate);  
-                    ev.sortingDate = ev.dueDate;
-                    ev.name = $scope.programStageNames[ev.programStage].name;
-                    ev.programName = $scope.programNames[ev.program].name;
-                    if(angular.isUndefined($scope.report[ev.program].enrollments)){
-                        $scope.report[ev.program] = {enrollments: {}};
-                    }
-                    ev.statusColor = EventUtils.getEventStatusColor(ev); 
-                    
-                    if(ev.eventDate){
-                        ev.eventDate = DateUtils.format(ev.eventDate);
-                        ev.sortingDate = ev.eventDate;
-                    }
-                    else{
-                        ev.visited = false;
-                    }                 
-
-                    if(ev.enrollment){
-                        if($scope.report[ev.program].enrollments[ev.enrollment]){
-                            $scope.report[ev.program].enrollments[ev.enrollment].push(ev);
-                        }
-                        else{
-                            $scope.report[ev.program].enrollments[ev.enrollment]= [ev];
-                        }
-                    }
-                    ev = EventUtils.setEventOrgUnitName(ev);
-                }                
-            });
-
-            if(eventList){
-                $scope.dataExists = true;
-            }
-            $scope.dataFetched = true;
-        });
-    };
-    
-    $scope.showProgramReportDetails = function(pr){
-        
-        $scope.showProgramReportDetailsDiv = !$scope.showProgramReportDetailsDiv;
-        $scope.selectedProgram = pr;
-        $scope.selectedReport = $scope.report[pr.id];
-        
-        //today as report date
-        $scope.today = moment();
-        $scope.today = Date.parse($scope.today);
-        $scope.today = $filter('date')($scope.today, 'yyyy-MM-dd');
-
-        //process tei attributes, this is to have consistent display so that the tei 
-        //contains program attributes whether it has value or not
-        TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, null).then(function(tei){
-            $scope.tei = tei;  
-        });
-        
-        //get program stage for the selected program
-        //they are needed assign data element names for event data values
-        $scope.programStages = [];  
-        $scope.allowProvidedElsewhereExists = [];
-        angular.forEach($scope.selectedProgram.programStages, function(st){
-            ProgramStageFactory.get(st.id).then(function(stage){
-                $scope.programStages[stage.id] = stage;
-                var providedElsewhereExists = false;
-                for(var i=0; i<stage.programStageDataElements.length && !providedElsewhereExists; i++){                
-                    if(stage.programStageDataElements[i].allowProvidedElsewhere){
-                        providedElsewhereExists = true;
-                        $scope.allowProvidedElsewhereExists[st.id] = true;
-                    }                
-                }            
-            });
-        });
-        
-        //program reports come grouped in enrollment, process for each enrollment
-        $scope.enrollments = [];        
-        angular.forEach(Object.keys($scope.selectedReport.enrollments), function(enr){        
-            //format report data values
-            angular.forEach($scope.selectedReport.enrollments[enr], function(ev){
-                angular.forEach(ev.notes, function(note){
-                    note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
-                }); 
-
-                if(ev.dataValues){
-                    angular.forEach(ev.dataValues, function(dv){
-                        if(dv.dataElement){
-                            ev[dv.dataElement] = dv;
-                        }                    
-                    });
-                }
-            });
-
-            //get enrollment details
-            EnrollmentService.get(enr).then(function(enrollment){
-                enrollment.dateOfEnrollment = DateUtils.format(enrollment.dateOfEnrollment);
-                enrollment.dateOfIncident = DateUtils.format(enrollment.dateOfIncident);            
-                angular.forEach(enrollment.notes, function(note){
-                    note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
-                });            
-                $scope.enrollments.push(enrollment);               
-            });
-        });    
-    };
-    
-    $scope.close = function(){
-        $scope.showProgramReportDetailsDiv = false;
-    };
-    
-    $scope.print = function(){
-        $scope.showProgramReportDetailsDiv = false;
-    };
-});
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	2014-08-27 10:38:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	1970-01-01 00:00:00 +0000
@@ -1,142 +0,0 @@
-<script src="../dhis-web-commons/ouwt/ouwt.js"></script>
-<script src="scripts/tracker-capture.js"></script>
-
-<div id="leftBar">   
-    <div class="left-bar-menu" ng-controller="LeftBarMenuController">
-        <ul class="nav nav-pills nav-stacked">
-            <li><a href ng-click="showHome()">{{'registration_and_data_entry' | translate}}</a></li>
-            <li><a href ng-click="showReportTypes()">{{'reports' | translate}}</a></li>            
-        </ul>
-    </div>  
-    <div id="orgUnitTree" style="margin-top:20px">
-        <ul>
-        </ul>
-    </div>
-    <img id="ouwt_loader" src="../images/ajax-loader-bar.gif"/>
-    <!--- selected org unit begins -->
-    <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
-    <!--- selected org unit ends  -->
-</div>
-
-<div id="mainPage" class="bordered-div">
-    <h2>{{'program_summary_report' | translate}}</h2>
-    <form name="outerForm" novalidate>               
-        <div class="row">
-            <div class="col-sm-8 col-md-6">
-                <table class="table table-borderless table-striped">
-                    <tr>
-                        <td class='col-sm-4 col-md-3 vertical-center'>
-                            {{'program' | translate}}
-                        </td>
-                        <td class='col-sm-4 col-md-3'>
-                            <select ng-model="selectedProgram"
-                                    class="form-control"
-                                    ng-options="program as program.name for program in programs | orderBy: 'name'" 
-                                    ng-disabled="programs.length < 1">
-                                <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists' | translate}}</option>
-                            </select>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='col-sm-4 col-md-3 vertical-center'>{{'org_unit'| translate}}</td>
-                        <td class='col-sm-4 col-md-3'>                 
-                            <label><input type="radio" ng-model="selectedOuMode.name" name="selected" value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
-                            <label><input type="radio" ng-model="selectedOuMode.name" name="children" value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
-                            <label><input type="radio" ng-model="selectedOuMode.name" name="descendants" value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
-                            <label><input type="radio" ng-model="selectedOuMode.name" name="accessible" value="ACCESSIBLE"> {{'ACCESSIBLE'| translate}}</label>
-                        </td>
-                    </tr>
-                </table>
-            </div>
-        </div>
-        <div class="row">
-            <div class="col-sm-8 col-md-6">
-                <table class="table-borderless">
-                    <tr>
-                        <td>
-                            <input type="text" name="reportStartDate" placeholder="{{'start_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.startDate" max="today" ng-required="true"/> 
-                            <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
-                        </td>
-                        <td>
-                            <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.endDate" max="today" ng-required="true"/>
-                            <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
-                        </td>
-                    </tr>
-                </table>                
-            </div>
-            <div class="col-md-6 trim">
-                <button type="button" class="btn btn-primary" ng-click="generateReport()" ng-disabled="!selectedProgram">{{'go'| translate}}</button>               
-            </div>
-        </div>
-    </form>
-    <div class="row" ng-if="programs.length < 1">        
-        <div class="col-sm-8 col-md-6 vertical-spacing">
-            <div class="alert alert-warning">{{'no_program_exists_report'| translate}}</div> 
-        </div>
-    </div>
-    <div class="row" ng-if="programs.length > 0 && !selectedProgram">        
-        <div class="col-sm-8 col-md-6 vertical-spacing">
-            <div class="alert alert-warning">{{'please_select_program_report'| translate}}</div> 
-        </div>
-    </div>
-    <div ng-if="dataReady">
-        <div ng-switch="teiCount">                    
-            <div ng-switch-when="undefined">
-                <div class="alert alert-warning vertical-spacing">
-                    {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
-                </div>
-            </div>
-            <div ng-switch-when="0">  
-                <div class="alert alert-warning vertical-spacing">
-                    {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
-                </div>
-            </div>    
-            <div ng-switch-default> 
-
-                <!-- report begins -->
-                <div class="vertical-spacing">                    
-                    <table class="table table-compact table-striped">
-                        <thead>
-                            <tr>
-                                <th>{{selectedProgram.trackedEntity.name}}</th>
-                                <th>{{selectedProgram.name}} {{'visit' | translate}}</th>
-                            </tr>
-                        </thead>
-                        <tr ng-repeat="tei in teiList.rows">
-                            <td>
-                                <span ng-repeat="gridColumn in gridColumns">
-                                    <span class="bold">{{gridColumn.name}}:</span> {{tei[gridColumn.id]}}<br>
-                                </span>
-                            </td>
-                            <td class='vertical-center'>    
-                                <div class='bold inline-block' ng-if='!dhis2Events[tei.id]'>{{'no_visit_made' | translate}}</div>
-                                <div class="inline-block" ng-repeat="ev in dhis2Events[tei.id] | orderBy: 'eventDate'">                                    
-                                    <div class="block align-center">{{ev.orgUnitName}}</div>                   
-                                    <div class="empty-stage-container" 
-                                         title="{{'no_data' | translate}}"
-                                         ng-class="{'{{ev.statusColor}}': true}"
-                                         ng-if='!ev.dataValues'>
-                                        {{ev.name}}<br/>
-                                        {{ev.eventDate}}<br>
-                                        {{'no_data' | translate}}
-                                    </div>
-                                    <div class="stage-container" 
-                                         title="{{'details' | translate}}"
-                                         ng-class="{'{{ev.statusColor}}': true}"
-                                         ng-if='ev.dataValues'
-                                         ng-click="showEventDetails(ev, tei)">
-                                        {{ev.name}}<br/>
-                                        {{ev.eventDate}}<br>  
-                                        {{'data_exists' | translate}}
-                                    </div>                                    
-                                    <span><i class="fa fa-arrow-right" ng-show="$index < dhis2Events[tei.id].length - 1"></i></span>
-                                </div>                                         
-                            </td>
-                        </tr>
-                    </table>
-                </div>
-                <!-- report ends -->
-            </div>
-        </div> 
-    </div>
-</div>

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report-controller.js	2014-08-27 11:18:35 +0000
@@ -0,0 +1,389 @@
+trackerCapture.controller('SummaryReportController',
+        function($scope,
+                $modal,
+                DateUtils,
+                EventUtils,
+                TEIService,
+                TEIGridService,
+                TranslationService,
+                AttributesFactory,
+                ProgramFactory,
+                DHIS2EventFactory,
+                storage) {
+
+    TranslationService.translate();
+    
+    $scope.today = DateUtils.format(moment());
+    
+    $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
+    $scope.selectedOuMode = $scope.ouModes[0];
+    $scope.report = {};
+    
+    //watch for selection of org unit from tree
+    $scope.$watch('selectedOrgUnit', function() {        
+        if( angular.isObject($scope.selectedOrgUnit)){            
+            storage.set('SELECTED_OU', $scope.selectedOrgUnit);            
+            $scope.loadPrograms($scope.selectedOrgUnit);
+        }
+    });
+    
+    //load programs associated with the selected org unit.
+    $scope.loadPrograms = function(orgUnit) {                
+        
+        $scope.selectedOrgUnit = orgUnit;
+        
+        if (angular.isObject($scope.selectedOrgUnit)) {   
+
+            ProgramFactory.getAll().then(function(programs){
+                $scope.programs = [];
+                angular.forEach(programs, function(program){                            
+                    if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id)){                                
+                        $scope.programs.push(program);
+                    }
+                });
+
+                if($scope.programs.length === 0){
+                    $scope.selectedProgram = null;
+                }
+                else{
+                    if($scope.selectedProgram){
+                        angular.forEach($scope.programs, function(program){                            
+                            if(program.id === $scope.selectedProgram.id){                                
+                                $scope.selectedProgram = program;
+                            }
+                        });
+                    }
+                    else{                        
+                        if($scope.programs.length === 1){
+                            $scope.selectedProgram = $scope.programs[0];
+                        }                        
+                    }
+                } 
+            });
+        }        
+    };
+    
+    //watch for selection of org unit from tree
+    $scope.$watch('selectedProgram', function() {        
+        if( angular.isObject($scope.selectedProgram)){            
+            $scope.dataReady = false;
+        }
+    });
+    
+    $scope.generateReport = function(){
+        
+        $scope.dataReady = false;
+        
+        //check for form validity
+        $scope.outerForm.submitted = true;        
+        if( $scope.outerForm.$invalid || !$scope.selectedProgram){
+            return false;
+        }
+        
+        $scope.programStages = [];
+        angular.forEach($scope.selectedProgram.programStages, function(stage){
+            $scope.programStages[stage.id] = stage;
+        });
+            
+        AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
+            $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);      
+        });  
+        
+        //fetch TEIs for the selected program and orgunit/mode
+        TEIService.search($scope.selectedOrgUnit.id, 
+                            $scope.selectedOuMode.name,
+                            null,
+                            'program=' + $scope.selectedProgram.id,
+                            null,
+                            $scope.pager,
+                            false).then(function(data){
+            if(data.rows){
+                $scope.teiCount = data.rows.length;
+                $scope.dataReady = true;
+            }
+            
+            
+            //process tei grid
+            $scope.teiList = TEIGridService.format(data);          
+            
+            DHIS2EventFactory.getByOrgUnitAndProgram($scope.selectedOrgUnit.id, $scope.selectedOuMode.name, $scope.selectedProgram.id).then(function(eventList){
+                $scope.dhis2Events = [];
+                angular.forEach(eventList, function(ev){
+                    if(ev.trackedEntityInstance){
+                        ev.name = $scope.programStages[ev.programStage].name;
+                        ev.programName = $scope.selectedProgram.name;
+                        ev.statusColor = EventUtils.getEventStatusColor(ev); 
+                        ev.eventDate = DateUtils.format(ev.eventDate);
+                        
+                        if($scope.dhis2Events[ev.trackedEntityInstance]){
+                            $scope.dhis2Events[ev.trackedEntityInstance].push(ev);
+                        }
+                        else{
+                            $scope.dhis2Events[ev.trackedEntityInstance] = [ev];
+                        }
+                        ev = EventUtils.setEventOrgUnitName(ev);
+                    }
+                });
+                
+            });
+        });
+    };
+    
+    $scope.showEventDetails = function(dhis2Event, selectedTei){
+        
+        var modalInstance = $modal.open({
+            templateUrl: 'components/report/event-details.html',
+            controller: 'EventDetailsController',
+            resolve: {
+                dhis2Event: function () {
+                    return dhis2Event;
+                },
+                gridColumns: function(){
+                    return $scope.gridColumns;
+                },
+                selectedTei: function(){
+                    return selectedTei;
+                },
+                entityName: function(){
+                    return $scope.selectedProgram.trackedEntity.name;
+                },
+                reportMode: function(){
+                    return 'PROGRAM';
+                }
+            }
+        });
+
+        modalInstance.result.then({
+        });
+    };   
+    
+})
+
+//Controller for event details
+.controller('EventDetailsController', 
+    function($scope, 
+            $modalInstance,
+            orderByFilter,
+            ProgramStageFactory,
+            dhis2Event,
+            selectedTei,
+            gridColumns,
+            entityName,
+            reportMode){
+    
+    $scope.selectedTei = selectedTei;
+    $scope.gridColumns = gridColumns;
+    $scope.entityName = entityName;
+    $scope.reportMode = reportMode;
+    $scope.currentEvent = dhis2Event;
+    $scope.currentEvent.providedElsewhere = [];
+    
+    if(!angular.isUndefined( $scope.currentEvent.notes)){
+        $scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate');            
+        angular.forEach($scope.currentEvent.notes, function(note){
+            note.storedDate = moment(note.storedDate).format('YYYY-MM-DD @ hh:mm A');
+        });
+    }
+    
+    ProgramStageFactory.get($scope.currentEvent.programStage).then(function(stage){
+        $scope.currentStage = stage;
+
+        $scope.allowProvidedElsewhereExists = false;
+        angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
+            $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
+            if(prStDe.allowProvidedElsewhere){
+                $scope.allowProvidedElsewhereExists = true;
+                $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = '';   
+            }                
+        });
+        angular.forEach($scope.currentEvent.dataValues, function(dataValue){
+            var val = dataValue.value;
+            if(val){
+                var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
+                if( de && de.type === 'int' && val){
+                    val = parseInt(val);
+                    dataValue.value = val;
+                }
+                $scope.currentEvent[dataValue.dataElement] = val;
+            }                    
+        });
+    });
+    
+    $scope.close = function () {
+        $modalInstance.close();
+    };
+})
+
+
+//conroller for tei report
+.controller('TeiReportController',
+        function($scope,
+                $filter,
+                CurrentSelection,
+                storage,
+                DateUtils,
+                EventUtils,
+                TEIService,
+                TranslationService,
+                ProgramFactory,
+                ProgramStageFactory,
+                EnrollmentService,
+                DHIS2EventFactory) {
+
+    TranslationService.translate();    
+    $scope.showProgramReportDetailsDiv = false;
+    $scope.programs = [];  
+    $scope.programNames = [];  
+    $scope.programStageNames = [];
+    ProgramFactory.getAll().then(function(programs){     
+        $scope.programs = programs;
+        angular.forEach($scope.programs, function(pr){
+            delete pr.organisationUnits;
+            $scope.programNames[pr.id] = {id: pr.id, name: pr.name};
+            angular.forEach(pr.programStages, function(stage){                
+                $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name};
+            });
+        });
+    });
+        
+    $scope.$on('dashboardWidgets', function(event, args) {
+        $scope.showProgramReportDetailsDiv = false;
+        var selections = CurrentSelection.get();
+        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        $scope.selectedTei = selections.tei;  
+        $scope.selectedEntity = selections.te;
+        $scope.selectedProgram = selections.pr;        
+        $scope.selectedEnrollment = selections.enrollment; 
+    
+        if($scope.selectedTei){            
+            $scope.getEvents();
+        }       
+    });
+    
+    $scope.getEvents = function(){
+        
+        $scope.dataFetched = false;
+        $scope.dataExists = false;
+        var programId = null, orgUnitId = null;
+        
+        if($scope.selectedProgram){
+            programId = $scope.selectedProgram.id;
+        }
+        
+        $scope.report = [];
+        angular.forEach($scope.programs, function(pr){
+            $scope.report[pr.id] = {};
+        });
+        
+        DHIS2EventFactory.getEventsByProgram($scope.selectedTei.trackedEntityInstance, orgUnitId, programId).then(function(eventList){
+            angular.forEach(eventList, function(ev){
+                if(ev.program){       
+                    ev.visited = true;
+                    ev.dueDate = DateUtils.format(ev.dueDate);  
+                    ev.sortingDate = ev.dueDate;
+                    ev.name = $scope.programStageNames[ev.programStage].name;
+                    ev.programName = $scope.programNames[ev.program].name;
+                    if(angular.isUndefined($scope.report[ev.program].enrollments)){
+                        $scope.report[ev.program] = {enrollments: {}};
+                    }
+                    ev.statusColor = EventUtils.getEventStatusColor(ev); 
+                    
+                    if(ev.eventDate){
+                        ev.eventDate = DateUtils.format(ev.eventDate);
+                        ev.sortingDate = ev.eventDate;
+                    }
+                    else{
+                        ev.visited = false;
+                    }                 
+
+                    if(ev.enrollment){
+                        if($scope.report[ev.program].enrollments[ev.enrollment]){
+                            $scope.report[ev.program].enrollments[ev.enrollment].push(ev);
+                        }
+                        else{
+                            $scope.report[ev.program].enrollments[ev.enrollment]= [ev];
+                        }
+                    }
+                    ev = EventUtils.setEventOrgUnitName(ev);
+                }                
+            });
+
+            if(eventList){
+                $scope.dataExists = true;
+            }
+            $scope.dataFetched = true;
+        });
+    };
+    
+    $scope.showProgramReportDetails = function(pr){
+        
+        $scope.showProgramReportDetailsDiv = !$scope.showProgramReportDetailsDiv;
+        $scope.selectedProgram = pr;
+        $scope.selectedReport = $scope.report[pr.id];
+        
+        //today as report date
+        $scope.today = moment();
+        $scope.today = Date.parse($scope.today);
+        $scope.today = $filter('date')($scope.today, 'yyyy-MM-dd');
+
+        //process tei attributes, this is to have consistent display so that the tei 
+        //contains program attributes whether it has value or not
+        TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, null).then(function(tei){
+            $scope.tei = tei;  
+        });
+        
+        //get program stage for the selected program
+        //they are needed assign data element names for event data values
+        $scope.programStages = [];  
+        $scope.allowProvidedElsewhereExists = [];
+        angular.forEach($scope.selectedProgram.programStages, function(st){
+            ProgramStageFactory.get(st.id).then(function(stage){
+                $scope.programStages[stage.id] = stage;
+                var providedElsewhereExists = false;
+                for(var i=0; i<stage.programStageDataElements.length && !providedElsewhereExists; i++){                
+                    if(stage.programStageDataElements[i].allowProvidedElsewhere){
+                        providedElsewhereExists = true;
+                        $scope.allowProvidedElsewhereExists[st.id] = true;
+                    }                
+                }            
+            });
+        });
+        
+        //program reports come grouped in enrollment, process for each enrollment
+        $scope.enrollments = [];        
+        angular.forEach(Object.keys($scope.selectedReport.enrollments), function(enr){        
+            //format report data values
+            angular.forEach($scope.selectedReport.enrollments[enr], function(ev){
+                angular.forEach(ev.notes, function(note){
+                    note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+                }); 
+
+                if(ev.dataValues){
+                    angular.forEach(ev.dataValues, function(dv){
+                        if(dv.dataElement){
+                            ev[dv.dataElement] = dv;
+                        }                    
+                    });
+                }
+            });
+
+            //get enrollment details
+            EnrollmentService.get(enr).then(function(enrollment){
+                enrollment.dateOfEnrollment = DateUtils.format(enrollment.dateOfEnrollment);
+                enrollment.dateOfIncident = DateUtils.format(enrollment.dateOfIncident);            
+                angular.forEach(enrollment.notes, function(note){
+                    note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+                });            
+                $scope.enrollments.push(enrollment);               
+            });
+        });    
+    };
+    
+    $scope.close = function(){
+        $scope.showProgramReportDetailsDiv = false;
+    };
+    
+    $scope.print = function(){
+        $scope.showProgramReportDetailsDiv = false;
+    };
+});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/summary-report.html	2014-08-27 11:18:35 +0000
@@ -0,0 +1,142 @@
+<script src="../dhis-web-commons/ouwt/ouwt.js"></script>
+<script src="scripts/tracker-capture.js"></script>
+
+<div id="leftBar">   
+    <div class="left-bar-menu" ng-controller="LeftBarMenuController">
+        <ul class="nav nav-pills nav-stacked">
+            <li><a href ng-click="showHome()">{{'registration_and_data_entry' | translate}}</a></li>
+            <li><a href ng-click="showReportTypes()">{{'reports' | translate}}</a></li>            
+        </ul>
+    </div>  
+    <div id="orgUnitTree" style="margin-top:20px">
+        <ul>
+        </ul>
+    </div>
+    <img id="ouwt_loader" src="../images/ajax-loader-bar.gif"/>
+    <!--- selected org unit begins -->
+    <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
+    <!--- selected org unit ends  -->
+</div>
+
+<div id="mainPage" class="bordered-div">
+    <h2>{{'program_summary_report' | translate}}</h2>
+    <form name="outerForm" novalidate>               
+        <div class="row">
+            <div class="col-sm-8 col-md-6">
+                <table class="table table-borderless table-striped">
+                    <tr>
+                        <td class='col-sm-4 col-md-3 vertical-center'>
+                            {{'program' | translate}}
+                        </td>
+                        <td class='col-sm-4 col-md-3'>
+                            <select ng-model="selectedProgram"
+                                    class="form-control"
+                                    ng-options="program as program.name for program in programs | orderBy: 'name'" 
+                                    ng-disabled="programs.length < 1">
+                                <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists' | translate}}</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='col-sm-4 col-md-3 vertical-center'>{{'org_unit'| translate}}</td>
+                        <td class='col-sm-4 col-md-3'>                 
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="selected" value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="children" value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="descendants" value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
+                            <label><input type="radio" ng-model="selectedOuMode.name" name="accessible" value="ACCESSIBLE"> {{'ACCESSIBLE'| translate}}</label>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+        </div>
+        <div class="row">
+            <div class="col-sm-8 col-md-6">
+                <table class="table-borderless">
+                    <tr>
+                        <td>
+                            <input type="text" name="reportStartDate" placeholder="{{'start_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.startDate" max="today" ng-required="true"/> 
+                            <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                        </td>
+                        <td>
+                            <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.endDate" max="today" ng-required="true"/>
+                            <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                        </td>
+                    </tr>
+                </table>                
+            </div>
+            <div class="col-md-6 trim">
+                <button type="button" class="btn btn-primary" ng-click="generateReport()" ng-disabled="!selectedProgram">{{'go'| translate}}</button>               
+            </div>
+        </div>
+    </form>
+    <div class="row" ng-if="programs.length < 1">        
+        <div class="col-sm-8 col-md-6 vertical-spacing">
+            <div class="alert alert-warning">{{'no_program_exists_report'| translate}}</div> 
+        </div>
+    </div>
+    <div class="row" ng-if="programs.length > 0 && !selectedProgram">        
+        <div class="col-sm-8 col-md-6 vertical-spacing">
+            <div class="alert alert-warning">{{'please_select_program_report'| translate}}</div> 
+        </div>
+    </div>
+    <div ng-if="dataReady">
+        <div ng-switch="teiCount">                    
+            <div ng-switch-when="undefined">
+                <div class="alert alert-warning vertical-spacing">
+                    {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
+                </div>
+            </div>
+            <div ng-switch-when="0">  
+                <div class="alert alert-warning vertical-spacing">
+                    {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
+                </div>
+            </div>    
+            <div ng-switch-default> 
+
+                <!-- report begins -->
+                <div class="vertical-spacing">                    
+                    <table class="table table-compact table-striped">
+                        <thead>
+                            <tr>
+                                <th>{{selectedProgram.trackedEntity.name}}</th>
+                                <th>{{selectedProgram.name}} {{'visit' | translate}}</th>
+                            </tr>
+                        </thead>
+                        <tr ng-repeat="tei in teiList.rows">
+                            <td>
+                                <span ng-repeat="gridColumn in gridColumns">
+                                    <span class="bold">{{gridColumn.name}}:</span> {{tei[gridColumn.id]}}<br>
+                                </span>
+                            </td>
+                            <td class='vertical-center'>    
+                                <div class='bold inline-block' ng-if='!dhis2Events[tei.id]'>{{'no_visit_made' | translate}}</div>
+                                <div class="inline-block" ng-repeat="ev in dhis2Events[tei.id] | orderBy: 'eventDate'">                                    
+                                    <div class="block align-center">{{ev.orgUnitName}}</div>                   
+                                    <div class="empty-stage-container" 
+                                         title="{{'no_data' | translate}}"
+                                         ng-class="{'{{ev.statusColor}}': true}"
+                                         ng-if='!ev.dataValues'>
+                                        {{ev.name}}<br/>
+                                        {{ev.eventDate}}<br>
+                                        {{'no_data' | translate}}
+                                    </div>
+                                    <div class="stage-container" 
+                                         title="{{'details' | translate}}"
+                                         ng-class="{'{{ev.statusColor}}': true}"
+                                         ng-if='ev.dataValues'
+                                         ng-click="showEventDetails(ev, tei)">
+                                        {{ev.name}}<br/>
+                                        {{ev.eventDate}}<br>  
+                                        {{'data_exists' | translate}}
+                                    </div>                                    
+                                    <span><i class="fa fa-arrow-right" ng-show="$index < dhis2Events[tei.id].length - 1"></i></span>
+                                </div>                                         
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+                <!-- report ends -->
+            </div>
+        </div> 
+    </div>
+</div>

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2014-08-27 11:18:35 +0000
@@ -0,0 +1,172 @@
+//conroller for tei report
+trackerCapture.controller('TeiReportController',
+        function($scope,
+                $filter,
+                CurrentSelection,
+                storage,
+                DateUtils,
+                EventUtils,
+                TEIService,
+                TranslationService,
+                ProgramFactory,
+                ProgramStageFactory,
+                EnrollmentService,
+                DHIS2EventFactory) {
+
+    TranslationService.translate();    
+    $scope.showProgramReportDetailsDiv = false;
+    $scope.programs = [];  
+    $scope.programNames = [];  
+    $scope.programStageNames = [];
+    ProgramFactory.getAll().then(function(programs){     
+        $scope.programs = programs;
+        angular.forEach($scope.programs, function(pr){
+            delete pr.organisationUnits;
+            $scope.programNames[pr.id] = {id: pr.id, name: pr.name};
+            angular.forEach(pr.programStages, function(stage){                
+                $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name};
+            });
+        });
+    });
+        
+    $scope.$on('dashboardWidgets', function(event, args) {
+        $scope.showProgramReportDetailsDiv = false;
+        var selections = CurrentSelection.get();
+        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        $scope.selectedTei = selections.tei;  
+        $scope.selectedEntity = selections.te;
+        $scope.selectedProgram = selections.pr;        
+        $scope.selectedEnrollment = selections.enrollment; 
+    
+        if($scope.selectedTei){            
+            $scope.getEvents();
+        }       
+    });
+    
+    $scope.getEvents = function(){
+        
+        $scope.dataFetched = false;
+        $scope.dataExists = false;
+        var programId = null, orgUnitId = null;
+        
+        if($scope.selectedProgram){
+            programId = $scope.selectedProgram.id;
+        }
+        
+        $scope.report = [];
+        angular.forEach($scope.programs, function(pr){
+            $scope.report[pr.id] = {};
+        });
+        
+        DHIS2EventFactory.getEventsByProgram($scope.selectedTei.trackedEntityInstance, orgUnitId, programId).then(function(eventList){
+            angular.forEach(eventList, function(ev){
+                if(ev.program){       
+                    ev.visited = true;
+                    ev.dueDate = DateUtils.format(ev.dueDate);  
+                    ev.sortingDate = ev.dueDate;
+                    ev.name = $scope.programStageNames[ev.programStage].name;
+                    ev.programName = $scope.programNames[ev.program].name;
+                    if(angular.isUndefined($scope.report[ev.program].enrollments)){
+                        $scope.report[ev.program] = {enrollments: {}};
+                    }
+                    ev.statusColor = EventUtils.getEventStatusColor(ev); 
+                    
+                    if(ev.eventDate){
+                        ev.eventDate = DateUtils.format(ev.eventDate);
+                        ev.sortingDate = ev.eventDate;
+                    }
+                    else{
+                        ev.visited = false;
+                    }                 
+
+                    if(ev.enrollment){
+                        if($scope.report[ev.program].enrollments[ev.enrollment]){
+                            $scope.report[ev.program].enrollments[ev.enrollment].push(ev);
+                        }
+                        else{
+                            $scope.report[ev.program].enrollments[ev.enrollment]= [ev];
+                        }
+                    }
+                    ev = EventUtils.setEventOrgUnitName(ev);
+                }                
+            });
+
+            if(eventList){
+                $scope.dataExists = true;
+            }
+            $scope.dataFetched = true;
+        });
+    };
+    
+    $scope.showProgramReportDetails = function(pr){
+        
+        $scope.showProgramReportDetailsDiv = !$scope.showProgramReportDetailsDiv;
+        $scope.selectedProgram = pr;
+        $scope.selectedReport = $scope.report[pr.id];
+        
+        //today as report date
+        $scope.today = moment();
+        $scope.today = Date.parse($scope.today);
+        $scope.today = $filter('date')($scope.today, 'yyyy-MM-dd');
+
+        //process tei attributes, this is to have consistent display so that the tei 
+        //contains program attributes whether it has value or not
+        TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, null).then(function(tei){
+            $scope.tei = tei;  
+        });
+        
+        //get program stage for the selected program
+        //they are needed assign data element names for event data values
+        $scope.programStages = [];  
+        $scope.allowProvidedElsewhereExists = [];
+        angular.forEach($scope.selectedProgram.programStages, function(st){
+            ProgramStageFactory.get(st.id).then(function(stage){
+                $scope.programStages[stage.id] = stage;
+                var providedElsewhereExists = false;
+                for(var i=0; i<stage.programStageDataElements.length && !providedElsewhereExists; i++){                
+                    if(stage.programStageDataElements[i].allowProvidedElsewhere){
+                        providedElsewhereExists = true;
+                        $scope.allowProvidedElsewhereExists[st.id] = true;
+                    }                
+                }            
+            });
+        });
+        
+        //program reports come grouped in enrollment, process for each enrollment
+        $scope.enrollments = [];        
+        angular.forEach(Object.keys($scope.selectedReport.enrollments), function(enr){        
+            //format report data values
+            angular.forEach($scope.selectedReport.enrollments[enr], function(ev){
+                angular.forEach(ev.notes, function(note){
+                    note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+                }); 
+
+                if(ev.dataValues){
+                    angular.forEach(ev.dataValues, function(dv){
+                        if(dv.dataElement){
+                            ev[dv.dataElement] = dv;
+                        }                    
+                    });
+                }
+            });
+
+            //get enrollment details
+            EnrollmentService.get(enr).then(function(enrollment){
+                enrollment.dateOfEnrollment = DateUtils.format(enrollment.dateOfEnrollment);
+                enrollment.dateOfIncident = DateUtils.format(enrollment.dateOfIncident);            
+                angular.forEach(enrollment.notes, function(note){
+                    note.storedDate = moment(note.storedDate).format('DD.MM.YYYY @ hh:mm A');
+                });            
+                $scope.enrollments.push(enrollment);               
+            });
+        });    
+    };
+    
+    $scope.close = function(){
+        $scope.showProgramReportDetailsDiv = false;
+    };
+    
+    $scope.print = function(){
+        $scope.showProgramReportDetailsDiv = false;
+    };
+});
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2014-08-26 16:39:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2014-08-27 11:18:35 +0000
@@ -52,7 +52,6 @@
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
         <!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>-->
-        <!--<script type="text/javascript" src="../dhis-web-commons/ouwt/ouwt.js"></script>-->
 
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate.min.js"></script>
@@ -65,13 +64,18 @@
         <script type="text/javascript" src="scripts/filters.js"></script>
         <script type="text/javascript" src="scripts/directives.js"></script>
         <script type="text/javascript" src="scripts/controllers.js"></script>        
+        <script type="text/javascript" src="scripts/column-display-controller.js"></script>
+        <script type="text/javascript" src="scripts/header-controller.js"></script>
+        <script type="text/javascript" src="scripts/leftbar-menu-controller.js"></script>
+        <script type="text/javascript" src="scripts/report-types-controller.js"></script>
+        
         <script type="text/javascript" src="scripts/tracker-capture.js"></script>
         <script type="text/javascript" src="components/dashboard/dashboard-controller.js"></script>
         <script type="text/javascript" src="components/dashboard/dashboard-widgets-controller.js"></script>
         <script type="text/javascript" src="components/registration/registration-controller.js"></script>
         <script type="text/javascript" src="components/enrollment/enrollment-controller.js"></script>
         <script type="text/javascript" src="components/dataentry/dataentry-controller.js"></script>
-        <script type="text/javascript" src="components/report/report-controller.js"></script>
+        <script type="text/javascript" src="components/report/summary-report-controller.js"></script>
         <script type="text/javascript" src="components/selected/selected-controller.js"></script>
         <script type="text/javascript" src="components/relationship/relationship-controller.js"></script>
         <script type="text/javascript" src="components/profile/profile-controller.js"></script>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js	2014-08-27 10:38:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js	2014-08-27 11:18:35 +0000
@@ -28,9 +28,9 @@
     }).when('/dashboard',{
         templateUrl:'components/dashboard/dashboard.html',
         controller: 'DashboardController'
-    }).when('/report',{
-        templateUrl:'components/report/report.html',
-        controller: 'ReportController'
+    }).when('/summary-report',{
+        templateUrl:'components/report/summary-report.html',
+        controller: 'SummaryReportController'
     }).when('/reports',{
         templateUrl:'components/report/reports.html',
         controller: 'ReportTypesController'

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/column-display-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/column-display-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/column-display-controller.js	2014-08-27 11:18:35 +0000
@@ -0,0 +1,24 @@
+//Controller for column show/hide
+trackerCapture.controller('ColumnDisplayController', 
+    function($scope, 
+            $modalInstance, 
+            hiddenGridColumns,
+            gridColumns){
+    
+    $scope.gridColumns = gridColumns;
+    $scope.hiddenGridColumns = hiddenGridColumns;
+    
+    $scope.close = function () {
+      $modalInstance.close($scope.gridColumns);
+    };
+    
+    $scope.showHideColumns = function(gridColumn){
+       
+        if(gridColumn.show){                
+            $scope.hiddenGridColumns--;            
+        }
+        else{
+            $scope.hiddenGridColumns++;            
+        }      
+    };    
+});
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-08-27 10:38:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-08-27 11:18:35 +0000
@@ -355,80 +355,4 @@
     $scope.getHelpContent = function(){
         console.log('I will get help content');
     };    
-})
-
-//Controller for column show/hide
-.controller('ColumnDisplayController', 
-    function($scope, 
-            $modalInstance, 
-            hiddenGridColumns,
-            gridColumns){
-    
-    $scope.gridColumns = gridColumns;
-    $scope.hiddenGridColumns = hiddenGridColumns;
-    
-    $scope.close = function () {
-      $modalInstance.close($scope.gridColumns);
-    };
-    
-    $scope.showHideColumns = function(gridColumn){
-       
-        if(gridColumn.show){                
-            $scope.hiddenGridColumns--;            
-        }
-        else{
-            $scope.hiddenGridColumns++;            
-        }      
-    };    
-})
-
-//Controller for the header section
-.controller('LeftBarMenuController',
-        function($scope,
-                $location,
-                TranslationService) {
-
-    TranslationService.translate();
-    
-    $scope.showHome = function(){
-        $location.path('/').search();
-    }; 
-    
-    $scope.showReportTypes = function(){
-        $location.path('/reports').search();
-    };
-})
-
-//Controller for the header section
-.controller('ReportTypesController',
-        function($scope,
-                $location,
-                TranslationService) {
-
-    TranslationService.translate();
-    
-    $scope.showSummaryReport = function(){   
-        $location.path('/report').search();
-    };
-    
-    $scope.showOverDueEvents = function(){   
-        $location.path('/report').search();
-    };   
-    
-    $scope.showUpcomingEvents = function(){
-        $location.path('/report').search();
-    };
-})
-
-//Controller for the header section
-.controller('HeaderController',
-        function($scope,                
-                DHIS2URL,
-                TranslationService) {
-
-    TranslationService.translate();
-    
-    $scope.home = function(){        
-        window.location = DHIS2URL;
-    };    
 });
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/header-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/header-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/header-controller.js	2014-08-27 11:18:35 +0000
@@ -0,0 +1,12 @@
+//Controller for the header section
+trackerCapture.controller('HeaderController',
+        function($scope,                
+                DHIS2URL,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    $scope.home = function(){        
+        window.location = DHIS2URL;
+    };    
+});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/leftbar-menu-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/leftbar-menu-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/leftbar-menu-controller.js	2014-08-27 11:18:35 +0000
@@ -0,0 +1,16 @@
+//Controller for column show/hide
+trackerCapture.controller('LeftBarMenuController',
+        function($scope,
+                $location,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    $scope.showHome = function(){
+        $location.path('/').search();
+    }; 
+    
+    $scope.showReportTypes = function(){
+        $location.path('/reports').search();
+    };
+});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/report-types-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/report-types-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/report-types-controller.js	2014-08-27 11:18:35 +0000
@@ -0,0 +1,20 @@
+//Controller for the header section
+trackerCapture.controller('ReportTypesController',
+        function($scope,
+                $location,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    $scope.showSummaryReport = function(){   
+        $location.path('/summary-report').search();
+    };
+    
+    $scope.showOverDueEvents = function(){   
+        $location.path('/report').search();
+    };   
+    
+    $scope.showUpcomingEvents = function(){
+        $location.path('/report').search();
+    };
+});
\ No newline at end of file