public String getOhipfilename(int diskId) {
   BillingONDiskName b = diskNameDao.find(diskId);
   if (b != null) {
     return b.getOhipFilename();
   }
   return "";
 }
 public boolean updateDiskName(BillingDiskNameData val) {
   BillingONDiskName b = diskNameDao.find(Integer.parseInt(val.getId()));
   if (b != null) {
     b.setCreator(val.creator);
     diskNameDao.merge(b);
   }
   return true;
 }
  public String getDiskCreateDate(String diskId) {
    String retval = null;

    BillingONDiskName b = diskNameDao.find(Integer.parseInt(diskId));
    if (b != null) {
      Date tmp = b.getCreateDateTime();
      retval = dateformatter.format(tmp);
    }
    return retval;
  }
  public String[] getLatestGrpMonthCodeBatchNum(String groupNo) {
    String[] retval = null;
    BillingONDiskName b = diskNameDao.findByGroupNo(groupNo);
    if (b != null) {
      retval = new String[2];
      retval[0] = b.getMonthCode();
      retval[1] = "" + b.getBatchCount();
    } else {
      retval = null;
    }

    return retval;
  }
  public String[] getLatestSoloMonthCodeBatchNum(String providerNo) {
    String[] retval = null;

    BillingONDiskName b = diskNameDao.getLatestSoloMonthCodeBatchNum(providerNo);
    if (b != null) {
      retval = new String[2];
      retval[0] = b.getMonthCode();
      retval[1] = "" + b.getBatchCount();
    } else {
      retval = null;
    }

    return retval;
  }
  public String getPrevDiskCreateDate(String diskId) {
    String retval = null;
    Date curDate = null;
    String groupNo = "";

    BillingONDiskName b = diskNameDao.find(Integer.valueOf(diskId));
    if (b != null) {
      curDate = b.getCreateDateTime();
      groupNo = b.getGroupNo();

      BillingONDiskName x = diskNameDao.getPrevDiskCreateDate(curDate, groupNo);
      if (x != null) {
        Date tmp = x.getCreateDateTime();
        retval = dateformatter.format(tmp);
      }
    }
    return retval;
  }
  public BillingDiskNameData getDisknameObj(String diskId) {
    BillingDiskNameData obj = new BillingDiskNameData();

    BillingONDiskName b = diskNameDao.find(Integer.valueOf(diskId));
    if (b != null) {
      obj.setId("" + b.getId());
      obj.setMonthCode(b.getMonthCode());
      obj.setBatchcount("" + b.getBatchCount());
      obj.setOhipfilename(b.getOhipFilename());
      obj.setGroupno(b.getGroupNo());
      obj.setClaimrecord(b.getCreator());
      obj.setClaimrecord(b.getClaimRecord());
      obj.setCreatedatetime(tsFormatter.format(b.getCreateDateTime()));
      obj.setStatus(b.getStatus());
      obj.setTotal(b.getTotal());
      obj.setUpdatedatetime(tsFormatter.format(b.getTimestamp()));

      List<BillingONFilename> ff = filenameDao.findCurrentByDiskId(b.getId());
      Vector vecHtmlfilename = new Vector();
      Vector vecProviderohipno = new Vector();
      Vector vecProviderno = new Vector();
      Vector vecClaimrecord = new Vector();
      Vector vecStatus = new Vector();
      Vector vecTotal = new Vector();
      Vector vecFilenameId = new Vector();
      for (BillingONFilename f : ff) {
        vecFilenameId.add("" + f.getId());
        vecHtmlfilename.add(f.getHtmlFilename());
        vecProviderohipno.add(f.getProviderOhipNo());
        vecProviderno.add(f.getProviderNo());
        vecClaimrecord.add(f.getClaimRecord());
        vecStatus.add(f.getStatus());
        vecTotal.add(f.getTotal());
      }

      obj.setVecFilenameId(vecFilenameId);
      obj.setHtmlfilename(vecHtmlfilename);
      obj.setProviderohipno(vecProviderohipno);
      obj.setProviderno(vecProviderno);
      obj.setVecClaimrecord(vecClaimrecord);
      obj.setVecStatus(vecStatus);
      obj.setVecTotal(vecTotal);
    }

    return obj;
  }
  public List getMRIList(String sDate, String eDate, String status) {
    List retval = new Vector();
    BillingDiskNameData obj = null;

    try {
      List<BillingONDiskName> results =
          diskNameDao.findByCreateDateRangeAndStatus(
              dateformatter.parse(sDate), dateformatter.parse(eDate), status);

      for (BillingONDiskName b : results) {
        obj = new BillingDiskNameData();
        obj.setId("" + b.getId());
        obj.setMonthCode(b.getMonthCode());
        obj.setBatchcount("" + b.getBatchCount());
        obj.setOhipfilename(b.getOhipFilename());
        obj.setGroupno(b.getGroupNo());
        obj.setClaimrecord(b.getClaimRecord());
        obj.setCreatedatetime(tsFormatter.format(b.getCreateDateTime()));
        obj.setUpdatedatetime(tsFormatter.format(b.getTimestamp()));
        obj.setStatus(b.getStatus());
        obj.setTotal(b.getTotal());

        List<BillingONFilename> ff = filenameDao.findByDiskIdAndStatus(b.getId(), status);
        Vector vecHtmlfilename = new Vector();
        Vector vecProviderohipno = new Vector();
        Vector vecProviderno = new Vector();
        Vector vecClaimrecord = new Vector();
        Vector vecStatus = new Vector();
        Vector vecTotal = new Vector();
        Vector vecFilenameId = new Vector();

        for (BillingONFilename f : ff) {
          vecFilenameId.add("" + f.getId());
          vecHtmlfilename.add(f.getHtmlFilename());
          vecProviderohipno.add(f.getProviderOhipNo());
          vecProviderno.add(f.getProviderNo());
          vecClaimrecord.add(f.getClaimRecord());
          vecStatus.add(f.getStatus());
          vecTotal.add(f.getTotal());
        }
        obj.setVecFilenameId(vecFilenameId);
        obj.setHtmlfilename(vecHtmlfilename);
        obj.setProviderohipno(vecProviderohipno);
        obj.setProviderno(vecProviderno);
        obj.setVecClaimrecord(vecClaimrecord);
        obj.setVecStatus(vecStatus);
        obj.setVecTotal(vecTotal);
        retval.add(obj);
      }
    } catch (Exception e) {
      MiscUtils.getLogger().error("Error", e);
      retval = null;
    }
    return retval;
  }
  // add disk file
  public int addBillingDiskName(BillingDiskNameData val) {
    BillingONDiskName b = new BillingONDiskName();
    b.setMonthCode(val.monthCode);
    b.setBatchCount(Integer.parseInt(val.batchcount));
    b.setOhipFilename(val.ohipfilename);
    b.setGroupNo(val.groupno);
    b.setCreator(val.creator);
    b.setClaimRecord(val.claimrecord);
    b.setCreateDateTime(new Date());
    b.setStatus(val.status);
    b.setTotal(val.total);

    diskNameDao.persist(b);

    int retval = b.getId();

    if (b.getId() > 0) {
      // add filenames, if needed
      for (int i = 0; i < val.providerohipno.size(); i++) {
        BillingONFilename f = new BillingONFilename();
        f.setDiskId(b.getId());
        f.setHtmlFilename((String) val.htmlfilename.get(i));
        f.setProviderOhipNo((String) val.providerohipno.get(i));
        f.setProviderNo((String) val.providerno.get(i));
        f.setClaimRecord((String) val.vecClaimrecord.get(0));
        f.setStatus((String) val.vecStatus.get(0));
        f.setTotal((String) val.vecTotal.get(0));
        filenameDao.persist(f);
      }

    } else {
      retval = 0;
    }

    return retval;
  }