/// <summary> /// Parent Constructor. /// </summary> /// <param name="parent">parent batch</param> public MJournal(MJournalBatch parent) : this(parent.GetCtx(), 0, parent.Get_TrxName()) { //this (parent.getCtx(), 0, parent.get_TrxName()); SetClientOrg(parent); SetGL_JournalBatch_ID(parent.GetGL_JournalBatch_ID()); SetC_DocType_ID(parent.GetC_DocType_ID()); SetPostingType(parent.GetPostingType()); // SetDateDoc(parent.GetDateDoc()); SetC_Period_ID(parent.GetC_Period_ID()); SetDateAcct(parent.GetDateAcct()); SetC_Currency_ID(parent.GetC_Currency_ID()); } // MJournal
} // 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