简体   繁体   中英

GL-Category Sequence in adempiere

I want to make a GL-Category Sequence like document sequence for every cash journal.

I added a field in cash journal window called journal number.

I want to generate a number for every cash journal and increment it by 1?

The document sequence is managed by the PO.java class in ADempiere. To use it, you need to add a column with the column name "DocumentNo" to your table. You will need to add the entry in the Sequence table to keep track of the numbers.

Here is the code from PO.java which is run when the record is first saved.

    //  Set new DocumentNo
    String columnName = "DocumentNo";
    int index = p_info.getColumnIndex(columnName);
    if (index != -1 && p_info.getColumn(index).ColumnSQL == null)
    {
        String value = (String)get_Value(index);
        if (value != null && value.startsWith("<") && value.endsWith(">"))
            value = null;
        if (value == null || value.length() == 0)
        {
            int dt = p_info.getColumnIndex("C_DocTypeTarget_ID");
            if (dt == -1)
                dt = p_info.getColumnIndex("C_DocType_ID");
            if (dt != -1)       //  get based on Doc Type (might return null)
                value = DB.getDocumentNo(get_ValueAsInt(dt), m_trxName, false, this);
            if (value == null)  //  not overwritten by DocType and not manually entered
                value = DB.getDocumentNo(getAD_Client_ID(), p_info.getTableName(), m_trxName, this);
            set_ValueNoCheck(columnName, value);
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM