You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/TruckMng/Viewsjs/Comm/MsChFeeAudit.js

144 lines
5.2 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.MsChFeeAudit = function (records, newStatus, waitMsg) {
var jsondata = ConvertRecordsToJsonAll(records);
Ext.Msg.wait(waitMsg);
Ext.Ajax.request({
waitMsg: waitMsg,
url: '/TruckMng/MsChFee/Audit',
scope: this,
params: {
newStatus: newStatus,
list: 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('FeeStatus', newStatus);
record.set('FeeStatus_Ref', newStatusRef);
record.commit();
}
////////////////
/* if (newStatus == 8 || newStatus == 9)
for (var i = 0; i < records.length; i++) {
var record = records[i];
Ext.Ajax.request({ //
waitMsg: '正在生成结算...',
url: '/Import/CWSettlement/Settlement',
params: {
newStatus: newStatus,
GId: record.get('GId')
},
callback: function (_count) {
//alert('初始化完成');
},
scope: this
});
} //request over*/
///////////////////////
// , FeeStore, Bsno
// if (FeeStore && Bsno) {
// FeeStore.load({ params: { condition: "Bsno='" + Bsno + "' " } });
// }
//.initdata
// if (initdata) {
// initdata();
// }
} 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.CheckChFeeDelete = function (records) {
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FeeStatus;
var canDelete = feeStatus == 1 || feeStatus == 6;
if (canDelete == false) {
Ext.Msg.show({
title: '提示',
msg: '只能删除费用状态为[录入状态]和[驳回提交]的费用,请重新选择',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
return false;
}
if (canDelete) {
if (parseFloat(rec.data.Invoice) != 0 && typeof (rec.data.Invoice) != "undefined" ) {
Ext.Msg.show({ title: '提示', msg: '已开发票不能删除', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已开出发票无法删除!'
return false;
}
}
if (canDelete) {
if (rec.data.OrderAmount != 0 && typeof (rec.data.OrderAmount) != "undefined" ) {
Ext.Msg.show({ title: '提示', msg: '已做(收费申请或付费申请)不能删除', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已申请费用无法删除!'
return false;
}
}
if (canDelete) {
if (rec.data.OrderInvoice != 0 && typeof (rec.data.OrderInvoice) != "undefined" ) {
Ext.Msg.show({ title: '提示', msg:'已申请开票,不能删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已申请开票无法删除!'
return false;
}
}
if (canDelete) {
if (rec.data.IsDebit == 'True' || rec.data.IsDebit == '1') {
Ext.Msg.show({ title: '提示', msg:'已对账,不能删除费用', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已対帐无法删除!'
return false;
}
}
}
return true;
}/*,
DsTruck.CheckFinanceInsert = function (records) {
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var FinanceStatus = rec.data.FinanceStatus;
var canInsert = feeStatus == 0 || feeStatus == 1;
if (canInsert == false) {
Ext.Msg.show({
title: '提示',
msg: '只能批量保存,请重新选择',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
return false;
}
}
return true;
}*/