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.

1274 lines
45 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.MsRptCustFeeGroupIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptCustFeeGroupIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptCustFeeGroupIndex, Ext.Panel, {
PageSize: 10000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
initUIComponents: function () {
//定义数据集
this.formname = 'MsRptCustFeeGroupIndex';
this.myfield = [
{ name: 'CUSTOMERNAME', type: 'string' }
]
this.girdcolums = [{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '应收客户',
width: 80
}
];
this.myfieldCr = [
{ name: 'CUSTOMERNAME', type: 'string' }
]
this.girdcolumsCr = [{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '应付客户',
width: 80
}
];
this.storeListDr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: this.myfield,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsRptCustFeeGroup/CustListData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListCr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: this.myfield,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsRptCustFeeGroup/CustListData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridListDr = new Ext.grid.GridPanel({
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums
});
//定义Grid
this.gridListCr = new Ext.grid.GridPanel({
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsCr
});
//#region formSearch
//#region formSearch枚举参照相关
this.StoreOpLb = Ext.create('Ext.data.Store', {
fields: ['OpLb']
});
this.StoreOpLb.add({ "OpLb": "海运出口" });
this.StoreOpLb.add({ "OpLb": "海运进口" });
this.StoreOpLb.add({ "OpLb": "报关业务" });
this.StoreOpLb.add({ "OpLb": "大宗散货" });
this.StoreOpLb.add({ "OpLb": "综合业务" });
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务类型',
store: this.StoreOpLb,
forceSelection: true,
name: 'PS_OPLB',
valueField: 'OpLb',
displayField: 'OpLb',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBsType.load({ params: { enumTypeId: 96004} });
this.comboxBsType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输类型',
store: this.storeBsType,
name: 'PS_BSTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeSalesCode,
forceSelection: true,
name: 'PS_OP',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'PS_CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeEnterpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomerRefModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCustomerRefList' }
});
this.storeEnterpCode.load({ params: { condition: "ISENTERP='1'"} });
this.comboxEnterp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '经营单位',
store: this.storeEnterpCode,
forceSelection: true,
name: 'PS_ENTERP',
valueField: 'DESCRIPTION',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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',
forceSelection: true,
name: 'DC',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用名称',
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.storeFeeType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeeType.load({ params: { enumTypeId: 96009} });
this.comboxFeeType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '费用范围',
store: this.storeFeeType,
forceSelection: true,
name: 'FEERANGE',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCust.load({ params: { condition: ""} });
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算客户',
store: this.storeCust,
forceSelection: true,
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFSTATUS = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeFSTATUS.add({ "DC": "0", "NAME": "全部" });
this.storeFSTATUS.add({ "DC": "1", "NAME": "仅已审核" });
this.comboxFSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用状态',
store: this.storeFSTATUS,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'FSTATUS',
value: '0',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeRptFeeGroup = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'DM_ID', type: 'string' },
{ name: 'RPTNAME', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsBaseInfo/GetCodeRptFeeGroup',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeRptFeeGroup.load({ params: { condition: "RPTTYPE='RPTFEEGROUP'"} });
this.storeFeeGroupCurr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'DM_ID', type: 'string' },
{ name: 'CURRENCY', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeFeeGroupTemplate/GetTotalCurrList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.comboxRptFeeGroup = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '分组模板',
store: this.storeRptFeeGroup,
valueField: 'DM_ID',
displayField: 'RPTNAME',
forceSelection: true,
name: 'RPTFEEGROUP',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var s = "DM_ID='" + combo.value+ "'";
this.storeFeeGroupCurr.load({ params: { condition: s} });
}
}
}
});
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
valueField: 'VESSEL',
flex: 1.5,
name: 'PS_VESSEL',
displayField: 'VESSEL',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeAgent = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeAgent.load({ params: { condition: "ISAGENT='1'"} });
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '国外代理',
store: this.storeAgent,
forceSelection: true,
name: 'PS_AGENT',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#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: [this.comboxCust, this.comboxFeeType, this.comboxFeeNameRef, this.comboxCurr, this.comboxaddDCType, this.comboxRptFeeGroup
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOpLb, {
fieldLabel: '提单号',
name: 'PS_MBLNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxVoyVeg, {
fieldLabel: '航次',
name: 'PS_VOYNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '品名',
name: 'PS_GOODSNAME'
}, this.comboxFSTATUS
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBsType, this.comboxSalesCode, this.comboxCustCode, {
fieldLabel: '从业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEBGN',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEEND',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxOp
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxEnterp, {
fieldLabel: '从ETD',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_ETDDATEBGN',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到ETD',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_ETDDATEEND',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从会计期间',
xtype: 'monthfield',
name: 'PS_ACCDATEBGN',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从会计期间',
xtype: 'monthfield',
name: 'PS_ACCDATEEND',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxAgent
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_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);
},
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
}, '-',
{
text: "模板设置",
iconCls: 'btnprint',
handler: function (button, event) {
window.open('/MvcShipping/MsCodeFeeGroupTemplate', "FEEGROUPINDEX", 'width=800,height=600,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
},
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: 121,
items: [this.formSearch]
});
this.panelBodyChFee = new Ext.Panel({
title: '客户应收',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.gridListDr]
});
this.panelBodyChFeeCr = new Ext.Panel({
title: '客户应付',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.gridListCr]
});
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelBodyChFee,
this.panelBodyChFeeCr
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.tabpanel]
});
this.storeTemplateFee = Ext.create('Ext.data.Store', {
model: 'MsCodeDuiTemplateFee',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeDuiTemplate/GetBodyList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeTemplateFeeCr = Ext.create('Ext.data.Store', {
model: 'MsCodeDuiTemplateFee',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeDuiTemplate/GetBodyList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
var RPTFEEGROUP = this.formSearch.getForm().findField('RPTFEEGROUP').getValue();
if (RPTFEEGROUP == '' || RPTFEEGROUP == null) {
Ext.Msg.alert('提示', '必须选择分组模板!');
return ;
}
this.myfield = [
{ name: 'CUSTOMERNAME', type: 'string' }
]
this.girdcolums = [{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '应收客户',
width: 80
}
];
this.myfieldCr = [
{ name: 'CUSTOMERNAME', type: 'string' }
]
this.girdcolumsCr = [{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '应付客户',
width: 80
}
];
var sql = this.getCondition();
this.sqlcontext = sql;
var Drsql = sql + getAndConSql(sql, '1=1', " c.FEETYPE=1");
var Crsql = sql + getAndConSql(sql, '1=1', " c.FEETYPE=2");
_this = this;
this.storeTemplateFee.load({ params: { condition: " DM_ID='" + RPTFEEGROUP + "' and FEETYPE=1 " },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
for (i = 0; i < _this.storeTemplateFee.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = _this.storeTemplateFee.getAt(i);
_this.myfield.push({ name: 'C' + memberyf.data.FeeCode + '_' + memberyf.data.Currency, type: 'number' });
_this.girdcolums.push({
sortable: true,
dataIndex: 'C' + memberyf.data.FeeCode + '_' + memberyf.data.Currency,
header: memberyf.data.FeeName + memberyf.data.Currency,
width: 80
});
};
for (i = 0; i < _this.storeFeeGroupCurr.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = _this.storeFeeGroupCurr.getAt(i);
// _this.myfield.push({ name: 'OT' + memberyf.data.CURRENCY, type: 'number' });
_this.myfield.push({ name: 'TOTAL' + memberyf.data.CURRENCY, type: 'number' });
// _this.girdcolums.push({
// sortable: true,
// dataIndex: 'OT' + memberyf.data.CURRENCY,
// header: '其他' + memberyf.data.CURRENCY,
// width: 80
// });
_this.girdcolums.push({
sortable: true,
dataIndex: 'TOTAL' + memberyf.data.CURRENCY,
header: '合计' + memberyf.data.CURRENCY,
width: 80
});
};
_this.myfield.push({ name: 'TOTALINRMB', type: 'number' });
_this.girdcolums.push({
sortable: true,
dataIndex: 'TOTALINRMB',
header: '折合人民币',
width: 80
});
}
_this.storeListDr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: _this.myfield,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsRptCustFeeGroup/CustListData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
_this.gridListDr.reconfigure(_this.storeListDr, _this.girdcolums);
_this.storeListDr.load({
params: { start: 0, limit: _this.PageSize, condition: Drsql, rptfeegroup: RPTFEEGROUP, feetype: '1',
printstr: 'false'
},
waitMsg: "正在查询数据...",
scope: this
});
}
}
});
this.storeTemplateFeeCr.load({ params: { condition: " DM_ID='" + RPTFEEGROUP + "' and FEETYPE=2 " },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
for (i = 0; i < _this.storeTemplateFeeCr.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = _this.storeTemplateFeeCr.getAt(i);
_this.myfieldCr.push({ name: 'C' + memberyf.data.FeeCode + '_' + memberyf.data.Currency, type: 'number' });
_this.girdcolumsCr.push({
sortable: true,
dataIndex: 'C' + memberyf.data.FeeCode + '_' + memberyf.data.Currency,
header: memberyf.data.FeeName + memberyf.data.Currency,
width: 80
});
};
for (i = 0; i < _this.storeFeeGroupCurr.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = _this.storeFeeGroupCurr.getAt(i);
// _this.myfieldCr.push({ name: 'OT' + memberyf.data.CURRENCY, type: 'number' });
_this.myfieldCr.push({ name: 'TOTAL' + memberyf.data.CURRENCY, type: 'number' });
// _this.girdcolumsCr.push({
// sortable: true,
// dataIndex: 'OT' + memberyf.data.CURRENCY,
// header: '其他' + memberyf.data.CURRENCY,
// width: 80
// });
_this.girdcolumsCr.push({
sortable: true,
dataIndex: 'TOTAL' + memberyf.data.CURRENCY,
header: '合计' + memberyf.data.CURRENCY,
width: 80
});
};
_this.myfieldCr.push({ name: 'TOTALINRMB', type: 'number' });
_this.girdcolumsCr.push({
sortable: true,
dataIndex: 'TOTALINRMB',
header: '折合人民币',
width: 80
});
}
_this.storeListCr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: _this.myfieldCr,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsRptCustFeeGroup/CustListData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
_this.gridListCr.reconfigure(_this.storeListCr, _this.girdcolumsCr);
_this.storeListCr.load({
params: { start: 0, limit: _this.PageSize, condition: Crsql, rptfeegroup: RPTFEEGROUP, feetype: '2',
printstr: 'false'
},
waitMsg: "正在查询数据...",
scope: this
});
}
}
});
},
RefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
var RPTFEEGROUP = this.formSearch.getForm().findField('RPTFEEGROUP').getValue();
this.sqlcontext = sql;
var Drsql = sql + getAndConSql(sql, '1=1', " c.FEETYPE=1");
var Crsql = sql + getAndConSql(sql, '1=1', " c.FEETYPE=2");
this.storeListDr.load({
params: { start: 0, limit: this.PageSize, condition: Drsql, rptfeegroup: RPTFEEGROUP, feetype: '1',
printstr: 'false'
},
waitMsg: "正在查询数据...",
scope: this
});
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
/*
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
*/
var mblNo = form.findField('PS_MBLNO').getValue();
sql = sql + getAndConSql(sql, mblNo, "B.MblNo like '%" + mblNo + "%'");
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDate_Min, " B.OPDATE>='" + expDate_Min + "'");
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDate_Max, " B.OPDATE<='" + expDate_Max + " 23:59:59'");
var etdDate_Min = form.findField('PS_ETDDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, etdDate_Min, " B.ETD>='" + etdDate_Min + "'");
var etdDate_Max = form.findField('PS_ETDDATEEND').getRawValue();
sql = sql + getAndConSql(sql, etdDate_Max, " B.ETD<='" + etdDate_Max + " 23:59:59'");
var accDate_Min = form.findField('PS_ACCDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, accDate_Min, " B.ACCDATE>='" + accDate_Min + "'");
var accDate_Max = form.findField('PS_ACCDATEEND').getRawValue();
sql = sql + getAndConSql(sql, accDate_Max, " B.ACCDATE<='" + accDate_Max + "'");
var ENTERP = form.findField('PS_ENTERP').getValue();
sql = sql + getAndConSql(sql, ENTERP, "B.ENTERP='" + ENTERP + "'");
var CUSTOMERNAME = form.findField('PS_CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "B.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var AGENT = form.findField('PS_AGENT').getValue();
sql = sql + getAndConSql(sql, AGENT, "B.AGENTID='" + AGENT + "'");
var SALE = form.findField('PS_SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "B.SALE='" + SALE + "'");
var OP = form.findField('PS_OP').getValue();
sql = sql + getAndConSql(sql, OP, "B.OP='" + OP + "'");
var BSTYPE = form.findField('PS_BSTYPE').getValue();
sql = sql + getAndConSql(sql, BSTYPE, "B.BSTYPE='" + BSTYPE + "'");
var OPLB = form.findField('PS_OPLB').getValue();
sql = sql + getAndConSql(sql, OPLB, "B.OPLBNAME='" + OPLB + "'");
var VESSEL = form.findField('PS_VESSEL').getValue();
sql = sql + getAndConSql(sql, VESSEL, "B.VESSEL like '%" + VESSEL + "%'");
var VOYNO = form.findField('PS_VOYNO').getValue();
sql = sql + getAndConSql(sql, VOYNO, "B.VOYNO like '%" + VOYNO + "%'");
var GOODSNAME = form.findField('PS_GOODSNAME').getValue();
sql = sql + getAndConSql(sql, GOODSNAME, "B.GOODSNAME like '%" + GOODSNAME + "%'");
var CUSTNAME = form.findField('CUSTNAME').getValue();
sql = sql + getAndConSql(sql, CUSTNAME, "F.CUSTOMERNAME='" + CUSTNAME + "'");
var DC = form.findField('DC').getValue();
sql = sql + getAndConSql(sql, DC, "F.FEETYPE=" + DC);
var Currency = form.findField('Currency').getValue();
sql = sql + getAndConSql(sql, Currency, "F.Currency='" + Currency + "'");
var FeeName = form.findField('FeeName').getValue();
sql = sql + getAndConSql(sql, FeeName, "F.FeeName='" + FeeName + "'");
var FEERANGE = form.findField('FEERANGE').getValue();
if (FEERANGE == '' || FEERANGE == null || FEERANGE == undefined) {
}
else {
if (sql == '') {
if (FEERANGE == 'B') {
sql = 'F.AMOUNT<>F.SETTLEMENT'
}
}
else {
if (FEERANGE == 'B') {
sql = sql + 'and F.AMOUNT<>F.SETTLEMENT'
}
}
}
var FSTATUS = form.findField('FSTATUS').getValue();
if (FSTATUS == '' || FSTATUS == null || FSTATUS == undefined || FSTATUS == 0) {
}
else {
if (sql == '') {
if (FSTATUS == 1) {
sql = ' F.FEESTATUS=0 or F.FEESTATUS=8 or F.FEESTATUS=9 '
}
}
else {
if (FSTATUS == 1) {
sql = sql + 'and F.FEESTATUS=0 or F.FEESTATUS=8 or F.FEESTATUS=9'
}
}
}
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
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;
}
,
onExportClick: function (button, event) {
_this = this;
if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
GridExportExcelPage(this.gridListDr);
} else if (this.tabpanel.getActiveTab() == this.panelBodyChFeeCr) {
GridExportExcelPage(this.gridListCr);
}
},
Print: function () {
var RPTFEEGROUP = this.formSearch.getForm().findField('RPTFEEGROUP').getValue();
var sql = this.getCondition();
var Crsql = sql + getAndConSql(sql, '1=1', " c.FEETYPE=2");
var Drsql = sql + getAndConSql(sql, '1=1', " c.FEETYPE=1");
_this = this;
if (this.storeListDr.getCount() == 0 && this.storeListCr.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptCustFeeGroup/CustListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: Drsql,
rptfeegroup: RPTFEEGROUP,
feetype: '1',
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstrDr = jsonresult.Data;
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptCustFeeGroup/CustListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: Crsql,
rptfeegroup: RPTFEEGROUP,
feetype: '2',
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstrCr = jsonresult.Data;
var printType = 'MSRPTCUSTFEEGROUP';
var sql1 = returnstrDr;
var sql2 = returnstrCr;
var sql3 = "select B.ETD,B.VESSEL, B.VOYNO,sum(case cur_code.CODENAME when 'USD' then CUR.VALUE end) 美元汇率 ,";
sql3 = sql3 + " sum(case cur_code.CODENAME when 'EUR' then CUR.VALUE end) 澳元汇率";
sql3 = sql3 + " ,sum(case cur_code.CODENAME when 'THB' then CUR.VALUE end) 泰铢汇率";
sql3 = sql3 + " ,sum(case cur_code.CODENAME when 'JPY' then CUR.VALUE end)*10000 日元汇率";
sql3 = sql3 + " ,sum(case cur_code.CODENAME when 'KRW' then CUR.VALUE end)*10000 韩元汇率";
sql3 = sql3 + " from currency_exchange cur";
sql3 = sql3 + " left join code_currency cur_code on cur.CURRENCYID=cur_code.GID";
sql3 = sql3 + " left join (select top 1 * from V_OP_BS B where " + sql + ") B on cur.STARTTIME<=B.ETD and cur.ENDTIME>=B.ETD ";
sql3 = sql3 + " WHERE " + sql + " GROUP BY B.ETD,B.VESSEL,B.VOYNO ";
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
});
}
}
});
} 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
});
}
}
});
}
});