fcdc7fdc016a1893b153b7e98889b62d61796daf.svn-base 11.2 KB
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminRent.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/popupHeader.php" ?> 
<?
	$obj		= new AdminOperate($_REQUEST, "");
	$info		= $obj->getInfoOfEnd();
	
	$rurl		= pack("H*", $_REQUEST["rurl"]) ;
?>

<script type="text/javascript">
	var _rurl = "<?=$rurl?>";
	var _no = "<?=$_REQUEST[no]?>";

	function getTotal(){
		var totalValue = 0;
		
		totalValue += $("input[name='daily_fee']").val() == ""? 0: parseInt($("input[name='daily_fee']").val());
		totalValue += $("input[name='utility_fee']").val() == ""? 0: parseInt($("input[name='utility_fee']").val());
		totalValue += $("input[name='maintenance_fee']").val() == ""? 0: parseInt($("input[name='maintenance_fee']").val());
		totalValue += $("input[name='leaving_fee']").val() == ""? 0: parseInt($("input[name='leaving_fee']").val());
		totalValue += $("input[name='disposal_fee']").val() == ""? 0: parseInt($("input[name='disposal_fee']").val());
		totalValue += $("input[name='damage_fee_1']").val() == ""? 0: parseInt($("input[name='damage_fee_1']").val());
		totalValue += $("input[name='damage_fee_2']").val() == ""? 0: parseInt($("input[name='damage_fee_2']").val());
		totalValue += $("input[name='damage_fee_3']").val() == ""? 0: parseInt($("input[name='damage_fee_3']").val());
		totalValue += $("input[name='damage_fee_4']").val() == ""? 0: parseInt($("input[name='damage_fee_4']").val());
		totalValue += $("input[name='cancelation_fee']").val() == ""? 0: parseInt($("input[name='cancelation_fee']").val());
		
		$("#total").attr("value", totalValue); 
		var balance = <?=$info["balance"]?> == ""? 0 : parseInt(<?=$info["balance"]?>);
		balance -= $("input[name='subtraction_total']").val() == ""? 0: parseInt($("input[name='subtraction_total']").val());
		$("#balance").attr("value", balance);
	}

	function getUsage(){
		var totalEValue=$("input[name='electricity_usage']").val() == ""? 0: parseInt($("input[name='electricity_usage']").val());
		var totalGValue=$("input[name='gas_usage']").val() == ""? 0: parseInt($("input[name='gas_usage']").val());
		var totalWValue=$("input[name='water_usage']").val() == ""? 0: parseInt($("input[name='water_usage']").val());

		totalEValue -= $("input[name='electricity_usage_lm']").val() == ""? 0: parseInt($("input[name='electricity_usage_lm']").val());
		if($("input[name='electricity_usage_lm']").val() == ""){
			totalEValue=$("input[name='electricity_usage']").val() == ""? 0: parseInt($("input[name='electricity_usage']").val());
		}
		totalGValue -= $("input[name='gas_usage_lm']").val() == ""? 0: parseInt($("input[name='gas_usage_lm']").val());
		if($("input[name='gas_usage_lm']").val() == ""){
			totalGValue=$("input[name='gas_usage']").val() == ""? 0: parseInt($("input[name='gas_usage']").val());
		}
		totalWValue -= $("input[name='water_usage_lm']").val() == ""? 0: parseInt($("input[name='water_usage_lm']").val());
		if($("input[name='water_usage_lm']").val() == ""){
			totalWValue=$("input[name='water_usage']").val() == ""? 0: parseInt($("input[name='water_usage']").val());
		}
		
		$("#elec_total_usage").attr("value", totalEValue);
		$("#gas_total_usage").attr("value", totalGValue);
		$("#water_total_usage").attr("value", totalWValue);
	}

	
	$(document).ready(function(){
		
		getUsage();
		getTotal();
		//=====프레입웤 변수들==================================================================================//
		var FORM_TARGET_CLS_NM		= ".data"	;		// 폼을 동적 wrap 할 타겟 ID이름
		var FORM_NAME				= "alf"		;		// 폼이름
		var FORM_METHOD				= "POST"		;		// 폼 메쏘드
		var FORM_USE_FILE			= false		;		// 파일폼 사용 여부
		var FORM_ACTION				= "/action_front.php" ; 
		
		
		var NEXT_CMD				= ""		;		// 다은 수행 할 cmd
		//=====================================================================================================//

		var jForm = $(FORM_TARGET_CLS_NM).mf({ "name" : FORM_NAME , "method" : FORM_METHOD , "action" : FORM_ACTION , "useFile" : FORM_USE_FILE }) ;

		$(".jCancel").click2(function(){
			location.href = _rurl;
		});

		$(".jClose").click2(function(){
			window.close();
		});
		

		$(".jSend").click2(function(){

			var data = $("#jData").serialize();

			$.ajax({
				url : "/action_front.php?cmd=AdminOperate.saveEnd",
				async : false,
				cache : false,
				dataType : "json",
				data : data,
				success : function(data){
					var room_fk=<?=$_REQUEST["no"]?>;
					if(confirm("전송하시겠습니까?"))
					{
					$.ajax({
						url : "/action_front.php?cmd=AdminPush.sendPushForBillSend",
						async : true,
						cache : false,
						dataType : "json",
						data : {
							"room_fk"	: room_fk
						},
						success : function(data){
							alert(data.returnMessage);
							window.opener.location.reload();
							window.close();
						},
						error:function(request,status,error){
						    alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
							location.reload();
						}
					});
					}
					
				}
			});
			
		});

		$(".wb").change(function(e){
			getTotal();
			});

		$(".ws").change(function(e){
			getUsage();
			});
	}) ;

</script>

<div id="Contents" style="width:700px;">

	<p style="margin-bottom:5px;">(<?=$info["Rname"]?> 호) <?=$info["contractor_name"]?> 귀하</p>
	<p style="margin-bottom:5px;">정산날짜 : <?=$info["leaving_y"]?>년 <?=$info["leaving_m"]?>월 <?=$info["leaving_d"]?>일</p>
	
	<div class="data" style="width:100%;">
		
		<form id="jData">
		<input type="hidden" name="no" value="<?=$_REQUEST[no]?>" />
		<input type="hidden" name="key" value="<?=$_REQUEST["key"]?>" />
		<input type="hidden" name="user_fk" value="<?=$info["user_fk"]?>" />
		<input type="hidden" name="month" value="<?=$info["leaving_y"]."-".$info["leaving_m"]."-".$info["leaving_d"]?>" />
		<table class="datav" style="width:100%;">
			<colgroup>
				<col width="30%" />
				<col width="25%" />
				<col width="25%" />
				<col width="25%" />
			</colgroup>
			<thead>
				<tr>
					<th style="height:25px;">내역</th>
					<th style="height:25px;">예치금총액</th>
					<th style="height:25px;">차감액</th>
					<th style="height:25px;">잔액</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<th style="height:25px;">예치금 혹은 보증금</th>
					<!-- 예치금총액 -->
					<td>
						<input type="text" class="ws" value="<?=$info["balance"]?>" readonly />
					</td>
					
					<!-- 차감액 -->
					<td>
						<input type="text" name="subtraction_total" id="total" class="ws" value="<?=$info["subtraction_total"]?>" readonly/>
					</td>
					
					<!-- 잔액 -->
					<td>
						<input type="text" name="balance" id="balance" class="ws" value="<?=$info["Ebalance"]?>" readonly/>
					</td>
				</tr>
			</tbody>
		</table>
		
		<p style="margin-top:20px;">차감 세부내용</p>
		<table class="datav" style="width:100%;margin-top:10px;">
			<colgroup>
				<col width="20%" />
				<col width="30%" />
				<col width="20%" />
				<col width="30%" />
			</colgroup>
			<tr>
				<!-- 일사용료 -->
				<th style="height:25px;">일사용료</th>
				<td class="center">
					<input type="text" name="daily_fee" class="wb" value="<?=$info["daily_fee"]?>" />
				</td>
				
				<!-- 파손비1 -->
				<th style="height:25px;">파손비1</th>
				<td class="center">
					<input type="text" name="damage_fee_1" class="wb" value="<?=$info["damage_fee_1"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 공과금 -->
				<th style="height:25px;">공과금</th>
				<td class="center">
					<input type="text" name="utility_fee" class="wb" value="<?=$info["utility_fee"]?>" />
				</td>
				
				<!-- 파손비2 -->
				<th style="height:25px;">파손비2</th>
				<td class="center">
					<input type="text" name="damage_fee_2" class="wb" value="<?=$info["damage_fee_2"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 관리비 -->
				<th style="height:25px;">관리비</th>
				<td class="center">
					<input type="text" name="maintenance_fee" class="wb" value="<?=$info["maintenance_fee"]?>" />
				</td>
				
				<!-- 파손비3 -->
				<th style="height:25px;">파손비3</th>
				<td class="center">
					<input type="text" name="damage_fee_3" class="wb" value="<?=$info["damage_fee_3"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 퇴실비 -->
				<th style="height:25px;">퇴실비</th>
				<td class="center">
					<input type="text" name="leaving_fee" class="wb" value="<?=$info["leaving_fee"]?>" />
				</td>
				
				<!-- 파손비4 -->
				<th style="height:25px;">파손비4</th>
				<td class="center">
					<input type="text" name="damage_fee_4" class="wb" value="<?=$info["damage_fee_4"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 폐기물비 -->
				<th style="height:25px;">폐기물비</th>
				<td class="center">
					<input type="text" name="disposal_fee" class="wb" value="<?=$info["disposal_fee"]?>" />
				</td>
				
				<!-- 위약금 -->
				<th style="height:25px;">위약금</th>
				<td class="center">
					<input type="text" name="cancelation_fee" class="wb" value="<?=$info["cancelation_fee"]?>" />
				</td>
			</tr>
		</table>
		
		<p style="margin-top:20px;">공과금 내역</p>
		<table class="datav" style="width:75%;margin-top:10px;">
			<colgroup>
				<col width="20%" />
				<col width="30%" />
				<col width="20%" />
				<col width="30%" />
			</colgroup>
			<thead>
				<!-- 항목 제목 -->
				<tr>
					<th style="height:25px;">항목</th>
					<th style="height:25px;">전월</th>
					<th style="height:25px;">당월</th>
					<th style="height:25px;">사용량</th>
				</tr>
			</thead>
			<tbody>
				<!-- 전기 -->
				<tr>
					<th style="height:25px;">전기</th>
					<td class="center">
						<input type="text" name="electricity_usage_lm" class="ws" value="<?=$info["electricity_usage_lm"]?>">
					</td>
					<td class="center"> 
						<input type="text" name="electricity_usage" class="ws" value="<?=$info["electricity_usage"]?>">
					</td>
					<td class="center">
						<input type="text" name="electricity_total_usage" id="elec_total_usage" class="ws" readonly />
					</td>
				</tr>
				
				<!-- 가스 -->
				<tr>
					<th style="height:25px;">가스</th>
					<td class="center">
						<input type="text" name="gas_usage_lm" class="ws" value="<?=$info["gas_usage_lm"]?>">
					</td>
					<td class="center">
						<input type="text" name="gas_usage" class="ws" value="<?=$info["gas_usage"]?>">
					</td>
					<td class="center">
						<input type="text" name="gas_total_usage" id="gas_total_usage" class="ws"  readonly/>
					</td>
				</tr>
				
				<!-- 수도 -->
				<tr>
					<th style="height:25px;">수도</th>
					<td class="center">
						<input type="text" name="water_usage_lm" class="ws" value="<?=$info["water_usage_lm"]?>">
					</td>
					<td class="center">
						<input type="text" name="water_usage" class="ws" value="<?=$info["water_usage"]?>">
					</td>
					<td class="center">
						<input type="text" name="water_total_usage" id="water_total_usage" class="ws"  readonly/>
					</td>
				</tr>
			</tbody>
		</table>
		</form>

		<div class="btngroupcenter">
			<span class="button bigrounded blue jSend">확인 발송</span>
			<?if($_REQUEST["key"] == ""){?>
			<span class="button bigrounded blue jClose">닫기</span>
			<?}else{?>
			<span class="button bigrounded blue jCancel">닫기</span>
			<?}?>
		</div>

	</div>
</div>