Exemplo n.º 1
0
  /** Creates new form Traphong */
  public checkOutAll(JFrame parent, boolean check, String Order_ID) {
    super(parent, check);
    this.Order_ID = Order_ID;
    initComponents();
    txtOrderId.setText(Order_ID);
    // NgayTratruoc.setVisible(false);
    NgayTratruoc.setLocale(new Locale("vi"));
    txtOrderOfCus.setText(
        Utils.selectDateToString(
            "select * from OrderOfCus where orderId='" + Order_ID + "'", "CusName"));
    txtOrderDate.setText(
        Utils.selectDateToString(
            "select * from OrderOfCus where orderId='" + Order_ID + "'", "orderDate"));
    new digitalClock(txtCurrentDate);
    Utils.addItemToTable(
        tblRoomsInOrder, "select * from roomInorder where orderid='" + Order_ID + "'");
    Utils.hiddencol(tblRoomsInOrder, 0);
    Utils.hiddencol(tblRoomsInOrder, 1);
    Utils.hiddencol(tblRoomsInOrder, 2);
    Utils.hiddencol(tblRoomsInOrder, 4);
    Utils.hiddencol(tblRoomsInOrder, 6);
    Utils.addItemToTable(
        tblServicesInOrderOnly, "select * from AllserviceInOrder where orderid='" + Order_ID + "'");
    Utils.hiddencol(tblServicesInOrderOnly, 0);
    FillAllFeild();
    /* sumCostOfRoomInOrder.setText(new publicClass().selectDateToString("select sum ([Thành ti�n]) as TotalCostRoom from tinhtienphong where [mã đơn hàng]='"+txtOrderId.getText()+"'","TotalCostRoom"));
    sumCostOfSVInOrder.setText(new publicClass().selectDateToString("sumofServices '"+txtOrderId.getText()+"'","sumSVR"));
    txtDiscount.setText(new publicClass().selectDateToString("select discount from orders where orderId='"+txtOrderId.getText()+"'","discount"));
    txtAddition.setText(new publicClass().selectDateToString("select addition from orders where orderId='"+txtOrderId.getText()+"'","addition"));
    txtAdd12.setText(new publicClass().selectDateToString("TinhTongTienDonHang "+txtOrderId.getText(),"TotalOd"));


    float Total = new Integer(txtAdd12.getText())+new Integer(txtAddition.getText())-new Integer(txtDiscount.getText())-new Integer(txtPay.getText());
    txtTotalSum.setText(Total+"");
    //String [] title = {" ","Tên phòng","Ngày bắt đầu","Ngày kết thúc","Trạng thái"};
    //TableDataRoom tabledataroom = new TableDataRoom(Order_ID,title);
    //tableSearchOrder.setModel(tabledataroom);
     */
  }
Exemplo n.º 2
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