📄 hotelframe.java
字号:
//获得主房间状态,看是普通住宿还是钟点房
rs = sunsql.executeQuery("select state from roominfo where delmark=0 and id='" + mainRoom + "'");
rs.next();
int mrState = 0; //主房间状态 0:普通入住 1:钟点房
if(rs.getString(1).equals("钟点")) {
mrState = 1;
}//Endif
DefaultTableModel ckoDTM = new DefaultTableModel(); //主房间下的所有房间信息
sunsql.initDTM(ckoDTM, "select pk,r_no,r_type_id,c_type_id,in_time,foregift from " +
"livein where delmark=0 and main_room='" + mainRoom + "'");
double total = 0; //消费总金额
double shsh = 0; //实收金额
double youh = 0; //优惠金额
for (int i = 0; i < ckoDTM.getRowCount(); i++) {
//取出当前房间的标准单价
rs = sunsql.executeQuery("select price,cl_price from roomtype where delmark=0 and id='" +
ckoDTM.getValueAt(i, 2) + "'");
rs.next();
double rprice = 0;
double days = 0;
if(mrState == 0) {
rprice = rs.getDouble(1); //普通入住单价
//获得入住天数
days = suntools.getConsumeFactor(ckoDTM.getValueAt(i, 4) + "", Journal.getNowDTime());
}else {
rprice = rs.getDouble(2); //钟点房单价
days = suntools.getClockFactor(ckoDTM.getValueAt(i, 4) + "", Journal.getNowDTime());
}//Endif
double rd = rprice * days; //当前房间的消费总金额
total = total + rd; //累加总消费
rs = sunsql.executeQuery("select discount from customertype where delmark=0 and " +
"id='" + ckoDTM.getValueAt(i, 3) + "' and dis_attr='" + ckoDTM.getValueAt(i, 2) + "'");
rs.next();
//取出宾客享受的折扣
int dst = rs.getInt(1);
double ddr = rd * dst/10; //当前房间的打折后价格
shsh = shsh + ddr; //应收金额累加
youh = youh + rd - ddr; //优惠金额累加
//向结算中间表加入数据
sunsql.executeUpdate("insert into checkout_temp(pk,r_type_id,r_no,price," +
"discount,dis_price,account,money,in_time) values(" + ckoDTM.getValueAt(i, 0) +
",'" + ckoDTM.getValueAt(i, 2) + "','" + ckoDTM.getValueAt(i, 1) + "'," +
rprice + "," + dst + "," + rprice * dst / 10 + "," + days + "," + ddr + ",'" +
ckoDTM.getValueAt(i, 4) + "')");
}
//传消费金额给结算窗口
co.lbD.setText(total + "");
//传应收金额给结算窗口
co.lbE.setText(shsh + "");
//传实收金额
co.tf1.setText(shsh + "");
//传优惠金额给结算窗口
co.lbG.setText(youh + "");
//传找零金额给结算窗口
co.lbH.setText(Double.parseDouble(co.lbF.getText()) - shsh + "");
//刷新结算中间表数据
co.initDTM();
co.tf2.requestFocus(true); //给宾客支付焦点
}//Endif
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null, "操作失败,请检查网络情况",
"提示", JOptionPane.INFORMATION_MESSAGE);
ex.printStackTrace();
System.out.println ("HotelFrame.initCKO(): false");
return false;
}//End try
return true;
}
/**=======================================================================**
* ActionListener 监听
**=======================================================================**
*/
public void actionPerformed (ActionEvent ae) {
Object o = ae.getSource ();
if(o == bt1 || o ==mi11) {//============================================
lbB.setText(face + "散 客 开 单 -");
if(initIDV()) { //传数据给散客开单窗口
idv.show(); //散客开单
initLeftData(); //刷新左房间信息栏数据
}//Endif
}else if(o == bt2 || o == mi12) {//=====================================
lbB.setText(face + "团 体 开 单 -");
if(initTeam()) { //传宾客类型数据给团体开单窗口
tm.show(); //团体开单
initLeftData(); //刷新左房间信息栏数据
}//Endif
}else if(o == bt3 || o == mi36) {//=====================================
lbB.setText(face + "关 于 我 们 -");
ab.show(); //关于我们
}else if(o == bt4 || o == mi21) {//=====================================
lbB.setText(face + "宾 客 结 帐 -");
if(initCKO()) { //传数据给结算窗口
co.show(); //宾客结帐
initLeftData(); //刷新左房间信息栏数据
}//Endif
}else if(o == bt5 || o == mi17) {//=====================================
lbB.setText(face + "客 房 预 订 -");
eg.show(); //客房预订
initLeftData(); //刷新左房间信息栏数据
}else if(o == bt6) {//==================================================
lbB.setText(face + "营 业 查 询 -");
qr.show(); //营业查询
}else if(o == bt7) {//==================================================
if(puil.equals("普通操作员")) { //客户管理
String msg = "对不起,您的权限不能进入 [ 客户管理 ] 页面,请用管理员ID登录 ...";
JOptionPane.showMessageDialog(null, msg, "提示", JOptionPane.INFORMATION_MESSAGE);
return;
}
lbB.setText(face + "客 户 管 理 -");
ct.initDTM1();
//ct.initDTM2();
ct.show();
}else if(o == bt8 || o == mi31) {//=====================================
if(puil.equals("普通操作员")) { //网络设置
String msg = "对不起,您的权限不能进入 [ 网络设置 ] 页面,请用管理员ID登录 ...";
JOptionPane.showMessageDialog(null, msg, "提示", JOptionPane.INFORMATION_MESSAGE);
return;
}
lbB.setText(face + "网 络 设 置 -");
ns.show();
}else if(o == bt9 || o == mi32) {//=====================================
if(puil.equals("普通操作员")) { //系统设置
String msg = "对不起,您的权限不能进入 [ 网络设置 ] 页面,请用管理员ID登录 ...";
JOptionPane.showMessageDialog(null, msg, "提示", JOptionPane.INFORMATION_MESSAGE);
return;
}
lbB.setText(face + "系 统 设 置 -");
st.buildDTM12(""); //刷新房间信息表的房间状态
st.show();
initLeftData(); //刷新左房间信息栏数据
}else if(o == btA || o == mi19) {//=====================================
quit (); //退出系统
}else if(o == mi13) {//=================================================
lbB.setText(face + "宾 客 续 住 -");
go.show(); //宾客续住
}else if(o == mi14) {//=================================================
lbB.setText(face + "更 换 房 间 -");
cg.show(); //更换房间
}else if(o == mi15) {//=================================================
lbB.setText(face + "修 改 登 记 -");
idv.show(); //修改登记-------还要修改
}else if(o == mi16) {//=================================================
//房间状态
}else if(o == mi18) {//=================================================
//电子提醒
}else if(o == mi22) {//=================================================
lbB.setText(face + "合 并 帐 单 -");
ub.show(); //合并帐单
}else if(o == mi23) {//=================================================
lbB.setText(face + "折 分 帐 单 -");
ap.show(); //折分帐单
}else if(o == mi33) {//=================================================
lbB.setText(face + "系 统 日 志 -");
rc.initDTM(); //刷新日志列表
rc.show(); //系统日志
}else if(o == mi34) {//=================================================
//数据备份
}else if(o == mi35) {//=================================================
//软件帮助
}
lbB.setText(face + "阳 光 酒 店 管 理 系 统 - ★★ 版 ");
}
/**=======================================================================**
* MouseListener 监听
**=======================================================================**
*/
public void mouseClicked (MouseEvent me) {
}
public void mousePressed (MouseEvent me) {
}
public void mouseReleased(MouseEvent me) {
}
public void mouseEntered (MouseEvent me) { //鼠标移进提示
Object o = me.getSource ();
if(o == bt1) {
lbA.setText (clue + toolTip[0]);
}else if(o == bt2) {
lbA.setText (clue + toolTip[1]);
}else if(o == bt3) {
lbA.setText (clue + toolTip[2]);
}else if(o == bt4) {
lbA.setText (clue + toolTip[3]);
}else if(o == bt5) {
lbA.setText (clue + toolTip[4]);
}else if(o == bt6) {
lbA.setText (clue + toolTip[5]);
}else if(o == bt7) {
lbA.setText (clue + toolTip[6]);
}else if(o == bt8) {
lbA.setText (clue + toolTip[7]);
}else if(o == bt9) {
lbA.setText (clue + toolTip[8]);
}else if(o == btA) {
lbA.setText (clue + toolTip[9]);
}
}
public void mouseExited (MouseEvent me) {
lbA.setText (clue + "请选择功能项 ... ");
}
/**=======================================================================**
* [## public void run() {} ]:
* 参数 :无
* 返回值 :无
* 修饰符 :public
* 功能 :结算后检查房间状态线程
**=======================================================================**
*/
public void run() {
try {
Statement ste1 = null;
Connection conn1 = null;
if(sunini.getIniKey ("Default_Link").equals ("1")) { //JDBC连接方式
String user1 = sunini.getIniKey ("UserID");
String pwd1 = sunini.getIniKey ("Password");
String ip1 = sunini.getIniKey ("IP");
String acc1 = sunini.getIniKey ("Access");
String dbf1 = sunini.getIniKey ("DBFname");
String url1 = "jdbc:microsoft:sqlserver://" + ip1 + ":" + acc1 + ";" + "databasename=" + dbf1;
//注册驱动
DriverManager.registerDriver (new com.microsoft.jdbc.sqlserver.SQLServerDriver());
//获得一个连接
conn1 = DriverManager.getConnection (url1, user1, pwd1);
}
else {
//注册驱动 //JDBCODBC连接方式
DriverManager.registerDriver (new sun.jdbc.odbc.JdbcOdbcDriver());
//获得一个连接
conn1 = DriverManager.getConnection ("jdbc:odbc:" + sunini.getIniKey("LinkName"));
}
//建立高级载体
ste1 = conn1.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
while( true ) {
ste1.executeUpdate("update roominfo set statetime=statetime-1 where statetime>0");
ste1.executeUpdate("update roominfo set state='可供' where statetime=0 and state='脏房'");
Thread.sleep(30000);
}//End while
}
catch (Exception ex) {
JOptionPane.showMessageDialog (null, "数据库连接失败...", "错误", JOptionPane.ERROR_MESSAGE);
System.exit(0);
//ex.printStackTrace();
}//End try
}
public static void main (String sd[]) {
sunswing.setWindowStyle (sunini.getIniKey ("Sys_style").charAt (0));
new HotelFrame ("gujun", "管理员");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -