IDEMPIERE-4723 - Clean up org.compiere.acct dead code (#921)

This commit is contained in:
Diego Ruiz 2021-10-13 07:19:18 +02:00 committed by GitHub
parent 08b2c28207
commit 6dd60f30c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 4 additions and 216 deletions

View File

@ -290,9 +290,6 @@ public class DocLine
m_DiscountAmt = m_ListAmt.subtract(m_LineNetAmt);
//
setAmount (m_ListAmt, m_DiscountAmt);
// Log.trace(this,Log.l6_Database, "DocLine_Invoice.setAmount",
// "LineNet=" + m_LineNetAmt + ", List=" + m_ListAmt + ", Discount=" + m_DiscountAmt
// + " => Amount=" + getAmount());
} // setAmounts
/**

View File

@ -27,11 +27,6 @@ public class Doc_AssetTransfer extends Doc
protected String loadDocumentDetails()
{
// Fix C_Period_ID
// MAssetTransfer assetTr = getAssetTransfer();
// assetTr.setC_Period_ID();
// assetTr.saveEx();
return null;
}
@ -50,7 +45,6 @@ public class Doc_AssetTransfer extends Doc
{
MAssetTransfer assetTr = getAssetTransfer();
MDepreciationWorkfile wk = getAssetWorkfile();
//MDepreciationExp exp = getExpense();
ArrayList<Fact> facts = new ArrayList<Fact>();
Fact fact = new Fact(this, as, assetTr.getPostingType());
@ -72,15 +66,10 @@ public class Doc_AssetTransfer extends Doc
MAccount dr = MAccount.get(getCtx(), assetTr.getA_Accumdepreciation_Acct());
FactUtil.createSimpleOperation(fact, null, dr, cr, as.getC_Currency_ID(),
wk.getA_Accumulated_Depr(), false);
//exp.getA_Accumulated_Depr(), false);
}
//
return facts;
}
/*private MDepreciationExp getExpense() {
return MDepreciationExp.get(getCtx(), 1712112);
}*/
private MAssetTransfer getAssetTransfer()
{

View File

@ -174,7 +174,6 @@ public class Doc_BankStatement extends Doc
MAccount acct_bank_asset = getAccount(Doc.ACCTTYPE_BankAsset, as);
MAccount acct_bank_in_transit = getAccount(Doc.ACCTTYPE_BankInTransit, as);
// if ((!as.isPostIfClearingEqual()) && acct_bank_asset.equals(acct_bank_in_transit) && (!isInterOrg)) {
// don't validate interorg on banks for this - normally banks are balanced by orgs
if ((!as.isPostIfClearingEqual()) && acct_bank_asset.equals(acct_bank_in_transit)) {
// Not using clearing accounts
@ -248,8 +247,7 @@ public class Doc_BankStatement extends Doc
line.getC_Currency_ID(), line.getInterestAmt().negate());
if (fl != null && C_BPartner_ID != 0)
fl.setC_BPartner_ID(C_BPartner_ID);
//
// fact.createTaxCorrection();
}
//
ArrayList<Fact> facts = new ArrayList<Fact>();
@ -257,33 +255,6 @@ public class Doc_BankStatement extends Doc
return facts;
} // createFact
/** Verify if the posting involves two or more organizations
@return true if there are more than one org involved on the posting
private boolean isInterOrg(MAcctSchema as) {
MAcctSchemaElement elementorg = as.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_Organization);
if (elementorg == null || !elementorg.isBalanced()) {
// no org element or not need to be balanced
return false;
}
if (p_lines.length <= 0) {
// no lines
return false;
}
int startorg = getBank_Org_ID();
if (startorg == 0)
startorg = p_lines[0].getAD_Org_ID();
// validate if the allocation involves more than one org
for (int i = 0; i < p_lines.length; i++) {
if (p_lines[i].getAD_Org_ID() != startorg)
return true;
}
return false;
}
*/
/**
* Get AD_Org_ID from Bank Account
* @return AD_Org_ID or 0

View File

@ -177,16 +177,12 @@ public class Doc_Cash extends Doc
// CashAsset CR
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashExpense, as),
getC_Currency_ID(), line.getAmount().negate(), null);
// fact.createLine(line, getAccount(Doc.ACCTTYPE_CashAsset, as),
// p_vo.C_Currency_ID, null, line.getAmount().negate());
assetAmt = assetAmt.subtract(line.getAmount().negate());
}
else if (CashType.equals(DocLine_Cash.CASHTYPE_RECEIPT))
{ // amount is positive
// CashAsset DR
// CashReceipt CR
// fact.createLine(line, getAccount(Doc.ACCTTYPE_CashAsset, as),
// p_vo.C_Currency_ID, line.getAmount(), null);
assetAmt = assetAmt.add(line.getAmount());
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashReceipt, as),
getC_Currency_ID(), null, line.getAmount());
@ -197,8 +193,6 @@ public class Doc_Cash extends Doc
// CashAsset CR
fact.createLine(line, line.getChargeAccount(as, line.getAmount().negate()),
getC_Currency_ID(), line.getAmount().negate());
// fact.createLine(line, getAccount(Doc.ACCTTYPE_CashAsset, as),
// p_vo.C_Currency_ID, null, line.getAmount().negate());
assetAmt = assetAmt.subtract(line.getAmount().negate());
}
else if (CashType.equals(DocLine_Cash.CASHTYPE_DIFFERENCE))
@ -207,8 +201,6 @@ public class Doc_Cash extends Doc
// CashAsset CR
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashDifference, as),
getC_Currency_ID(), line.getAmount().negate());
// fact.createLine(line, getAccount(Doc.ACCTTYPE_CashAsset, as),
// p_vo.C_Currency_ID, line.getAmount());
assetAmt = assetAmt.add(line.getAmount());
}
else if (CashType.equals(DocLine_Cash.CASHTYPE_INVOICE))

View File

@ -850,11 +850,7 @@ public class Doc_InOut extends Doc
//update below
costs = Env.ONE;
}
// NotInvoicedReceipt DR
// Elaine 2008/06/26
/*dr = fact.createLine(line,
getAccount(Doc.ACCTTYPE_NotInvoicedReceipts, as),
as.getC_Currency_ID(), costs , null);*/
dr = fact.createLine(line,
getAccount(Doc.ACCTTYPE_NotInvoicedReceipts, as),
C_Currency_ID, costs , null);
@ -888,9 +884,7 @@ public class Doc_InOut extends Doc
MAccount assets = line.getAccount(ProductCost.ACCTTYPE_P_Asset, as);
if (product.isService())
assets = line.getAccount(ProductCost.ACCTTYPE_P_Expense, as);
// Elaine 2008/06/26
/*cr = fact.createLine(line, assets,
as.getC_Currency_ID(), null, costs);*/
cr = fact.createLine(line, assets,
C_Currency_ID, null, costs);
//

View File

@ -419,7 +419,6 @@ public class Doc_Invoice extends Doc
// Receivables DR
int receivables_ID = getValidCombination_ID(Doc.ACCTTYPE_C_Receivable, as);
// Deprecated IDEMPIERE-362
// int receivablesServices_ID = getValidCombination_ID (Doc.ACCTTYPE_C_Receivable_Services, as);
int receivablesServices_ID = receivables_ID;
if (m_allLinesItem || !as.isPostServices()
|| receivables_ID == receivablesServices_ID)
@ -608,8 +607,6 @@ public class Doc_Invoice extends Doc
// Liability CR
int payables_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability, as);
// Deprecated IDEMPIERE-362
// int payablesServices_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability_Services, as);
int payablesServices_ID = payables_ID;
if (m_allLinesItem || !as.isPostServices()
|| payables_ID == payablesServices_ID)
@ -1148,7 +1145,6 @@ public class Doc_Invoice extends Doc
.append("FROM C_Invoice i, C_InvoiceLine il ")
.append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
.append(" AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID");
//jz + " AND ROWNUM=1 AND i.C_Invoice_ID=").append(get_ID()).append(") ")
if (DB.isOracle()) //jz
{
sql.append(" AND ROWNUM=1 ");

View File

@ -89,9 +89,6 @@ public class Doc_MatchInv extends Doc
private ProductCost m_pc = null;
private MMatchInv m_matchInv;
/** Commitments */
// private DocLine[] m_commitments = null;
/**
* Load Specific Document Details
* @return error message or null
@ -189,15 +186,6 @@ public class Doc_MatchInv extends Doc
setC_Currency_ID (as.getC_Currency_ID());
boolean isInterOrg = isInterOrg(as);
/** Needs to be handled in PO Matching as no Receipt info
if (m_pc.isService())
{
log.fine("Service - skipped");
return fact;
}
**/
// NotInvoicedReceipt DR
// From Receipt
BigDecimal multiplier = getQty()

View File

@ -82,7 +82,6 @@ public class Doc_Order extends Doc
// Contained Objects
m_taxes = loadTaxes();
p_lines = loadLines(order);
// log.fine( "Lines=" + p_lines.length + ", Taxes=" + m_taxes.length);
return null;
} // loadDocumentDetails
@ -468,7 +467,6 @@ public class Doc_Order extends Doc
.append("FROM C_Order o, C_OrderLine ol ")
.append("WHERE o.C_Order_ID=ol.C_Order_ID")
.append(" AND po.M_Product_ID=ol.M_Product_ID AND po.C_BPartner_ID=o.C_BPartner_ID ");
//jz + " AND ROWNUM=1 AND o.C_Order_ID=").append(get_ID()).append(") ")
if (DB.isOracle()) //jz
{
sql.append(" AND ROWNUM=1 ");

View File

@ -83,7 +83,6 @@ public class Doc_Payment extends Doc
public BigDecimal getBalance()
{
BigDecimal retValue = Env.ZERO;
// log.config( toString() + " Balance=" + retValue);
return retValue;
} // getBalance

View File

@ -67,7 +67,6 @@ public class Doc_Requisition extends Doc
setAmount(AMTTYPE_Net, req.getTotalLines());
// Contained Objects
p_lines = loadLines (req);
// log.fine( "Lines=" + p_lines.length + ", Taxes=" + m_taxes.length);
return null;
} // loadDocumentDetails
@ -86,7 +85,6 @@ public class Doc_Requisition extends Doc
DocLine docLine = new DocLine (line, this);
BigDecimal Qty = line.getQty();
docLine.setQty (Qty, false);
//BigDecimal PriceActual = line.getPriceActual();
BigDecimal LineNetAmt = line.getLineNetAmt();
docLine.setAmount (LineNetAmt); // DR
list.add (docLine);

View File

@ -439,7 +439,6 @@ public final class Fact
{
FactLine line = (FactLine)m_lines.get(i);
Integer key = Integer.valueOf(line.getAD_Org_ID());
// BigDecimal balance = line.getSourceBalance();
Balance oldBalance = (Balance)map.get(key);
if (oldBalance == null)
{
@ -448,7 +447,6 @@ public final class Fact
}
else
oldBalance.add(line.getAmtSourceDr(), line.getAmtSourceCr());
// log.info ("Key=" + key + ", Balance=" + balance + " - " + line);
}
// Create entry for non-zero element
@ -706,11 +704,6 @@ public final class Fact
// No Distribution for this line
//AZ Goodwill
//The above "get" only work in GL Journal because it's using ValidCombination Account
//Old:
//if (distributions == null || distributions.length == 0)
// continue;
//For other document, we try the followings (from FactLine):
//New:
if (distributions == null || distributions.length == 0)
{
distributions = MDistribution.get (dLine.getCtx(), dLine.getC_AcctSchema_ID(),
@ -846,7 +839,6 @@ public final class Fact
for (int i = 0; i < m_lines.size(); i++)
{
FactLine fl = (FactLine)m_lines.get(i);
// log.fine("save - " + fl);
if (!fl.save(trxName)) // abort on first error
return false;
}

View File

@ -82,7 +82,6 @@ public final class FactLine extends X_Fact_Acct
setAmtAcctDr (Env.ZERO);
setAmtSourceCr (Env.ZERO);
setAmtSourceDr (Env.ZERO);
// Log.trace(this,Log.l1_User, "FactLine " + AD_Table_ID + ":" + Record_ID);
setAD_Table_ID (AD_Table_ID);
setRecord_ID (Record_ID);
setLine_ID (Line_ID);
@ -922,11 +921,6 @@ public final class FactLine extends X_Fact_Acct
if (m_acct != null && super.getC_SalesRegion_ID() == 0)
setC_SalesRegion_ID (m_acct.getC_SalesRegion_ID());
}
//
// log.fine("C_SalesRegion_ID=" + super.getC_SalesRegion_ID()
// + ", C_BPartner_Location_ID=" + m_docVO.C_BPartner_Location_ID
// + ", BP_C_SalesRegion_ID=" + m_docVO.BP_C_SalesRegion_ID
// + ", SR=" + m_acctSchema.isAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_SalesRegion));
return super.getC_SalesRegion_ID();
} // getC_SalesRegion_ID
@ -1176,8 +1170,6 @@ public final class FactLine extends X_Fact_Acct
// Accounted Amounts - reverse
BigDecimal dr = fact.getAmtAcctDr();
BigDecimal cr = fact.getAmtAcctCr();
// setAmtAcctDr (cr.multiply(multiplier));
// setAmtAcctCr (dr.multiply(multiplier));
setAmtAcct(getC_Currency_ID(), cr.multiply(multiplier), dr.multiply(multiplier));
//
// Bayu Sistematika - Source Amounts

View File

@ -49,7 +49,7 @@ public final class FactUtil
int C_Currency_ID, BigDecimal amt, boolean signSensitive)
{
FactLine[] lines = new FactLine[2];
//newTrxIndex();
if (signSensitive) {
lines[0] = fact.createLine(docLine, account_DR, C_Currency_ID, amt);
lines[1] = fact.createLine(docLine, account_CR, C_Currency_ID, amt.negate());
@ -58,7 +58,6 @@ public final class FactUtil
lines[0] = fact.createLine(docLine, account_DR, C_Currency_ID, amt, null);
lines[1] = fact.createLine(docLine, account_CR, C_Currency_ID, null, amt);
}
//newTrxIndex();
//
return lines;
} // createLine

View File

@ -154,7 +154,6 @@ public class Matcher
{
if (log.isLoggable(Level.FINE)) log.fine("InvLine=" + C_InvoiceLine_ID + ",Rec=" + M_InOutLine_ID + ", Qty=" + Qty + ", " + DateTrx);
// MMatchInv inv = new MMatchInv ();
int M_MatchInv_ID = DB.getNextID (AD_Client_ID, "M_MatchInv", m_trxName);
//
StringBuilder sql = new StringBuilder("INSERT INTO M_MatchInv (")

View File

@ -228,120 +228,4 @@ public class ProductInfo
{
return m_qty;
} // getQty
/**
* Get PO Price from PriceList - and convert it to AcctSchema Currency
* @param as accounting schema
* @param onlyPOPriceList use only PO price list
* @return po price
*/
/*private BigDecimal getPriceList (MAcctSchema as, boolean onlyPOPriceList)
{
StringBuilder sql = new StringBuilder (
"SELECT pl.C_Currency_ID, pp.PriceList, pp.PriceStd, pp.PriceLimit ")
.append("FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp ")
.append("WHERE pl.M_PriceList_ID = plv.M_PriceList_ID")
.append(" AND plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID")
.append(" AND pp.M_Product_ID=?");
if (onlyPOPriceList)
sql.append(" AND pl.IsSOPriceList='N'");
sql.append(" ORDER BY pl.IsSOPriceList ASC, plv.ValidFrom DESC");
int C_Currency_ID = 0;
BigDecimal PriceList = null;
BigDecimal PriceStd = null;
BigDecimal PriceLimit = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, m_M_Product_ID);
rs = pstmt.executeQuery();
if (rs.next())
{
C_Currency_ID = rs.getInt(1);
PriceList = rs.getBigDecimal(2);
PriceStd = rs.getBigDecimal(3);
PriceLimit = rs.getBigDecimal(4);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// nothing found
if (C_Currency_ID == 0)
return null;
BigDecimal price = PriceLimit; // best bet
if (price == null || price.compareTo(Env.ZERO)==0)
price = PriceStd;
if (price == null || price.compareTo(Env.ZERO)==0)
price = PriceList;
// Convert
if (price != null && price.compareTo(Env.ZERO)!=0)
price = MConversionRate.convert (as.getCtx(),
price, C_Currency_ID, as.getC_Currency_ID(),
as.getAD_Client_ID(), 0);
return price;
} // getPOPrice*/
/**
* Get PO Cost from Purchase Info - and convert it to AcctSchema Currency
* @param as accounting schema
* @return po cost
*/
/*private BigDecimal getPOCost (MAcctSchema as)
{
String sql = "SELECT C_Currency_ID, PriceList,PricePO,PriceLastPO "
+ "FROM M_Product_PO WHERE M_Product_ID=? "
+ "ORDER BY IsCurrentVendor DESC";
int C_Currency_ID = 0;
BigDecimal PriceList = null;
BigDecimal PricePO = null;
BigDecimal PriceLastPO = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_M_Product_ID);
rs = pstmt.executeQuery();
if (rs.next())
{
C_Currency_ID = rs.getInt(1);
PriceList = rs.getBigDecimal(2);
PricePO = rs.getBigDecimal(3);
PriceLastPO = rs.getBigDecimal(4);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// nothing found
if (C_Currency_ID == 0)
return null;
BigDecimal cost = PriceLastPO; // best bet
if (cost == null || cost.compareTo(Env.ZERO)==0)
cost = PricePO;
if (cost == null || cost.compareTo(Env.ZERO)==0)
cost = PriceList;
// Convert - standard precision!! - should be costing precision
if (cost != null && cost.compareTo(Env.ZERO)!=0)
cost = MConversionRate.convert (as.getCtx(),
cost, C_Currency_ID, as.getC_Currency_ID(), m_AD_Client_ID, m_AD_Org_ID);
return cost;
} // getPOCost*/
} // ProductInfo