示例#1
0
        }       //	getLines

        /// <summary>
        /// Copy Lines from other Journal
        /// </summary>
        /// <param name="fromJournal">Journal</param>
        /// <param name="dateAcct">date used - if null original</param>
        /// <param name="typeCR">type of copying (C)orrect=negate - (R)everse=flip dr/cr - otherwise just copy</param>
        /// <returns>number of lines copied</returns>
        public int CopyLinesFrom(MJournal fromJournal, DateTime?dateAcct, char typeCR)
        {
            if (IsProcessed() || fromJournal == null)
            {
                return(0);
            }
            int count     = 0;
            int lineCount = 0;

            MJournalLine[] fromLines = fromJournal.GetLines(false);
            for (int i = 0; i < fromLines.Length; i++)
            {
                MJournalLine toLine = new MJournalLine(GetCtx(), 0, fromJournal.Get_TrxName());
                PO.CopyValues(fromLines[i], toLine, GetAD_Client_ID(), GetAD_Org_ID());
                toLine.SetGL_Journal_ID(GetGL_Journal_ID());
                //
                if (dateAcct != null)
                {
                    toLine.SetDateAcct(dateAcct);
                }
                //	Amounts
                if (typeCR == 'C')                      //	correct
                {
                    // toLine.SetAmtSourceDr(fromLines[i].GetAmtSourceDr().negate());
                    toLine.SetAmtSourceDr(Decimal.Negate(fromLines[i].GetAmtSourceDr()));
                    toLine.SetAmtSourceCr(Decimal.Negate(fromLines[i].GetAmtSourceCr())); //.negate());
                }
                else if (typeCR == 'R')                                                   //	reverse
                {
                    toLine.SetAmtSourceDr(fromLines[i].GetAmtSourceCr());
                    toLine.SetAmtSourceCr(fromLines[i].GetAmtSourceDr());
                }
                toLine.SetIsGenerated(true);
                toLine.SetProcessed(false);

                // // Set Orignal Document Reference on Reversal Document
                if (Get_ColumnIndex("IsReversal") > 0 && IsReversal())
                {
                    if (toLine.Get_ColumnIndex("ReversalDoc_ID") > 0)
                    {
                        toLine.SetReversalDoc_ID(fromLines[i].GetGL_JournalLine_ID());
                    }
                }

                if (toLine.Save())
                {
                    count++;
                    lineCount += toLine.CopyLinesFrom(fromLines[i], toLine.GetGL_JournalLine_ID());
                }
            }
            if (fromLines.Length != count)
            {
                log.Log(Level.SEVERE, "Line difference - JournalLines=" + fromLines.Length + " <> Saved=" + count);
            }

            return(count);
        }       //	copyLinesFrom
示例#2
0
        }       //	copyLinesFrom

        // Mainsh 18/7/2016...
        public int CopyLines(MJournal fromJournal, char typeCR)
        {
            DateTime?dateAcct = GetDateAcct();

            if (IsProcessed() || fromJournal == null)
            {
                return(0);
            }
            int count     = 0;
            int lineCount = 0;

            MJournalLine[] fromLines = fromJournal.GetLines(false);
            for (int i = 0; i < fromLines.Length; i++)
            {
                MJournalLine toLine = new MJournalLine(GetCtx(), 0, fromJournal.Get_TrxName());
                PO.CopyValues(fromLines[i], toLine, GetAD_Client_ID(), GetAD_Org_ID());
                toLine.SetGL_Journal_ID(GetGL_Journal_ID());
                //
                //if (dateAcct != null)
                //{
                //    toLine.SetDateAcct(dateAcct);
                //}
                //	Amounts
                //if (typeCR == 'C')			//	correct
                //{
                //    // toLine.SetAmtSourceDr(fromLines[i].GetAmtSourceDr().negate());
                //    toLine.SetAmtSourceDr(Decimal.Negate(fromLines[i].GetAmtSourceDr()));
                //    toLine.SetAmtSourceCr(Decimal.Negate(fromLines[i].GetAmtSourceCr()));//.negate());
                //}
                //else if (typeCR == 'R')		//	reverse
                //{
                toLine.SetAmtSourceDr(fromLines[i].GetAmtSourceDr());
                toLine.SetAmtSourceCr(fromLines[i].GetAmtSourceCr());
                // }

                toLine.SetDescription(fromLines[i].GetDescription());
                toLine.SetC_Currency_ID(fromLines[i].GetC_Currency_ID());
                toLine.SetIsGenerated(true);
                toLine.SetProcessed(false);
                toLine.SetQty(fromLines[i].GetQty());
                toLine.SetElementType(fromLines[i].GetElementType());


                if (toLine.Save(fromJournal.Get_TrxName()))
                {
                    count++;
                    lineCount += toLine.CopyLinesFrom(fromLines[i], toLine.GetGL_JournalLine_ID());
                }
            }
            if (fromLines.Length != count)
            {
                log.Log(Level.SEVERE, "Line difference - JournalLines=" + fromLines.Length + " <> Saved=" + count);
            }

            return(count);
        }       //	copyLinesFrom
示例#3
0
        }       //	copyLinesFrom

        //end

        //added by To Create Journal Lines Arpit Rai 15th Dec,2016
        public int CopyJLines(MJournal fromJournal, DateTime?dateAcct)
        {
            if (IsProcessed() || fromJournal == null)
            {
                return(0);
            }
            int count     = 0;
            int lineCount = 0;

            MJournalLine[] fromLines = fromJournal.GetLines(false);
            for (int i = 0; i < fromLines.Length; i++)
            {
                MJournalLine toLine = new MJournalLine(GetCtx(), 0, fromJournal.Get_TrxName());
                PO.CopyValues(fromLines[i], toLine, GetAD_Client_ID(), GetAD_Org_ID());
                toLine.SetGL_Journal_ID(GetGL_Journal_ID());
                if (dateAcct != null)
                {
                    toLine.SetDateAcct(dateAcct);
                }
                else
                {
                    toLine.SetDateAcct(DateTime.Now);
                }
                toLine.SetAmtSourceDr(fromLines[i].GetAmtSourceDr());
                toLine.SetAmtSourceCr(fromLines[i].GetAmtSourceCr());
                toLine.SetDescription(fromLines[i].GetDescription());
                toLine.SetC_Currency_ID(fromLines[i].GetC_Currency_ID());
                toLine.SetIsGenerated(true);
                toLine.SetProcessed(false);
                toLine.SetQty(fromLines[i].GetQty());
                toLine.SetElementType(fromLines[i].GetElementType());
                if (toLine.Save(fromJournal.Get_TrxName()))
                {
                    count++;
                    lineCount += toLine.CopyLinesFrom(fromLines[i], toLine.GetGL_JournalLine_ID());
                }
            }
            if (fromLines.Length != count)
            {
                log.Log(Level.SEVERE, "Line difference - JournalLines=" + fromLines.Length + " <> Saved=" + count);
            }

            return(count);
        }