// 结算记录--查看
function viewRecord(id){
    window.open('/bill/basicView?viewInitiation=1&historyId='+id)
    return false;
};


$(function () {

    function showAmount(cellValue,options,rowObject) {
        if(cellValue !== null) {
            return commaDelimiter(cellValue)
        }else {
            return ''
        }
    }

    // 操作列
    function operateBusiness(cellValue,options,rowObject){
        var btnstr = '';
        // if( $('#viewBusiness').length>0 ){
            btnstr += '<p><span>查看</span><i class="operateIconfont operateIcon-chakan" onclick="viewRecord('+rowObject.id+')"></i></p>';
        // };
        return '<div class="operateIcon noHover">'+btnstr+'</div>';
    };

    sxUtil.jqGrid('#recordList', {
        colNames: ['ID', '序号','结算单号', '结算时间', '状态', '结算金额 ', '操作'],
        colModel: [
            {name: 'applicantId', label: 'ID', hidedlg: true, hidden: true, sortable: false, title: false},
            {name: 'orderNumber', label: '序号', sortable: false, width: 50, align: 'center', title: false},
            {name: 'billInformationNumber', label: '结算清单号', sortable: false,align: 'center', title: false},
            // {name: 'loanCount', label: '供应商名称', sortable: false, align: 'center', title: false},
            {name: 'settlementDate', label: '结算时间', sortable: false, align: 'center', title: false},
            {name: 'status.name', label: '状态', sortable: false, align: 'center',  title: false},
            {name: 'settlementAmount', label: '结算金额', sortable: false, align: 'center',title: false,formatter:showAmount},
            {
                name: 'remark',
                label: '操作',
                sortable: false,
                align: 'left',
                width: 140,
                title: false,
                formatter: operateBusiness
            }
        ],
        height: 'auto',
        mtype: 'GET',
        url: '/business/management/findBillHis',
        pager: "#recordListPage",
        multiselect: false,
        rownumbers: false,
        postData: {
            'conditionLong':businessQuery.detailId,
        },
        page: 1,
        loadError: function () {
            new $.zui.Messager('列表加载失败', {
                type: 'warning'
            }).show();
        }
    }, true);


    $(".newBackBtn").click(function () {
        $(".yk_rightcontent").load('/business/management/findBillGoods?businessBasicInfoId='+businessQuery.detailId);
    })

})

