Search in sources :

Example 1 with MRequestType

use of org.compiere.model.MRequestType in project adempiere by adempiere.

the class MRequestTypeTest method testQuery.

public void testQuery() throws Exception {
    MRequestType req = MRequestType.getDefault(getCtx());
    assertTrue("There should be default requesttype", req.getAD_Client_ID() == 11);
}
Also used : MRequestType(org.compiere.model.MRequestType)

Example 2 with MRequestType

use of org.compiere.model.MRequestType in project adempiere by adempiere.

the class WebInfo method getRequestType.

//	getRequestTypes
/**
	 * 	Get Request Type
	 *	@return Request Type
	 */
public MRequestType getRequestType() {
    m_infoMessage = null;
    MRequestType retValue = null;
    String sql = "SELECT * FROM R_RequestType WHERE IsSelfService='Y' AND R_RequestType_ID=?";
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, m_id);
        rs = pstmt.executeQuery();
        if (rs.next())
            retValue = new MRequestType(m_ctx, rs, null);
    } catch (Exception e) {
        log.log(Level.SEVERE, sql, e);
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    log.fine("R_RequestType_ID=" + m_id + " - " + retValue);
    return retValue;
}
Also used : ResultSet(java.sql.ResultSet) MRequestType(org.compiere.model.MRequestType) PreparedStatement(java.sql.PreparedStatement)

Example 3 with MRequestType

use of org.compiere.model.MRequestType in project adempiere by adempiere.

the class WebInfo method getRequestTypes.

//	getRequest
/**
	 * 	Get Request Types
	 *	@return Array of Request Types
	 */
public ArrayList<MRequestType> getRequestTypes() {
    m_infoMessage = null;
    ArrayList<MRequestType> list = new ArrayList<MRequestType>();
    String sql = "SELECT * FROM R_RequestType " + "WHERE IsSelfService='Y' AND AD_Client_ID=? ORDER BY Name";
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, getAD_Client_ID());
        rs = pstmt.executeQuery();
        while (rs.next()) list.add(new MRequestType(m_ctx, rs, null));
        rs.close();
        pstmt.close();
        pstmt = null;
    } catch (Exception e) {
        log.log(Level.SEVERE, sql, e);
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    log.fine("#" + list.size());
    return list;
}
Also used : ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) MRequestType(org.compiere.model.MRequestType) PreparedStatement(java.sql.PreparedStatement)

Example 4 with MRequestType

use of org.compiere.model.MRequestType in project adempiere by adempiere.

the class HtmlDashboard method goalsDetail.

private String goalsDetail(int AD_Table_ID) {
    //TODO link to goals
    String output = "";
    if (m_goals == null)
        return output;
    for (int i = 0; i < m_goals.length; i++) {
        MMeasureCalc mc = MMeasureCalc.get(Env.getCtx(), m_goals[i].getMeasure().getPA_MeasureCalc_ID());
        if (AD_Table_ID == m_goals[i].getPA_Goal_ID()) {
            // mc.getAD_Table_ID()) {
            output += "<table class=\"dataGrid\"><tr>\n<th colspan=\"3\" class=\"label\"><b>" + m_goals[i].getName() + "</b></th></tr>\n";
            output += "<tr><td class=\"label\">Target</td><td colspan=\"2\" class=\"tdcontent\">" + m_goals[i].getMeasureTarget() + "</td></tr>\n";
            output += "<tr><td class=\"label\">Actual</td><td colspan=\"2\" class=\"tdcontent\">" + m_goals[i].getMeasureActual() + "</td></tr>\n";
            //if (mc.getTableName()!=null) output += "table: " + mc.getAD_Table_ID() + "<br>\n";
            Graph barPanel = new Graph(m_goals[i]);
            GraphColumn[] bList = barPanel.getGraphColumnList();
            MQuery query = null;
            output += "<tr><td rowspan=\"" + bList.length + "\" class=\"label\" valign=\"top\">" + m_goals[i].getXAxisText() + "</td>\n";
            for (int k = 0; k < bList.length; k++) {
                GraphColumn bgc = bList[k];
                if (k > 0)
                    output += "<tr>";
                if (//	Single Achievement
                bgc.getAchievement() != null) {
                    MAchievement a = bgc.getAchievement();
                    query = MQuery.getEqualQuery("PA_Measure_ID", a.getPA_Measure_ID());
                } else if (//	Multiple Achievements 
                bgc.getGoal() != null) {
                    MGoal goal = bgc.getGoal();
                    query = MQuery.getEqualQuery("PA_Measure_ID", goal.getPA_Measure_ID());
                } else if (//	Document
                bgc.getMeasureCalc() != null) {
                    mc = bgc.getMeasureCalc();
                    query = mc.getQuery(m_goals[i].getRestrictions(false), bgc.getMeasureDisplay(), bgc.getDate(), //	logged in role
                    MRole.getDefault());
                } else if (//	Document
                bgc.getProjectType() != null) {
                    MProjectType pt = bgc.getProjectType();
                    query = pt.getQuery(m_goals[i].getRestrictions(false), bgc.getMeasureDisplay(), bgc.getDate(), bgc.getID(), //	logged in role
                    MRole.getDefault());
                } else if (//	Document
                bgc.getRequestType() != null) {
                    MRequestType rt = bgc.getRequestType();
                    query = rt.getQuery(m_goals[i].getRestrictions(false), bgc.getMeasureDisplay(), bgc.getDate(), bgc.getID(), //	logged in role
                    MRole.getDefault());
                }
                output += "<td class=\"tdcontent\">" + bgc.getLabel() + "</td><td  class=\"tdcontent\">";
                if (query != null) {
                    output += "<a class=\"hrefZoom\" href=\"http:///window/zoom#" + queryZoom.size() + "\">" + bgc.getValue() + "</a><br>\n";
                    queryZoom.add(query);
                } else {
                    log.info("Nothing to zoom to - " + bgc);
                    output += bgc.getValue();
                }
                output += "</td></tr>";
            }
            output += "</tr>" + "<tr><td colspan=\"3\">" + m_goals[i].getDescription() + "<br>" + stripHtml(m_goals[i].getColorSchema().getDescription(), true) + "</td></tr>" + "</table>\n";
            bList = null;
            barPanel = null;
        }
    }
    return output;
}
Also used : MAchievement(org.compiere.model.MAchievement) MProjectType(org.compiere.model.MProjectType) MRequestType(org.compiere.model.MRequestType) MQuery(org.compiere.model.MQuery) MMeasureCalc(org.compiere.model.MMeasureCalc) MGoal(org.compiere.model.MGoal)

Example 5 with MRequestType

use of org.compiere.model.MRequestType in project adempiere by adempiere.

the class GraphColumn method getMQuery.

//	setHeight
public MQuery getMQuery(MGoal mGoal) {
    MQuery query = null;
    if (//	Single Achievement
    getAchievement() != null) {
        MAchievement a = getAchievement();
        query = MQuery.getEqualQuery("PA_Measure_ID", a.getPA_Measure_ID());
    } else if (//	Multiple Achievements
    getGoal() != null) {
        MGoal goal = getGoal();
        query = MQuery.getEqualQuery("PA_Measure_ID", goal.getPA_Measure_ID());
    } else if (//	Document
    getMeasureCalc() != null) {
        MMeasureCalc mc = getMeasureCalc();
        query = mc.getQuery(mGoal.getRestrictions(false), getMeasureDisplay(), getDate(), //	logged in role
        MRole.getDefault());
    } else if (//	Document
    getProjectType() != null) {
        MProjectType pt = getProjectType();
        query = pt.getQuery(mGoal.getRestrictions(false), getMeasureDisplay(), getDate(), getID(), //	logged in role
        MRole.getDefault());
    } else if (//	Document
    getRequestType() != null) {
        MRequestType rt = getRequestType();
        query = rt.getQuery(mGoal.getRestrictions(false), getMeasureDisplay(), getDate(), getID(), //	logged in role
        MRole.getDefault());
    }
    return query;
}
Also used : MAchievement(org.compiere.model.MAchievement) MProjectType(org.compiere.model.MProjectType) MRequestType(org.compiere.model.MRequestType) MQuery(org.compiere.model.MQuery) MMeasureCalc(org.compiere.model.MMeasureCalc) MGoal(org.compiere.model.MGoal)

Aggregations

MRequestType (org.compiere.model.MRequestType)6 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 MAchievement (org.compiere.model.MAchievement)2 MGoal (org.compiere.model.MGoal)2 MMeasureCalc (org.compiere.model.MMeasureCalc)2 MProjectType (org.compiere.model.MProjectType)2 MQuery (org.compiere.model.MQuery)2 ArrayList (java.util.ArrayList)1 MRequest (org.compiere.model.MRequest)1 AdempiereSystemError (org.compiere.util.AdempiereSystemError)1