

/**
 * 图表填充
 */

function conOverdueChartInit(contextPath,url){
    $.ajax({
        type: 'GET',
        url: contextPath+url,
        contentType: "application/json; charset=utf-8",
        success: function (datas) {
            if(datas[0]){
                var amountStr=
                     datas[0].overdueAmount6+','
                    +datas[0].overdueAmount5+','
                    +datas[0].overdueAmount4+','
                    +datas[0].overdueAmount3+','
                    +datas[0].overdueAmount2+','
                    +datas[0].overdueAmount1+','
                    +datas[0].overdueAmount1;
                if(datas[0].overdueAmount6 && datas[0].overdueAmount5 && datas[0].overdueAmount4 && datas[0].overdueAmount3 && datas[0].overdueAmount2 && datas[0].overdueAmount1){
                    $('#contract-overdue-span').text(amountStr);
                }
                $('#contract-overdue-span').text('1,12,1,23,22,1,1');
                InitiateSparkline2Charts.init();
            }
        }
    });
}

function initWeekContent(){
    var sysDateStr=$('#sysData').text();
    sysDateStr=sysDateStr.replace('年','-').replace('月','-').replace('日','');
    var year = sysDateStr.split('-')[0];
    var month = sysDateStr.split('-')[1];
    var date = sysDateStr.split('-')[2];
    var newDate =new Date(year,month,date);
    var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
    $('#day-1').text(dayNames[newDate.getDay()]);
    newDate.setDate(newDate.getDate()-1);
    $('#day-2').text(dayNames[newDate.getDay()]);
    newDate.setDate(newDate.getDate()-1);
    $('#day-3').text(dayNames[newDate.getDay()]);
    newDate.setDate(newDate.getDate()-1);
    $('#day-4').text(dayNames[newDate.getDay()]);
    newDate.setDate(newDate.getDate()-1);
    $('#day-5').text(dayNames[newDate.getDay()]);
    newDate.setDate(newDate.getDate()-1);
    $('#day-6').text(dayNames[newDate.getDay()]);
    newDate.setDate(newDate.getDate()-1);
    $('#day-7').text(dayNames[newDate.getDay()]);
}
function loadConOverDueData(contextPath,url){
    conOverdueChartInit(contextPath,url);
    initWeekContent();
}

