var teamUsers;

var isMultiple = false;

$(function () {   
    $("#sCustomerNo").select2();
    setOperationBtns();
    setDueDay();

    $("#tOrder tr td").click(function () {

        if ($(this).hasClass("td-last") || $(this).hasClass("td-checkbox")) {
            return;
        }
        else {
            ShowDetail($(this).parent().attr("id"));
        }      

    });
    
    TdRowOverOutWithSpan("tOrder");    

});


function BatchProcess() {
    ClearErrorMsg();
    if (SelectedNumber() == 0) {
        return SetErrorMsg("请先选择纪录");
    }

    var workFlowName = '';
    var statusName = '';
    var duplicated = false;
    var count = 0;
    $("#tOrder tr").each(function (i, val) {

        if (!$(val).find("td:eq(0)").find("input").prop("checked")) {
            return;
        }

        count++;

        if (workFlowName != '') {

            if (workFlowName != $(val).find("td:eq(6)").text().trim()) {
                duplicated = true;
                return false;
            }
        }
        if (statusName != '') {
            if (statusName != $(val).find("td:eq(5)").text().trim()) {
                duplicated = true;
                return false;
            }
        }

        workFlowName = $(val).find("td:eq(6)").text().trim();
        statusName = $(val).find("td:eq(5)").text().trim();
    });


    if (duplicated) {
        return SetErrorMsg("只能选择流程和状态均相同的记录");
    }


    if (count > 100) {
        return SetErrorMsg("每次最多只能选择100条记录。请尝试分多次操作。");
    }

    NextStep(GetSelectedId(), true);
}

