1 14 package org.compiere.tools; 15 16 import java.util.*; 17 18 import org.compiere.model.*; 19 import org.compiere.util.*; 20 21 22 28 public class Currency extends PO 29 { 30 35 public Currency (Properties ctx, int C_Currency_ID) 36 { 37 super (ctx, C_Currency_ID); 38 if (C_Currency_ID == 0) 40 { 41 setValue("StdPrecision", new Integer (2)); 42 setValue("CostingPrecision", new Integer (4)); 43 setValue("IsEuro", new Boolean (false)); 44 setValue("IsEMUMember", new Boolean (false)); 45 } 46 } 48 53 protected POInfo initPO (Properties ctx) 54 { 55 int AD_Table_ID = 141; 56 POInfo poi = POInfo.getPOInfo (ctx, AD_Table_ID); 57 return poi; 58 } 60 61 62 69 public static Currency create (String ISO_Code, String CurSymbol, String Description) 70 { 71 Currency cur = new Currency(Env.getCtx(), 0); 72 cur.setValue("ISO_Code", ISO_Code); 73 cur.setValue("CurSymbol", CurSymbol); 74 cur.setValue("Description", Description); 75 cur.save(); 76 return cur; 77 } 79 84 public static void main(String [] args) 85 { 86 Locale[] locales = Locale.getAvailableLocales(); 87 for (int i = 0; i < locales.length; i++) 88 { 89 System.out.println(locales[i] + " - " + locales[i].getDisplayCountry()); 90 try 91 { 92 java.util.Currency c = java.util.Currency.getInstance(locales[i]); 93 System.out.println(" " + c + " " + c.getDefaultFractionDigits() + " " + c.getSymbol()); 94 } 95 catch (Exception ex) 96 { 97 } 98 } 99 100 101 102 105 } } | Popular Tags |