EgDemandDetails insertPenalty(final BigDecimal chqBouncePenalty,final Module module){
  EgDemandDetails demandDetail=null;
  if (chqBouncePenalty != null && chqBouncePenalty.compareTo(BigDecimal.ZERO) > 0) {
    final Installment currInstallment=getCurrentInstallment(module);
    final EgDemandReasonMaster egDemandReasonMaster=demandGenericDao.getDemandReasonMasterByCode(DEMANDRSN_CODE_CHQ_BOUNCE_PENALTY,module);
    if (egDemandReasonMaster == null)     throw new ApplicationRuntimeException(" Penalty Demand reason Master is null in method  insertPenalty");
    final EgDemandReason egDemandReason=demandGenericDao.getDmdReasonByDmdReasonMsterInstallAndMod(egDemandReasonMaster,currInstallment,module);
    if (egDemandReason == null)     throw new ApplicationRuntimeException(" Penalty Demand reason is null in method  insertPenalty ");
    demandDetail=EgDemandDetails.fromReasonAndAmounts(chqBouncePenalty,egDemandReason,BigDecimal.ZERO);
  }
  return demandDetail;
}

EgDemandDetails insertPenalty ( final BigDecimal chqBouncePenalty , final Module module ) { EgDemandDetails demandDetail = null ; if ( chqBouncePenalty != null && chqBouncePenalty . compareTo ( BigDecimal . ZERO ) > 0 ) { final Installment currInstallment = getCurrentInstallment ( module ) ; final EgDemandReasonMaster egDemandReasonMaster = demandGenericDao . getDemandReasonMasterByCode ( DEMANDRSN_CODE_CHQ_BOUNCE_PENALTY , module ) ; if ( egDemandReasonMaster == null ) throw new ApplicationRuntimeException ( " Penalty Demand reason Master is null in method  insertPenalty" ) ; final EgDemandReason egDemandReason = demandGenericDao . getDmdReasonByDmdReasonMsterInstallAndMod ( egDemandReasonMaster , currInstallment , module ) ; if ( egDemandReason == null ) throw new ApplicationRuntimeException ( " Penalty Demand reason is null in method  insertPenalty " ) ; demandDetail = EgDemandDetails . fromReasonAndAmounts ( chqBouncePenalty , egDemandReason , BigDecimal . ZERO ) ; } return demandDetail ; }
method used to insert penalty in egdemanddetail table . penalty amount will be calculated depending upon the cheque amount .
