//集运管理-路单查询
Ext.namespace('Shipping');
Shipping.MsRptSaleBalProfitShareIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptSaleBalProfitShareIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptSaleBalProfitShareIndex, Ext.Panel, {
PageSize: 20000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
bslistsortfield: '',
bslistsortdire: '',
salelistsortfield: '',
salelistsortdire: '',
custlistsortfield: '',
custlistsortdire: '',
oplistsortfield: '',
oplistsortdire: '',
bssourcelistsortfield: '',
bssourcelistsortdire: '',
bssourcedetaillistsortfield: '',
MsPeriod: null,
bssourcedetaillistsortdire: '',
initUIComponents: function () {
this.formname = 'MsRptSaleLHProfitShareIndex';
Ext.Ajax.timeout = 120000;
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BSNO', type: 'string' },
{ name: 'OPLB', type: 'string' },
{ name: 'OPLBNAME', type: 'string' },
{ name: 'OPTYPE', type: 'string' },
{ name: 'BSTYPE', type: 'string' },
{ name: 'ISSALEFEE', type: 'string' },
{ name: 'SETTLETIME', type: 'string' },
{ name: 'BLFRT', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'HBLNO', type: 'string' },
{ name: 'ETD', type: 'string' },
{ name: 'STLDATE', type: 'string' },
{ name: 'STLNAME', type: 'string' },
{ name: 'VESSEL', type: 'string' },
{ name: 'VOYNO', type: 'string' },
{ name: 'INPUTBY', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'BSSTATUS', type: 'string' },
{ name: 'SALE', type: 'string' },
{ name: 'OP', type: 'string' },
{ name: 'DOC', type: 'string' },
{ name: 'CUSTSERVICE', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'PORTDISCHARGE', type: 'string' },
{ name: 'CUSTOMNO', type: 'string' },
{ name: 'ACCDATE', type: 'string' },
{ name: 'CARRIER', type: 'string' },
{ name: 'BSSOURCE', type: 'string' },
{ name: 'LANE', type: 'string' },
{ name: 'FORWARDER', type: 'string' },
{ name: 'CNTRTOTAL', type: 'string' },
{ name: 'TRADETYPE', type: 'string' },
{ name: 'GOODSNAME', type: 'string' },
{ name: 'OPDATE', type: 'string' },
{ name: 'CUSTOMDATE', type: 'string' },
{ name: 'ENTERP', type: 'string' },
{ name: 'NETWEIGHT', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'TEU', type: 'number' },
{ name: 'CNTR1', type: 'number' },
{ name: 'CNTR2', type: 'number' },
{ name: 'CNTR3', type: 'number' },
{ name: 'CNTR4', type: 'number' },
{ name: 'CNTR5', type: 'number' },
{ name: 'CNTR6', type: 'number' },
{ name: 'CNTR7', type: 'number' },
{ name: 'CNTR8', type: 'number' },
{ name: 'CNTR9', type: 'number' },
{ name: 'CNTR10', type: 'number' },
{ name: 'OTCNTR', type: 'number' },
{ name: 'RMBDR', type: 'number' },
{ name: 'RMBCR', type: 'number' },
{ name: 'USDDR', type: 'number' },
{ name: 'USDCR', type: 'number' },
{ name: 'OTDR', type: 'number' },
{ name: 'OTCR', type: 'number' },
{ name: 'TTLDR', type: 'number' },
{ name: 'TTLCR', type: 'number' },
{ name: 'INTEREST', type: 'number' },
{ name: 'RMBPROFIT', type: 'number' },
{ name: 'USDPROFIT', type: 'number' },
{ name: 'OTPROFIT', type: 'number' },
{ name: 'TTLPROFIT', type: 'number' },
{ name: 'ZKTTLPROFIT', type: 'number' },
{ name: 'THTTLPROFIT', type: 'number' },
{ name: 'RMBNODR', type: 'number' },
{ name: 'USDNODR', type: 'number' },
{ name: 'OTNODR', type: 'number' },
{ name: 'TTLNODR', type: 'number' },
{ name: 'RMBNOCR', type: 'number' },
{ name: 'USDNOCR', type: 'number' },
{ name: 'OTNOCR', type: 'number' },
{ name: 'TTLNOCR', type: 'number' },
{ name: 'STLRMBDR', type: 'number' },
{ name: 'STLUSDDR', type: 'number' },
{ name: 'STLOTDR', type: 'number' },
{ name: 'STLTTLDR', type: 'number' },
{ name: 'MONTHSTLTTLDR', type: 'number' },
{ name: 'STLRMBCR', type: 'number' },
{ name: 'STLUSDCR', type: 'number' },
{ name: 'STLOTCR', type: 'number' },
{ name: 'STLTTLCR', type: 'number' },
{ name: 'ACTUALDAY', type: 'number' },
{ name: 'NODAY', type: 'number' },
{ name: 'ACTNODAY', type: 'number' },
{ name: 'NOMONTH', type: 'number' },
{ name: 'TiChengQuJian', type: 'number' },
{ name: 'COMPR', type: 'number' },
{ name: 'MONTHTTLPR', type: 'number' },
{ name: 'TiChengBiLi', type: 'number' },
{ name: 'TiChengBiLiStr', type: 'string' },
{ name: 'TiCheng', type: 'number' },
{ name: 'ShiJiTiChengBiLi', type: 'number' },
{ name: 'KouXi', type: 'number' },
{ name: 'PROFITRATE', type: 'string' },
{ name: 'PRREMARK', type: 'string' }
],
remoteSort: false,
proxy: {
type: 'ajax',
timeout: 120000,
url: '/MvcShipping/MsRptSaleBalProfitShare/GetCXDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolums = [{
sortable: false,
dataIndex: 'BSNO',
header: '编号',
hidden: true,
width: 130
}, {
sortable: false,
//sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类型',
width: 70
}, {
sortable: false,
dataIndex: 'OPTYPE',
header: '更改单',
width: 70
}, {
sortable: false,
dataIndex: 'FEESTATUSREF',
header: '费用锁定',
width: 70
}, {
sortable: false,
dataIndex: 'ISSALEFEE',
header: '提成发放',
width: 70
}, {
sortable: false,
dataIndex: 'OPDATE',
header: '业务日期',
width: 86
}, {
sortable: false,
dataIndex: 'SETTLETIME',
header: '结算日期',
width: 86
}, {
sortable: false,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
sortable: false,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 136
}, {
sortable: false,
dataIndex: 'BLFRT',
header: '付费方式',
width: 200
}, {
sortable: false,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: false,
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
}, {
sortable: false,
dataIndex: 'ETD',
header: '开船日期',
width: 86
}, {
sortable: false,
dataIndex: 'VESSEL',
header: '船名',
width: 200
}, {
sortable: false,
dataIndex: 'VOYNO',
header: '航次',
width: 50
}, {
sortable: false,
dataIndex: 'SALE',
header: '业务员',
width: 80
}, {
sortable: false,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: false,
dataIndex: 'DOC',
header: '单证',
width: 80
}, {
sortable: false,
dataIndex: 'CUSTSERVICE',
header: '客服员',
width: 80
}, {
sortable: false,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 80
}, {
sortable: false,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 150
}, {
sortable: false,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: false,
dataIndex: 'CARRIER',
header: '船公司',
width: 80
}, {
sortable: false,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 120
}, {
sortable: false,
dataIndex: 'ACTUALDAY',
header: '实际天数',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'NODAY',
header: '超期天数',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'ACTNODAY',
header: '实际超期天数',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'TiChengQuJian',
header: '提成区间',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'COMPR',
header: '累计利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'ZKTTLPROFIT',
header: '直客累计利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'THTTLPROFIT',
header: '同行累计利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'TiChengBiLi',
header: '提成比例',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'ShiJiTiChengBiLi',
header: '原始提成比例',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: false,
dataIndex: 'TiCheng',
header: '提成',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'KouXi',
header: '扣罚',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'PRREMARK',
header: '提成备注',
width: 80
}, {
sortable: false,
dataIndex: 'TiChengBiLiStr',
header: '提成比例公式',
width: 80
}, {
sortable: false,
dataIndex: 'TTLDR',
header: '合计应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'TTLCR',
header: '合计应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'TTLPROFIT',
header: '利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'MONTHTTLPR',
header: '业务员本月利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'PROFITRATE',
header: '利润率',
width: 80
}, {
sortable: false,
dataIndex: 'STLTTLDR',
header: '合计已收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'TTLNODR',
header: '合计未收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: false,
dataIndex: 'TTLNOCR',
header: '合计未付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}];
// this.girdcolums = this.initgirdcolums;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bs', this.initgirdcolums, 1);
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
sortableColumns: false,
selModel: this.GridCheckBoxModel,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.girdcolums,
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var BILLSTATUSREF = record.get('ISSALEFEE');
if (BILLSTATUSREF == "已发放")
return 'feestatus_pass';
}
},
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bs', this.girdcolums, 1);
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
if (record.data.OPLBNAME == "报关业务") {
openUrl = "../MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + record.data.BSNO;
} else {
openUrl = "../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
}
window.open(openUrl, openType, openSet);
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.bslistsortfield = column.dataIndex;
this.bslistsortdire = direction;
}, this);
//#region formSearch
//#region formSearch枚举参照相关
_this = this;
this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSalesCode.load();
this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSalesCode,
forceSelection: true,
name: 'PS_SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.CheckAllDR = new Ext.form.Checkbox({
fieldLabel: '不包含优质航线业务',
checked: true,
labelAlign: "right",
labelWidth: 120
});
//客户加载_仓库
this.storeWAREHOUSE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListWAREHOUSE' }
});
this.storeWAREHOUSE.load();
//车队
this.comboxWAREHOUSE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '优质航线', //'仓库',
store: this.storeWAREHOUSE,
// forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'WAREHOUSE',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//#endregion
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: [{
fieldLabel: '提成月份',
xtype: 'monthfield',
name: 'PS_ACCDATE',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxSalesCode, {
fieldLabel: '从结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_STLDATEBGN',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_STLDATEEND',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxWAREHOUSE
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.CheckSaveQuery = new Ext.form.Checkbox({
fieldLabel: '记忆查询条件',
checked: true,
width: 120
});
_this = this;
this.SearchBtn = new Ext.Button({
text: '隐藏查询',
handler: function () {
if (_this.SearchBtn.text == '隐藏查询') {
_this.panelSearch.hide();
_this.SearchBtn.setText("显示查询");
} else {
_this.panelSearch.show();
_this.SearchBtn.setText("隐藏查询");
}
}
});
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "计算提成",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
var isvisible = true;
var issavevalue = false;
if (_this.SearchBtn.text == '隐藏查询')
isvisible = true
else
isvisible = false;
if (this.CheckSaveQuery.checked)
issavevalue = true
saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue);
},
scope: this
}, '-', {
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', this.SearchBtn, {
xtype: 'button',
width: 90,
text: "清空条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, this.CheckSaveQuery, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存列表",
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, { text: "列表初始化",
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
scope: this
}, '-', {
text: '发放提成',
tooltip: '发放提成',
id: 'btnSubmitAudit',
handler: function (button, event) {
this.onSetFeeClick();
},
scope: this
}, '-', {
text: '取消发放',
tooltip: '取消发放',
id: 'btnSubmitAuditBack',
handler: function (button, event) {
this.onCancelSetFeeClick();
},
scope: this
}, '-', {
text: '发放记录',
tooltip: '发放记录',
handler: function (button, event) {
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcShipping/MsRptSaleBalProfitShare/TCIndex";
window.open(openUrl, openType, openSet);
},
scope: this
}
//, '-', {
// text: '差旅费',
// tooltip: '差旅费',
// handler: function (button, event) {
// var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
// var openType = "_blank";
// var openUrl = "";
// openUrl = "../../MvcShipping/MsRptSaleBalProfitShare/TravelFee";
// window.open(openUrl, openType, openSet);
// },
// scope: this
//}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 29,
items: [this.panelBtn]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 56,
items: [this.formSearch]
});
this.panelBodyChFee = new Ext.Panel({
title: '业务明细',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.gridList]
});
// this.panelSum = new Ext.Panel({
// title: '合 计',
// layout: "border",
// height: 120,
// region: 'south',
// margin: '0 0',
// frame: true,
// items: [this.gridListSum]
// });
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelBodyChFee
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.tabpanel]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var month = this.formSearch.getForm().findField('PS_ACCDATE').getRawValue();
var expDate_Min = this.formSearch.getForm().findField('PS_STLDATEBGN').getRawValue();
var expDate_Max = this.formSearch.getForm().findField('PS_STLDATEEND').getRawValue();
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext, month: month, expDate_Min: expDate_Min, expDate_Max: expDate_Max });
}, this);
// this.storeSumList.on('beforeload', function (store) {
// if (!this.checkSearchCondition())
// return;
// var sql = this.getCondition();
// Ext.apply(store.proxy.extraParams, { condition: sql });
// }, this);
this.LoadPeriod();
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
}, //end initUIComponents
LoadPeriod: function () {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...', //'正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.sqlcontext = sql;
var month = this.formSearch.getForm().findField('PS_ACCDATE').getRawValue();
var expDate_Min = this.formSearch.getForm().findField('PS_STLDATEBGN').getRawValue();
var expDate_Max = this.formSearch.getForm().findField('PS_STLDATEEND').getRawValue();
var oDate1 = new Date(month + '-01');
var oDate2 = new Date(this.MsPeriod.PERIOD + '-01');
if (oDate1.getTime() >= oDate2.getTime()) {
Ext.Msg.alert('提示', '此月份未月末结转,请先月末结转再计算提成!');
return false;
}
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, month: month, expDate_Min: expDate_Min, expDate_Max: expDate_Max},
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function (button, event) {
var sql = this.sqlcontext;
var month = this.formSearch.getForm().findField('PS_ACCDATE').getRawValue();
var expDate_Min = this.formSearch.getForm().findField('PS_STLDATEBGN').getRawValue();
var expDate_Max = this.formSearch.getForm().findField('PS_STLDATEEND').getRawValue();
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, month: month, expDate_Min: expDate_Min, expDate_Max: expDate_Max },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var SALE = form.findField('PS_SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "B.SALE='" + SALE + "'");
var WAREHOUSE = form.findField('WAREHOUSE').getValue();
sql = sql + getAndConSql(sql, WAREHOUSE, "B.WAREHOUSE='" + WAREHOUSE + "'");
//if (this.CheckAllDR.checked) {
// sql = sql + getAndConSql(sql, "11", " isnull(B.ISFUMIGATION,0)<>1 ");
//}
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
onSetFeeClick: function (button, event) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要发放的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
if (rec.data.ISSALEFEE != '已发放') {
bodyAddDatas.push(rec);
}
}
var month = this.formSearch.getForm().findField('PS_ACCDATE').getRawValue();
var expDate_Min = this.formSearch.getForm().findField('PS_STLDATEBGN').getRawValue();
var expDate_Max = this.formSearch.getForm().findField('PS_STLDATEEND').getRawValue();
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要发放提成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.wait('正在提取数据...');
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcShipping/MsRptSaleBalProfitShare/SetFeeCX',
params: {
data: jsonbodyAddDatas, month: month, expDate_Min: expDate_Min, expDate_Max: expDate_Max
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onCancelSetFeeClick: function (button, event) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要发放的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
if (rec.data.ISSALEFEE != '未发放') {
bodyAddDatas.push(rec);
}
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要发放提成的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.wait('正在提取数据...');
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcShipping/MsRptSaleBalProfitShare/CancelSetFeeCX',
params: {
data: jsonbodyAddDatas
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.SelectedRecord.data.BSNO;
ret[4] = "MsRptOpProfitIndex";
return ret;
},
onSaveGridClick: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.girdcolums, 1, true);
},
oninitGridClick: function (button, event) {
var agirdcolums = this.initgirdcolums;
this.gridList.reconfigure(this.storeList, agirdcolums);
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.initgirdcolums, 1, true);
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var sql = this.sqlcontext;
var month = this.formSearch.getForm().findField('PS_ACCDATE').getRawValue();
var expDate_Min = this.formSearch.getForm().findField('PS_STLDATEBGN').getRawValue();
var expDate_Max = this.formSearch.getForm().findField('PS_STLDATEEND').getRawValue();
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptSaleBalProfitShare/GetCXDataListStr',
scope: this,
params: {
condition: sql, month: month, expDate_Min: expDate_Min, expDate_Max: expDate_Max
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSRPTCXSALEBALPROFITSHARELIST';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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
});
}
}
});
}
});