var el = {
    invoiceVoucher: '#invoiceVoucher',
    invoicePostDate: '#invoicePostDate',
    paymentExpireDate: '#paymentExpireDate',
    statementType: '#statementType',
    postStatus: '#postStatus',
    voucherYear: '#voucherYear',
    id:'#ids'

};
$(function () {
    $(el.postStatus).combobox({
        editable: false,
        panelHeight: 'auto',
        valueField: 'value',
        textField: 'label',
        prompt: '--- 请选择 ---',
        data: [
            {label: '未过账', value: 1},
            {label: '预制失败', value: 3},
            {label: '预制成功', value: 4},
            {label: '过账成功', value: 5}
        ],
    });
    $(el.voucherYear).combobox({
        required: true,
        valueField: 'code',
        textField: 'name',
        limitToList: 'true',
        data: [
            {'name': moment().format('YYYY'), 'code': moment().format('YYYY')},
            {'name': moment().add(-12, 'month').format('YYYY'), 'code': moment().add(-12, 'month').format('YYYY')},
            {'name': moment().add(-24, 'month').format('YYYY'), 'code': moment().add(-24, 'month').format('YYYY')},
        ],
        editable: false,
        prompt: '--- 请选择 ---',
        panelHeight: 'auto',
    });
    // $(el.invoicePostDate).datebox({
    //     value: moment().format('YYYY-MM-DD'),
    // });
});
/**
 * 确定过账
 */
function confirm(call) {
    var invoiceVoucher = $(el.invoiceVoucher).textbox('getValue');
    // var invoicePostDate = $(el.invoicePostDate).datebox('getValue');
    var paymentExpireDate = $(el.paymentExpireDate).datebox('getValue');
    // var statementType = $(el.statementType).combobox('getValue');
    var postStatus = $(el.postStatus).combobox('getValue');
    var voucherYear = $(el.voucherYear).combobox('getValue');
    var ids = $(el.id).val();
    if(!invoiceVoucher){
        topWin.layer.alert('请填写MIRO凭证号', {icon: 0});
        return false;
    }
    // if(!invoicePostDate){
    //     topWin.layer.alert('请填写发票过账日期', {icon: 0});
    //     return false;
    // }
    if(!paymentExpireDate){
        topWin.layer.alert('请填写付款到期日', {icon: 0});
        return false;
    }
    if(isBlank(postStatus)){
        topWin.layer.alert('请填写过账状态', {icon: 0});
        return false;
    }
    var param = {
        invoiceVoucher : invoiceVoucher,
        // invoicePostDate : invoicePostDate,
        paymentExpireDate : paymentExpireDate,
        postStatus : postStatus,
        voucherYear : voucherYear,
        // statementType : statementType,
        ids:ids
    }
    call(param);
}
