/** @return */
  @Action(value = "/collectPropertyTax-generateBill")
  public String generateBill() {
    if (LOGGER.isDebugEnabled())
      LOGGER.debug(
          "Entered method generatePropertyTaxBill, Generating bill for index no : " + propertyId);
    if (propertyId == null || propertyId.isEmpty()) {
      setErrorMsg(getText("mandatory.assessmentNo"));
      return RESULT_ERROR;
    }
    final BasicProperty basicProperty =
        basicPropertyService.findByNamedQuery(
            PropertyTaxConstants.QUERY_BASICPROPERTY_BY_UPICNO, propertyId);
    if (basicProperty == null) {
      setErrorMsg(getText("validation.property.doesnot.exists"));
      return RESULT_ERROR;
    }
    if (LOGGER.isDebugEnabled())
      LOGGER.debug("generatePropertyTaxBill : BasicProperty :" + basicProperty);

    if (basicProperty.getProperty().getIsExemptedFromTax()) {
      args.add(propertyId);
      setErrorMsg(getText("msg.collection.tax.exempted", args));
      return RESULT_ERROR;
    }

    final Map<String, BigDecimal> demandCollMap =
        propertyTaxUtil.getDemandAndCollection(basicProperty.getProperty());
    final BigDecimal currDue =
        demandCollMap.get(CURR_DMD_STR).subtract(demandCollMap.get(CURR_COLL_STR));
    final BigDecimal arrDue =
        demandCollMap.get(ARR_DMD_STR).subtract(demandCollMap.get(ARR_COLL_STR));

    if (currDue.compareTo(BigDecimal.ZERO) <= 0 && arrDue.compareTo(BigDecimal.ZERO) <= 0) {
      args.add(propertyId);
      isAssessmentNoValid = Boolean.TRUE;
      setErrorMsg(getText("msg.collection.fully.paid", args));
      return RESULT_ERROR;
    }
    propertyTaxBillable.setLevyPenalty(true);
    propertyTaxBillable.setBasicProperty(basicProperty);
    propertyTaxBillable.setUserId(Long.valueOf(getSession().get("userid").toString()));
    propertyTaxBillable.setReferenceNumber(
        propertyTaxNumberGenerator.generateBillNumber(
            basicProperty.getPropertyID().getWard().getBoundaryNum().toString()));
    propertyTaxBillable.setBillType(propertyTaxUtil.getBillTypeByCode(BILLTYPE_AUTO));

    final String billXml = ptBillServiceImpl.getBillXML(propertyTaxBillable);
    try {
      collectXML = URLEncoder.encode(billXml, "UTF-8");
    } catch (final UnsupportedEncodingException e) {
      throw new RuntimeException(e.getMessage());
    }
    if (LOGGER.isDebugEnabled())
      LOGGER.debug(
          "Exiting method generatePropertyTaxBill, collectXML (before decode): " + billXml);
    return RESULT_VIEW;
  }