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.

1507 lines
55 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.MsOpCtnBsCardFee = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnBsCardFee.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnBsCardFee, Ext.Panel, {
PageSize: 50,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
stroplb: '',
StoreDateCurr: null,
StoreCurr: null,
initUIComponents: function () {
this.formname = "formMsOpCtnBsCardFee"; //页面名称
this.sqlcontext = '';
this.ctnno = '';
this.selectremark = '';
this.ishistry = getUrlParam('ishistry');
this.mfeetype = getUrlParam('feetype');
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpCtnBsCard',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnBsCard/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'CTNNO',
header: '箱号',
width: 200
}, {
sortable: true,
dataIndex: 'APPLYNO',
header: '放箱申请编号',
width: 120
}, {
sortable: true,
dataIndex: 'CTNPROP',
header: '箱属',
width: 200
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
width: 200
}, {
sortable: true,
dataIndex: 'ISCLOSE',
header: '锁定',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
sortable: true,
dataIndex: 'IS_PUTCTN',
header: '放箱通知发送',
width: 100,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "是";
}
}
}, {
sortable: true,
dataIndex: 'PUTCTNDATE',
header: '放箱通知发送时间',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 200
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '货物名称',
width: 100
}, {
sortable: true,
dataIndex: 'PREGOODSNAME',
header: '前装货品名',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'ETA',
header: '到港日期',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTNAME',
header: '目的港代理',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_PORT',
header: '当前位置',
width: 100
}, {
sortable: true,
dataIndex: 'CUR_DATE',
header: '当前时间',
width: 100
}, {
sortable: true,
dataIndex: 'CYCLE_DAY',
header: '周期',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 200
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 200
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 200
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_STATOIN',
header: '起运港场站',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD_CNT_TIME',
header: '起运港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'LOADFACTORY',
header: '装货工厂',
width: 200
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT',
header: '目的港',
width: 100
}, {
sortable: true,
dataIndex: 'DEST_CNT_TIME',
header: '目的港提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DEST_RTCNT_TIME',
header: '目的港还箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'DESTPORT_STATOIN',
header: '目的港场站',
width: 200
}, {
sortable: true,
dataIndex: 'DETAIN_CTN_DAYS',
header: '滞箱天数',
width: 200
}, {
sortable: true,
dataIndex: 'PRE_CNT_TIME',
header: '预计提箱日期',
width: 200
}, {
sortable: true,
dataIndex: 'IS_RETURE_EMPTY',
header: '是否返空',
width: 100
}, {
sortable: true,
dataIndex: 'IS_POD_CLEAN',
header: '否目的港清洗',
width: 100
}, {
sortable: true,
dataIndex: 'IS_BOOKING',
header: '是否订舱',
width: 200
}, {
sortable: true,
dataIndex: 'I_CUSTNO',
header: '空返委托编号',
width: 100
}, {
sortable: true,
dataIndex: 'I_MBLNO',
header: '空返提单号',
width: 120
}, {
sortable: true,
dataIndex: 'I_CARRIER',
header: '空返船公司',
width: 100
}, {
sortable: true,
dataIndex: 'I_CONTRACT',
header: '运费约价',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD_CNT_TIME',
header: '空返起运港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_PORTLOAD',
header: '空返起运港',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETD',
header: '空返开船日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT',
header: '空返目的港',
width: 100
}, {
sortable: true,
dataIndex: 'I_ETA',
header: '空返到港日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DESTPORT_STATOIN',
header: '空返目的港场站',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_CNT_TIME',
header: '空返目的港提箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'I_DEST_RTCNT_TIME',
header: '空返目的港还箱日期',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_FREE_DAYS',
header: '起运港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS',
header: '起运港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_FEE',
header: '起运港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD_OVER_DAYS_AMT',
header: '起运港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_FREE_DAYS',
header: '目的港免箱使天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS',
header: '目的港超期天数',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_FEE',
header: '目的港箱使费/天',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_OVER_DAYS_AMT',
header: '目的港箱使费',
width: 100
}, {
sortable: true,
dataIndex: 'BOOKGOODNAME',
header: '订舱品名',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMGOODNAME',
header: '报关品名',
width: 100
}, {
sortable: true,
dataIndex: 'TRUCKNAME',
header: '录车队',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'north',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
height: 150,
disableSelection: false,
viewConfig: {
enableTextSelection: true
},
selModel: this.GridCheckBoxModel,
columns: this.girdcolums
,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
//#endregion
//#region 费用表
//明细表表格相关
this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeFeeTypeRef,
name: 'FeeType'
});
//明细表-数据集
this.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_thisbscardfee = this;
this.initgirdDrcolums = [{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
width: 100
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
width: 100
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
width: 120
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
width: 60
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
width: 60
}, {
sortable: true,
dataIndex: 'TaxRate',
header: '税率',
width: 80
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: '不含税金额',
width: 80
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 60
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
width: 60
}, {
sortable: true,
dataIndex: 'AccTaxRate',
header: '财务税率',
width: 80
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 150
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
width: 100
}, {
sortable: true,
dataIndex: 'EnteroPerator',
header: '录入人',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '录入时间',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: '录入方式', //'录入方式',
width: 150
}, {
sortable: true,
dataIndex: 'WmsOutBsNo',
header: '关联号', //'录入方式',
width: 150
}
];
this.girdDrcolums = this.initgirdDrcolums;
this.gridListChFee = new Ext.grid.GridPanel({
store: this.storeBodyChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return Shipping.FeeGetRowClass(feeStatus);
}
},
columns: this.girdDrcolums,
// paging bar on the bottom
bbar: [{
xtype: "button",
id: "button_add",
iconCls: "btnadd",
text: "引入费用(选中费用)",
handler: function (button, event) {
_this.onAddDetailClick(button, event);
}
},
'-', {
xtype: "button",
id: "button_addall",
iconCls: "btnadd",
text: "引入费用(选中业务费用)",
handler: function (button, event) {
_this.onAddDetailAllClick(button, event);
}
},
'-',
{
xtype: "button",
id: "button_close",
text: "取消退出",
handler: function (button, event) {
window.close();
}
}, '-', {
text: "保存列表样式",
menu: [
{
text: "保存",
handler: function (button, event) {
_thisbscardfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'BSCARDFEEDRGRID', _thisbscardfee.gridListChFee.columns, _thisbscardfee.girdDrcolums, 0, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_thisbscardfee.gridListChFee.reconfigure(this.storeBodyChFee, _thisbscardfee.initgirdDrcolums);
_thisbscardfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'BSCARDFEEDRGRID', _thisbscardfee.gridListChFee.columns, _thisbscardfee.initgirdDrcolums, 0, true);
}
}],
scope: this
}
]
});
this.girdDrcolums = DsTruck.GetGridPanel(GID, 'BSCARDFEEDRGRID', this.girdDrcolums, 0); //使用者id表名中间column数组跳过一开始的几列
this.gridListChFee.reconfigure(this.storeBodyChFee, this.girdDrcolums);
//#endregion
//#region formSearch 查询面板
_this = this;
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreBILLTYPE = Ext.create('Ext.data.Store', {
fields: ['BILLTYPE','condition']
});
this.StoreBILLTYPE.add({ "BILLTYPE": "", "condition": "" });
this.StoreBILLTYPE.add({ "BILLTYPE": "全部", "condition": "" });
this.StoreBILLTYPE.add({ "BILLTYPE": "未引入", "condition": " exists(select 1 from ch_fee where bsno=b.GID and feestatus=0 and ISNULL(ISACC,0)=0 and isnull(WMSOUTBSNO,'')='' " });
this.StoreBILLTYPE.add({ "BILLTYPE": "已引入", "condition": " exists(select 1 from ch_fee where bsno=b.GID and feestatus=0 and ISNULL(ISACC,0)=0 and isnull(WMSOUTBSNO,'')<>'' " });
//and feetype=" + this.FeeType + "
this.comboxBILLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否未引入',
labelWidth:70,
store: this.StoreBILLTYPE,
forceSelection: true,
name: 'BILLTYPE',
valueField: 'condition',
displayField: 'BILLTYPE',
value:" exists(select 1 from ch_fee where bsno=b.GID and feestatus=0 and ISNULL(ISACC,0)=0 and isnull(WMSOUTBSNO,'')='' ",
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
height: 45,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '箱号',
name: 'CTNNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '放箱申请编号',
name: 'BSNO',
labelWidth: 90,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '编号',
name: 'MBLNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '待引入委托编号',
name: 'CUSTNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, {
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
labelWidth: 20,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxBILLTYPE, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "保存列表样式",
iconCls: "",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "列表样式初始化",
iconCls: "",
handler: function (button, event) {
_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
},
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelBodyChFee = new Ext.Panel({
title: '费用明细',
layout: "border",
region: 'center',
margin: '5 10',
items: [this.gridListChFee]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.panelBodyChFee
]
});
Ext.apply(this, {
items: [this.formSearch, this.gridList, this.panelFee]
});
//#endregion
var panelEdit = window.parent.opener.panelEdit;
if ((panelEdit != null)) {
if (((panelEdit.tabSeaepanel != undefined) && (panelEdit.tabSeaepanel.activeTab.title == '费用更改单')) ||
((panelEdit.tabSeaipanel != undefined) && (panelEdit.tabSeaipanel.activeTab.title == '费用更改单'))) {
this.parentWin = window.parent.opener._thisAmendfee;
} else {
this.parentWin = window.parent.opener._thisfee;
if (this.parentWin == null || this.parentWin == NaN) this.parentWin = window.parent.opener._thisAmendfee;
}
} else {
this.parentWin = window.parent.opener._thisfee;
if (this.parentWin == null || this.parentWin == NaN) this.parentWin = window.parent.opener._thisAmendfee;
}
if (this.parentWin == null) {
this.parentWin = window.parent.opener._thistkfee;
}
if (this.parentWin) {
this.feeType = this.parentWin.feeType;
if (this.feeType == 1) {
this.StoreFee = this.parentWin.storeDrChFee;
} else if (this.feeType == 2) {
this.StoreFee = this.parentWin.storeCrChFee;
}
if (this.feeType == 0) this.feeType = this.mfeetype;
this.StoreFeeUnit = this.parentWin.StoreUnit;
this.StoreFeeCust = this.parentWin.StoreCustType;
this.EditRecord = this.parentWin.EditRecord;
this.stroplb = this.parentWin.stroplb;
this.StoreDateCurr = this.parentWin.StoreDateCurr;
this.StoreCurr = this.parentWin.StoreCurr;
}
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.sqlcontext;
// if (this.stroplb == 'op_Seai') sql = "I_CUSTNO='" + this.EditRecord.get('CUSTNO') + "'";
// else sql = "CUSTNO='" + this.EditRecord.get('CUSTNO') + "'";
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);
// //'AND (WMSOUTBSNO='' OR WMSOUTBSNO IS NULL) '
// var sql = '';
// var bsno = record.data.GID;
// this.ctnno = record.data.CTNNO;
// sql = " bsno='" + bsno + "' and feestatus=0 and feetype=" + this.feeType;
// var BILLTYPE = this.formSearch.getForm().findField('BILLTYPE').getRawValue();
// if (BILLTYPE == '未引入') sql = sql +" AND isnull(WMSOUTBSNO,'')='' ";
// if (BILLTYPE == '已引入') sql = sql + " AND isnull(WMSOUTBSNO,'')<>'' ";
// this.storeBodyChFee.load({ params: { billno: bsno, type: this.feeType, optype: 'OpCtnBsCard', condition: sql} });
//}, this);
this.gridList.on({
selectionchange: function (sm, selections) {
_this.storeBodyChFee.removeAll();
if (selections.length == 0) {
return;
}
var bsnostr = '';
var bsno = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var Gid = "'" + rec.data.GID + "'";
if (bsnostr == '')
bsnostr = Gid;
else {
bsnostr = bsnostr + ',' + Gid;
}
bsno = rec.data.GID;
_this.selectremark = '';
//if (rec.data.N_BKNO != '') {
// _this.selectremark = _this.selectremark + '订单号:' + rec.data.N_BKNO;
//}
//if (rec.data.N_CARRIER_TASKNO != '') {
// _this.selectremark = _this.selectremark + '船运-运输任务单号:' + rec.data.N_CARRIER_TASKNO;
//}
//if (rec.data.N_TRUCK_TASKNO != '') {
// _this.selectremark = _this.selectremark + '汽运-运输任务单号:' + rec.data.N_TRUCK_TASKNO;
//}
}
var sql = '';
sql = " bsno in (" + bsnostr + ") and feestatus=0 and feetype=" + _this.feeType;
var BILLTYPE = _this.formSearch.getForm().findField('BILLTYPE').getRawValue();
if (BILLTYPE == '未引入') sql = sql + " AND isnull(WMSOUTBSNO,'')='' ";
if (BILLTYPE == '已引入') sql = sql + " AND isnull(WMSOUTBSNO,'')<>'' ";
_this.storeBodyChFee.load({ params: { billno: bsno, type: _this.feeType, optype: 'OpCtnBsCard', condition: sql } });
}
});
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onAutoRefresh: function () {
var sql = '';
if (this.ishistry != '1') {
sql = "APPLYNO='" + this.EditRecord.get('APPLYNO') + "'";
this.formSearch.getForm().findField('BSNO').setValue(this.EditRecord.get('APPLYNO'));
var APPLYNO = this.EditRecord.get('APPLYNO');
var i = APPLYNO.indexOf(",");
if (i > 0) {
var slist = APPLYNO.split(",");
var feeGidSql = '';
for (var i = 0; i < slist.length; i += 1) {
var feeGId = "'" + slist[i] + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
sql = "APPLYNO in (" + feeGidSql + ")";
}
}
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
// if (this.stroplb == 'op_Seai') sql = "I_CUSTNO='" + this.EditRecord.get('CUSTNO') + "'";
// else sql = "CUSTNO='" + this.EditRecord.get('CUSTNO') + "'";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAddDetailClick: function (button, event) {
var bodyDrChFeeDatas = [];
var myDate = new Date();
selectedRecords = this.feeGridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
this.feeGridCheckBoxModel.selectAll();
selectedRecords = this.feeGridCheckBoxModel.selected.items;
}
for (i = 0; i < selectedRecords.length; i += 1) {
var memberyf = selectedRecords[i];
if (this.ishistry!=1&&memberyf.data.WmsOutBsNo != '' && memberyf.data.WmsOutBsNo != null) {
Ext.Msg.alert('提示', '此费用已引入,不允许重复引入。');
} else {
bodyDrChFeeDatas.push(memberyf);
var record = null;
var records = DsStoreQueryBy(this.StoreFeeUnit, 'UNIT', memberyf.data.Unit);
var isfindrc = DsStoreQueryBy(this.StoreFee, 'WmsOutBsNo', memberyf.data.GId);
if (isfindrc.getCount() > 0) {
} else {
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var quantity = data.QUANTITY;
} else {
var quantity = 0;
}
var taxrate = memberyf.data.TaxRate;
if (taxrate == null) taxrate = 0;
var notaxamount = Mul(quantity, memberyf.data.UnitPrice);
var tax = Div(Mul(notaxamount, taxrate), 100);
var amount = Add(notaxamount, tax);
var Feetype = memberyf.data.FeeType;
var curr = memberyf.data.Currency;
var exrate = 0;
if (curr =='RMB')
{ exrate = 1 }
else {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', curr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
if (Feetype == 2)
exrate = ffdata.CRDEFRATE;
else
exrate = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', curr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
if (Feetype == 2)
exrate = dfdata.CRDEFRATE;
else
exrate = dfdata.DEFRATE;
} else {
}
}
if (exrate == 0) exrate = memberyf.data.ExchangeRate;
};
var newsort = this.GetHandleSerialNo(this.StoreFee);
var inputmode = '业务卡导入' + memberyf.data.VOUALLNO + '(' + memberyf.data.INPUTMODE+')';
var wmsoutbsno = memberyf.data.GId;
if (this.ishistry == '1' || this.stroplb =='OpCtnBsCard') {
inputmode = '手工';
wmsoutbsno = '';
}
var feestatus = memberyf.data.FeeStatus;
var feestatusref = memberyf.data.FeeStatus_Ref;
if (this.stroplb == 'OpCtnBsCard') {
feestatus = 1;
feestatusref = "录入状态";
}
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: feestatus,
FeeStatus_Ref: feestatusref,
FeeType: memberyf.data.FeeType,
FeeName: memberyf.data.FeeName,
FeeDescription: memberyf.data.FeeDescription,
CustomerType: memberyf.data.CustomerType,
CustomerName: memberyf.data.CustomerName,
Unit: memberyf.data.Unit.replace("天", "DAY"),
UnitPrice: memberyf.data.UnitPrice,
TaxUnitPrice: memberyf.data.TaxUnitPrice,
Quantity: memberyf.data.Quantity,
TaxRate: memberyf.data.TaxRate,
NoTaxAmount: memberyf.data.NoTaxAmount,
Amount: memberyf.data.Amount,
AccTaxRate: memberyf.data.AccTaxRate,
Currency: memberyf.data.Currency,
ExChangerate: exrate,
PreAmount: memberyf.data.PreAmount,
Reason: '',
Remark: memberyf.data.Remark + _this.selectremark,
INPUTMODE: inputmode,
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
OpName: SHOWNAME,
EnterDate: myDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "False",
Sort: newsort,
IsInvoice: "0",
ISACC: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: wmsoutbsno
});
record.id = NewGuid();
record.internalId = NewGuid();
this.StoreFee.add(record);
}
}
};
this.parentWin.onPostDetailClick(NaN, NaN, this.feeType);
// this.parentWin.calcDetailTotal();
// window.closeAction = 'destroy';
// window.close();
if (bodyDrChFeeDatas.length != 0) {
var custno = this.EditRecord.get('CUSTNO');
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsChFee/UpdateFeeCustNo',
scope: this,
params: {
body: jsonChFeeBody,
custno: custno
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//window.closeAction = 'destroy';
//window.close();
} 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
});
}
}
});
}
},
onAddDetailAllClick: function (button, event) {
var bodyDrChFeeDatas = [];
var myDate = new Date();
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title:'提示', msg:'没有要引入的费用', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//没有选择要申请的费用!
return;
}
var GidStr = '';
for (i = 0; i < selectedRecords.length; i += 1) {
var memberyf = selectedRecords[i];
var bsno = memberyf.data.GID;
if (GidStr == '')
GidStr = "'"+bsno+"'";
else {
GidStr = GidStr + ",'" + bsno+"'";
}
}
var sql = " bsno in (" + GidStr + ") and feestatus=0 and feetype=" + this.feeType;
this.storeBodyChFee.load({
params: { billno: bsno, type: _thisbscardfee.feeType, optype: 'OpCtnBsCard', condition: sql },
callback: function (r, options, success) {
if (success) {
if (_thisbscardfee.storeBodyChFee.getCount() > 0) {
for (var j = 0; j < _thisbscardfee.storeBodyChFee.getCount(); j += 1) {
var memberyf = _thisbscardfee.storeBodyChFee.getAt(j);
if (memberyf.data.WmsOutBsNo != '' && memberyf.data.WmsOutBsNo != null) {
Ext.Msg.alert('提示', '此费用已引入,不允许重复引入。');
} else {
bodyDrChFeeDatas.push(memberyf);
var record = null;
var records = DsStoreQueryBy(_thisbscardfee.StoreFeeUnit, 'UNIT', memberyf.data.Unit);
var isfindrc = DsStoreQueryBy(_thisbscardfee.StoreFee, 'WmsOutBsNo', memberyf.data.GId);
if (isfindrc.getCount() > 0) {
} else {
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var quantity = data.QUANTITY;
} else {
var quantity = 0;
}
var taxrate = memberyf.data.TaxRate;
if (taxrate == null) taxrate = 0;
var notaxamount = Mul(quantity, memberyf.data.UnitPrice);
var tax = Div(Mul(notaxamount, taxrate), 100);
var amount = Add(notaxamount, tax);
var Feetype = memberyf.data.FeeType;
var curr = memberyf.data.Currency;
var exrate = 0;
if (curr == 'RMB') { exrate = 1 }
else {
var FFrecords = DsStoreQueryBy(_thisbscardfee.StoreDateCurr, 'CURR', curr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
if (Feetype == 2)
exrate = ffdata.CRDEFRATE;
else
exrate = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(_thisbscardfee.StoreCurr, 'CURR', curr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
if (Feetype == 2)
exrate = dfdata.CRDEFRATE;
else
exrate = dfdata.DEFRATE;
} else {
}
}
if (exrate == 0) exrate = memberyf.data.ExchangeRate;
};
var newsort = _thisbscardfee.GetHandleSerialNo(_thisbscardfee.StoreFee);
var oprecords = DsStoreQueryBy(_thisbscardfee.storeList, 'GID', memberyf.data.BsNo);
var cntrno = '';
if (oprecords.getCount() > 0) {
var data = oprecords.getAt(0).data;
cntrno = data.CTNNO;
}
var inputmode = '业务卡导入' + cntrno ;
var wmsoutbsno = memberyf.data.GId;
if (_thisbscardfee.ishistry == '1') {
inputmode = '手工';
wmsoutbsno = '';
}
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: memberyf.data.FeeStatus,
FeeStatus_Ref: memberyf.data.FeeStatus_Ref,
FeeType: memberyf.data.FeeType,
FeeName: memberyf.data.FeeName,
FeeDescription: memberyf.data.FeeDescription,
CustomerType: memberyf.data.CustomerType,
CustomerName: memberyf.data.CustomerName,
Unit: memberyf.data.Unit,
UnitPrice: memberyf.data.UnitPrice,
TaxUnitPrice: memberyf.data.TaxUnitPrice,
Quantity: memberyf.data.Quantity,
TaxRate: memberyf.data.TaxRate,
NoTaxAmount: memberyf.data.NoTaxAmount,
Amount: memberyf.data.Amount,
AccTaxRate: memberyf.data.AccTaxRate,
Currency: memberyf.data.Currency,
ExChangerate: exrate,
PreAmount: memberyf.data.PreAmount,
Reason: '',
Remark: memberyf.data.Remark + _this.selectremark,
INPUTMODE: inputmode,
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
OpName: SHOWNAME,
EnterDate: myDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "False",
Sort: newsort,
IsInvoice: "0",
ISACC: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: wmsoutbsno
});
record.id = NewGuid();
record.internalId = NewGuid();
_thisbscardfee.StoreFee.add(record);
}
}
}
}
_thisbscardfee.parentWin.onPostDetailClick(NaN, NaN, _thisbscardfee.feeType);
// this.parentWin.calcDetailTotal();
// window.closeAction = 'destroy';
// window.close();
if (bodyDrChFeeDatas.length != 0) {
var custno = _thisbscardfee.EditRecord.get('CUSTNO');
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsChFee/UpdateFeeCustNo',
scope: this,
params: {
body: jsonChFeeBody,
custno: custno
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//window.closeAction = 'destroy';
//window.close();
} 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
});
}
}
});
}
}
}
});
},
GetHandleSerialNo: function (store) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.Sort > result) {
result = member.data.Sort;
}
}
}
result = parseInt(result) + 1;
return result;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, " (CUSTNO like '%" + MBLNO + "%' or I_CUSTNO like '%" + MBLNO + "%' or MBLNO like '%" + MBLNO + "%' ) ");
var APPLYNO = form.findField('BSNO').getValue();
var i = APPLYNO.indexOf(",");
if (i > 0) {
var slist = APPLYNO.split(",");
var feeGidSql = '';
for (var i = 0; i < slist.length; i += 1) {
var feeGId = "'" + slist[i] + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
sql = "APPLYNO in (" + feeGidSql + ")";
} else sql = sql + getAndConSql(sql, APPLYNO, " (APPLYNO like '%" + APPLYNO + "%' ) ");
var CTNNO = form.findField('CTNNO').getValue();
var i = CTNNO.indexOf(",");
if (i > 0) {
var slist = CTNNO.split(",");
var feeGidSql = '';
for (var i = 0; i < slist.length; i += 1) {
var feeGId = "'" + slist[i] + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
sql = "CTNNO in (" + feeGidSql + ")";
} else sql = sql + getAndConSql(sql, CTNNO, " (CTNNO like '%" + CTNNO + "%' ) ");
//sql = sql + getAndConSql(sql, CTNNO, "CTNNO like '%" + CTNNO + "%'");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
var expDateBgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "ETD>='" + expDateBgn + "'");
var expDateEnd = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "ETD<='" + expDateEnd + " 23:59:59'");
var BILLTYPE = form.findField('BILLTYPE').getValue();
sql = sql + getAndConSql(sql, BILLTYPE, BILLTYPE + " and feetype=" + this.feeType + ")");
var CUSTNO = form.findField('CUSTNO').getValue();
sql = sql + getAndConSql(sql, CUSTNO, " EXISTS (select 1 from ch_fee L WHERE L.BSNO=B.GID and L.SALESNO='" + CUSTNO + "' AND ISNULL(L.WmsOutBsNo,'')='') ");
return sql;
}
});