📄 macctschema.java
字号:
} // getAcctSchemaDefault
/**
* String representation
* @return String rep
*/
public String toString()
{
StringBuffer sb = new StringBuffer("AcctSchema[");
sb.append(get_ID()).append("-").append(getName())
.append("]");
return sb.toString();
} // toString
/**
* Is Suspense Balancing active
* @return suspense balancing
*/
public boolean isSuspenseBalancing()
{
if (m_gl == null)
getAcctSchemaGL();
return m_gl.isUseSuspenseBalancing() && m_gl.getSuspenseBalancing_Acct() != 0;
} // isSuspenseBalancing
/**
* Get Suspense Error Account
* @return suspense error account
*/
public MAccount getSuspenseBalancing_Acct()
{
if (m_SuspenseError_Acct != null)
return m_SuspenseError_Acct;
if (m_gl == null)
getAcctSchemaGL();
int C_ValidCombination_ID = m_gl.getSuspenseBalancing_Acct();
m_SuspenseError_Acct = MAccount.get(getCtx(), C_ValidCombination_ID);
return m_SuspenseError_Acct;
} // getSuspenseBalancing_Acct
/**
* Is Currency Balancing active
* @return suspense balancing
*/
public boolean isCurrencyBalancing()
{
if (m_gl == null)
getAcctSchemaGL();
return m_gl.isUseCurrencyBalancing();
} // isSuspenseBalancing
/**
* Get Currency Balancing Account
* @return currency balancing account
*/
public MAccount getCurrencyBalancing_Acct()
{
if (m_CurrencyBalancing_Acct != null)
return m_CurrencyBalancing_Acct;
if (m_gl == null)
getAcctSchemaGL();
int C_ValidCombination_ID = m_gl.getCurrencyBalancing_Acct();
m_CurrencyBalancing_Acct = MAccount.get(getCtx(), C_ValidCombination_ID);
return m_CurrencyBalancing_Acct;
} // getCurrencyBalancing_Acct
/**
* Get Due To Account for Segment
* @param segment ignored
* @return Account
*/
public MAccount getDueTo_Acct(String segment)
{
if (m_DueTo_Acct != null)
return m_DueTo_Acct;
if (m_gl == null)
getAcctSchemaGL();
int C_ValidCombination_ID = m_gl.getIntercompanyDueTo_Acct();
m_DueTo_Acct = MAccount.get(getCtx(), C_ValidCombination_ID);
return m_DueTo_Acct;
} // getDueTo_Acct
/**
* Get Due From Account for Segment
* @param segment ignored
* @return Account
*/
public MAccount getDueFrom_Acct(String segment)
{
if (m_DueFrom_Acct != null)
return m_DueFrom_Acct;
if (m_gl == null)
getAcctSchemaGL();
int C_ValidCombination_ID = m_gl.getIntercompanyDueFrom_Acct();
m_DueFrom_Acct = MAccount.get(getCtx(), C_ValidCombination_ID);
return m_DueFrom_Acct;
} // getDueFrom_Acct
/**
* Set Only Org Childs
* @param orgs
*/
public void setOnlyOrgs (Integer[] orgs)
{
m_onlyOrgs = orgs;
} // setOnlyOrgs
/**
* Set Only Org Childs
* @return orgs
*/
public Integer[] getOnlyOrgs()
{
return m_onlyOrgs;
} // getOnlyOrgs
/**
* Skip creating postings for this Org.
* Requires setOnlyOrgs (MReportTree requires MTree in Basis)
* @param AD_Org_ID
* @return true if to skip
*/
public boolean isSkipOrg (int AD_Org_ID)
{
if (getAD_OrgOnly_ID() == 0)
return false;
// Only Organization
if (getAD_OrgOnly_ID() == AD_Org_ID)
return false;
if (m_onlyOrg == null)
m_onlyOrg = MOrg.get(getCtx(), getAD_OrgOnly_ID());
// Not Summary Only - i.e. skip it
if (!m_onlyOrg.isSummary())
return true;
if (m_onlyOrgs == null)
return false;
for (int i = 0; i < m_onlyOrgs.length; i++)
{
if (AD_Org_ID == m_onlyOrgs[i].intValue())
return false;
}
return true;
} // isSkipOrg
/**
* Get Std Precision of accounting Currency
* @return precision
*/
public int getStdPrecision()
{
if (m_stdPrecision < 0)
{
MCurrency cur = MCurrency.get(getCtx(), getC_Currency_ID());
m_stdPrecision = cur.getStdPrecision();
m_costPrecision = cur.getCostingPrecision();
}
return m_stdPrecision;
} // getStdPrecision
/**
* Get Costing Precision of accounting Currency
* @return precision
*/
public int getCostingPrecision()
{
if (m_costPrecision < 0)
getStdPrecision();
return m_costPrecision;
} // getCostingPrecision
/**
* Check Costing Setup.
* Make sure that there is a Cost Type and Cost Element
*/
public void checkCosting()
{
log.info(toString());
// Create Cost Type
if (getM_CostType_ID() == 0)
{
MCostType ct = new MCostType (getCtx(), 0, get_TrxName());
ct.setClientOrg(getAD_Client_ID(), 0);
ct.setName(getName());
ct.save();
setM_CostType_ID(ct.getM_CostType_ID());
}
// Create Cost Elements
MCostElement.getMaterialCostElement(this, getCostingMethod());
// Default Costing Level
if (getCostingLevel() == null)
setCostingLevel(COSTINGLEVEL_Client);
if (getCostingMethod() == null)
setCostingMethod (COSTINGMETHOD_StandardCosting);
if (getGAAP() == null)
setGAAP (GAAP_InternationalGAAP);
} // checkCosting
/**
* Is Client Costing Level (default)
* @return true if Client
*/
public boolean isCostingLevelClient()
{
String s = getCostingLevel();
if (s == null || COSTINGLEVEL_Client.equals(s))
return true;
return false;
} // isCostingLevelClient
/**
* Is Org Costing Level
* @return true if Org
*/
public boolean isCostingLevelOrg()
{
return COSTINGLEVEL_Organization.equals(getCostingLevel());
} // isCostingLevelOrg
/**
* Is Batch Costing Level
* @return true if Batch
*/
public boolean isCostingLevelBatch()
{
return COSTINGLEVEL_BatchLot.equals(getCostingLevel());
} // isCostingLevelBatch
/**
* Create Commitment Accounting
* @return true if creaet commitments
*/
public boolean isCreateCommitment()
{
String s = getCommitmentType();
if (s == null)
return false;
return COMMITMENTTYPE_CommitmentOnly.equals(s)
|| COMMITMENTTYPE_CommitmentReservation.equals(s);
} // isCreateCommitment
/**
* Create Commitment/Reservation Accounting
* @return true if create reservations
*/
public boolean isCreateReservation()
{
String s = getCommitmentType();
if (s == null)
return false;
return COMMITMENTTYPE_CommitmentReservation.equals(s);
} // isCreateReservation
/**
* Before Save
* @param newRecord new
* @return true
*/
protected boolean beforeSave (boolean newRecord)
{
if (getAD_Org_ID() != 0)
setAD_Org_ID(0);
checkCosting();
// Check Primary
if (getAD_OrgOnly_ID() != 0)
{
MClientInfo info = MClientInfo.get(getCtx(), getAD_Client_ID());
if (info.getC_AcctSchema1_ID() == getC_AcctSchema_ID())
setAD_OrgOnly_ID(0);
}
return true;
} // beforeSave
} // MAcctSchema
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -