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.

2726 lines
103 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//2013-03-15 删除固定费用
Ext.namespace('DsTruck');
DsTruck.MsWlBsCtnEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsWlBsCtnEdit.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsWlBsCtnEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
initUIComponents: function () {
this.ctnSerialNo = 0;
this.ctnBodyDel = [];
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.Audit = false;
//#region 编辑Form
Ext.define('DsShipping.ux.OpDefValue', {
extend: 'Ext.data.Model',
fields: [
{ name: 'FIELDNAME', type: 'string' },
{ name: 'DEFVALUE', type: 'string' },
{ name: 'ISMUST', type: 'string' },
{ name: 'ISCOLOR', type: 'string' },
{ name: 'ISREADONLY', type: 'string' }
]
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeFeeTemplateDetail = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'TEMPLATEID', type: 'string' },
{ name: 'UNIT', type: 'string' },
{ name: 'UNITTYPE', type: 'string' },
{ name: 'UNITPRICE', type: 'number' },
{ name: 'STARTWEIGHT', type: 'number' },
{ name: 'ENDWEIGHT', type: 'number' },
{ name: 'CREATEUSER', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'REMARK', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCustTruckFeeTemplate/GetBodyList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
//枚举参照相关(编辑form)
this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBsType.load({ params: { enumTypeId: 99025} });
this.comboxBsType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '托单类型',
store: this.storeBsType,
name: 'BsType'
});
//表参照相关(编辑form)
this.storeCustContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomContactRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomContactList' }
});
this.comboxCustContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户联系人',
store: this.storeCustContact,
name: 'CustLikeManName',
valueField: 'Name',
displayField: 'Name',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeCustContact, 'Name', records[0].data.Name);
var custTel = this.formEdit.getForm().findField('CustTel');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custTel.setValue(data.Tel);
} else {
custTel.setValue('');
}
}
}
}
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
this.storeCustCode.load();
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位代码',
typeAhead: true,
store: this.storeCustCode,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'CustCode',
valueField: 'CustCode',
displayField: 'CodeAndFull',
//queryMode: 'remote',
// displayTpl: Ext.create('Ext.XTemplate',
// '<tpl for=".">',
// '{CustCode}-{CustName}',
// '</tpl>'
// ),
// tpl: Ext.create('Ext.XTemplate',
// '<tpl for=".">',
// '<div class="x-boundlist-item">{CustCode} - {CustName}</div>',
// '</tpl>'
// ),
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeCustCode, 'CustCode', records[0].data.CustCode);
var custname = this.formEdit.getForm().findField('CustName');
var custLikeManName = this.formEdit.getForm().findField('CustLikeManName');
var custTel = this.formEdit.getForm().findField('CustTel');
var billRises1 = this.formEdit.getForm().findField('BillRises1');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custname.setValue(data.CustName);
this.storeCustContact.load({
scope: this,
params: { custCode: data.CustCode },
callback: function (records, operation, success) {
if (success) {
if (records.length > 0) {
var recordData = records[0].data;
custLikeManName.setValue(recordData.Name);
custTel.setValue(recordData.Tel);
billRises1.setValue(recordData.BillRises1);
} else {
custLikeManName.setValue('');
custTel.setValue('');
billRises1.setValue('');
}
} else {
custLikeManName.setValue('');
custTel.setValue('');
}
}
});
this.getContractNo();
}
else //if (recs.getCount() > 0)
{
custname.setValue('');
custLikeManName.setValue('');
custTel.setValue('');
}
}
}
}
});
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.VoyRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetVoyRefList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船名航次',
store: this.storeVoyVeg,
name: 'VoyVeg',
valueField: 'VoyCode',
displayField: 'CodeAndName'
});
this.comboxVoyVegSe = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '二程船名航次',
store: this.storeVoyVeg,
name: 'VoyVegSe',
valueField: 'VoyCode',
displayField: 'CodeAndName'
});
this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSalesCode.load({ params: { condition: ""} });
this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSalesCode,
name: 'SalesCode',
valueField: 'UserCode',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSalesCode, 'UserCode', records[0].data.UserCode);
var custname = this.formEdit.getForm().findField('SalesName');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custname.setValue(data.UserName);
} else {
custname.setValue('');
}
}
}
}
});
this.storeDispatchCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeDispatchCode.load({ params: { condition: ""} });
this.comboxDispatchCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '调度员',
store: this.storeDispatchCode,
name: 'DispatchCode',
valueField: 'UserCode',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeDispatchCode, 'UserCode', records[0].data.UserCode);
var custname = this.formEdit.getForm().findField('DispatchName');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custname.setValue(data.UserName);
} else {
custname.setValue('');
}
}
}
}
});
this.storeSendYardCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeSendYardCode.load({ params: { condition: "ISYARD='1'"} });
this.comboxSendYardCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '拖箱场站编码',
store: this.storeSendYardCode,
name: 'SendYardCode',
valueField: 'CustCode',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSendYardCode, 'CustCode', records[0].data.CustCode);
var custname = this.formEdit.getForm().findField('SendYardName');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custname.setValue(data.CustName);
} else {
custname.setValue('');
}
}
}
}
});
//品名
Ext.define('DsShipping.ux.CodeGoodsModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'CodeAndName', type: 'string' },
{ name: 'GOODNAME', type: 'string' },
{ name: 'GOODCODE', type: 'string' },
{ name: 'GoodsTypeGID', type: 'string' },
{ name: 'GoodsTypeName', type: 'string' }
]
});
//品名
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeGoodsModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeGoodsListRm' }
});
this.storeCodeGoodsList.load();
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'GoodsName',
valueField: 'GOODNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.getContractNo();
}
}
}
});
this.storeListGetContract = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'LINKID', type: 'string' },
{ name: 'CONTRACTNO', type: 'string' },
{ name: 'SIGNINGDATE', type: 'string' },
{ name: 'STARTDATE', type: 'string' },
{ name: 'CANCELDATE', type: 'string' },
{ name: 'CHIEF', type: 'string' },
{ name: 'REMARK', type: 'string' },
{ name: 'CORPID', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetContractDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxContract = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGetContract,
// forceSelection: true,
fieldLabel: '合同号', //'费用类型',
valueField: 'CONTRACTNO',
name: 'CONTRACTNO',
displayField: 'CONTRACTNO',
listeners: {
scope: this,
'focus': function (combo, records, eOpts) {
var custname = this.formEdit.getForm().findField('CustName').getValue();
if (custname != '') {
var sql = "LINKID in (select GID FROM INFO_CLIENT WHERE SHORTNAME='" + custname + "')";
this.storeListGetContract.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
}
}
});
this.storeListFeeTemplate = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'LINKID', type: 'string' },
{ name: 'CONTRACTNO', type: 'string' },
{ name: 'TEMPLATENAME', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'GOODNAME', type: 'string' },
{ name: 'TRANTYPE', type: 'string' },
{ name: 'LOADPORT', type: 'string' },
{ name: 'DISTPORT', type: 'string' },
{ name: 'CREATEUSER', type: 'string' },
{ name: 'CREATEUSERREF', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'CORPID', type: 'string' },
{ name: 'REMARK', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCustTruckFeeTemplate/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxFeeTemplate = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListFeeTemplate,
// forceSelection: true,
fieldLabel: '计费方案', //'费用类型',
valueField: 'TEMPLATENAME',
name: 'TEMPLATENAME',
displayField: 'TEMPLATENAME',
listeners: {
scope: this,
'focus': function (combo, records, eOpts) {
var CONTRACTNO = this.formEdit.getForm().findField('CONTRACTNO').getValue();
if (CONTRACTNO != '') {
var sql = " CONTRACTNO='" + CONTRACTNO + "' and TRANTYPE='集装箱' and BSSTATUS='审核通过'";
this.storeListFeeTemplate.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
} else this.storeListFeeTemplate.removeAll();
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CONTRACTNO = this.formEdit.getForm().findField('CONTRACTNO').getValue();
var s = " TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + combo.value + "' and CONTRACTNO='" + CONTRACTNO + "')";
this.storeFeeTemplateDetail.load({
params: { condition: s },
scope: this
});
this.formEdit.getForm().findField('PORTLOAD').setValue(records[0].data.LOADPORT);
this.formEdit.getForm().findField('DstArea').setValue(records[0].data.DISTPORT);
this.formEdit.getForm().findField('GoodsName').setValue(records[0].data.GOODNAME);
}
}
}
});
this.storeListTruckLoadPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckLoadPort.load();
this.comboxLoadPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '启运地', //'费用类型',
store: this.storeListTruckLoadPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'PORTLOAD',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.getContractNo();
}
}
}
});
this.storeListTruckDistPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckDistPort.load();
this.comboxDistPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地', //'费用类型',
store: this.storeListTruckDistPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'DstArea',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.getContractNo();
}
}
}
});
this.storeISFEE = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISFEE.add({ "FSTATUS": "1", "NAME": "是" });
this.storeISFEE.add({ "FSTATUS": "0", "NAME": "否" });
this.comboxISFEE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否生成费用', //是否开垫付
store: this.storeISFEE,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISFEE',
readOnly:true,
value: '',
enableKeyEvents: true
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '录入日期',
name: 'LrDate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '记账日期',
name: 'JzDate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '用户编码',
name: 'UserCode', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '用户姓名',
name: 'UserName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '组织编码',
name: 'OrgCode', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '组织名称',
name: 'OrgName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '委托单位',
name: 'CustName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '揽货人姓名',
name: 'SalesName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '调度员姓名',
name: 'DispatchName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '拖箱场站',
name: 'SendYardName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '返箱场站编码',
name: 'RtnYardCode', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '返箱场站',
name: 'RtnYard', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '单据锁定状态',
name: 'BillStatus', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用锁定状态',
name: 'FeeStatus', flex: 0, hidden: true, margins: '0'
}, { fieldLabel: 'GId',
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '时间戳',
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '发票抬头',
name: 'BillRises1', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '物流号',
allowBlank: false,
disabled: true,
name: 'BillNo'
}, {
fieldLabel: '订单状态',
readOnly: true,
name: 'TRANSSTATUS',
value: '新建'
},this.comboxBsType, this.comboxCustCode
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '客户订单号',
readOnly: false,
name: 'ORDERNO'
}, this.comboxCustContact, {
fieldLabel: '客户联系人电话',
name: 'CustTel'
}, this.comboxGOODSNAME//, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxLoadPort, this.comboxDistPort,this.comboxContract, this.comboxFeeTemplate//, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '要求起运日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'NeadLoadDate'
}, {
fieldLabel: '要求到达日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'NeedArriveDate'
}, this.comboxSalesCode, {
fieldLabel: '委托日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate'
}//{ xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '截港日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EndPortDate'
}, {
fieldLabel: '开船(到港)日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EtDate'
}, this.comboxVoyVeg, {
fieldLabel: '提单号',
name: 'MblNo'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxDispatchCode, this.comboxSendYardCode, {
fieldLabel: '工厂地址',
flex: 2,
name: 'DetiNation'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '工厂联系电话',
name: 'DetiLinkTel'
}, {
fieldLabel: '工厂联系人',
name: 'DetiLinkMan'
}, this.comboxISFEE, {
fieldLabel: '重量',
name: 'CtnInfo'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textarea',
height: 40,
items: [{
fieldLabel: '备注',
height:40,
name: 'Remark'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'bsbtnSave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'bsbtnSaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
id: 'bsbtnSaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditBsClick();
},
scope: this
}, {
id: 'btnSubmitAuditBack',
text: '撤销提交',
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackBsClick();
},
scope: this
}, '-', {
id: 'btnAudit',
text: '审核通过',
tooltip: '审核通过',
handler: function (button, event) {
this.onAuditBsClick();
},
scope: this
},
{
text: "驳回提交",
id: 'btnAuditBack',
iconCls: "btndelete",
handler: function (button, event) {
var billstatus = this.formEdit.getForm().findField('TRANSSTATUS').getValue();
if ((billstatus != "提交审核") && (billstatus != "审核通过")) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.winAuditBackShow.show();
},
scope: this
},
// {
// text: "派车",
// handler: function (button, event) {
// this.DispatchTruck();
// },
// scope: this
// },
'-',
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
},
{
id: 'bsbtnNew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('BillNo').setDisabled(false);
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}
// , {xtype: 'label',
// text: '<span style="color:green;">' + '单据已锁定' + '</span>',
// style: {
// width: '95%',
// marginBottom: '10px'
// }
// }
// ,
// {
// text: "Test",
// handler: function (button, event) {
// for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
// var member = this.storeBodyFix.getAt(i);
// member.set("BillNo", this.editRecord.get('BillNo'));
// member.commit();
// };
// var removeRecords = this.storeBodyFix.getRemovedRecords();
// for (var i = 0; i < removeRecords.length; i++) {
// var memberyf = removeRecords[i];
// };
// },
// scope: this
// }
]
}); //end 按钮Toolbar
//#endregion
//#region 集装箱部分
//明细表表格相关
this.storeContainerTypeRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CtnRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnRefList' }
});
this.storeContainerTypeRef.load({ params: { condition: ""} });
this.comboxContainerTypeRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeContainerTypeRef,
name: 'ContainerType',
valueField: 'CtnName',
displayField: 'CtnName'
});
this.storeBodyCtn = Ext.create('Ext.data.Store', {
model: 'MsWlBsCtn',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlBs/GetCtnBodyList',
reader: {
id: 'BillNo,SerialNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditingCtn = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListCtn = new Ext.grid.GridPanel({
title: '托单集装箱信息',
store: this.storeBodyCtn,
plugins: [this.cellEditingCtn],
enableHdMenu: false,
region: 'east',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
width: 420,
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
id: 'btnadddetail',
handler: function (button, event) {
this.onAddDetailClick(button, event, '0');
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
id: 'btndeletedetail',
handler: function (button, event) {
this.onDelDetailClick(button, event, '0');
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'BillNo',
header: '单据号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'ORUNITPRICE',
header: 'ORUNITPRICE',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'ORFREIGHT',
header: 'ORFREIGHT',
hidden: true,
width: 120
}, {
dataIndex: "SerialNo",
header: "序号",
width: 40
}, {
sortable: true,
dataIndex: 'ContainerType',
header: '箱型',
// renderer: function (value, p, record) {
// if (value == null || value == '')
// return '';
// else
// return value + '-' + record.data.ContainerType_Ref;
// },
editor: this.comboxContainerTypeRef,
width: 50
}, {
sortable: true,
dataIndex: 'ContainerQty',
header: '箱量',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 50
}, {
sortable: true,
dataIndex: 'PCQTY',
header: '已派车箱量',
width: 80
}, {
sortable: true,
dataIndex: 'UNITPRICE',
header: '单价',
editor: {
xtype: 'numberfield',
// allowBlank: false,
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'FREIGHT',
header: '运费合计',
editor: {
xtype: 'numberfield',
// allowBlank: false,
selectOnFocus: true
},
width: 100
}
]
});
this.gridListCtn.on('edit', function (editor, e, eOpts) {
this.gridListCtnAfterEdit(editor, e, eOpts);
}, this);
//#endregion 集装箱部分定义
//#region 固定费用明细表(删除)
// //明细表表格相关
// this.storeCreditDebitRef = Ext.create('DsExt.ux.RefEnumStore', {});
// this.storeCreditDebitRef.load({ params: { enumTypeId: 99020} });
// this.comboxCreditDebitRef = Ext.create('DsExt.ux.RefEnumCombox', {
// store: this.storeCreditDebitRef,
// name: 'CreditDebit'
// });
// this.storeFeeTypeCodeRef = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsTruckMng.ux.FeeTypeRefModel',
// proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
// });
// this.storeFeeTypeCodeRef.load({ params: { condition: "ISTRUCKING='1' and ISTRUCKINGFIXED ='1'"} });
// this.comboxFeeTypeCodeRef = Ext.create('DsExt.ux.RefTableCombox', {
// store: this.storeFeeTypeCodeRef,
// name: 'FeeTypeCode',
// valueField: 'FeeCode',
// displayField: 'CodeAndName'
// });
// //明细表-数据集
// this.storeBodyFix = Ext.create('Ext.data.Store', {
// model: 'MsWlBsFixed',
// remoteSort: true,
// proxy: {
// type: 'ajax',
// url: '/TruckMng/MsWlBs/GetFeeBodyList',
// reader: {
// id: 'BillNo,SerialNo',
// root: 'data',
// totalProperty: 'totalCount'
// }
// }
// });
// //明细表表格
// this.cellEditingFix = Ext.create('Ext.grid.plugin.CellEditing', {
// id: 'cellEditingFix',
// clicksToEdit: 1
// });
// this.gridListFix = new Ext.grid.GridPanel({
// store: this.storeBodyFix,
// enableHdMenu: false,
// region: 'center',
// loadMask: { msg: "数据加载中,请稍等..." },
// trackMouseOver: true,
// disableSelection: false,
// plugins: [this.cellEditingFix],
// selType: 'cellmodel',
// tbar: [{
// text: '增加明细',
// tooltip: '增加明细',
// iconCls: "btnadddetail",
// handler: function (button, event) {
// this.onAddDetailClick(button, event, '1');
// },
// scope: this
// }, '-', {
// text: '删除明细',
// tooltip: '删除明细',
// iconCls: "btndeletedetail",
// handler: function (button, event) {
// this.onDelDetailClick(button, event, '1');
// },
// scope: this
// }],
// columns: [{
// sortable: true,
// dataIndex: 'BillNo',
// header: '单据号',
// hidden: true,
// width: 120
// }, {
// sortable: true,
// hidden: true,
// dataIndex: 'SerialNo',
// header: '序号',
// width: 40
// }, {
// sortable: true,
// dataIndex: 'FeeTypeCode',
// header: '费用编码',
// renderer: function (value, p, record) {
// if (value == null || value == '')
// return '';
// else
// return value + '-' + record.data.FeeTypeCode_Ref;
// },
// editor: this.comboxFeeTypeCodeRef,
// width: 80
// }, {
// sortable: true,
// dataIndex: 'FeeTypeName',
// header: '费用名称',
// hidden: true,
// width: 120
// }, {
// sortable: true,
// dataIndex: 'FsTotal',
// header: '金额',
// editor: {
// xtype: 'numberfield',
// allowBlank: false,
// selectOnFocus: true
// },
// width: 60
// }, {
// sortable: true,
// dataIndex: 'Remark',
// header: '备注',
// editor: {
// xtype: 'textfield',
// selectOnFocus: true
// },
// width: 150
// }
// // , {
// // sortable: true,
// // dataIndex: 'CreditDebit',
// // header: '收付方式',
// // renderer: function (value, p, record) {
// // if (value == null || value == '')
// // return '';
// // else
// // return value + '-' + record.data.CreditDebit_Ref;
// // },
// // editor: this.comboxCreditDebitRef,
// // width: 80
// // }
// ]
// });
// this.gridListFix.on('edit', function (editor, e, eOpts) {
// this.gridListFixAfterEdit(editor, e, eOpts);
// }, this);
// this.cellEditingFix.on('beforeedit', function (editor, e) {
// return this.cellEditingFixBeforeEdit(editor, e);
// }, this);
//#endregion
//#region 费用表
//明细表表格相关
//this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
//this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
//this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
// store: this.storeFeeTypeRef,
// name: 'FeeType'
//});
//this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsTruckMng.ux.FeeTypeRefModel',
// proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
//});
//this.storeFeeNameRef.load({ params: { condition: "ISTRUCKING='1' "} });
//this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
// store: this.storeFeeNameRef,
// name: 'FeeName',
// valueField: 'Name',
// displayField: 'CodeAndName'
//});
//this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsTruckMng.ux.CustomRefModel',
// proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
//});
//this.storeCustomerNameRef.load({ params: { condition: ""} });
//this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
// store: this.storeCustomerNameRef,
// name: 'CustomerName',
// valueField: 'CustName',
// displayField: 'CodeAndName'
//});
////明细表-数据集
//this.storeBodyChFee = Ext.create('Ext.data.Store', {
// model: 'MsChFee',
// remoteSort: false,
// proxy: {
// type: 'ajax',
// url: '/TruckMng/MsChFee/GetDataList',
// reader: {
// id: 'GId',
// root: 'data',
// totalProperty: 'totalCount'
// }
// }
//});
////明细表表格
//this.cellEditingChFee = Ext.create('Ext.grid.plugin.CellEditing', {
// clicksToEdit: 1
//});
//this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//this.gridListChFee = new Ext.grid.GridPanel({
// store: this.storeBodyChFee,
// enableHdMenu: false,
// region: 'center',
// loadMask: { msg: "数据加载中,请稍等..." },
// trackMouseOver: true,
// disableSelection: false,
// plugins: [this.cellEditingChFee],
// selModel: this.feeGridCheckBoxModel,
// selType: 'cellmodel',
// viewConfig: {
// autoFill: true,
// enableTextSelection: true,
// getRowClass: function (record, rowIndex, rowParams, store) {
// var feeStatus = record.get('FeeStatus');
// return DsTruck.MsChFeeGetRowClass(feeStatus);
// }
// },
// tbar: [{
// text: '增加明细',
// tooltip: '增加明细',
// iconCls: "btnadddetail",
// id: 'btnadddetailfee',
// handler: function (button, event) {
// this.onAddDetailClick(button, event, '2');
// },
// scope: this
// }, '-', {
// text: '删除明细',
// tooltip: '删除明细',
// id: 'btndeletedetailfee',
// iconCls: "btndeletedetail",
// handler: function (button, event) {
// this.onDelDetailClick(button, event, '2');
// },
// scope: this
// }, '-', {
// text: '提交审核',
// tooltip: '提交审核',
// id: 'btnsubmitauditfee',
// iconCls: 'btnsubmitaudit',
// handler: function (button, event) {
// this.onSubmitAuditClick(button, event);
// },
// scope: this
// }
// //, '-', {
// // text: '生成运费', //'增加费用明细',
// // id: 'btnCreateFee',
// // tooltip: '生成费用', //'增加费用明细',
// // handler: function (button, event) {
// // this.CreateFee();
// // },
// // scope: this
// //}
// ],
// columns: [{
// sortable: true,
// dataIndex: 'GId',
// header: '惟一编号',
// hidden: true,
// width: 160
// }, {
// sortable: true,
// dataIndex: 'BsNo',
// header: '业务编号',
// hidden: true,
// width: 200
// }, {
// sortable: true,
// dataIndex: 'FeeStatus',
// header: '费用状态',
// renderer: function (value, p, record) {
// return record.data.FeeStatus_Ref;
// },
// width: 66
// }, {
// sortable: true,
// dataIndex: 'FeeName',
// header: '费用名称',
// editor: this.comboxFeeNameRef,
// width: 100
// }, {
// sortable: true,
// dataIndex: 'FeeType',
// header: '收付方式',
// renderer: function (value, p, record) {
// if (value == null || value == '')
// return value;
// else
// return value + '-' + record.data.FeeType_Ref;
// },
// editor: this.comboxFeeTypeRef,
// width: 66
// }, {
// sortable: true,
// dataIndex: 'FeeDescription',
// header: '费用英文名称',
// hidden: true,
// width: 200
// }, {
// sortable: true,
// dataIndex: 'CustomerType',
// header: '客户类别',
// hidden: true,
// width: 200
// }, {
// sortable: true,
// dataIndex: 'CustomerName',
// header: '结算对象',
// editor: this.comboxCustomerNameRef,
// width: 120
// }, {
// sortable: true,
// dataIndex: 'Unit',
// header: '单位标准',
// hidden: true,
// width: 200
// }, {
// sortable: true,
// dataIndex: 'UnitPrice',
// header: '单价',
// editor: {
// xtype: 'numberfield',
// selectOnFocus: true
// },
// width: 60
// }, {
// sortable: true,
// dataIndex: 'Quantity',
// header: '数量',
// editor: {
// xtype: 'numberfield',
// selectOnFocus: true
// },
// width: 60
// }, {
// sortable: true,
// dataIndex: 'Amount',
// header: '金额',
// width: 60
// }, {
// sortable: true,
// dataIndex: 'Remark',
// header: '备注',
// editor: {
// xtype: 'textfield',
// selectOnFocus: true
// },
// width: 150
// }
// ]
//});
//this.gridListChFee.on('edit', function (editor, e, eOpts) {
// this.gridListChFeeAfterEdit(editor, e, eOpts);
//}, this);
//this.cellEditingChFee.on('beforeedit', function (editor, e) {
// return this.cellEditingChFeeBeforeEdit(editor, e);
//}, this);
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 300,
items: [this.panelBtn, this.formEdit, this.gridListCtn]
});
/*
this.panelBodyFix = new Ext.Panel({
title: '协议运费',
layout: "border",
region: 'west',
width: 270,
margin: '5 10',
items: [this.gridListFix]
});*/
//this.panelBodyChFee = new Ext.Panel({
// title: '费用',
// layout: "border",
// region: 'center',
// margin: '5 10',
// items: [this.gridListChFee]
//});
//this.panelFee = new Ext.Panel({
// layout: "border",
// region: "center",
// items: [
// this.panelBodyChFee
// ]
//});
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'tMsWlPcHead';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "F_CustomerName" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.storeFeeNameRef.load({ params: { condition: "ISTRUCKING='1' " } });
Ext.apply(this, {
items: [this.panelTop, this.panelFee]
});
//#endregion
this.formAuditBack = Ext.widget('form', {
frame: true,
region: 'center',
title: "<a href='#'><font color='#FF0000'>驳回原因</font></a>",
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: '',
labelSeparator: '',
labelWidth: 0,
height: 100,
name: 'ORREASON',
anchor: '100%'
}
]//end root items
});
me = this;
this.winAuditBackShow = Ext.create('Ext.window.Window', {
title: "驳回派车申请",
width: 450,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formAuditBack],
buttons: [{
text: "确认驳回",
minWidth: 70,
handler: function () {
var form = me.formAuditBack.getForm();
var ORREASON = form.findField('ORREASON').getRawValue();
if (ORREASON == '' || ORREASON == null || ORREASON == undefined) {
Ext.Msg.show({ title: '提示', msg: '驳回原因为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.onAuditBackBsClick(ORREASON);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditBackShow.close();
}
}]
});
parentWin = window.parent.opener.panelIndex;
if (parentWin == undefined) parentWin = window.parent.opener.pnl;
this.InitData();
this.LoadMustBe();
}, //end initUIComponents
//#region 加载数据
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.Audit = ret[3];
}
if (this.opStatus == 'edit')
condition = " BillNo='" + this.editRecord.get('BillNo') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.ctnSerialNo = 0;
this.ctnBodyDel = [];
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/MsWlBs/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
var recordCustCode = Ext.create('DsTruckMng.ux.CustomRefModel', {
GId: NewGuid(),
CustCode: data.CustCode,
CustName: data.CustName,
CodeAndName: data.CustCode + '-' + data.CustName
});
this.storeCustCode.add(recordCustCode);
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
if (data.BillStatus == '0') {
this.setSaveBtnStatus(true);
} else {
this.setSaveBtnStatus(false);
}
var editp = Ext.create('MsWlBsHead', data);
this.LoadFeeData(editp);
if (data.CONTRACTNO != '' && data.TEMPLATENAME != '') {
var s = " TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + data.TEMPLATENAME + "' and CONTRACTNO='" + data.CONTRACTNO + "' and TRANTYPE='集装箱')";
this.storeFeeTemplateDetail.load({
params: { condition: s },
scope: this
});
}
this.storeCustContact.load({ params: { custCode: data.CustCode} });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BillNo');
gid = this.editRecord.get('GId');
}
this.storeBodyCtn.load({ params: { billno: gid } });
//this.storeBodyFix.load({ params: { billno: gid} });
// this.storeBodyChFee.load({ params: { billno: gid} });
}, // end LoadDate
LoadFeeData: function (EditRecord) {
this.panelFee.EditRecord = EditRecord;
var bsno = EditRecord.get('GId');
this.panelFee.strBSNO = bsno;
this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: bsno } });
this.panelFee.StoreUnit.load({ params: { bsno: bsno, bstype: "tMsWlPcHead" } });
this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: "tMsWlPcHead" } });
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: "tMsWlPcHead" } });
this.panelFee.storeBodySum.load({
params: { bsno: bsno, optype: "tMsWlPcHead" },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: bsno, optype: "tMsWlPcHead" } });
}, // end LoadDate
//#endregion
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
var bodyCtnDatas = [];
var i;
for (i = 0; i < this.storeBodyCtn.getCount(); i += 1) {
var member = this.storeBodyCtn.getAt(i);
bodyCtnDatas.push(member);
};
var jsonCtnBody = ConvertRecordsToJson(bodyCtnDatas);
var jsonCtnDelBody = ConvertRecordsToJsonAll(this.ctnBodyDel);
var bodyFixdatas = [];
var jsonFixBody = ConvertRecordsToJson(bodyFixdatas);
var jsonFixDelBody = ConvertRecordsToJsonAll(this.fixBodyDel);
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlBs/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
ctnbody: jsonCtnBody,
ctndelbody: jsonCtnDelBody,
fixbody: jsonFixBody,
fixdelbody: jsonFixDelBody,
chfeebody: jsonChFeeBody,
chfeedelbody: jsonChFeeDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
//var p = Ext.create('MsWlBsHead', returnData); // Ext.create('WlBsCardHead', data, NewGuid()); //或者new WlBsCardHead(data, NewGuid());
//var p=this.StoreList.add(returnData);
//parentWin.AddNewRecord(returnData);
//this.editRecord = p[0];
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsWlBsHead', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('BillNo').setDisabled(true);
// for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
// var member = this.storeBodyFix.getAt(i);
// member.set("BillNo", this.editRecord.get('BillNo'));
// member.commit();
// };
for (var i = 0; i < this.storeBodyCtn.getCount(); i += 1) {
var member = this.storeBodyCtn.getAt(i);
member.set("BillNo", this.editRecord.get('GId'));
member.commit();
};
for (var i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var member = this.storeBodyChFee.getAt(i);
member.set("BsNo", this.editRecord.get('GId'));
member.commit();
};
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
}
} 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
});
}
}
});
}, //end save
//#region 明细操作
onAddDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 0) {
store = this.storeBodyCtn;
} else if (type == 1) {
store = this.storeBodyFix;
} else if (type == 2) {
store = this.storeBodyChFee;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
if (type == 0) {
record = Ext.create('MsWlBsCtn',
{
GID: NewGuid(),
BillNo: '*',
SerialNo: newSerialno,
ContainerType: '',
ContainerQty: 0
}
);
} else if (type == 1) {
record = Ext.create('MsWlBsFixed', {
GId: NewGuid(),
BillNo: '*',
SerialNo: newSerialno,
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
AuditStatus: 0,
CreditDebit: '2',
CreditDebit_Ref: '应付',
FeeTypeCode: '',
DistCount: 0,
Price: 0,
FsTotal: 0,
JsTotal: 0,
Remark: ''
});
} else if (type == 2) {
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: 1,
FeeType_Ref: '应收',
FeeName: '',
FeeName_Ref: '',
FeeDescription: '',
CustomerType: '',
CustomerName: this.getCustName(),
CustomerName_Ref: '',
Unit: '',
UnitPrice: 0,
Quantity: 1,
Amount: 0,
Currency: 'RMB',
ExChangerate: 1,
Reason: '',
Remark: '',
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: GetCookie_UserId(),
EnterDate: null,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: "0",
IsInvoice: "0",
FeeFrt: '',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: ''
});
}
store.add(record);
var editColumnIndex = 0;
var cellediting = null;
if (type == 0) {
cellediting = this.cellEditingCtn;
editColumnIndex = 2;
} else if (type == 1) {
cellediting = this.cellEditingFix;
editColumnIndex = 2;
} else if (type == 2) {
cellediting = this.cellEditingChFee;
editColumnIndex = 4;
}
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
onSubmitAuditBsClick: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var BSSTATUSREF = this.formEdit.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '新建' && BSSTATUSREF != '' && BSSTATUSREF != '驳回提交') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
var bodyCtnDatas = [];
var i;
for (i = 0; i < this.storeBodyCtn.getCount() ; i += 1) {
var member = this.storeBodyCtn.getAt(i);
bodyCtnDatas.push(member);
};
var jsonCtnBody = ConvertRecordsToJsonAll(bodyCtnDatas);
var jsonCtnDelBody = ConvertRecordsToJsonAll(this.ctnBodyDel);
var bodyFixdatas = [];
var jsonFixBody = ConvertRecordsToJson(bodyFixdatas);
var jsonFixDelBody = ConvertRecordsToJsonAll(this.fixBodyDel);
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount() ; i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({
title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlBsCtn/SubmitAudit',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
ctnbody: jsonCtnBody,
ctndelbody: jsonCtnDelBody,
fixbody: jsonFixBody,
fixdelbody: jsonFixDelBody,
chfeebody: jsonChFeeBody,
chfeedelbody: jsonChFeeDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
//var p = Ext.create('MsWlBsHead', returnData); // Ext.create('WlBsCardHead', data, NewGuid()); //或者new WlBsCardHead(data, NewGuid());
//var p=this.StoreList.add(returnData);
//parentWin.AddNewRecord(returnData);
//this.editRecord = p[0];
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsWlBsHead', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
this.opStatus = 'edit';
basicForm.findField('BillNo').setDisabled(true);
for (var i = 0; i < this.storeBodyCtn.getCount() ; i += 1) {
var member = this.storeBodyCtn.getAt(i);
member.set("BillNo", this.editRecord.get('GId'));
member.commit();
};
//for (var i = 0; i < this.storeBodyChFee.getCount() ; i += 1) {
// var member = this.storeBodyChFee.getAt(i);
// member.set("BsNo", this.editRecord.get('BillNo'));
// member.commit();
//};
this.storeBodyChFee.load({ params: { billno: this.editRecord.get('GId') } });
this.setSaveBtnStatus(false);
} 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
});
}
}
});
}, //end save
onSubmitAuditBackBsClick: function () {
var BSSTATUSREF = this.formEdit.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '提交审核') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlBsCtn/SubmitAuditBack',
scope: this,
params: {
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
var editp = Ext.create('MsWlBsHead', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.opStatus = 'edit';
this.storeBodyChFee.reload();
this.setSaveBtnStatus(false);
} 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
});
}
}
});
}, //end save
onAuditBsClick: function () {
var BSSTATUSREF = this.formEdit.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '提交审核' && BSSTATUSREF != '驳回提交') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlBsCtn/Audit',
scope: this,
params: {
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
var editp = Ext.create('MsWlBsHead', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.opStatus = 'edit';
} 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
});
}
}
});
}, //end save
onAuditBackBsClick: function (reason) {
var BSSTATUSREF = this.formEdit.getForm().findField('TRANSSTATUS').getValue();
if (BSSTATUSREF != '提交审核' && BSSTATUSREF != '审核通过') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法驳回提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlBsCtn/AuditBack',
scope: this,
params: {
data: Ext.JSON.encode(data),
reason:reason
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
var editp = Ext.create('MsWlBsHead', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.opStatus = 'edit';
} 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
});
}
}
});
}, //end save
CreateFee: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var ISFEE = this.formEdit.getForm().findField('ISFEE').getValue();
if (ISFEE == '1') {
Ext.Msg.show({
title: '警告',
msg: '已生成费用,不能重复生成!',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
var bodyCtnDatas = [];
var i;
for (i = 0; i < this.storeBodyCtn.getCount() ; i += 1) {
var member = this.storeBodyCtn.getAt(i);
bodyCtnDatas.push(member);
};
var jsonCtnBody = ConvertRecordsToJsonAll(bodyCtnDatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlBsCtn/CreateFeeDetail',
scope: this,
params: {
data: Ext.JSON.encode(data),
ctnbody: jsonCtnBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
var gid = returnData.GId;
this.storeBodyChFee.load({ params: { billno: gid} });
} 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
});
}
}
});
}, //end save
GetHandleSerialNo: function (store, type) {
var result = 0;
if (type == 0) {
result = this.ctnSerialNo;
} else if (type == 1) {
result = this.fixSerialNo;
} else if (type == 2) {
result = this.feeSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > result) {
result = member.data.SerialNo;
}
}
}
result = result + 1;
if (type == 0) {
this.ctnSerialNo = result;
} else if (type == 1) {
this.fixSerialNo = result;
} else if (type == 2) {
this.feeSerialNo = result;
}
return result;
},
onDelDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 0) {
store = this.storeBodyCtn;
} else if (type == 1) {
store = this.storeBodyFix;
} else if (type == 2) {
store = this.storeBodyChFee;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var result = 0;
if (type == '0') {
result = this.ctnSerialNo;
} else if (type == '1') {
result = this.fixSerialNo;
} else if (type == '2') {
result = this.feeSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > this.giSerialNo) {
result = member.data.SerialNo;
}
}
}
if (type == '0') {
this.ctnSerialNo = result;
} else if (type == '1') {
this.fixSerialNo = result;
} else if (type == '2') {
this.feeSerialNo = result;
}
var selectedRecords = [];
if (type == '0') {
selectedRecords = this.gridListCtn.selModel.getSelection();
} else if (type == '1') {
selectedRecords = this.gridListFix.selModel.getSelection();
} else if (type == '2') {
selectedRecords = this.gridListChFee.selModel.getSelection();
var candelete = DsTruck.CheckChFeeDelete(selectedRecords);
if (candelete == false)
return;
}
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
if (type == '0')
this.ctnBodyDel.push(rec);
else if (type == '1') {
this.fixBodyDel.push(rec);
} else if (type == '2') {
this.feeBodyDel.push(rec);
}
}
if (type == '0') {
this.storeBodyCtn.remove(selectedRecords[i]);
} else if (type == '1') {
this.storeBodyFix.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeBodyChFee.remove(selectedRecords[i]);
}
}
}
},
getAllowOperationDetail: function () {
var feeStatus = this.getFeeStatus();
if (feeStatus == '0')
return true;
else {
Ext.Msg.show({ title: '错误', msg: "费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
},
//#endregion
//#region 表格的AfterEdit
gridListCtnAfterEdit: function (editor, e, eOpts) {
},
gridListFixAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FeeTypeCode') {
var records = DsStoreQueryBy(this.storeFeeTypeCodeRef, 'FeeCode', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('FeeTypeCode_Ref', data.Name);
e.record.set('FeeTypeName', data.Name);
} else {
e.record.set('FeeTypeCode_Ref', '');
e.record.set('FeeTypeName', '');
}
} else if (e.field == 'CreditDebit') {
var recordsCreditDebit = DsStoreQueryBy(this.storeCreditDebitRef, 'EnumValueId', e.value);
if (recordsCreditDebit.getCount() > 0) {
var dataCreditDebit = recordsCreditDebit.getAt(0).data;
e.record.set('CreditDebit_Ref', dataCreditDebit.EnumValueName);
} else {
e.record.set('CreditDebit_Ref', '');
}
}
},
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FeeType') {
var records = DsStoreQueryBy(this.storeFeeTypeRef, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('FeeType_Ref', data.EnumValueName);
} else {
e.record.set('FeeType_Ref', '');
}
} else if (e.field = 'UnitPrice' || e.field == 'Quantity') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
e.record.set('Amount', (unitPrice * quantity).toFixed(2));
}
},
//#endregion
GetBillNo: function () {
if (this.editRecord == null)
return '*';
else {
return this.editRecord.get('BillNo');
}
},
cellEditingFixBeforeEdit: function (editor, e) {
var feeStatus = this.getFeeStatus();
var billStatus = this.getBillStatus();
var canedit = feeStatus == '0' && billStatus == '0';
return canedit;
},
cellEditingChFeeBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
if (canedit) {
var feeStatus = this.getFeeStatus();
var billStatus = this.getBillStatus();
canedit = feeStatus == '0' && billStatus == '0';
}
return canedit;
},
getContractNo: function () {
var CUSTOMERNAME = this.formEdit.getForm().findField('CustName').getValue();
var GOODSNAME = this.formEdit.getForm().findField('GoodsName').getValue();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').getValue();
var PORTDISCHARGE = this.formEdit.getForm().findField('DstArea').getValue();
if (CUSTOMERNAME != '' && GOODSNAME != '' && PORTLOAD != '' && PORTDISCHARGE != '') {
var sql = " CUSTOMERNAME='" + CUSTOMERNAME + "' and GOODNAME='" + GOODSNAME + "' and TRANTYPE='集装箱' and BSSTATUS='审核通过' and GID IN (SELECT TEMPLATEID FROM Cust_Truck_feetemplatedetail WHERE LOADPORT='" + PORTLOAD + "' and DISTPORT='" + PORTDISCHARGE + "')";
this.storeListFeeTemplate.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
callback: function (r, options, success) {
if (success) {
if (this.storeListFeeTemplate.getCount() > 0) {
var member = this.storeListFeeTemplate.getAt(0);
this.formEdit.getForm().findField('CONTRACTNO').setValue(member.data.CONTRACTNO);
this.formEdit.getForm().findField('TEMPLATENAME').setValue(member.data.TEMPLATENAME);
if (member.data.CONTRACTNO != '' && member.data.TEMPLATENAME != '') {
var s = " TEMPLATEID in (select gid from [Cust_Truck_feetemplate] where TEMPLATENAME='" + member.data.TEMPLATENAME + "' and CONTRACTNO='" + member.data.CONTRACTNO + "' and TRANTYPE='集装箱')";
this.storeFeeTemplateDetail.load({
params: { condition: s },
scope: this
});
}
} else {
this.formEdit.getForm().findField('CONTRACTNO').setValue('');
this.formEdit.getForm().findField('TEMPLATENAME').setValue('');
}
}
},
waitMsg: "正在查询数据...",
scope: this
});
}
},
getCustName: function () {
var custName = this.formEdit.getForm().findField('CustName');
return custName.getValue();
},
onSubmitAuditClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..');
},
LoadMustBe: function () {
this.storeMustBe.load({
params: { condition: "BSTYPE='陆运集运订单'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount() ; j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
};
} else {
}
}
},
scope: this
});
},
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('bsbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('bsbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('bsbtnSaveAndNew');
var btnadddetail = Ext.getCmp('btnadddetail');
var btndeletedetail = Ext.getCmp('btndeletedetail');
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btnAudit = Ext.getCmp('btnAudit');
var btnAuditBack = Ext.getCmp('btnAuditBack');
var btnadddetailfee = Ext.getCmp('btnadddetailfee');
var btndeletedetailfee = Ext.getCmp('btndeletedetailfee');
var btnsubmitauditfee = Ext.getCmp('btnsubmitauditfee');
// var btnCreateFee = Ext.getCmp('btnCreateFee');
var TRANSSTATUS = this.formEdit.getForm().findField('TRANSSTATUS').getValue();
if ((TRANSSTATUS != '新建' && TRANSSTATUS != '驳回提交')) {
enable = false;
} else enable = true;
if (this.Audit) {
btnSubmitAudit.disable();
btnSubmitAuditBack.disable();
btnAudit.enable();
btnAuditBack.enable();
enable = false;
} else {
btnSubmitAudit.enable();
btnSubmitAuditBack.enable();
btnAudit.disable();
btnAuditBack.disable();
}
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
btnadddetail.enable();
btndeletedetail.enable();
//btnadddetailfee.enable();
//btndeletedetailfee.enable();
//btnsubmitauditfee.enable();
// btnCreateFee.enable();
} else {
bsbtnSave.disable();
bsbtnSaveAndClose.disable();
bsbtnSaveAndNew.disable();
btndeletedetail.disable();
btnadddetail.disable();
// btnCreateFee.disable();
//btnadddetailfee.disable();
//btndeletedetailfee.disable();
//btnsubmitauditfee.disable();
}
},
getFeeStatus: function () {
var basicForm = this.formEdit.getForm();
var feeStatus = basicForm.findField('FeeStatus').value;
return feeStatus;
}
,
getBillStatus: function () {
var basicForm = this.formEdit.getForm();
var billStatus = basicForm.findField('BillStatus').value;
return billStatus;
},
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('BillNo').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var gid = basicForm.findField('GId').value;
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/TruckMng/MsWlBs/GetIsPrint',
async: false,
params: {
billno: billNo,
Gid: gid
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
var printType = 'MSWLBS';
var sql1 = "SET LANGUAGE 'us_english ' "
+ " select * from vMsWlBsHeadPrint WHERE BillNo = '" + billNo + "' order by BillNo";
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'";
//var sql3 = "SET LANGUAGE 'us_english' "
// + " select * from vMsWlPcHeadPrint where RefBillNo='" + billNo + "' order by RefBillNo";
//var sql4 = "SET LANGUAGE 'us_english' select * from ch_fee where BSNO in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BsNo";
var sql3 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A, ch_fee B where A.Gid=B.BsNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo";
//var sql4 = "SET LANGUAGE 'us_english' select * from tMsWlPcFixed where BillNo in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BillNo";
var sql4 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A,tMsWlPcFixed B where A.Gid=B.BillNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
// var printType = 'MSWLBS';
// var sql1 = "SET LANGUAGE 'us_english ' "
// + " select * from vMsWlBsHeadPrint WHERE BillNo = '" + billNo + "' order by BillNo";
// var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'";
// //var sql3 = "SET LANGUAGE 'us_english' "
// // + " select * from vMsWlPcHeadPrint where RefBillNo='" + billNo + "' order by RefBillNo";
// //var sql4 = "SET LANGUAGE 'us_english' select * from ch_fee where BSNO in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BsNo";
// var sql3 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A, ch_fee B where A.Gid=B.BsNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo";
// //var sql4 = "SET LANGUAGE 'us_english' select * from tMsWlPcFixed where BillNo in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BillNo";
// var sql4 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A,tMsWlPcFixed B where A.Gid=B.BillNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo";
// var sql5 = "";
// var sql6 = "";
// PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
DispatchTruck: function () {
},
setBtnOnlyQuery: function () {
var bsbtnSave = Ext.getCmp('bsbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('bsbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('bsbtnSaveAndNew');
var bsbtnNew = Ext.getCmp('bsbtnNew');
bsbtnSave.setVisible(false);
bsbtnSaveAndClose.setVisible(false);
bsbtnSaveAndNew.setVisible(false);
bsbtnNew.setVisible(false);
}
});