=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet' === removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetPdfService.java 1970-01-01 00:00:00 +0000 @@ -1,233 +0,0 @@ -package org.hisp.dhis.tallysheet; - -/* - * 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.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.util.List; - -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.system.util.PDFUtils; - -import com.lowagie.text.Document; -import com.lowagie.text.DocumentException; -import com.lowagie.text.Element; -import com.lowagie.text.Font; -import com.lowagie.text.PageSize; -import com.lowagie.text.Paragraph; -import com.lowagie.text.pdf.PdfPCell; -import com.lowagie.text.pdf.PdfPTable; -import com.lowagie.text.pdf.PdfWriter; - -/** - * @author Haavard Tegelsrud, Oddmund Stroemme, Joergen Froeysadal, Ruben - * Wangberg - * @version $Id$ - */ -public class DefaultTallySheetPdfService - implements TallySheetPdfService -{ - //TODO this class must be improved and use PdfUtils - - private static Font headerFont; - - private static Font tableFont; - - // ------------------------------------------------------------------------- - // Logic - // ------------------------------------------------------------------------- - - public InputStream createTallySheetPdf( TallySheet tallySheet, I18n i18n ) - { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - InputStream inputStream = null; - Document document = new Document(); - String facilityName = ""; - - boolean a3Format = tallySheet.isA3Format(); - - if ( tallySheet.isDisplayFacilityName() ) - { - facilityName = tallySheet.getFacilityName(); - } - - try - { - document.setPageSize( a3Format ? PageSize.A3 : PageSize.A4 ); - PdfWriter.getInstance( document, outputStream ); - - writeMetadata( document, tallySheet.getTallySheetName(), i18n ); - - document.open(); - initFont(); - writeHeader( document, tallySheet.getTallySheetName(), facilityName, i18n ); - writeLines( document, tallySheet.getTallySheetTuples(), a3Format, tallySheet.getRowWidth() ); - document.close(); - - inputStream = new ByteArrayInputStream( outputStream.toByteArray() ); - } - catch ( DocumentException e ) - { - e.printStackTrace(); - } - - return inputStream; - } - - private void writeMetadata( Document document, String title, I18n i18n ) - { - document.addTitle( title ); - document.addAuthor( "DHIS 2" ); - - if ( i18n != null ) - { - document.addSubject( i18n.getString( "tally_sheet_report" ) ); - } - - document.addKeywords( "tallysheet, health, data, tally sheet" ); - document.addCreator( "DHIS 2" ); - } - - private void writeHeader( Document document, String header, String facilityName, I18n i18n ) - throws DocumentException - { - document.add( new Paragraph( header, headerFont ) ); - - if ( i18n != null ) - { - document.add( new Paragraph( i18n.getString( "facility" ) + ": " + facilityName, headerFont ) ); - document.add( new Paragraph( i18n.getString( "month" ) + ": ", headerFont ) ); - document.add( new Paragraph( i18n.getString( "year" ) + ": ", headerFont ) ); - - Paragraph totalParagraph = new Paragraph( i18n.getString( "total" ) + ": ", headerFont ); - totalParagraph.setAlignment( "right" ); - totalParagraph.setIndentationRight( 10 ); - totalParagraph.setSpacingAfter( 2 ); - document.add( totalParagraph ); - } - } - - private void writeLines( Document document, List tallySheetTuples, boolean a3Format, int rowWidth ) - throws DocumentException - { - double a4Multiplier = (PageSize.A3.getWidth() / PageSize.A4.getWidth()) * 1.1; - float[] widths = { 0.2f, 0.55f, 0.05f }; - - if ( !a3Format ) - { - widths[0] = (float) (widths[0] * a4Multiplier); - widths[2] = (float) (widths[2] * a4Multiplier); - widths[1] = 1f - widths[0] - widths[2]; - } - - PdfPTable table = new PdfPTable( widths ); - table.setWidthPercentage( 100 ); - - DataElement dataElement; - - for ( TallySheetTuple tallySheetTuple : tallySheetTuples ) - { - dataElement = tallySheetTuple.getDataElement(); - int rows = tallySheetTuple.getNumberOfRows(); - if ( tallySheetTuple.isChecked() && rows > 0 ) - { - table.addCell( createNameCell( dataElement.getName(), tableFont ) ); - table.addCell( createCellsCell( rows, tableFont, rowWidth ) ); - table.addCell( createTotalBoxCell( tableFont ) ); - } - } - document.add( table ); - } - - private PdfPCell createNameCell( String elementName, Font font ) - { - PdfPCell nameCell = new PdfPCell( new Paragraph( elementName, font ) ); - nameCell.setBorderWidth( 0 ); - nameCell.setBorderWidthTop( (float) 0.5 ); - nameCell.setHorizontalAlignment( Element.ALIGN_LEFT ); - return nameCell; - } - - private PdfPCell createCellsCell( int rows, Font font, int rowWidth ) - { - StringBuilder cellRows = new StringBuilder(); - - for ( int i = 0; i < rows; i++ ) - { - if ( i > 0 ) - { - cellRows.append( "\n" ); - } - - for ( int j = 0; j < rowWidth; j++ ) - { - if ( j % 5 == 0 ) - { - cellRows.append( " " ); - } - - if ( j != 0 && j % 25 == 0 ) - { - cellRows.append( " " ); - } - - cellRows.append( "0" ); - } - } - - Paragraph cellParagraph = new Paragraph( cellRows.toString(), font ); - PdfPCell cellCell = new PdfPCell( cellParagraph ); - cellCell.setBorderWidth( 0 ); - cellCell.setBorderWidthTop( (float) 0.5 ); - cellCell.setHorizontalAlignment( Element.ALIGN_RIGHT ); - cellCell.setPaddingBottom( 4 ); - return cellCell; - } - - private PdfPCell createTotalBoxCell( Font font ) - { - PdfPCell boxCell = new PdfPCell(); - PdfPTable totalTable = new PdfPTable( 1 ); - PdfPCell totalCell = new PdfPCell(); - totalCell.setBorderWidth( (float) 0.5 ); - totalCell.setFixedHeight( (float) (font.getCalculatedSize() * 1.2) ); - totalTable.addCell( totalCell ); - boxCell.addElement( totalTable ); - boxCell.setBorderWidth( 0 ); - boxCell.setBorderWidthTop( (float) 0.5 ); - return boxCell; - } - - private void initFont() - { - headerFont = PDFUtils.getBoldFont( 12 ); - tableFont = PDFUtils.getFont( 8 ); - } -} === removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetService.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetService.java 1970-01-01 00:00:00 +0000 @@ -1,140 +0,0 @@ -package org.hisp.dhis.tallysheet; - -/* - * 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.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; - -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DataValueService; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.period.PeriodType; - -/** - * @author Haavard Tegelsrud, Oddmund Stroemme, Joergen Froeysadal, Ruben - * Wangberg - * @version $Id$ - */ -public class DefaultTallySheetService - implements TallySheetService -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataValueService dataValueService; - - public void setDataValueService( DataValueService dataValueService ) - { - this.dataValueService = dataValueService; - } - - // ------------------------------------------------------------------------- - // TallySheetService implementation - // ------------------------------------------------------------------------- - - // ------------------------------------------------------------------------- - // Logic - // ------------------------------------------------------------------------- - - public TallySheet createTallySheet( OrganisationUnit organisationUnit, List dataElements, - boolean a3Format, boolean displayFacilityName, DataSet selectedDataSet, String tallySheetName ) - { - PeriodType periodType = selectedDataSet.getPeriodType(); - - Collection dataValues = new HashSet(); - - for ( DataElement dataElement : dataElements ) - { - - DataValue dataValue = dataValueService.getLatestDataValues( dataElement, periodType, organisationUnit ); - - if ( dataValue != null ) - { - dataValues.add( dataValue ); - } - - } - - return internalCreateTallySheet( organisationUnit, dataElements, dataValues, a3Format, displayFacilityName, - tallySheetName ); - } - - // ------------------------------------------------------------------------- - // Supportive methods - // ------------------------------------------------------------------------- - - private TallySheet internalCreateTallySheet( OrganisationUnit organisationUnit, List dataElements, - Collection dataValues, boolean a3Format, boolean displayFacilityName, String tallySheetName ) - { - TallySheet tallySheet = new TallySheet(); - - tallySheet.setTallySheetName( tallySheetName ); - tallySheet.setA3Format( a3Format ); - tallySheet.setDisplayFacilityName( displayFacilityName ); - tallySheet.setOrganisationUnit( organisationUnit ); - - List tallySheetTuples = new ArrayList(); - - for ( DataElement dataElement : dataElements ) - { - int calculatedNumberOfElements = 0; - - for ( DataValue dataValue : dataValues ) - { - - if ( dataValue.getSource().equals( organisationUnit ) - && dataValue.getDataElement().equals( dataElement ) ) - { - try - { - calculatedNumberOfElements = Integer.parseInt( dataValue.getValue() ); - } - catch ( NumberFormatException e ) - { - continue; - } - - break; - } - } - - TallySheetTuple tallySheetTuple = new TallySheetTuple(); - tallySheetTuple.setTallySheetTuple( calculatedNumberOfElements, dataElement, tallySheet.getRowWidth() ); - tallySheetTuples.add( tallySheetTuple ); - } - - tallySheet.setTallySheetTuples( tallySheetTuples ); - - return tallySheet; - } -} === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-02-02 20:01:36 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-02-05 13:28:15 +0000 @@ -233,14 +233,6 @@ - - - - - - - - === removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/tallysheet' === removed file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/tallysheet/TallySheetServiceTest.java' --- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/tallysheet/TallySheetServiceTest.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/tallysheet/TallySheetServiceTest.java 1970-01-01 00:00:00 +0000 @@ -1,86 +0,0 @@ -package org.hisp.dhis.tallysheet; - -/* - * 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 static junit.framework.Assert.assertNotNull; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import org.hisp.dhis.DhisSpringTest; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.period.MonthlyPeriodType; -import org.junit.Test; - -/** - * @author Haavard Tegelsrud, Oddmund Stroemme, Joergen Froeysadal, Ruben - * Wangberg - * @version $Id$ - */ -public class TallySheetServiceTest - extends DhisSpringTest -{ - private TallySheetService tallySheetService; - - private TallySheetPdfService tallySheetPdfService; - - @Override - public void setUpTest() - { - tallySheetService = (TallySheetService) getBean( TallySheetService.ID ); - - tallySheetPdfService = (TallySheetPdfService) getBean( TallySheetPdfService.ID ); - } - - @Test - public void testCreateTallySheet() - { - List dataElements = new ArrayList(); - - TallySheet tallySheet = tallySheetService.createTallySheet( createOrganisationUnit( 'A' ), dataElements, false, - true, createDataSet( 'A', new MonthlyPeriodType() ), "DHIS 2" ); - - assertNotNull( tallySheet ); - } - - @Test - public void testCreateTallySheetPdf() - { - List dataElements = new ArrayList(); - - TallySheet tallySheet = tallySheetService.createTallySheet( createOrganisationUnit( 'A' ), dataElements, false, - true, createDataSet( 'A', new MonthlyPeriodType() ), "DHIS 2" ); - - assertNotNull( tallySheet ); - - InputStream in = tallySheetPdfService.createTallySheetPdf( tallySheet, null ); - - assertNotNull( in ); - } -} === removed file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/tallysheetgenerator.png' Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/tallysheetgenerator.png 2010-06-19 15:32:24 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/tallysheetgenerator.png 1970-01-01 00:00:00 +0000 differ === removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet' === removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action' === removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/GenerateTallySheetAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/GenerateTallySheetAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/GenerateTallySheetAction.java 1970-01-01 00:00:00 +0000 @@ -1,140 +0,0 @@ -package org.hisp.dhis.reporting.tallysheet.action; - -/* - * 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.io.InputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.tallysheet.TallySheet; -import org.hisp.dhis.tallysheet.TallySheetPdfService; -import org.hisp.dhis.tallysheet.TallySheetTuple; - -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionContext; - -/** - * @author Haavard Tegelsrud, Oddmund Stroemme, Joergen Froeysadal, Ruben - * Wangberg - * @version $Id$ - */ -public class GenerateTallySheetAction - implements Action -{ - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private int[] rows; - - public void setRows( int[] rows ) - { - this.rows = rows; - } - - private boolean[] checked; - - public void setChecked( boolean[] checked ) - { - this.checked = checked; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private String fileName; - - public String getFileName() - { - return fileName; - } - - private InputStream inputStream; - - public InputStream getInputStream() - { - return inputStream; - } - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private TallySheetPdfService tallySheetPdfService; - - public void setTallySheetPdfService( TallySheetPdfService tallySheetPdfService ) - { - this.tallySheetPdfService = tallySheetPdfService; - } - - // ------------------------------------------------------------------------- - // I18n - // ------------------------------------------------------------------------- - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - TallySheet tallySheet = (TallySheet) ActionContext.getContext().getSession().get( TallySheet.KEY_TALLY_SHEET ); - - if ( tallySheet != null ) - { - List tallySheetTuples = tallySheet.getTallySheetTuples(); - - for ( int i = 0; i < checked.length; i++ ) - { - TallySheetTuple tallySheetTuple = tallySheetTuples.get( i ); - tallySheetTuple.setChecked( checked[i] ); - tallySheetTuple.setNumberOfRows( rows[i] ); - } - - Date today = new java.util.Date(); - DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" ); - String timestamp = dateFormat.format( today ); - - fileName = timestamp + "_" + tallySheet.getTallySheetName() + ".pdf"; - inputStream = tallySheetPdfService.createTallySheetPdf( tallySheet, i18n ); - } - - return SUCCESS; - } -} === removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/SelectTallySheetAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/SelectTallySheetAction.java 2012-01-25 17:11:43 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/SelectTallySheetAction.java 1970-01-01 00:00:00 +0000 @@ -1,82 +0,0 @@ -package org.hisp.dhis.reporting.tallysheet.action; - -/* - * 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.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Haavard Tegelsrud, Oddmund Stroemme, Joergen Froeysadal, Ruben Wangberg - * @version $Id$ - */ -public class SelectTallySheetAction - implements Action -{ - // ------------------------------------------------------------------------- - // Parameters - // ------------------------------------------------------------------------- - - private List dataSets = new ArrayList(); - - public Collection getDataSets() - { - return dataSets; - } - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - dataSets = new ArrayList( dataSetService.getAllDataSets() ); - Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE ); - - return SUCCESS; - } -} === removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/ViewTallySheetAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/ViewTallySheetAction.java 2012-01-25 17:11:43 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tallysheet/action/ViewTallySheetAction.java 1970-01-01 00:00:00 +0000 @@ -1,202 +0,0 @@ -package org.hisp.dhis.reporting.tallysheet.action; - -/* - * 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.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.oust.manager.SelectionTreeManager; -import org.hisp.dhis.tallysheet.TallySheet; -import org.hisp.dhis.tallysheet.TallySheetService; -import org.hisp.dhis.tallysheet.TallySheetTuple; - -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionContext; - -/** - * @author Haavard Tegelsrud, Oddmund Stroemme, Joergen Froeysadal, Ruben - * Wangberg - * @version $Id$ - */ -public class ViewTallySheetAction - implements Action -{ - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private String tallySheetName; - - public void setTallySheetName( String tallySheetName ) - { - this.tallySheetName = tallySheetName; - } - - private boolean largeFormat; - - public void setLargeFormat( boolean largeFormat ) - { - this.largeFormat = largeFormat; - } - - private boolean displayFacilityName; - - public void setDisplayFacilityName( boolean displayFacilityName ) - { - this.displayFacilityName = displayFacilityName; - } - - private Integer selectedDataSetId; - - public void setSelectedDataSetId( Integer selectedDataSetId ) - { - this.selectedDataSetId = selectedDataSetId; - } - - private double factor = 1; - - public double getFactor() - { - return factor; - } - - public void setFactor( double factor ) - { - this.factor = factor; - } - - private boolean[] checked; - - public void setChecked( boolean[] checked ) - { - this.checked = checked; - } - - private boolean recalculate = false; - - public void setRecalculate( boolean recalculate ) - { - this.recalculate = recalculate; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private TallySheet tallySheet; - - public TallySheet getTallySheet() - { - return tallySheet; - } - - private List tallySheetTuples; - - public List getTallySheetTuples() - { - return tallySheetTuples; - } - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private TallySheetService tallySheetService; - - public void setTallySheetService( TallySheetService tallySheetService ) - { - this.tallySheetService = tallySheetService; - } - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - private SelectionTreeManager selectionTreeManager; - - public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) - { - this.selectionTreeManager = selectionTreeManager; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - private ArrayList dataElements; - - private OrganisationUnit organisationUnit; - - private DataSet selectedDataSet; - - public String execute() - throws Exception - { - if ( recalculate ) - { - tallySheet = (TallySheet) ActionContext.getContext().getSession().get( TallySheet.KEY_TALLY_SHEET ); - - if ( tallySheet != null ) - { - tallySheetTuples = tallySheet.getTallySheetTuples(); - - for ( int i = 0; i < checked.length; i++ ) - { - TallySheetTuple tallySheetTuple = tallySheetTuples.get( i ); - tallySheetTuple.setChecked( checked[i] ); - tallySheetTuple.recalculateRows( factor ); - } - } - - return SUCCESS; - } - - organisationUnit = selectionTreeManager.getSelectedOrganisationUnit(); - selectedDataSet = dataSetService.getDataSet( selectedDataSetId ); - dataElements = new ArrayList( dataSetService.getDataElements( selectedDataSet ) ); - Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE ); - - tallySheet = tallySheetService.createTallySheet( organisationUnit, dataElements, largeFormat, - displayFacilityName, selectedDataSet, tallySheetName ); - - tallySheetTuples = tallySheet.getTallySheetTuples(); - - ActionContext.getContext().getSession().put( TallySheet.KEY_TALLY_SHEET, tallySheet ); - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-01-05 20:39:23 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-02-05 13:28:15 +0000 @@ -231,25 +231,6 @@ - - - - - - - - - - - - - - - - === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-12-22 21:17:05 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2012-02-05 13:28:15 +0000 @@ -265,34 +265,7 @@ - - - - - /main.vm - 420 - /dhis-web-reporting/selectTallySheetForm.vm - /dhis-web-reporting/menu.vm - ../dhis-web-commons/oust/oust.js,javascript/tallySheet.js - - - - /main.vm - 420 - /dhis-web-reporting/viewTallySheetForm.vm - /dhis-web-reporting/menu.vm - ../dhis-web-commons/oust/oust.js,javascript/tallySheet.js - - - - - application/pdf - inputStream - filename="${fileName}" - 1024 - - - + === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/index.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/index.vm 2011-12-22 21:17:05 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/index.vm 2012-02-05 13:28:15 +0000 @@ -13,7 +13,6 @@ #introListImgItem( "displayViewDataCompletenessForm.action" "reporting_rate_summary" "reportingratesummary" ) #introListImgItem( "displayViewDocumentForm.action" "resource" "resource" ) #introListImgItem( "displayOrgUnitDistribution.action" "orgunit_distribution_report" "distribution" ) - #introListImgItem( "tallySheetGenerator.action" "tally_sheet_generator" "tallysheetgenerator" ) #introListImgItem( "displayManageTableForm.action" "report_table" "reporttable" ) #introListImgItem( "displayPivotTableForm.action" "pivot_table" "pivottable" ) === removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/tallySheet.js' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/tallySheet.js 2011-08-19 21:33:57 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/tallySheet.js 1970-01-01 00:00:00 +0000 @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------------- -// Step 1 functions -//---------------------------------------------------------------------------- - -function continueToStepTwo() -{ - if ( validateData() ) - { - setHeaderWaitMessage( i18n_processing + "..." ); - byId( "tallySheetForm" ).submit(); - } -} - -// ----------------------------------------------------------------------------- -// Step 2 functions -// ---------------------------------------------------------------------------- - -function setChecked( id ) -{ - var value = byId( "checkbox" + id ).checked; - byId( "checked" + id ).value = value; - - if ( value == true ) - { - if ( byId( "rows" + id ).value == 0 ) - { - byId( "rows" + id ).value = 1; - } - } -} - -function doRecalculate() -{ - byId( 'recalculate' ).value = true; - byId( 'configureTallySheetForm' ).submit(); -} - -function selectAll() -{ - var length = document.configureTallySheetForm.checkbox.length; - - for ( var i = 0; i < length; i++ ) - { - document.configureTallySheetForm.checkbox[i].checked = true; - document.configureTallySheetForm.checked[i].value = true; - if ( document.configureTallySheetForm.rows[i].value == 0 ) - { - document.configureTallySheetForm.rows[i].value = 1; - } - } -} - -function selectNone() -{ - var length = document.configureTallySheetForm.checkbox.length; - - for ( var i = 0; i < length; i++ ) - { - document.configureTallySheetForm.checkbox[i].checked = false; - document.configureTallySheetForm.checked[i].value = false; - } -} - -function generatePdf() -{ - byId( 'configureTallySheetForm' ).action = "generateTallySheetPDF.action"; - byId( 'configureTallySheetForm' ).submit(); - byId( 'configureTallySheetForm' ).action = "configureTallySheetGenerator.action"; -} - -// ----------------------------------------------------------------------------- -// Validation -// ---------------------------------------------------------------------------- - -var selectedOrganisationUnitIds = null; - -function setSelectedOrganisationUnitIds( ids ) -{ - selectedOrganisationUnitIds = ids; -} - -function validateData() -{ - var tallySheetName = byId( "tallySheetName" ).value; - - if ( !getListValue( "selectedDataSetId" ) || getListValue( "selectedDataSetId" ) == "null" ) - { - setHeaderDelayMessage( i18n_select_data_set ); - return false; - } - - if ( !tallySheetName ) - { - setHeaderDelayMessage( i18n_type_tally_sheet_name ); - return false; - } - - if ( selectedOrganisationUnitIds == null || selectedOrganisationUnitIds.length == 0 ) - { - setHeaderDelayMessage( i18n_select_organisation_unit ); - return false; - } - - return true; -} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm 2011-12-22 21:17:05 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm 2012-02-05 13:28:15 +0000 @@ -6,11 +6,6 @@
  • $i18n.getString( "reporting_rate_summary" ) 
  • $i18n.getString( "resource" ) 
  • $i18n.getString( "organisation_unit_report" ) 
  • -
  • $i18n.getString( "tally_sheet_generator" ) 
  • $i18n.getString( "report_table" ) 
  • - - -

    $i18n.getString( "pivot_table" ) 

    - === removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTallySheetForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTallySheetForm.vm 2011-03-28 20:09:32 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTallySheetForm.vm 1970-01-01 00:00:00 +0000 @@ -1,52 +0,0 @@ -

    $i18n.getString( "tally_sheet_generator" )

    - -
    - - - - - - - - - - - -
    $i18n.getString( "tally_sheet_step2" )
    -
    - - - - - - - #foreach( $tallySheetTuple in $tallySheetTuples ) - - - - - - #end -
    $i18n.getString("data_element")$i18n.getString("select")$i18n.getString("tally_rows")
    - $tallySheetTuple.getDataElement().getName() - - - - - -
    -
    -
    -
    - $i18n.getString( "edit_tally_rows" ) -
    - Factor
    -
    - -
    - -
    - - -
    -