private boolean reverseIt(){
  if (!isActive())   throw new IllegalStateException("Allocation already reversed (not active)");
  MPeriod.testPeriodOpen(getCtx(),getDateTrx(),MPeriodControl.DOCBASETYPE_PaymentAllocation,getAD_Org_ID());
  setIsActive(false);
  if (!isPosted())   setPosted(true);
  setDocumentNo(getDocumentNo() + "^");
  setDocStatus(DOCSTATUS_Reversed);
  if (!save() || isActive())   throw new IllegalStateException("Cannot de-activate allocation");
  MFactAcct.deleteEx(MAllocationHdr.Table_ID,getC_AllocationHdr_ID(),get_TrxName());
  getLines(true);
  HashSet<Integer> bps=new HashSet<Integer>();
  for (int i=0; i < m_lines.length; i++) {
    MAllocationLine line=m_lines[i];
    line.setIsActive(false);
    line.saveEx();
    bps.add(new Integer(line.processIt(true)));
  }
  updateBP(bps);
  return true;
}

private boolean reverseIt ( ) { if ( ! isActive ( ) ) throw new IllegalStateException ( "Allocation already reversed (not active)" ) ; MPeriod . testPeriodOpen ( getCtx ( ) , getDateTrx ( ) , MPeriodControl . DOCBASETYPE_PaymentAllocation , getAD_Org_ID ( ) ) ; setIsActive ( false ) ; if ( ! isPosted ( ) ) setPosted ( true ) ; setDocumentNo ( getDocumentNo ( ) + "^" ) ; setDocStatus ( DOCSTATUS_Reversed ) ; if ( ! save ( ) || isActive ( ) ) throw new IllegalStateException ( "Cannot de-activate allocation" ) ; MFactAcct . deleteEx ( MAllocationHdr . Table_ID , getC_AllocationHdr_ID ( ) , get_TrxName ( ) ) ; getLines ( true ) ; HashSet < Integer > bps = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < m_lines . length ; i ++ ) { MAllocationLine line = m_lines [ i ] ; line . setIsActive ( false ) ; line . saveEx ( ) ; bps . add ( new Integer ( line . processIt ( true ) ) ) ; } updateBP ( bps ) ; return true ; }
reverse allocation . period needs to be open
