package com.mellon.jasper.reporting.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import net.sf.jasperreports.engine.JRAbstractScriptlet;
import net.sf.jasperreports.engine.JRScriptletException;
public class test extends JRAbstractScriptlet{
@Override
public void afterColumnInit() throws JRScriptletException {
// TODO Auto-generated method stub
String jasperDate;
String fromDate = "02-JAN-13";
String toDate = "01-MAR-13";
String interest_rate;
interest_rate = (String) this.getFieldValue("interest_rate") + "000000";
jasperDate = (String) this.getFieldValue("book_date");
SimpleDateFormat format1 = new SimpleDateFormat("MM dd yyyy HH mm ss");
SimpleDateFormat format2 = new SimpleDateFormat("dd-MMM-yy");
Date date = null;
try {
date = format1.parse(jasperDate);
jasperDate = format2.format(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(jasperDate);
setVariableValue("jasperDate", new String(jasperDate).toUpperCase());
setVariableValue("interest_rate", new String(interest_rate));
setVariableValue("fromDate", new String(fromDate));
setVariableValue("toDate", new String(toDate));
}
@Override
public void afterDetailEval() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void afterGroupInit(String arg0) throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void afterPageInit() throws JRScriptletException {
}
@Override
public void afterReportInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforeColumnInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforeDetailEval() throws JRScriptletException {
// TODO Auto-generated method stub
// Float YearSalary = 0.00f;
// Float Salary;
//
// Salary = (Float)this.getFieldValue("Salary");
//
// YearSalary = Salary * 12;
// setVariableValue("YearSalary", new Float(YearSalary));
}
@Override
public void beforeGroupInit(String arg0) throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforePageInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforeReportInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
}
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import net.sf.jasperreports.engine.JRAbstractScriptlet;
import net.sf.jasperreports.engine.JRScriptletException;
public class test extends JRAbstractScriptlet{
@Override
public void afterColumnInit() throws JRScriptletException {
// TODO Auto-generated method stub
String jasperDate;
String fromDate = "02-JAN-13";
String toDate = "01-MAR-13";
String interest_rate;
interest_rate = (String) this.getFieldValue("interest_rate") + "000000";
jasperDate = (String) this.getFieldValue("book_date");
SimpleDateFormat format1 = new SimpleDateFormat("MM dd yyyy HH mm ss");
SimpleDateFormat format2 = new SimpleDateFormat("dd-MMM-yy");
Date date = null;
try {
date = format1.parse(jasperDate);
jasperDate = format2.format(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(jasperDate);
setVariableValue("jasperDate", new String(jasperDate).toUpperCase());
setVariableValue("interest_rate", new String(interest_rate));
setVariableValue("fromDate", new String(fromDate));
setVariableValue("toDate", new String(toDate));
}
@Override
public void afterDetailEval() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void afterGroupInit(String arg0) throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void afterPageInit() throws JRScriptletException {
}
@Override
public void afterReportInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforeColumnInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforeDetailEval() throws JRScriptletException {
// TODO Auto-generated method stub
// Float YearSalary = 0.00f;
// Float Salary;
//
// Salary = (Float)this.getFieldValue("Salary");
//
// YearSalary = Salary * 12;
// setVariableValue("YearSalary", new Float(YearSalary));
}
@Override
public void beforeGroupInit(String arg0) throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforePageInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
@Override
public void beforeReportInit() throws JRScriptletException {
// TODO Auto-generated method stub
}
}