private int createDocType(String Name,String PrintName,String DocBaseType,String DocSubTypeSO,int C_DocTypeShipment_ID,int C_DocTypeInvoice_ID,int StartNo,int GL_Category_ID,boolean isReturnTrx){
  MSequence sequence=null;
  if (StartNo != 0) {
    sequence=new MSequence(m_ctx,getAD_Client_ID(),Name,StartNo,m_trx.getTrxName());
    if (!sequence.save()) {
      log.log(Level.SEVERE,"Sequence NOT created - " + Name);
      return 0;
    }
  }
  MDocType dt=new MDocType(m_ctx,DocBaseType,Name,m_trx.getTrxName());
  if (PrintName != null && PrintName.length() > 0)   dt.setPrintName(PrintName);
  if (DocSubTypeSO != null)   dt.setDocSubTypeSO(DocSubTypeSO);
  if (C_DocTypeShipment_ID != 0)   dt.setC_DocTypeShipment_ID(C_DocTypeShipment_ID);
  if (C_DocTypeInvoice_ID != 0)   dt.setC_DocTypeInvoice_ID(C_DocTypeInvoice_ID);
  if (GL_Category_ID != 0)   dt.setGL_Category_ID(GL_Category_ID);
  if (sequence == null)   dt.setIsDocNoControlled(false);
 else {
    dt.setIsDocNoControlled(true);
    dt.setDocNoSequence_ID(sequence.getAD_Sequence_ID());
  }
  dt.setIsSOTrx();
  if (isReturnTrx)   dt.setIsSOTrx(!dt.isSOTrx());
  if (!dt.save()) {
    log.log(Level.SEVERE,"DocType NOT created - " + Name);
    return 0;
  }
  return dt.getC_DocType_ID();
}

private int createDocType ( String Name , String PrintName , String DocBaseType , String DocSubTypeSO , int C_DocTypeShipment_ID , int C_DocTypeInvoice_ID , int StartNo , int GL_Category_ID , boolean isReturnTrx ) { MSequence sequence = null ; if ( StartNo != 0 ) { sequence = new MSequence ( m_ctx , getAD_Client_ID ( ) , Name , StartNo , m_trx . getTrxName ( ) ) ; if ( ! sequence . save ( ) ) { log . log ( Level . SEVERE , "Sequence NOT created - " + Name ) ; return 0 ; } } MDocType dt = new MDocType ( m_ctx , DocBaseType , Name , m_trx . getTrxName ( ) ) ; if ( PrintName != null && PrintName . length ( ) > 0 ) dt . setPrintName ( PrintName ) ; if ( DocSubTypeSO != null ) dt . setDocSubTypeSO ( DocSubTypeSO ) ; if ( C_DocTypeShipment_ID != 0 ) dt . setC_DocTypeShipment_ID ( C_DocTypeShipment_ID ) ; if ( C_DocTypeInvoice_ID != 0 ) dt . setC_DocTypeInvoice_ID ( C_DocTypeInvoice_ID ) ; if ( GL_Category_ID != 0 ) dt . setGL_Category_ID ( GL_Category_ID ) ; if ( sequence == null ) dt . setIsDocNoControlled ( false ) ; else { dt . setIsDocNoControlled ( true ) ; dt . setDocNoSequence_ID ( sequence . getAD_Sequence_ID ( ) ) ; } dt . setIsSOTrx ( ) ; if ( isReturnTrx ) dt . setIsSOTrx ( ! dt . isSOTrx ( ) ) ; if ( ! dt . save ( ) ) { log . log ( Level . SEVERE , "DocType NOT created - " + Name ) ; return 0 ; } return dt . getC_DocType_ID ( ) ; }
create document types with sequence
