5. Fixed Asset check unprocessed product and Warning

--HG--
branch : EDII
This commit is contained in:
hodianto 2019-03-16 23:34:27 +07:00
parent 8234229ae9
commit f709e3aeba
1 changed files with 14 additions and 0 deletions

View File

@ -1,12 +1,14 @@
package andromedia.midsuit.model;
import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MDepreciationEntry;
import org.compiere.model.MDepreciationExp;
import org.compiere.model.Query;
import org.compiere.process.DocAction;
import org.compiere.process.DocOptions;
import org.compiere.util.DB;
@ -32,6 +34,18 @@ public class MID_MDepreciationEntry extends MDepreciationEntry implements DocOpt
if(DB.getSQLValue(get_TrxName(), "SELECT COUNT(*) FROM "
+MDepreciationExp.Table_Name+" WHERE A_Depreciation_Entry_ID =?", new Object[] { getA_Depreciation_Entry_ID() })==0)
throw new AdempiereException("No Lines Found !!!");
List<MDepreciationExp> exps = new Query(getCtx(), MDepreciationExp.Table_Name, "A_Depreciation_Entry_ID =?", get_TrxName())
.setOnlyActiveRecords(true)
.setParameters(new Object[] { getA_Depreciation_Entry_ID() })
.list();
for(MDepreciationExp exp : exps) {
try {
exp.checkExistsNotProcessedEntries(getCtx(), exp.getA_Asset_ID(), exp.getDateAcct(),exp.getPostingType(), get_TrxName());
}catch(Exception e) {
throw new AdempiereException(exp.getA_Asset().getName()+" Belum terdepresiasi di bulan sebelumnya !!!");
}
}
return super.prepareIt();
}
@Override