import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import com.jatools.component.*;
import com.jatools.core.ZHZUtil;
import com.jatools.data.rs.sql.ZImageReader;

	public  double sin(double a) {
		return Math.sin(a);
	}
	
	public Object query(Object conn,String sql)
	{
	    return ZHZUtil.query(conn,sql);
	}
	public String p(String prop)
	{
	    return ZHZUtil.getProperty(prop);
	
	}
	public  Object sum( String field) {
		return ZHZUtil.sum(this.interpreter.get("_taBle_prinTer_"),field);
	}

	public  Object count() {
		return ZHZUtil.count(this.interpreter.get("_taBle_prinTer_"));
	}

	public  Object max( String field) {
		return ZHZUtil.max(this.interpreter.get("_taBle_prinTer_"),field);
	}

	public  Object min( String field) {
		return ZHZUtil.min(this.interpreter.get("_taBle_prinTer_"),field);
	}

	public  Object average( String field) {
		return ZHZUtil.average(this.interpreter.get("_taBle_prinTer_"),field);
	}
	
	public Object sum(String group,String col)
	{
	    return ZHZUtil.sum(this.interpreter.get("_C_t_D_g_9"),group,col);
	}
	
	public Object rowsum(String col)
	{
	    return ZHZUtil.rowsum(this.interpreter.get("_C_t_D_g_9"),col);
	}

    public Object colsum(String col)
	{
	    return ZHZUtil.colsum(this.interpreter.get("_C_t_D_g_9"),col);
	}
	
	public Object allsum(String col)
	{
	    return ZHZUtil.allsum(this.interpreter.get("_C_t_D_g_9"),col);
	}
	
	public String clobString(String col)
	{
	
	   
	    return ZHZUtil.clobString(this.interpreter,col);
	    
	}
	
	

	//cos
	public  double cos(double a) {
		return Math.cos(a);
	}

	//tan
	public  double tan(double a) {
		return Math.tan(a);
	}

	//asin
	public  double asin(double a) {
		return Math.asin(a);
	}

	//acos
	public  double acos(double a) {
		return Math.acos(a);
	}

	//atan
	public  double atan(double a) {
		return Math.atan(a);
	}

	//toRadians
	public  double toRadians(double angdeg) {
		return Math.toRadians(angdeg);
	}

	//toDegrees
	public  double toDegrees(double angrad) {
		return Math.toDegrees(angrad);
	}

	//exp
	public  double exp(double a) {
		return Math.exp(a);
	}

	//log
	public  double log(double a) {
		return Math.log(a);
	}

	//sqrt
	public  double sqrt(double a) {
		return Math.sqrt(a);
	}

	//IEEEremainder
	public  double IEEEremainder(double f1, double f2) {
		return Math.IEEEremainder(f1, f2);
	}

	//ceil
	public  double ceil(double a) {
		return Math.ceil(a);
	}

	//floor
	public  double floor(double a) {
		return Math.floor(a);
	}

	//rint
	public  double rint(double a) {
		return Math.rint(a);
	}

	//atan2
	public  double atan2(double y, double x) {
		return Math.atan2(y, x);
	}

	//pow
	public  double pow(double a, double b) {
		return Math.pow(a, b);
	}

	//round
	public  int round(float a) {
		return Math.round(a);
	}

	public  long round(double a) {
		return Math.round(a);
	}

	//random
	public  double random() {
		return Math.random();
	}

	//abs
	public  int abs(int a) {
		return Math.abs(a);
	}

	public  long abs(long a) {
		return Math.abs(a);
	}

	public  float abs(float a) {
		return Math.abs(a);
	}

	public  double abs(double a) {
		return Math.abs(a);
	}

	//max
	public  int max(int a, int b) {
		return Math.max(a, b);
	}

	public  long max(long a, long b) {
		return Math.max(a, b);
	}

	public  float max(float a, float b) {
		return Math.max(a, b);
	}

	public  double max(double a, double b) {
		return Math.max(a, b);
	}

	//min
	public  int min(int a, int b) {
		return Math.min(a, b);
	}

	public  long min(long a, long b) {
		return Math.min(a, b);
	}

	public  float min(float a, float b) {
		return Math.min(a, b);
	}

	public  double min(double a, double b) {
		return Math.min(a, b);
	}

	//truncate
	public  String truncate(float f) {
		int m = (int) f;
		String s = String.valueOf(m) + ".00";

		return s;
	}

	public  String truncate(double d) {
		int m = (int) d;
		String s = String.valueOf(m) + ".00";

		return s;
	}

	public  String truncate(float f, int n) {
		char[] cha = null;
		String s2 = "";
		String s = String.valueOf(f);
		String s1 = String.valueOf((int) f) + ".";

		//ĩβp0
		int p = s.length() - s1.length() - n;

		for (int i = 0; i < p; i++) {
			s2 += "0";
		}

		for (int i = 0; i < (s.length() - p); i++) {
			cha[i] = s.charAt(i);
		}

		s1 = s.copyValueOf(cha, 1, s.length() - p);
		s = s1 + s2;

		return s1;
	}

	public  String truncate(double d, int n) {
		char[] cha = new char[20];
		String s2 = "";
		String s = String.valueOf(d);
		String s1 = String.valueOf((int) d) + ".";

		//ĩβp0
		int p = s.length() - s1.length() - n;

		for (int i = 0; i < p; i++) {
			s2 += "0";
		}

		for (int i = 0; i < (s.length() - p); i++) {
			cha[i] = s.charAt(i);
		}

		s1 = s.copyValueOf(cha, 0, s.length() - p);
		s = s1 + s2;

		return s;
	}
	public int length(String str) {
		return str.length();
	}

	public  char charAt(String str, int index) {
		return str.charAt(index);
	}

	public byte[] getBytes(String str, String charsetName)
		throws UnsupportedEncodingException {
		return str.getBytes(charsetName);
	}

	public byte[] getBytes(String str) {
		return str.getBytes();
	}

	public boolean equals(String str, Object anObject) {
		return str.equals(anObject);
	}

	public boolean contentEquals(String str, StringBuffer sb) {
		return str.contentEquals(sb);
	}

	public boolean equalsIgnoreCase(String str, String anotherString) {
		return str.equalsIgnoreCase(anotherString);
	}

	public int compareTo(String str, String anotherString) {
		return str.compareTo(anotherString);
	}

	public int compareTo(String str, Object o) {
		return str.compareTo(o);
	}

	public int compareToIgnoreCase(String str, String string) {
		return str.compareToIgnoreCase(string);
	}

	public boolean regionMatches(
		String str,
		int toffset,
		String other,
		int ooffset,
		int len) {
		return str.regionMatches(toffset, other, ooffset, len);
	}

	public boolean regionMatches(
		String str,
		boolean ignoreCase,
		int toffset,
		String other,
		int ooffset,
		int len) {
		return str.regionMatches(ignoreCase, toffset, other, ooffset, len);
	}

	public boolean startsWith(String str, String prefix, int toffset) {
		return str.startsWith(prefix, toffset);
	}

	public boolean startsWith(String str, String prefix) {
		return str.startsWith(prefix);
	}

	public boolean endsWith(String str, String suffix) {
		return str.startsWith(suffix);
	}

	public int hashCode(String str) {
		return str.hashCode();
	}

	public int indexOf(String str, int ch) {
		return str.indexOf(ch);
	}

	public int indexOf(String str, int ch, int fromIndex) {
		return str.indexOf(ch, fromIndex);
	}

	public int lastIndexOf(String str, int ch) {
		return str.lastIndexOf(ch);
	}

	public int lastIndexOf(String str, int ch, int fromIndex) {
		return str.lastIndexOf(ch, fromIndex);
	}

	public int indexOf(String str, String string) {
		return str.indexOf(string);
	}

	public int indexOf(String str, String string, int fromIndex) {
		return str.indexOf(string, fromIndex);
	}

	public int lastIndexOf(String str, String string) {
		return str.lastIndexOf(string);
	}

	public int lastIndexOf(String str, String string, int fromIndex) {
		return str.lastIndexOf(string, fromIndex);
	}

	public String substring(String str, int beginIndex) {
		return str.substring(beginIndex);
	}

	public String substring(String str, int beginIndex, int endIndex) {
		return str.substring(beginIndex, endIndex);
	}

	public CharSequence subSequence(String str, int beginIndex, int endIndex) {
		return str.subSequence(beginIndex, endIndex);
	}

	public String concat(String str, String string) {
		return str.concat(string);
	}

	public String replace(String str, char oldChar, char newChar) {
		return str.replace(oldChar, newChar);
	}

	public boolean matches(String str, String regex) {
		return str.matches(regex);
	}

	public String replaceFirst(String str, String regex, String replacement) {
		return str.replaceFirst(regex, replacement);
	}

	public String replaceAll(String str, String regex, String replacement) {
		return str.replaceAll(regex, replacement);
	}

	public String[] split(String str, String regex, int limit) {
		return str.split(regex, limit);
	}

	public String[] split(String str, String regex) {
		return str.split(regex);
	}

	public String toLowerCase(String str, Locale locale) {
		return str.toLowerCase(locale);
	}

	public String toLowerCase(String str) {
		return str.toLowerCase();
	}

	public String toUpperCase(String str, Locale locale) {
		return str.toUpperCase(locale);
	}

	public String toUpperCase(String str) {
		return str.toUpperCase();
	}

	public String trim(String str) {
		return str.trim();
	}

	public String toString(String str) {
		return str.toString();
	}

	public char[] toCharArray(String str) {
		return str.toCharArray();
	}

	public  String valueOf(Object obj) {
		return String.valueOf(obj);
	}

	public  String valueOf(char[] data) {
		return String.valueOf(data);
	}

	public  String valueOf(char[] data, int offset, int count) {
		return String.valueOf(data, offset, count);
	}

	public  String copyValueOf(char[] data, int offset, int count) {
		return String.copyValueOf(data, offset, count);
	}

	public  String toString(char[] data) {
		return String.copyValueOf(data);
	}

	public  String toString(boolean b) {
		return String.valueOf(b);
	}

	public  boolean toBoolean(String str) {
		return Boolean.getBoolean(str);
	}

	public  String toString(char c) {
		return String.valueOf(c);
	}

	public  String toString(int i) {
		return String.valueOf(i);
	}

	public  int toInteger(String str) {
		return Integer.parseInt(str);
	}

	public  String toString(long l) {
		return String.valueOf(l);
	}

	public  long toLong(String str) {
		return Long.parseLong(str);
	}

	public  String toString(float f) {
		return String.valueOf(f);
	}

	public  float toFloat(String str) {
		return Float.parseFloat(str);
	}

	public  String toString(double d) {
		return String.valueOf(d);
	}

	public  double toDouble(String str) {
		return Double.parseDouble(str);
	}

	public  String toString(Date d) {
		return d.toString();
	}
	public String toRmbString(double a)
	{
	     return ZHZUtil.toRmbString(a);
	}
	
	public String toHZDay(int a)
	{
	     return ZHZUtil.toHZDay(a);
	}
	public String toHZMonth(int a)
	{
	     return ZHZUtil.toHZMonth(a);
	}
	public String toHZYear(int a)
	{
	     return ZHZUtil.toHZ(a);
	}

	public  String format(float f, String format) {
		// format(345678.5f,"###,##0.00") -> 345,678.50
		// to String g from double d
		DecimalFormat decimalFormat = new DecimalFormat(format);

		return decimalFormat.format(f);
	}

	public  String format(double d, String format) {
		// format(345678.5f,"###,##0.00") -> 345,678.50
		// to String g from double d
		DecimalFormat decimalFormat = new DecimalFormat(format);
		return decimalFormat.format(d);
	}

	public  String format(Date d, String format) {
		// format(d,"yyyy-MM-dd") -> 2004-01-28
		DateFormat dateFormat = new SimpleDateFormat(format);

		return dateFormat.format(d);
	}
	public static long UTC(int year, int month, int date,
			int hrs, int min, int sec) {
		return Date.UTC(year,month,date,hrs,min,sec);
	}

	public static long parse(String s) {
		return Date.parse(s);
	}

	public static int getYear(Date d) {
		return d.getYear()+1900;
	}

	public static int getMonth(Date d) {
		return d.getMonth()+1;
	}

	public static int getDate(Date d) {
		return d.getDate();
	}

	public static int getDay(Date d) {
		return d.getDay();
	}

	public static int getHours(Date d) {
		return d.getHours();
	}

	public static int getMinutes(Date d) {
		return d.getMinutes();
	}

	public static int getSeconds(Date d) {
		return d.getSeconds();
	}


	public static long getTime(Date d) {
		return d.getTime();
	}

	public static boolean before(Date d,Date when) {
		return d.before(when);
	}

	public static boolean after(Date d,Date when) {
		return d.after(when);
	}

	public static boolean equals(Date d,Object obj) {
		return d.equals(obj);
	}

	public static int compareTo(Date d,Date anotherDate) {
		return d.compareTo(anotherDate);
	}

	public static int compareTo(Date d,Object o) {
		return d.compareTo(o);
	}
	public static long getSession()
	{
		return new Date().getTime() ;
	}


	public static int getTimezoneOffset(Date d) {
		return d.getTimezoneOffset();
	}
	
	
