Search in sources :

Example 1 with MReportCube

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

the class FinReport method doIt.

//	setPeriods
/**************************************************************************
	 *  Perform process.
	 *  @return Message to be translated
	 *  @throws Exception
	 */
protected String doIt() throws Exception {
    log.info("AD_PInstance_ID=" + getAD_PInstance_ID());
    if (p_PA_ReportCube_ID > 0) {
        MReportCube cube = new MReportCube(getCtx(), p_PA_ReportCube_ID, get_TrxName());
        String result = cube.update(false, false);
        log.log(Level.FINE, result);
    }
    //	** Create Temporary and empty Report Lines from PA_ReportLine
    //	- AD_PInstance_ID, PA_ReportLine_ID, 0, 0
    int PA_ReportLineSet_ID = m_report.getLineSet().getPA_ReportLineSet_ID();
    StringBuffer sql = new StringBuffer("INSERT INTO T_Report " + "(AD_PInstance_ID, PA_ReportLine_ID, Record_ID,Fact_Acct_ID, SeqNo,LevelNo, Name,Description,TabLevel, ReportLineStyle, FixedPercentage) " + "SELECT ").append(getAD_PInstance_ID()).append(", PA_ReportLine_ID, 0,0, SeqNo,0, Name,Description,TabLevel,ReportLineStyle,FixedPercentage " + "FROM PA_ReportLine " + "WHERE IsActive='Y' AND PA_ReportLineSet_ID=").append(PA_ReportLineSet_ID);
    int no = DB.executeUpdate(sql.toString(), get_TrxName());
    log.fine("Report Lines = " + no);
    //	** Get Data	** Segment Values
    m_columns = m_report.getColumnSet().getColumns();
    if (m_columns.length == 0)
        throw new AdempiereUserError("@No@ @PA_ReportColumn_ID@");
    m_lines = m_report.getLineSet().getLiness();
    if (m_lines.length == 0)
        throw new AdempiereUserError("@No@ @PA_ReportLine_ID@");
    //	for all lines
    for (int line = 0; line < m_lines.length; line++) {
        //	Line Segment Value (i.e. not calculation)
        if (m_lines[line].isLineTypeSegmentValue())
            insertLine(line);
    }
    //	for all lines
    insertLineDetail();
    doCalculations();
    deleteUnprintedLines();
    scaleResults();
    //	Create Report
    if (Ini.isClient())
        getProcessInfo().setTransientObject(getPrintFormat());
    else
        getProcessInfo().setSerializableObject(getPrintFormat());
    MPrintFormat pf = getPrintFormat();
    log.fine((System.currentTimeMillis() - m_start) + " ms");
    return "";
}
Also used : MPrintFormat(org.compiere.print.MPrintFormat) AdempiereUserError(org.compiere.util.AdempiereUserError) MReportCube(org.compiere.model.MReportCube)

Example 2 with MReportCube

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

the class FactAcctSummary method doIt.

@Override
protected String doIt() throws Exception {
    String where = "";
    if (p_Cube_ID > 0)
        where = "PA_ReportCube_ID = " + p_Cube_ID;
    List<MReportCube> cubes = new Query(getCtx(), MReportCube.Table_Name, where, get_TrxName()).setOnlyActiveRecords(true).setClient_ID().list();
    for (MReportCube cube : cubes) {
        addLog(cube.update(p_reset, p_force));
    }
    return "@OK@";
}
Also used : Query(org.compiere.model.Query) MReportCube(org.compiere.model.MReportCube)

Aggregations

MReportCube (org.compiere.model.MReportCube)2 Query (org.compiere.model.Query)1 MPrintFormat (org.compiere.print.MPrintFormat)1 AdempiereUserError (org.compiere.util.AdempiereUserError)1