} // updateJournalTotal /// <summary> /// This functionis used to create Line Dimension Line /// </summary> /// <param name="fromJournal">object of old GL Journal Line from where we need to pick lines</param> /// <param name="newlineID">GL Journal Line ID - new record agsint which we copy lines</param> /// <param name="typeCR">Optional Parameter - When 'C' - its means Reverse record - amount to be negate in this case</param> /// <returns>count of line - which is created</returns> public int CopyLinesFrom(MJournalLine fromJournal, int newlineID, char typeCR = 'X') { if (IsProcessed() || fromJournal == null) { return(0); } int count = 0; int lineCount = 0; MLineDimension[] fromLines = fromJournal.GetLines(false); for (int i = 0; i < fromLines.Length; i++) { MLineDimension toLine = new MLineDimension(GetCtx(), 0, fromJournal.Get_TrxName()); PO.CopyValues(fromLines[i], toLine, GetAD_Client_ID(), GetAD_Org_ID()); toLine.SetC_BPartner_ID(fromLines[i].GetC_BPartner_ID()); toLine.SetC_Campaign_ID(fromLines[i].GetC_Campaign_ID()); toLine.SetC_ElementValue_ID(fromLines[i].GetC_ElementValue_ID()); toLine.SetC_Element_ID(fromLines[i].GetC_Element_ID()); toLine.SetC_Location_ID(fromLines[i].GetC_Location_ID()); toLine.SetC_Project_ID(fromLines[i].GetC_Project_ID()); toLine.SetC_SalesRegion_ID(fromLines[i].GetC_SalesRegion_ID()); toLine.SetM_Product_ID(fromLines[i].GetM_Product_ID()); toLine.SetOrg_ID(fromLines[i].GetOrg_ID()); toLine.SetSeqNo(fromLines[i].GetSeqNo()); toLine.SetLineType(fromLines[i].GetLineType()); toLine.SetGL_JournalLine_ID(newlineID); if (typeCR == 'C') { toLine.SetAmount(Decimal.Negate(fromLines[i].GetAmount())); } else { toLine.SetAmount(fromLines[i].GetAmount()); } toLine.SetLine(fromLines[i].GetLine()); if (toLine.Save(fromJournal.Get_TrxName())) { count++; } } if (fromLines.Length != count) { log.Log(Level.SEVERE, "Line difference - LinesDimensionl=" + fromLines.Length + " <> Saved=" + count); } return(lineCount); }
public MLineDimension[] GetLines(Boolean requery) { //ArrayList<MJournalLine> list = new ArrayList<MJournalLine>(); List <MLineDimension> list = new List <MLineDimension>(); String sql = "SELECT * FROM GL_LineDimension WHERE GL_JournalLine_ID=@Param1 ORDER BY Line"; //PreparedStatement pstmt = null; SqlParameter[] Param = new SqlParameter[1]; IDataReader idr = null; DataTable dt = null; try { //pstmt = DataBase.prepareStatement(sql, get_TrxName()); //pstmt.setInt(1, GetGL_JournalLine_ID()); Param[0] = new SqlParameter("@Param1", GetGL_JournalLine_ID()); idr = DataBase.DB.ExecuteReader(sql, Param, Get_TrxName()); dt = new DataTable(); dt.Load(idr); idr.Close(); //while (rs.next()) foreach (DataRow dr in dt.Rows) { list.Add(new MLineDimension(GetCtx(), dr, Get_TrxName())); } dt = null; } catch (Exception ex) { if (idr != null) { idr.Close(); } if (dt != null) { dt = null; } log.Log(Level.SEVERE, "getLines", ex); } // MLineDimension[] retValue = new MLineDimension[list.Count]; //list.toArray(retValue); retValue = list.ToArray(); return(retValue); } // getLines