<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="IDC/js/setToken.js"></script>

<script>
function additionalService(sc){		
	//alert("service_code : " + sc);	
	if(sc != undefined && sc != null) {
		//location.replace("additionalService.sev?service_code="+sc);
		window.location = "additionalService.sev?service_code="+sc;
		
	}else{
		alert("고객을 선택해주세요");
	}
}

function addVPC(sc){		
	if(sc != undefined && sc != null) {			
		//location.replace("addVPC.sev?service_code="+sc);
		window.location = "addVPC.sev?service_code="+sc;
	}else{
		alert("고객을 선택해주세요");
	}
}

function addKCS(sc){
	if(sc != undefined && sc != null) {			
		//location.replace("addKCS.sev?service_code="+sc);
		window.location = "addKCS.sev?service_code="+sc;
	}else{
		alert("고객을 선택해주세요");
	}
}

function addDeffence1(sc, cc){
	//location.replace("addDeffence1.sev?service_code="+sc+"&client_code="+cc);
	window.location = "addDeffence1.sev?service_code="+sc+"&client_code="+cc;
}

function deleteService(service_code, client_code, server_code){
	window.location = "deleteServiceHandle.sev?service_code="+service_code+"&client_code="+client_code+"&server_code="+server_code;    	
}


$(function(){

	$(document).on("click",".myVpn",function()
	{
		var data = $(this).parents("b").find("[type=hidden]");
		$("#vservice_status").val($(data[0]).val());
		$("#vservice_code").val($(data[1]).val());
		$("#vserver_code").val($(data[2]).val());
		$("#vservice_ip").val($(data[3]).val());
		$("#vservice_amount").val($(data[4]).val());
		$("#vservice_payment_date").val($(data[5]).val());
	});
	
	$(document).on("click", ".aid", function(){
		
		var td1 = $(this).children();
		var td2 = td1.next();
		var td3 = td2.next(); 
		var td4 = td3.next();
		var td5 = td4.next();
		var td6 = td5.next();
		var td7 = td6.next();
		var td8 = td7.next();
		var td9 = td8.next();
		var td10 = td9.next();
		var td11 = td10.next();
		var td12 = td11.next();
		var td13 = td12.next();
		var td14 = td13.next();
		var td15 = td14.next();
		var td16 = td15.next();
		var td17 = td16.next();
		var td18 = td17.next();
		var td19 = td18.next();
		var td20 = td19.next();
		var td21 = td20.next();
		var td22 = td21.next();
		var td23 = td22.next();
		var td24 = td23.next();
		var td25 = td24.next();
		var td26 = td25.next();				
		var td27 = td26.next();
		var td28 = td27.next();
		var td29 = td28.next();
		var td30 = td29.next();
		var td31 = td30.next();
		var td32 = td31.next();
		var td33 = td32.next();
		var td34 = td33.next();
		var td35 = td34.next();
		var td36 = td35.next();
		var td37 = td36.next();
		var td38 = td37.next();
		var td39 = td38.next();
		var td40 = td39.next();
		var td41 = td40.next();
		var td42 = td41.next();
		//장비
		var td43 = td42.next();
		var td44 = td43.next();
		var td45 = td44.next();
		var td46 = td45.next();
		var td47 = td46.next();
		var td48 = td47.next();
		var td49 = td48.next();
		var td50 = td49.next();
		var td51 = td50.next();
		var td52 = td51.next();
		
		var service_code = td1.val();
		var service_status = td2.val();
		var client_code = td3.val();
		var service_line = td4.val();
		var server_code = td5.val();
		var service_sw = td6.val();
		var service_os = td7.val();
		var service_ip = td8.val();
		var service_request_date = td9.val();
		var service_open_date = td10.val();
		var service_payment_date = td11.val();
		var amount_rack = td12.val();
		var amount_line = td13.val();
		var amount_cpu = td14.val();
		var service_defence = td15.val();
		var amount_reseller = td16.val();
		var last_long = td17.val();
		var last_pre = td18.val();
		var amount_authority = td19.val();
		var amount_contact = td20.val();
		var amount_total_discount = td21.val();
		var amount_cost = td22.val();
		var service_cost = td23.val();
		var service_amount = td24.val();
		var mo_note = td25.val();
		var add_amount = parseInt(service_amount||0) - parseInt(service_cost||0);
		var amount_defence = td26.val();
		var server_process = td27.val();
		var server_spec = td28.val();
		var server_cpuname = td29.val();
		var server_ram = td30.val();
		var server_hdd = td31.val();
		var server_location = td32.val();
		var ip_total = td33.val();
		var cs_total = td34.val();
		var kcs_total = td35.val();
		var service_deduction = td36.val();
		var service_united = td37.val();
		var service_nonAmount = td38.val();
		var defence_discount = td39.val();
		var amount_sub_discount = td40.val();
		var amount_one = td41.val();
		var amount_etc = td42.val();
		
		var server_ram1 = td43.val();
		var server_ram2 = td44.val();
		var server_ram3 = td45.val();
		var server_ram4 = td46.val();
		var server_ram5 = td47.val();	
		var server_hdd1 = td48.val();
		var server_hdd2 = td49.val();
		var server_hdd3 = td50.val();
		var server_hdd4 = td51.val();
		var server_hdd5 = td52.val();
		
		$("#service_status").val(service_status);
		$("#client_code").val(client_code);
		$("#service_code").val(service_code);				
		$("#service_line").val(service_line);		
		$("#server_code").val(server_code);
		$("#service_sw").val(service_sw);
		$("#service_os").val(service_os);
		$("#service_ip").val(service_ip);
		$("#service_os").val(service_os);
		$("#service_request_date").val(service_request_date);
		$("#service_open_date").val(service_open_date);
		$("#service_payment_date").val(service_payment_date);
		$("#amount_rack").val(amount_rack);
		$("#amount_line").val(amount_line);
		$("#amount_cpu").val(amount_cpu);
		
		if(service_defence=="x")
			service_defence="없음";
		else if(service_defence=="normal")
			service_defence="일반";
		else if(service_defence=="ordinary")
			service_defence="상시";
		else 
			service_defence="cs-pre";
		
		$("#service_defence").val(service_defence);
		$("#amount_reseller").val(amount_reseller);
		$("#last_long").val(last_long);
		$("#last_pre").val(last_pre);
		$("#amount_authority").val(amount_authority);
		$("#amount_contact").val(amount_contact);
		$("#amount_total_discount").val(amount_total_discount);
		$("#amount_cost").val(amount_cost);
		$("#service_cost").val(service_cost);
		$("#service_amount").val(service_amount);
		$("#mo_note").val(mo_note);
		//$("#add_amount").val(add_amount);
		$("#amount_defence").val(amount_defence);
		$("#server_process").val(server_process);
		$("#server_spec").val(server_spec);
		$("#server_cpuname").val(server_cpuname);
		$("#server_ram").val(server_ram);
		$("#server_hdd").val(server_hdd);
		$("#server_location").val(server_location);
		$("#ip_total").val(ip_total);
		$("#cs_total").val(cs_total);
		$("#kcs_total").val(kcs_total);		
		$("#service_deduction").val(service_deduction);
		$("#service_united").val(service_united);
		$("#service_nonAmount").val(service_nonAmount);
		$("#defence_discount").val(defence_discount);
		$("#amount_sub_discount").val(amount_sub_discount);
		$("#amount_one").val(amount_one);
		$("#amount_etc").val(amount_etc);
		
		$("#server_ram1").val(server_ram1);
		$("#server_ram2").val(server_ram2);
		$("#server_ram3").val(server_ram3);
		$("#server_ram4").val(server_ram4);
		$("#server_ram5").val(server_ram5);
		
		$("#server_hdd1").val(server_hdd1);
		$("#server_hdd2").val(server_hdd2);
		$("#server_hdd3").val(server_hdd3);
		$("#server_hdd4").val(server_hdd4);
		$("#server_hdd5").val(server_hdd5);		
		
		$('.money1').mask('000,000,000,000,000,000', {reverse: true});
	});
	
	//장비관련 변경 사항시 서비스 가격계산
	$(".service_accounting").change(function(){
		calc();						
	});
	
	//장비관련 서비스 가격계산
	function calc(){
		var amount_line = parseInt($("#amount_line").val()||0);
		var amount_rack =parseInt($("#amount_rack").val()||0);
		var amount_cpu = parseInt($("#amount_cpu").val()||0);
		var amount_defence = parseInt($("#amount_defence").val()||0);
		var amount_reseller = parseInt($("#amount_reseller").val()||0);
		var last_long = parseInt($("#last_long").val()||0);
		var last_pre = parseInt($("#last_pre").val()||0);
		var amount_authority = parseInt($("#amount_authority").val()||0);
		var amount_contact = parseInt($("#amount_contact").val()||0);
		//var amount_total_discount = parseInt($("#amount_total_discount").val()||0);
		var amount_cost = parseInt($("#amount_cost").val()||0);		
		var service_cost = parseInt($("#service_cost").val()||0);
		var service_amount = parseInt($("#service_amount").val()||0);		
		var add_amount = $("#add_amount").val();
		var ip_total = parseInt($("#ip_total").val()||0);
		var cs_total = parseInt($("#cs_total").val()||0);
		var kcs_total = parseInt($("#kcs_total").val()||0);
		var sub_discount = parseInt($("#amount_sub_discount").val()||0);
		var amount_one = parseInt($("#amount_one").val()||0);
		var amount_etc = parseInt($("#amount_etc").val()||0);
		//alert("amunt_etc " + amount_etc);
		
		//전체금액
		var temp=(amount_rack + amount_line + amount_cpu - amount_authority - amount_contact);
		var cost_price = temp + ip_total + cs_total+amount_one+amount_defence+amount_etc;
		var first_dis = 0, second_dis=0;
		if(amount_reseller==0)
			first_dis = temp * last_long / 100;
		else
			first_dis = temp * amount_reseller / 100;
		temp2 = temp-first_dis;
		second_dis = temp2 * last_pre/100;
		//전체 할인금액
		var amount_total_discount = Math.ceil((first_dis+second_dis)/1000)*1000;
		
		//할인된 서비스 금액
		var calc_service = temp - amount_total_discount-sub_discount;

		//전체 금액
		var service_amount = cost_price - amount_total_discount - sub_discount;
		
		$("#service_cost").val(calc_service);
		$("#service_amount").val(service_amount);
		$("#amount_total_discount").val(amount_total_discount);
		$("#defence_discount").val(defence_discount);
		//계산식
//		var cost_price = amount_rack + amount_line + amount_cpu + amount_ip + amount_cs+amount_defence;
//		var service_cost = (amount_rack + amount_line + amount_cpu - amount_authority - amount_contact) * (1-(last_pre + amount_reseller + last_long)/100);
//		var defence_discount = amount_defence-(amount_defence * (1-(last_pre + amount_reseller + last_long)/100));
//		var service_calc =  service_cost + amount_ip + amount_cs+amount_defence-defence_discount;
//		service_calc = Math.round(service_calc);
//		document.getElementById("amount_total_discount").value = (cost_price - service_calc);
//		document.getElementById("amount_cost").value = cost_price;
//		document.getElementById("service_amount").value = service_calc;
//		document.getElementById("service_cost").value = service_cost;
//		document.getElementById("defence_discount").value=defence_discount;
	}
	
	//할인 금액이 서버 원가보다 크지 못하게 처리
	$(".validateDiscount").change(function(){
		
		var amount_authority = parseInt($("#amount_authority").val()||0);
		var amount_contact = parseInt($("#amount_contact").val()||0);			
		var service_cost = parseInt($("#service_cost").val()||0);
		var service_amount = parseInt($("#service_amount").val()||0);
			
		//alert("amount_authority " + amount_authority + " amount_contact " + amount_contact + " service_cost " + service_cost);	
		if(service_amount < 0){
			alert("총 할인 금액이 서버 금액 보다 클 수 없습니다.");
			document.getElementById("amount_authority").value = "0";
			document.getElementById("amount_contact").value = "0";
			calc();
		}
	});
	
	$(".validateDeduction").change(function(){
		var service_cost = parseInt($("#service_cost").val()||0);
		var service_deduction = parseInt($("#service_deduction").val()||0);
						
		if( service_deduction > service_cost){
			alert("일할 과금 금액이 서버 금액 보다 클 수 없습니다.");
			document.getElementById("service_deduction").value = "0";
		}
	});	
		
	$("#amount_defence").change(function(){
		//alert("amount_defence : change");		
	});
	
	//방어 선택시 가격 적용
	$("#service_defence").change(function(){		
		var selectedObj = $(this).val();
		if(selectedObj == "x") $("#amount_defence").val("0");
		if(selectedObj == "normal") $("#amount_defence").val("400000");
		if(selectedObj == "ordinary") $("#amount_defence").val("2000000");
		if(selectedObj == "cs-pre") $("#amount_defence").val("3000000");
		
		calc();
	});
	
	//결제내역
	$(document).on("click", ".amount_a", function(){	
				 		
		var td1 = $(this).children();
		var td2 = td1.next();
		var td3 = td2.next(); 
		var td4 = td3.next();
		var td5 = td4.next();
		var td6 = td5.next();
		var td7 = td6.next();
		var td8 = td7.next();
		var td9 = td8.next();
		var td10 = td9.next();
		var td11 = td10.next();
		var td12 = td11.next();
		var td13 = td12.next();
		var td14 = td13.next();
		var td15 = td14.next();
		var td16 = td15.next();
		var td17 = td16.next();
		var td18 = td17.next();
		var td19 = td18.next();
		var td20 = td19.next();
		var td21 = td20.next();
		var td22 = td21.next();
		var td23 = td22.next();
		var td24 = td23.next();
		var td25 = td24.next();
		var td26 = td25.next();
		var td27 = td26.next();
		var td28 = td27.next();
		var td29 = td28.next();
		
		var service_code = td2.val();		
		var client_code = td3.val();
		var amount_line = td4.val();
		var amount_rack = td5.val();			
		var amount_cpu = td6.val();
		var ip_total = td7.val();
		var cs_total = td8.val();
		var amount_defence = td9.val();
		var amount_reseller = td10.val();
		var last_long = td11.val();
		var last_pre = td12.val();
		var amount_authority = td13.val();
		var amount_contact = td14.val();
		var amount_total_discount = td15.val();
		var service_amount = td16.val();		
		var service_request_date = td17.val();
		var service_open_date = td18.val();		
		var service_payment_date = td19.val();
		var service_cost = td20.val();
		var kcs_total = td21.val();
		var amount_note = td22.val();
		var service_deduction = td23.val();
		var service_united = td24.val();
		var service_nonAmount = td25.val();
		var service_defence_discount = td26.val();
		var service_sub_discount = td27.val();
		var amount_one = td28.val();
		var amount_etc = td29.val();
		
		$("#mo_service_code").val(service_code);
		$("#mo_client_code").val(client_code);
		$("#mo_amount_rack").val(amount_rack);				
		$("#mo_amount_line").val(amount_line);		
		$("#mo_amount_cpu").val(amount_cpu);
		$("#mo_amount_ip").val(ip_total);
		$("#mo_amount_cs").val(cs_total);
		$("#mo_amount_kcs").val(kcs_total);
		$("#mo_amount_defence").val(amount_defence);
		$("#mo_amount_reseller").val(amount_reseller);
		$("#mo_last_long").val(last_long);
		$("#mo_last_pre").val(last_pre);
		$("#mo_amount_authority").val(amount_authority);
		$("#mo_amount_contact").val(amount_contact);
		$("#mo_amount_total_discount").val(amount_total_discount);
		$("#mo_service_amount").val(service_amount);
		$("#mo_service_cost").val(service_cost);
		$("#mo_service_request_date").val(service_request_date);
		$("#mo_service_open_date").val(service_open_date);
		$("#mo_service_payment_date").val(service_payment_date);
		$("#mo_amount_note").val(amount_note);
		$("#mo_service_deduction").val(service_deduction);
		$("#mo_service_united").val(service_united);
		$("#mo_service_nonAmount").val(service_nonAmount);
		$("#mo_amount_sub_discount").val(service_sub_discount);
		$("#mo_amount_one").val(amount_one);
		$("#mo_amount_etc").val(amount_etc);
	});
	
	//결제내역 관련 계산
	function amount_calc(){
		
		var amount_line = parseInt($("#mo_amount_line").val()||0);
		var amount_rack =parseInt($("#mo_amount_rack").val()||0);
		var amount_cpu = parseInt($("#mo_amount_cpu").val()||0);
		var ip_total = parseInt($("#mo_amount_ip").val()||0);
		var cs_total = parseInt($("#mo_amount_cs").val()||0);
		var kcs_total = parseInt($("#mo_amount_kcs").val()||0);		
		var amount_defence = parseInt($("#mo_amount_defence").val()||0);
		var amount_reseller = parseInt($("#mo_amount_reseller").val()||0);
		var last_long = parseInt($("#mo_last_long").val()||0);
		var last_pre = parseInt($("#mo_last_pre").val()||0);
		var amount_authority = parseInt($("#mo_amount_authority").val()||0);
		var amount_contact = parseInt($("#mo_amount_contact").val()||0);
		var amount_total_discount = parseInt($("#mo_amount_total_discount").val()||0);						
		var service_cost = parseInt($("#service_cost").val()||0);				
		var service_sub_discount = parseInt($("#mo_amount_sub_discount").val()||0);						
		var amount_one = parseInt($("#mo_amount_one").val()||0);
		var amount_etc = parseInt($("#mo_amount_etc").val()||0);
		
		
		//전체금액
		var temp=(amount_rack + amount_line + amount_cpu - amount_authority - amount_contact);
		var cost_price = temp + ip_total + cs_total+amount_one+amount_defence+amount_etc;
		var first_dis = 0, second_dis=0;
		if(amount_reseller==0)
			first_dis = temp * last_long / 100;
		else
			first_dis = temp * amount_reseller / 100;
		temp2 = temp-first_dis;
		second_dis = temp2 * last_pre/100;
		//전체 할인금액
		var amount_total_discount = Math.ceil((first_dis+second_dis)/1000)*1000;
		
		//할인된 서비스 금액
		var calc_service = temp - amount_total_discount-service_sub_discount;

		//전체 금액
		var service_amount = cost_price - amount_total_discount - service_sub_discount;
		
		$("#mo_service_cost").val(service_cost);
		$("#mo_service_amount").val(service_amount);
		$("#mo_amount_total_discount").val(amount_total_discount);
	}
	
	//결제금액 관련 변경 사항시 서비스 가격계산
	$(".modal_accounting").change(function(){		
		amount_calc();						
	});
	
	//과금처리로 이동
	$(".accountingHandle_link").click(function(){
		var client_code = $(this).attr("client_code");
		window.location = "serviceAccounting.sev?client_code="+client_code;
		
	});
	
	//현재 페이지 에서 결제처리(사용 안함)
	$(".accountingHandle").click(function(){
		
		var client_code = $(this).attr("client_code");
		var service_code = $(this).attr("service_code");
		var client_money = $(this).attr("client_money");		
		var service_amount = $(this).attr("service_amount");
		var nonpayment = $(this).attr("nonpayment");
		
		var result = parseInt(client_money||0) - parseInt(nonpayment||0);
		
		if(nonpayment != "0"){
			
			if(parseInt(nonpayment||0) > 0){
				//alert("미납금이 있습니다.");
				window.location = "serviceAccounting.sev?client_code="+client_code;
			}
			
		}else{
			alert("미납 금액이 없습니다.");
			return false;
		}
		
		if(result < 0){			
			alert("예치금이 부족합니다.");
			return false;
		}else{
			window.location = "IdcServicePaymentUpdate.sev?client_code="+client_code+"&service_code="+service_code+"&service_amount="+service_amount + "&nonpayment="+nonpayment;
		}

	});
	
});

var tableToExcel = (function(){
	var uri = 'data:application/vnd.ms-excel;base64,'
	    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>'
	    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
	    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
	  return function(table, name) {
	    if (!table.nodeType) table = document.getElementById(table)
	    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
	    window.location.href = uri + base64(format(template, ctx))
	  }
})();

</script>

<!-- 내 스크립트 -->
<script type="text/javascript">
$(function()
{
	/*
	$.ajax(
	{
		url : "IdcHistoryList.jso",
		data : "client_name="+$("#client_name").html(),
		dataType : "json",
		type : "post",
		cache : false,
		success : function(data)
		{
			setHistory(data.a);
		},
		error : function()
		{
			alert("실패");
		}
	});
	*/
	//권한설정 2번
	$("#accountBtn").click(function()
	{
		if($("#p2").val()!="o")
		{
			alert("권한이 없습니다. 관리자에게 문의하세요.");
			return;
		}
			clickServiceAccounting();
	});
	
	//서비스 라인 변동시
	$("#service_line").change(function()
	{
		if($("#oldServiceLine").val()=="defence")
		{
			alert("방어서비스 해지 후 변경해주십시오.");
		}
		else if($(this).val()=="defence")
		{
			$(this).val($("#oldServiceLine").val());
			if($("#oldServiceLine").val()!="defence")
				alert("방어서비스는 부가서비스에서 추가하여 주십시오.");
		}
	});
});

var setHistory = function(a)
{
	var history = $("#historyBody");
	for(var i=0;i<a.length;i++) 
	{
		var tr = $("<tr>");
		var td1 = $("<td>");
		td1.html(a[i].behavior);
		var td2 = $("<td>");
		td2.html(a[i].server_code);
		var td3 = $("<td>");
		td3.html(a[i].behavior_case);
		var td4 = $("<td>");
		td4.html(a[i].strbehavior_date);
		var td5 = $("<td>");
		td5.html(a[i].note)
		tr.append(td1).append(td2).append(td3).append(td4).append(td5);
		history.append(tr);
	}
}
</script>

<script>
function clickServiceDefence(selectObj)
{
	
	//var amount_defence = document.getElementById("amount_defence").value;		
	if(selectObj.value == "x"){
		document.getElementById("amount_defence").value = "0";
		document.getElementById("service_line").value="normal";		
	}	
	if(selectObj.value == "normal"){
		document.getElementById("amount_defence").value = "400000";
		document.getElementById("service_line").value="defence";		
	}
	if(selectObj.value == "ordinary"){
		document.getElementById("amount_defence").value = "2000000";
		document.getElementById("service_line").value="defence";		
	}
	if(selectObj.value == "cs-pre"){
		document.getElementById("amount_defence").value = "3000000";
		document.getElementById("service_line").value="defence";		
	}	
}

//페이지 이동
function clickServiceRegistration(){	
	
	var selectedClient = document.getElementById("client_code").value;
	
	if(selectedClient != undefined && selectedClient != null && selectedClient != "") {
		window.location = "serviceWriteForm.sev?client_code="+selectedClient;
	}else{
		alert("고객을 선택해주세요");
	}	
}

function clickServiceAccounting(){
	//alert("나 serviceAccounting");
	var selectedClient = document.getElementById("client_code").value;
	
	if(selectedClient != undefined && selectedClient != null && selectedClient != "") {		
		//location.replace("serviceAccounting.sev?client_code="+client_code);
		window.location = "serviceAccounting.sev?client_code="+selectedClient;
		
	}else{
		alert("고객을 선택해주세요");
	}	
}

function clickInfoCS(){	
	window.location = "vpcInfo.sev";
	/*	
	var selectedClient = document.getElementById("selectedClient").value;
	if(selectedClient != undefined && selectedClient != null && selectedClient != "") {		
		window.location = "vpcInfo.sev?client_code="+selectedClient;
	}else{
		alert("고객을 선택해주세요");
	}	
	*/
}

function clickDeffenceInfo(){
	var selectedClient = document.getElementById("client_code").value;
	window.location = "deffenceInfo.sev?client_code="+selectedClient;
	
	/*
	var selectedClient = document.getElementById("selectedClient").value;
	if(selectedClient != undefined && selectedClient != null && selectedClient != "") {		
		window.location = "deffenceInfo.sev?client_code="+client_code;
	}else{
		alert("고객을 선택해주세요");
	}	
	*/
}



//입금등록
function clickRegisterAccounting(){
	var selectedClient = document.getElementById("client_code").value;
	if(selectedClient != undefined && selectedClient != null && selectedClient != "") {
		window.location = "IdcDepositForm.dep?client_code="+ selectedClient;		
	}else{
		alert("고객을 선택해주세요");
	}
}

//고객리스트 or 서비스 리스트 이동
function showView(selectedObj){
	if(selectedObj == "cList"){
		window.location = "serviceList.sev?view_state=clientList";
	}else if(selectedObj == "sList"){
		window.location = "serviceList.sev";
	}
}

$(function(){	

	/*
	$(".inputNote").click(function(){
		var td1 = $(this).parent().children();
		var client_code = $(this).attr("client_code");
		var service_code = $(this).attr("service_code");
								
		window.location = "IdcServiceNoteUpdate.sev?client_code="+client_code+"&service_code="+service_code+"&service_note="+td1.val();
	});
	*/
	
	$("#myDate").change(function()
	{
		var d = $("#myservice").val();
		var date = $("#myDate").val();
		$.ajax(
		{
			url:"IdcGetPaymentList.jso",
			data:"service_code="+d+"&from="+date,
			dataType:"json",
			cache:false,
			type:"get",
			success:function(data)
			{
				var tbody = $("#paymentList");
				tbody.empty();
				//var t = data.a;
				
				for(var i=0;i<data.length;i++)
				{
					var tr = $("<tr>");
					var td1 = $("<td>").html(data[i].name);
					var td2 = $("<td>").html(data[i].code);
					var td3 = $("<td>").html(data[i]._case + " - " + data[i].adddb_code);
					var td4 = $("<td>").html(data[i].sdate);
					var td5 = $("<td>").html(data[i].payment);
					tr.append(td1).append(td2).append(td3).append(td4).append(td5);
					tbody.append(tr);
				}
			},
			error:function()
			{
				alert("paymentList - 실패");
			}
		});
	});
	
	$(".payment").click(function()
	{
		var d = $(this).attr("value");
		$("#myservice").val(d);
		var date = $("#myDate").val();
		$.ajax(
		{
			url:"IdcGetPaymentList.jso",
			data:"service_code="+d,
			dataType:"json",
			cache:false,
			type:"get",
			success:function(data)
			{
				var tbody = $("#paymentList");
				tbody.empty();
				//var t = data.a;
				
				for(var i=0;i<data.length;i++)
				{
					var tr = $("<tr>");
					var td1 = $("<td>").html(data[i].name);
					var td2 = $("<td>").html(data[i].code).attr("id","dateid");
					var td3 = $("<td>").html(data[i]._case + " - " + data[i].adddb_code);
					var td4 = $("<td>").html(data[i].sdate);
					var td5 = $("<td>").html(data[i].payment);
					tr.append(td1).append(td2).append(td3).append(td4).append(td5);
					tbody.append(tr);
				}
			},
			error:function()
			{
				alert("paymentList - 실패");
			}
		});
	});
});


var tableToExcel = (function(){
	var uri = 'data:application/vnd.ms-excel;base64,'
	    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>'
	    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
	    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
	  return function(table, name) {
	    if (!table.nodeType) table = document.getElementById(table)
	    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
	    window.location.href = uri + base64(format(template, ctx))
	  }
})();

</script>

<style>
 	
@media screen and (max-width:900px) {
  	.modal1 .modal-body{
    max-width: 800px;
    overflow-x: auto;    
    
	}	
	#acoount_modal1{
		
		font-size:5px;
		padding:0px;
	}
	
	.mo_a{
		padding:0px;
		font-size:5px;
		
	}
}
</style>

<style>
	.info_table{text-align:center}
	.info_table th{font-size:12px; background-color:#efefef; text-align:center}
	.info_table td{font-size:17px; color:#0075CB}
	
	.info_table1 th{font-size:12px; background-color:#efefef; text-align:center}
	.info_table1 td{font-size:11px; color:#0075CB;}
	
	.pay_table{text-align:center}
	.pay_table th{font-size:12px; background-color:#FDF3FF; text-align:center}
	.pay_table td{font-size:17px; text-align:center}
	.des_pay{color:#4991FF}
	.all_pay{color:#67BD0E}
	.n_pay{color:#DF282B}
	.test{border:1px #FFE9E9 solid; background:#F0F2FF}
	.svinfo{border:1px #DDDDDD solid}
	.svinfo th{font-size:12px; padding:0; background-color:#F7F7F7; color:#A7A7A7; text-align:center;}
	.svinfo td{font-size:12px; padding:0; text-align:center}
	.svtitle{ border:1px #E0E0E0 solid; border-radius:10px}
	.svtitle_sub{ border-radius:5px 5px 0px 0px;}
	.svt_sm{font-size:10px; color:#8C8C8C}
	.sv_info_title{background-color:#F7F7F7; color:#A7A7A7;font-size:10px; padding:5px; border-radius:5px 5px 0px 0px; border:#d1d1d1 solid; border-width:1px 1px 0px 1px}
	.sv_info_content{color:#707070;font-size:12px; padding:5px; border-radius:0px 0px 5px 5px; border:#d1d1d1 solid; border-width:0px 1px 1px 1px; min-height:150px;}
	.cslist{padding:4px; border:1px #D3D3D3 solid; border-radius:5px;}
	.cslist_wrap{line-height:27px; text-align: justify;text-justify: inter-word;}
	.svpaytable{ font-size:12px;}
	.svdiv{ border:1px #d1d1d1 solid; border-radius:5px;}
			
	.money{
		text-align:center;
		border:none; width:100%;
		padding:0;			
	}
</style>

<style>

</style>
<script>
$(document).ready(function(){
	  $('.date').mask('00/00/0000');
	  $('.time').mask('00:00:00');
	  $('.date_time').mask('00/00/0000 00:00:00');
	  $('.cep').mask('00000-000');
	  $('.phone').mask('0000-0000');
	  $('.phone_with_ddd').mask('(00) 0000-0000');
	  $('.phone_us').mask('(000) 000-0000');
	  $('.mixed').mask('AAA 000-S0S');
	  $('.cpf').mask('000.000.000-00', {reverse: true});
	  $('.money').mask('000,000,000,000,000,000', {reverse: true});
	  $('.money1').mask('000,000,000,000,000,000', {reverse: true});
	  $('.money2').mask("#.##0,00", {reverse: true});	  	  
	  $('.ip_address').mask('0ZZ.0ZZ.0ZZ.0ZZ', {
	    translation: {
	      'Z': {
	        pattern: /[0-9]/, optional: true
	      }
	    }
	  });
	  $('.ip_address').mask('099.099.099.099');
	  $('.percent').mask('##0,00%', {reverse: true});
	  $('.clear-if-not-match').mask("00/00/0000", {clearIfNotMatch: true});
	  $('.placeholder').mask("00/00/0000", {placeholder: "__/__/____"});
	  $('.fallback').mask("00r00r0000", {
	      translation: {
	        'r': {
	          pattern: /[\/]/, 
	          fallback: '/'
	        }, 
	        placeholder: "__/__/____"
	      }
	    });
	  $('.selectonfocus').mask("00/00/0000", {selectOnFocus: true});
});
</script>
<!-- 개통 안내서 -->
<script type="text/javascript">
$(function()
{
	$("#bill").change(function()
	{
		var a=$(this).val();
		if(a!="")
			window.location="IdcServiceBillPaperForm.sev?&service_code="+a;
	});
	
	//권한이 없는 사람에게 안보이게
	if($("#p5").val() == "x"){
		$(".power5").hide();
	}
	
});
</script>
</head>
<body>	
	<input type="button" value="서비스 리스트" onclick="showView('sList')" class="btn btn-outline btn-default"/>
	<input type="button" value="고객 리스트" onclick="showView('cList')" class="btn btn-outline btn-default"/>	
	<input type="button" value="서비스 등록" onclick="clickServiceRegistration()" class="btn btn-outline btn-default"/>
	<c:if test="${member.power5 eq 'o'}">
		<input type="button" id="accountBtn" value="과금처리" class="btn btn-outline btn-default"/>
	</c:if>
	<input type="button" value="입금등록" onclick="clickRegisterAccounting()" class="btn btn-outline btn-default"/>
	<input type="button" value="CS정보"/ onclick="clickInfoCS()" class="btn btn-outline btn-default"/>
	<input type="button" value="방어라인정보"/ onclick="clickDeffenceInfo()" class="btn btn-outline btn-default"/>
	<select class="btn btn-outline btn-default" id="bill">
		<option value="">개통안내서</option>
		<c:forEach items="${detail}" var="dto">
			<option value="${dto.service_code }">${dto.service_code }</option>
		</c:forEach>
	</select>
	<a class="btn btn-outline btn-default"  onclick="tableToExcel('table','name')">엑셀</a>
	
      <div class="row">
        <div class="col-lg-12">
        	<div class="panel panel-default">
				<div class="panel-heading">
					<h4><i class="fa fa-desktop fa-fw"></i> 서비스 정보</h4>
				</div>          
          <input type=hidden id="token">
        
        <!-- /.col-lg-12 --> 
        
        <!-- 수정사항 시작 -->
        <div class="panel-body">
        <div class="col-lg-12">
          <div class="row" style="max-width:1200px; padding:10px; border-radius:10px; border:1px #c1c1c1 dotted; margin-top:5px; ">
            <div class="col-lg-2 col-md-3 col-xs-12" style="padding:3px">
              <h4><strong>${iusc.client_name}</strong></h4>
            </div>
            <!-- 사용정보 시작-->
            <div class="col-lg-2 col-md-2 col-xs-4" style="padding:3px">
              <table width="100%" border="0"align="left" class="table table-bordered table-condensed info_table" style="margin-bottom:0px" >
                <thead>
                  <tr>
                    <th>도쿄</th>
                    <th class=" ">치바</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>${iusc.client_tokyo_sum}</td>
                    <td>${iusc.client_chiba_sum}</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="col-lg-2 col-md-4 col-xs-5" style="padding:3px">
              <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-condensed info_table" style="margin-bottom:0px">
                <thead>
                  <tr>
                    <th>일반</th>
                    <th class=" ">방어</th>
                    <th class=" ">전용</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>${iusc.client_normal_sum}</td>
                    <td class=" ">${iusc.client_defence_sum}</td>
                    <td class=" ">${iusc.client_solo_sum}</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="col-lg-2 col-md-3 col-xs-3" style="padding:3px">
              <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-condensed info_table" style="margin-bottom:0px">
                <thead>
                  <tr>
                    <th>시험<br></th>
                    <th class=" ">대체</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>${iusc.client_test_sum}</td>
                    <td class=" ">${iusc.client_substitution}</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <!-- end 사용정보 -->
            <c:if test="${member.power5 eq 'o'}">
	            <div class="col-lg-4 col-md-12" style="padding:3px">
	              <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-condensed pay_table" style="margin-bottom:0px">
	                <thead>
	                  <tr>
	                    <th>예치금 </th>
	                    <th>전체요금</th>
	                    <th>미납금</th>
	                  </tr>
	                </thead>
	                <tbody>
	                  <tr>
	                    <td class="des_pay"><input type="text" size="8" value="${iusc.client_money}" class="money"  readonly="readonly" /></td>                                        
	                    <td class="all_pay"><input type="text" size="8" value="${iusc.client_total_amount}" class="money"  readonly="readonly" /></td>
	                    <td class="n_pay"><input type="text" size="8" value="${iusc.client_unpaid_amount}" class="money"  readonly="readonly" /></td>
	                  </tr>
	                </tbody>
              </table>
            </div>
            </c:if>
          </div>
        </div>
        <!-- 수정사항 끝 -->        
        <!-- 하단 상세정보내역-->
        <c:forEach items="${detail}" var="dto">
        
        <div class="col-lg-12 svtitle " style="max-width:1200px;margin-top:10px;">
          <div class="row">
            <div class="col-md-2 col-xs-12 " style="padding:5px; text-align:center;">
              <div>
              	<b>
              		<c:if test="${dto.service_line ne 'vpn'}">
					<a class="aid" action="NEW" data-toggle="modal" data-target="#divModal" value="${dto.server_code}">
						${dto.server_code}
						<input type="hidden" value="${dto.service_code}"/>
						<input type="hidden" value="${dto.service_status}"/>
						<input type="hidden" value="${client_code}" />
						<input type="hidden" id="oldServiceLine" value="${dto.service_line}"/>
						<input type="hidden" value="${dto.server_code}"/>
						<input type="hidden" value="${dto.service_sw}"/>
						<input type="hidden" value="${dto.service_os}"/>
						<input type="hidden" value="${dto.service_ip}"/>
						<input type="hidden" value="${dto.service_request_date}"/>
						<input type="hidden" value="${dto.service_open_date}"/>
						<input type="hidden" value="${dto.service_payment_date}"/>
						<input type="hidden" value="${dto.amount_rack}"/>
						<input type="hidden" value="${dto.amount_line}"/>
						<input type="hidden" value="${dto.amount_cpu}"/>
						<input type="hidden" value="${dto.service_defence}"/>
						<input type="hidden" value="${dto.amount_reseller}"/>
						<input type="hidden" value="${dto.last_long}"/>
						<input type="hidden" value="${dto.last_pre}"/>
						<input type="hidden" value="${dto.amount_authority}"/>
						<input type="hidden" value="${dto.amount_contact}"/>
						<input type="hidden" value="${dto.amount_total_discount}"/>
						<input type="hidden" value="${dto.amount_cost}"/>
						<input type="hidden" value="${dto.service_cost}"/>
						<input type="hidden" value="${dto.service_amount}"/>
						<input type="hidden" value="${dto.service_note}"/>
						<input type="hidden" value="${dto.amount_defence}"/>					
						<input type="hidden" value="${dto.server_process}"/>
						<input type="hidden" value="${dto.server_spec}"/>
						<input type="hidden" value="${dto.server_cpuname}"/>
						<input type="hidden" value="${dto.server_ram}"/>
						<input type="hidden" value="${dto.server_hdd}"/>
						<input type="hidden" value="${dto.server_location}"/>
						<input type="hidden" value="${dto.ip_total}"/>
						<input type="hidden" value="${dto.cs_total}"/>
						<input type="hidden" value="${dto.kcs_total}"/>
						<input type="hidden" value="${dto.service_deduction}"/>
						<input type="hidden" value="${dto.service_united }">
						<input type="hidden" value="${dto.service_nonAmount }">
						<input type="hidden" value="${dto.amount_defence_discount }">
						<input type="hidden" value="${dto.amount_sub_discount }">
						<input type="hidden" value="${dto.amount_one }">
						<input type="hidden" value="${dto.amount_etc }">						
						<input type="hidden" value="${dto.server_ram1}">
						<input type="hidden" value="${dto.server_ram2 }">
						<input type="hidden" value="${dto.server_ram3 }">
						<input type="hidden" value="${dto.server_ram4 }">
						<input type="hidden" value="${dto.server_ram5 }">
						<input type="hidden" value="${dto.server_hdd1 }">
						<input type="hidden" value="${dto.server_hdd2 }">
						<input type="hidden" value="${dto.server_hdd3 }">
						<input type="hidden" value="${dto.server_hdd4 }">
						<input type="hidden" value="${dto.server_hdd5 }">
					</a>
				</c:if>
				<c:if test="${dto.service_line eq 'vpn'}">
					<a class="myVpn" action="NEW" data-toggle="modal" data-target="#vpnModal">
						${dto.server_code}				
					</a>					
					<input type="hidden" value="${dto.service_status}"/>
					<input type="hidden" value="${dto.service_code}"/>
					<input type="hidden" value="${dto.server_code}"/>
					<input type="hidden" value="${dto.service_ip}"/>
					<input type="hidden" value="${dto.service_amount}"/>
					<input type="hidden" value="${dto.service_payment_date}"/>
				</c:if>
              	</b>
			  </div>
              <div>
              	<b>
              		<c:if test="${dto.service_line ne 'vpn'}">${dto.service_ip}</c:if>
					<c:if test="${dto.service_line eq 'vpn'}">${dto.service_code}</c:if>
              	</b>
              </div>
              <div class="svt_sm">
              	<c:if test="${dto.service_line ne 'vpn'}">${dto.service_code}</c:if>              	
              </div>
            </div>
            <div class="col-md-10 col-xs-12 " style="padding:5px;">
              <table border="2" align="center" cellspacing="3" bordercolor="#FFFFFF" class="table table-condensed svinfo" style="margin-bottom:0px;">
                <thead>
                  <tr>
                  	<c:if test="${dto.service_line ne 'vpn'}">
                    	<th>LOC</th>
                    </c:if>
                    <th>LINE</th>
                    <th>SPECIFICATION</th>                    
                    <c:if test="${dto.service_line ne 'vpn'}">
                    	<th>OS INFO</th>
                    	<th>S/W INFO</th>
                    	<th>기타 부가서비스</th>                    	
                    </c:if>                    
                  </tr>
                </thead>
                <tbody>
                  <tr>
                  	<c:if test="${dto.service_line ne 'vpn'}">
                    	<td>${dto.server_location}</td>
                    	<td>${dto.temp}</td>
                    	<td>${dto.server_spec} ${dto.server_ram} ${dto.server_hdd}</td>
                    	<td>${dto.service_os}</td>
                    	<td>${dto.service_sw}</td>
                    	<td>
                    		<c:forEach items="${aet}" var="adto">
                    			<c:if test="${dto.service_code eq adto.service_code}">
                    				${adto.addDB_code}<br>
                    			</c:if>
                    		</c:forEach>
                    	</td>
                    </c:if>                                       
                    <c:if test="${dto.service_line eq 'vpn'}">
                    	<td>${dto.temp}</td>
                    	<td>${dto.service_ip}</td>
                    </c:if>
                    
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <div class="col-lg-12" style="padding:0px;">
            <div class="row">
              <div class="col-md-3 col-sm-6 col-xs-6"  style="padding:3px;">
                <div class="sv_info_title">IP INFO</div>
                <div class="sv_info_content">
                  <ul class="list-group" style="margin-bottom:0px; line-height:14px">                    
                    <c:forEach items="${aip}" var="ai">					
						<c:if test="${dto.service_code == ai.service_code && ai.addDB_case eq 'ip'}">						
							<li class="list-group-item">${ai.addDB_ip}</li>
						</c:if>
					</c:forEach>
                  </ul>
                </div>
              </div>
              <div class="col-md-3 col-sm-6 col-xs-6" style="padding:3px;">
                <div class="sv_info_title">CS INFO</div>
                <div class="sv_info_content">
                  <div class="list-group" style="line-height:12px; margin-bottom:10px;">
                   <c:if test="${dto.service_line ne 'vpn'}">
	                  	<a href="vpcInfo.sev?client_code=${client_code }&csInfoFlag=true&service_code=${dto.service_code}" class="list-group-item">
	                  		<span class="badge">${dto.cs_count}</span>VPC CS
	                  	</a> 
	                  	<a href="vpcInfo.sev?client_code=${client_code }&csInfoFlag=false&service_code=${dto.service_code}" class="list-group-item">
	                  		<span class="badge">${dto.kcs_count }</span>KT CS
	                  	</a>
	                </c:if> 	
				  </div>
                  
                  <!-- 리스트 일렬로 출력 -->
                  <div class="cslist_wrap">
                  	<c:forEach items="${aip}" var="ai">
						<c:if test="${dto.service_code == ai.service_code}">
							<c:if test="${ai.addDB_case ne 'ip'}"><span class="cslist">${ai.addDB_code}</span></c:if>
						</c:if>
					</c:forEach>                  	
                  </div>
                </div>
              </div>
              <div class="clearfix visible-sm visible-xs"></div>
              <div class="col-md-3 col-sm-6 col-xs-6 col-xs-offse-0 col-md-offset-0" style="padding:3px;">
              	<div class="sv_info_title">MEMO</div>
	              	<form  action="IdcServiceNoteUpdate.sev" method="post">
	              		<div class="sv_info_content">
	              			<textarea class="form-control" rows="5" name="s_service_note">${dto.service_note}</textarea>
							<input type="hidden" name="s_client_code" value="${client_code}"/>
							<input type="hidden" name="s_service_code" value="${dto.service_code}"/>
							<input type="submit" value="DONE" a class="btn  btn-outline btn-block btn-default btn-xs" />							
						 </div>
					</form>
              </div>
              <div class="col-md-3 col-sm-6 col-xs-6" style="padding:3px;">
                <div class="svdiv" style="text-align:center; padding:5px">
                  <div class="btn-group btn-group-xs">
                  	<c:if test="${dto.service_line ne 'vpn'}">
	                    <button type="button" class="btn btn-primary btn-outline dropdown-toggle" data-toggle="dropdown"> <i class="glyphicon glyphicon-plus-sign"></i> 서비스추가 </button>                    
	                    <ul class="dropdown-menu" role="menu">
	                      <li><a href="#" onclick="additionalService('${dto.service_code}')">IP / 방어 /기타 부가서비스/ 1회성</a></li>
	                      <li class="divider"></li>
	                      <li><a href="#" onclick="addVPC('${dto.service_code}')">VPC-CS 추가</a></li>
	                      <li><a href="#" onclick="addKCS('${dto.service_code}')">KT-CS 추가</a></li>
	                      <li class="divider"></li>
	                      <li><a href="#" onclick="addDeffence1('${dto.service_code}','${client_code}')">방어존추가</a></li>
	                    </ul>
                    </c:if>
                  </div>
                  <button type="button" class="btn btn-danger btn-outline btn-xs" onclick="deleteService('${dto.service_code}','${client_code}')"><i class="fa fa-times-circle"></i> 해지</button>                  
                </div>
                <div class="svdiv" style="margin-top:5px;">
                  <table class="table table-condensed table-striped svpaytable" style="margin:0px;">
                    <tbody>
                      <tr>
                      	<c:if test="${dto.service_line ne 'vpn'}">
	                        <th>결제일</th>
	                        <td>${dto.service_payment_date}</td>
                        </c:if>
                        <c:if test="${dto.service_line eq 'vpn'}">
	                        <th>결제일/신청일</th>
	                        <td>${dto.service_payment_date}<span class="text-primary">/</span>${dto.service_request_date}</td>
                        </c:if>
                      </tr>
                      <tr>
                        <th>결제금</th>
                        <td>
                        	<b>
                        		<c:if test="${member.power5 eq 'o'}">
	                        		<c:if test="${dto.service_line ne 'vpn'}">				
										<a class="amount_a" action="NEW" data-toggle="modal" data-target="#amount_divModal" >
											<input type="text" size="6" value="${dto.service_amount}" class="money"  readonly="readonly" />
											<input type="hidden" value="${dto.service_code}">
											<input type="hidden" value="${client_code}" >
											<input type="hidden" value="${dto.amount_line}">
											<input type="hidden" value="${dto.amount_rack}">
											<input type="hidden" value="${dto.amount_cpu}">
											<input type="hidden" value="${dto.ip_total}">
											<input type="hidden" value="${dto.cs_total}">
											<input type="hidden" value="${dto.amount_defence}">
											<input type="hidden" value="${dto.amount_reseller}">
											<input type="hidden" value="${dto.last_long}">
											<input type="hidden" value="${dto.last_pre}">
											<input type="hidden" value="${dto.amount_authority}">
											<input type="hidden" value="${dto.amount_contact}">
											<input type="hidden" value="${dto.amount_total_discount}">
											<input type="hidden" value="${dto.service_amount}">
											<input type="hidden" value="${dto.service_request_date}">
											<input type="hidden" value="${dto.service_open_date}">
											<input type="hidden" value="${dto.service_payment_date}">
											<input type="hidden" value="${dto.service_cost}">
											<input type="hidden" value="${dto.kcs_total}">
											<input type="hidden" value="${dto.amount_note}">
											<input type="hidden" value="${dto.service_deduction}"/>
											<input type="hidden" value="${dto.service_united }">
											<input type="hidden" value="${dto.service_nonAmount }">
											<input type="hidden" value="${dto.amount_defence_discount }">
											<input type="hidden" value="${dto.amount_sub_discount }">
											<input type="hidden" value="${dto.amount_one }">
											<input type="hidden" value="${dto.amount_etc }">
										</a>
									</c:if>
								</c:if>
								<c:if test="${member.power5 eq 'o'}">
									<c:if test="${dto.service_line eq 'vpn'}">
										<input type="text" size="6" value="${dto.service_amount}" class="money"  readonly="readonly" />									
									</c:if>
								</c:if>
                        	</b>
                        </td>
                      </tr>
                      <tr>
                        <th>미납금</th>
                        <td>
                        	<span class="text-danger">
                        		<b>
                        			<c:if test="${member.power5 eq 'o'}">
	                        			<c:if test="${dto.service_nonpayment ne '0'}">
	                        				<font color="#990033">
	                        					<input type="text" size="6" value="${dto.service_nonpayment}" class="money"  readonly="readonly" />
	                        				</font>
	                        			</c:if>
                        			</c:if>
                        			<c:if test="${member.power5 eq 'o'}">
	                        			<c:if test="${dto.service_nonpayment eq '0'}">
	                        				<font color="#6699FF">                        					
	                        					<input type="text" size="6" value="${dto.service_nonpayment}" class="money"  readonly="readonly" />
											</font>
										</c:if>
									</c:if>
                        		</b>
                        	</span>
						</td>
                      </tr>
                      <tr>
                        <td colspan="2" align="center">
                        	<c:if test="${member.power5 eq 'o'}">
	                        	<button class="btn btn-default btn-sm payment" data-toggle="modal" data-target="#payment_divModal" value="${dto.service_code }"><i class="fa fa-list-alt"></i> 결제내역
	                        	</button>
                        	</c:if>
                        	<c:if test="${member.power5 eq 'o'}">
	                          	<button  class="btn btn-default btn-sm accountingHandle_link" client_code="${client_code}" service_code="${dto.service_code}" client_money="${iusc.client_money}" service_amount="${dto.service_amount}" nonpayment="${dto.service_nonpayment}">
	                          		<i class="fa fa-won"></i> 과금처리
	                          	</button>
	                         </c:if> 	
						</td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- end-row-->         
        </c:forEach>
        
        <c:if test="${fn:length(onetime) ne 0}">
        <!-- 수정사항 시작 -->
        <div class="col-lg-12">
          <div class="row" style="max-width:1200px; padding:10px; border-radius:10px; border:1px #c1c1c1 dotted; margin-top:7px;">
            <div class="col-lg-12 col-md-12 col-xs-12" style="padding:3px">
              <h4><strong>미지급<br>1회성 정보</strong></h4>
            </div>
            <!-- 사용정보 시작-->
            <div class="col-lg-10 col-md-10 col-xs-10" style="padding:3px">
            	<div class="table-responsive">            				   
	              <table width="100%" border="0"align="left" class="table table-bordered table-condensed info_table1" style="margin-bottom:0px" >	              	
	                <thead>		                            
	                  <tr>
	                    <th>종류</th>
	                    <th>내용</th>
	                    <th>누적 갯수</th>
	                    <th>서비스 금액</th>
	                    <th>미지급금</th>
	                    <th>누적 금액</th>
	                    <th>처리</th>
	                    <th>비고</th>
	                  </tr>
	                </thead>
	                <tbody>
	                 	<c:forEach items="${onetime}" var="dto">
							<tr>
								<td>${dto.temp}</td>
								<td>${dto.onetime_sub}</td>
								<td>${dto.onetime_count}</td>
								<td>
									<c:if test="${member.power5 eq 'o'}">
										<input type="text" size="8" value="${dto.onetime_amount}" class="money"  readonly="readonly" />
									</c:if>	
								</td>
								<td>
									<c:if test="${member.power5 eq 'o'}">
										<input type="text" size="8" value="${dto.onetime_nonpayment}" class="money text-danger"  readonly="readonly" />
									</c:if>
								</td>
								<td>
									<c:if test="${member.power5 eq 'o'}">
										<input type="text" size="8" value="${dto.onetime_total}" class="money"  readonly="readonly" />
									</c:if>
								</td>
								<td>
									<c:if test="${member.power5 eq 'o'}">
										<button  class="btn btn-default btn-sm accountingHandle_link" client_code="${client_code}">
	                          				<i class="fa fa-won"></i> 과금처리
	                          			</button>									
                          			</c:if>
								</td>
								<td>${dto.onetime_note}</td>
							</tr>
						</c:forEach>
	                </tbody>
	              </table>
	           </div>   
            </div>
          </div>
        </div>
        <!-- 수정사항 끝 -->
        </c:if>
        
<c:if test="${fn:length(hlist) ne 0}">        
<div class="row">
	<div class="col-lg-12 col-md-12 col-xs-12" style="margin-top:8px">
		<div class="table-responsive">
			<table class="table table-bordered table-hover table-striped">
				<thead>
					<tr>
						<td><label>행동</label></td>
						<td><label>장비명</label></td>
						<td><label>상세 정보</label></td>
						<td><label>날짜</label></td>
						<td><label>비고</label></td>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${hlist}" var="dto">
						<tr>
							<td>${dto.behavior}</td>
							<td>${dto.server_code}</td>
							<td>${dto.behavior_case}</td>
							<td>${dto.strbehavior_date}</td>
							<td>${dto.note}</td>																						
						</tr>
					</c:forEach>
					</tbody>
				
				<!-- 
				<tbody id="historyBody">					
				</tbody>
				 -->				 
				<tfoot>
				</tfoot>
			</table>
		</div>
		<div align="center">
			<ul class="pagination" style="margin:0px;">
					<li>
						<a class="btn btn-outline btn-default" href="serviceDetail.sev?client_code=${client_code}">															
							<i class="fa fa-angle-double-left "></i>
						</a>
					</li>
					<li>						
						<a class="btn btn-outline_btn-default" href="serviceDetail.sev?curPage=${curPage-1 }&client_code=${client_code}">
							<i class="fa fa-angle-left"></i>
						</a>																		
					</li>
					<c:forEach var="i" begin="${firstPage }" end="${endPage}">				
					<li>
						<a class="btn btn-outline btn-defualt" href="serviceDetail.sev?client_code=${client_code}&curPage=${i}">${i}</a>	
					</li>
					</c:forEach>
					<li>
						<a class="btn btn-outline_btn-default" href="serviceDetail.sev?curPage=${curPage+1 }&client_code=${client_code}">
							<i class="fa fa-angle-right"></i>
						</a>						
					</li>
					<li>
						<a class="btn btn-outline btn-default" href="serviceDetail.sev?client_code=${client_code}&curPage=${pageCnt}">
							<i class="fa fa-angle-double-right "></i>
						</a>
					</li>
			</ul>
			<!-- ul -->
		</div>
		<!-- UL DIV -->
	</div>
	
	</div>
	
	</div>		  
	</div>
    </div> 
</c:if>       

			


<!-- 장비관련 모달창 -->
<div id="divModal" class="modal fade" data-keyboard="true" >
    <div class="modal-dialog"> 			
        <div class="modal-content" style="width:1000px; position:relative;left:-30%; auto;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title"></h4>
            </div>
            <div class="modal-body">
 				<form name="frm" action="serviceUpdate.sev" method="post">			
		   			<input type="hidden" class="token" name="token">
		   			<div class="table-responsive">
						<table class="table table-bordered table-hover table-striped">
							<thead>
							</thead>
							<tbody>
								<tr>
									<td style="min-width: 120px">서비스 상태</td>
									<td colspan="5">
										<select name="service_status" id="service_status">
											<option value="o">o</option>
											<option value="x">x</option>						
										</select>
									</td>
								</tr>								
								<tr>
									<td>고객 코드</td>
									<td colspan="5">
										<input type="text" name="client_code" id="client_code" maxlength="50" size="50" value="${client_code}" readonly="readonly">
									</td>
								</tr>
								 
								<tr>
									<td>서비스 코드</td>
									<td colspan="5">
										<input type="text" name="service_code" id="service_code" maxlength="50" size="50" readonly="readonly">
									</td>
								</tr>
																
								<tr>
									<td>라인 종류</td>
									<td colspan="5">					
										<select name="service_line" id="service_line" >
											<option value="normal">일반</option>
											<option value="defence">방어</option>
											<option value="solo">전용</option>
											<option value="test">테스트</option>
											<option value="soloLine">전용라인</option>
											<option value="substitution">대체서버</option>
											<option value="vpn">VPN라인</option>												
										</select>
									</td>
								</tr>
								<tr>
									<td>장비번호</td>
									<td colspan="5">															
										<input type="text" name="server_code" id="server_code" maxlength="50" size="50" readonly="readonly">			
									</td>
								</tr>
								<tr>
									<td>프로세스</td>
									<td colspan="5">															
										<input type="text" name="server_process" id="server_process" maxlength="50" size="50" readonly="readonly">			
									</td>
								</tr>
								<tr>
									<td>사양</td>
									<td colspan="5">															
										<input type="text" name="server_spec" id="server_spec" maxlength="50" size="50"  readonly="readonly">			
									</td>
								</tr>
								<tr>
									<td>모델</td>
									<td colspan="5">															
										<input type="text" name="server_cpuname" id="server_cpuname" maxlength="50" size="50" readonly="readonly">			
									</td>
								</tr>								
								<tr>
									<td>ram</td>
									<td colspan="2">
										<input type="hidden" name="server_ram" id="server_ram" maxlength="50" size="50">
										<input type="hidden" name="server_hdd" id="server_hdd" maxlength="50" size="50">										
										<select name="server_ram1" id="server_ram1">
											<option value="">없음</option>
											<option value="1g">1g</option>
											<option value="2g">2g</option>
											<option value="4g">4g</option>
											<option value="8g">8g</option>
											<option value="16g">16g</option>
											<option value="24g">24g</option>
											<option value="32g">32g</option>
											<option value="64g">64g</option>
											<option value="128g">128g</option>
											<option value="256g">256g</option>																												
										</select>
										<select name="server_ram2" id="server_ram2">
											<option value="">없음</option>
											<option value="1g">1g</option>
											<option value="2g">2g</option>
											<option value="4g">4g</option>
											<option value="8g">8g</option>
											<option value="16g">16g</option>
											<option value="24g">24g</option>
											<option value="32g">32g</option>
											<option value="64g">64g</option>
											<option value="128g">128g</option>
											<option value="256g">256g</option>																												
										</select>
										<select name="server_ram3" id="server_ram3">
											<option value="">없음</option>
											<option value="1g">1g</option>
											<option value="2g">2g</option>
											<option value="4g">4g</option>
											<option value="8g">8g</option>
											<option value="16g">16g</option>
											<option value="24g">24g</option>
											<option value="32g">32g</option>
											<option value="64g">64g</option>
											<option value="128g">128g</option>
											<option value="256g">256g</option>																												
										</select>
										<select name="server_ram4" id="server_ram4">
											<option value="">없음</option>
											<option value="1g">1g</option>
											<option value="2g">2g</option>
											<option value="4g">4g</option>
											<option value="8g">8g</option>
											<option value="16g">16g</option>
											<option value="24g">24g</option>
											<option value="32g">32g</option>
											<option value="64g">64g</option>
											<option value="128g">128g</option>
											<option value="256g">256g</option>																												
										</select>										
									</td>
									<td>직접입력: <Input type="text" name="server_ram5" id="server_ram5"/></td>									
								</tr>
								<tr>
									<td>hdd</td>
									<td colspan="2">
										<select name="server_hdd1" id="server_hdd1">
											<option value="">없음</option>
											<option value="SAS 73G">SAS 73G</option>																																														
											<option value="SAS 146G">SAS 146G</option>
											<option value="SATA 300G">SATA 300G</option>
											<option value="SATA 500G">SATA 500G</option>
											<option value="SSD 128G">SSD 128G</option>
											<option value="SSD 256G">SSD 256G</option>
											<option value="SCSI 73G">SCSI 73G</option>
											<option value="SCSI 146G">SCSI 146G</option>										
										</select>
										<select name="server_hdd2" id="server_hdd2">
											<option value="">없음</option>
											<option value="SAS 73G">SAS 73G</option>																																														
											<option value="SAS 146G">SAS 146G</option>
											<option value="SATA 300G">SATA 300G</option>
											<option value="SATA 500G">SATA 500G</option>
											<option value="SSD 128G">SSD 128G</option>
											<option value="SSD 256G">SSD 256G</option>
											<option value="SCSI 73G">SCSI 73G</option>
											<option value="SCSI 146G">SCSI 146G</option>
										</select>
										<select name="server_hdd3" id="server_hdd3">
											<option value="">없음</option>
											<option value="SAS 73G">SAS 73G</option>																																														
											<option value="SAS 146G">SAS 146G</option>
											<option value="SATA 300G">SATA 300G</option>
											<option value="SATA 500G">SATA 500G</option>
											<option value="SSD 128G">SSD 128G</option>
											<option value="SSD 256G">SSD 256G</option>
											<option value="SCSI 73G">SCSI 73G</option>
											<option value="SCSI 146G">SCSI 146G</option>
										</select>
										<select name="server_hdd4" id="server_hdd4">
											<option value="">없음</option>
											<option value="SAS 73G">SAS 73G</option>																																														
											<option value="SAS 146G">SAS 146G</option>
											<option value="SATA 300G">SATA 300G</option>
											<option value="SATA 500G">SATA 500G</option>
											<option value="SSD 128G">SSD 128G</option>
											<option value="SSD 256G">SSD 256G</option>
											<option value="SCSI 73G">SCSI 73G</option>
											<option value="SCSI 146G">SCSI 146G</option>
										</select>
									</td>
									<td>직접입력: <Input type="text" name="server_hdd5" id="server_hdd5"/></td>
								</tr>
								<tr>
									<td>서버 위치</td>
									<td colspan="5">															
										<input type="text" name="server_location" id="server_location" maxlength="50" size="50" readonly="readonly">			
									</td>
								</tr>																								
								<tr>
									<td>sw정보</td>
									<td colspan="5">
										<input type="text" name="service_sw" id="service_sw" maxlength="50" size="50">
									</td>
								</tr>
								<tr>
									<td>os정보</td>
									<td colspan="5">
										<input type="text" name="service_os" id="service_os" maxlength="50" size="50">
									</td>
								</tr>								
								<tr>
									<td>기본IP</td>
									<td colspan="5">
										<input type="text" name="service_ip" id="service_ip" maxlength="50" size="50" readonly="readonly">
									</td>
								</tr>
																						
								<tr>
									<td>신청일</td>
									<td colspan="5">
										<input type="date" name="service_request_date" id="service_request_date" maxlength="50" size="50">
									</td>
								</tr>
								<tr>
									<td>개통일</td>
									<td colspan="5">
										<input type="date" name="service_open_date" id="service_open_date" maxlength="50" size="50">
									</td>
								</tr>
								<tr>
									<td>익월 결제일</td>
									<td colspan="5">
										<input type="date" name="service_payment_date" id="service_payment_date" maxlength="50" size="50">					
									</td>
								</tr>								
								<tr class="power5">
									<td>상면비</td>
									<td colspan="5">					
										<input type="text" name="amount_rack" id="amount_rack" class="service_accounting power">																									
									</td>									
								</tr>
								<tr class="power5">
									<td>회선비</td>
									<td colspan="5">					
										<input type="text" name="amount_line" id="amount_line" class="service_accounting">																									
									</td>																											
								</tr>
								<tr class="power5">
									<td>장비 임대 금액</td>
									<td colspan="5">										
										<input type="text" name="amount_cpu" id="amount_cpu" class="service_accounting"/>
									</td>
								</tr>
												
								<tr>
									<td>방어 서비스</td>
									<td>
										<input type="text" readonly="readonly" name="service_defence" id="service_defence">
										<!-- 
										 <select name="service_defence" id="service_defence" onchange="clickServiceDefence(this);">
											<option value="x">없음</option>
											<option value="normal">일반</option>
											<option value="ordinary">상시</option>
											<option value="cs-pre">CS-PRE</option>																																														
										</select>
										 -->
									</td>
									<td class="power5">
										방어서비스 금액 : <input type="text" name="amount_defence" id="amount_defence" value="0" readonly="readonly">
										<br>
										할인된 금액 : <input type="text" name="defence_discount" id="defence_discount" readonly="readonly">
									</td>
								</tr>								
								<tr class="power5">
									<td>IP금액</td>
									<td colspan="5">
										<input type="text" name="ip_total" id="ip_total" maxlength="50" size="50" class="service_accounting" readonly="readonly">
									</td>
								</tr>
								<tr class="power5">
									<td>CS금액</td>
									<td colspan="5">
										<input type="text" name="cs_total" id="cs_total" maxlength="50" size="50" class="service_accounting" readonly="readonly">
									</td>
								</tr>
								
								<tr class="power5">
									<td>KCS(VPN)금액</td>
									<td colspan="5">
										<input type="text" name="kcs_total" id="kcs_total" maxlength="50" size="50" class="service_accounting" readonly="readonly">
									</td>
								</tr>
								<tr class="power5">
									<td>기타 부가서비스 금액</td>
									<td colspan="5">
										<input type="text" id="amount_etc" name="amount_etc" maxlength="50" size="50" class="service_accounting" readonly="readonly">
									</td>
								</tr>		
								<tr class="power5">
									<td>일회성 금액</td>
									<td colspan="5">
										<input type="text" id="amount_one" name="amount_one" maxlength="50" size="50" class="service_accounting" readonly="readonly">
									</td>
								</tr>								
								<tr class="power5">
									<td>리셀러</td>
									<td colspan="5">										
										<input type="text" value="${client_reseller}" name="amount_reseller" id="amount_reseller" readonly="readonly"/>
									</td>
								</tr>
								
								<tr class="power5">				
									<td>장기 할인률</td>																		
									<td colspan="5">
										<input type="text" id="last_long" name="last_long" class="service_accounting"/>
									</td>
								</tr>
											
								<tr class="power5">
									<td>선입금 할인률</td>									
									<td colspan="5">
										<input type="text" id="last_pre" name="last_pre" class="service_accounting"/>
									</td>
								</tr>
								
								<tr class="power5">
									<td>직권 할인 금액</td>
									<td colspan="5">										
										<input type="text" name="amount_authority" id="amount_authority" value="0" class="service_accounting validateDiscount" />
									</td>
								</tr>
								<tr class="power5">
									<td>계약 할인 금액</td>
									<td colspan="5">										
										<input type="text" name="amount_contact" id="amount_contact" value="0" class="service_accounting validateDiscount" />
									</td>
								</tr>
								<tr class="power5">
									<td>부가 할인 금액</td>
									<td colspan="5">										
										<input type="text" name="amount_sub_discount" id="amount_sub_discount" value="0" class="service_accounting validateDiscount" />
									</td>
								</tr>
								<tr class="power5">
									<td>총 할인 금액</td>
									<td colspan="5">										
										<input type="text" name="amount_total_discount" id="amount_total_discount" readonly="readonly" value="0"/>
									</td>
								</tr>
								<!-- 
								<tr>									
									<td>서비스 금액</td>
									<td><input type="text" name="service_cost" id="service_cost"> </td>						
								</tr>
								 -->
								<tr class="power5">
									<td>총 결제 금액</td>
									<td colspan="5">
										<input type="text" name="service_amount" id="service_amount" />
										<input type="hidden" name="service_cost" id="service_cost">	
										<input type="hidden" name="service_united" id="service_united">
										<input type="hidden" name="service_nonAmount" id="service_nonAmount">
									</td>								
								</tr>
								<tr class="power5">
									<td>일할 과금</td>
									<td colspan="5">
										<input type="text" name="service_deduction" id="service_deduction" class="validateDeduction"/>										
									</td>
								</tr>
								<!-- 
								<tr>
									<td>부가 서비스 비용</td>
									<td>
										<input type="text" name="add_amount" id="add_amount" />
									</td>
								</tr>
								 -->								
								<tr>
									<td>비고</td>
									<td colspan="5">					
										<textarea name="mo_note" id="mo_note" rows="8" cols="100"></textarea>
									</td>
								</tr>
							</tbody>							
						</table>
					</div>
					<!-- table-responsive -->
					
					<div class="modal-footer">
	                	<button type="button" class="btn btn-default" data-dismiss="modal">취소</button>
	                	<input type="submit" class="btn btn-primary" id="save_btn">
            		</div>
				</form>
                                                                                           
            </div>
             
            
        </div><!-- /.modal-content -->          
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!--  모달 결제창 -->
<div id="amount_divModal" class="modal fade" data-keyboard="true" >    
	<form id="frmAmountInfo" class="form-horizontal" action="serviceAmountUpdate.sev" method="post"> 			
		<input type="hidden" class="token" name="token">
        <div class="modal-content" style="top:100px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title"></h4>
            </div>
            <div class="modal-body modal1">
            	<input type="hidden" name="client_code" value="${client_code}"/>
            	<div class="form-group">
                        <label for="tfName" class="col-lg-3 control-label" >서비스 코드</label>
                        <div class="col-lg-5">
                          <input type="text" name="mo_service_code" class="form-control" id="mo_service_code" readonly="readonly">
                        </div>
                    </div>
                <div class="table-responsive">               	            	                                                       
				<table class="table table-hover table-condensed"  id="acoount_modal1">					
					<tr>
						<td>상면비</td>
						<td>회선비</td>
						<td>장비임대</td>
						<td>IP<br>사용료</td>
						<td>CS<br>사용료</td>
						<td>KCS<br>사용료</td>
						<td>기타서비스</td>
						<td>일회성</td>						
						<td>방어라인</td>						
						<td>리셀러</td>
						<td>장기할인</td>					
						<td>선입금<br>할인</td>
						<td>직권할인</td>
						<td>계약할인</td>	
						<td>부가할인</td>					
						<td>총 할인<br>금액</td>												
						<td>서비스<br>금액</td>									
					</tr>										
					<tr>
						<td><input type="text" name="mo_amount_rack" id="mo_amount_rack" class="form-control form-dateTime mo_a modal_accounting " ></td>
						<td><input type="text" name="mo_amount_line" id="mo_amount_line" class="form-control form-dateTime mo_a modal_accounting " ></td>
						<td><input type="text" name="mo_amount_cpu" id="mo_amount_cpu" class="form-control form-dateTime mo_a modal_accounting " ></td>
						<td><input type="text" name="mo_amount_ip" id="mo_amount_ip" class="form-control form-dateTime mo_a modal_accounting "  readonly="readonly"></td>
						<td><input type="text" name="mo_amount_cs" id="mo_amount_cs" class="form-control form-dateTime mo_a modal_accounting " readonly="readonly"></td>
						<td><input type="text" name="mo_amount_kcs" id="mo_amount_kcs" class="form-control form-dateTime mo_a modal_accounting " readonly="readonly"></td>
						<td><input type="text" name="mo_amount_etc" id="mo_amount_etc" class="form-control form-dateTime mo_a modal_accounting " readonly="readonly"></td>
						<td><input type="text" name="mo_amount_one" id="mo_amount_one" class="form-control form-dateTime mo_a modal_accounting " readonly="readonly"></td>
						<td><input type="text" name="mo_amount_defence" id="mo_amount_defence" class="form-control form-dateTime mo_a modal_accounting " readonly="readonly"></td>
						<td><input type="text" name="mo_amount_reseller" id="mo_amount_reseller" class="form-control form-dateTime mo_a " readonly="readonly"></td>
						<td><input type="text" name="mo_last_long" id="mo_last_long" class="form-control form-dateTime mo_a modal_accounting "  readonly="readonly"></td>
						<td><input type="text" name="mo_last_pre" id="mo_last_pre" class="form-control form-dateTime mo_a modal_accounting " readonly="readonly"></td>
						<td><input type="text" name="mo_amount_authority" id="mo_amount_authority" class="form-control form-dateTime mo_a modal_accounting " ></td>
						<td><input type="text" name="mo_amount_contact" id="mo_amount_contact" class="form-control form-dateTime mo_a modal_accounting " ></td>
						<td><input type="text" name="mo_amount_sub_discount" id="mo_amount_sub_discount" class="form-control form-dateTime mo_a modal_accounting " ></td>
						<td><input type="text" name="mo_amount_total_discount" id="mo_amount_total_discount" class="form-control form-dateTime mo_a "></td>																												
						<td><input type="text" name="mo_service_amount" id="mo_service_amount" class="form-control form-dateTime mo_a ">
							<input type="hidden" name="mo_service_cost" id="mo_service_cost" class="form-control form-dateTime mo_a ">							
							<input type="hidden" name="mo_client_code" id="mo_client_code"/>
							<input type="hidden" name="mo_service_united" id="mo_service_united">
							<input type="hidden" name="mo_service_nonAmount" id="mo_service_nonAmount">
						</td>						 
					</tr>					
					<tr>
						<td colspan="2">신청일</td>
						<td colspan="2">개통일</td>						
						<td colspan="2">매월 결제일</td>
						<td colspan="11">비고</td>
					</tr>
					<tr>
						<td colspan="2"><input type="date" name="mo_service_request_date" id="mo_service_request_date" class="form-control form-dateTime mo_a"></td>
						<td colspan="2"><input type="date" name="mo_service_open_date" id="mo_service_open_date" class="form-control form-dateTime mo_a"></td>
						<td colspan="2"><input type="date" name="mo_service_payment_date" id="mo_service_payment_date" class="form-control form-dateTime mo_a"></td>
						<td colspan="11">
							<textarea style="width:100%;hight:100%;" name="mo_amount_note" id="mo_amount_note" class="form-control form-dateTime mo_a"></textarea>
							<input type="hidden" name="mo_service_deduction" id="mo_service_deduction" />
						</td>
					</tr>					
				</table>
				</div>                    
            </div>
 
            <div class="modal-footer">                
                <input type="submit" class="btn btn-primary" id="save_btn" value="수정">
                <button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
            </div>
            
        </div><!-- /.modal-content -->
            </form>
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div id="payment_divModal" class="modal fade" data-keyboard="true" >
    <div class="modal-dialog">
        <div class="modal-content" style="width:1400px; position:relative;left:-60%; auto;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">결제내역</h4>
            </div>
            <div class="modal-body">
    			<div class="table-responsive">
					<table border="1" class="table table-horver">
						<thead>
							<tr>
								<td>날짜 선택</td>
								<td><input type="date" id="myDate" value=""></td>
								<td>서비스코드</td>
								<td><input type="text" id="myservice" readonly="readonly"></td>
							</tr>
							<tr>
								<td>고객명</td>
								<td>서비스 코드</td>
								<td>서비스 종류</td>
								<td>결제일</td>
								<td>결제액</td>
							</tr>
						</thead>
						<tbody id="paymentList">
						</tbody>
						<tfoot>
						</tfoot>
					</table>                    
    			</div>        	
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
	
	
	
<div id="vpnModal" class="modal fade" data-keyboard="true" >
    <div class="modal-dialog"> 			
        <div class="modal-content" style="width:1000px; position:relative;left:-30%; auto;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title"></h4>
            </div>
            <div class="modal-body">
 				<form name="frm" action="serviceUpdateVpn.sev" method="post">			
		   			<input type="hidden" class="token" name="token">
		   			<div class="table-responsive">
						<table class="table table-bordered table-hover table-striped">
							<thead>
							</thead>
							<tbody>
								<tr>
									<td style="min-width: 120px">서비스 상태</td>
									<td colspan="5">
										<select name="service_status" id="vservice_status">
											<option value="o">o</option>
											<option value="x">x</option>						
										</select>
									</td>
								</tr>								
								<tr>
									<td>고객 코드</td>
									<td colspan="5">
										<input type="text" name="client_code" id="vclient_code" maxlength="50" size="50" value="${client_code}" readonly="readonly">
									</td>
								</tr>
								<tr>
									<td>서비스 코드</td>
									<td colspan="5">
										<input type="text" name="service_code" id="vservice_code" maxlength="50" size="50" readonly="readonly">
									</td>
								</tr>
								<tr>
									<td>서버 코드</td>
									<td colspan="5">
										<input type="text" name="server_code" id="vserver_code" maxlength="50" size="50">
									</td>
								</tr>
								<tr>
									<td>서비스 IP</td>
									<td colspan="5">
										<input type="text" name="service_ip" id="vservice_ip" maxlength="50" size="50" readonly="readonly">
									</td>
								</tr>
								<tr>
									<td>결제 금액</td>
									<td colspan="5">
										<input type="text" name="service_amount" id="vservice_amount" maxlength="50" size="50">
									</td>
								</tr>
								<tr>
									<td>결제일</td>
									<td colspan="5">
										<input type="date" name="service_payment_date" id="vservice_payment_date" maxlength="50" size="50">
									</td>
								</tr>
							</tbody>							
						</table>
					</div>
					<!-- table-responsive -->
					
					<div class="modal-footer">
	                	<button type="button" class="btn btn-default" data-dismiss="modal">취소</button>
	                	<input type="submit" class="btn btn-primary" id="save_btn">
            		</div>
				</form>
            </div>
        </div><!-- /.modal-content -->          
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->	
	
	
</body>
</html>