billMonthSend.php 7.78 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->getInfoOfRent();
	$lm_info	= $obj->getInfoOfLMRent();
	
	$rurl		= pack("H*", $_REQUEST["rurl"]) ;
?>

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

	function getTotal(){
		var totalValue = 0;

		totalValue += $("input[name='maintenance_fee']").val() == ""? 0: parseInt($("input[name='maintenance_fee']").val());
		totalValue += $("input[name='internet']").val() == ""? 0: parseInt($("input[name='internet']").val());
		totalValue += $("input[name='cable']").val() == ""? 0: parseInt($("input[name='cable']").val());
		totalValue += $("input[name='rent_1']").val() == ""? 0: parseInt($("input[name='rent_1']").val());
		totalValue += $("input[name='rent_2']").val() == ""? 0: parseInt($("input[name='rent_2']").val());
		totalValue += $("input[name='etc']").val() == ""? 0: parseInt($("input[name='etc']").val());
		totalValue += $("input[name='monthly_rent']").val() == ""? 0: parseInt($("input[name='monthly_rent']").val());
		
		$("#total").attr("value", totalValue); 
		$("#total2").attr("value", totalValue);
	}

	function getSummationA(){
		var sumA;
		sumA=$("input[id='sum_before_payment']").val() == ""? 0: parseInt($("input[id='sum_before_payment']").val());
		sumA+=$("input[id='current_month_late_fee']").val() == ""? 0: parseInt($("input[id='current_month_late_fee']").val());
		$("#sum_after_payment").attr("value", sumA);		//납기후
		
	}

	function getSummationB(){
		var sumB=$("input[id='unpaid']").val() == ""? 0: parseInt($("input[id='unpaid']").val());
		
		sumB+=$("input[id='total']").val() == ""? 0: parseInt($("input[id='total']").val());
		$("#sum_before_payment").attr("value", sumB);		//납기내
	}
	$(document).ready(function(){

		getTotal();
		getSummationB();
		getSummationA();
		//=====프레입웤 변수들==================================================================================//
		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 }) ;

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

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

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

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

			$.ajax({
				url : "/action_front.php?cmd=AdminOperate.saveRent",
				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){
			e.preventDefault();
			getTotal();
			getSummationB();
			getSummationA();
			});

	}) ;

</script>

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

	<div>
		<span class="btnleft_y">납부기한 : <?=date("Y")?><?=date("m")?><?=date("d", $info["monthly_rent_date"])?>일까지</span>
		<span class="btnright_y"><?=$info["Bname"]?> <?=$info["name"]?></span>
	</div>
	
	<div class="data" style="width:100%;">
		
		<form id="jData">
		<input type="hidden" name="key" value="<?=$_REQUEST[key]?>" />
		<input type="hidden" name="no" value="<?=$_REQUEST[no]?>" />
		<input type="hidden" name="month" value=" <?=date("m")."-".date("d", $info["monthly_rent_date"])?>" />
		<input type="hidden" name="monthly_rent_date" value="<?=$info["monthly_rent_date"]?>" />
		<table class="datav" style="width:100%;">
			<colgroup>
				<col width="25%" />
				<col width="75%" />
			</colgroup>
			<tr>
				<!-- 일반관리 -->
				<th style="height:25px;">일반관리</th>
				<td class="center">
					<input type="text" name="maintenance_fee" class="wb" value="<?=$info["maintenance_fee"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 인터넷 -->
				<th style="height:25px;">인터넷</th>
				<td class="center">
					<input type="text" name="internet" class="wb" value="<?=$info["internet"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 케이블 -->
				<th style="height:25px;">케이블</th>
				<td class="center">
					<input type="text" name="cable" class="wb" value="<?=$info["cable"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 렌트1 -->
				<th style="height:25px;">렌트1</th>
				<td class="center">
					<input type="text" name="rent_1" class="wb" value="<?=$info["rent_1"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 렌트2 -->
				<th style="height:25px;">렌트2</th>
				<td class="center">
					<input type="text" name="rent_2" class="wb" value="<?=$info["rent_2"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 기타 -->
				<th style="height:25px;">기타</th>
				<td class="center">
					<input type="text" name="etc" class="wb" value="<?=$info["etc"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 월세 -->
				<th style="height:25px;">월세</th>
				<td class="center">
					<input type="text" name="monthly_rent" class="wb" value="<?=$info["monthly_rent"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 소계 -->
				<th style="height:25px;">소계</th>
				<td class="center">
					<input type="text" name="name" id="total" class="wb" value=""  readonly/>
				</td>
			</tr>
		</table>
		
		<table class="datav" style="width:100%; margin-top:20px;">
			<colgroup>
				<col width="25%" />
				<col width="75%" />
			</colgroup>
			<tr>
				<!-- 당월부과액 -->
				<th style="height:25px;">당월부과액</th>
				<td class="center">
					<input type="text" name="current_month_charge" id="total2" class="wb" value="" readonly />
				</td>
			</tr>
			<tr>
				<!-- 전월미납액 -->
				<th style="height:25px;">전월미납액</th>
				<td class="center">
					<input type="text" name="name" id="unpaid" class="wb" value="<?=$lm_info["sum_after_payment"]?>" readonly />
				</td>
			</tr>
			<tr>
				<!-- 납기 내 금액 -->
				<th style="height:25px;">납기 내 금액</th>
				<td class="center">
					<input type="text" name="name" class="wb" id="sum_before_payment" value="" readonly />
				</td>
			</tr>
			<tr>
				<!-- 당월연체료 -->
				<th style="height:25px;">당월연체료</th>
				<td class="center">
					<input type="text" name="current_month_late_fee" id="current_month_late_fee" class="wb" value="<?=$info["current_month_late_fee"]?>" />
				</td>
			</tr>
			<tr>
				<!-- 납기 후 금액 -->
				<th style="height:25px;">납기 후 금액</th>
				<td class="center">
					<input type="text" name="sum_after_payment" id="sum_after_payment" class="wb" value="" readonly />
				</td>
			</tr>
		</table>
		</form>

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

	</div>
</div>