Example #1
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    if (roomId == null) {
      JOptionPane.showMessageDialog(this, "Bạn phải ch�n phòng để trả");
    } else {
      if (new Integer(roomStatus) != 4) {

        if (new Integer(
                new Utils().selectDateToString("tratruochaykhong '" + detaiId + "'", "canPay"))
            == 0) {
          JOptionPane.showMessageDialog(
              this,
              "Bạn  không thể trả phòng khi mà khách đặt trước và chưa đến ở !");
        }
        if (new Integer(
                new Utils().selectDateToString("tratruochaykhong '" + detaiId + "'", "canPay"))
            == 1) {
          JOptionPane.showMessageDialog(this, "Trả trước th�i hạn!");
          if (TratruocThoiHan.isSelected()) {
            int cf1 =
                JOptionPane.showConfirmDialog(
                    this,
                    "Bạn có muốn trả phòng: "
                        + roomName
                        + " trước th�i hạn vào ngày: "
                        + new UserFormat().getFormat(NgayTratruoc.getDate(), "thongthuong")
                        + " hay không ?",
                    "Thong bao",
                    0);
            if (cf1 == 0) {

              CheckOutRoom(
                  roomId,
                  roomName,
                  txtOrderId.getText(),
                  detaiId,
                  new UserFormat().getFormat(NgayTratruoc.getDate(), "ngaygio"));
            }
          } else {
            int cf =
                JOptionPane.showConfirmDialog(
                    this,
                    "Bạn có muốn trả phòng: "
                        + roomName
                        + " vào ngày hôm nay hay không ?",
                    "Thông báo!",
                    0);
            if (cf == 0) {
              CheckOutRoom(roomId, roomName, txtOrderId.getText(), detaiId, "getDate()");
            }
          }
        } // ngày hiện th�i nằm trong khoảng th�i gian có thể trả
      } else // phong da tra
      {
        JOptionPane.showMessageDialog(
            this,
            "Phòng: "
                + roomName
                + " đã được trả ! bạn kông thể thao tác được !");
      }
    }
  } // GEN-LAST:event_jButton1ActionPerformed