温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(ExtJs)源码
当前文件:
MyHotelManager/HotelUI/Js/CloseRoom.js,打开代码结构图
MyHotelManager/HotelUI/Js/CloseRoom.js,打开代码结构图1//退房方法 2
function CloseRoom(OpenRoomId,RoomNumber,TypeName,TypePrice,OpenTime,GuestMoney,GuestNumber,GuestName,Remark) 3
{ 4
//计算余额 5
var balance = GuestMoney - TypePrice; 6
Ext.QuickTips.init(); 7
Ext.form.Field.prototype.msgTarget = 'side'; 8
var closeRoom = new Ext.FormPanel 9
( 10
{ 11
labelWidth:75, 12
frame : true, 13
title : '退房清单', 14
width : 260, 15
waitMsgTarget : true, 16
items: 17
[ 18
new Ext.form.TextField 19
( 20
{ 21
fieldLabel: '房间号', 22
name: 'RoomNumber', 23
allowBlank:false, 24
value: RoomNumber 25
} 26
), 27
new Ext.form.TextField 28
( 29
{ 30
fieldLabel: '房间类型', 31
name: 'RoomType', 32
allowBlank:false, 33
value: TypeName 34
} 35
), 36
new Ext.form.TextField 37
( 38
{ 39
fieldLabel: '登记姓名', 40
name: 'GuestName', 41
allowBlank:false, 42
value: GuestName 43
} 44
), 45
new Ext.form.TextField 46
( 47
{ 48
fieldLabel: '登记身份证', 49
name: 'GuestNumber', 50
allowBlank:false, 51
value: GuestNumber 52
} 53
), 54
new Ext.form.TextField 55
( 56
{ 57
fieldLabel: '开房时间', 58
name: 'OpenTime', 59
allowBlank:false, 60
value: OpenTime 61
} 62
), 63
new Ext.form.TextField 64
( 65
{ 66
fieldLabel: '预交金额', 67
name: 'BefarePrice', 68
allowBlank:false, 69
value: GuestMoney 70
} 71
), 72
new Ext.form.TextField 73
( 74
{ 75
fieldLabel: '找补金额', 76
name: 'ZhaoPrice', 77
allowBlank:false, 78
value: balance 79
} 80
) 81
], 82
buttons: 83
[ 84
{ 85
id:'btnOk', 86
text:'退 房', 87
handler:function() 88
{ 89
//如果验证合法 90
if (closeRoom.form.isValid()) 91
{ 92
//弹出效果 93
Ext.MessageBox.show 94
( 95
{ 96
msg: '正在执行退房,请稍等...', 97
progressText: 'Saving...', 98
width:300, 99
wait:true, 100
waitConfig: {interval:200}, 101
icon:'download', 102
animEl: 'saving' 103
} 104
); 105
setTimeout(function(){}, 10000); 106
//提交到服务器 107
closeRoom.form.submit 108
( 109
{ 110
url:'/HotelUI/Form/CloseRoom.aspx', //提交的页面路径 111
method:'post',//提交方式为post 112
//提交成功的回调函数 113
success:function(form,action) 114
{ 115
var flage = action.result.success; 116
//如果服务器端传过来的数据为true则表示登录成功 117
if (flage == true) 118
{ 119
Ext.MessageBox.alert('恭喜','退房成功!'); 120
storeMain.reload(); //重新加载Grid 121
newWin.hide(); 122
} 123
}, 124
//提交失败的回调函数 125
failure:function() 126
{ 127
Ext.Msg.alert('错误','服务器出现错误请稍后再试!'); 128
} 129
} 130
); 131
} 132
} 133
134
}, 135
{ 136
text:'取 消', 137
handler:function() 138
{ 139
newWin.hide(); 140
} 141
} 142
] 143
} 144
); 145
//定义窗体 146
newWin = new Ext.Window 147
( 148
{ 149
layout:'fit', 150
width:260, 151
height:300, 152
collapsible:true, //允许缩放条 153
closeAction : 'hide', 154
plain : true, 155
modal: 'true', 156
items : closeRoom 157
} 158
); 159
//显示窗体 160
newWin.show(); 161
162
} 163
164





}
}