From 72fd2663784b06c5e09e8656e1b6851762a72dbf Mon Sep 17 00:00:00 2001 From: armenrz Date: Wed, 20 Jun 2007 00:34:09 +0000 Subject: [PATCH] Average Costing & Landed Cost fixes --- base/src/org/compiere/model/MCostElement.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/base/src/org/compiere/model/MCostElement.java b/base/src/org/compiere/model/MCostElement.java index abe0c98a14..11ab3d4fdf 100644 --- a/base/src/org/compiere/model/MCostElement.java +++ b/base/src/org/compiere/model/MCostElement.java @@ -178,6 +178,50 @@ public class MCostElement extends X_M_CostElement return retValue; } // getMaterialCostElement + // MZ Goodwill + /** + * Get active non Material Cost Element for client + * @param po parent + * @return cost element array + */ + public static MCostElement[] getNonCostingMethods (PO po) + { + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM M_CostElement " + + "WHERE AD_Client_ID=?" + + " AND IsActive='Y' AND CostingMethod IS NULL"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, po.get_TrxName()); + pstmt.setInt (1, po.getAD_Client_ID()); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + list.add(new MCostElement (po.getCtx(), rs, po.get_TrxName())); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + s_log.log (Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + // + MCostElement[] retValue = new MCostElement[list.size ()]; + list.toArray (retValue); + return retValue; + } // getMaterialCostElement + // end MZ /** * Get Cost Element from Cache