IDEMPIERE-4723 - Clean up org.compiere.acct dead code (#921)
This commit is contained in:
parent
08b2c28207
commit
6dd60f30c7
|
@ -290,9 +290,6 @@ public class DocLine
|
||||||
m_DiscountAmt = m_ListAmt.subtract(m_LineNetAmt);
|
m_DiscountAmt = m_ListAmt.subtract(m_LineNetAmt);
|
||||||
//
|
//
|
||||||
setAmount (m_ListAmt, m_DiscountAmt);
|
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
|
} // setAmounts
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,11 +27,6 @@ public class Doc_AssetTransfer extends Doc
|
||||||
|
|
||||||
protected String loadDocumentDetails()
|
protected String loadDocumentDetails()
|
||||||
{
|
{
|
||||||
// Fix C_Period_ID
|
|
||||||
// MAssetTransfer assetTr = getAssetTransfer();
|
|
||||||
// assetTr.setC_Period_ID();
|
|
||||||
// assetTr.saveEx();
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +45,6 @@ public class Doc_AssetTransfer extends Doc
|
||||||
{
|
{
|
||||||
MAssetTransfer assetTr = getAssetTransfer();
|
MAssetTransfer assetTr = getAssetTransfer();
|
||||||
MDepreciationWorkfile wk = getAssetWorkfile();
|
MDepreciationWorkfile wk = getAssetWorkfile();
|
||||||
//MDepreciationExp exp = getExpense();
|
|
||||||
|
|
||||||
ArrayList<Fact> facts = new ArrayList<Fact>();
|
ArrayList<Fact> facts = new ArrayList<Fact>();
|
||||||
Fact fact = new Fact(this, as, assetTr.getPostingType());
|
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());
|
MAccount dr = MAccount.get(getCtx(), assetTr.getA_Accumdepreciation_Acct());
|
||||||
FactUtil.createSimpleOperation(fact, null, dr, cr, as.getC_Currency_ID(),
|
FactUtil.createSimpleOperation(fact, null, dr, cr, as.getC_Currency_ID(),
|
||||||
wk.getA_Accumulated_Depr(), false);
|
wk.getA_Accumulated_Depr(), false);
|
||||||
//exp.getA_Accumulated_Depr(), false);
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
return facts;
|
return facts;
|
||||||
}
|
}
|
||||||
/*private MDepreciationExp getExpense() {
|
|
||||||
|
|
||||||
return MDepreciationExp.get(getCtx(), 1712112);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private MAssetTransfer getAssetTransfer()
|
private MAssetTransfer getAssetTransfer()
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,7 +174,6 @@ public class Doc_BankStatement extends Doc
|
||||||
MAccount acct_bank_asset = getAccount(Doc.ACCTTYPE_BankAsset, as);
|
MAccount acct_bank_asset = getAccount(Doc.ACCTTYPE_BankAsset, as);
|
||||||
MAccount acct_bank_in_transit = getAccount(Doc.ACCTTYPE_BankInTransit, 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
|
// 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)) {
|
if ((!as.isPostIfClearingEqual()) && acct_bank_asset.equals(acct_bank_in_transit)) {
|
||||||
// Not using clearing accounts
|
// Not using clearing accounts
|
||||||
|
@ -248,8 +247,7 @@ public class Doc_BankStatement extends Doc
|
||||||
line.getC_Currency_ID(), line.getInterestAmt().negate());
|
line.getC_Currency_ID(), line.getInterestAmt().negate());
|
||||||
if (fl != null && C_BPartner_ID != 0)
|
if (fl != null && C_BPartner_ID != 0)
|
||||||
fl.setC_BPartner_ID(C_BPartner_ID);
|
fl.setC_BPartner_ID(C_BPartner_ID);
|
||||||
//
|
|
||||||
// fact.createTaxCorrection();
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
ArrayList<Fact> facts = new ArrayList<Fact>();
|
ArrayList<Fact> facts = new ArrayList<Fact>();
|
||||||
|
@ -257,33 +255,6 @@ public class Doc_BankStatement extends Doc
|
||||||
return facts;
|
return facts;
|
||||||
} // createFact
|
} // 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
|
* Get AD_Org_ID from Bank Account
|
||||||
* @return AD_Org_ID or 0
|
* @return AD_Org_ID or 0
|
||||||
|
|
|
@ -177,16 +177,12 @@ public class Doc_Cash extends Doc
|
||||||
// CashAsset CR
|
// CashAsset CR
|
||||||
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashExpense, as),
|
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashExpense, as),
|
||||||
getC_Currency_ID(), line.getAmount().negate(), null);
|
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());
|
assetAmt = assetAmt.subtract(line.getAmount().negate());
|
||||||
}
|
}
|
||||||
else if (CashType.equals(DocLine_Cash.CASHTYPE_RECEIPT))
|
else if (CashType.equals(DocLine_Cash.CASHTYPE_RECEIPT))
|
||||||
{ // amount is positive
|
{ // amount is positive
|
||||||
// CashAsset DR
|
// CashAsset DR
|
||||||
// CashReceipt CR
|
// CashReceipt CR
|
||||||
// fact.createLine(line, getAccount(Doc.ACCTTYPE_CashAsset, as),
|
|
||||||
// p_vo.C_Currency_ID, line.getAmount(), null);
|
|
||||||
assetAmt = assetAmt.add(line.getAmount());
|
assetAmt = assetAmt.add(line.getAmount());
|
||||||
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashReceipt, as),
|
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashReceipt, as),
|
||||||
getC_Currency_ID(), null, line.getAmount());
|
getC_Currency_ID(), null, line.getAmount());
|
||||||
|
@ -197,8 +193,6 @@ public class Doc_Cash extends Doc
|
||||||
// CashAsset CR
|
// CashAsset CR
|
||||||
fact.createLine(line, line.getChargeAccount(as, line.getAmount().negate()),
|
fact.createLine(line, line.getChargeAccount(as, line.getAmount().negate()),
|
||||||
getC_Currency_ID(), 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());
|
assetAmt = assetAmt.subtract(line.getAmount().negate());
|
||||||
}
|
}
|
||||||
else if (CashType.equals(DocLine_Cash.CASHTYPE_DIFFERENCE))
|
else if (CashType.equals(DocLine_Cash.CASHTYPE_DIFFERENCE))
|
||||||
|
@ -207,8 +201,6 @@ public class Doc_Cash extends Doc
|
||||||
// CashAsset CR
|
// CashAsset CR
|
||||||
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashDifference, as),
|
fact.createLine(line, getAccount(Doc.ACCTTYPE_CashDifference, as),
|
||||||
getC_Currency_ID(), line.getAmount().negate());
|
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());
|
assetAmt = assetAmt.add(line.getAmount());
|
||||||
}
|
}
|
||||||
else if (CashType.equals(DocLine_Cash.CASHTYPE_INVOICE))
|
else if (CashType.equals(DocLine_Cash.CASHTYPE_INVOICE))
|
||||||
|
|
|
@ -850,11 +850,7 @@ public class Doc_InOut extends Doc
|
||||||
//update below
|
//update below
|
||||||
costs = Env.ONE;
|
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,
|
dr = fact.createLine(line,
|
||||||
getAccount(Doc.ACCTTYPE_NotInvoicedReceipts, as),
|
getAccount(Doc.ACCTTYPE_NotInvoicedReceipts, as),
|
||||||
C_Currency_ID, costs , null);
|
C_Currency_ID, costs , null);
|
||||||
|
@ -888,9 +884,7 @@ public class Doc_InOut extends Doc
|
||||||
MAccount assets = line.getAccount(ProductCost.ACCTTYPE_P_Asset, as);
|
MAccount assets = line.getAccount(ProductCost.ACCTTYPE_P_Asset, as);
|
||||||
if (product.isService())
|
if (product.isService())
|
||||||
assets = line.getAccount(ProductCost.ACCTTYPE_P_Expense, as);
|
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,
|
cr = fact.createLine(line, assets,
|
||||||
C_Currency_ID, null, costs);
|
C_Currency_ID, null, costs);
|
||||||
//
|
//
|
||||||
|
|
|
@ -419,7 +419,6 @@ public class Doc_Invoice extends Doc
|
||||||
// Receivables DR
|
// Receivables DR
|
||||||
int receivables_ID = getValidCombination_ID(Doc.ACCTTYPE_C_Receivable, as);
|
int receivables_ID = getValidCombination_ID(Doc.ACCTTYPE_C_Receivable, as);
|
||||||
// Deprecated IDEMPIERE-362
|
// Deprecated IDEMPIERE-362
|
||||||
// int receivablesServices_ID = getValidCombination_ID (Doc.ACCTTYPE_C_Receivable_Services, as);
|
|
||||||
int receivablesServices_ID = receivables_ID;
|
int receivablesServices_ID = receivables_ID;
|
||||||
if (m_allLinesItem || !as.isPostServices()
|
if (m_allLinesItem || !as.isPostServices()
|
||||||
|| receivables_ID == receivablesServices_ID)
|
|| receivables_ID == receivablesServices_ID)
|
||||||
|
@ -608,8 +607,6 @@ public class Doc_Invoice extends Doc
|
||||||
|
|
||||||
// Liability CR
|
// Liability CR
|
||||||
int payables_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability, as);
|
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;
|
int payablesServices_ID = payables_ID;
|
||||||
if (m_allLinesItem || !as.isPostServices()
|
if (m_allLinesItem || !as.isPostServices()
|
||||||
|| payables_ID == payablesServices_ID)
|
|| payables_ID == payablesServices_ID)
|
||||||
|
@ -1148,7 +1145,6 @@ public class Doc_Invoice extends Doc
|
||||||
.append("FROM C_Invoice i, C_InvoiceLine il ")
|
.append("FROM C_Invoice i, C_InvoiceLine il ")
|
||||||
.append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
|
.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");
|
.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
|
if (DB.isOracle()) //jz
|
||||||
{
|
{
|
||||||
sql.append(" AND ROWNUM=1 ");
|
sql.append(" AND ROWNUM=1 ");
|
||||||
|
|
|
@ -89,9 +89,6 @@ public class Doc_MatchInv extends Doc
|
||||||
private ProductCost m_pc = null;
|
private ProductCost m_pc = null;
|
||||||
private MMatchInv m_matchInv;
|
private MMatchInv m_matchInv;
|
||||||
|
|
||||||
/** Commitments */
|
|
||||||
// private DocLine[] m_commitments = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Specific Document Details
|
* Load Specific Document Details
|
||||||
* @return error message or null
|
* @return error message or null
|
||||||
|
@ -189,15 +186,6 @@ public class Doc_MatchInv extends Doc
|
||||||
setC_Currency_ID (as.getC_Currency_ID());
|
setC_Currency_ID (as.getC_Currency_ID());
|
||||||
boolean isInterOrg = isInterOrg(as);
|
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
|
// NotInvoicedReceipt DR
|
||||||
// From Receipt
|
// From Receipt
|
||||||
BigDecimal multiplier = getQty()
|
BigDecimal multiplier = getQty()
|
||||||
|
|
|
@ -82,7 +82,6 @@ public class Doc_Order extends Doc
|
||||||
// Contained Objects
|
// Contained Objects
|
||||||
m_taxes = loadTaxes();
|
m_taxes = loadTaxes();
|
||||||
p_lines = loadLines(order);
|
p_lines = loadLines(order);
|
||||||
// log.fine( "Lines=" + p_lines.length + ", Taxes=" + m_taxes.length);
|
|
||||||
return null;
|
return null;
|
||||||
} // loadDocumentDetails
|
} // loadDocumentDetails
|
||||||
|
|
||||||
|
@ -468,7 +467,6 @@ public class Doc_Order extends Doc
|
||||||
.append("FROM C_Order o, C_OrderLine ol ")
|
.append("FROM C_Order o, C_OrderLine ol ")
|
||||||
.append("WHERE o.C_Order_ID=ol.C_Order_ID")
|
.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 ");
|
.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
|
if (DB.isOracle()) //jz
|
||||||
{
|
{
|
||||||
sql.append(" AND ROWNUM=1 ");
|
sql.append(" AND ROWNUM=1 ");
|
||||||
|
|
|
@ -83,7 +83,6 @@ public class Doc_Payment extends Doc
|
||||||
public BigDecimal getBalance()
|
public BigDecimal getBalance()
|
||||||
{
|
{
|
||||||
BigDecimal retValue = Env.ZERO;
|
BigDecimal retValue = Env.ZERO;
|
||||||
// log.config( toString() + " Balance=" + retValue);
|
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getBalance
|
} // getBalance
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ public class Doc_Requisition extends Doc
|
||||||
setAmount(AMTTYPE_Net, req.getTotalLines());
|
setAmount(AMTTYPE_Net, req.getTotalLines());
|
||||||
// Contained Objects
|
// Contained Objects
|
||||||
p_lines = loadLines (req);
|
p_lines = loadLines (req);
|
||||||
// log.fine( "Lines=" + p_lines.length + ", Taxes=" + m_taxes.length);
|
|
||||||
return null;
|
return null;
|
||||||
} // loadDocumentDetails
|
} // loadDocumentDetails
|
||||||
|
|
||||||
|
@ -86,7 +85,6 @@ public class Doc_Requisition extends Doc
|
||||||
DocLine docLine = new DocLine (line, this);
|
DocLine docLine = new DocLine (line, this);
|
||||||
BigDecimal Qty = line.getQty();
|
BigDecimal Qty = line.getQty();
|
||||||
docLine.setQty (Qty, false);
|
docLine.setQty (Qty, false);
|
||||||
//BigDecimal PriceActual = line.getPriceActual();
|
|
||||||
BigDecimal LineNetAmt = line.getLineNetAmt();
|
BigDecimal LineNetAmt = line.getLineNetAmt();
|
||||||
docLine.setAmount (LineNetAmt); // DR
|
docLine.setAmount (LineNetAmt); // DR
|
||||||
list.add (docLine);
|
list.add (docLine);
|
||||||
|
|
|
@ -439,7 +439,6 @@ public final class Fact
|
||||||
{
|
{
|
||||||
FactLine line = (FactLine)m_lines.get(i);
|
FactLine line = (FactLine)m_lines.get(i);
|
||||||
Integer key = Integer.valueOf(line.getAD_Org_ID());
|
Integer key = Integer.valueOf(line.getAD_Org_ID());
|
||||||
// BigDecimal balance = line.getSourceBalance();
|
|
||||||
Balance oldBalance = (Balance)map.get(key);
|
Balance oldBalance = (Balance)map.get(key);
|
||||||
if (oldBalance == null)
|
if (oldBalance == null)
|
||||||
{
|
{
|
||||||
|
@ -448,7 +447,6 @@ public final class Fact
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
oldBalance.add(line.getAmtSourceDr(), line.getAmtSourceCr());
|
oldBalance.add(line.getAmtSourceDr(), line.getAmtSourceCr());
|
||||||
// log.info ("Key=" + key + ", Balance=" + balance + " - " + line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create entry for non-zero element
|
// Create entry for non-zero element
|
||||||
|
@ -706,11 +704,6 @@ public final class Fact
|
||||||
// No Distribution for this line
|
// No Distribution for this line
|
||||||
//AZ Goodwill
|
//AZ Goodwill
|
||||||
//The above "get" only work in GL Journal because it's using ValidCombination Account
|
//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)
|
if (distributions == null || distributions.length == 0)
|
||||||
{
|
{
|
||||||
distributions = MDistribution.get (dLine.getCtx(), dLine.getC_AcctSchema_ID(),
|
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++)
|
for (int i = 0; i < m_lines.size(); i++)
|
||||||
{
|
{
|
||||||
FactLine fl = (FactLine)m_lines.get(i);
|
FactLine fl = (FactLine)m_lines.get(i);
|
||||||
// log.fine("save - " + fl);
|
|
||||||
if (!fl.save(trxName)) // abort on first error
|
if (!fl.save(trxName)) // abort on first error
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,6 @@ public final class FactLine extends X_Fact_Acct
|
||||||
setAmtAcctDr (Env.ZERO);
|
setAmtAcctDr (Env.ZERO);
|
||||||
setAmtSourceCr (Env.ZERO);
|
setAmtSourceCr (Env.ZERO);
|
||||||
setAmtSourceDr (Env.ZERO);
|
setAmtSourceDr (Env.ZERO);
|
||||||
// Log.trace(this,Log.l1_User, "FactLine " + AD_Table_ID + ":" + Record_ID);
|
|
||||||
setAD_Table_ID (AD_Table_ID);
|
setAD_Table_ID (AD_Table_ID);
|
||||||
setRecord_ID (Record_ID);
|
setRecord_ID (Record_ID);
|
||||||
setLine_ID (Line_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)
|
if (m_acct != null && super.getC_SalesRegion_ID() == 0)
|
||||||
setC_SalesRegion_ID (m_acct.getC_SalesRegion_ID());
|
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();
|
return super.getC_SalesRegion_ID();
|
||||||
} // getC_SalesRegion_ID
|
} // getC_SalesRegion_ID
|
||||||
|
|
||||||
|
@ -1176,8 +1170,6 @@ public final class FactLine extends X_Fact_Acct
|
||||||
// Accounted Amounts - reverse
|
// Accounted Amounts - reverse
|
||||||
BigDecimal dr = fact.getAmtAcctDr();
|
BigDecimal dr = fact.getAmtAcctDr();
|
||||||
BigDecimal cr = fact.getAmtAcctCr();
|
BigDecimal cr = fact.getAmtAcctCr();
|
||||||
// setAmtAcctDr (cr.multiply(multiplier));
|
|
||||||
// setAmtAcctCr (dr.multiply(multiplier));
|
|
||||||
setAmtAcct(getC_Currency_ID(), cr.multiply(multiplier), dr.multiply(multiplier));
|
setAmtAcct(getC_Currency_ID(), cr.multiply(multiplier), dr.multiply(multiplier));
|
||||||
//
|
//
|
||||||
// Bayu Sistematika - Source Amounts
|
// Bayu Sistematika - Source Amounts
|
||||||
|
|
|
@ -49,7 +49,7 @@ public final class FactUtil
|
||||||
int C_Currency_ID, BigDecimal amt, boolean signSensitive)
|
int C_Currency_ID, BigDecimal amt, boolean signSensitive)
|
||||||
{
|
{
|
||||||
FactLine[] lines = new FactLine[2];
|
FactLine[] lines = new FactLine[2];
|
||||||
//newTrxIndex();
|
|
||||||
if (signSensitive) {
|
if (signSensitive) {
|
||||||
lines[0] = fact.createLine(docLine, account_DR, C_Currency_ID, amt);
|
lines[0] = fact.createLine(docLine, account_DR, C_Currency_ID, amt);
|
||||||
lines[1] = fact.createLine(docLine, account_CR, C_Currency_ID, amt.negate());
|
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[0] = fact.createLine(docLine, account_DR, C_Currency_ID, amt, null);
|
||||||
lines[1] = fact.createLine(docLine, account_CR, C_Currency_ID, null, amt);
|
lines[1] = fact.createLine(docLine, account_CR, C_Currency_ID, null, amt);
|
||||||
}
|
}
|
||||||
//newTrxIndex();
|
|
||||||
//
|
//
|
||||||
return lines;
|
return lines;
|
||||||
} // createLine
|
} // createLine
|
||||||
|
|
|
@ -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);
|
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);
|
int M_MatchInv_ID = DB.getNextID (AD_Client_ID, "M_MatchInv", m_trxName);
|
||||||
//
|
//
|
||||||
StringBuilder sql = new StringBuilder("INSERT INTO M_MatchInv (")
|
StringBuilder sql = new StringBuilder("INSERT INTO M_MatchInv (")
|
||||||
|
|
|
@ -228,120 +228,4 @@ public class ProductInfo
|
||||||
{
|
{
|
||||||
return m_qty;
|
return m_qty;
|
||||||
} // getQty
|
} // 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
|
} // ProductInfo
|
||||||
|
|
Loading…
Reference in New Issue