@RequestMapping(
      value = "**/creditAndDebitFull**",
      method = {RequestMethod.POST, RequestMethod.GET})
  public ModelAndView editCreditAndDebit(HttpServletRequest request, HttpSession session) {

    ModelAndView model = null;
    model = new ModelAndView();
    String userName = "";
    userName = (String) session.getAttribute("USERNAME");
    if (request.getParameter("submit") != null) {
      String option = request.getParameter("transaction");
      String accountNum = request.getParameter("transactions");
      String amount = request.getParameter("amount");
      try {
        double am = Double.parseDouble(amount);
        if (am > 0) {
          LoginHandler handler = new LoginHandler();
          ResultSet rs = handler.requestBalance(userName);
          double balance = 0;
          try {
            while (rs.next()) {
              if (rs.getString("accountNumber").equals(accountNum)) {
                balance = rs.getDouble("balance");
              }
            }

            double finalBalance = balance;
            if (option.equalsIgnoreCase("debit") && (Double.parseDouble(amount) > finalBalance)) {
              model.addObject("insuffFunds", "The Account has insufficient funds");
              getAccountNumbers(model, userName, session);
              model.setViewName("creditAndDebit");
            } else {
              int random = (new Random()).nextInt(900000) + 100000;
              // Date date=new Date();
              boolean flag1 = false;
              boolean flag2 = false;
              if (option.equalsIgnoreCase("debit")) {
                logger.error(
                    "Insereting the requested debit transacation for the user "
                        + userName
                        + " for amount:"
                        + amount);
                flag1 =
                    handler.insertTransactionDetails(
                        userName,
                        random,
                        amount,
                        accountNum,
                        "",
                        TimeUtility.generateSysDateMethod(),
                        option,
                        "pendingapproval");
                logger.error(
                    "Succesfully inserted the requested debit transacation for the user "
                        + userName
                        + " for amount:"
                        + amount);
                balance = balance - Double.parseDouble(amount);
                flag2 = handler.updateBalance(accountNum, balance, userName);
                logger.error("Successfully updated the balance of the user:"******"credit")) {
                logger.error(
                    "Insereting the requested debit transacation for the user "
                        + userName
                        + " for amount:"
                        + amount);
                flag1 =
                    handler.insertTransactionDetails(
                        userName,
                        random,
                        amount,
                        "",
                        accountNum,
                        TimeUtility.generateSysDateMethod(),
                        option,
                        "pendingapproval");
                logger.error(
                    "Succesfully inserted the requested debit transacation for the user "
                        + userName
                        + " for amount:"
                        + amount);
                balance = balance + Double.parseDouble(amount);
                // flag2=handler.updateBalance(accountNum,balance,userName);
                logger.error("Successfully updated the balance of the user:"******"Transaction is Sucess");
                model.setViewName("customerhome");
              } else {
                logger.error("Transaction is failed");
                model.setViewName("customerhome");
              }
            }
            rs.close();
          } catch (SQLException e) {
            try {
              if (!userName.isEmpty() || !userName.equalsIgnoreCase(null)) {
                handler.updateLoggedInFlag(userName, 0);
              }
            } catch (Exception e1) {
              session.invalidate();
              model.setViewName("index");
            }
            session.invalidate();
            model.setViewName("index");
            e.printStackTrace();
          }
        } else {
          model.addObject("emptyFields", "Amount Field has invalid input");
          getAccountNumbers(model, userName, session);
          model.setViewName("creditAndDebit");
        }
      } catch (NumberFormatException nfe) {
        model.addObject("emptyFields", "Amount Field has invalid input");
        getAccountNumbers(model, userName, session);
        model.setViewName("creditAndDebit");
      }
    }
    return model;
  }