Ext.namespace('DsTruck'); DsTruck.GetDirty = function (store1, Delstore1) { var changelines = store1.getModifiedRecords(); var delcount = Delstore1.length; var changecount = changelines.length; if (delcount == 0 && changecount == 0) { return false; } else { return true; } } DsTruck.GetDirty1 = function (store1) { var changelines = store1.getModifiedRecords(); var changecount = changelines.length; if (changecount == 0) { return false; } else { return true; } } DsTruck.GLFYAudit = function (records, newStatus, waitMsg) { var jsondata = ConvertRecordsToJsonAll(records); Ext.Msg.wait(waitMsg); Ext.Ajax.request({ waitMsg: waitMsg, url: '/Account/AccountAudit/Audit', scope: this, async: false, params: { newStatus: newStatus, chfeelist: jsondata }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var newStatusRef = jsonresult.Data; for (var i = 0; i < records.length; i++) { var record = records[i]; record.set('BXSTATUS', newStatus); //record.set('FeeStatus_Ref', newStatusRef); record.commit(); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } Ext.define('Accitemsmb', { extend: 'Ext.data.Model', idProperty: 'GID', fields: [ { name: 'GID', type: 'string' }, { name: 'ACCID', type: 'string' }, { name: 'ACCNAME', type: 'string' }, { name: 'ACCIDNAME', type: 'string' }, { name: 'DC', type: 'string' }, { name: 'ISFCY', type: 'string' }, { name: 'REMARKS', type: 'string' }, { name: 'DETAILED', type: 'string' } ] }); DsTruck.newID = function () { var guid = ""; for (var i = 1; i <= 32; i++) { var n = Math.floor(Math.random() * 16.0).toString(16); guid += n; if ((i == 8) || (i == 12) || (i == 16) || (i == 20)) guid += "-"; } return guid.toUpperCase(); } Ext.define('CMBmb', { extend: 'Ext.data.Model', fields: [ { type: 'string', name: 'id' }, { type: 'string', name: 'name' } ] }); Ext.define('MsOpFeeAmend', { extend: 'Ext.data.Model', idProperty: 'GID', fields: [ { name: 'GID', type: 'string' }, { name: 'BSNO', type: 'string' }, { name: 'AMENDNO', type: 'string' }, { name: 'PARENTID', type: 'string' }, { name: 'FEESTATUS', type: 'boolean', convert: function (v) { return v === '1'; } }, { name: 'FEESTATUSREF', type: 'string' }, { name: 'ACCDATE', type: 'date', dateFormat: 'Y-m' }, { name: 'REASON', type: 'string' }, { name: 'REMARKS', type: 'string' }, { name: 'SALE', type: 'string' }, { name: 'BillFeeStatus', type: 'string' }, { name: 'CREATEUSER', type: 'string' }, { name: 'CREATETIME', type: 'string' } ] }); Ext.define('AuthorityRangemb', { extend: 'Ext.data.Model', idProperty: 'GID', fields: [ { name: 'GID', type: 'string' }, { name: 'VISIBLERANGE', type: 'string' }, { name: 'OPERATERANGE', type: 'string' } ] }); //审核报销单 报销单审核 DsTruck.BaoxiaoAudit = function (records, newStatus,WorkFlowName, waitMsg,Reason) { var jsondata = ConvertRecordsToJsonAll(records); Ext.Msg.wait(waitMsg); Ext.Ajax.request({ waitMsg: waitMsg, url: '/OA/BaoxiaoAudit/Audit', scope: this, async: false, params: { newStatus: newStatus, WorkFlowName: WorkFlowName, Reason:Reason, chfeelist: jsondata }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var newStatusRef = jsonresult.Data; for (var i = 0; i < records.length; i++) { var record = records[i]; record.set('BXSTATUS', newStatus); record.set('BXSTATUS_REF', newStatusRef); record.commit(); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } //借款单审核 DsTruck.JKAudit = function (records, newStatus, waitMsg) { var jsondata = ConvertRecordsToJsonAll(records); Ext.Msg.wait(waitMsg); Ext.Ajax.request({ waitMsg: waitMsg, url: '/OA/Jiekuan/Audit', scope: this, async: false, params: { newStatus: newStatus, chfeelist: jsondata }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var newStatusRef = jsonresult.Data; for (var i = 0; i < records.length; i++) { var record = records[i]; record.set('JKSTATUS', newStatus); record.set('JKSTATUS_REF', newStatusRef); record.commit(); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } //设定挂账的费用 DsTruck.SetGZ = function (BXGID) { //var jsondata = ConvertRecordsToJsonAll(records); Ext.Msg.wait(""); } Ext.define('SumDetail', { extend: 'Ext.data.Model', idProperty: 'SUM1', fields: [ { name: 'SUM1', type: 'string' }, { name: 'SUM2', type: 'string' }, { name: 'SUM3', type: 'string' }, { name: 'SUM4', type: 'string' }, { name: 'SUM5', type: 'string' }, { name: 'SUM6', type: 'string' }, { name: 'SUM7', type: 'string' }, { name: 'SUM8', type: 'string' }, { name: 'SUM9', type: 'string' }, { name: 'SUM10', type: 'string' } ] }); DsTruck.CheckBaoxiaoDelete = function (records) { for (var i = 0; i < records.length; i++) { var rec = records[i]; var BXSTATUS = rec.data.BXSTATUS; var canDelete = BXSTATUS == 1 || BXSTATUS == 6; if (canDelete == false) { Ext.Msg.show({ title: '提示', msg: '只能删除费用状态为[录入状态]和[驳回提交]的报销单,请重新选择', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return false; } } return true; } DsTruck.trimdata= function (value) { if (value == "") { return "0"; } else return value; } round2 = function (str, length) { var r2 = parseFloat(str).toFixed(8); //var r2 = parseFloat(str).toFixed(parseInt(length) + 1); var r1 = parseFloat(r2).toFixed(parseInt(length)); //str = parseFloat(str).toFixed(parseInt(length)); return r1; } /* Number.prototype.toFixed = function (len) { var add = 0; var s, temp; var s1 = this + ""; var start = s1.indexOf("."); if (start >= 0) { s1 = s1 + "0"; if (s1.substr(start + len + 1, 1) >= 5) add = 1; var temp = Math.pow(10, len); s = Math.floor(this * temp) + add; return s / temp; } else return this; } //除法函数,用来得到精确的除法结果 //说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。 //调用:accDiv(arg1,arg2) //返回值:arg1除以arg2的精确结果 function accDiv(arg1, arg2) { var t1 = 0, t2 = 0, r1, r2; try { t1 = arg1.toString().split(".")[1].length } catch (e) { } try { t2 = arg2.toString().split(".")[1].length } catch (e) { } with (Math) { r1 = Number(arg1.toString().replace(".", "")) r2 = Number(arg2.toString().replace(".", "")) return (r1 / r2) * pow(10, t2 - t1); } } //给Number类型增加一个div方法,调用起来更加方便。 Number.prototype.div = function (arg) { return accDiv(this, arg); } //乘法函数,用来得到精确的乘法结果 //说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。 //调用:accMul(arg1,arg2) //返回值:arg1乘以arg2的精确结果 function accMul(arg1, arg2) { var m = 0, s1 = arg1.toString(), s2 = arg2.toString(); try { m += s1.split(".")[1].length } catch (e) { } try { m += s2.split(".")[1].length } catch (e) { } return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m) } //给Number类型增加一个mul方法,调用起来更加方便。 Number.prototype.mul = function (arg) { return accMul(arg, this); } //加法函数,用来得到精确的加法结果 //说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。 //调用:accAdd(arg1,arg2) //返回值:arg1加上arg2的精确结果 function accAdd(arg1, arg2) { var r1, r2, m; try { r1 = arg1.toString().split(".")[1].length } catch (e) { r1 = 0 } try { r2 = arg2.toString().split(".")[1].length } catch (e) { r2 = 0 } m = Math.pow(10, Math.max(r1, r2)) return (arg1 * m + arg2 * m) / m } //给Number类型增加一个add方法,调用起来更加方便。 Number.prototype.add = function (arg) { return accAdd(arg, this); } function Add(a, b, length) { if ((typeof(length) == undefined) || (length == null)){ length=2; } var _r = parseFloat(a).add(parseFloat(b)).toFixed(parseInt(length)); return parseFloat(_r); } function Cut(a, b, length) { if ((typeof (length) == undefined) || (length == null)) { length = 2; } var _r = parseFloat(a).add(parseFloat(0) - parseFloat(b)).toFixed(parseInt(length)); return parseFloat(_r); } function Mul(a, b, length) { if ((typeof (length) == undefined) || (length == null)) { length = 2; } var _r = parseFloat(a).mul(parseFloat(b)) var _r2 = _r.toFixed(parseInt(length)); return parseFloat(_r2); } function Mul3(a, b,c, length) { if ((typeof (length) == undefined) || (length == null)) { length = 2; } var _r = (parseFloat(a).mul(parseFloat(b)).mul(parseFloat(c))).toFixed(parseInt(length)); return parseFloat(_r); } function Mul4(a, b, c,d, length) { if ((typeof (length) == undefined) || (length == null)) { length = 2; } var _r = (parseFloat(a).mul(parseFloat(b)).mul(parseFloat(c)).mul(parseFloat(d))).toFixed(parseInt(length)); return parseFloat(_r); } function Mul5(a, b, c,d,e, length) { if ((typeof (length) == undefined) || (length == null)) { length = 2; } var _r = (parseFloat(a).mul(parseFloat(b)).mul(parseFloat(c)).mul(parseFloat(d)).mul(parseFloat(e))).toFixed(parseInt(length)); return parseFloat(_r); } function Div(a, b, length) { if ((typeof (length) == undefined) || (length == null)) { length = 2; } var _r = parseFloat(a).div(parseFloat(b)).toFixed(parseInt(length)); return parseFloat(_r); } */ function getUrlParam(param) { var params = Ext.urlDecode(location.search.substring(1)); return param ? params[param] : params; } //在js中获取当前日期(参数0)或当前日期前后某天(参数1为后一天,-2为两天前) function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth() + 1; //获取当前月份的日期 var d = dd.getDate(); return y + "-" + m + "-" + d; }