- should call Env.getLanaguage(ctx) instead of Env.getLoginLanguage(ctx), Env.getLoginLanguage(ctx) call Language.getLoginLanguage() which will return the default login language instead of the current login language ( see Language.getLoginLanguage() javadoc )
This commit is contained in:
Heng Sin Low 2009-05-24 07:52:37 +00:00
parent 9a9b9472f9
commit b992310464
1 changed files with 50 additions and 50 deletions

View File

@ -18,7 +18,7 @@ package org.compiere.util;
/** /**
* Spanish Amount in Words * Spanish Amount in Words
* *
* @author Jorg Janke - http://www.rgagnon.com/javadetails/java-0426.html * @author Jorg Janke - http://www.rgagnon.com/javadetails/java-0426.html
* @translator Jordi Luna * @translator Jordi Luna
* @version $Id: AmtInWords_ES.java,v 1.3 2006/07/30 00:54:36 jjanke Exp $ * @version $Id: AmtInWords_ES.java,v 1.3 2006/07/30 00:54:36 jjanke Exp $
@ -34,58 +34,58 @@ public class AmtInWords_ES implements AmtInWords
} // AmtInWords_ES } // AmtInWords_ES
private static final String[] majorNames = { private static final String[] majorNames = {
"", "",
" MIL", " MIL",
" MILL\u00d3N", " MILL\u00d3N",
" MILLARDO", " MILLARDO",
" BILL\u00d3N", " BILL\u00d3N",
" BILLARDO", " BILLARDO",
" TRILL\u00d3N" " TRILL\u00d3N"
}; };
private static final String[] majorNamesPlural = { private static final String[] majorNamesPlural = {
"", "",
" MIL", " MIL",
" MILLONES", " MILLONES",
" MILLARDOS", " MILLARDOS",
" BILLONES", " BILLONES",
" BILLARDOS", " BILLARDOS",
" TRILLONES" " TRILLONES"
}; };
private static final String[] tensNames = { private static final String[] tensNames = {
"", "",
" DIEZ", " DIEZ",
" VEINTE", " VEINTE",
" TREINTA", " TREINTA",
" CUARENTA", " CUARENTA",
" CINCUENTA", " CINCUENTA",
" SESENTA", " SESENTA",
" SETENTA", " SETENTA",
" OCHENTA", " OCHENTA",
" NOVENTA" " NOVENTA"
}; };
private static final String[] numNames = { private static final String[] numNames = {
"", "",
" UN", " UN",
" DOS", " DOS",
" TRES", " TRES",
" CUATRO", " CUATRO",
" CINCO", " CINCO",
" SEIS", " SEIS",
" SIETE", " SIETE",
" OCHO", " OCHO",
" NUEVE", " NUEVE",
" DIEZ", " DIEZ",
" ONCE", " ONCE",
" DOCE", " DOCE",
" TRECE", " TRECE",
" CATORCE", " CATORCE",
" QUINCE", " QUINCE",
" DIECIS\u00c9IS", " DIECIS\u00c9IS",
" DIECISIETE", " DIECISIETE",
" DIECIOCHO", " DIECIOCHO",
" DIECINUEVE" " DIECINUEVE"
}; };
@ -118,7 +118,7 @@ public class AmtInWords_ES implements AmtInWords
} }
if (number == 0) if (number == 0)
//return soFar; //return soFar;
// Begin e-Evolution ogi-cd // Begin e-Evolution ogi-cd
return tensNames[number % 10] + soFar; // e-Evolution ogi-cd return tensNames[number % 10] + soFar; // e-Evolution ogi-cd
// End e-Evolution ogi-cd // End e-Evolution ogi-cd
if (number > 1) if (number > 1)
@ -187,7 +187,7 @@ public class AmtInWords_ES implements AmtInWords
return (prefix + soFar).trim (); return (prefix + soFar).trim ();
} // convert } // convert
/************************************************************************** /**************************************************************************
* Get Amount in Words * Get Amount in Words
* @param amount numeric amount (352.80) * @param amount numeric amount (352.80)
@ -198,23 +198,23 @@ public class AmtInWords_ES implements AmtInWords
{ {
if (amount == null) if (amount == null)
return amount; return amount;
Language lang = Env.getLoginLanguage(Env.getCtx()); Language lang = Env.getLanguage(Env.getCtx());
// //
StringBuffer sb = new StringBuffer (); StringBuffer sb = new StringBuffer ();
int pos = 0; int pos = 0;
if(lang.isDecimalPoint()) if(lang.isDecimalPoint())
pos = amount.lastIndexOf ('.'); // Old pos = amount.lastIndexOf ('.'); // Old
else else
pos = amount.lastIndexOf (','); pos = amount.lastIndexOf (',');
int pos2 = 0; int pos2 = 0;
if(lang.isDecimalPoint()) if(lang.isDecimalPoint())
pos2 = amount.lastIndexOf (','); // Old pos2 = amount.lastIndexOf (','); // Old
else else
pos2 = amount.lastIndexOf ('.'); pos2 = amount.lastIndexOf ('.');
if (pos2 > pos) if (pos2 > pos)
pos = pos2; pos = pos2;
String oldamt = amount; String oldamt = amount;
@ -229,7 +229,7 @@ public class AmtInWords_ES implements AmtInWords
newpos = amount.lastIndexOf ('.'); // Old newpos = amount.lastIndexOf ('.'); // Old
else else
newpos = amount.lastIndexOf (','); newpos = amount.lastIndexOf (',');
long pesos = Long.parseLong(amount.substring (0, newpos)); long pesos = Long.parseLong(amount.substring (0, newpos));
sb.append (convert (pesos)); sb.append (convert (pesos));
for (int i = 0; i < oldamt.length (); i++) for (int i = 0; i < oldamt.length (); i++)
@ -253,5 +253,5 @@ public class AmtInWords_ES implements AmtInWords
// System.out.println(aiw.getAmtInWords(i+",00")); // System.out.println(aiw.getAmtInWords(i+",00"));
System.out.println(aiw.getAmtInWords("9223372036854775807.99")); System.out.println(aiw.getAmtInWords("9223372036854775807.99"));
} }
} // AmtInWords_ES } // AmtInWords_ES