=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/reports/action/GenerateJRXMLReportAction.java' --- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/reports/action/GenerateJRXMLReportAction.java 2012-08-17 10:21:10 +0000 +++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/reports/action/GenerateJRXMLReportAction.java 2012-09-06 07:02:12 +0000 @@ -203,53 +203,12 @@ } // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private Grid grid; - - public Grid getGrid() - { - return grid; - } - - private Map params = new HashMap(); - - public Map getParams() - { - return params; - } - - // ------------------------------------------------------------------------- // Result implementation // ------------------------------------------------------------------------- - private InputStream fileStream; - - public void setFileStream( InputStream arg ) - { - fileStream = arg; - } - - public InputStream getFileStream() - { - return fileStream; - } - - private String ReportPath; - - public String getReportPath() - { - return ReportPath; - } - - public void setReportPath( String reportPath ) - { - ReportPath = reportPath; - } - + @Override public String execute() - throws Exception + throws Exception,JRException { Connection con = jdbcTemplate.getDataSource().getConnection(); String fileName = null; @@ -260,8 +219,7 @@ String orgUnitIdsByComma = ccemReportManager.getOrgunitIdsByComma( selOrgUnitList, orgunitGroupList ); ccemReport = ccemReportManager.getCCEMReportByReportId( reportList ); Map ccemSettingsMap = new HashMap( ccemReportManager.getCCEMSettings() ); - List reportDesignList = new ArrayList( ccemReportManager - .getCCEMReportDesign( ccemReport.getXmlTemplateName() ) ); + List reportDesignList = new ArrayList( ccemReportManager.getCCEMReportDesign( ccemReport.getXmlTemplateName() ) ); String oName = null; String oUnitGrpName = null; @@ -362,8 +320,7 @@ jasperPrint = JasperFillManager.fillReport( jasperReport, hash, con ); } else if ( ccemReport.getReportType().equals( CCEMReport.ORGUNITGROUP_DATAVALUE ) ) - { - ccemReportOutput = new CCEMReportOutput(); + { List tableHeadings = new ArrayList(); List> tableSubHeadings = new ArrayList>(); List tableData = new ArrayList(); @@ -476,6 +433,7 @@ } } frb.setTemplateFile( path + "ORGUNITGROUP_DATAVALUE.jrxml" ); + frb.setPrintBackgroundOnOddRows(true); for ( Integer orgUnitGroupId : orgunitGroupList ) { Map numberOfData = new HashMap(); @@ -513,7 +471,7 @@ JRDataSource ds = new JRMapCollectionDataSource( tableData ); DynamicReport dynamicReport = frb.build(); - dynamicReport.getOptions().getDefaultDetailStyle().setBackgroundColor( Color.BLUE ); + dynamicReport.getOptions().getOddRowBackgroundStyle().setBackgroundColor( Color.decode( "#F5F5F6" ) ); dynamicReport.getOptions().getDefaultHeaderStyle().setBorder( Border.THIN() ); dynamicReport.getOptions().getDefaultHeaderStyle().setHorizontalAlign( HorizontalAlign.CENTER ); dynamicReport.getOptions().getDefaultDetailStyle().setBorder( Border.THIN() ); @@ -524,8 +482,7 @@ } else if ( ccemReport.getReportType().equals( CCEMReport.ORGUNIT_EQUIPMENT_ROUTINE_DATAVALUE ) ) - { - ccemReportOutput = new CCEMReportOutput(); + { List tableHeadings = new ArrayList(); List> tableSubHeadings = new ArrayList>(); List oneSubHeadingRow = new ArrayList(); @@ -707,8 +664,7 @@ for ( OrganisationUnit orgUnit : orgUnitList ) { - Map numberOfData = new HashMap(); - List oneTableDataRow = new ArrayList(); + Map numberOfData = new HashMap(); String orgUnitBranch = ""; if ( orgUnit.getParent() != null ) { @@ -725,8 +681,7 @@ for ( CCEMReportDesign ccemReportDesign1 : reportDesignList ) { String ccemCellContent1 = ccemSettingsMap.get( ccemReportDesign1.getContent() ); - Integer dataElementId = Integer.parseInt( ccemCellContent1.split( ":" )[0] ); - Integer optComboId = Integer.parseInt( ccemCellContent1.split( ":" )[1] ); + Integer dataElementId = Integer.parseInt( ccemCellContent1.split( ":" )[0] ); for ( Period period : periodList ) { @@ -748,9 +703,10 @@ } frb.setTemplateFile( path + "ORGUNIT_EQUIPMENT_ROUTINE_DATAVALUE.jrxml" ); + frb.setPrintBackgroundOnOddRows(true); JRDataSource ds = new JRMapCollectionDataSource( tableData ); DynamicReport dynamicReport = frb.build(); - dynamicReport.getOptions().getDefaultDetailStyle().setBackgroundColor( Color.BLUE ); + dynamicReport.getOptions().getOddRowBackgroundStyle().setBackgroundColor( Color.decode( "#F5F5F6" ) ); dynamicReport.getOptions().getDefaultHeaderStyle().setBorder( Border.THIN() ); dynamicReport.getOptions().getDefaultHeaderStyle().setHorizontalAlign( HorizontalAlign.CENTER ); dynamicReport.getOptions().getDefaultDetailStyle().setBorder( Border.THIN() ); @@ -760,18 +716,11 @@ jasperPrint = JasperFillManager.fillReport( jr, hash, ds ); } else if ( ccemReport.getReportType().equals( CCEMReport.VACCINE_STORAGE_CAPACITY ) ) - { - ccemReportOutput = new CCEMReportOutput(); - List tableHeadings = new ArrayList(); - List> tableSubHeadings = new ArrayList>(); - List oneSubHeadingRow = new ArrayList(); + { List tableData = new ArrayList(); - List orgUnitList = new ArrayList(); - List orgUnitGroupMembers = new ArrayList(); - List content = new ArrayList(); - String orgUnitGroupIdsByComma = "-1"; - Map subHeadingNumber = new HashMap(); + List orgUnitGroupMembers = new ArrayList(); + String orgUnitGroupIdsByComma = "-1"; Integer periodId = 0; Date date2 = new Date(); Calendar calendar = Calendar.getInstance(); @@ -1112,12 +1061,7 @@ System.out.println( "Exception while calculating individualVaccineRequirement" ); individualVaccineRequirement = 0.0; } - - // System.out.println( vsReqUsageData - // +":"+vsReqTargetPopData +":"+vsReqDosesData - // +":"+vsReqPackedVolData +":"+ vsReqWastageData +":"+ - // vsReqSupplyIntervalData +":"+ vsReqReserveStockData ); - + vaccineRequirement += individualVaccineRequirement; } @@ -1177,15 +1121,14 @@ frb.setPrintColumnNames( true ); frb.setHeaderHeight( 100 ); frb.setColumnsPerPage( 1, 15 ).setUseFullPageWidth( true ); + frb.setPrintBackgroundOnOddRows(true); frb.setTemplateFile( path + "VACCINE_STORAGE_CAPACITY.jrxml" ); - Style oddRowStyle = new Style(); - oddRowStyle.setBorder( Border.NO_BORDER() ); - oddRowStyle.setBackgroundColor( Color.LIGHT_GRAY ); - oddRowStyle.setTransparency( Transparency.OPAQUE ); + JRDataSource ds = new JRMapCollectionDataSource( tableData ); - frb.setOddRowBackgroundStyle( oddRowStyle ); DynamicReport dynamicReport = frb.build(); dynamicReport.getOptions().getDefaultHeaderStyle().setBorder( Border.THIN() ); + //Color.LIGHT_GRAY + dynamicReport.getOptions().getOddRowBackgroundStyle().setBackgroundColor( Color.decode( "#F5F5F6" ) ); dynamicReport.getOptions().getDefaultHeaderStyle().setHorizontalAlign( HorizontalAlign.CENTER ); dynamicReport.getOptions().getDefaultDetailStyle().setBorder( Border.THIN() ); dynamicReport.getOptions().getDefaultDetailStyle().setHorizontalAlign( HorizontalAlign.CENTER ); @@ -1201,7 +1144,6 @@ { response.setContentType( "application/pdf" ); response.setHeader( "Content-Disposition", "inline; fileName=\"file.pdf\"" ); - exporter = new JRPdfExporter(); exporter.setParameter( JRExporterParameter.JASPER_PRINT, jasperPrint ); exporter.setParameter( JRExporterParameter.OUTPUT_STREAM, ouputStream ); @@ -1220,14 +1162,13 @@ exporter = new JRHtmlExporter(); exporter.setParameter( JRHtmlExporterParameter.OUTPUT_STREAM, false ); exporter.setParameter( JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, new Boolean( false ) ); - exporter.setParameter( JRExporterParameter.JASPER_PRINT, jasperPrint ); exporter.setParameter( JRExporterParameter.OUTPUT_STREAM, ouputStream ); } else if ( "xls".equalsIgnoreCase( type ) ) { response.setContentType( "application/xls" ); - response.setHeader( "Content-Disposition", "attachment; fileName=\"file.xls\"" ); + response.setHeader( "Content-Disposition", "inline; fileName=\"file.xls\"" ); exporter = new JRXlsExporter(); exporter.setParameter( JRExporterParameter.JASPER_PRINT, jasperPrint ); @@ -1242,7 +1183,7 @@ exporter.setParameter( JRExporterParameter.JASPER_PRINT, jasperPrint ); exporter.setParameter( JRExporterParameter.OUTPUT_STREAM, ouputStream ); } - con.close(); + con.close(); try { exporter.exportReport(); @@ -1251,20 +1192,7 @@ { throw new ServletException( e ); } - finally - { - if ( ouputStream != null ) - { - try - { - ouputStream.close(); - } - catch ( IOException ex ) - { - System.out.println( "exception thrown" ); - } - } - } + return SUCCESS; } === modified file 'local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties' --- local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-08-01 12:21:34 +0000 +++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-09-06 07:02:12 +0000 @@ -143,4 +143,12 @@ orgunit_group_list = Orgunit Group List selected_orgunit_list = Selected Orgunit List generate = Generate -orgunit_tree = Orgunit Tree \ No newline at end of file +orgunit_tree = Orgunit Tree +jrxml_reports = JRXML Report +output_type = Output type +rtf = RTF +html = HTML +xls = XLS +csv = CSV +text = TEXT +pdf = PDF \ No newline at end of file === modified file 'local/in/dhis-web-coldchain/src/main/resources/struts.xml' --- local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-08-17 10:21:10 +0000 +++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-09-06 07:02:12 +0000 @@ -582,7 +582,7 @@ /main.vm /dhis-web-coldchain/jrxmlReportsPage.vm - /dhis-web-coldchain/ccemReportMenu.vm + /dhis-web-coldchain/jrxmlReportMenu.vm ../dhis-web-commons/ouwt/ouwt.js,javascript/ccemReports.js @@ -610,8 +610,11 @@ --> - jrxmlReportsPage.action + /main.vm + /dhis-web-coldchain/menu.vm + /dhis-web-coldchain/welcome.vm + \ No newline at end of file === modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jrxmlReportsPage.vm' --- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jrxmlReportsPage.vm 2012-08-17 10:21:10 +0000 +++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jrxmlReportsPage.vm 2012-09-06 07:02:12 +0000 @@ -1,13 +1,11 @@ - - -

$i18n.getString( "ccem_reports_page" )

+

$i18n.getString( "jrxml_reports" )

-
+ #foreach( $ccemReport in $reportList ) #end @@ -18,7 +16,7 @@ $i18n.getString( "orgunit_tree" )
#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
- --> + --> @@ -37,10 +35,10 @@ @@ -68,16 +66,16 @@ - + @@ -92,11 +90,16 @@
$i18n.getString( "ccem_reports_list" )
$i18n.getString( "ccem_reports_period_list" ):
- $i18n.getString( "last_3months" ) - $i18n.getString( "current_year" )
- $i18n.getString( "last_6months" ) - $i18n.getString( "last_year" ) + $i18n.getString( "last_3months" ) + $i18n.getString( "current_year" )
+ $i18n.getString( "last_6months" ) + $i18n.getString( "last_year" )
 
Report Type
$i18n.getString( "output_type" )
- + + + + + +
- + + + + +
#parse( "/dhis-web-commons/loader/loader.vm" )
+
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm' --- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm 2012-07-24 05:31:29 +0000 +++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm 2012-09-06 07:02:12 +0000 @@ -20,5 +20,5 @@

$i18n.getString( "ccem_reports" )