日期:2014-05-18 浏览次数:20705 次
function checeAddInvoice(id) {
var contract_id = id;
var money=document.getElementById("invoice_money").value;
$.ajax({
type : "POST",
url : "${pageContext.request.contextPath}/checkAddInvoice.action",
data : "contract_id=" + contract_id+"&money="+money,
async : false,
success : function(data) {
if (data == "true") {
layer.msg('正在添加,请稍后...');
document.getElementById("form2").submit(); //提交form2表单后,跳转后的页面并没有立即显示刚刚新增的发票数据
} else {
$.layer({
shade : [ 0.5, '#000', true ],
area : [ 'auto', 'auto' ],
dialog : {
msg : '添加金额已超过合同金额,是否添加并更新合同总额?',
btns : 2,
type : 4,
btn : [ '更新', '不更新', ],
yes : function() {
layer.msg('您选择了继续添加', 2, 1);
},
no : function() {
layer.msg('取消了', 2, 4);
}
}
});
}
}
});
};
<form id="form2" method="post" action="insertInvoice.action">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="hidden" name="invoice.contract_id"
value="${contract1.contract_id}"> <input type="hidden"
name="invoice.customer_id" value="${contract1.customer_id}">
<input type="hidden" name="type" value="2">
  发票号码: <input type="text" size="40"
name="invoice.invoice_number">   开票时间: <input
name="invoice.invoice_time" type="text" class="Wdate"
onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
  开票金额: <input id="invoice_money" type="text" size="20"
name="invoice.invoice_money">  <input type="button"
onclick="checeAddInvoice('${contract1.contract_id}')"
value="添加发票" />
</td>
</tr>
</table>
</form>