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/TruckMng/Viewsjs/MsOpTruckBulk/MsRptTruckBulkCtnProfitInde...

1370 lines
47 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsRptTruckBulkCtnProfitIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptTruckBulkCtnProfitIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptTruckBulkCtnProfitIndex, Ext.Panel, {
PageSize: 2000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
bslistsortfield: '',
bslistsortdire: '',
salelistsortfield: '',
salelistsortdire: '',
custlistsortfield: '',
custlistsortdire: '',
oplistsortfield: '',
oplistsortdire: '',
bssourcelistsortfield: '',
bssourcelistsortdire: '',
bssourcedetaillistsortfield: '',
bssourcedetaillistsortdire: '',
initUIComponents: function () {
this.formname = 'MsRptTruckBulkCtnProfitIndex';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BSNO', type: 'string' },
{ name: 'CUSTNO', type: 'string' }, // 委托编号
{ name: 'ORDERNO', type: 'string' }, // 委托编号
{ name: 'ORDERNO1', type: 'string' }, // 委托编号
{ name: 'CUSTOMERNAME', type: 'string' }, // 委托单位
{ name: 'CUSTOMERNAMEREF', type: 'string' }, // 委托单位
{ name: 'GOODSNAME', type: 'string' }, // 品名
{ name: 'ETD', type: 'string' }, // 到港/开船日期
{ name: 'PCETD', type: 'string' }, // 到港/开船日期
{ name: 'CREATETIME', type: 'string' }, // 创建日期
{ name: 'DELAYDAYS', type: 'string' }, // 晚录入天数
{ name: 'ETA', type: 'string' }, // 到港/开船日期
{ name: 'PORTLOAD', type: 'string' }, // 装货地
{ name: 'PORTDISCHARGE', type: 'string' }, // 卸货地
{ name: 'MBLNO', type: 'string' }, // 卸货地
{ name: 'CNTRTOTAL', type: 'string' }, // 卸货地
{ name: 'YARD', type: 'string' }, // 卸货地
{ name: 'TRUCKER', type: 'string' }, // 委托单位
{ name: 'TRUCKERREF', type: 'string' }, // 委托单位
{ name: 'TRUCKNO', type: 'string' }, // 车号
{ name: 'DRIVER', type: 'string' }, // 驾驶员
{ name: 'DRIVERTEL', type: 'string' }, // 驾驶员电话
{ name: 'TRADETYPE', type: 'string' }, // 毛重
{ name: 'SALE', type: 'string' }, // 毛重
{ name: 'CUSTSERVICE', type: 'string' }, // 毛重
{ name: 'CNTRTOTAL', type: 'string' }, // 净重
{ name: 'PCREMARK', type: 'string' }, //
{ name: 'ISTEMPLATENAME', type: 'string' },
{ name: 'PKGS', type: 'string' }, // 件数
{ name: 'PCCTNNUM', type: 'number' },
{ name: 'PCFREIGHT', type: 'number' },
{ name: 'TAXRATE', type: 'number' },
{ name: 'PCTTLFREIGHT', type: 'number' },
{ name: 'TTLOTCR', type: 'number' },
{ name: 'TTLCR', type: 'number' },
{ name: 'TTKHFCR', type: 'number' },
{ name: 'TTKHFDR', type: 'number' },
{ name: 'FREIGHT', type: 'number' },
{ name: 'TTLOTDR', type: 'number' },
{ name: 'TTLDR', type: 'number' },
{ name: 'PROFIT', type: 'number' },
{ name: 'PROFITRATE', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsOpTruckBulk/RptCtnLRData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolums = [{
sortable: true,
dataIndex: 'ORDERNO',
header: '客户订单号',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAMEREF',
header: '委托单位',
width: 110
},{
sortable: true,
dataIndex: 'ORDERNO1',
header: '运输凭证编号',
width: 80
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '提单号',
width: 80
}, {
sortable: true,
dataIndex: 'TRADETYPE',
header: '托运类型',
width: 80
}, {
sortable: true,
dataIndex: 'PCETD',
header: '实际装货(卸货)日期',
width: 80
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建日期',
width: 80
}, {
sortable: true,
dataIndex: 'DELAYDAYS',
header: '晚录入天数',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运地',
width: 80
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的地',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '箱型箱量',
width: 80
}, {
sortable: true,
dataIndex: 'TRUCKERREF',
header: '承运商',
width: 80
}, {
sortable: true,
dataIndex: 'TRUCKNO',
header: '车号',
width: 80
}, {
sortable: true,
dataIndex: 'DRIVER',
header: '司机',
width: 120
}, {
sortable: true,
dataIndex: 'DRIVERTEL',
header: '司机电话',
width: 120
}, {
sortable: true,
dataIndex: 'SALE',
header: '客户经理',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTSERVICE',
header: '运营经理',
width: 120
}, {
sortable: true,
dataIndex: 'PCREMARK',
header: '派车备注',
width: 120
}, {
sortable: true,
dataIndex: 'ISTEMPLATENAME',
header: '是否自定义价格',
width: 120
}, {
sortable: true,
dataIndex: 'TTLOTCR',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PCTTLFREIGHT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTKHFDR',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTKHFCR',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'FREIGHT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTLOTDR',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PROFIT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PROFITRATE',
header: '毛利率',
width: 80,
renderer: function (value, cellmeta) {
if (value!='') return value + '%';
}
}
];
// this.girdcolums = this.initgirdcolums;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bs', this.initgirdcolums, 1);
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
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 = "/Account/Chfee_settlement/SettementView";
// if (record.data.BILLTYPE == 'M')
// openUrl = "/Account/Chfee_management/CMView";
// if (record.data.BILLTYPE == 'Y')
// openUrl = "/Import/CWAdvancePayment/Edit";
// window.open(openUrl, openType, openSet);
}, this);
_this = this;
this.storeSumList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'PCFREIGHT', type: 'number' },
// { name: 'TAXRATE', type: 'number' },
{ name: 'PCTTLFREIGHT', type: 'number' },
{ name: 'TTLOTCR', type: 'number' },
{ name: 'TTLCR', type: 'number' },
{ name: 'FREIGHT', type: 'number' },
{ name: 'TTLDR', type: 'number' },
{ name: 'TTKHFCR', type: 'number' },
{ name: 'TTKHFDR', type: 'number' },
{ name: 'PROFIT', type: 'number' },
{ name: 'PROFITRATE', type: 'string' },
{ name: 'DELAYDAYS', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 120000,
url: '/TruckMng/MsOpTruckBulk/RptCtnSumLRData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initgridlistsumcolumn = [{
sortable: true,
dataIndex: 'PCFREIGHT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PCTTLFREIGHT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTKHFDR',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTKHFCR',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'FREIGHT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTLOTDR',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PROFIT',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'PROFITRATE',
header: '毛利率',
width: 80,
renderer: function (value, cellmeta) {
if (value != '' && value != '0') return value + '%';
}
}, {
sortable: true,
dataIndex: 'DELAYDAYS',
header: '晚录入天数',
width: 80
}
];
this.gridlistsumcolumn = DsTruck.GetGridPanel(USERID, this.formname + 'sum', this.initgridlistsumcolumn, 1);
//定义Grid
this.gridListSum = new Ext.grid.GridPanel({
store: this.storeSumList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.gridlistsumcolumn
});
//#region formSearch
//#region formSearch枚举参照相关
_this = this;
//#endregion
//客户加载_委托单位
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,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeListTruckLoadPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckLoadPort.load();
this.comboxLoadPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运地', //'费用类型',
store: this.storeListTruckLoadPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'PORTLOAD',
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeListTruckDistPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckDistPort.load();
this.comboxDistPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地', //'费用类型',
store: this.storeListTruckDistPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'PORTDISCHARGE',
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListTRUCK' }
});
//车队
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '承运商', //'车队',
store: this.storeTRUCKER,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'TRUCKER',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运营经理',
store: this.storeOpCode,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户经理',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
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: 80,
msgTarget: 'qtip'
},
items: [
{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxCustCode, {
fieldLabel: '客户订单号',
name: 'ORDERNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '实际装货(卸货)日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDBgn',
labelWidth: 110,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '-',
format: 'Y-m-d',
xtype: 'datefield',
labelSeparator: '',
labelWidth: 30,
flex: 0.8,
// labelWidth: 15,
name: 'ETDEnd',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxLoadPort, this.comboxDistPort, {
fieldLabel: '付款单号',
name: 'PAYNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxTRUCKER, this.comboxSALE, this.comboxCUSTSERVICE, {
fieldLabel: '提单号',
name: 'MBLNO',
labelWidth: 50,
flex: 0.8,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '车号',
name: 'TRUCKNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '收款单号',
name: 'RECNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, { xtype: 'hiddenfield' }]
}
]//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
}, '-', this.SearchBtn, {
xtype: 'button',
width: 90,
text: "清空条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, this.CheckSaveQuery, '-', {
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
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存列表",
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, { text: "列表初始化",
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
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: 75,
items: [this.formSearch]
});
this.panelBody = new Ext.Panel({
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [
this.gridList]
});
this.panelSum = new Ext.Panel({
title: '合 计',
layout: "border",
height: 90,
region: 'south',
split: true,
margin: '0 0',
frame: true,
items: [this.gridListSum]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.panelBody, this.panelSum]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeSumList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
var gcolumns = this.gridList.columns;
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.currentPage = 1;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeSumList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "B.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var ORDERNO = form.findField('ORDERNO').getValue();
sql = sql + getAndConSql(sql, ORDERNO, "B.ORDERNO like '%" + ORDERNO + "%'");
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "B.MBLNO like '%" + MBLNO + "%'");
var PAYNO = form.findField('PAYNO').getValue();
sql = sql + getAndConSql(sql, PAYNO, "P.BSNO IN (SELECT DISTINCT BSNO FROM CH_FEE_DO WHERE BILLNO='" + PAYNO + "')");
var RECNO = form.findField('RECNO').getValue();
sql = sql + getAndConSql(sql, RECNO, "B.BSNO IN (SELECT DISTINCT BSNO FROM CH_FEE_DO WHERE BILLNO='" + RECNO + "')");
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, "B.PORTLOAD= '" + PORTLOAD + "'");
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, "B.PORTDISCHARGE= '" + PORTDISCHARGE + "'");
var ETDBgn = form.findField('ETDBgn').getRawValue();
sql = sql + getAndConSql(sql, ETDBgn, "CONVERT(char(10), P.ETA, 20) >='" + ETDBgn + "'");
var ETDEnd = form.findField('ETDEnd').getRawValue();
sql = sql + getAndConSql(sql, ETDEnd, "CONVERT(char(10), P.ETA, 20) <='" + ETDEnd + "'");
var TRUCKER = form.findField('TRUCKER').getValue();
sql = sql + getAndConSql(sql, TRUCKER, "P.TRUCKER='" + TRUCKER + "'");
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "P.SALE='" + SALE + "'");
var CUSTSERVICE = form.findField('CUSTSERVICE').getValue();
sql = sql + getAndConSql(sql, CUSTSERVICE, "P.CUSTSERVICE='" + CUSTSERVICE + "'");
var TRUCKNO = form.findField('TRUCKNO').getValue();
sql = sql + getAndConSql(sql, TRUCKNO, "P.TRUCKNO='" + TRUCKNO + "'");
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();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = "MsRptCustDrCrIndex";
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) {
grid2Excel(this.gridList,'应收应付总账');
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/TruckMng/MsOpTruckBulk/RptCtnLRData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: _this.sqlcontext,
printstr: 'true'
},
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 = 'MSRptCtnLRData';
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
});
}
}
});
}
});