Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
  private void validateAdvancePaymentExists() {

    if (advanceRequisition != null
        && advanceRequisition.getEgAdvanceReqMises().getVoucherheader() != null
        && advanceRequisition.getEgAdvanceReqMises().getVoucherheader().getStatus() != 4) {
      populateBankAccounts(Integer.parseInt(commonBean.getBankId().split("-")[1]), fund.getId());
      throw new ValidationException(
          Arrays.asList(
              new ValidationError(
                  "arf.payment.uniqueCheck.validate.message",
                  getText(
                      "arf.payment.uniqueCheck.validate.message",
                      new String[] {advanceRequisition.getAdvanceRequisitionNumber()}))));
    }
  }
Ejemplo n.º 3
0
  @ValidationErrorPage(value = NEW)
  @Action(value = "/payment/advancePayment-save")
  public String save() {

    voucherHeader.setType(FinancialConstants.STANDARD_VOUCHER_TYPE_PAYMENT);
    voucherHeader.setName(FinancialConstants.PAYMENTVOUCHER_NAME_ADVANCE);
    voucherHeader.setDescription(description);
    try {
      validateAdvancePaymentExists();
      if (commonBean.getModeOfPayment().equalsIgnoreCase(FinancialConstants.MODEOFPAYMENT_RTGS)) {
        validateRTGS();
      }
      voucherHeader = createVoucherAndledger();
      paymentheader =
          paymentService.createPaymentHeader(
              voucherHeader,
              Integer.valueOf(commonBean.getAccountNumberId()),
              commonBean.getModeOfPayment(),
              advanceRequisition.getAdvanceRequisitionAmount());

      createMiscBill();
      paymentheader.start().withOwner(paymentService.getPosition());
      advanceRequisition.getEgAdvanceReqMises().setVoucherheader(paymentheader.getVoucherheader());
      sendForApproval();
      addActionMessage(
          getText("arf.payment.transaction.success") + " " + voucherHeader.getVoucherNumber());

    } catch (ValidationException e) {
      List<ValidationError> errorList = e.getErrors();
      for (ValidationError error : errorList) {
        if (error.getMessage().contains("DatabaseSequenceFirstTimeException")) {
          prepare();
          throw new ValidationException(
              Arrays.asList(new ValidationError("error", error.getMessage())));
        } else throw new ValidationException(e.getErrors());
      }
      populateBankAccounts(Integer.parseInt(commonBean.getBankId().split("-")[1]), fund.getId());
    } catch (NumberFormatException e) {
      LOGGER.error(e.getMessage(), e);
      throw e;
    } catch (ApplicationRuntimeException e) {
      LOGGER.error(e.getMessage(), e);
      throw e;
    } finally {
      loadApproverUser(FinancialConstants.STANDARD_VOUCHER_TYPE_PAYMENT);
    }
    return VIEW;
  }
Ejemplo n.º 4
0
  @Override
  protected HashMap<String, Object> createHeaderAndMisDetails() throws ValidationException {
    HashMap<String, Object> headerdetails = new HashMap<String, Object>();
    headerdetails.put(VoucherConstant.VOUCHERNAME, voucherHeader.getName());
    headerdetails.put(VoucherConstant.VOUCHERTYPE, voucherHeader.getType());
    headerdetails.put(VoucherConstant.VOUCHERDATE, voucherHeader.getVoucherDate());
    headerdetails.put(VoucherConstant.DESCRIPTION, voucherHeader.getDescription());

    EgAdvanceRequisitionMis egAdvanceReqMises = advanceRequisition.getEgAdvanceReqMises();
    if (egAdvanceReqMises != null) {
      if (egAdvanceReqMises.getFund() != null && egAdvanceReqMises.getFund().getId() != null) {
        headerdetails.put(VoucherConstant.FUNDCODE, egAdvanceReqMises.getFund().getCode());
      }
      if (egAdvanceReqMises.getEgDepartment() != null
          && egAdvanceReqMises.getEgDepartment().getId() != null) {
        headerdetails.put(
            VoucherConstant.DEPARTMENTCODE, egAdvanceReqMises.getEgDepartment().getCode());
      }
      if (egAdvanceReqMises.getFundsource() != null
          && egAdvanceReqMises.getFundsource().getId() != null) {
        headerdetails.put(
            VoucherConstant.FUNDSOURCECODE, egAdvanceReqMises.getFundsource().getCode());
      }
      if (egAdvanceReqMises.getScheme() != null && egAdvanceReqMises.getScheme().getId() != null) {
        headerdetails.put(VoucherConstant.SCHEMECODE, egAdvanceReqMises.getScheme().getCode());
      }
      if (egAdvanceReqMises.getSubScheme() != null
          && egAdvanceReqMises.getSubScheme().getId() != null) {
        headerdetails.put(
            VoucherConstant.SUBSCHEMECODE, egAdvanceReqMises.getSubScheme().getCode());
      }
      if (egAdvanceReqMises.getFunctionaryId() != null
          && egAdvanceReqMises.getFunctionaryId().getId() != null) {
        headerdetails.put(
            VoucherConstant.FUNCTIONARYCODE, egAdvanceReqMises.getFunctionaryId().getCode());
      }
      if (egAdvanceReqMises.getFunction() != null
          && egAdvanceReqMises.getFunction().getId() != null) {
        headerdetails.put(VoucherConstant.FUNCTIONCODE, egAdvanceReqMises.getFunction().getCode());
      }
      if (egAdvanceReqMises.getFieldId() != null
          && egAdvanceReqMises.getFieldId().getId() != null) {
        headerdetails.put(VoucherConstant.DIVISIONID, egAdvanceReqMises.getFieldId().getId());
      }
    }
    return headerdetails;
  }
Ejemplo n.º 5
0
 private void populateFund() {
   if (advanceRequisition != null && advanceRequisition.getEgAdvanceReqMises() != null)
     fund = advanceRequisition.getEgAdvanceReqMises().getFund();
 }