/** Business logic to execute. */
  public VOResponse deleteCharges(ArrayList list, String serverLanguageId, String username)
      throws Throwable {
    Statement stmt = null;
    Connection conn = null;
    try {
      if (this.conn == null) conn = getConn();
      else conn = this.conn;
      stmt = conn.createStatement();

      ChargeVO vo = null;
      for (int i = 0; i < list.size(); i++) {
        // logically delete the record in SAL06...
        vo = (ChargeVO) list.get(i);
        stmt.execute(
            "update SAL06_CHARGES set ENABLED='N' where COMPANY_CODE_SYS01='"
                + vo.getCompanyCodeSys01SAL06()
                + "' and CHARGE_CODE='"
                + vo.getChargeCodeSAL06()
                + "'");
      }

      return new VOResponse(new Boolean(true));
    } catch (Throwable ex) {
      Logger.error(
          username,
          this.getClass().getName(),
          "executeCommand",
          "Error while deleting existing charges",
          ex);
      try {
        if (this.conn == null && conn != null)
          // rollback only local connection
          conn.rollback();
      } catch (Exception ex3) {
      }

      throw new Exception(ex.getMessage());
    } finally {
      try {
        stmt.close();
      } catch (Exception exx) {
      }
      try {
        if (this.conn == null && conn != null) {
          // close only local connection
          conn.commit();
          conn.close();
        }

      } catch (Exception exx) {
      }
    }
  }
  /** Business logic to execute. */
  public VOListResponse insertCharges(
      ArrayList list, String serverLanguageId, String username, ArrayList customizedFields)
      throws Throwable {
    Connection conn = null;
    try {
      if (this.conn == null) conn = getConn();
      else conn = this.conn;
      ChargeVO vo = null;

      Map attribute2dbField = new HashMap();
      attribute2dbField.put("companyCodeSys01SAL06", "COMPANY_CODE_SYS01");
      attribute2dbField.put("chargeCodeSAL06", "CHARGE_CODE");
      attribute2dbField.put("chargeCodeSAL06", "CHARGE_CODE");
      attribute2dbField.put("progressiveSys10SAL06", "PROGRESSIVE_SYS10");
      attribute2dbField.put("valueSAL06", "VALUE");
      attribute2dbField.put("percSAL06", "PERC");
      attribute2dbField.put("vatCodeReg01SAL06", "VAT_CODE_REG01");
      attribute2dbField.put("currencyCodeReg03SAL06", "CURRENCY_CODE_REG03");
      attribute2dbField.put("enabledSAL06", "ENABLED");

      BigDecimal progressiveSYS10 = null;
      Response res = null;
      for (int i = 0; i < list.size(); i++) {
        vo = (ChargeVO) list.get(i);
        vo.setEnabledSAL06("Y");

        // insert record in SYS10...
        progressiveSYS10 =
            TranslationUtils.insertTranslations(
                vo.getDescriptionSYS10(), vo.getCompanyCodeSys01SAL06(), conn);
        vo.setProgressiveSys10SAL06(progressiveSYS10);

        // insert into SAL06...
        res =
            CustomizeQueryUtil.insertTable(
                conn,
                new UserSessionParameters(username),
                vo,
                "SAL06_CHARGES",
                attribute2dbField,
                "Y",
                "N",
                null,
                true,
                customizedFields);
        if (res.isError()) {
          throw new Exception(res.getErrorMessage());
        }
      }

      return new VOListResponse(list, false, list.size());
    } catch (Throwable ex) {
      Logger.error(
          username,
          this.getClass().getName(),
          "executeCommand",
          "Error while inserting new charges",
          ex);
      try {
        if (this.conn == null && conn != null)
          // rollback only local connection
          conn.rollback();
      } catch (Exception ex3) {
      }

      throw new Exception(ex.getMessage());
    } finally {
      try {
        if (this.conn == null && conn != null) {
          // close only local connection
          conn.commit();
          conn.close();
        }

      } catch (Exception exx) {
      }
    }
  }