Ejemplo n.º 1
0
  protected void onRebookingNotReqClick() {
    // Do a get in sd_appt
    Sd_appt_dts.Sd_appt_dtsRecord appt_dtsRecord = form.MainGrid().getValue();
    if (appt_dtsRecord != null && appt_dtsRecord.Appt_head_id.length() > 0) {
      Sd_appt apptDto = null;
      try {
        apptDto = domain.getAndGetForUpdateSd_appt(appt_dtsRecord.Appt_head_id);
      } catch (DomainInterfaceException e) {
        engine.showMessage(e.getMessage());
        return;
      }

      boolean bFound = false;
      // Loop throught the details to find the repeating that has the same Appt_id as the one
      // selected from the grid
      if (apptDto != null && apptDto.DataCollection.count() > 0)
        for (int x = 0; x < apptDto.DataCollection.get(0).Appt_idCollection.count(); x++)
          if (apptDto
              .DataCollection
              .get(0)
              .Appt_idCollection
              .get(x)
              .Appt_id
              .equals(appt_dtsRecord.Appt_id)) {
            // Update the appointment status to Cancelled Reallocation not  required
            apptDto.DataCollection.get(0).Appt_idCollection.get(x).Appt_stat = "-2193";
            // 11/02/2005 - if the record is incomplete then update the completed flag to "F"
            if (isIncomplete(appt_dtsRecord))
              apptDto.DataCollection.get(0).Appt_idCollection.get(x).Act_comp_flg = "F";
            bFound = true;
            break;
          }

      if (bFound) {
        try {
          domain.updateSd_appt(apptDto);
        } catch (DomainInterfaceException e) {
          engine.showMessage(e.getMessage());
          return;
        }

        // Repopulate the grid with the new status
        if (form.MainGrid().getValue() != null) {
          GenForm.MainGridRow row = form.MainGrid().getRowByValue(form.MainGrid().getValue());
          row.setAppointmentStatus(GetApptStatusText("-2193"));
          row.getValue().Appt_stat = "-2193";
          onMainGridSelectionChanged();
        }
      }
    }
  }