|
|
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
|
|
|
Ext.namespace('DsTruck');
|
|
|
|
|
|
var C_cargoinfo_id="";
|
|
|
var HTHCount=0;
|
|
|
var APPUsingCount=0;
|
|
|
|
|
|
|
|
|
DsTruck.MsOpAirn_Freight_Edit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.DsTruck.MsOpAirn_Freight_Edit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Date.prototype.format = function (format) {
|
|
|
var o = {
|
|
|
"M+": this.getMonth() + 1, //month
|
|
|
"d+": this.getDate(), //day
|
|
|
"h+": this.getHours(), //hour
|
|
|
"m+": this.getMinutes(), //minute
|
|
|
"s+": this.getSeconds(), //sedcond
|
|
|
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
|
|
|
"S": this.getMilliseconds() //millisecond
|
|
|
}
|
|
|
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
|
|
|
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
|
for (var k in o) if (new RegExp("(" + k + ")").test(format))
|
|
|
format = format.replace(RegExp.$1,
|
|
|
RegExp.$1.length == 1 ? o[k] :
|
|
|
("00" + o[k]).substr(("" + o[k]).length));
|
|
|
return format;
|
|
|
}
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
var currdate = new Date();
|
|
|
if (!xhr) {
|
|
|
//...其他生成xmlhttprequest方法
|
|
|
}
|
|
|
xhr.open("HEAD", location.href, true);
|
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
|
var datestr = xhr.getResponseHeader("Date");
|
|
|
currdate = new Date(datestr);
|
|
|
// alert(currdate.format('yyyy-MM-dd'));
|
|
|
}
|
|
|
}
|
|
|
xhr.send(null);
|
|
|
|
|
|
function getSaved(){
|
|
|
var cargodirty = DsTruck.GetDirty(panelEdit.storeDetail, panelEdit.DetailDel);
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty()== true || cargodirty==true)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
else return false;
|
|
|
}
|
|
|
|
|
|
Ext.extend(DsTruck.MsOpAirn_Freight_Edit, Ext.Panel, {
|
|
|
parentWin: null,
|
|
|
opStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
// parentfunction: null,
|
|
|
_First: true,
|
|
|
GID: "",
|
|
|
CUSTOMERNAME: "",
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
Ext.Ajax.timeout = 1200000;
|
|
|
this.DetailDel = [];
|
|
|
|
|
|
this.feeSerialNo = 0;
|
|
|
this.feeBodyDel = [];
|
|
|
this.DetailListName = "ChFeeAutoDuiDetail";
|
|
|
this.bssql = '';
|
|
|
this.feesql = '';
|
|
|
|
|
|
this.FactoryNo = "";
|
|
|
|
|
|
//#region 枚举参照相关(编辑form)
|
|
|
|
|
|
var _this = this;
|
|
|
//this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
// model: 'Tradermb',
|
|
|
// proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
//});
|
|
|
//this.storeSeller.load({ params: { condition: ""} });
|
|
|
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
|
|
|
});
|
|
|
this.storeCustomerNameRef.load();
|
|
|
|
|
|
this.comboxCustomer = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '结算对象', flex: 1,
|
|
|
forceSelection: true,
|
|
|
store: this.storeCustomerNameRef,
|
|
|
id: 'CUSTOMERNAME',
|
|
|
queryMode: 'remote',
|
|
|
minChars: 1,
|
|
|
queryParam: 'CODENAME',
|
|
|
lazyRender: false,
|
|
|
name: 'CUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
allowBlank: false,
|
|
|
listeners: {
|
|
|
blur: function (field, newValue, oldValue) {
|
|
|
Ext.getCmp("CUSTOMERNAME").setValue(field.displayTplData[0].CustName);
|
|
|
if (field.displayTplData[0].CustCode != "") {
|
|
|
//_this.storeDetailName.load({ params: { start: 0, limit: 9999, condition: " CLIENTGID=(select gid from info_client where codename='" + field.displayTplData[0].code + "') "} });
|
|
|
}
|
|
|
},
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
if (field.displayTplData[0].CustCode != "") {
|
|
|
//_this.storeDetailName.load({ params: { start: 0, limit: 9999, condition: " CLIENTGID=(select gid from info_client where codename='" + field.displayTplData[0].code + "') "} });
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
});
|
|
|
this.storeUser.load({ params: { condition: ""} });
|
|
|
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '操作人', readOnly: true,
|
|
|
forceSelection: true,
|
|
|
store: this.storeUser,
|
|
|
name: 'OP',
|
|
|
valueField: 'UserName',
|
|
|
displayField: 'CodeAndName'
|
|
|
//,allowBlank: false
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeFeeType = Ext.create('Ext.data.Store', {
|
|
|
fields: ['ID', 'NAME']
|
|
|
});
|
|
|
//this.storeFeeType.add({ "ID": "0", "NAME": "" });
|
|
|
this.storeFeeType.add({ "ID": "1", "NAME": "应收" });
|
|
|
this.storeFeeType.add({ "ID": "2", "NAME": "应付" });
|
|
|
this.storeFeeType.add({ "ID": "3", "NAME": "全部" });
|
|
|
|
|
|
this.comboxFEETYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeFeeType, //id: "STLNAME",
|
|
|
fieldLabel: '结算方式',
|
|
|
forceSelection: true,
|
|
|
flex: 0.6,
|
|
|
name: 'FEETYPE',
|
|
|
valueField: 'ID',
|
|
|
displayField: 'NAME'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeAddDCType = Ext.create('Ext.data.Store', {
|
|
|
fields: ['DC', 'NAME']
|
|
|
});
|
|
|
this.storeAddDCType.add({ "DC": "0", "NAME": "全部" });
|
|
|
this.storeAddDCType.add({ "DC": "1", "NAME": "应收" });
|
|
|
this.storeAddDCType.add({ "DC": "2", "NAME": "应付" });
|
|
|
|
|
|
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '费用范围',
|
|
|
store: this.storeAddDCType,
|
|
|
valueField: 'DC',
|
|
|
displayField: 'NAME',
|
|
|
flex: 0.5,
|
|
|
|
|
|
// labelWidth: 50,
|
|
|
forceSelection: true,
|
|
|
name: 'FEEDC',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
Ext.define('MsFeeCurr', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
idProperty: 'CURR',
|
|
|
fields: [
|
|
|
{ name: 'CURR', type: 'string' },
|
|
|
{ name: 'DEFRATE', type: 'number' },
|
|
|
{ name: 'CRDEFRATE', type: 'number' }
|
|
|
]
|
|
|
});
|
|
|
|
|
|
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsFeeCurr',
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
|
|
|
});
|
|
|
this.StoreCurr.load({ params: { condition: ""} });
|
|
|
|
|
|
|
|
|
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '币别',
|
|
|
store: this.StoreCurr,
|
|
|
forceSelection: true,
|
|
|
labelWidth: 30,
|
|
|
flex: 0.4,
|
|
|
name: 'CURR',
|
|
|
valueField: 'CURR',
|
|
|
displayField: 'CURR',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeFSTATUS = Ext.create('Ext.data.Store', {
|
|
|
fields: ['FSTATUS', 'NAME']
|
|
|
});
|
|
|
this.storeFSTATUS.add({ "FSTATUS": "0", "NAME": "全部" });
|
|
|
this.storeFSTATUS.add({ "FSTATUS": "1", "NAME": "仅已审核" });
|
|
|
this.storeFSTATUS.add({ "FSTATUS": "2", "NAME": "仅未审核" });
|
|
|
this.storeFSTATUS.add({ "FSTATUS": "3", "NAME": "仅已审核未申请" });
|
|
|
this.storeFSTATUS.add({ "FSTATUS": "4", "NAME": "仅未申请" });
|
|
|
|
|
|
this.comboxFSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '费用状态',
|
|
|
store: this.storeFSTATUS,
|
|
|
valueField: 'FSTATUS',
|
|
|
displayField: 'NAME',
|
|
|
flex: 0.5,
|
|
|
forceSelection: true,
|
|
|
name: 'FSTATUS',
|
|
|
value: '',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeDuiType = Ext.create('Ext.data.Store', {
|
|
|
fields: ['ID', 'NAME']
|
|
|
});
|
|
|
//this.storeFeeType.add({ "ID": "0", "NAME": "" });
|
|
|
this.storeDuiType.add({ "ID": "1", "NAME": "根据区间对账" });
|
|
|
this.storeDuiType.add({ "ID": "2", "NAME": "根据导入对账" });
|
|
|
|
|
|
this.comboxDUITYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeDuiType, //id: "STLNAME",
|
|
|
fieldLabel: '对账方式', flex: 1,
|
|
|
forceSelection: true,
|
|
|
value:'1',
|
|
|
name: 'DUITYPE',
|
|
|
valueField: 'ID',
|
|
|
displayField: 'NAME'
|
|
|
});
|
|
|
|
|
|
this.storeFEEDUITYPE = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeFEEDUITYPE.load({ params: { enumTypeId: 50003 } });
|
|
|
|
|
|
this.comboxFEEDUITYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeFEEDUITYPE,
|
|
|
fieldLabel:'', //'对账类别',
|
|
|
flex: 0.5,
|
|
|
// labelWidth: 60,
|
|
|
valueField: 'EnumValueName',
|
|
|
displayField: 'EnumValueName',
|
|
|
name: 'FEEDUITYPE',
|
|
|
forceSelection: true
|
|
|
});
|
|
|
|
|
|
this.storeFEEDUITYPECONDIT = Ext.create('Ext.data.Store', {
|
|
|
fields: ['ID', 'NAME']
|
|
|
});
|
|
|
//this.storeFeeType.add({ "ID": "0", "NAME": "" });
|
|
|
this.storeFEEDUITYPECONDIT.add({ "ID": "等于", "NAME": "等于" });
|
|
|
this.storeFEEDUITYPECONDIT.add({ "ID": "不等于", "NAME": "不等于" });
|
|
|
this.comboxFEEDUITYPECONDIT = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeFEEDUITYPECONDIT, //id: "STLNAME",
|
|
|
fieldLabel: '费用类别',
|
|
|
flex:0.5,
|
|
|
forceSelection: true,
|
|
|
value: '等于',
|
|
|
name: 'FEEDUITYPECONDIT',
|
|
|
valueField: 'ID',
|
|
|
displayField: 'NAME'
|
|
|
});
|
|
|
|
|
|
this.storeSALECORP = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsCompanySale',
|
|
|
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
|
|
|
});
|
|
|
this.storeSALECORP.load();
|
|
|
|
|
|
this.comboxSALECORP = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeSALECORP,
|
|
|
fieldLabel: '核算单位', //是否开垫付
|
|
|
flex: 0.5,
|
|
|
name: 'SALECORP',
|
|
|
valueField: 'NAME',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
//编辑form:formEdit
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
// layout: "border",
|
|
|
region: 'center',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
trackResetOnLoad: true, //不加的话load之后isdirty即变为true
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 60,
|
|
|
msgTarget: 'qtip'
|
|
|
//,split:true
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{//container_1
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '自动对账编号',
|
|
|
labelWidth: 90,
|
|
|
// hidden: true,
|
|
|
readOnly:true,
|
|
|
name: 'GID'
|
|
|
}, this.comboxCustomer
|
|
|
,this.comboxDUITYPE
|
|
|
, {
|
|
|
fieldLabel: '对账状态', //readOnly: true,
|
|
|
name: 'DUISTATUS', flex: 1
|
|
|
}, {
|
|
|
fieldLabel: '对账单编号', //readOnly: true,
|
|
|
labelWidth: 75,
|
|
|
name: 'DUINO', flex: 1
|
|
|
}
|
|
|
, {
|
|
|
fieldLabel: '时间戳',
|
|
|
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
|
|
|
}
|
|
|
]
|
|
|
}, //container_1 end
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
|
|
|
this.comboxBLTYPE
|
|
|
, {
|
|
|
fieldLabel: '起始时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'STARTDATE'
|
|
|
}
|
|
|
, {
|
|
|
fieldLabel: '结束时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'ENDDATE'
|
|
|
}, this.comboxOP
|
|
|
, {
|
|
|
fieldLabel: '操作时间', readOnly: true,
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
labelWidth: 75,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
|
|
|
name: 'OPDATE'
|
|
|
}, { xtype: 'hiddenfield' }
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
fieldLabel: '对账情况', readOnly: true, hidden: true,
|
|
|
name: 'STATUS', flex: 2
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
this.comboxaddDCType, this.comboxFEETYPE, this.comboxCurr, this.comboxFSTATUS, this.comboxSALECORP, {
|
|
|
xtype: 'checkbox',
|
|
|
labelWidth:75,
|
|
|
fieldLabel: '包含已对账',
|
|
|
name: 'HAVEDEBIT', flex: 0.5
|
|
|
}, this.comboxFEEDUITYPECONDIT, this.comboxFEEDUITYPE
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
////
|
|
|
{
|
|
|
//xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '备注',
|
|
|
name: 'REMARK', flex: 1
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
////
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
////
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
|
|
|
////
|
|
|
]
|
|
|
}]
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
//////////////////////////////////
|
|
|
|
|
|
|
|
|
//#region 自动对账明细
|
|
|
|
|
|
//数据集
|
|
|
this.storeDetail = Ext.create('Ext.data.Store', {
|
|
|
pageSize: 9999,
|
|
|
model: 'CH_FEE_AutoDuiDetailmb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/GetBodyList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
this.DetailColumns = [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'BSNO',
|
|
|
header: 'BSNO',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'B_BSNO',
|
|
|
header: 'B_BSNO',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'left',
|
|
|
dataIndex: 'MBLNO',
|
|
|
header: '主提单号',
|
|
|
width: 140,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'left',
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '委托单位',
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'left',
|
|
|
dataIndex: 'OP',
|
|
|
header: '操作',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'left',
|
|
|
dataIndex: 'ETD',
|
|
|
header: 'ETD',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'right',
|
|
|
dataIndex: 'RMBAMOUNT',
|
|
|
header: 'RMB对账金额',
|
|
|
width: 80,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
summaryType: 'sum', align: 'right',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'right',
|
|
|
dataIndex: 'USDAMOUNT',
|
|
|
header: 'USD对账金额',
|
|
|
width: 80,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
summaryType: 'sum', align: 'right',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'right',
|
|
|
dataIndex: 'L_RMBAMOUNT',
|
|
|
header: 'RMB本地金额',
|
|
|
width: 80,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
summaryType: 'sum', align: 'right',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'right',
|
|
|
dataIndex: 'L_USDAMOUNT',
|
|
|
header: 'USD本地金额',
|
|
|
width: 80,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
summaryType: 'sum', align: 'right',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'right',
|
|
|
dataIndex: 'Y_RMBAMOUNT',
|
|
|
header: 'RMB差额',
|
|
|
width: 80,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
summaryType: 'sum', align: 'right',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'right',
|
|
|
dataIndex: 'Y_USDAMOUNT',
|
|
|
header: 'USD差额',
|
|
|
width: 80,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
summaryType: 'sum', align: 'right',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISOK',
|
|
|
header: '对账完成', align: 'center',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'checkboxfield',
|
|
|
inputValue: '1',
|
|
|
uncheckedValue: '0'
|
|
|
// selectOnFocus: true
|
|
|
},
|
|
|
renderer: function (value, cellmeta) {
|
|
|
if (value == '1' || value == "true") {
|
|
|
return "√";
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'left',
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 120,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true/*,
|
|
|
listeners: {
|
|
|
keydown: function (textField, e) {
|
|
|
if (e.getKey() == 40) {
|
|
|
_thisfee.onNextKeyClick(1, 18)
|
|
|
} else if (e.getKey() == 38) {
|
|
|
_thisfee.onUpKeyClick(1, 18)
|
|
|
}
|
|
|
}
|
|
|
}*/
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, align: 'left',
|
|
|
dataIndex: 'REMARK2', //readOnly:true,
|
|
|
header: '对账结果',
|
|
|
width: 120
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CARRIER', //readOnly:true,
|
|
|
header: '船公司',
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'TEU', //readOnly:true,
|
|
|
header: 'TEU',
|
|
|
width: 60
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'SALE', //readOnly:true,
|
|
|
header: '揽货人',
|
|
|
width: 60
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTNO', //readOnly:true,
|
|
|
header: '委托编号',
|
|
|
width: 60
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
this.cellEditingDetail = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.Detail_CBM = Ext.create('Ext.selection.CheckboxModel');
|
|
|
_this = this;
|
|
|
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
|
|
|
width: 40
|
|
|
});
|
|
|
this.formDetail = new Ext.grid.GridPanel({
|
|
|
store: this.storeDetail,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border', id: "formDetail",
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
trackResetOnLoad: true,
|
|
|
height: 160,
|
|
|
features: [{
|
|
|
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
|
|
|
}],
|
|
|
autoScroll: true,
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingDetail],
|
|
|
selModel: this.Detail_CBM,
|
|
|
selType: 'cellmodel',
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true,
|
|
|
getRowClass: function (record, rowIndex, rowParams, store) {
|
|
|
var feeStatus = "";
|
|
|
var ISOK = record.get('ISOK');
|
|
|
var RMBAMOUNT = parseFloat(record.get('RMBAMOUNT'));
|
|
|
var USDAMOUNT = parseFloat(record.get('USDAMOUNT'));
|
|
|
var L_RMBAMOUNT = parseFloat(record.get('L_RMBAMOUNT'));
|
|
|
var L_USDAMOUNT = parseFloat(record.get('L_USDAMOUNT'));
|
|
|
var REMARK2 = record.get('REMARK2');
|
|
|
if (record.get('ISOK') == "1") {
|
|
|
feeStatus = 9;
|
|
|
} else
|
|
|
if (REMARK2 == "我方无此提单号") {
|
|
|
feeStatus = 3; //4
|
|
|
} else
|
|
|
if (REMARK2 == "对方账单无此提单号") {
|
|
|
feeStatus = 3; //4
|
|
|
} else {
|
|
|
//如rmb和usd均不相等为6
|
|
|
if (RMBAMOUNT != L_RMBAMOUNT && USDAMOUNT != L_USDAMOUNT) {
|
|
|
if (RMBAMOUNT < L_RMBAMOUNT && USDAMOUNT < L_USDAMOUNT) {
|
|
|
feeStatus = 3; //2
|
|
|
} else if (RMBAMOUNT > L_RMBAMOUNT && USDAMOUNT > L_USDAMOUNT) {
|
|
|
feeStatus = 3;
|
|
|
} else {
|
|
|
feeStatus = 3; //6 改为3
|
|
|
}
|
|
|
} else if (RMBAMOUNT < L_RMBAMOUNT || USDAMOUNT < L_USDAMOUNT) {
|
|
|
//RMB我方较多为2
|
|
|
feeStatus = 3; //2
|
|
|
} else if (RMBAMOUNT > L_RMBAMOUNT || USDAMOUNT > L_USDAMOUNT) {
|
|
|
//RMB我方较多为2
|
|
|
feeStatus = 3;
|
|
|
} else {
|
|
|
feeStatus = 99;
|
|
|
}
|
|
|
//RMB我方较多为2
|
|
|
//RMB对方较多为3
|
|
|
}
|
|
|
return RowClass(feeStatus);
|
|
|
}
|
|
|
},
|
|
|
tbar: [{
|
|
|
text: '增加明细', //hidden:true,
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddCargoClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelCargoClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '生成应收应付',
|
|
|
tooltip: '生成应收应付',
|
|
|
iconCls: "btnCWStart", hidden: true,
|
|
|
handler: function (button, event) {
|
|
|
this.onbtnCWStartClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "保存列表样式",
|
|
|
id: "btnsavelist",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
var tempcolumns = this.formDetail.columns;
|
|
|
DsTruck.SaveGridPanel(USERID, _this.DetailListName, tempcolumns);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "导出Excel",
|
|
|
id: "btnExportExcel",
|
|
|
iconCls: 'btnexportexcel',
|
|
|
handler: function (button, event) {
|
|
|
this.onExportClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.DetailColumns
|
|
|
});
|
|
|
|
|
|
this.DetailColumns = DsTruck.GetGridPanel(USERID, this.DetailListName, this.DetailColumns);
|
|
|
this.DetailColumns.unshift(new Ext.grid.RowNumberer());
|
|
|
//使用者id,表名 ,中间column数组,跳过一开始的几列
|
|
|
this.formDetail.reconfigure(this.storeDetail, this.DetailColumns);
|
|
|
|
|
|
this.formDetail.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
this.SelectedRecord = record;
|
|
|
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
|
var openType = "_blank";
|
|
|
var openUrl = "";
|
|
|
if (record.data.OPLBNAME == "报关业务") {
|
|
|
openUrl = "../MsOpApply/ApplyFeeView?handle=check&bsno=" + record.data.B_BSNO;
|
|
|
} else {
|
|
|
openUrl = "../MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.B_BSNO;
|
|
|
}
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//公共按钮Toolbar:panelBtn
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
id: "savebtn",
|
|
|
text: "保存",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: "saveandclosebtn",
|
|
|
text: "保存并关闭",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "打印", //"打印",
|
|
|
iconCls: "btnprint",
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
text: "导入对账信息Excel表格",
|
|
|
tooltip: '注意!三列数据应分别为:提单号,RMB金额,USD金额',
|
|
|
id: "uploadexcelbtn",
|
|
|
iconCls: "btnexportexcel",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
this.Save('0');
|
|
|
|
|
|
if (this.formEdit.getForm().findField('CUSTOMERNAME').getValue() == "") {
|
|
|
alert("必须要选择对账单位");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var winAccess = new DsTruck.FileImport({});
|
|
|
|
|
|
winAccess.StoreList = this.storeDetail;
|
|
|
this.GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
this.CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
this.FEETYPE = this.formEdit.getForm().findField('FEETYPE').getValue();
|
|
|
|
|
|
winAccess.show();
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
id: "remakebtn",
|
|
|
text: "重新计算对账信息",
|
|
|
tooltip: '不需重新导入对账文档,只根据当前的费用状态重新计算对账数据。注意当生成对账单后此功能不能使用',
|
|
|
//iconCls: "btnexportexcel",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
//this.Save('0');
|
|
|
|
|
|
this.ReMake();
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
id: "makeduibtn",
|
|
|
text: "生成对账单(对账成功的部分)",
|
|
|
tooltip: '仅生成对账成功的部分。如果某条信息由于某种原因需要设为对账成功,可以采取以下方法:1.对方账单金额错误-将excel文档内的数据改正确,然后生成',
|
|
|
//iconCls: "btnexportexcel",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
this.MakeDui('1');
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
},{
|
|
|
id: "cfsavebtn",
|
|
|
text: "拆分(对账成功的部分)",
|
|
|
handler: function (button, event) {
|
|
|
this.CFSave();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
id: "delduibtn",
|
|
|
text: "取消生成对账单",
|
|
|
tooltip: '',
|
|
|
//iconCls: "btnexportexcel",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
this.MakeDui('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "生成付费申请", //"打印",
|
|
|
handler: function (button, event) {
|
|
|
this.MakeShen('0');
|
|
|
|
|
|
//this.feesql = ' 1=1 ';
|
|
|
//var DUINO = this.formEdit.getForm().findField('GID').getValue();
|
|
|
//this.bssql = " b.BSNO IN (SELECT B_BSNO FROM CH_FEE_AutoDuiDetail WHERE BSNO='" + DUINO + "')";
|
|
|
//var CURR = this.formEdit.getForm().findField('CURR').getValue();
|
|
|
//if (CURR != '' && CURR != null) this.feesql = this.feesql + " and f.Currency='" + CURR + "'"
|
|
|
//var FEEDC = this.formEdit.getForm().findField('FEEDC').getValue();
|
|
|
//if (FEEDC == '1' || FEEDC == '2') this.feesql = this.feesql + " and f.feetype='" + FEEDC + "'"
|
|
|
//var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
|
|
|
//DsOpenEditWin("/Account/Chfee_payapplication/BLEdit?handle=check&bsnosql=duilist&bsCust=" + CUSTOMERNAME, '付费申请');
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//布局
|
|
|
/* 3 */
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 160,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
|
|
|
this.panelCargoandApp = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
split: true,
|
|
|
height: 500,
|
|
|
margin: '1 1',
|
|
|
items: [this.formDetail
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.panelCargoandApp]
|
|
|
});
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
this.InitData();
|
|
|
|
|
|
//集中绑定编辑后事件
|
|
|
this.formDetail.on('edit', function (editor, e, eOpts) {
|
|
|
this.DetailAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
SetBtnEnable: function (data) {
|
|
|
|
|
|
if (data.DUINO == "") {//没有对账编号
|
|
|
Ext.getCmp('savebtn').enable(); //保存按钮置灰
|
|
|
Ext.getCmp('saveandclosebtn').enable(); //enable;
|
|
|
Ext.getCmp('uploadexcelbtn').enable();
|
|
|
Ext.getCmp('remakebtn').enable();
|
|
|
Ext.getCmp('makeduibtn').enable();
|
|
|
Ext.getCmp('delduibtn').disable();
|
|
|
} else
|
|
|
if (data.SALESTATUS != "") {//有对账编号
|
|
|
Ext.getCmp('savebtn').disable(); //保存按钮置灰
|
|
|
Ext.getCmp('saveandclosebtn').disable(); //enable;
|
|
|
Ext.getCmp('uploadexcelbtn').disable();
|
|
|
Ext.getCmp('remakebtn').disable();
|
|
|
Ext.getCmp('makeduibtn').disable();
|
|
|
Ext.getCmp('delduibtn').enable();
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
////////<<<商品>>>明细表相关方法
|
|
|
reLine: function (button, event) {
|
|
|
var _L = 1;
|
|
|
this.storeDetail.each(function (record) {
|
|
|
var ln = _L + "";
|
|
|
_L = _L + 1;
|
|
|
record.set('SEQUENCE', ln);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
onAddCargoClick: function (button, event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var linenum=this.storeDetail.getCount()+1;
|
|
|
//var _r=this.reLine();
|
|
|
var record = Ext.create('FreightDetailmb', {
|
|
|
'GID': NewGuid(),
|
|
|
'DESCRIPTION': '',
|
|
|
'PLAN_GID': '',
|
|
|
'CARGOGID': '',
|
|
|
'CARGO_CODE': '',
|
|
|
'CARGO_NAME': '',
|
|
|
'MINFEE': '0',
|
|
|
'MINWEIGHT': '0',
|
|
|
'W_5': '0',
|
|
|
'W_10': '0',
|
|
|
'W_N': '0',
|
|
|
'W_45': '0',
|
|
|
'W_100': '0',
|
|
|
'W_300': '0',
|
|
|
'W_500': '0',
|
|
|
'W_1000': '0',
|
|
|
'REMARK': '',
|
|
|
'REMARK_2': '',
|
|
|
'REMARK_3': '',
|
|
|
'PORTLOADID': '',
|
|
|
'PORTDISCHARGEID': '',
|
|
|
'VESSEL': '',
|
|
|
'PORTLOADID_REF': '',
|
|
|
'PORTDISCHARGEID_REF': '',
|
|
|
'D_INFO': ''
|
|
|
});
|
|
|
this.storeDetail.add(record);
|
|
|
|
|
|
var n = this.storeDetail.getCount();
|
|
|
this.cellEditingCargo.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
//aftereditform();
|
|
|
},
|
|
|
|
|
|
onDelCargoClick: function (button, event) {
|
|
|
var selectedRecords = this.formDetail.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.BSNO != "" || rec.BSNO != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.DetailDel.push(rec);
|
|
|
}
|
|
|
this.storeDetail.remove(selectedRecords[i]);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
//aftereditform();
|
|
|
},
|
|
|
|
|
|
DetailAfterEdit: function (editor, e, eOpts) {
|
|
|
|
|
|
if (e.field == 'CARGOGID') {
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeDetailName, 'GID', e.value);
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
|
|
|
e.record.set('CARGO_CODE', Cargoinfodata.CODEandNAME);
|
|
|
|
|
|
} else {
|
|
|
e.record.set('CARGO_CODE', '');
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'PORTLOADID') {
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeCodeDisport, 'PORTID', e.value);
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
|
|
|
e.record.set('PORTLOADID_REF', Cargoinfodata.PORTID + "-" + Cargoinfodata.PORTCNAME);
|
|
|
|
|
|
} else {
|
|
|
e.record.set('PORTLOADID_REF', '');
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'PORTDISCHARGEID') {
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeCodeDisport2, 'PORTID', e.value);
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
|
|
|
e.record.set('PORTDISCHARGEID_REF', Cargoinfodata.PORTCNAME);
|
|
|
|
|
|
} else {
|
|
|
e.record.set('PORTDISCHARGEID_REF', '');
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
/////////////明细表<<<商品>>>的相关方法
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
// alert(this.First);
|
|
|
ret1[3]();
|
|
|
},
|
|
|
|
|
|
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.parentfunction = ret[3];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " GID='" + this.editRecord.get('GID') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
//载入数据
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
this.opStatus = opstatus;
|
|
|
var GID = "";
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/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;
|
|
|
this.formEdit.getForm().reset();
|
|
|
GID = data.GID;
|
|
|
if (data.FEETYPE == "" || data.FEETYPE == "0") {
|
|
|
data.FEETYPE = '3';
|
|
|
}
|
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
Ext.getCmp("formDetail").setTitle(data.STATUS + '(' + 'RMB对账金额:' + data.RMBAMOUNT + ',USD对账金额:' + data.USDAMOUNT + ',RMB本地金额:' + data.L_RMBAMOUNT + ',USD本地金额:' + data.L_USDAMOUNT+')');
|
|
|
this.SetBtnEnable(data);
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}); //request over
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
|
}
|
|
|
|
|
|
}, // end LoadDate
|
|
|
ReflashEdt: function (GID) {
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
condition = " GID='" + GID + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
//this.storeDetail.load({ params: { condition: condition} });
|
|
|
|
|
|
|
|
|
}, //end InitData
|
|
|
checkedit: function () {
|
|
|
var _r = true;
|
|
|
|
|
|
if (this.HTHCount > 0) {
|
|
|
alert("合同号重复");
|
|
|
_r = false;
|
|
|
} else {
|
|
|
var ContractStatus = this.formEdit.getForm().findField('ContractStatus').getValue() ? 1 : 0
|
|
|
if (ContractStatus == 1) {
|
|
|
alert("已经锁定");
|
|
|
_r = false;
|
|
|
} else
|
|
|
{ } //return true;
|
|
|
}
|
|
|
|
|
|
if (this.storeDetail.getCount() == 0) { } //return true;
|
|
|
else {
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var cargomember = this.storeDetail.getAt(i).data;
|
|
|
if (cargomember.weight == "0") {
|
|
|
alert("请填写货物重量,请注意单位是千克");
|
|
|
_r = false;
|
|
|
} else
|
|
|
if (cargomember.name == "") {
|
|
|
alert("请填写货名。");
|
|
|
_r = false;
|
|
|
} else
|
|
|
if (cargomember.cicodeandname == '0203290090_其他冻藏猪肉' && (cargomember.SPECIFICATIONS == "" || cargomember.SPECIFICATIONS == null)) {
|
|
|
alert("0203290090_其他冻藏猪肉的商品必须选择商品规格(去骨/带骨)");
|
|
|
_r = false;
|
|
|
}
|
|
|
} //end for
|
|
|
} //end if
|
|
|
/* if (e.field == 'SPECIFICATIONS'){
|
|
|
var cicodeandname=e.record.get('cicodeandname');
|
|
|
if (cicodeandname!="0202300090_其他冻藏猪肉" ){
|
|
|
//alert("只有HS代码为0203290090的商品才能修改规格");
|
|
|
canedit=false;
|
|
|
}else{
|
|
|
//canedit=true;
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
_form = this.formEdit.getForm();
|
|
|
|
|
|
var seller_name = _form.findField('seller').getValue();
|
|
|
if (CheckISSTOP(this.storeSeller, 'name', seller_name) == true) {
|
|
|
alert("你选择的贸易商已经停用");
|
|
|
_r = false;
|
|
|
}
|
|
|
|
|
|
var buyer_name = _form.findField('buyer').getValue();
|
|
|
var buyer = DsStoreQueryBy(this.storeBuyer, 'name', buyer_name);
|
|
|
if (buyer.getCount() > 0) {
|
|
|
var buyerdata = buyer.getAt(0).data;
|
|
|
if (buyerdata.ISSTOP == "True") {
|
|
|
alert("你选择的购货商已经停用");
|
|
|
//return;
|
|
|
_r = false;
|
|
|
}
|
|
|
}
|
|
|
var TRADINGAGENCY_name = _form.findField('TRADINGAGENCY').getValue();
|
|
|
var TRADINGAGENCY = DsStoreQueryBy(this.storeTRADINGAGENCY, 'name', TRADINGAGENCY_name);
|
|
|
if (TRADINGAGENCY.getCount() > 0) {
|
|
|
var buyerdata = TRADINGAGENCY.getAt(0).data;
|
|
|
if (buyerdata.ISSTOP == "True") {
|
|
|
alert("你选择的中间商已经停用");
|
|
|
//return;
|
|
|
_r = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return _r;
|
|
|
},
|
|
|
Save: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
//basicForm.findField('ContractNo').setDisabled(false);
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
//var HTH = data.HTH;
|
|
|
//var ContractNo = data.ContractNo;
|
|
|
//basicForm.findField('ContractNo').setDisabled(true);
|
|
|
|
|
|
data.HAVEDEBIT = this.formEdit.getForm().findField('HAVEDEBIT').getValue() ? 1 : 0;
|
|
|
var Cargodatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
if (member.data.ISOK == "true") {
|
|
|
member.data.ISOK = "1";
|
|
|
}
|
|
|
if (member.data.ISOK == "false") {
|
|
|
member.data.ISOK = "0";
|
|
|
}
|
|
|
Cargodatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var CargoBody = ConvertRecordsToJson(Cargodatas);
|
|
|
var CargoDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
//将复选框值转化为1/0
|
|
|
//data.ContractStatus=this.formEdit.getForm().findField('ContractStatus').getValue()?1:0;
|
|
|
//data.HaveContract=this.formEdit.getForm().findField('HaveContract').getValue()?1:0;
|
|
|
//data.INUSE = this.formEdit.getForm().findField('INUSE').getValue() ? 1 : 0;
|
|
|
|
|
|
var _this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
async: false,
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
CargoBody: CargoBody,
|
|
|
CargoDelBody: CargoDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChFeeAutoDuimb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
this.GID = returnData.GID;
|
|
|
this.ReflashEdt(this.GID);
|
|
|
this.SetBtnEnable(returnData);
|
|
|
//this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
|
this.SetBtnEnable(returnData);
|
|
|
} else if (type == '1') {//保存并关闭
|
|
|
window.close();
|
|
|
} else if (type == '2') {//保存并全部新建
|
|
|
|
|
|
}
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
CFSave: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
//basicForm.findField('ContractNo').setDisabled(false);
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
//var HTH = data.HTH;
|
|
|
//var ContractNo = data.ContractNo;
|
|
|
//basicForm.findField('ContractNo').setDisabled(true);
|
|
|
|
|
|
data.HAVEDEBIT = this.formEdit.getForm().findField('HAVEDEBIT').getValue() ? 1 : 0;
|
|
|
var Cargodatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
if (member.data.ISOK == "true") {
|
|
|
member.data.ISOK = "1";
|
|
|
}
|
|
|
if (member.data.ISOK == "false") {
|
|
|
member.data.ISOK = "0";
|
|
|
}
|
|
|
Cargodatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var CargoBody = ConvertRecordsToJson(Cargodatas);
|
|
|
var CargoDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
//将复选框值转化为1/0
|
|
|
//data.ContractStatus=this.formEdit.getForm().findField('ContractStatus').getValue()?1:0;
|
|
|
//data.HaveContract=this.formEdit.getForm().findField('HaveContract').getValue()?1:0;
|
|
|
//data.INUSE = this.formEdit.getForm().findField('INUSE').getValue() ? 1 : 0;
|
|
|
|
|
|
var _this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
async: false,
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/CFSave',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
CargoBody: CargoBody,
|
|
|
CargoDelBody: CargoDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
this.GID = returnData.GID;
|
|
|
this.ReflashEdt(this.GID);
|
|
|
this.SetBtnEnable(returnData);
|
|
|
//this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
|
this.SetBtnEnable(returnData);
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
ReMake: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
data.HAVEDEBIT = this.formEdit.getForm().findField('HAVEDEBIT').getValue() ? 1 : 0;
|
|
|
|
|
|
var Cargodatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
if (member.data.ISOK == "true") {
|
|
|
member.data.ISOK = "1";
|
|
|
}
|
|
|
if (member.data.ISOK == "false") {
|
|
|
member.data.ISOK = "0";
|
|
|
}
|
|
|
Cargodatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var CargoBody = ConvertRecordsToJson(Cargodatas);
|
|
|
var CargoDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
var _this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
async: false,
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
CargoBody: CargoBody,
|
|
|
CargoDelBody: CargoDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChFeeAutoDuimb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
|
|
|
_this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/ReMake',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
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) {
|
|
|
//this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChFeeAutoDuimb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
//this.storeDetail.load({ params: { start: 0, limit: 9999, condition: " BSNO='" + returnData.GID + "'"} });
|
|
|
this.ReflashEdt(returnData.GID);
|
|
|
this.SetBtnEnable(returnData);
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
MakeDui: function (type) {
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
data.HAVEDEBIT = this.formEdit.getForm().findField('HAVEDEBIT').getValue() ? 1 : 0;
|
|
|
|
|
|
var Cargodatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
if (member.data.ISOK == "true") {
|
|
|
member.data.ISOK = "1";
|
|
|
}
|
|
|
if (member.data.ISOK == "false") {
|
|
|
member.data.ISOK = "0";
|
|
|
}
|
|
|
if (member.data.ISOK == "1")
|
|
|
Cargodatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
|
|
|
if (Cargodatas.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg:'没有要生成对账的业务', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var CargoBody = ConvertRecordsToJson(Cargodatas);
|
|
|
var CargoDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
var _this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
async: false,
|
|
|
timeout: 1200000,
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
CargoBody: CargoBody,
|
|
|
CargoDelBody: CargoDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChFeeAutoDuimb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
|
|
|
_this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/MakeDui',
|
|
|
timeout: 1200000,
|
|
|
scope: this,
|
|
|
params: {
|
|
|
type: type,
|
|
|
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) {
|
|
|
//this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChFeeAutoDuimb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
|
|
|
this.ReflashEdt(returnData.GID);
|
|
|
this.SetBtnEnable(returnData);
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
MakeShen: function (type) {
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
data.HAVEDEBIT = this.formEdit.getForm().findField('HAVEDEBIT').getValue() ? 1 : 0;
|
|
|
|
|
|
var Cargodatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
if (member.data.ISOK == "true") {
|
|
|
member.data.ISOK = "1";
|
|
|
}
|
|
|
if (member.data.ISOK == "false") {
|
|
|
member.data.ISOK = "0";
|
|
|
}
|
|
|
Cargodatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
|
|
|
|
|
|
|
|
|
var CargoBody = ConvertRecordsToJson(Cargodatas);
|
|
|
var CargoDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
var _this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
async: false,
|
|
|
timeout: 1200000,
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
CargoBody: CargoBody,
|
|
|
CargoDelBody: CargoDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChFeeAutoDuimb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
|
|
|
_this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsChFeeAutoDui/MakeShen',
|
|
|
timeout: 1200000,
|
|
|
scope: this,
|
|
|
params: {
|
|
|
type: type,
|
|
|
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) {
|
|
|
//this.storeDetail.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChFeeAutoDuimb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
|
|
|
this.ReflashEdt(returnData.GID);
|
|
|
this.SetBtnEnable(returnData);
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
OprationSwap: function () {
|
|
|
var ret = new Array();
|
|
|
ret[0] = this.bssql;
|
|
|
ret[1] = this.feesql;
|
|
|
|
|
|
return ret;
|
|
|
},
|
|
|
|
|
|
//#region 打印
|
|
|
Print: function () {
|
|
|
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
|
|
|
var printType = 'MSCHFEEAUTODUI';
|
|
|
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM CH_FEE_AutoDui WHERE GID= '" + GID + "' ";
|
|
|
var sql2 = "SET LANGUAGE 'us_english' SELECT dl.*,b.ETD,B.CUSTOMERNAME,B.OP FROM CH_FEE_AutoDuiDetail dl left join v_op_bs B ON (B.BSNO=dl.B_BSNO) WHERE dl.BSNO = '" + GID + "' ";
|
|
|
var sql3 = "";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, '');
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
onExportClick: function (button, event) {
|
|
|
GridExportExcelPage(this.formDetail);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|