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

2530 lines
89 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.

Ext.namespace('Shipping');
Shipping.MsOpPriceEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpPriceEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpPriceEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
stroplb: '报价业务',
PageSize:50,
initUIComponents: function () {
this.bodyDel = [];
this.itemindex = 1;
this.myDate = new Date();
this.accdatesameetd = 0;
this.MsPeriod = null;
this.SALEORDERDEPTBYOP = 0;
this.ENTERSAMEASCUSTOMER = 0;
this.copyfee = false;
this.GID = getUrlParam('GID');
this.formname = "formMsOpPriceEdit"; //页面名称
Ext.define('MsFeeCurr', {
extend: 'Ext.data.Model',
idProperty: 'CURR',
fields: [
{ name: 'CURR', type: 'string' },
{ name: 'DEFRATE', type: 'number' },
{ name: 'CRDEFRATE', type: 'number' }
]
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.storeDefValue = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpDef/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
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.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode.load();
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode2.load();
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode2,
forceSelection: true,
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (this.SALEORDERDEPTBYOP == 0)
this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME);
this.formHead.getForm().findField('SALECORPID').setValue(records[0].data.CORPID);
}
}
}
});
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱型',
store: this.storeCodeCtn,
flex: 0.6,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
//
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司', //'船公司',
store: this.storeCARRIER,
//forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListFORWARDER' }
});
//船公司
this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '供应商', //'订舱代理',
store: this.storeFORWARDER,
//forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
_thisPriceEdit = this;
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
collapsed: false,
collapsible: true,
// height:160,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'GID', hidden: true
}, {
fieldLabel: 'BILLSTATUS',
name: 'BILLSTATUS', hidden: true
}, {
fieldLabel: '报价单状态',
readOnly: true,
name: 'BILLSTATUSREF',
value: '未提交'
}, {
fieldLabel: '报价单号',
readOnly: true,
name: 'BILLNO'
}, {
fieldLabel: '录入人',
readOnly: true,
name: 'CREATEUSER'
}, {
fieldLabel: '录入日期',
readOnly: true,
name: 'CREATETIME'
}, {
fieldLabel: '询价截止时间',
readOnly: true,
name: 'PQENDDATE'
}, {
fieldLabel: '揽货人',
readOnly: true,
name: 'SALE'
}, {
fieldLabel: '订舱编号',
readOnly: true,
name: 'ORDNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '委托单位',
readOnly: true,
name: 'CUSTOMERNAME'
}, {
fieldLabel: '新意向合作客户',
name: 'NEWCUSTOMERNAME'
}, {
fieldLabel: '装货港',
readOnly: true,
name: 'PORTLOAD'
}, {
fieldLabel: '卸货港',
readOnly: true,
name: 'PORTDISCHARGE'
}, this.comboxFORWARDER, {
fieldLabel: '询价供应商',
name: 'NEWFORWARDER'
}, this.comboxCARRIER]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数',
readOnly: true,
name: 'PKGS'
}, {
fieldLabel: '包装',
readOnly: true,
name: 'KINDPKGS'
}, {
fieldLabel: '重量',
readOnly: true,
name: 'KGS'
}, {
fieldLabel: '尺码',
readOnly: true,
name: 'CBM'
}, {
fieldLabel: '贸易条款',
readOnly: true,
name: 'TRADETERM'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '开船日期',
name: 'ETD'
}, {
fieldLabel: '中转港',
name: 'VIA'
}, {
fieldLabel: '航程',
name: 'TT'
}, {
fieldLabel: '运费总额',
name: 'TTLFREIGHT'
}, {
fieldLabel: '国内杂费',
name: 'RMBOT'
}, {
fieldLabel: '国外杂费美金',
name: 'USDOT'
}, {
fieldLabel: '其他币别杂费',
name: 'OTHEROT'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel:'备注', //备注
xtype: 'textareafield',
height:45,
grow: true,
flex: 4,
id: 'REMARK',
name: 'REMARK'
}, {
fieldLabel: '订舱备注', //备注
xtype: 'textareafield',
height: 45,
grow: true,
flex: 4,
id: 'ORDERREMARK',
name: 'ORDERREMARK'
}, {
fieldLabel: '审核备注', //备注
xtype: 'textareafield',
height: 45,
grow: true,
readOnly:true,
flex: 3,
name: 'AUDITREMARK'
}]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formHead
//#endregion
this.storeCtnList = Ext.create('Ext.data.Store', {
model: 'MsOpPriceFreight',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpPrice/GetPriceFreightList',
reader: {
id: 'ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//箱型_集装箱列表中的下拉框加载
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeCtn,
forceSelection: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
this.StoreCurr2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr2.load({ params: { condition: "" } });
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr2,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR'
});
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdcolumsCtn = [{
sortable: true,
dataIndex: 'ID',
header: '编号',
hidden: true,
width: 0
}, {
dataIndex: 'CTNALL',
header: '箱型', //'箱型',
width: 80,
editor: this.comboxCTNALL
}, {
dataIndex: 'CTNNUM',
header: '箱量', //'箱量',
width: 100,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}
, {
dataIndex: 'CURRENCY',
header: '币别', //'箱型',
width: 80,
editor: this.comboxCurr2
}, {
dataIndex: 'PRICE',
header: '底价', //'箱量',
width: 100,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'SELLPRICE',
header: '指导价', //'箱量',
width: 100,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}
];
this.girdcolumsCtn = this.initgirdcolumsCtn;
this.gridListCtn = new Ext.grid.GridPanel({
store: this.storeCtnList,
enableHdMenu: false,
title: '运费', //'集装箱信息',
region: 'west',
width:520,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [
{
text: '增加明细', //'增加明细',
tooltip: '增加明细', //'增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetail();
},
scope: this
}, '-', {
text: '删除明细', //'删除明细',
tooltip: '删除明细', //'删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.deleteDetail();
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolumsCtn = DsTruck.SaveGridPanel(USERID, _thisPriceEdit.formname + 'ctn', _thisPriceEdit.gridListCtn.columns, _thisPriceEdit.girdcolumsCtn, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_thisPriceEdit.girdcolums = DsTruck.SaveGridPanel(USERID, _thisPriceEdit.formname + 'ctn', _thisPriceEdit.gridListCtn.columns, _thisPriceEdit.initgirdcolumsCtn, 1, true);
}
}],
scope: this
}],
columns: this.girdcolumsCtn
});
this.girdcolumsCtn = DsTruck.GetGridPanel(USERID, this.formname + 'ctn', this.girdcolumsCtn, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridListCtn.reconfigure(this.storeCtnList, this.girdcolumsCtn);
this.gridListCtn.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
this.storeCtnList.on('beforeload', function (store) {
var condition = "";
if (this.GID == undefined) {
var billNo = this.editRecord.get('GID');
condition = "BSNO='" + billNo + "'";
} else {
var billNo = this.GID;
condition = "BSNO='" + billNo + "'";
}
Ext.apply(store.proxy.extraParams, { condition: condition });
}, this);
this.storeOtherList = Ext.create('Ext.data.Store', {
model: 'MsOpPriceOther',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpPrice/GetPriceOtherList',
reader: {
id: 'ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefListNew' }
});
this.storeFeeNameRef.load();
this.comboxFeeNameRef = Ext.create('DsExt.ux.DCombox', {
store: this.storeFeeNameRef,
minChars: 1,
matchFieldWidth: false,
//queryParam: 'Name',
forceSelection: true,
lazyRender: false,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
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', {
store: this.StoreCurr,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR'
});
this.storeFeeUnit = Ext.create('DsExt.ux.RefTableStore', {
fields: ['UNIT'],
proxy: { url: '/MvcShipping/MsCodeFeeTemplate/GetFeeUnit' }
});
this.storeFeeUnit.load({ params: { condition: "" } });
this.comboxFeeUnit = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeUnit,
forceSelection: true,
name: 'UNIT',
valueField: 'UNIT',
displayField: 'UNIT'
});
this.initgirdcolumsOther = [{
sortable: true,
dataIndex: 'ID',
header: '编号',
hidden: true,
width: 0
}, {
dataIndex: 'FEENAME',
header: '费用名称', //'箱型',
width: 80,
editor: this.comboxFeeNameRef
}, {
dataIndex: 'CURRENCY',
header: '币别', //'箱型',
width: 80,
editor: this.comboxCurr
}, {
dataIndex: 'UNITPRICE',
header: '单价', //'箱量',
width: 60,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'QUANTITY',
header: '数量', //'箱量',
width: 60,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'UNIT',
header: '标准', //'标准',
editor: this.comboxFeeUnit,
width: 80
}, {
dataIndex: 'AMOUNT',
header: '金额', //'箱量',
width: 100,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注', //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
}
}
];
this.girdcolumsOther = this.initgirdcolumsOther;
this.gridListCellEditing2 = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListOther = new Ext.grid.GridPanel({
store: this.storeOtherList,
enableHdMenu: false,
title: '杂费', //'集装箱信息',
region: 'west',
width: 420,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing2],
selType: 'cellmodel',
tbar: [
{
text: '增加明细', //'增加明细',
tooltip: '增加明细', //'增加明细',
id: "btnadddetail2",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetail2();
},
scope: this
}, '-', {
text: '删除明细', //'删除明细',
tooltip: '删除明细', //'删除明细',
id: "btndeldetail2",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.deleteDetail2();
},
scope: this
}, {
text: "保存列表样式",
id: "btntest2",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolumsOther = DsTruck.SaveGridPanel(USERID, _thisPriceEdit.formname + 'other', _thisPriceEdit.gridListOther.columns, _thisPriceEdit.girdcolumsOther, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_thisPriceEdit.girdcolums = DsTruck.SaveGridPanel(USERID, _thisPriceEdit.formname + 'other', _thisPriceEdit.gridListOther.columns, _thisPriceEdit.initgirdcolumsOther, 1, true);
}
}],
scope: this
}],
columns: this.girdcolumsOther
});
this.girdcolumsOther = DsTruck.GetGridPanel(USERID, this.formname + 'other', this.girdcolumsOther, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridListOther.reconfigure(this.storeOtherList, this.girdcolumsOther);
this.gridListOther.on('edit', function (editor, e, eOpts) {
this.gridotAfterEdit(editor, e, eOpts);
}, this);
this.storeOtherList.on('beforeload', function (store) {
var condition = "";
if (this.GID == undefined) {
var billNo = this.editRecord.get('GID');
condition = "BSNO='" + billNo + "'";
} else {
var billNo = this.GID;
condition = "BSNO='" + billNo + "'";
}
Ext.apply(store.proxy.extraParams, { condition: condition });
}, this);
//#region 附件上传
this.storeChfeeFile = Ext.create('Ext.data.Store', {
model: 'FeeFileModel',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Account/Chfee_payapplication/GetFileList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.FeeFileColumns = [
{
sortable: true, hidden: true,
dataIndex: 'GID', readOnly: true,
header: 'GID',
width: 80
}, {
sortable: true, hidden: false,
dataIndex: 'File_OriginalName', readOnly: true,
header: '文件名称', //文件名称
renderer: function (value, p, record) {
return '<a href="' + "/Areas/Account/Files/" + record.data.BillNo + '/' + record.data.File_Name + '" target="_blank" style=' + '"text-decoration:none"' + ' >' + value + '</a>';
},
width: 180
}, {
sortable: true, hidden: false,
dataIndex: 'UpdateTime', readOnly: true,
header: '上传日期', //上传日期
width: 80
}, {
sortable: true, hidden: false,
dataIndex: 'Operator', readOnly: true,
header: '上传人', //上传者
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'File_Name', readOnly: true,
header: 'FFF', //文件物理名称
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'File_Path',
header: 'File_Path',
width: 80
}, {
xtype: 'actioncolumn',
width: 50,
text: '操作', //操作
items: [{
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
tooltip: '预览',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
var filePath = "/Areas/Account/Files/" + rec.get('BillNo') + '/' + rec.get('File_Name') + '?a=' + Math.random();
var imgView = new Shipping.FileView({ filePath: filePath });
imgView.show();
}
}]
}
];
var selCertModel = Ext.create('Ext.selection.CheckboxModel');
this.fileGrid = new Ext.grid.GridPanel({
store: this.storeChfeeFile,
title: '附件', //'集装箱信息',
enableHdMenu: false,
layout: 'border',
region: 'center',
loadMask: { msg: '数据加载中,请稍等...' }, //数据加载中,请稍等...
trackMouseOver: true,
disableSelection: false,
selModel: selCertModel,
singleSelect: true,
selType: 'rowmodel',
tbar: [{
text: '上传附件', //上传图片
tooltip: '上传附件',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFileClick(button, event);
},
scope: this
}, '-', {
text: '删除', //删除
tooltip: '删除', //删除图片
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}],
columns: this.FeeFileColumns
});
//#endregion附件上传
this.panelBody = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
//frame: true,
items: [this.gridListCtn, this.gridListOther, this.fileGrid]
});
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0', '0');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1', '0');
},
scope: this
}, {
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2', '0');
},
scope: this
},
'-',
{
text: "复制新建", //"复制新建",
handler: function (button, event) {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('GID').setDisabled(false);
var field = basicForm.findField('GID');
field.setValue(NewGuid());
basicForm.findField('GID').setDisabled(true);
field = basicForm.findField('CREATEUSER');
field.setValue('');
field = basicForm.findField('BILLNO');
field.setValue('');
field = basicForm.findField('BILLSTATUSREF');
field.setValue('未提交');
field = basicForm.findField('BILLSTATUS');
field.setValue('1');
this.setSaveBtnStatus(true);
for (var j = 0; j < this.storeCtnList.getCount(); j += 1) {
var memberbody = this.storeCtnList.getAt(j);
memberbody.set("ID", '');
memberbody.commit();
};
for (var j = 0; j < this.storeOtherList.getCount(); j += 1) {
var memberbody = this.storeOtherList.getAt(j);
memberbody.set("ID", '');
memberbody.commit();
};
},
scope: this
}, {
id: 'btnESubmit',
text: "提交审核",
handler: function (button, event) {
this.Save('0','2');
},
scope: this
}, {
id: 'btnECancelSubmit',
text: "撤销提交",
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, {
text: "新建",
id: 'btnENew',
handler: function (button, event) {
this.LoadData('add', '');
},
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
id: 'btnEHistryCopy',
text:'引入历史报价',
handler: function (button, event) {
DsOpenEditWin('/MvcShipping/MsOpPrice/HistryIndex', "历史报价引入", "600", "940", "10", "10");
},
scope: this
}]
}); //end 按钮Toolbar
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportListRm' }
});
this.storeCodeLoadport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货港',
store: this.storeCodeLoadport,
queryMode: 'remote',
minChars: 2,
queryParam: 'PORT',
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisPriceEdit.onRefreshClick();
}
}
}
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'remote',
matchFieldWidth: false,
minChars: 1,
queryParam: 'PORT',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisPriceEdit.onRefreshClick();
}
}
}
});
//人员信息加载
this.storeSaleCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeSaleCode.load();
//操 作
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSaleCode,
forceSelection: true,
name: 'SALE',
queryMode: 'remote',
//flex: 0.5,
minChars: 0,
queryParam: 'CODENAME',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisPriceEdit.onRefreshClick();
}
}
}
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
// this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisPriceEdit.onRefreshClick();
}
}
}
});
//客户加载_船公司
this.storeCARRIERQ = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
//船公司
this.comboxCARRIERQ = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司', //'船公司',
store: this.storeCARRIERQ,
//forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisPriceEdit.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [ {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '订舱单号',
name: 'ORDNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxPORTLOAD, this.comboxPORTDISCHARGE,this.comboxSALE, this.comboxCustCode, this.comboxCARRIERQ, {
xtype: 'button',
width: 60,
text:'查询', //查询
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsSeaeOrderModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsSeaeOrder/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_thisPriceEdit.onRefreshClick();
}
}
}
});
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 0
}, {
sortable: true,
dataIndex: 'PQSTATUS',
header: '询价状态',
width: 120
},
{
sortable: true,
dataIndex: 'PRICEOP',
header: '询价人',
width: 100
}, {
sortable: true,
dataIndex: 'PQENDDATE',
header: '询价截止时间',
width: 120
}, {
sortable: true,
dataIndex: 'ORDNO',
header: '订舱编号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
},
{
sortable: true,
dataIndex: 'ORSTATUSREF',
header: '状态',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '确认订舱') {
meta.tdCls = 'feestatus_settle';
} else if (value == '驳回') {
meta.tdCls = 'feestatus_nopass';
} else if (value == '退舱') {
meta.tdCls = 'feestatus_Del';
}
return value;
}
},
{
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTSERVICE',
header: '客服员',
width: 80
},
{
sortable: true,
dataIndex: 'DOC',
header: '单证客服员',
width: 80
},
{
sortable: true,
dataIndex: 'FRCUSTSERVICE',
header: '海外客服员',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
sortable: true,
dataIndex: 'LANE',
header: '航线',
width: 80
},
{
sortable: true,
dataIndex: 'BSDATE',
header: '接单日期',
width: 80
},
{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 80
},
{
sortable: true,
dataIndex: 'BLTYPE',
header: '装运方式',
width: 60
},
{
sortable: true,
dataIndex: 'STLNAME',
header: '结算方式',
width: 60
},
{
sortable: true,
dataIndex: 'STLDATE',
header: '结算日期',
width: 60
},
{
sortable: true,
dataIndex: 'BLFRT',
header: '付费方式',
width: 60
},
{
sortable: true,
dataIndex: 'CARGOID',
header: '货物标识',
width: 60
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
},
{
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 120
},
{
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80
},
{
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
},
{
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '集装箱',
width: 80
},
{
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'OP',
header: '操作员',
width: 80
},
{
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 100
},
{
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
},
{
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 100
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 100
},
{
sortable: true,
dataIndex: 'DESTINATION',
header: '目的港',
width: 100
},
{
sortable: true,
dataIndex: 'CUSTOMSER',
header: '报关行',
width: 80
},
{
sortable: true,
dataIndex: 'KINDPKGS',
header: '件数包装',
width: 60
},
{
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 100
},
{
sortable: true,
dataIndex: 'AGENTID',
header: '国外代理',
width: 100
},
{
sortable: true,
dataIndex: 'AUDITOPERATOR',
header: '审核人',
width: 100
},
{
sortable: true,
dataIndex: 'AUDITDATE',
header: '审核日期',
width: 100
},
{
sortable: true,
dataIndex: 'CONFIRMOP',
header: '确认人',
width: 100
},
{
sortable: true,
dataIndex: 'CONFIRMDATE',
header: '确认日期',
width: 100
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 100
},
{
sortable: true,
dataIndex: 'SERVICECONTRACTNO',
header: '服务合同号',
width: 100
},
{
sortable: true,
dataIndex: 'SALECORP',
header: '所属分部',
width: 100
},
{
sortable: true,
dataIndex: 'INVNO',
header: '发票号',
width: 100
},
{
sortable: true,
id: '',
dataIndex: 'DRFEESTATUS',
header: '应收费用', //'应收费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
},
{
sortable: true,
id: '',
dataIndex: 'CRFEESTATUS',
header: '应付费用', //'应付费用',
align: 'center',
width: 60,
renderer: function (value, meta) {
if (value == '审核通过') {
meta.tdCls = 'feestatus_pass';
} else if (value == '录入状态') {
} else if (value == '提交审核') {
meta.tdCls = 'feestatus_refer';
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_refer';
} else if (value == '结算完毕') {
meta.tdCls = 'feestatus_settle';
} else if (value == '未录入') {
} else if (value == '部分结算') {
meta.tdCls = 'feestatus_settle';
} else if (value == '部分审核') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分提交') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
}];
this.girdcolums=this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
selModel: this.GridCheckBoxModel,
disableSelection: false,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
tbar: [{
text: '添加订单', //添加申请费用明细
tooltip: '添加订单',
iconCls: "btnadddetail",
id: "btnadddetailBs",
handler: function (button, event) {
this.onAddOrderClick(button, event);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest3",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _thisPriceEdit.formname, _thisPriceEdit.gridList.columns, _thisPriceEdit.girdcolums, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_thisPriceEdit.girdcolums = DsTruck.SaveGridPanel(USERID, _thisPriceEdit.formname, _thisPriceEdit.gridList.columns, _thisPriceEdit.initgirdcolums, 1, true);
}
}],
scope: this
}],
listeners: {
cellclick: function (thisTab, record, item, index, e, eOpts) {
if (index == 10) {//设置按钮列
// alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode);
}
}
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////
this.paneladd = new Ext.Panel({
title: '添加订单', //添加支付结算明细
layout: "border",
// region: 'south',
region: "center",
// height: 420,
items: [
this.formSearch, this.gridList
]
});
Ext.apply(this, {
items: [this.panelBtn, this.formHead, this.panelBody, this.paneladd]
});
parentWin = window.parent.opener;
if (this.GID == undefined) {
this.InitData();
} else {
this.opStatus = 'edit'
var condition = " GID='" + this.GID + "'";
this.LoadData(this.opStatus, condition);
this.paneladd.setVisible(false);
}
}, //end initUIComponents
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];
}
if (this.opStatus == 'copyaddfee') {
this.opStatus = 'copyadd';
this.copyfee = true;
}
//
if (this.opStatus == 'edit') {
//
condition = " GID='" + this.editRecord.get('GID') + "'";
}
this.LoadData(this.opStatus, condition);
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsSeaeOrderCtn',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsSeaeOrder/GetBodyList',
reader: {
id: 'ORDNO,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
}, //end InitData
LoadData: function (opstatus, condition) {
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpPrice/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;
}
data = result.data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.GetEditStatus();
if (this.opStatus == 'add') {
var basicForm = this.formHead.getForm();
basicForm.findField('GID').setDisabled(false);
var field = basicForm.findField('GID');
field.setValue(NewGuid());
basicForm.findField('GID').setDisabled(true);
//if (this.opStatus == 'add') {
// this.LoadDefValue();
//}
}
if (this.opStatus == 'edit') {
this.storeCtnList.load({ params: { condition: "BSNO='" + data.GID + "'" } });
this.storeOtherList.load({ params: { condition: "BSNO='" + data.GID + "'" } });
this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: data.GID } });
} else {
this.storeCtnList.load({ params: { condition: "BSNO='1'" } });
this.storeOtherList.load({ params: { condition: "BSNO='1'" } });
this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo:'1' } });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
if (this.GID == undefined) {
billno = this.editRecord.get('GID');
} else {
billno = this.GID;
}
}
},
// end LoadDate
Save: function (type,subtype) {
var basicForm2 = this.formHead.getForm();
if (!basicForm2.isValid()) {
return;
}
if (subtype == '2') {
var billstatus = this.formHead.getForm().findField('ORDNO').getValue();
if (billstatus == '') {
Ext.Msg.show({ title: '提示', msg: '订舱编号不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var billstatus = this.formHead.getForm().findField('TTLFREIGHT').getValue();
if (billstatus ==0) {
Ext.Msg.show({ title: '提示', msg: '运费为0不允许提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var PQENDDATE = this.formHead.getForm().findField('PQENDDATE').getRawValue();
if (PQENDDATE != '') {
var oDate1 = new Date(PQENDDATE);
var oDate2 = new Date();
if (oDate1.getTime() < oDate2.getTime()) {
Ext.Msg.show({ title: '提示', msg: '小于询价截至日期不允许提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
}
this.formHead.getForm().findField('GID').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
this.formHead.getForm().findField('GID').setDisabled(true);
var bodyctndatas = [];
for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
var member = this.storeCtnList.getAt(i);
bodyctndatas.push(member);
}
;
var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas);
var bodyotdatas = [];
var j= 1;
for (var i = 0; i < this.storeOtherList.getCount(); i += 1) {
var member = this.storeOtherList.getAt(i);
member.data.SEQUENCE = j;
bodyotdatas.push(member);
j = j + 1;
}
;
var jsonOtBody = ConvertRecordsToJsonAll(bodyotdatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpPrice/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
bodylist: jsonCtnBody,
otbodylist: jsonOtBody,
subtype: subtype,
pricetype:'询价'
},
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.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.GetEditStatus();
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpPrice', 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';
basicForm2.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeCtnList.getCount(); j += 1) {
var memberbody = this.storeCtnList.getAt(j);
memberbody.set("BSNO", data.GID);
memberbody.commit();
};
for (var j = 0; j < this.storeOtherList.getCount(); j += 1) {
var memberbody = this.storeOtherList.getAt(j);
memberbody.set("BSNO", data.GID);
memberbody.commit();
};
} else if (type == '1') {
this.opStatus = 'edit';
window.close();
} else if (type == '2') {
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
addDetail: function () {
var record = Ext.create('MsOpPriceFreight', {
BSNO: '*',
CTNALL: '',
CURRENCY: 'USD',
CTNNUM: 1,
ID: 0,
PRICE: 0,
SELLPRICE: 0
});
this.storeCtnList.add(record);
var n = this.storeCtnList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
deleteDetail: function () {
var selectedRecords = this.gridListCtn.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*" || rec.data.ID == "")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeCtnList.remove(selectedRecords[i]);
//this.setAllTotal();
}
else {
Ext.MessageBox.confirm('提示','确实要删除箱型箱量吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作数据');
Ext.Ajax.request({
waitMsg: '正在操作数据', //'正在删除数据...',
url: '/MvcShipping/MsOpPrice/DeleteFreightDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeCtnList.reload();
//this.setAllTotal();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
addDetail2: function () {
var record = Ext.create('MsOpPriceOther', {
BSNO: '*',
FEENAME: '',
CURRENCY: 'RMB',
UNITPRICE: 0,
QUANTITY: 0,
AMOUNT: 0
});
this.storeOtherList.add(record);
var n = this.storeOtherList.getCount();
this.gridListCellEditing2.startEditByPosition({ row: n - 1, column: 1 });
},
deleteDetail2: function () {
var selectedRecords = this.gridListOther.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*" || rec.data.ID == "")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeOtherList.remove(selectedRecords[i]);
//this.setAllTotal();
}
else {
Ext.MessageBox.confirm('提示', '确实要删除箱型箱量吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作数据');
Ext.Ajax.request({
waitMsg: '正在操作数据', //'正在删除数据...',
url: '/MvcShipping/MsOpPrice/DeleteOtherDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeOtherList.reload();
//this.setAllTotal();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
gridAfterEdit: function (editor, e, eOpts) {
if (e.field == 'CTNNUM' || e.field == 'PRICE') {
var PRICE = e.record.data['PRICE'];
e.record.set('SELLPRICE', PRICE);
this.setAllTotal();
}
},
gridotAfterEdit: function (editor, e, eOpts) {
if (e.field == 'UNITPRICE' || e.field == 'QUANTITY') {
var UNITPRICE = e.record.data['UNITPRICE'];
var QUANTITY = e.record.data['QUANTITY'];
AMOUNT = Mul(UNITPRICE, QUANTITY);
e.record.set('AMOUNT', AMOUNT);
this.setAllTotal();
}
if (e.field == 'CURRENCY' || e.field == 'AMOUNT') {
this.setAllTotal();
}
},
setAllTotal: function () {
var total = 0;
for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
var member = this.storeCtnList.getAt(i);
var unitPrice = member.data.PRICE;
var quantity = member.data.CTNNUM;
var amount = Mul(unitPrice, quantity);
total = Add(total, amount, 4);
}
var field = this.formHead.getForm().findField('TTLFREIGHT');
field.setValue(total);
var rmbtotal = 0;
var usdtotal = 0;
var ottotal = 0;
for (var i = 0; i < this.storeOtherList.getCount(); i += 1) {
var member = this.storeOtherList.getAt(i);
var CURRENCY = member.data.CURRENCY;
var AMOUNT = member.data.AMOUNT;
if (CURRENCY=='RMB')
rmbtotal = Add(rmbtotal, AMOUNT, 4);
if (CURRENCY == 'USD')
usdtotal = Add(usdtotal, AMOUNT, 4);
if (CURRENCY != 'USD' && CURRENCY != 'RMB')
ottotal = Add(ottotal, AMOUNT, 4);
}
var field = this.formHead.getForm().findField('RMBOT');
field.setValue(rmbtotal);
var field = this.formHead.getForm().findField('USDOT');
field.setValue(usdtotal);
var field = this.formHead.getForm().findField('OTHEROT');
field.setValue(ottotal);
},
GetEditStatus: function () {
var canedit = false;
var BILLSTATUS = this.formHead.getForm().findField('BILLSTATUS').getValue();
var CREATEUSER = this.formHead.getForm().findField('CREATEUSER').getValue();
//
if (BILLSTATUS == "0") {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modOpPriceList" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_thisPriceEdit.StoreOpRange, 'OPID', CREATEUSER);
if (records.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
} else { canedit = false; }
_thisPriceEdit.setSaveBtnStatus(canedit);
}
}
});
}
//
},
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.formHead.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);
}
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
});
},
//#region 文件上传
onAddFileClick: function () {
var billstatus = this.formHead.getForm().findField('BILLSTATUS').getValue();
if ((billstatus != 1) && (billstatus != 4)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BillNo = this.formHead.getForm().findField('GID').getValue();
if (BillNo == '' || BillNo == '*') {
Ext.MessageBox.alert(Zi.LAN.Prompt, '请先生成编号!'); //提示', '请先生成申请编号!
return;
}
var winAccess = new Shipping.FileUpload({});
winAccess.BillNo = BillNo;
winAccess.storeChfeeFile = this.storeChfeeFile;
winAccess.show();
}, onDelFileClick: function () {
var billstatus = this.formHead.getForm().findField('BILLSTATUS').getValue();
if ((billstatus != 1) && (billstatus != 2)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selections = this.fileGrid.getSelectionModel().getSelection();
if (selections.length == 0) {//提示', msg: '请先选择要删除的数据!
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的数据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BillNo = this.formHead.getForm().findField('GID').getValue();
var record = new Array();
for (var i = 0; i < selections.length; i++) {
record.push(selections[i].data);
} //提示', '确定删除该记录吗?'
Ext.MessageBox.confirm('提示', '确认要删除吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据'); //正在删除数据
Ext.Ajax.request({
waitMsg: '正在删除数据',
url: '/Account/Chfee_payapplication/CertDel',
params: {
data: Ext.JSON.encode(record)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
panelEdit.LoadData('edit', "BILLNO='" + BillNo + "'");
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} //提示
else {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {//'警告', msg: '服务器响应出错,请重试'
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
//#endregion
onSubmitAuditBackClick: function () {
var Duino = this.formHead.getForm().findField('GID').getValue();
var billstatus = this.formHead.getForm().findField('BILLSTATUS').getValue();
if (Duino == '*') {//提示', msg: '请先保存付费申请,然后才能提交审核!
Ext.Msg.show({ title: '提示', msg: '请先保存单据', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != 2) {
//提示', msg: '当前状态无法撤销提交!
Ext.Msg.show({
title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.Ajax.request({//正在添加数据..
waitMsg: '正在处理...',
url: '/MvcShipping/MsOpPrice/SubmitAuditBack',
params: {
bill: Duino
},
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 condition = " GID='" + this.editRecord.get('GID') + "'";
this.LoadData(this.opStatus, condition);
}
} else {//请求出现错误,请重试'
Ext.MessageBox.alert('错误', response.responseText);
}
},
scope: this
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnadddetail = Ext.getCmp('btnadddetail');
var btndeldetail = Ext.getCmp('btndeldetail');
var btnadddetail2 = Ext.getCmp('btnadddetail2');
var btndeldetail2 = Ext.getCmp('btndeldetail2');
var btnECancelSubmit = Ext.getCmp('btnECancelSubmit');
var btnESubmit = Ext.getCmp('btnESubmit');
var BILLSTATUS = this.formHead.getForm().findField('BILLSTATUS').getValue();
if (enable) {
if (BILLSTATUS == '1') {
btnESubmit.enable();
btnECancelSubmit.disable();
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnadddetail.enable();
btnadddetail2.enable();
btndeldetail.enable();
btndeldetail2.enable();
} else if (BILLSTATUS == '2') {
btnESubmit.disable();
btnECancelSubmit.enable();
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnadddetail.disable();
btnadddetail2.disable();
btndeldetail.disable();
btndeldetail2.disable();
}
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnadddetail.disable();
btnadddetail2.disable();
btndeldetail.disable();
btndeldetail2.disable();
btnESubmit.disable();
btnECancelSubmit.disable();
}
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql } });
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {//提示', '查询条件赋值错误,请检查
Ext.Msg.alert(Zi.LAN.Prompt, Zi.LAN.SelectError);
return '';
}
var ORDNO = this.formHead.getForm().findField('ORDNO').getValue();
// var sql = " isnull(b.PQSTATUS,'')='提交询价' and NOT EXISTS (SELECT 1 FROM OP_PRICE WHERE OP_PRICE.ORDNO=B.ORDNO AND OP_PRICE.CREATEUSER='" + GID +"' ) ";
var sql = " isnull(b.PQSTATUS,'')='提交询价' and b.ORSTATUS<>'4' and (isnull(PRICEOP,'')='' or PRICEOP like '%" + SHOWNAME + "%' ) ";
sql = sql + getAndConSql(sql, ORDNO, " ORDNO<>'" + ORDNO + "'");
//装货港
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD like '%" + PORTLOAD + "%'");
//卸货港
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE like '%" + PORTDISCHARGE + "%'");
//船公司
var CARRIER = form.findField('CARRIER').getValue();
sql = sql + getAndConSql(sql, CARRIER, "CARRIER='" + CARRIER + "'");
//揽货人
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "SALE='" + SALE + "'");
//客户名称
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
var ORDNO = form.findField('ORDNO').getValue();
sql = sql + getAndConSql(sql, ORDNO, "(ORDNO like '%" + ORDNO + "%')");
// sql = sql + getAndConSql(sql, feesql, feesql);
// this.BillSql = sql;
return sql;
},
onAddOrderClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var rec = selections[0];
this.formHead.getForm().findField('CUSTOMERNAME').setValue(rec.data.CUSTOMERNAME);
this.formHead.getForm().findField('NEWCUSTOMERNAME').setValue(rec.data.NEWCUSTOMERNAME);
this.formHead.getForm().findField('ORDNO').setValue(rec.data.ORDNO);
this.formHead.getForm().findField('PORTLOAD').setValue(rec.data.PORTLOAD);
this.formHead.getForm().findField('PORTDISCHARGE').setValue(rec.data.PORTDISCHARGE);
this.formHead.getForm().findField('CARRIER').setValue(rec.data.CARRIER);
this.formHead.getForm().findField('SALE').setValue(rec.data.SALE);
this.formHead.getForm().findField('PQENDDATE').setValue(rec.data.PQENDDATE);
this.formHead.getForm().findField('PKGS').setValue(rec.data.PKGS);
this.formHead.getForm().findField('KINDPKGS').setValue(rec.data.KINDPKGS);
this.formHead.getForm().findField('KGS').setValue(rec.data.KGS);
this.formHead.getForm().findField('CBM').setValue(rec.data.CBM);
this.formHead.getForm().findField('TRADETERM').setValue(rec.data.TRADETERM);
this.formHead.getForm().findField('ORDERREMARK').setValue(rec.data.REMARK);
var condition = "ORDNO='" + rec.data.ORDNO + "'";
this.storeBodyList.load({
params: { condition: condition },
callback: function (r, options, success) {
if (success) {
if (_thisPriceEdit.storeBodyList.getCount() > 0) {
for (var j = 0; j < _thisPriceEdit.storeBodyList.getCount(); j += 1) {
var memberbody = _thisPriceEdit.storeBodyList.getAt(j);
var record = Ext.create('MsOpPriceFreight', {
BSNO: '*',
CTNALL: memberbody.data.CTNALL,
CTNNUM: memberbody.data.CTNNUM,
CURRENCY:'USD',
PRICE: 0,
BASEPRICE: 0,
SELLPRICE: 0
});
_thisPriceEdit.storeCtnList.add(record);
}
} else {
}
}
},
scope: this
});
/* this.Save('0', '0');*/
},
//#region 上一票,下一票
PrevRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title:'警告', msg:'已经是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); //'警告', '已是最前一票'
return;
}
var children = this.tabOtherPanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodOpOtherInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已经是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); //'警告', '已是最后一票'
return;
}
var children = this.tabOtherPanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodOpOtherInfo') {
//this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabOtherPanel.doLayout();
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
//#endregion
Print: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSOPOHTER';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_other WHERE BSNO = '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
getIsModify: function () {
var feepanel = Ext.getCmp('pnlmodOpOtherAllFee');
if (feepanel != NaN && feepanel != null) {
var feemodify = feepanel.panelFee.getModifyStatus();
if (feemodify) {
return '费用信息';
}
}
var feeamendpanel = Ext.getCmp('pnlmodOpOtherAmendFee');
if (feeamendpanel != NaN && feeamendpanel != null) {
var feemodify = feeamendpanel.panelFee.getModifyStatus();
if (feemodify) {
return '更改单信息';
}
}
if (this.formHead.getForm().isDirty() == true) {
return '业务信息';
}
else return '';
}
});