Exemple #1
0
        /// <summary>
        /// Get Posting Type
        /// </summary>
        /// <returns></returns>
        public ListBoxVO GetPostingType()
        {
            int             AD_Reference_ID = 125;
            List <NamePair> options         = new List <NamePair>(MRefList.GetList(AD_Reference_ID, true));

            return(new ListBoxVO(options, null));
        }
Exemple #2
0
        /// <summary>
        ///Get Reference List
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="AD_Reference_ID">reference</param>
        /// <param name="Value">value</param>
        /// <param name="trxName">transaction</param>
        /// <returns>List or null</returns>
        public static MRefList Get(Ctx ctx, int AD_Reference_ID, String Value, Trx trxName)
        {
            MRefList retValue = null;
            String   sql      = "SELECT * FROM AD_Ref_List "
                                + "WHERE AD_Reference_ID=" + AD_Reference_ID + " AND Value=" + Value;
            DataSet ds = null;

            try
            {
                ds = DataBase.DB.ExecuteDataset(sql, null, trxName);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow rs = ds.Tables[0].Rows[i];
                    retValue = new MRefList(ctx, rs, trxName);
                }
                ds = null;
            }
            catch (Exception ex)
            {
                _log.Log(Level.SEVERE, sql, ex);
            }
            ds = null;

            return(retValue);
        }
Exemple #3
0
        /**
         *  Get Measure Display Text
         *	@return Measure Display Text
         */
        public String GetXAxisText()
        {
            MMeasure measure = GetMeasure();

            if (measure != null &&
                MMeasure.MEASUREDATATYPE_StatusQtyAmount.Equals(measure.GetMeasureDataType()))
            {
                if (MMeasure.MEASURETYPE_Request.Equals(measure.GetMeasureType()))
                {
                    return(Msg.GetElement(GetCtx(), "R_Status_ID"));
                }
                if (MMeasure.MEASURETYPE_Project.Equals(measure.GetMeasureType()))
                {
                    return(Msg.GetElement(GetCtx(), "C_Phase_ID"));
                }
            }
            String value   = GetMeasureDisplay();
            String display = MRefList.GetListName(GetCtx(), MEASUREDISPLAY_AD_Reference_ID, value);

            return(display == null ? value : display);
        }
Exemple #4
0
        /**
         *  Get Material Cost Element or create it
         *	@param po parent
         *	@param CostingMethod method
         *	@return cost element
         */
        public static MCostElement GetMaterialCostElement(PO po, String CostingMethod)
        {
            if (CostingMethod == null || CostingMethod.Length == 0)
            {
                _log.Severe("No CostingMethod");
                return(null);
            }
            //
            MCostElement retValue = null;
            String       sql      = "SELECT * FROM M_CostElement WHERE AD_Client_ID=" + po.GetAD_Client_ID() + " AND CostingMethod=@costingMethod ORDER BY AD_Org_ID";
            DataTable    dt       = null;
            IDataReader  idr      = null;

            try
            {
                SqlParameter[] param = new SqlParameter[1];
                param[0] = new SqlParameter("@costingMethod", CostingMethod);

                idr = DataBase.DB.ExecuteReader(sql, param, po.Get_TrxName());
                dt  = new DataTable();
                dt.Load(idr);
                idr.Close();

                //bool n = dr.next(); //jz to fix DB2 resultSet closed problem
                //if (n)
                foreach (DataRow dr in dt.Rows)
                {
                    retValue = new MCostElement(po.GetCtx(), dr, po.Get_TrxName());
                }
                //if (n && dr.next())
                //    s_log.warning("More then one Material Cost Element for CostingMethod=" + CostingMethod);
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, sql, e);
            }
            finally
            {
                dt = null;
            }

            if (retValue != null)
            {
                return(retValue);
            }

            //	Create New
            retValue = new MCostElement(po.GetCtx(), 0, po.Get_TrxName());
            retValue.SetClientOrg(po.GetAD_Client_ID(), 0);
            String name = MRefList.GetListName(po.GetCtx(), COSTINGMETHOD_AD_Reference_ID, CostingMethod);

            if (name == null || name.Length == 0)
            {
                name = CostingMethod;
            }
            retValue.SetName(name);
            retValue.SetCostElementType(COSTELEMENTTYPE_Material);
            retValue.SetCostingMethod(CostingMethod);
            retValue.Save();
            return(retValue);
        }
        }       //	GetCreatedByName

        /**
         *  Get Confidential Entry Text (for jsp)
         *	@return text
         */
        public String GetConfidentialEntryText()
        {
            return(MRefList.GetListName(GetCtx(), CONFIDENTIALTYPEENTRY_AD_Reference_ID, GetConfidentialTypeEntry()));
        }       //	GetConfidentialTextEntry
 /**
  *  Get Name of ConfirmType
  *	@return confirm type
  */
 public String GetConfirmTypeName()
 {
     return(MRefList.GetListName(GetCtx(), CONFIRMTYPE_AD_Reference_ID, GetConfirmType()));
 }