} // reverseCorrectionIt /// <summary> /// Reverse Accrual. Flip Dr/Cr - Use Today's date /// </summary> /// <returns>true if success </returns> public Boolean ReverseAccrualIt() { log.Info("ReverseCorrectIt - " + ToString()); MJournal[] journals = GetJournals(true); // check prerequisites for (int i = 0; i < journals.Length; i++) { MJournal journal = journals[i]; if (!journal.IsActive()) { continue; } // All need to be closed/Completed if (DOCSTATUS_Completed.Equals(journal.GetDocStatus())) { ; } else { m_processMsg = "All Journals need to be Compleded: " + journal.GetSummary(); return(false); } } // Reverse it MJournalBatch reverse = new MJournalBatch(this); reverse.SetC_Period_ID(0); //reverse.SetDateDoc(new Timestamp(System.currentTimeMillis())); reverse.SetDateDoc(DateTime.Now); reverse.SetDateAcct(reverse.GetDateDoc()); // Reverse indicator String description = reverse.GetDescription(); if (description == null) { description = "** " + GetDocumentNo() + " **"; } else { description += " ** " + GetDocumentNo() + " **"; } reverse.SetDescription(description); reverse.Save(); // Reverse Journals for (int i = 0; i < journals.Length; i++) { MJournal journal = journals[i]; if (!journal.IsActive()) { continue; } if (journal.ReverseCorrectIt(reverse.GetGL_JournalBatch_ID()) == null) { m_processMsg = "Could not reverse " + journal; return(false); } journal.Save(); } return(true); } // ReverseCorrectIt
} // closeIt /// <summary> /// Reverse Correction.As if nothing happened - same date /// </summary> /// <returns>true if success </returns> public Boolean ReverseCorrectIt() { log.Info("reverseCorrectIt - " + ToString()); MJournal[] journals = GetJournals(true); // check prerequisites for (int i = 0; i < journals.Length; i++) { MJournal journal = journals[i]; if (!journal.IsActive()) { continue; } // All need to be closed/Completed if (DOCSTATUS_Completed.Equals(journal.GetDocStatus())) { ; } else { m_processMsg = "All Journals need to be Compleded: " + journal.GetSummary(); return(false); } } // Reverse it MJournalBatch reverse = new MJournalBatch(this); reverse.SetDateDoc(GetDateDoc()); reverse.SetC_Period_ID(GetC_Period_ID()); reverse.SetDateAcct(GetDateAcct()); reverse.SetC_Year_ID(GetC_Year_ID()); // Reverse indicator if (reverse.Get_ColumnIndex("ReversalDoc_ID") > 0 && reverse.Get_ColumnIndex("IsReversal") > 0) { // set Reversal property for identifying, record is reversal or not during saving or for other actions reverse.SetIsReversal(true); // Set Orignal Document Reference reverse.SetReversalDoc_ID(GetGL_JournalBatch_ID()); } // for reversal document set Temp Document No to empty if (reverse.Get_ColumnIndex("TempDocumentNo") > 0) { reverse.SetTempDocumentNo(""); } String description = reverse.GetDescription(); if (description == null) { description = "** " + GetDocumentNo() + " **"; } else { description += " ** " + GetDocumentNo() + " **"; reverse.SetDescription(description); } if (!reverse.Save()) { ValueNamePair pp = VLogger.RetrieveError(); if (pp != null && !String.IsNullOrEmpty(pp.GetName())) { m_processMsg = pp.GetName() + " - " + "Could not reverse " + this; } else { m_processMsg = "Could not reverse " + this; } return(false); } // // Reverse Journals for (int i = 0; i < journals.Length; i++) { MJournal journal = journals[i]; if (!journal.IsActive()) { continue; } if (journal.ReverseCorrectIt(reverse.GetGL_JournalBatch_ID()) == null) { m_processMsg = "Could not reverse " + journal; return(false); } journal.Save(); } return(true); } // reverseCorrectionIt