shr.defineClass("shr.custom.CheckoutApplicationEdit", shr.framework.Edit, {
	initalizeDOM: function () {
		shr.custom.CheckoutApplicationEdit.superClass.initalizeDOM.call(this);
		var self = this;
		if ("VIEW" != this.operateState) {
			//设置可选入住人员信息，入住日期小于等于今天，退宿日期大于今天
			self.remoteCall({
				action: "getOptionalOccupants",
				uipk: this.uipk,
				type: 'POST',
				success: function (data) {
					$("#entrys_occupants").shrPromptBox("setFilter", "id in (" + data + ")");
				}
			});
			//入住人员信息
			$("#entrys_occupants").shrPromptBox("option", {
				//值改变值,获取任职信息
				onchange: function (e, value) {
					var occupants = value.current;
					$("#entrys_adminOrg").shrPromptBox("setValue", {
						id: occupants["personPosition.personDep.id"],
						name: occupants["personPosition.personDep.name"]
					});
					$("#entrys_position").shrPromptBox("setValue", {
						id: occupants["personPosition.primaryPosition.id"],
						name: occupants["personPosition.primaryPosition.name"]
					});
					$("#entrys_person").shrPromptBox("setValue", {
						id: occupants["personPosition.person.id"],
						name: occupants["personPosition.person.name"]
					});
					//入住日期
					$("#entrys_checkInDate").shrDateTimePicker("setValue", occupants.CheckInDate);
					//退宿日期
					$("#entrys_oldCheckoutDate").shrDateTimePicker("setValue", occupants.CheckOutDate);
					//现住房间
					$("#entrys_currentRoom").shrPromptBox("setValue", {
						id: occupants["Dormitory.id"],
						name: occupants["Dormitory.name"],
						displayName: occupants["Dormitory.displayName"]
					});
					$("#entrys_checkoutDate").shrDateTimePicker("setValue", null);
				},
			});
		}
		if ("0" == $("#billState").val()) {
			//未提交
			//隐藏流程图
			$('#workFlowDiagram').hide();
		}
	},
	/**
	 * 对保存、提交的数据进行确认
	 */
	verify: function () {
		// shr.showInfo({message: message});
		var checkInDate,checkoutDate,oldCheckoutDate;
		if ("VIEW" == this.operateState) {
			checkInDate = $("#entrys_checkInDate").val();
			checkoutDate = $("#entrys_checkoutDate").val();
			oldCheckoutDate = $("#entrys_oldCheckoutDate").val();
		} else {
			checkInDate = $("#entrys_checkInDate").shrDateTimePicker("getValue");
			checkoutDate = $("#entrys_checkoutDate").shrDateTimePicker("getValue");
			oldCheckoutDate = $("#entrys_oldCheckoutDate").shrDateTimePicker("getValue");
		}
		if (checkoutDate <= checkInDate) {
			shr.showWarning({
				message: "退宿日期不能小于等于入住日期",
				hideAfter: 5
			});
			return false;
		}
		if (checkoutDate == checkInDate) {
			shr.showWarning({
				message: "退宿日期不能等于原退宿日期",
				hideAfter: 5
			});
			return false;
		}
		return true;
	},

});