Esempio n. 1
0
  @Override
  public void prepare() {
    if (id != null) overhead = overheadService.findById(id, false);

    // expenditureTypeList = (List) overheadService.findAllBy("select distinct expenditureType from
    // WorkType");
    expenditureTypeList =
        (List) overheadService.findAllBy("select distinct expenditureType from Overhead");
    super.prepare();
    setupDropdownDataExcluding("account");
    try {
      List<CChartOfAccounts> accounts = new ArrayList<CChartOfAccounts>();
      // TODO:
      if (worksService.getWorksConfigValue("OVERHEAD_PURPOSE") != null)
        accounts =
            commonsService.getAccountCodeByPurpose(
                Integer.valueOf(worksService.getWorksConfigValue("OVERHEAD_PURPOSE")));
      addDropdownData("accountList", accounts);
    } catch (final ApplicationException e) {
      logger.error("Unable to load accountcode :" + e.getMessage());
      addFieldError("accountcode", "Unable to load accountcode");
    }

    final String[] expenditure = parameters.get("expenditure");
    if (!ArrayUtils.isEmpty(expenditure) && !expenditure[0].equals("-1"))
      overhead.setExpenditureType(new ExpenditureType(expenditure[0]));
  }
  /** @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;
  }
Esempio n. 3
0
 private List<EgDemandReasonDetails> getDemandReasonDetails(
     final String demandReasonCode,
     final BigDecimal grossAnnualRentAfterDeduction,
     final Installment installment) {
   return persistenceService.findAllByNamedQuery(
       QUERY_DEMANDREASONDETAILS_BY_DEMANDREASON_AND_INSTALLMENT,
       demandReasonCode,
       grossAnnualRentAfterDeduction,
       installment.getFromDate(),
       installment.getToDate());
 }
 public Map<String, Object> getContractorForApprovedWorkOrder() {
   Map<String, Object> contractorsWithWOList = new LinkedHashMap<String, Object>();
   List<Contractor> approvedContractorList =
       contractorService.findAllByNamedQuery("getApprovedContractorsWithWO");
   if (approvedContractorList != null) {
     for (Contractor contractor : approvedContractorList) {
       contractorsWithWOList.put(
           contractor.getId() + "", contractor.getCode() + " - " + contractor.getName());
     }
   }
   return contractorsWithWOList;
 }
Esempio n. 5
0
 private void createMiscBill() {
   Miscbilldetail miscbilldetail = new Miscbilldetail();
   // Since we are not creating any bill for advance payment, we are updating bill no, bill date
   // and bill amount from ARF
   miscbilldetail.setBillnumber(advanceRequisition.getAdvanceRequisitionNumber());
   miscbilldetail.setBilldate(advanceRequisition.getAdvanceRequisitionDate());
   miscbilldetail.setBillamount(advanceRequisition.getAdvanceRequisitionAmount());
   miscbilldetail.setPassedamount(advanceRequisition.getAdvanceRequisitionAmount());
   miscbilldetail.setPaidamount(advanceRequisition.getAdvanceRequisitionAmount());
   miscbilldetail.setPaidto(advanceRequisition.getEgAdvanceReqMises().getPayto());
   miscbilldetail.setPayVoucherHeader(paymentheader.getVoucherheader());
   miscbilldetailService.persist(miscbilldetail);
 }
Esempio n. 6
0
 /**
  * This method populates the <code>PtNotice</code> object along with notice input stream
  *
  * @param basicProperty the <code>BasicProperty</code> object for which the notice is generated
  * @param noticeNo - notice no
  * @param noticeType - type of notice
  * @param fileStream - input stream of generated notice.
  */
 public PtNotice saveNotice(
     String noticeNo, String noticeType, BasicProperty basicProperty, InputStream fileStream) {
   PtNotice ptNotice = new PtNotice();
   Module module = moduleDao.getModuleByName(PTMODULENAME);
   ptNotice.setModuleId(module.getId());
   ptNotice.setNoticeDate(new Date());
   ptNotice.setNoticeNo(noticeNo);
   ptNotice.setNoticeType(noticeType);
   ptNotice.setUserId(EgovThreadLocals.getUserId());
   ptNotice.setBasicProperty(basicProperty);
   String fileName = ptNotice.getNoticeNo() + ".pdf";
   FileStoreMapper fileStore =
       fileStoreService.store(fileStream, fileName, "application/pdf", PTMODULENAME);
   ptNotice.setFileStore(fileStore);
   basicProperty.addNotice(ptNotice);
   basicPropertyService.update(basicProperty);
   return ptNotice;
 }
Esempio n. 7
0
  private BoundaryCategory getBoundaryCategory(
      final Boundary zone,
      final Installment installment,
      final Long usageId,
      final Date occupancyDate) {
    List<BoundaryCategory> categories = new ArrayList<BoundaryCategory>();

    categories =
        persistenceService.findAllByNamedQuery(
            QUERY_BASERATE_BY_OCCUPANCY_ZONE,
            zone.getId(),
            usageId,
            occupancyDate,
            installment.getToDate());

    LOGGER.debug("baseRentOfUnit - Installment : " + installment);
    return categories.get(0);
  }
Esempio n. 8
0
 public List<Installment> getInstallmentListByStartDate(final Date startDate) {
   return persistenceService.findAllByNamedQuery(
       QUERY_INSTALLMENTLISTBY_MODULE_AND_STARTYEAR, startDate, startDate, PTMODULENAME);
 }
Esempio n. 9
0
 public String create() {
   overheadService.persist(overhead);
   addActionMessage(getText("overhead.save.success", "The overhead was saved successfully"));
   return list();
 }
Esempio n. 10
0
 public String save() {
   overheadService.persist(overhead);
   return SUCCESS;
 }
Esempio n. 11
0
 /**
  * This method is invoked to display the list of over heads.
  *
  * @return
  */
 public String list() {
   overheadList = overheadService.findAllBy(" from Overhead o order by name asc");
   return INDEX;
 }