⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guestsettleaccounts.java

📁 酒店信息管理系统包括客户的信息
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                              new XYConstraints(106, 1, -1, -1));
        jPDeposit.add(jTFDeposit, new XYConstraints(54, 4, 156, -1));
        jPCHODay.add(jTFCHODay, new XYConstraints(75, 4, 136, -1));
        jPGusetInfo.add(jLCompany, new XYConstraints(8, 7, -1, -1));
        jPGusetInfo.add(jTFCompany, new XYConstraints(75, 4, 156, -1));
        this.getContentPane().add(jPRoomInfo, new XYConstraints(4, 68, 437, 64));
        jPRoomInfo.add(jBShowRoomInfo, new XYConstraints(333, 30, -1, 27));
        jSPRoomaName.getViewport().add(jTARoomName);
        jPGusetInfo.add(jTFName, new XYConstraints(75, 4, 156, -1));
        jPRoomInfo.add(jTFRoomNum, new XYConstraints(75, 2, 156, -1));

        BGGuestSettleAccounts.add(jRBGuestSettleAccounts); //散客
        BGGuestSettleAccounts.add(jRBGroupSettleAccounts); //团体
        jPRoomInfo.add(jSPRoomaName, new XYConstraints(75, 28, 253, 30));
        jPSum.add(jLSumShow, new XYConstraints(75, 6, 200, 24));
        jPSum.add(jLYuan, new XYConstraints(286, 10, 27, 19));
        jPSum.add(jBAddRoom, new XYConstraints(337, 5, -1, -1));
        if (MainFrame.strGuestStyle.equals("SN")) { //散客管理
            jRBGuestSettleAccounts.setSelected(true);
            jRBGroupSettleAccounts.setEnabled(false);
            jLCompany.setVisible(false);
            jTFCompany.setVisible(false);
        } else if (MainFrame.strGuestStyle.equals("TN")) { //团体管理
            jRBGuestSettleAccounts.setEnabled(false);
            jRBGroupSettleAccounts.setSelected(true);
            jLName.setVisible(false);
            jTFName.setVisible(false);
        }
    }

    public void jBQuit_actionPerformed(ActionEvent e) { //取消
        this.setVisible(false);

    }

    public void jBShowRoomInfo_actionPerformed(ActionEvent e) { //显示详细信息
        DisplayRoomInfo displayroominfo = new DisplayRoomInfo();
        displayroominfo.setVisible(true);
    }

    public void jBAddRoom_actionPerformed(ActionEvent e) { //核算
        float flAllMoreny = 0;
        String strDate = dateformat.format(daCheckInDate);
        String strDeposit = jTFDeposit.getText(); //押金
        try {
            //-----------------------------------------------------------------------------------------------------
            connect1 = new DataConnect();
            connect1.con1 = DriverManager.getConnection(connect1.url); //建立连接
            connect1.stmt1 = connect1.con1.createStatement(); //创建语句
            connect1.sql1 = "Select distinct RoomID,StandardPri,RebatePri from HIMS_Register_CheckInRoom,HIMS_RoomInfo  where   HIMS_RoomInfo .RoomID  in (select RoomName01 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "') or HIMS_RoomInfo.RoomID  in (select RoomName02 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "') or HIMS_RoomInfo.RoomID  in (select RoomName03 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "') or HIMS_RoomInfo.RoomID  in (select RoomName04 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "') or HIMS_RoomInfo.RoomID  in (select RoomName05 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "') or HIMS_RoomInfo.RoomID  in (select RoomName06 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "') or HIMS_RoomInfo.RoomID  in (select RoomName07 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "') or HIMS_RoomInfo.RoomID  in (select RoomName08 from HIMS_Register_CheckInRoom where RegRoomID = '" +
                            strID + "');";
            rs1l = connect1.stmt1.executeQuery(connect1.sql1);
            //-----------------------------------------------------------------------------------------------------
            while (rs1l.next()) {
                String strRoomID = rs1l.getString("RoomID");
                float flStandardPri = rs1l.getFloat("StandardPri");
                float flRebatePri = rs1l.getFloat("RebatePri");

                if (!strRoomID.equals(null)) {
                    if (flRebatePri == 0) { //折扣价
                        flAllMoreny = flAllMoreny + flStandardPri;
                    } else {
                        flAllMoreny = flAllMoreny + flRebatePri;
                    }
                } else {
                    return;
                }
            } //while
            flSum = flAllMoreny * Float.valueOf(jTFCHODay.getText()).floatValue();
            flGiveyou = Float.valueOf(strDeposit) - flSum;
            String strMessage = "";
            if (flGiveyou > 0) {
                strMessage = "应找还给客人" + flGiveyou + "";
            } else if (flGiveyou < 0) {
                strMessage = "客人还应再付" + flGiveyou + "";
                jLSumShow.setText("客户还应再付" + String.valueOf(flGiveyou).toString());
                strFlag = "F";
                jBSettlement.setEnabled(true);
                jTFReceive.setEnabled(true);
            } else {
                strMessage = "不用再付任何金额!";
            }
            JOptionPane.showMessageDialog(null, " 您所交的押金为'" + strDeposit
                                          + "'\n  开始住的日期为'" + strDate
                                          + "'\n  住的天数为'" + jTFCHODay.getText()
                                          + "'\n  所住房间的价格为'" + flAllMoreny
                                          + "'\n  所住的房间总金额为'" + flSum
                                          + "'\n  '" + strMessage
                                          + "'\n   ", "酒店信息管理系统提示",
                                          JOptionPane.WARNING_MESSAGE);
            connect2 = new DataConnect();
            connect3 = new DataConnect();
            connect2.con2 = DriverManager.getConnection(
                    connect2.url); //建立连接
            connect3.con3 = DriverManager.getConnection(
                    connect3.url); //建立连接
            connect2.stmt2 = connect2.con2.createStatement(); //创建语句
            connect3.stmt3 = connect3.con3.createStatement(); //创建语句
            connect2.sql2 =
                    " UPDATE  HIMS_Register_Account SET AccountID = '" +
                    strID +
                    "' , Reckoning= '" + flSum +
                    "', DutyID= '" + ReturnPopedom.strEmpID +
                    "' Where AccountID = '" + strID + "'";
            connect3.sql3 =
                    " UPDATE  HIMS_Register SET CheckInType = 'Q ',CheckInDay = '" +
                    jTFCHODay.getText()
                    + "' , QuitDate = '" + strDate+ "' Where RegisterID = '" +
                    strID + "'";

            connect2.stmt2.executeUpdate(connect2.sql2);
            connect3.stmt3.executeUpdate(connect3.sql3);
            jBAddRoom.setEnabled(false);
        } catch (SQLException ex) {
            ex.printStackTrace();
        } finally {
            try {
                if (connect1.con1 != null && connect2.con1 != null && connect3.con1 != null) {
                    connect1.con1.close(); //关闭数据库admin
                    connect2.con2.close(); //关闭数据库admin
                    connect3.con3.close(); //关闭数据库admin
                    connect1.stmt1.close();
                    connect2.stmt2.close();
                    connect3.stmt3.close();
                } //if
            } catch (SQLException ex) {
                System.out.println(ex);
            } //catch
        } //finally
    }

    public void jBQueryAccounts_actionPerformed(ActionEvent e) { //查找
        strID = jTFAccounts.getText();
        String strSystemDate = dateformat.format(date); //得到系统时间

        try {
            //-----------------------------------------------------------------------------------------------------
            connect1 = new DataConnect();
            connect1.con1 = DriverManager.getConnection(connect1.url); //建立连接
            connect1.stmt1 = connect1.con1.createStatement(); //创建语句
            connect1.sql1 = "SELECT RegisterID,Name,Company,RegiType,CheckInType,Deposit,CheckInDate,CheckInDay,QuitDate,RoomMon,RoomName01,RoomName02,RoomName03,RoomName04,RoomName05,RoomName06,RoomName07,RoomName08 FROM HIMS_Register,HIMS_Register_CheckInRoom  where  HIMS_Register.RegisterID = HIMS_Register_CheckInRoom.RegRoomID AND CheckInType != 'Q';";
            rs1l = connect1.stmt1.executeQuery(connect1.sql1);
            //-----------------------------------------------------------------------------------------------------
            while (rs1l.next()) {
                String strBuffID = rs1l.getString("RegisterID");
                String strName = rs1l.getString("Name");
                String strCompany = rs1l.getString("Company");
                String strRegiTypes = rs1l.getString("RegiType");
                String strCheckInTypes = rs1l.getString("CheckInType");
                String strDeposit = rs1l.getString("Deposit");
                daCheckInDate = rs1l.getDate("CheckInDate");
                String strCheckInDay = rs1l.getString("CheckInDay");
                String QuitDate = rs1l.getString("QuitDate");
                String strRoomMon = rs1l.getString("RoomMon");
                String strRoomName01 = rs1l.getString("RoomName01");
                String strRoomName02 = rs1l.getString("RoomName02");
                String strRoomName03 = rs1l.getString("RoomName03");
                String strRoomName04 = rs1l.getString("RoomName04");
                String strRoomName05 = rs1l.getString("RoomName05");
                String strRoomName06 = rs1l.getString("RoomName06");
                String strRoomName07 = rs1l.getString("RoomName07");
                String strRoomName08 = rs1l.getString("RoomName08");

                if (strBuffID.equals(strID)) {
                    if (strRegiTypes.equals("T") && strCheckInTypes.equals("N")) { //客人类型:团体
                        jRBGroupSettleAccounts.setSelected(true);
                        jRBGroupSettleAccounts.setEnabled(true);
                        jRBGuestSettleAccounts.setEnabled(false);
                        jLCompany.setVisible(true);
                        jTFCompany.setVisible(true);
                        jLName.setVisible(false);
                        jTFName.setVisible(false);
                        jBQueryAccounts.setEnabled(false);
                        jBAddRoom.setEnabled(true);
                        jBShowRoomInfo.setEnabled(true);
                        jTFCompany.setText(strCompany);
                        jTFDeposit.setText(strDeposit);
                        jTFCHODay.setText(strCheckInDay);
                        jTFRoomNum.setText(strRoomMon);
                        jTARoomName.setText(strRoomName01 + " " +
                                            strRoomName02 +
                                            " " + strRoomName03 + " " +
                                            strRoomName04 +
                                            " " + strRoomName05 + " " +
                                            strRoomName06 + " " +
                                            strRoomName07 +
                                            " " + strRoomName08);
                        if (strSystemDate.compareTo(QuitDate) < 0) {
                            int inChoose = JOptionPane.showConfirmDialog(null,
                                    "您与要离店的日期还有一段时间,真的要结账吗?!",
                                    "酒店信息管理系统提示", JOptionPane.YES_NO_OPTION);
                            if (inChoose == 0) { //choose为0时,用户选则“是”
                                int iNum = strSystemDate.compareTo(
                                        String.valueOf(daCheckInDate).toString());
                                jTFCHODay.setText(String.valueOf(iNum).toString());
                            }
                                connect4 = new DataConnect();
                                connect4.con4 = DriverManager.getConnection(
                                        connect4.url); //建立连接
                                connect4.stmt4 = connect4.con4.createStatement(); //创建语句
                                connect4.sql4 =
                                        " UPDATE  HIMS_RoomState SET  OnUser = '2' , Reason  = '客人已经退出此房间,可以作用!!' where RoomID = '" +
                                        strRoomName01 + "' or RoomID = '" +
                                        strRoomName02
                                        + "' or RoomID = '" + strRoomName03 +
                                        "' or RoomID = '" + strRoomName04 +
                                        "' or RoomID = '" + strRoomName05 +
                                        "' or RoomID = '" + strRoomName02
                                        + "' or RoomID = '" + strRoomName06 +
                                        "' or RoomID = '" + strRoomName07 +
                                        "' or RoomID = '" + strRoomName08 + "'";
                                connect4.stmt4.executeUpdate(connect4.sql4);
                            }

                        return;
                    } else if (strRegiTypes.equals("S") &&

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -