/*
오픈전에 소스 정리해야함.
팝업 제어하는 파일
*/
//xml 데이터 url
var xml_base_url = "/ckepco/front/CYCOMM00/xml/";
function initSale(type, disabled){
if(disabled) alert("비주거용일 경우 할인 요금이 적용되지 않습니다.");
$("input[name="+type+"_input_02][value=4]").prop("checked", true);
$("select[name="+type+"_input_03]").val("1");
$("input[name="+type+"_input_02][value!=4]").prop("disabled", disabled);
$("select[name="+type+"_input_03]").prop("disabled", disabled);
}
function GeneralK2Sum(){
var middle_value = 0;
var top_value = 0;
var bottom_value = 0;
if(isNaN(parseInt($('[name=GeneralK2_input_07]').val()))){
middle_value = 0;
}else{
middle_value = parseInt($('[name=GeneralK2_input_07]').val(), 10);
}
if(isNaN(parseInt($('[name=GeneralK2_input_08]').val()))){
top_value = 0;
}else{
top_value = parseInt($('[name=GeneralK2_input_08]').val(), 10);
}
if(isNaN(parseInt($('[name=GeneralK2_input_09]').val()))){
bottom_value = 0;
}else{
bottom_value = parseInt($('[name=GeneralK2_input_09]').val(), 10);
}
$('[name=GeneralK2_input_06]').val(middle_value+top_value+bottom_value);
}
function GeneralUSum(){
var middle_value = 0;
var top_value = 0;
var bottom_value = 0;
if(isNaN(parseInt($('[name=GeneralU_input_07]').val()))){
middle_value = 0;
}else{
middle_value = parseInt($('[name=GeneralU_input_07]').val(), 10);
}
if(isNaN(parseInt($('[name=GeneralU_input_08]').val()))){
top_value = 0;
}else{
top_value = parseInt($('[name=GeneralU_input_08]').val(), 10);
}
if(isNaN(parseInt($('[name=GeneralU_input_09]').val()))){
bottom_value = 0;
}else{
bottom_value = parseInt($('[name=GeneralU_input_09]').val(), 10);
}
$('[name=GeneralU_input_06]').val(middle_value+top_value+bottom_value);
}
function EducationUSum(){
var middle_value = 0;
var top_value = 0;
var bottom_value = 0;
if(isNaN(parseInt($('[name=EducationU_input_07]').val()))){
middle_value = 0;
}else{
middle_value = parseInt($('[name=EducationU_input_07]').val(), 10);
}
if(isNaN(parseInt($('[name=EducationU_input_08]').val()))){
top_value = 0;
}else{
top_value = parseInt($('[name=EducationU_input_08]').val(), 10);
}
if(isNaN(parseInt($('[name=EducationU_input_09]').val()))){
bottom_value = 0;
}else{
bottom_value = parseInt($('[name=EducationU_input_09]').val(), 10);
}
$('[name=EducationU_input_06]').val(middle_value+top_value+bottom_value);
}
function IndustryK2Sum(){
var middle_value = 0;
var top_value = 0;
var bottom_value = 0;
if(isNaN(parseInt($('[name=IndustryK2_input_07]').val()))){
middle_value = 0;
}else{
middle_value = parseInt($('[name=IndustryK2_input_07]').val(), 10);
}
if(isNaN(parseInt($('[name=IndustryK2_input_08]').val()))){
top_value = 0;
}else{
top_value = parseInt($('[name=IndustryK2_input_08]').val(), 10);
}
if(isNaN(parseInt($('[name=IndustryK2_input_09]').val()))){
bottom_value = 0;
}else{
bottom_value = parseInt($('[name=IndustryK2_input_09]').val(), 10);
}
$('[name=IndustryK2_input_06]').val(middle_value+top_value+bottom_value);
}
function IndustryUSum(){
var middle_value = 0;
var top_value = 0;
var bottom_value = 0;
if(isNaN(parseInt($('[name=IndustryU_input_07]').val()))){
middle_value = 0;
}else{
middle_value = parseInt($('[name=IndustryU_input_07]').val(), 10);
}
if(isNaN(parseInt($('[name=IndustryU_input_08]').val()))){
top_value = 0;
}else{
top_value = parseInt($('[name=IndustryU_input_08]').val(), 10);
}
if(isNaN(parseInt($('[name=IndustryU_input_09]').val()))){
bottom_value = 0;
}else{
bottom_value = parseInt($('[name=IndustryU_input_09]').val(), 10);
}
$('[name=IndustryU_input_06]').val(middle_value+top_value+bottom_value);
}
function TempU2Sum(){
var middle_value = 0;
var top_value = 0;
var bottom_value = 0;
if(isNaN(parseInt($('[name=TempU2_input_07]').val()))){
middle_value = 0;
}else{
middle_value = parseInt($('[name=TempU2_input_07]').val(), 10);
}
if(isNaN(parseInt($('[name=TempU2_input_08]').val()))){
top_value = 0;
}else{
top_value = parseInt($('[name=TempU2_input_08]').val(), 10);
}
if(isNaN(parseInt($('[name=TempU2_input_09]').val()))){
bottom_value = 0;
}else{
bottom_value = parseInt($('[name=TempU2_input_09]').val(), 10);
}
$('[name=TempU2_input_06]').val(middle_value+top_value+bottom_value);
}
function TempU3Sum(){
var middle_value = 0;
var top_value = 0;
var bottom_value = 0;
if(isNaN(parseInt($('[name=TempU3_input_07]').val()))){
middle_value = 0;
}else{
middle_value = parseInt($('[name=TempU3_input_07]').val(), 10);
}
if(isNaN(parseInt($('[name=TempU3_input_08]').val()))){
top_value = 0;
}else{
top_value = parseInt($('[name=TempU3_input_08]').val(), 10);
}
if(isNaN(parseInt($('[name=TempU3_input_09]').val()))){
bottom_value = 0;
}else{
bottom_value = parseInt($('[name=TempU3_input_09]').val(), 10);
}
$('[name=TempU3_input_06]').val(middle_value+top_value+bottom_value);
}
function DisplayOneHouse(){
var family_count = 0;
if(isNaN(parseInt($('[name=OneHouse_input_01]').val()))){
family_count = 0;
}else{
family_count = parseInt($('[name=OneHouse_input_01]').val(), 10);
}
if(family_count>0){
//$('#per_family_0').show();
}else{
//$('#per_family_0').hide();
}
for(fi=1;fi<10;fi++){
$('#per_family_'+fi).hide();
}
for(fi2=1;fi2<=family_count;fi2++){
$('#per_family_'+fi2).show();
}
}
function checkOnehouse(group_nm, uq_nm){
val_01 = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_1"]').is(":checked"); //장애인/유공자
val_02 = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_2"]').is(":checked"); //기초생활(생계,의료)
val_03 = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_3"]').is(":checked"); //기초생활(주거,교육)
val_04 = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_4"]').is(":checked"); //차상위계층
val_05 = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_5"]').is(":checked"); //사회복지시설
val_06 = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_6"]').is(":checked"); //3자녀/대가족/출산가구
val_07 = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_7"]').is(":checked"); //생명유지
val_curr = $('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').is(":checked");
if(uq_nm=="1"){
if(val_02){
alert("장애인/유공자 요금할인과 기초생활(생계,의료)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_03){
alert("장애인/유공자 요금할인과 기초생활(주거,교육)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_04){
alert("장애인/유공자 요금할인과 차상위계층는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_05){
alert("장애인/유공자 요금할인과 사회복지시설는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_06){
alert("장애인/유공자 요금할인과 3자녀/대가족/출산가구는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_07){
alert("장애인/유공자 요금할인과 생명유지는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}
}else if(uq_nm=="2"){
if(val_01){
alert("기초생활(생계,의료) 요금할인과 장애인/유공자는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_03){
alert("기초생활(생계,의료) 요금할인과 기초생활(주거,교육)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_04){
alert("기초생활(생계,의료) 요금할인과 차상위계층는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_05){
alert("기초생활(생계,의료) 요금할인과 사회복지시설는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}
}else if(uq_nm=="3"){
if(val_01){
alert("기초생활(주거,교육) 요금할인과 장애인/유공자는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_02){
alert("기초생활(주거,교육) 요금할인과 기초생활(생계,의료)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_04){
alert("기초생활(주거,교육) 요금할인과 차상위계층는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_05){
alert("기초생활(주거,교육) 요금할인과 사회복지시설는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}
}else if(uq_nm=="4"){
if(val_01){
alert("차상위계층 요금할인과 장애인/유공자는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_02){
alert("차상위계층 요금할인과 기초생활(생계,의료)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_03){
alert("차상위계층 요금할인과 기초생활(주거,교육)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_05){
alert("차상위계층 요금할인과 사회복지시설는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}
}else if(uq_nm=="5"){
if(val_01){
alert("사회복지시설 요금할인과 장애인/유공자는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_02){
alert("사회복지시설 요금할인과 기초생활(생계,의료)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_03){
alert("사회복지시설 요금할인과 기초생활(주거,교육)는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_04){
alert("사회복지시설 요금할인과 차상위계층는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_06){
alert("사회복지시설 요금할인과 3자녀/대가족/출산가구는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_07){
alert("사회복지시설 요금할인과 생명유지는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}
}else if(uq_nm=="6"){
if(val_01){
alert("3자녀/대가족/출산가구 요금할인과 장애인/유공자는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_05){
alert("3자녀/대가족/출산가구 요금할인과 사회복지시설는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_07){
alert("3자녀/대가족/출산가구 요금할인과 생명유지는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}
}else if(uq_nm=="7"){
if(val_01){
alert("생명유지 요금할인과 장애인/유공자는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_05){
alert("생명유지 요금할인과 사회복지시설는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}else if(val_06){
alert("생명유지 요금할인과 3자녀/대가족/출산가구는 동시에 적용될 수 없습니다.");
$('input:checkbox[name="OneHouse_input_03_'+group_nm+'_'+uq_nm+'"]').attr("checked", false);
}
}
}
function checkETypeFarmU(obj){
//alert(obj.value);
if($("#FarmU_input_05").val()=="810L") $("#trTermFarmU").hide();
else $("#trTermFarmU").show();
}
function showLoading(){
$("#loading").show();
$("#loading2").show();
}
function hideLoading(){
$("#loading").hide();
$("#loading2").hide();
}
function showLoading3(){
$("#loading3").show();
}
function hideLoading3(){
$("#loading3").hide();
}
// 계약종별선택 후 보일 폼
function createForm(formName) {
/*
$('.scroll_contract .table_contract').each(function(index) {
alert(index);
$(this).hide();
});
*/
$("#FormHouseL").hide();
$("#FormHouseH").hide();
$("#FormGeneralK").hide();
$("#FormGeneralK2").hide();
$("#FormGeneralU").hide();
$("#FormOneHouse").hide();
$("#FormEducationK").hide();
$("#FormEducationU").hide();
$("#FormIndustryK").hide();
$("#FormIndustryK2").hide();
$("#FormIndustryU").hide();
$("#FormTempK").hide();
$("#FormTempU").hide();
$("#FormTempU2").hide();
$("#FormTempU3").hide();
$("#FormLampU").hide();
$("#FormNightK").hide();
$("#FormFarmK").hide();
$("#FormFarmU").hide();
$("#"+formName).attr("tabindex","0").show().focus();
form1.reset();
//계산결과 지우기
calClear();
$("#Proc_CODE").val(formName.replace("Form",""));
//전기요금표 보기 링크 생성
$("#view_cal_table").hide();
$("#1house_cal_table").hide();
if(formName=="FormOneHouse"){
$("#1house_cal_table").show();
}else{
$("#1house_cal_table").hide();
$("#view_cal_table").show();
$("#view_cal_table").unbind("click");
$("#view_cal_table").click(function() {
var doc_location = "";
if(formName=="FormHouseL" || formName=="FormHouseH"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00101.jsp";
}else if(formName=="FormGeneralK" || formName=="FormGeneralK2" || formName=="FormGeneralU"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00102.jsp";
}else if(formName=="FormEducationK" || formName=="FormEducationU"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00104.jsp";
}else if(formName=="FormIndustryK" || formName=="FormIndustryK2" || formName=="FormIndustryU"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00103.jsp";
}else if(formName=="FormFarmK" || formName=="FormFarmU"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00105.jsp";
}else if(formName=="FormNightK"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00107.jsp";
}else if(formName=="FormLampU"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00106.jsp";
}else if(formName=="FormTempK"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00101.jsp";
}else if(formName=="FormTempU"){
doc_location = "https://home.kepco.co.kr/ckepco/front/jsp/CY/E/E/CYEEHP00102.jsp";
}else{
}
//if(opener != 'undefined'){
//opener.location.href=doc_location;
window.open(doc_location,""); //새창으로
//self.close();
//}else{
//window.open(doc_location,"");
//}
});
}
return false;
};
// 계산결과 지우기
function calClear() {
$("#cal_detail_title").html("");
$("#cal_detail_content").html("");
$("#cal_detail_blank").show();
$("#cal_detail_show").hide();
$("#print_cal_result").hide();
$("#cal_result").html("
");
return false;
};
// 계산결과 보이기
function calShow() {
$("#cal_detail_blank").hide();
$("#cal_detail_show").show();
$("#print_cal_result").show();
return false;
};
//날짜관련
// 숫자 자리수 맞추기 앞에 0 붙임
function addzero(n) {
return parseInt(n, 10) < 10 ? "0" + n : n;
}
//날짜 포맷
function dateFormat(dt) {
var d = new Date(dt);
var yyyy = d.getFullYear();
var MM = d.getMonth()+1;
var dd = d.getDate();
return (yyyy + '.' + addzero(MM) + '.' + addzero(dd));
}
//날짜 포맷
function dateLength(input_date){
try{
var t_year = input_date.substring(0,4);
var t_mm = addzero((parseInt(input_date.substring(5,7), 10)-1));
var t_dd = input_date.substring(8,10);
var loadDt = new Date(t_year, t_mm, t_dd);
var loadDt_tmp = new Date(t_year, t_mm, t_dd);
loadDt.setMonth(loadDt.getMonth()+1); //한달 후
loadDt.setDate(loadDt.getDate()-1); //하루 전
return dateFormat(loadDt);
}catch(e){
return "";
}
}
$(function() {
// 요금계산기 바로가기
$("#bill_simulation").click(function() {
//초기화(추가필)
form1.reset();
$('#cal_dialog').show();
$("#1house_cal_table").hide();
//$('.list_cont_info [selformkey=FormHouseL]').click();
return false;
});
// 계약종별 선택
$('.list_cont_info').find('li').bind({
click: function(){
$('.list_cont_info > li').removeClass('on');
$(this).addClass('on');
$('.list_cont_info li a').removeAttr("title");
$(this).find("a").attr("title","선택됨");
var selFormKey = $(this).attr('selFormKey');
if(selFormKey != ""){
createForm(selFormKey);
}
}
});
//시간대별 사용량의 경우 메시지 띄우기
$("input[readonly=readonly][title*='사용량']").click(
function(){
var mid = $(this).parent().parent().parent().next().find("input");
var hea = $(this).parent().parent().parent().next().next().find("input");
var lig = $(this).parent().parent().parent().next().next().next().find("input");
if( isNaN(parseInt(mid.val())) ){
alert("주간(중간)사용량을 입력해 주시기 바랍니다.");
mid.focus();
return;
}
if( isNaN(parseInt(hea.val())) ){
alert("저녁(최대)사용량을 입력해 주시기 바랍니다.");
hea.focus();
return;
}
if( isNaN(parseInt(lig.val())) ){
alert("심야(경)사용량을 입력해 주시기 바랍니다.");
lig.focus();
return;
}
}
);
// 요금계산하기
$("#cal_start").click(function() {
if($('[name=HouseL_input_05]').val()==""){
alert("사용기간을 입력해 주시기 바랍니다.");
$('[name=HouseL_input_05]').focus();
return;
}
if($('[name=HouseL_input_06]').val()==""){
alert("사용기간을 입력해 주시기 바랍니다.");
$('[name=HouseL_input_06]').focus();
return;
}
if(isNaN(parseInt($('[name=HouseL_input_04]').val()))){
alert("사용량을 입력해 주시기 바랍니다.");
$("#HouseL_input_04").focus();
return;
}
calClear();
calShow();
getRateData();
return false;
});
// 달력
$("[name=HouseL_input_05]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "http://cyber.kepco.co.kr/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=HouseL_input_06]").val(dateLength($("[name=HouseL_input_05]").val()));
}
});
// 달력
$("[name=HouseH_input_05]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "http://cyber.kepco.co.kr/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=HouseH_input_06]").val(dateLength($("[name=HouseH_input_05]").val()));
}
});
// 달력
$("[name=GeneralK_input_07]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=GeneralK_input_08]").val(dateLength($("[name=GeneralK_input_07]").val()));
}
});
// 달력
$("[name=GeneralK2_input_10]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=GeneralK2_input_11]").val(dateLength($("[name=GeneralK2_input_10]").val()));
}
});
// 달력
$("[name=GeneralU_input_10]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=GeneralU_input_11]").val(dateLength($("[name=GeneralU_input_10]").val()));
}
});
// 달력
$("[name=OneHouse_input_04]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=OneHouse_input_05]").val(dateLength($("[name=OneHouse_input_04]").val()));
}
});
// 달력
$("[name=EducationK_input_07]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=EducationK_input_08]").val(dateLength($("[name=EducationK_input_07]").val()));
}
});
// 달력
$("[name=EducationU_input_10]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=EducationU_input_11]").val(dateLength($("[name=EducationU_input_10]").val()));
}
});
// 달력
$("[name=IndustryK_input_07]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=IndustryK_input_08]").val(dateLength($("[name=IndustryK_input_07]").val()));
}
});
// 달력
$("[name=IndustryK2_input_10]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=IndustryK2_input_11]").val(dateLength($("[name=IndustryK2_input_10]").val()));
}
});
// 달력
$("[name=IndustryU_input_10]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=IndustryU_input_11]").val(dateLength($("[name=IndustryU_input_10]").val()));
}
});
// 달력
$("[name=TempK_input_02]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=TempK_input_03]").val(dateLength($("[name=TempK_input_02]").val()));
}
});
// 달력
$("[name=TempU_input_07]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=TempU_input_08]").val(dateLength($("[name=TempU_input_07]").val()));
}
});
// 달력
$("[name=TempU2_input_10]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=TempU2_input_11]").val(dateLength($("[name=TempU2_input_10]").val()));
}
});
// 달력
$("[name=TempU3_input_10]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=TempU3_input_11]").val(dateLength($("[name=TempU3_input_10]").val()));
}
});
// 달력
$("[name=NightK_input_03]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=NightK_input_04]").val(dateLength($("[name=NightK_input_03]").val()));
}
});
// 달력
$("[name=FarmU_input_07]").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "yy.mm.dd",
showOtherMonths: true,
selectOtherMonths: true,
showOn: "button",
buttonImage: "/ckepco/front/img/com/calendar.png",
buttonImageOnly: true,
minDate:new Date('2013', '10', '21'),
onSelect:function(){
$("[name=FarmU_input_08]").val(dateLength($("[name=FarmU_input_07]").val()));
}
});
$("img.ui-datepicker-trigger").attr("style", "margin-left:4px; vertical-align:middle; cursor: Pointer;");
});
// Ajax 기준요금등 xml 데이터 가져오기 (서버 xml 확인필)
function getRateDataGraph() {
var iUsedAmount_LIMITED = iUsedAmount;
if(iUsedAmount>1000){
iUsedAmount_LIMITED = 1000;
}
if(ajax_submit) {
//alert("실행중입니다.");
return false;
}
ajax_submit = true;
$.ajax({
url: xml_base_url+'get_unitcost.jsp'+'?autopay=2&use%5Famt='+iUsedAmount_LIMITED+'&big%5Ffam=3&contractType=HouseL&welfare=1',
type : "get",
dataType : "xml",
beforeSend: function(jqXHR, settings) {
showLoading3();
},
success: function(data, textStatus, jqXHR) {
var rdata = data;
ajax_submit = false;
hideLoading3();
drawGraph(rdata);
},
error: function(jqXHR, textStatus, errorThrown) {
hideLoading3();
ajax_submit = false;
alert("서버 데이터를 가져오는데 [실패]하였습니다.");
},
complete: function(jqXHR, textStatus) {
},
timeout: 15000
});
}
var plot1;
function drawGraph(xmlDoc){
var yMax = 0;
var iUsedAmount_LIMITED = iUsedAmount;
if(iUsedAmount>1000){
iUsedAmount_LIMITED = 1000;
}
// 차트 그리기
$.jqplot.config.enablePlugins = true;
var xmlData06 = new Array();
var xmlData07 = new Array();
var xmlData08 = new Array();
var xmlData09 = new Array();
var xmlInc06 = 0;
var xmlInc07 = 0;
var xmlInc08 = 0;
var xmlInc09 = 0;
$(xmlDoc).find('data').each(function() {
if($(this).attr('costs') != "null"){
xmlData06[xmlInc06]=[$(this).attr('kwh'), $(this).attr('costs')];
if(yMax<=parseInt($(this).attr('costs'), 10)){
yMax = parseInt($(this).attr('costs'), 10);
}
xmlInc06++;
}
if($(this).attr('bigf') != "null"){
xmlData07[xmlInc07]=[$(this).attr('kwh'), $(this).attr('bigf')];
if(yMax<=parseInt($(this).attr('bigf'), 10)){
yMax = parseInt($(this).attr('bigf'), 10);
}
xmlInc07++;
}
if($(this).attr('welf') != "null"){
xmlData08[xmlInc08]=[$(this).attr('kwh'), $(this).attr('welf')];
if(yMax<=parseInt($(this).attr('welf'), 10)){
yMax = parseInt($(this).attr('welf'), 10);
}
xmlInc08++;
}
if($(this).attr('multi') != "null"){
xmlData09[xmlInc09]=[$(this).attr('kwh'), $(this).attr('multi')];
if(yMax<=parseInt($(this).attr('multi'), 10)){
yMax = parseInt($(this).attr('multi'), 10);
}
xmlInc09++;
}
});
plot1 = $.jqplot('chart1', [xmlData06, xmlData07, xmlData08, xmlData09], {
legend:{
background: "rgb(228, 237, 244)",
textColor: "rgb(91, 93, 94)",
renderer: $.jqplot.EnhancedLegendRenderer,
show:true,
location: 'nw',
fontSize: '10px',
fontFamily: ["돋움"],
rendererOptions: {
seriesToggle: 'normal'
}
},
seriesDefaults: {
show: true, // wether to render the series.
xaxis: 'xaxis', // either 'xaxis' or 'x2axis'.
yaxis: 'yaxis', // either 'yaxis' or 'y2axis'.
label: '', // label to use in the legend for this line.
color: '', // CSS color spec to use for the line. Determined automatically.
lineWidth: 2.5, // Width of the line in pixels.
shadow: true, // show shadow or not.
shadowAngle: 45, // angle (degrees) of the shadow, clockwise from x axis.
shadowOffset: 1.25, // offset from the line of the shadow.
shadowDepth: 3, // Number of strokes to make when drawing shadow. Each
// stroke offset by shadowOffset from the last.
shadowAlpha: 0.1, // Opacity of the shadow.
showLine: true, // whether to render the line segments or not.
showMarker: true, // render the data point markers or not.
fill: false, // fill under the line,
fillAndStroke: false, // *stroke a line at top of fill area.
fillColor: undefined, // *custom fill color for filled lines (default is line color).
fillAlpha: undefined, // *custom alpha to apply to fillColor.
renderer: $.jqplot.LineRenderer, // renderer used to draw the series.
rendererOptions: {}, // options passed to the renderer. LineRenderer has no options.
markerRenderer: $.jqplot.MarkerRenderer, // renderer to use to draw the data
// point markers.
markerOptions: {
show: true, // wether to show data point markers.
style: 'filledCircle', // circle, diamond, square, filledCircle.
// filledDiamond or filledSquare.
lineWidth: 2, // width of the stroke drawing the marker.
size: 9, // size (diameter, edge length, etc.) of the marker.
// color: '#666666', // color of marker, set to color of line by default.
shadow: true, // wether to draw shadow on marker or not.
shadowAngle: 45, // angle of the shadow. Clockwise from x axis.
shadowOffset: 1, // offset from the line of the shadow,
shadowDepth: 3, // Number of strokes to make when drawing shadow. Each stroke
// offset by shadowOffset from the last.
shadowAlpha: 0.07 // Opacity of the shadow
}
},
seriesColors: ["rgb(18, 131, 195)", "rgb(215, 111, 0)", "rgb(0, 116, 3)", "rgb(211, 0, 0)"],
series: [
{
label: '주택용(저압)',
lineWidth: 1.2,
shadow:true,
showLine:true,
showMarker:true,
highlighter: {
showLabel: true
}
},
{
label: '생명유지장치',
lineWidth: 2,
shadow:true,
showLine:true,
showMarker:true,
highlighter: {
showLabel: true
}
},
{
label: '복지할인 적용',
lineWidth: 1.2,
shadow:true,
showLine:true,
showMarker:true,
highlighter: {
showLabel: true
}
},
{
label: '생명유지장치+복지할인',
lineWidth: 1.2,
shadow:true,
showLine:true,
showMarker:true,
highlighter: {
showLabel: true
}
}
],
grid: {
drawGridLines: true, // wether to draw lines across the grid or not.
gridLineColor: '#cccccc', // *Color of the grid lines.
background: '#ffffff', // CSS color spec for background color of grid.
borderColor: '#000000', // CSS color spec for border around grid.
borderWidth: 0, // pixel width of border around grid.
shadow: true, // draw a shadow for grid.
shadowAngle: 45, // angle of the shadow. Clockwise from x axis.
shadowOffset: 1.5, // offset from the line of the shadow.
shadowWidth: 3, // width of the stroke for the shadow.
shadowDepth: 3, // Number of strokes to make when drawing shadow.
// Each stroke offset by shadowOffset from the last.
shadowAlpha: 0.07, // Opacity of the shadow
renderer: $.jqplot.CanvasGridRenderer, // renderer to use to draw the grid.
rendererOptions: {} // options to pass to the renderer. Note, the default
// CanvasGridRenderer takes no additional options.
},
//animate: true,
//animateReplot: true,
cursor: {
show: true, //커서 기능 사용 유무
zoom: true, //줌 기능 사용 유무
useAxesFormatters:false,
showTooltip: false, //화면 하단에 tooltip 기능 사용 유무
tooltipFormatString: "%dkWh/%'d원"
},
axes:{
xaxis:{
min:0,
max:(parseInt(iUsedAmount_LIMITED,10)+(parseInt(iUsedAmount_LIMITED,10)*0.03)),
//max:parseInt(iUsedAmount_LIMITED,10),
autoscale: true,
label:'',
pad:2.0,
tickOptions:{
showLabel: true,
formatString:'%d'
},
rendererOptions: {
//forceTickAt0: true
}
},
yaxis:{
min:0,
max:(yMax+(yMax*0.03)),
autoscale: false,
label:'',
pad:1.0,
tickOptions:{
showLabel: true,
formatString:'%.1f',
formatter: $.jqplot.customFormatter
},
rendererOptions: {
//forceTickAt0: true
}
}
},
highlighter: {
show: true,
showLabel: true,
sizeAdjust: 100,
markerRenderer : new $.jqplot.MarkerRenderer({shadow:true}),
showMarker : true,
Color: '#0000FF',
lineWidthAdjust : 15.5,
sizeAdjust: 9.5,
tooltipAxes:'xy',
useAxesFormatters:false,
tooltipFormatString : '%.5P',
bringSeriesToFront: true,
yvalues : 1,
showTooltip : true,
formatString: "#serieLabel#
사용량 : %dkWh
요금: %'d원",
tooltipLocation : 'n',
fadeTooltip: true,
tooltipFadeSpeed: "fast"
}
});
}