/**
         *  Get CashBook for Org and Currency
         *	@param ctx context
         *	@param AD_Org_ID org
         *	@param C_Currency_ID currency
         *	@return cash book or null
         */
        public static MCashBook Get(Ctx ctx, int AD_Org_ID, int C_Currency_ID)
        {
            //	Try from cache
            //Iterator it = _cache.values().iterator();
            IEnumerator it = _cache.Values.GetEnumerator();

            while (it.MoveNext())
            {
                MCashBook cb = (MCashBook)it.Current;
                if (cb.GetAD_Org_ID() == AD_Org_ID && cb.GetC_Currency_ID() == C_Currency_ID)
                {
                    return(cb);
                }
            }

            //	Get from DB
            //SI_0648_1 : if there are multiple "defaults / no default" with in same org and currency, system will create object of highest ID.
            MCashBook retValue = null;
            String    sql      = "SELECT * FROM C_CashBook "
                                 + " WHERE AD_Org_ID=" + AD_Org_ID + " AND C_Currency_ID=" + C_Currency_ID
                                 + " ORDER BY IsDefault DESC,  C_CashBook_id DESC";
            DataTable   dt  = null;
            IDataReader idr = null;

            try
            {
                idr = DB.ExecuteReader(sql, null, null);
                dt  = new DataTable();
                dt.Load(idr);
                idr.Close();
                foreach (DataRow dr in dt.Rows)
                {
                    retValue = new MCashBook(ctx, dr, null);
                    int key = retValue.GetC_CashBook_ID();
                    _cache.Add(key, retValue);
                    break;
                }
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, "get", e);
            }
            finally { dt = null; }
            return(retValue);
        }