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/MsFeeTemplate/FeeTemplatePLAdd.js

761 lines
24 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.FeeTemplatePLAdd = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.FeeTemplatePLAdd.superclass.constructor.call(this);
};
Ext.extend(Shipping.FeeTemplatePLAdd, Ext.Panel, {
PageSize: 100,
ParentWin: null,
feeType: 0,
feeTypeRef: '',
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
StoreDateCurr: null,
storeCustomerNameRef: null,
StoreCurr: null,
EditRecord: null,
stroplb: '',
strGID: '',
initUIComponents: function () {
this.DEFORDERCUST = "";
this.SALECORP = "";
this.ACCTAXRATESAMETAXRATE = 0;
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsFeeTemplate',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsFeeTemplate/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
// height: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
tbar: [{
text:'确定引入', //删除账单明细
tooltip: Zi.LAN.sczdmingxi,
iconCls: "btnadd",
id: 'btnadd',
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
2 years ago
}, {
text: '确定引入(客户类别)', //删除账单明细
tooltip: Zi.LAN.sczdmingxi,
iconCls: "btnadd",
id: 'btnadd2',
handler: function (button, event) {
this.onAddDetailClick2(button, event);
},
scope: this
}],
3 years ago
columns: [{
sortable: true,
dataIndex: 'Name',
header: '模板名称',
width: 100
}, {
sortable: true,
dataIndex: 'Description',
header: '模板说明',
width: 120
}, {
sortable: true,
dataIndex: 'OpTyperef',
header: '业务类型',
width: 80
}, {
sortable: true,
dataIndex: 'FeeTyperef',
header: '费用类型',
width: 60
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 220
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#region 固定费用明细表
//#region 费用表
//明细表-数据集
this.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsFeeTemplateDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsFeeTemplate/GetDetailDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
// this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
this.gridListChFee = new Ext.grid.GridPanel({
store: this.storeBodyChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
// selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
width: 120
}, {
sortable: true,
dataIndex: 'FEEDESCRIPTION',
header: '费用英文名称',
width: 120
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
width: 120
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
width: 120
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
width: 60
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
width: 60
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
width: 60
}, {
sortable: true,
dataIndex: 'ExchangeRate',
header: '汇率',
width: 60
}, {
sortable: true,
dataIndex: 'TaxRate',
header: '税率',
width: 60
}, {
sortable: true,
dataIndex: 'TaxUnitPrice',
header: '含税单价',
width: 60
}, {
sortable: true,
dataIndex: 'Tax',
header: '税额',
width: 60
}, {
sortable: true,
dataIndex: 'AccTaxRate',
header: '财务税率',
width: 60
}, {
sortable: true,
dataIndex: 'FEEFRT',
header: 'FRT',
width: 20
}, {
sortable: true,
dataIndex: 'SALECORP',
header: '核算单位',
width: 120
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 150
}
]
});
this.storeBodyAddList = Ext.create('Ext.data.Store', {
model: 'MsOpBill',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBill/GetBLListData',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeBodyAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类别',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 108
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 108
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 150
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
}
]
});
//#endregion
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "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',
// labelWidth: 50,
forceSelection: true,
name: 'DC',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxaddDCType,{
fieldLabel: '模板名称',
name: 'NAME'
}, {
fieldLabel: '模板说明',
name: 'DESCRIPTION'
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 55,
items: [this.formSearch]
});
this.panelBodyChFee = new Ext.Panel({
title: '费用明细',
layout: "border",
region: 'east',
width:600,
margin: '5 10',
items: [this.gridListChFee]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "north",
height:300,
items: [
this.gridList, this.panelBodyChFee
]
});
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.storeDefValue.load({ params: { condition: "BSTYPE='费用信息'" } });
Ext.apply(this, {
items: [this.panelTop, this.panelFee, this.gridAddList]
});
//#endregion
this.parentWin = window.parent.opener._thisfee;
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
this.gridList.getSelectionModel().on('select', function (model, record, index) {
//alert(record.data.BillNo);
var bsno = record.data.GID;
this.strGID = record.data.GID;
feeType = record.data.FeeType;
feeTypeRef = record.data.FeeTyperef;
this.storeBodyChFee.load({ params: { TemplateID: bsno} });
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
parentWin = window.parent.opener;
this.onAutoRefresh();
//#endregion
}, //end initUIComponents
onAutoRefresh: function () {
if (parentWin) {
var ret = parentWin.OprationSwap();
_this.strbsno = ret[3];
_this.storeBodyAddList.load({
params: { start: 0, limit: 1000, sort: '', condition: _this.strbsno },
waitMsg: "正在查询数据...",
callback: function (r, options, success) {
if (success) {
var memdata = _this.storeBodyAddList.getAt(0);
var OPLBNAME = memdata.data.OPLB.toUpperCase();
this.stroplb = OPLBNAME;
var sql = '';
if (this.stroplb == 'OP_SEAE' || this.stroplb == 'op_SeaeOrder') {
sql = ' OpType=1 ';
} else if (this.stroplb == 'OP_SEAI') {
sql = ' OpType=2 ';
} else if (this.stroplb == 'OP_AIRE') {
sql = ' OpType=3 ';
} else if (this.stroplb == 'OP_AIRI') {
sql = ' OpType=7 ';
} else if (this.stroplb == 'OP_APPLY') {
sql = ' OpType=4 ';
} else if (this.stroplb == 'OP_BULK') {
sql = ' OpType=5 ';
} else if (this.stroplb == 'OP_OTHER') {
sql = ' OpType=6 ';
} else if (this.stroplb == 'OP_TRUCK') {
sql = ' OpType=8 ';
2 years ago
} else if (this.stroplb == 'OP_RAILWAY') {
sql = ' OpType=9 ';
3 years ago
}
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
},
scope: this
});
}
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAddDetailClick: function (button, event) {
var bodyDrChFeeDatas = [];
var i;
var bodyBillDatas = [];
var selections = this.gridListCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title:'提示', msg:'请选择费用模板', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要生成的业务!
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyDrChFeeDatas.push(rec);
}
for (i = 0; i < this.storeBodyAddList.getCount(); i += 1) {
var memberyf = this.storeBodyAddList.getAt(i);
bodyBillDatas.push(memberyf);
};
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
var jsonbodyBill = ConvertRecordsToJsonAll(bodyBillDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsFeeTemplate/PiliangAdd',
scope: this,
params: {
bill: jsonbodyBill,
2 years ago
body: jsonChFeeBody,
isclienttype: '0'
3 years ago
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({
title: '提示',
msg: jsonresult.Message,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
return;
} 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
});
}
}
});
},
2 years ago
onAddDetailClick2: function (button, event) {
var bodyDrChFeeDatas = [];
var i;
var bodyBillDatas = [];
var selections = this.gridListCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请选择费用模板', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要生成的业务!
return;
}
var BSNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyDrChFeeDatas.push(rec);
}
for (i = 0; i < this.storeBodyAddList.getCount(); i += 1) {
var memberyf = this.storeBodyAddList.getAt(i);
bodyBillDatas.push(memberyf);
};
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
var jsonbodyBill = ConvertRecordsToJsonAll(bodyBillDatas);
3 years ago
2 years ago
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsFeeTemplate/PiliangAdd',
scope: this,
params: {
bill: jsonbodyBill,
body: jsonChFeeBody,
isclienttype:'1'
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({
title: '提示',
msg: jsonresult.Message,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
return;
} 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
});
}
}
});
},
3 years ago
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var DC = form.findField('DC').getValue();
sql = sql + getAndConSql(sql, DC, "FeeType=" + DC);
if (this.stroplb == 'OP_SEAE' || this.stroplb == 'op_SeaeOrder') {
sql = ' OpType=1 ';
} else if (this.stroplb == 'OP_SEAI') {
sql = ' OpType=2 ';
} else if (this.stroplb == 'OP_AIRE') {
sql = ' OpType=3 ';
} else if (this.stroplb == 'OP_AIRI') {
sql = ' OpType=7 ';
} else if (this.stroplb == 'OP_APPLY') {
sql = ' OpType=4 ';
} else if (this.stroplb == 'OP_BULK') {
sql = ' OpType=5 ';
} else if (this.stroplb == 'OP_OTHER') {
sql = ' OpType=6 ';
} else if (this.stroplb == 'OP_TRUCK') {
sql = ' OpType=8 ';
2 years ago
} else if (this.stroplb == 'OP_RAILWAY') {
sql = ' OpType=9 ';
3 years ago
}
//if (this.stroplb == 'op_Seae') {
// sql = ' OpType=1 and FeeType=' + this.feeType;
//} else if (this.stroplb == 'op_Seai') {
// sql = ' OpType=2 and FeeType=' + this.feeType;
//} else if (this.stroplb == 'op_Aire') {
// sql = ' OpType=3 and FeeType=' + this.feeType;
//} else if (this.stroplb == 'op_Airi') {
// sql = ' OpType=4 and FeeType=' + this.feeType;
//} else if (this.stroplb == 'op_Apply') {
// sql = ' OpType=4 and FeeType=' + this.feeType;
//} else if (this.stroplb == 'op_Bulk') {
// sql = ' OpType=5 and FeeType=' + this.feeType;
//} else if (this.stroplb == 'op_other') {
// sql = ' OpType=6 and FeeType=' + this.feeType;
//}
var custName = form.findField('NAME').getValue();
sql = sql + getAndConSql(sql, custName, " Name like '%" + custName + "%'");
var mblNo = form.findField('DESCRIPTION').getValue();
sql = sql + getAndConSql(sql, mblNo, " Description like '%" + mblNo + "%'");
return sql;
}
});