Search in sources :

Example 1 with MProjectType

use of org.compiere.model.MProjectType 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 2 with MProjectType

use of org.compiere.model.MProjectType 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)

Example 3 with MProjectType

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

the class ProjectSetType method doIt.

//	prepare
/**
	 *  Perform process.
	 *  @return Message (clear text)
	 *  @throws Exception if not successful
	 */
protected String doIt() throws Exception {
    m_C_Project_ID = getRecord_ID();
    log.info("doIt - C_Project_ID=" + m_C_Project_ID + ", C_ProjectType_ID=" + m_C_ProjectType_ID);
    //
    MProject project = new MProject(getCtx(), m_C_Project_ID, get_TrxName());
    if (project.getC_Project_ID() == 0 || project.getC_Project_ID() != m_C_Project_ID)
        throw new IllegalArgumentException("Project not found C_Project_ID=" + m_C_Project_ID);
    if (project.getC_ProjectType_ID_Int() > 0)
        throw new IllegalArgumentException("Project already has Type (Cannot overwrite) " + project.getC_ProjectType_ID());
    //
    MProjectType type = new MProjectType(getCtx(), m_C_ProjectType_ID, get_TrxName());
    if (type.getC_ProjectType_ID() == 0 || type.getC_ProjectType_ID() != m_C_ProjectType_ID)
        throw new IllegalArgumentException("Project Type not found C_ProjectType_ID=" + m_C_ProjectType_ID);
    //	Set & Copy if Service
    project.setProjectType(type);
    if (!project.save())
        throw new Exception("@Error@");
    //
    return "@OK@";
}
Also used : MProjectType(org.compiere.model.MProjectType) MProject(org.compiere.model.MProject)

Aggregations

MProjectType (org.compiere.model.MProjectType)3 MAchievement (org.compiere.model.MAchievement)2 MGoal (org.compiere.model.MGoal)2 MMeasureCalc (org.compiere.model.MMeasureCalc)2 MQuery (org.compiere.model.MQuery)2 MRequestType (org.compiere.model.MRequestType)2 MProject (org.compiere.model.MProject)1