You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsRptFeeSettleStatus/MsRptFeeSettleZnjIndex.js

1431 lines
50 KiB
JavaScript

//结算费用统计
Ext.namespace('Shipping');
Shipping.MsRptFeeSettleZnjIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptFeeSettleZnjIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptFeeSettleZnjIndex, Ext.Panel, {
PageSize: 2000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
bslistdrsortfield: '',
bslistdrsortdire: '',
bslistcrsortfield: '',
bslistcrsortdire: '',
feelistdrsortfield: '',
feelistdrsortdire: '',
feelistcrsortfield: '',
feelistcrsortdire: '',
salesumsortfield: '',
salesumsortdire: '',
custsumsortfield: '',
custsumsortdire: '',
vesselsumsortfield: '',
vesselsumsortdire: '',
initUIComponents: function () {
//定义数据集
this.sqlcontext = '1=2';
this.formname = 'MsRptFeeSettleZnjIndex';
//#region 费用统计
this.storeFeeListDr = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BSNO', type: 'string' },
{ name: 'PARENTID', type: 'string' },
{ name: 'OPLB', type: 'string' },
{ name: 'OPLBNAME', type: 'string' },
{ name: 'FEESTATUSREF', type: 'string' },
{ name: 'BLTYPE', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'HBLNO', type: 'string' },
{ name: 'ETD', type: 'string' },
{ name: 'ACTUALDAY', type: 'number' },
{ name: 'NODAY', type: 'number' },
{ name: 'VESSEL', type: 'string' },
{ name: 'VOYNO', type: 'string' },
{ name: 'INPUTBY', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'BSSTATUS', type: 'string' },
{ name: 'FEESTATUSREF', 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: 'CBM', type: 'number' },
{ name: 'TEU', type: 'number' },
{ name: 'CUSTNAME', type: 'string' },
{ name: 'FeeType_Ref', type: 'string' },
{ name: 'FEENAME', type: 'string' },
{ name: 'UNIT', type: 'string' },
{ name: 'CURRENCY', type: 'string' },
{ name: 'REMARK', type: 'string' },
{ name: 'UNITPRICE', type: 'number' },
{ name: 'QUANTITY', type: 'number' },
{ name: 'AMOUNT', type: 'number' },
{ name: 'EXCHANGERATE', type: 'number' },
{ name: 'RATE', type: 'number' },
{ name: 'TAXRATE', type: 'number' },
{ name: 'NOTAXAMOUNT', type: 'number' },
{ name: 'ACCTAXRATE', type: 'number' },
{ name: 'SETTLEMENT', type: 'number' },
{ name: 'BILLNO', type: 'string' },
{ name: 'SETTLETIME', type: 'string' },
{ name: 'SETTLENO', type: 'string' },
{ name: 'SETTLEUSERREF', type: 'string' },
{ name: 'SETTLETYPEREF', type: 'string' },
{ name: 'USDHYFCR', type: 'number' },
{ name: 'STLUSDHYFCR', type: 'number' },
{ name: 'BALUSDHYFCR', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsRptFeeSettleStatus/ZnjFeeListData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolumsfeedr = [{
sortable: true,
dataIndex: 'BSNO',
text: '编号',
hidden: true,
width: 130
}, {
sortable: true,
dataIndex: 'CUSTNAME',
text: '结算客户',
width: 60
}, {
sortable: true,
dataIndex: 'FEESTATUSREF',
text: '费用锁定',
width: 70
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
text: '委托单位',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
text: '委托编号',
width: 136
}, {
sortable: true,
dataIndex: 'MBLNO',
text: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'HBLNO',
text: '分提单号',
width: 120
}, {
sortable: true,
dataIndex: 'ETD',
text: '开船日期',
width: 86
}, {
sortable: true,
dataIndex: 'VESSEL',
text: '船名',
width: 200
}, {
sortable: true,
dataIndex: 'VOYNO',
text: '航次',
width: 50
},
{
sortable: true,
dataIndex: 'BILLNO',
text: '结算单号',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLETIME',
text: '结算日期',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLENO',
header: '相关号码',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEUSERREF',
header: '结算人',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLETYPEREF',
header: '结算方式',
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
text: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
text: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
text: '起运港',
width: 80
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
text: '目的港',
width: 150
}, {
sortable: true,
dataIndex: 'ACCDATE',
text: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'CARRIER',
text: '船公司',
width: 80
}, {
sortable: true,
dataIndex: 'FORWARDER',
header: '订舱代理',
width: 100
}, {
sortable: true,
dataIndex: 'BSSOURCE',
text: '业务来源',
width: 120
}, {
sortable: true,
dataIndex: 'TEU',
text: 'TEU',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
text: 'KGS',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
text: '集装箱',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSNAME',
text: '品名',
width: 80
}, {
sortable: true,
dataIndex: 'FeeType_Ref',
text: '收付类型',
width: 60
}, {
sortable: true,
dataIndex: 'FEENAME',
text: '费用名称',
width: 60
}, {
sortable: true,
dataIndex: 'CURRENCY',
text: '币别',
width: 60
}, {
sortable: true,
dataIndex: 'AMOUNT',
text: '金额',
align: 'right',
width: 80,
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;
}
}, {
sortable: true,
dataIndex: 'SETTLEMENT',
text: '结算金额',
align: 'right',
width: 80,
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;
}
}, {
sortable: true,
dataIndex: 'REMARK',
text: '备注',
width: 60
}, {
sortable: true,
dataIndex: 'USDHYFCR',
header: 'USD海运费应付',
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: 'STLUSDHYFCR',
header: 'USD海运费已付',
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: 'BALUSDHYFCR',
header: 'USD海运费未付',
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
}
];
this.girdcolumsfeedr = DsTruck.GetGridPanel(USERID, this.formname + 'feedr', this.initgirdcolumsfeedr, 1);
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 170,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
})
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridFeeListDr = new Ext.grid.GridPanel({
store: this.storeFeeListDr,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolumsfeedr,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeFeeListDr,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridFeeListDr.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 = "";
openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
}, this);
this.gridFeeListDr.addListener('sortchange', function (ct, column, direction, eOpts) {
this.feelistdrsortfield = column.dataIndex;
this.feelistdrsortdire = direction;
}, this);
//#endregion
///////////////////////////////////////////
//#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.comboxOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeSalesCode,
forceSelection: true,
name: 'PS_OP',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: 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: {
keyup: 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',
//flex: 0.5,
//labelWidth: 50,
forceSelection: true,
name: 'DC',
enableKeyEvents: true,
listeners: {
keyup: 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,
//flex: 0.5,
//labelWidth: 50,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR',
enableKeyEvents: true,
listeners: {
keyup: 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: {
keyup: 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: {
keyup: 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: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameZnj = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.comboxFeeNameZnj = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '生成费用名称',
labelWidth: 90,
store: this.storeFeeNameZnj,
forceSelection: true,
name: 'ZnjFeeName',
valueField: 'Name',
displayField: 'CodeAndName',
enableKeyEvents: true
});
this.storeFeeNameZnj.load({ params: { condition: "" } });
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
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.comboxOp
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '编号',
name: 'PS_MBLNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxVoyVeg, {
fieldLabel: '航次',
//labelWidth: 40,
//flex: 0.5,
name: 'PS_VOYNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SETTLEDATEBGN',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SETTLEDATEEND',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSalesCode, this.comboxCustCode,{
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();
}
}
}
}
]
}, , {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFeeNameZnj, {
fieldLabel: '滞纳金比率%',
xtype: 'numberfield',
labelWidth: 80,
name: 'PS_ZNJ',
enableKeyEvents: true
}, {
xtype: 'button',
width: 90,
text: '生成滞纳金', //"执行查询",
handler: function (button, event) {
this.onCreateZNJ();
},
scope: this
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { 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",
id: "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
}
]
});
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.panelFeeListDr = new Ext.Panel({
title: '结算费用明细',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.gridFeeListDr]
});
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelFeeListDr
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.tabpanel]
});
this.storeFeeListDr.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeFeeListDr.currentPage = 1;
this.storeFeeListDr.pageSize = this.PageSize;
this.storeFeeListDr.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function (button, event) {
this.PageSize = this.Pagenum.getValue();
var sql = this.sqlcontext;
this.storeFeeListDr.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
var data = this.formSearch.getForm().getValues(false, false, false);
var sql = '';
var stlsql = '';
/*
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
*/
var mblNo = form.findField('PS_MBLNO').getValue();
sql = sql + getAndConSql(sql, mblNo, " (B.CUSTNO like '%" + mblNo + "%' or B.MBLNO like '%" + mblNo + "%' or B.HBLNO like '%" + mblNo + "%' or B.CUSTOMNO like '%" + mblNo + "%' or B.ORDERNO like '%" + mblNo + "%') ");
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 CUSTOMERNAME = form.findField('PS_CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "B.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var SALE = form.findField('PS_SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "B.SALE='" + SALE + "'");
/*
var PS_FEELOCK = form.findField('PS_FEELOCK').getValue();
if (PS_FEELOCK == '已锁定')
sql = sql + getAndConSql(sql, PS_FEELOCK, "B.FEESTATUS=1");
else if (PS_FEELOCK == '未锁定')
sql = sql + getAndConSql(sql, PS_FEELOCK, "B.FEESTATUS=0");
*/
var OP = form.findField('PS_OP').getValue();
sql = sql + getAndConSql(sql, OP, "B.OP='" + OP + "'");
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 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 '
}
if (FEERANGE == 'S') {
sql = ' F.SETTLEMENT<>0 '
}
}
else {
if (FEERANGE == 'B') {
sql = sql + ' and F.AMOUNT<>F.SETTLEMENT '
}
if (FEERANGE == 'S') {
sql = sql + ' and F.SETTLEMENT<>0 '
}
}
}
var CREATETIME_MIN = form.findField('SETTLEDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, CREATETIME_MIN, " s.SETTLETIME>='" + CREATETIME_MIN + "'");
var CREATETIME_MAX = form.findField('SETTLEDATEEND').getRawValue();
sql = sql + getAndConSql(sql, CREATETIME_MAX, " s.SETTLETIME<='" + CREATETIME_MAX + " 23:59:59'");
// if (stlsql != '') {
// sql = sql + getAndConSql(sql, stlsql, "D.BILLNO IN (SELECT BILLNO FROM ch_fee_settlement S WHERE " + stlsql+" )");
//
// }
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] = "MsRptFeeSettleStatusIndex";
return ret;
},
onCreateZNJ: function () {
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.FEESTATUSREF != '锁定')
bodyAddDatas.push(rec);
}
//_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要生成滞纳金的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var form = this.formSearch.getForm();
var FeeName = form.findField('ZnjFeeName').getValue();
var PS_ZNJ = form.findField('PS_ZNJ').getValue();
if (FeeName == null || FeeName == '') {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (PS_ZNJ == null || PS_ZNJ == '' || PS_ZNJ == '0') {
Ext.Msg.show({ title: '提示', msg: '滞纳金比率不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在生成...');
Ext.Ajax.request({
waitMsg: '正在生成...',
url: '/MvcShipping/MsChFee/CreateZnj',
params: {
data: jsonbodyAddDatas,
FeeName: FeeName,
ZNJ: PS_ZNJ
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSaveGridClick: function (button, event) {
this.girdcolumsfeedr = DsTruck.SaveGridPanel(USERID, this.formname + 'feedr', this.gridFeeListDr.columns, this.girdcolumsfeedr, 1, true);
},
oninitGridClick: function (button, event) {
this.gridFeeListDr.reconfigure(this.storeFeeListDr, this.initgirdcolumsfeedr);
this.girdcolumsfeedr = DsTruck.SaveGridPanel(USERID, this.formname + 'feedr', this.gridFeeListDr.columns, this.initgirdcolumsfeedr, 1, true);
},
// onExportClick: function (button, event) {
// _this = this;
// if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
// GridExportExcelPage(this.gridListDr);
// } else if (this.tabpanel.getActiveTab() == this.panelCustSum) {
// GridExportExcelPage(this.gridListCust);
// } else if (this.tabpanel.getActiveTab() == this.panelFeeListDr) {
// grid2Excel(this.gridFeeListDr, "结算费用明细");
//// GridExportExcelPage(this.gridFeeListDr);
// }
// },
onExportClick: function () {
var sql = this.getCondition();
//var Crsql = sql + getAndConSql(sql, '1=1', " F.FEETYPE=2");
//var Drsql = sql + getAndConSql(sql, '1=1', " F.FEETYPE=1");
_this = this;
if (this.storeFeeListDr.getCount() == 0) {
return;
}
var sortstr = ' CUSTOMERNAME,OPDATE';
if (this.feelistdrsortfield != '' && this.feelistdrsortdire != '') {
sortstr = this.feelistdrsortfield + ' ' + this.feelistdrsortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptFeeSettleStatus/ZnjFeeListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: _this.sqlcontext,
printstr: 'true',
sortstr: sortstr
},
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 = 'MsRptFeeSettleStatusFEELISTDR';
var sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
if (sql1 != '') {
GridExportBySql(sql1, this.formname + 'feedr', '结算费用统计-费用明细.xls');
}
} 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
});
}
}
});
},
Print: function () {
var sql = this.getCondition();
//var Crsql = sql + getAndConSql(sql, '1=1', " F.FEETYPE=2");
//var Drsql = sql + getAndConSql(sql, '1=1', " F.FEETYPE=1");
_this = this;
if (this.storeFeeListDr.getCount() == 0) {
return;
}
var sortstr = ' F.CUSTOMERNAME,B.OPDATE';
if (this.feelistdrsortfield != '' && this.feelistdrsortdire != '') {
sortstr = this.feelistdrsortfield + ' ' + this.feelistdrsortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptFeeSettleStatus/ZnjFeeListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: _this.sqlcontext,
printstr: 'true',
sortstr: sortstr
},
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 = 'MsRptFeeSettleZnjFEELISTDR';
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
});
}
}
});
}
});