=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java 2012-05-26 12:39:39 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Grid.java 2012-10-18 19:13:26 +0000 @@ -82,6 +82,13 @@ * Adds a header value. */ Grid addHeader( GridHeader header ); + + /** + * Adds a number of empty values to the Grid. + * + * @param number the number of columns to add. + */ + Grid addEmptyHeaders( int number ); /** * Returns the current height / number of rows in the grid. @@ -109,6 +116,13 @@ * @param value the value to add. */ Grid addValue( Object value ); + + /** + * Adds a number of empty values to the Grid at the current row. + * + * @param number the number of values to add. + */ + Grid addEmptyValues( int number ); /** * Returns the row with the given index. === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datasetreport/DataSetReportService.java 2012-10-18 19:13:26 +0000 @@ -54,6 +54,9 @@ */ String getCustomDataSetReport( DataSet dataSet, OrganisationUnit unit, Period period, boolean selectedUnitOnly, I18nFormat format ); + List getCustomDataSetReportAsGrid( DataSet dataSet, OrganisationUnit unit, Period period, + boolean selectedUnitOnly, I18nFormat format ); + /** * Generates a Grid representing a data set report with all data elements * in the data set. The data elements are grouped by their category combo. === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java 2012-10-01 13:09:49 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java 2012-10-18 19:13:26 +0000 @@ -62,6 +62,7 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; import org.hisp.dhis.system.filter.AggregatableDataElementFilter; +import org.hisp.dhis.system.grid.GridUtils; import org.hisp.dhis.system.grid.ListGrid; import org.hisp.dhis.system.util.FilterUtils; @@ -71,7 +72,7 @@ */ public class DefaultDataSetReportService implements DataSetReportService -{ +{ private static final String NULL_REPLACEMENT = ""; private static final String DEFAULT_HEADER = "Value"; private static final String TOTAL_HEADER = "Total"; @@ -109,6 +110,21 @@ return prepareReportContent( dataSet.getDataEntryForm(), valueMap, indicatorValueMap, format ); } + + public List getCustomDataSetReportAsGrid( DataSet dataSet, OrganisationUnit unit, Period period, + boolean selectedUnitOnly, I18nFormat format ) + { + String html = getCustomDataSetReport( dataSet, unit, period, selectedUnitOnly, format ); + + try + { + return GridUtils.fromHtml( html ); + } + catch ( Exception ex ) + { + throw new RuntimeException( "Failed to render custom data set report as grid", ex ); + } + } public List getSectionDataSetReport( DataSet dataSet, Period period, OrganisationUnit unit, boolean selectedUnitOnly, I18nFormat format, I18n i18n ) === modified file 'dhis-2/dhis-support/dhis-support-system/pom.xml' --- dhis-2/dhis-support/dhis-support-system/pom.xml 2012-08-03 11:05:49 +0000 +++ dhis-2/dhis-support/dhis-support-system/pom.xml 2012-10-18 19:13:26 +0000 @@ -144,6 +144,10 @@ javax.servlet servlet-api + + org.htmlparser + htmlparser + ../../ === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java 2012-05-26 12:39:39 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java 2012-10-18 19:13:26 +0000 @@ -43,6 +43,7 @@ import java.io.OutputStream; import java.io.StringWriter; import java.io.Writer; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -62,6 +63,8 @@ import org.amplecode.staxwax.factory.XMLFactory; import org.amplecode.staxwax.writer.XMLWriter; import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.velocity.VelocityContext; import org.hisp.dhis.common.Grid; import org.hisp.dhis.common.GridHeader; @@ -71,6 +74,14 @@ import org.hisp.dhis.system.util.MathUtils; import org.hisp.dhis.system.util.StreamUtils; import org.hisp.dhis.system.velocity.VelocityManager; +import org.htmlparser.Node; +import org.htmlparser.NodeFilter; +import org.htmlparser.Parser; +import org.htmlparser.filters.OrFilter; +import org.htmlparser.filters.TagNameFilter; +import org.htmlparser.nodes.TagNode; +import org.htmlparser.tags.TableRow; +import org.htmlparser.tags.TableTag; import org.springframework.jdbc.support.rowset.SqlRowSet; import com.lowagie.text.Document; @@ -81,10 +92,14 @@ */ public class GridUtils { + private static final Log log = LogFactory.getLog( GridUtils.class ); + private static final String EMPTY = ""; private static final String XLS_SHEET_PREFIX = "Sheet "; + private static final NodeFilter HTML_ROW_FILTER = new OrFilter( new TagNameFilter( "td" ), new TagNameFilter( "th" ) ); + private static final WritableCellFormat XLS_FORMAT_TTTLE = new WritableCellFormat( new WritableFont( WritableFont.TAHOMA, 13, WritableFont.NO_BOLD, false ) ); @@ -428,6 +443,126 @@ } } + /** + * Creates a list of Grids based on the given HTML string. This works only + * for table-based HTML documents. + * + * @param html the HTML string. + * @return a list of Grids. + */ + public static List fromHtml( String html ) + throws Exception + { + if ( html == null || html.trim().isEmpty() ) + { + return null; + } + + List grids = new ArrayList(); + + Parser parser = Parser.createParser( html, "UTF-8" ); + + Node[] tables = parser.extractAllNodesThatMatch( new TagNameFilter( "table" ) ).toNodeArray(); + + for ( Node t : tables ) + { + Grid grid = new ListGrid(); + + TableTag table = (TableTag) t; + + TableRow[] rows = table.getRows(); + + Integer firstColumnCount = null; + + for ( TableRow row : rows ) + { + if ( getColumnCount( row ) == 0 ) // Ignore if no cells + { + log.warn( "Ignoring row with no columns" ); + continue; + } + + Node[] cells = row.getChildren().extractAllNodesThatMatch( HTML_ROW_FILTER ).toNodeArray(); + + if ( firstColumnCount == null ) // First row becomes header + { + firstColumnCount = getColumnCount( row ); + + for ( Node c : cells ) + { + TagNode cell = (TagNode) c; + + grid.addHeader( new GridHeader( getValue( cell ), false, false ) ); + + Integer colSpan = MathUtils.parseInt( cell.getAttribute( "colspan" ) ); + + if ( colSpan != null && colSpan > 1 ) + { + grid.addEmptyHeaders( ( colSpan - 1 ) ); + } + } + } + else // Rest becomes rows + { + if ( firstColumnCount != getColumnCount( row ) ) // Ignore + { + log.warn( "Ignoring row which has " + row.getColumnCount() + " columns since table has " + firstColumnCount + " columns" ); + continue; + } + + grid.addRow(); + + for ( Node c : cells ) + { + // TODO row span + + TagNode cell = (TagNode) c; + + grid.addValue( getValue( cell ) ); + + Integer colSpan = MathUtils.parseInt( cell.getAttribute( "colspan" ) ); + + if ( colSpan != null && colSpan > 1 ) + { + grid.addEmptyValues( ( colSpan - 1 ) ); + } + } + } + } + + grids.add( grid ); + } + + return grids; + } + + /** + * Returns the number of columns/cells in the given row, including cell spacing. + */ + private static int getColumnCount( TableRow row ) + { + Node[] cells = row.getChildren().extractAllNodesThatMatch( HTML_ROW_FILTER ).toNodeArray(); + + int cols = 0; + + for ( Node cell : cells ) + { + Integer colSpan = MathUtils.parseInt( ((TagNode) cell).getAttribute( "colspan" ) ); + + cols += colSpan != null ? colSpan : 1; + } + + return cols; + } + + /** + * Retrieves the value of a table cell. + */ + public static String getValue( TagNode cell ) + { + return cell.getFirstChild() != null ? cell.getFirstChild().getText().trim().replaceAll( " ", "" ) : ""; + } + // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java 2012-09-27 09:28:54 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java 2012-10-18 19:13:26 +0000 @@ -160,6 +160,18 @@ return this; } + + public Grid addEmptyHeaders( int number ) + { + for ( int i = 0; i < number; i++ ) + { + headers.add( new GridHeader( "", false, false ) ); + } + + updateColumnIndexMap(); + + return this; + } @JsonProperty @JsonView( { DetailedView.class } ) @@ -221,6 +233,16 @@ return this; } + + public Grid addEmptyValues( int number ) + { + for ( int i = 0; i < number; i++ ) + { + addValue( "" ); + } + + return this; + } public List getRow( int rowIndex ) { === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2012-09-22 21:59:39 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2012-10-18 19:13:26 +0000 @@ -347,7 +347,7 @@ */ public static Double parseDouble( String value ) { - if ( value == null ) + if ( value == null || value.trim().isEmpty() ) { return null; } @@ -363,6 +363,30 @@ } /** + * Parses an integer silently. Returns the Integer value of the given string. + * Returns null if the input string is null, empty or if it cannot be parsed. + * + * @param string the string. + * @return an Integer. + */ + public static Integer parseInt( String string ) + { + if ( string == null || string.trim().isEmpty() ) + { + return null; + } + + try + { + return Integer.parseInt( string ); + } + catch ( NumberFormatException ex ) + { + return null; + } + } + + /** * Returns the lower bound for the given standard deviation, number of standard * deviations and average. * === added file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridUtilsTest.java' --- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridUtilsTest.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridUtilsTest.java 2012-10-18 19:13:26 +0000 @@ -0,0 +1,55 @@ +package org.hisp.dhis.system.grid; + +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.hisp.dhis.common.Grid; +import org.junit.Test; +import org.springframework.core.io.ClassPathResource; + +import static junit.framework.Assert.*; + +/** + * @author Lars Helge Overland + */ +public class GridUtilsTest +{ + @Test + public void testFromHtml() + throws Exception + { + String html = IOUtils.toString( new ClassPathResource( "customform.html" ).getInputStream() ); + + List grids = GridUtils.fromHtml( html ); + + assertNotNull( grids ); + assertEquals( 6, grids.size() ); + } +} === added file 'dhis-2/dhis-support/dhis-support-system/src/test/resources/customform.html' --- dhis-2/dhis-support/dhis-support-system/src/test/resources/customform.html 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/test/resources/customform.html 2012-10-18 19:13:26 +0000 @@ -0,0 +1,1839 @@ +

MOH - Uganda - January 2012

+ + + + +
+ +
+ + + +
+ +
+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ Joint Medical Store (Global Fund)

+
+
+ Please adhere to these instructions
+
+ i. Please ensure to report in pack sizes. For example, instead of recording 60 tablets for AZT/3TC/NVP, record 1 pack.
+
+ ii. Please note that the ARV order and report form is a bi-monthly report. Therefore combine and enter data for two months into a single report when filling the form. Selecting a month in the period field above implies that you are entering data for the selected month and the month before. For example, selecting February 2012 means you are entering aggregated data for January 2012 and February 2012.
+
+   + Drug Formulation and Strength + Pack Size + OPENING BALANCE at start of 2 Month Cycle + QUANTITY RECEIVED during 2 Month Cycle + PMTCT CONSUMPTION during 2 Month Cycle + ART
+ CONSUMPTION during 2 Month Cycle
+ LOSSES / ADJUSTMENTS ( + / - ) + CLOSING BALANCE (Physical Count Stores + Pharmacy) + MONTHS OF STOCK ON-HAND = F / ((C+D) / 2) + QUANTITY REQUIRED FOR CURRENT PATIENTS = (2 x (C+D) - F + ESTIMATED NO OF NEW ART PATIENTS for the Next Cycle + ESTIMATED
+ NO OF NEW HIV+ PREGNANT WOMEN for the Next Cycle
+ TOTAL QUANTITY TO BE ORDERED = G + (H * p * 4) + Notes
+ ADULT - RECOMMENDED FORMULATIONS + A + B + C + D + E + F + G + H + I + J + K +  
+ 1 + Tenofovir/Lamivudine/Efavirenz (TDF/3TC/EFV) 300mg/300mg/600mg + Pack of 30 + 160 + 160 + 160 + 160 + 160 + 160 + 2 + 960 + 160 + 160 + 3520 +
+ 2 + Tenofovir/Lamivudine (TDF/3TC) 300mg/300mg + Pack of 30 + 160 + 160 + 160 + 160 + 160 + 160 + 2 + 960 + 160 + 160 + 3520 +
+ 3 + Zidovudine/Lamivudine/Nevirapine (AZT/3TC/NVP) 300mg/150mg/200mg + Pack of 60 + 160 + 160 + 160 + 160 + 160 + 160 + 2 + 960 + 160 + 160 + 3520 +
+ 4 + Zidovudine/Lamivudine (AZT/3TC) 300mg/150mg + Pack of 60 + 160 + 160 + 160 + 160 + 160 + 160 + 2 + 960 + 160 + 160 + 3520 +
+ 5 + Efavirenz (EFV) 600mg + Pack of 30 + 160 + 160 +   + 160 + 160 + 160 + 4 + 320 + 160 +   + 1600 +
+ 6 + Nevirapine (NVP) 200mg + Pack of 60 + 160 + 160 + 160 + 160 + 160 + 160 + 2 + 960 + 160 + 160 + 3520 +
+ 7 + Atazanavir/Ritonavir (ATV/r) 300mg/100mg + Pack of 30 + 160 + 160 +   + 160 + 160 + 160 + 4 + 320 + 160 +   + 1600 +
+ 8 + Lopinavir/Ritonavir (LPV/r) 200mg/50mg + Pack of 120 + 160 + 160 +   + 160 + 160 + 160 + 4 + 320 +   +   + 320 +
+   + Drug Formulation and Strength + Pack Size + OPENING BALANCE at start of 2 Month Cycle + QUANTITY RECEIVED during 2 Month Cycle + PMTCT CONSUMPTION during 2 Month Cycle + ART
+ CONSUMPTION during 2 Month Cycle
+ LOSSES / ADJUSTMENTS ( + / - ) + CLOSING BALANCE (Physical Count Stores + Pharmacy) + MONTHS OF STOCK ON-HAND = F / ((C+D) / 2) + QUANTITY REQUIRED FOR CURRENT PATIENTS = (2 x (C+D) - F + ESTIMATED NO OF NEW ART PATIENTS for the Next Cycle + ESTIMATED
+ NO OF NEW HIV+ PREGNANT WOMEN for the Next Cycle
+ TOTAL QUANTITY TO BE ORDERED = G + (H * p * 4) + Notes
+ ADULT - FORMULATIONS + A + B + C + D + E + F + G + H + I + J + K +  
+ 9 + Zidovudine (AZT) 300mg + Pack of 60 + 160 + 160 + 160 +   + 160 + 130 + 3.2 + 380 +   + 70 + 940 +
+ 10 + Lamivudine (3TC) 150mg + Pack of 60 + 130 + 130 +   + 130 + 130 + 130 + 4 + 260 + 70 +   + 820 +
+ 11 + Abacavir (ABC) 300mg + Pack of 60 + 60 + 60 +   + 60 + 60 + 60 + 4 + 120 + +   + 120 +
+ 12 + Abacavir/Lamivudine (ABC/3TC) 600mg/300mg + Pack of 30 + 60 + 60 +   + 60 + 60 + 60 + 4 + 120 + +   + 120 +
+   + Drug Formulation and Strength + Pack Size + OPENING BALANCE at start of 2 Month Cycle + QUANTITY RECEIVED during 2 Month Cycle + PMTCT CONSUMPTION during 2 Month Cycle + ART CONSUMPTION during 2 Month Cycle + LOSSES / ADJUSTMENTS ( + / - ) + CLOSING BALANCE (Physical Count Stores + Pharmacy) + MONTHS OF STOCK ON-HAND = F / ((C+D) / 2) + QUANTITY REQUIRED FOR CURRENT PATIENTS = (2 x (C+D) - F + ESTIMATED NO OF NEW ART PATIENTS for the Next Cycle + ESTIMATED
+ NO OF NEW HIV+ PREGNANT WOMEN for the Next Cycle
+ TOTAL QUANTITY TO BE ORDERED = G + (H * p * 4) + Notes
+ PAEDIATRIC - RECOMMENDED FORMULATIONS + A + B + C + D + E + F + G + H + I + J + K +  
+ 1 + Zidovudine/Lamivudine/Nevirapine (AZT/3TC/NVP) 60mg/30mg/50mg + Pack of 60 + + +   + + + + 0 + 0 + +   + 0 +
+ 2 + Zidovudine/Lamivudine (AZT/3TC) 60mg/30mg + Pack of 60 + + +   + + + + 0 + 0 + +   + 0 +
+ 3 + Abacavir/Lamivudine (ABC/3TC) 60mg/30mg + Pack of 60 + + +   + + + + 0 + 0 + +   + 0 +
+ 4 + Abacavir (ABC) 60mg + Pack of 60 + + +   + + + + 0 + 0 + +   + 0 +
+ 5 + Efavirenz (EFV) 200mg + Pack of 90 + + +   + + + + 0 + 0 + +   + 0 +
+ 6 + Nevirapine (NVP) 50mg + Pack of 60 + + +   + + + + 0 + 0 + +   + 0 +
+ 7 + Lopinavir/Ritonavir (LVP/r) 80mg/20ml oral susp. + Bottle 60 ml + + +   + + + + 0 + 0 + +   + 0 +
+ 8 + Lopinavir/Ritonavir (LVP/r) 100mg/25mg + Pack of 60 + + +   + + + + 0 + 0 + +   + 0 +
+ 9 + Efavirenz (EFV) 50mg + Pack of 30 + + +   + + + + 0 + 0 + +   + 0 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ Joint Medical Store (Global Fund)

+
+
+   + Drug Formulation and Strength + Pack Size + OPENING BALANCE at start of 2 Month Cycle + QUANTITY RECEIVED during 2 Month Cycle + PMTCT CONSUMPTION during 2 Month Cycle + ART CONSUMPTION during 2 Month Cycle + LOSSES / ADJUSTMENTS ( + / - ) + CLOSING BALANCE (Physical Count in Stores + Pharmacy) + MONTHS OF STOCK ON-HAND = F / ((C+D) / 2) + QUANTITY REQUIRED FOR CURRENT PATIENTS
+ = (2 x (C+D) - F
+ ESTIMATED NUMBER OF ART NEW ART PATIENTS for the Next Cycle + ESTIMATED
+ NO OF NEW HIV+ PREGNANT WOMEN for the Next Cycle
+ TOTAL QUANTITY TO BE ORDERED = G + (H * p * 4) + Notes
+ PAEDIATRIC - FORMULATIONS + A + B + C + D + E + F + G + H + I + J + K +  
+ 10 + Stavudine/Lamivudine/Nevirapine (D4T/3TC/NVP) 6mg/30mg/50mg + Pack of 60 + + +   + + + + 0 + 0 +   +   + 0 +
+ 11 + Stavudine/Lamivudine (D4T/3TC) 6mg/30mg + Pack of 60 + + +   + + + + 0 + 0 +   +   + 0 +
+ 12 + Stavudine/Lamivudine/Nevirapine (D4T/3TC/NVP) 12mg/30mg/100mg + Pack of 60 + + +   + + + + 0 + 0 +   +   + 0 +
+ PMTCT ONLY FORMULATIONS +   +   +   +   +   +   +   +   +   +   +   +  
+ 1 + Nevirapine (NVP) 10mg/ml oral susp. + Bottle 100 ml + + + +   + + + 0 + 0 +   + + 0 +
+   + Drug Formulation and Strength + Pack Size + OPENING BALANCE at start of 2 Month Cycle + QUANTITY RECEIVED during 2 Month Cycle + PMTCT CONSUMPTION during 2 Month Cycle + ART CONSUMPTION during 2 Month Cycle + LOSSES / ADJUSTMENTS ( + / - ) + CLOSING BALANCE (Physical Count Stores + Pharmacy) + MONTHS OF STOCK ON-HAND = F / ((C+D) / 2) + QUANTITY REQUIRED FOR CURRENT PATIENTS 
+ = (2 x (C+D) - F
+ ESTIMATED NO OF NEW ART PATIENTS for the Next Cycle + ESTIMATED
+ NO OF NEW HIV+ PREGNANT WOMEN for the Next Cycle
+ TOTAL QUANTITY TO BE ORDERED = G + (H * p * 4) + Notes
+ OTHER FORMULATIONS + A + B + C + D + E + F + G + H + I + J + K +  
+ 1 + Sulfamethoxazole/Trimethoprim (Cotrimoxazole) 800mg/160mg + Pack of 1000 + + + + + + + 0 + 0 + + + 0 +
+ 2 + Sulfamethoxazole/Trimethoprim (Cotrimoxazole) 100mg/20mg + Pack of 1000 + + + + + + + 0 + 0 + + + 0 +
+ 3 + Fluconazole (FL) 200mg + Pack of 28 + + + + + + + 0 + 0 + + + 0 +
+ 4 + Fluconazole (FL) oral solution + Bottle 35 ml + + + + + + + 0 + 0 + + + 0 +
+ 5 + Fluconazole (FL) IV + IV 100 ml + + + + + + + 0 + 0 + + + 0 +
+ 6 + Dapsone 100mg + Pack of 1000 + + + + + + + 0 + 0 + + + 0 +
+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ Patients Treated With Fluconazole

+
+
+   + Patients treated for the following: + Adults + Children
+ 1 + Acute cryptococcal meningitis + 160 + 160
+ 2 + Cryptococcal meningitis patients treated on maintenance therapy + 160 + 160
+ 3 + Esophageal candidiasis + 160 + 160
+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ PMTCT Patients

+
+
+   + PMTCT Patients by Regimen + Existing + New
+ 1 + TDF/3TC/EFV + 160 + 160
+ 2 + TDF/3TC/NVP + 160 + 160
+ 3 + AZT/3TC/NVP + 160 + 160
+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ Adult ART Patients

+
+
+   + 1st Line Regiments + Existing + New
+ 1 + TDF/3TC/NVP + 160 + 160
+ 2 + TDF/3TC/EFV + 100 + 100
+ 3 + AZT/3TC/NVP + 100 + 110
+ 4 + AZT/3TC/EFV + 110 + 100
+ 5 + ABC/3TC/NVP + 91 + 91
+ 6 + ABC/3TC/EFV + 91 + 91
+   + 2nd Line Regiments + Existing + New
+ 1 + TDF/3TC/ATV/r + 91 + 91
+ 2 + TDF/3TC/LPV/r + 91 +  
+ 3 + AZT/3TC/ATV/r + 91 + 90
+ 4 + AZT/3TC/LPV/r + 91 +  
+   + Summary + Existing + New
+   + TOTAL ADULT PATIENTS + 2032 + 1666
+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ Paediatric ART Patients (14 years and below)

+
+
+   + 1st Line Regiments + Existing + New
+ 1 + AZT/3TC/NVP + 92 + 92
+ 2 + AZT/3TC/EFV + 91 + 91
+ 3 + ABC/3TC/NVP + 100 + 100
+ 4 + ABC/3TC/EFV + 110 + 110
+ 5 + D4T/3TC/NVP + 140 +  
+ 6 + D4T/3TC/EFV + 140 +  
+   + 2nd Line Regiments + Existing + New
+ 1 + AZT/3TC/LPV/r + 160 + 160
+ 2 + ABC/3TC/LPV/r + 190 + 190
+ 3 + D4T/3TC/LPV/r + 91 + 91
+   + Summary + Existing + New
+   + TOTAL PAEDIATRIC PATIENTS + 2228 + 1668
+

+ P is defined as the number of packs per patient per month

+ +
\ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2012-10-01 15:58:02 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2012-10-18 19:13:26 +0000 @@ -253,7 +253,7 @@ { if ( type != null ) { - grid = dataSetReportService.getDefaultDataSetReport( selectedDataSet, selectedPeriod, selectedOrgunit, selectedUnitOnly, format, i18n ); + grids = dataSetReportService.getCustomDataSetReportAsGrid( selectedDataSet, selectedOrgunit, selectedPeriod, selectedUnitOnly, format ); } else { === modified file 'dhis-2/pom.xml' --- dhis-2/pom.xml 2012-09-23 15:49:44 +0000 +++ dhis-2/pom.xml 2012-10-18 19:13:26 +0000 @@ -735,6 +735,11 @@ 1.1.3.4.O runtime + + org.htmlparser + htmlparser + 2.1 +