public EgDemandDetails insertAdvanceCollection(final String demandReason,final BigDecimal advanceCollectionAmount,final Installment installment){
  EgDemandDetails demandDetail=null;
  if (advanceCollectionAmount != null && advanceCollectionAmount.compareTo(BigDecimal.ZERO) > 0) {
    final EgDemandReasonMaster egDemandReasonMaster=demandGenericDAO.getDemandReasonMasterByCode(WaterTaxConstants.DEMANDRSN_CODE_ADVANCE,module());
    if (egDemandReasonMaster == null)     throw new ApplicationRuntimeException(" Advance Demand reason Master is null in method  insertAdvanceCollection");
    final EgDemandReason egDemandReason=demandGenericDAO.getDmdReasonByDmdReasonMsterInstallAndMod(egDemandReasonMaster,installment,module());
    if (egDemandReason == null)     throw new ApplicationRuntimeException(" Advance Demand reason is null in method  insertAdvanceCollection ");
    demandDetail=createDemandDetails(egDemandReason,advanceCollectionAmount,BigDecimal.ZERO);
  }
  return demandDetail;
}

public EgDemandDetails insertAdvanceCollection ( final String demandReason , final BigDecimal advanceCollectionAmount , final Installment installment ) { EgDemandDetails demandDetail = null ; if ( advanceCollectionAmount != null && advanceCollectionAmount . compareTo ( BigDecimal . ZERO ) > 0 ) { final EgDemandReasonMaster egDemandReasonMaster = demandGenericDAO . getDemandReasonMasterByCode ( WaterTaxConstants . DEMANDRSN_CODE_ADVANCE , module ( ) ) ; if ( egDemandReasonMaster == null ) throw new ApplicationRuntimeException ( " Advance Demand reason Master is null in method  insertAdvanceCollection" ) ; final EgDemandReason egDemandReason = demandGenericDAO . getDmdReasonByDmdReasonMsterInstallAndMod ( egDemandReasonMaster , installment , module ( ) ) ; if ( egDemandReason == null ) throw new ApplicationRuntimeException ( " Advance Demand reason is null in method  insertAdvanceCollection " ) ; demandDetail = createDemandDetails ( egDemandReason , advanceCollectionAmount , BigDecimal . ZERO ) ; } return demandDetail ; }
method used to insert advance collection in egdemanddetail table .
