📄 query.java
字号:
/**
*##############################################################################
*
* [ 项目名 ] : 阳光酒店管理系统
* [ 公司名 ] : 清华IT
* [ 模块名 ] : 营业查询模块
* [ 文件名 ] : Setup.java
* [ 相关文件 ] :
* [ 文件实现功能] : 组织营业查询窗口及功能
* [ 作者 ] : 董丰
* [ 版本 ] : 1.0
* ----------------------------------------------------------------------------
* [ 备注 ] :
* ----------------------------------------------------------------------------
* [ 修改记录 ] :
*
* [ 日 期 ] [版本] [修改人] [修改内容]
* 2006/04/23 1.0 董丰 创建
* ##--------------------------------------------------------------------------
* 版权所有(c) 2006-2007, SunshineSOFT Corporation
* --------------------------------------------------------------------------##
*
* [ 函数说明 ] : 看类内各函数开头
*
* [ 遗留问题 ] :
*
*##############################################################################
*/
package com.sunshine.query;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import com.sunshine.sunsdk.sql.*; //公共类库
import com.sunshine.sunsdk.system.*;
import com.sunshine.sunsdk.swing.*;
import com.sunshine.mainframe.HotelFrame; //加载主窗口
public class Query
extends JDialog
implements ActionListener, MouseListener {
private JLabel top;
private JTabbedPane tp;
private JPanel panelMain;
//=========结帐单查询
private JTextField tf11,tf12,tf13,tf1;
private JButton bt11,bt12;
private JCheckBox chk11,chk12;
private JTable tb1;
private DefaultTableModel dtm1;
private JScrollPane sp1;
//=========全部宾客信息查询
private JTextField tf21,tf2;
private JButton bt21,bt22,bt23;
private JTable tb2;
private DefaultTableModel dtm2;
private JScrollPane sp2;
//=========在店宾客消费查询
private JTextField tf31,tf32,tf33,tf3;
private JButton bt31,bt32;
private JRadioButton rb31,rb32;
private JTable tb3;
private DefaultTableModel dtm3;
private JScrollPane sp3;
//=========离店宾客消费查询
private JTextField tf41,tf42,tf43,tf4;
private JButton bt41,bt42;
private JCheckBox chk41,chk42;
private JComboBox cb41;
private JTable tb4;
private DefaultTableModel dtm4;
private JScrollPane sp4;
/**=======================================================================**
* [## public Query(JFrame frame) {} ]: 构造函数
* 参数 :JDialog对象表示本对话框的父窗口
* 返回值 :无
* 修饰符 :public
* 功能 :组建营业查询模块
**=======================================================================**
*/
public Query(JFrame frame) {
super(frame,"营业查询",true);
top = new JLabel(); //假空格
panelMain = new JPanel(new BorderLayout(0,5));
tab(); //制作系统设置项目标签面板
addListener(); //加入事件监听
panelMain.add("North",top);
panelMain.add("Center",tp);
this.setContentPane(panelMain);
this.setPreferredSize (new Dimension (800,500));
this.setMinimumSize (new Dimension (800,500));
this.setResizable(false); //不允许改变窗口大小
pack();
sunswing.setWindowCenter(this); //窗口屏幕居中
}
/**=======================================================================**
* [## private void addListener() {} ]: 加事件监听
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :加事件监听
**=======================================================================**
*/
private void addListener() {
bt11.addActionListener(this); //加动作监听
bt12.addActionListener(this);
bt21.addActionListener(this);
bt22.addActionListener(this);
bt23.addActionListener(this);
bt31.addActionListener(this);
bt32.addActionListener(this);
bt41.addActionListener(this);
bt42.addActionListener(this);
bt11.addMouseListener(this); //加鼠标监听
bt12.addMouseListener(this);
bt21.addMouseListener(this);
bt22.addMouseListener(this);
bt23.addMouseListener(this);
bt31.addMouseListener(this);
bt32.addMouseListener(this);
bt41.addMouseListener(this);
bt42.addMouseListener(this);
}
/**=======================================================================**
* [## private void tab() {} ]:
* 参数 :无
* 返回值 :无
* 修饰符 :private
* 功能 :制作系统设置项目标签面板
**=======================================================================**
*/
private void tab() {
JPanel jp1,jp2,jp3,jp4;
///////////////////////////////////////////////-----------模块接口
jp1 = pay(); //结账单查询
jp2 = allCustomer(); //全部宾客信息查询
jp3 = stay(); //在店宾客消费查询
jp4 = leave(); //离店宾客消费查询
//////////////////////////////////////////////////////////////////
tp = new JTabbedPane();
tp.addTab("结帐单查询", new ImageIcon("pic/u04.gif"), jp1);
tp.addTab("全部宾客信息查询", new ImageIcon("pic/u02.gif"), jp2);
tp.addTab("在店宾客消费查询", new ImageIcon("pic/u03.gif"), jp3);
tp.addTab("离店宾客消费查询", new ImageIcon("pic/v04.gif"), jp4);
}
/**=======================================================================**
* [## private JPanel pay() {} ]:
* 参数 :无
* 返回值 :JPanel
* 修饰符 :private
* 功能 :结帐单查询
**=======================================================================**
*/
private JPanel pay() {
tf11 = new TJTextField (13);
tf12 = new TJTextField (13);
tf13 = new TJTextField (13);
tf1 = new JTextField ("结帐状态信息");
tf1.setHorizontalAlignment (JTextField.CENTER);
tf1.setBackground(new Color(199,183,143));
tf1.setBorder(new LineBorder(new Color(87,87,47)));
tf1.setEditable(false);
bt11 = new TJButton ("pic/find.gif", "查 询", "查询结帐单信息");
bt12 = new TJButton ("pic/b1.gif", "刷 新", "刷新结帐单信息");
chk11 = new JCheckBox(" 结帐时间:");
chk12 = new JCheckBox();
dtm1 = new DefaultTableModel();
tb1 = new JTable(dtm1);
sp1 = new JScrollPane(tb1);
////////////////////////填写表格
String sqlCode = "select a.chk_no 帐单号,b.r_no 房间号,b.c_name 宾客姓名,b.foregift 已收押金,a.money 实收金额,a.chk_time 结算时间,a.remark 备注 "+
"from checkout as a,livein as b where a.delmark = 0 and a.in_no = b.in_no";
sunsql.initDTM(dtm1,sqlCode);
JLabel lb1,lb4,lb5,lb8,lb9,lb10,lb11;
lb1 = new JLabel("起始时间 ");
lb4 = new JLabel(" 终止时间 ");
lb5 = new JLabel(" ");
lb8 = new JLabel("姓名/房间号/帐单号: ");
lb9 = new JLabel(" ");
lb10 = new JLabel(" ");
lb11 = new JLabel(" ");
JPanel panelPay,pn,pn1,pn2,pc;
panelPay = new JPanel(new BorderLayout());
pn = new JPanel(new GridLayout(2,1,0,0));
pn1 = new JPanel(new FlowLayout());
pn2 = new JPanel(new FlowLayout());
pc = new JPanel(new BorderLayout());
pn1.add(chk11);
pn1.add(lb1);
pn1.add(tf11);
pn1.add(lb4);
pn1.add(tf12);
pn1.add(lb5);
pn2.add(chk12);
pn2.add(lb8);
pn2.add(tf13);
pn2.add(lb9);
pn2.add(bt11);
pn2.add(lb10);
pn2.add(bt12);
pn2.add(lb11);
pn.add(pn1);
pn.add(pn2);
pn.setBorder(BorderFactory.createTitledBorder(""));
pc.add("North",tf1);
pc.add(sp1);
pc.setBorder(BorderFactory.createTitledBorder(""));
panelPay.add("North",pn);
panelPay.add(pc);
return panelPay;
}
/**=======================================================================**
* [## private JPanel allCustomer() {} ]:
* 参数 :无
* 返回值 :JPanel
* 修饰符 :private
* 功能 :全部宾客信息查询
**=======================================================================**
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -