本文主要是介绍转下一步时对费用报销单检测明细grid中不能为空,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
加入日期判断,仅对新发起的报销单进行检测,不影响未走完的流程.
function UserDefineDjSave()
{
//add by tzjly
if((sys_getAppAppCurDisposeName()=="事业部总经理级")&&(radioQQ.value==""))
{
return "请选择“是否质量费用”!";
}
if (combobox3.value == "") { return "请在费用类型下拉框选择是否车贴!"; }
if (cmbPeriod.value == "") { return "期间不允许为空,请选择。"; }
if(dataset2.RecordCourt == "0") { return "请填写费用细目!"; }
if(txtDeptID.value == "" && txtRegCode.value =="" && txtProjectID.value == "") { return "归属部门不能都为空!"; }
dataset2.Update('不检查');
if(dataset2.RecordCount==0) {return "请输入费用细目"; }
var Year = txtYear.value;
var DeptID = txtDeptID.value;
var ProjectID = "";//txtProjectID.value;
var RegCode = "";//txtRegCode.value;
var Period = cmbPeriod.value;
var xml="<?xml version=\"1.0\" encoding=\"gb2312\"?><root>";
//---------add by tzjly,仅对新发起的报销单进行检测--
if(txtBaoXiaoShiJian.value>='2012-08-10')
for (var i=0;i<dataset2.RecordCount;i++)
{
var typecode = dataset2.oDom.documentElement.childNodes(i).childNodes(2).text;
var itemcode = dataset2.oDom.documentElement.childNodes(i).childNodes(4).text;
var money = dataset2.oDom.documentElement.childNodes(i).childNodes(5).text;
var appmoney = dataset2.oDom.documentElement.childNodes(i).childNodes(6).text;
var BillNum = dataset2.oDom.documentElement.childNodes(i).childNodes(7).text;
var feeDate = dataset2.oDom.documentElement.childNodes(i).childNodes(8).text;
var Remark = dataset2.oDom.documentElement.childNodes(i).childNodes(9).text;
//if(IsSpace(typecode)) { return "费用类型不能为空!"; }
//if(IsSpace(itemcode)) { return "费用科目不能为空!"; }
if(IsSpace(money)) { return "报销金额不能为空!"; }
if(parseFloat(money)<0) { return "报销金额不能小于0!"; }
if(IsSpace(BillNum)) { return "票据张数不能为空!"; }
if(IsSpace(feeDate)) { return "费用产生日期不能为空!"; }
if(IsSpace(Remark)) { return "用途备注不能为空!"; }
if(IsSpace(appmoney)) { appmoney = "0"; }
if(IsSpace(usagemoney)) { usagemoney = "0"; }
xml+= "<record>";
xml+="<Year>"+ Year +"</Year>";
xml+="<Period>"+ Period +"</Period>";
xml+="<DeptID>"+ DeptID +"</DeptID>";
xml+="<ProjectID>"+ ProjectID +"</ProjectID>";
xml+="<RegCode>"+ RegCode +"</RegCode>";
xml+="<TypeCode>"+ typecode +"</TypeCode>";
xml+="<ItemCode>"+ itemcode +"</ItemCode>";
xml+="<OldMoney>"+ appmoney +"</OldMoney>";
xml+="<NewMoney>"+ money +"</NewMoney>";
xml+= "</record>";
}
xml+= "</root>";
var sql = "EXEC [dbo].[Form_pYS_UpdateBudget] '"+xml+"'";
var res = SelectSql(sql,1,-1);
var dom = SetDom(res);
var test = "";
if(dom.documentElement)
{
if(dom.documentElement.xml != "<root></root>")
{
for(var i = 0;i<dom.documentElement.childNodes.length-1;i++)
{
var itemname = dom.documentElement.childNodes(i).childNodes(0).text;
var usagemoney = dom.documentElement.childNodes(i).childNodes(1).text;
test += "科目 [ "+ itemname +" ] 申请超支,当前可用金额为 [ "+ usagemoney +" ]\r\n";
}
}
}
if(test != "")
{
var StopApprove = SqlToField("select value from Form_YS_SystemManage where keyword='StopApprove'");
var name=sys_getAppCurDisposeName();
if(StopApprove == "是" && name=="财务部")
{
return test;
}
//else
//{
//alert(test);
//}
}
return DjSave();
}
这篇关于转下一步时对费用报销单检测明细grid中不能为空的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!