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

📄 guestsettleaccounts.java~89~

📁 酒店信息管理系统包括客户的信息
💻 JAVA~89~
📖 第 1 页 / 共 2 页
字号:
package GuestManagement;

import java.awt.BorderLayout;
import hotelinformationmanagesystem.*;
import javax.swing.JFrame;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.util.Date;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
import java.sql.SQLException;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.Color;
import java.text.SimpleDateFormat;

/**
 * <p>Title: 酒店信息管理系统</p>
 *
 * <p>Description: HotelInformationManageSystem</p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: JSP</p>
 *
 * @author 江世澎
 * @version 1.0
 */
public class GuestSettleAccounts extends JFrame {
    XYLayout xYLayout1 = new XYLayout();
    JPanel jPGusetInfo = new JPanel();
    XYLayout xYLayout2 = new XYLayout();
    JLabel jLAccounts = new JLabel();
    JLabel jLCompany = new JLabel();
    JLabel jLName = new JLabel();
    JTextField jTFAccounts = new JTextField();
    JTextField jTFName = new JTextField();
    JTextField jTFCompany = new JTextField();
    JPanel jPAccounts = new JPanel();
    XYLayout xYLayout4 = new XYLayout();
    JLabel jLRoomName = new JLabel();
    JPanel jPDeposit = new JPanel();
    JLabel jLDeposit = new JLabel();
    JTextField jTFDeposit = new JTextField();
    XYLayout xYLayout6 = new XYLayout();
    JPanel jPRoomInfo = new JPanel();
    JLabel jLRoomNum = new JLabel();
    JTextField jTFRoomNum = new JTextField();
    XYLayout xYLayout7 = new XYLayout();
    JPanel jPCHODay = new JPanel();
    XYLayout xYLayout8 = new XYLayout();
    JLabel jLCHODay = new JLabel();
    JTextField jTFCHODay = new JTextField();
    JPanel jPSum = new JPanel();
    XYLayout xYLayout9 = new XYLayout();
    JLabel jLSum = new JLabel();
    JButton jBSettlement = new JButton();
    JPanel jPCommand = new JPanel();
    XYLayout xYLayout10 = new XYLayout();
    JButton jBQuit = new JButton();
    JPanel jPReceive = new JPanel();
    XYLayout xYLayout11 = new XYLayout();
    JLabel jLReceive = new JLabel();
    JTextField jTFReceive = new JTextField();
    JButton jBQueryAccounts = new JButton();
    JPanel jPSettlesAccounts = new JPanel();
    XYLayout xYLayout5 = new XYLayout();
    JRadioButton jRBGuestSettleAccounts = new JRadioButton();
    JRadioButton jRBGroupSettleAccounts = new JRadioButton();
    ButtonGroup BGGuestSettleAccounts = new ButtonGroup();
    JScrollPane jSPRoomaName = new JScrollPane();
    JTextArea jTARoomName = new JTextArea();
    JButton jBShowRoomInfo = new JButton();
    JButton jBAddRoom = new JButton();
    JLabel jLSumShow = new JLabel();
    JLabel jLYuan = new JLabel();
    JButton jBReSet = new JButton();

    hotelinformationmanagesystem.JudgeValidity judgeval = new JudgeValidity();
    DataConnect connect1;
    DataConnect connect2;
    ResultSet rs1l = null;

    public static String strID = "";
    Date daCheckInDate;
    SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = new Date();
    String strFlag = "";
    float flGiveyou;

    public GuestSettleAccounts() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(xYLayout1);
        this.setResizable(false);
        this.setTitle("客户结账界面");
        xYLayout1.setWidth(445);
        xYLayout1.setHeight(303);
        this.setSize(450, 335); //宽,高
        SetFormCenter wcenter = new SetFormCenter();
        wcenter.setcenter(this);
        jPGusetInfo.setBorder(BorderFactory.createEtchedBorder());
        jPGusetInfo.setLayout(xYLayout2);
        jLAccounts.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
        jLAccounts.setText("账单编号");
        jLCompany.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
        jLCompany.setText("单 位");
        jLName.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
        jLName.setText("姓 名");
        jPAccounts.setBorder(BorderFactory.createEtchedBorder());
        jPAccounts.setLayout(xYLayout4);
        jLRoomName.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
        jLRoomName.setText("房间名");
        jPDeposit.setBorder(BorderFactory.createEtchedBorder());
        jPDeposit.setLayout(xYLayout6);
        jLDeposit.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
        jLDeposit.setText("押 金");
        jPRoomInfo.setBorder(BorderFactory.createEtchedBorder());
        jPRoomInfo.setLayout(xYLayout7);
        jLRoomNum.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
        jLRoomNum.setText("客房数");
        jPCHODay.setLayout(xYLayout8);
        jPCHODay.setBorder(BorderFactory.createEtchedBorder());
        jLCHODay.setFont(new java.awt.Font("宋体", Font.BOLD, 14));
        jLCHODay.setText("入住天数");
        jPSum.setBorder(BorderFactory.createEtchedBorder());
        jPSum.setLayout(xYLayout9);
        jLSum.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
        jLSum.setText("金 额");
        jBSettlement.setEnabled(false);
        jBSettlement.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
        jBSettlement.setText("结算");
        jBSettlement.addActionListener(new
                                       GuestSettleAccounts_jBSettlement_actionAdapter(this));
        jPCommand.setBorder(BorderFactory.createEtchedBorder());
        jPCommand.setLayout(xYLayout10);
        jBQuit.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
        jBQuit.setText("取消");
        jBQuit.addActionListener(new GuestSettleAccounts_jBQuit_actionAdapter(this));
        jPReceive.setBorder(BorderFactory.createEtchedBorder());
        jPReceive.setLayout(xYLayout11);
        jLReceive.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
        jLReceive.setText("收 取");
        jTFReceive.setEnabled(false);
        jTFReceive.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
        jBQueryAccounts.setToolTipText("");
        jBQueryAccounts.setText("查找");
        jBQueryAccounts.addActionListener(new
                                          GuestSettleAccounts_jBQueryAccounts_actionAdapter(this));
        jPSettlesAccounts.setLayout(xYLayout5);
        jPSettlesAccounts.setBorder(BorderFactory.createEtchedBorder());
        jRBGuestSettleAccounts.setText("客户结账");
        jRBGroupSettleAccounts.setText("团体结账");
        jTFName.setEnabled(false);
        jTFCompany.setEnabled(false);
        jTFRoomNum.setEnabled(false);
        jTFCHODay.setEnabled(false);
        jTFDeposit.setEnabled(false);
        jBShowRoomInfo.setEnabled(false);
        jBShowRoomInfo.setFont(new java.awt.Font("宋体", Font.PLAIN, 10));
        jBShowRoomInfo.setText("显示详细信息");
        jBShowRoomInfo.addActionListener(new
                                         GuestSettleAccounts_jBShowRoomInfo_actionAdapter(this));
        jTARoomName.setEnabled(false);
        jBAddRoom.setEnabled(false);
        jBAddRoom.setText("核算");
        jBAddRoom.addActionListener(new
                                    GuestSettleAccounts_jBAddRoom_actionAdapter(this));
        jLSumShow.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
        jLSumShow.setForeground(Color.orange);
        jLYuan.setFont(new java.awt.Font("宋体", Font.BOLD, 18));
        jLYuan.setText("元");
        jBReSet.setEnabled(false);
        jBReSet.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
        jBReSet.setText("重置");
        jBReSet.addActionListener(new GuestSettleAccounts_jBReSet_actionAdapter(this));
        jPSum.add(jLSum, new XYConstraints(9, 9, -1, -1));
        this.getContentPane().add(jPAccounts, new XYConstraints(197, 2, 244, 32));
        jPCommand.add(jBSettlement, new XYConstraints(22, 4, 104, 35));
        jPCommand.add(jBQuit, new XYConstraints(308, 3, 104, 35));
        jPCommand.add(jBReSet, new XYConstraints(169, 4, 104, 35));
        jPReceive.add(jLReceive, new XYConstraints(9, 9, -1, -1));
        jPReceive.add(jTFReceive, new XYConstraints(72, 2, 357, 31));
        jPDeposit.add(jLDeposit, new XYConstraints(2, 6, -1, -1));
        jPRoomInfo.add(jLRoomNum, new XYConstraints(9, 6, -1, -1));
        jPRoomInfo.add(jLRoomName, new XYConstraints(9, 34, -1, -1));
        jPCHODay.add(jLCHODay, new XYConstraints(9, 6, -1, -1));
        jPGusetInfo.add(jLName, new XYConstraints(9, 7, -1, -1));
        this.getContentPane().add(jPGusetInfo, new XYConstraints(4, 35, 437, 33));
        this.getContentPane().add(jPCHODay, new XYConstraints(4, 134, 218, 33));
        this.getContentPane().add(jPCommand, new XYConstraints(4, 254, 437, 45));
        this.getContentPane().add(jPReceive, new XYConstraints(4, 211, 437, 41));
        this.getContentPane().add(jPDeposit,
                                  new XYConstraints(223, 134, 218, 33));
        this.getContentPane().add(jPSum, new XYConstraints(4, 167, 437, 41));
        jPAccounts.add(jLAccounts, new XYConstraints(9, 5, -1, -1));
        jPAccounts.add(jTFAccounts, new XYConstraints(81, 3, 86, -1));
        jPAccounts.add(jBQueryAccounts, new XYConstraints(174, 3, 63, 20));
        this.getContentPane().add(jPSettlesAccounts,
                                  new XYConstraints(4, 2, 192, 32));
        jPSettlesAccounts.add(jRBGuestSettleAccounts,
                              new XYConstraints(7, 1, -1, -1));
        jPSettlesAccounts.add(jRBGroupSettleAccounts,
                              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;
        float flSum = 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) {

⌨️ 快捷键说明

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