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.

531 lines
19 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.RptChFeeInvoiceDutyFreeIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.RptChFeeInvoiceDutyFreeIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.RptChFeeInvoiceDutyFreeIndex, Ext.Panel, {
PageSize: 1000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formRptChFeeInvoiceDutyFreeIndex"; //页面名称
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'RptChFeeInvoiceDutyFreeModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptChFeeInvoiceDutyFree/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 定义列
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
header: '唯一编码',
width: 0
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME_i',
header: '委托方名称',
width: 120
},
{
sortable: false,
dataIndex: 'INVOICENO',
header: '发票号',
width: 140
}, {
sortable: false,
dataIndex: 'MBLNO',
header: '(运)提单号',
//align: 'center',
width: 140
}, {
sortable: false,
dataIndex: 'VESSEL',
header: '船名',
width: 120
}, {
sortable: false,
dataIndex: 'VOYNO',
header: '航次',
width: 60
}, {
sortable: false,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 120
}, {
sortable: false,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 150
}, {
sortable: false,
dataIndex: 'gjUSD',
header: '国际运费USD',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'gjRMB',
header: '国际运费RMB',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'gkRMB',
header: '港口码头费',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'qtRMB',
header: '其他收费项',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'REMARK',
header: '备注',
width: 200
}];
//#endregion
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
enableHdMenu: false, //是否显示表格列的菜单
stripeRows: true, //斑马线效果
rowLines: true,
columnLines: true,
columns: this.girdcolums,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: '开票日期',
format: 'Y-m-d',
xtype: 'datefield',
editable: false,
allowBlank: false,
id: 'INVOICEMAKETIMEbgn',
name: 'INVOICEMAKETIMEbgn',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keydown': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '至',
labelWidth: 20,
format: 'Y-m-d',
xtype: 'datefield',
editable: false,
allowBlank: false,
id: 'INVOICEMAKETIMEend',
name: 'INVOICEMAKETIMEend',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keydown': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
id: 'VOUNO',
fieldLabel: '发票号',
labelWidth: 50,
name: 'INVOICENObgn',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keydown': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
id: '至',
fieldLabel: '发票号',
labelWidth: 50,
name: 'INVOICENOend',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keydown': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}]
}]
}]//end items(fieldset 1)
});
//#endregion formSearch
//#region 按钮工具条
this.CheckSaveQuery = new Ext.form.Checkbox({
fieldLabel: '记忆查询条件',
checked: true,
width: 120
});
this.panelBtn = new Ext.Panel({
region: "north",
border: false,
tbar: [{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
var isvisible = false;
var issavevalue = false;
if (this.CheckSaveQuery.checked) {
issavevalue = true
}
saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue);
},
scope: this
}, {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(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.CheckSaveQuery, '-', {
xtype: 'button',
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
}]
});
//#endregion
//#region 页面布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 70,
border: false,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
border: false,
items: [this.panelTop, this.gridList]
});
//this.onRefreshClick();
//#endregion
//#region 页面加载
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
if (sql.toString() != "") {
Ext.apply(store.proxy.extraParams, { condition: sql });
}
}, this);
//加载事件
this.InitData();
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
//获取当前日期(到秒)
var curDate = new Date()
//格式化;
var data = Ext.Date.format(curDate, 'Y-m');
Ext.getCmp("INVOICEMAKETIMEbgn").setValue(data);
Ext.getCmp("INVOICEMAKETIMEend").setValue(data);
}, //end InitData
//#endregion
//#region 执行查询
onRefreshClick: function (button, event) {
var sql = this.getCondition();
if (sql.toString() != "") {
this.sqlcontext = sql;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this });
}
},
onDsQuery: function (button, event) {
var sql = this.sqlcontext;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this });
},
//#endregion
//#region 查询
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//#region formSearch 查询面板
//开票期间
var sINVOICEMAKETIMEbgn = form.findField('INVOICEMAKETIMEbgn').getRawValue();
var sINVOICEMAKETIMEend = form.findField('INVOICEMAKETIMEend').getRawValue();
if (sINVOICEMAKETIMEbgn.toString() == "" || sINVOICEMAKETIMEend.toString() == "") {
alert('请先选择开票日期!');
return '';
}
sql = sql + getAndConSql(sql, sINVOICEMAKETIMEbgn, "INVOICEMAKETIME>='" + sINVOICEMAKETIMEbgn + "'");
sql = sql + getAndConSql(sql, sINVOICEMAKETIMEend, "INVOICEMAKETIME<='" + sINVOICEMAKETIMEend + "'");
//开票号
var sINVOICENObgn = form.findField('INVOICENObgn').getValue();
if (sINVOICENObgn != null) {
if (sINVOICENObgn != "") {
sql = sql + getAndConSql(sql, sINVOICENObgn, "INVOICENO>='" + sINVOICENObgn + "'");
}
}
var sINVOICENOend = form.findField('INVOICENOend').getValue();
if (sINVOICENOend != null) {
if (sINVOICENOend != "") {
sql = sql + getAndConSql(sql, sINVOICENOend, "INVOICENO<='" + sINVOICENOend + "'");
}
}
//#endregion formSearch
return sql;
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
this.InitData();
}, //onDeleteClick
//#endregion
//#region 导出Excel
onExportClick: function (button, event) {
if (this.storeList.getCount() == 0) {
return;
}
var sql = this.sqlcontext;
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/RptChFeeInvoiceDutyFree/GetDataListSQL',
params: {
condition: sql,
printstr: 'false'
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
if (returnStr.toString() != "") {
var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
var openType = "_blank";
var condition1 = escape(returnStr);
var openUrl = "../../Reports/RptExport.aspx?handle=RptChFeeInvoiceDutyFreeIndex&formname=" + this.formname + "&condition1=" + condition1;
window.open(openUrl, openType, openSet);
}
} 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 });
}
},
scope: this
});
},
//ExtJs 自带的导出当前页的excel导出函数
onExportClick2: function (button, event) {
GridExportExcelPage(this.gridList);
},
//#endregion
//#region 打印
Print: function () {
if (this.storeList.getCount() == 0) {
return;
}
var sql = this.sqlcontext;
Ext.Msg.wait('正在计算数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/RptChFeeInvoiceDutyFree/GetDataListStr',
params: {
condition: sql,
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
var printType = 'RptChFeeInvoiceDutyFreeIndex';
var sql1 = returnStr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
Ext.Msg.hide();
} 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 });
}
},
timeout: 3000000, //30秒
scope: this
});
},
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});