Search in sources :

Example 1 with MAssetTransfer

use of org.compiere.model.MAssetTransfer in project adempiere by adempiere.

the class Doc_AssetTransfer method createFacts.

/**
	 * Produce inregistrarea:
	 * <pre>
	 *	20.., 21..[A_Asset_New_Acct]			=	23..[A_Asset_Acct]		
	 * </pre>
	 */
public ArrayList<Fact> createFacts(MAcctSchema as) {
    MAssetTransfer assetTr = getAssetTransfer();
    MDepreciationWorkfile wk = getAssetWorkfile();
    //MDepreciationExp exp = getExpense();
    ArrayList<Fact> facts = new ArrayList<Fact>();
    Fact fact = new Fact(this, as, assetTr.getPostingType());
    facts.add(fact);
    // Change Asset Account
    if (assetTr.getA_Asset_New_Acct() != assetTr.getA_Asset_Acct()) {
        MAccount dr = MAccount.get(getCtx(), assetTr.getA_Asset_New_Acct());
        MAccount cr = MAccount.get(getCtx(), assetTr.getA_Asset_Acct());
        FactUtil.createSimpleOperation(fact, null, dr, cr, as.getC_Currency_ID(), wk.getA_Asset_Cost(), false);
    }
    // Change Asset Accum. Depr. Account
    if (assetTr.getA_Accumdepreciation_New_Acct() != assetTr.getA_Accumdepreciation_Acct()) {
        MAccount cr = MAccount.get(getCtx(), assetTr.getA_Accumdepreciation_New_Acct());
        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;
}
Also used : MDepreciationWorkfile(org.compiere.model.MDepreciationWorkfile) MAccount(org.compiere.model.MAccount) ArrayList(java.util.ArrayList) MAssetTransfer(org.compiere.model.MAssetTransfer)

Aggregations

ArrayList (java.util.ArrayList)1 MAccount (org.compiere.model.MAccount)1 MAssetTransfer (org.compiere.model.MAssetTransfer)1 MDepreciationWorkfile (org.compiere.model.MDepreciationWorkfile)1