@Override public BigDecimal calculateTotalPendingAdvance(final BigDecimal totalAdvancePaid,final Date billDate,final WorkOrderEstimate workOrderEstimate,final Long billId){
  final CChartOfAccounts advanceCOA=contractorAdvanceService.getContractorAdvanceAccountcodeForWOE(workOrderEstimate.getId());
  BigDecimal totalPendingBalance=BigDecimal.ZERO;
  BigDecimal totalAdvanceAdjusted=BigDecimal.ZERO;
  if (advanceCOA != null && totalAdvancePaid != null && totalAdvancePaid.compareTo(BigDecimal.ZERO) > 0) {
    totalAdvanceAdjusted=getTotalAdvanceAdjustedForWOE(billDate,workOrderEstimate.getId(),advanceCOA.getId(),billId);
    if (totalAdvanceAdjusted != null && totalAdvanceAdjusted.compareTo(BigDecimal.ZERO) > 0 && totalAdvanceAdjusted.compareTo(BigDecimal.ZERO) > 0)     totalPendingBalance=totalAdvanceAdjusted.subtract(totalAdvanceAdjusted);
 else     totalPendingBalance=totalAdvancePaid;
  }
  return totalPendingBalance;
}

@ Override public BigDecimal calculateTotalPendingAdvance ( final BigDecimal totalAdvancePaid , final Date billDate , final WorkOrderEstimate workOrderEstimate , final Long billId ) { final CChartOfAccounts advanceCOA = contractorAdvanceService . getContractorAdvanceAccountcodeForWOE ( workOrderEstimate . getId ( ) ) ; BigDecimal totalPendingBalance = BigDecimal . ZERO ; BigDecimal totalAdvanceAdjusted = BigDecimal . ZERO ; if ( advanceCOA != null && totalAdvancePaid != null && totalAdvancePaid . compareTo ( BigDecimal . ZERO ) > 0 ) { totalAdvanceAdjusted = getTotalAdvanceAdjustedForWOE ( billDate , workOrderEstimate . getId ( ) , advanceCOA . getId ( ) , billId ) ; if ( totalAdvanceAdjusted != null && totalAdvanceAdjusted . compareTo ( BigDecimal . ZERO ) > 0 && totalAdvanceAdjusted . compareTo ( BigDecimal . ZERO ) > 0 ) totalPendingBalance = totalAdvanceAdjusted . subtract ( totalAdvanceAdjusted ) ; else totalPendingBalance = totalAdvancePaid ; } return totalPendingBalance ; }
the method return bigdecimal
