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/Account/Viewsjs/Chfee_ForeignPay/ChForeignPayIndex.js

1329 lines
51 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.MsChForeignPayIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChForeignPayIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChForeignPayIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.sqlcontext = "";
this.formname = "MsChForeignPayIndex";
//定义数据集
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modPaySettleAppList"} });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChPayapplication',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_ForeignPay/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.column = [
{
sortable: true,
dataIndex: 'BILLNO',
header: '申请单号',
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUSREF',
header: '状态',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算单位',
width: 120
}, {
sortable: true,
dataIndex: 'AMOUNTRMB',
header: 'RMB',
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',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'AMOUNTUSD',
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',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 120
}, {
sortable: true,
dataIndex: 'CURR',
header: '币别',
align: 'center',
width: 60
}, {
sortable: true,
dataIndex: 'APPLYTIME',
header: '申请日期',
width: 100
}, {
sortable: true,
dataIndex: 'APPLICANTNAME',
header: '申请人',
width: 100
}, {
sortable: true,
dataIndex: 'PAYABLETIME',
header: '最晚支付日期',//申请支付日期
width: 100
}, {
sortable: true,
dataIndex: 'CUSTBANKNAME',
header: '结算对象银行',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTACCOUNT',
header: '结算对象账户',
width: 140
},
{
sortable: true,
dataIndex: 'PAYCOMPANY',
header: '付款公司',
width: 80
},
{
sortable: true,
dataIndex: 'PAYBANK',
header: '付款银行',
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160,
editor: {
xtype: 'textfield'
}
}, {
sortable: true,
dataIndex: 'INVNO',
header: '发票号',
width: 80
}, {
sortable: true,
dataIndex: 'SettBillNo',
header: '结算单号',
width: 140
},
{
sortable: true,
dataIndex: 'SettUser',
header: '结算人',
width: 80
},
{
sortable: true,
dataIndex: 'SettDate',
header: '结算时间',
width: 120,
editor: {
xtype: 'datetimefield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'SettStatusRef',
header: '结算状态',
width: 80
},
{
sortable: true,
dataIndex: 'BS_CUSTOMERNAME',
header: '相关业务委托单位',
width: 160
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 80
},
{
sortable: true,
dataIndex: 'ETA',
header: '最早到港日',
width: 110
}
];
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.FeeCBModel = Ext.create('Ext.selection.CheckboxModel'); //, { checkOnly: true }
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.cellEditing_1 = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.column,
plugins: [this.cellEditing_1],
viewConfig: {
enableTextSelection: true,
autoFill: true
},
features: [{
ftype: 'summary'
}],
selModel: this.FeeCBModel,
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Account/Chfee_ForeignPay/BLEdit', record.data.BILLNO);
}, this);
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id表名 中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
this.storeOP = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOP.load({ params: { condition: ""} });
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '申请人',
forceSelection: true,
store: this.storeOP,
name: 'PayUser',
valueField: 'GID',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeOP2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOP2.load({ params: { condition: ""} });
this.comboxOP2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算人',
forceSelection: true,
store: this.storeOP2,
name: 'SettUser',
valueField: 'GID',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.define('IsLockMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'IsLock', type: 'string' },
{ name: 'IsLock_REF', type: 'string' }
]
});
var IsLockData = [{ "IsLock": "", "IsLock_REF": "全部" },
{ "IsLock": "1", "IsLock_REF": "锁定" },
{ "IsLock": "2", "IsLock_REF": "未锁定" },
{ "IsLock": "3", "IsLock_REF": "结算撤销"}];
this.storeIsLockType = Ext.create('Ext.data.Store', {
model: 'IsLockMd',
data: IsLockData
});
this.comboxIsLock = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '结算已锁定',
forceSelection: true,
store: this.storeIsLockType,
name: 'IsLock',
valueField: 'IsLock',
displayField: 'IsLock_REF',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: " ISDISABLE=0 "} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '付费公司',
//matchFieldWidth: false,
store: this.storeCompany,
name: 'companyid',
valueField: 'gid',
displayField: 'name',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeBILLSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBILLSTATUS.load({ params: { enumTypeId: 97005} });
this.comboxBILLSTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '申请单状态',
forceSelection: true,
store: this.storeBILLSTATUS,
name: 'BILLSTATUS',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.GeneralValue',
proxy: { url: '/CommMng/BasicDataRef/GeneralSelect' }
});
this.storeport.load({ params: { condition: "select EnumValueName GID,EnumValueName GVALUE from tSysEnumValue where EnumTypeID=10"} }); //({ params: { enumTypeId: 10} });
this.comboxPort = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '目的港',
autosize: true,
bodyPadding: 1,
flex: 2,
width: 80,
labelWidth: 90,
store: this.storeport,
queryMode: 'local',
triggerOnClick: false,
valueField: 'GID',
displayField: 'GVALUE',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '申请编号',
name: 'BillNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '业务编号',
name: 'BsNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCompany
, {
fieldLabel: '结算单位',
name: 'CustName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从申请日期', id: "ExpDateBgn",
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn',
//value: GetDateStr(0),
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到申请日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxBILLSTATUS
, {
fieldLabel: '从结算日期', id: "SettTimeBgn",
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'SettTimeBgn',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到结算日期', id: "SettTimeEnd",
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'SettTimeEnd',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxOP
, this.comboxOP2
, this.comboxIsLock
, {
xtype: 'hiddenfield',
flex: 2, hidden: true
}
]
}
]//end items(fieldset 1)
}//end fieldset 2
, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '结算编号',
name: 'SettNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '发票号',
name: 'InvNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..金额',
name: 'Amount_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..金额',
name: 'Amount_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxPort, {
xtype: 'hiddenfield',
hidden: true
}
]
}
]//end items(fieldset 1)
}//end fieldset 2
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '付费申请明细表',
handler: clickHandler
}, {
text: '中国银行付汇申请表格',
handler: clickHandler2
}, {
text: '建设银行付汇申请表格',
handler: clickHandler3
}]
});
function clickHandler() {
panelIndex.Print();
};
function clickHandler2() {
panelIndex.Print2();
};
function clickHandler3() {
panelIndex.Print3();
};
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Account/Chfee_ForeignPay/BLEdit');
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
if (this.winAccess == '' || typeof (this.winAccess) == "undefined") {
this.winAccess = new Shipping.DsQuery({});
} else {
this.winAccess.destroy();
this.winAccess = new Shipping.DsQuery({});
}
this.winAccess.StoreList = this.storeList;
this.winAccess.formname = this.formname;
this.winAccess.condition = sql;
this.winAccess.LoadQueryData_self(this.formname);
this.winAccess.show();
return;
},
scope: this
}, '-', {
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, {
text: '撤销审核',
tooltip: '撤销审核',
handler: function (button, event) {
this.onSubmitResetClick();
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', { text: "打印报表", menu: menu1, scope: this },
{
text: "删除",
id: 'btndelete',
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnSaveTable",
handler: function (button, event) {
var formname = this.formname;
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.column, 1, false);
},
scope: this
}, '-',
{
text: "保存修改", id: "SaveBtn",
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 125,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//this.onRefreshClick();
//Ext.getCmp("ExpDateBgn").setValue(GetDateStr(0));
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontex = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var billstatus = record.data.BILLSTATUS;
if (billstatus != '1' && billstatus != '6') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除此单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Account/Chfee_ForeignPay/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onSubmitAuditClick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '1' || rec.data.BILLSTATUS == '6') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitAuditList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBackClick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '2') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitAuditBackList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
},
onSubmitResetClick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '2') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitResetList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
},
onSaveClick: function () {
var bodyList = [];
for (i = 0; i < this.storeList.getCount(); i += 1) {
var member = this.storeList.getAt(i);
bodyList.push(member);
};
var jsonBody = ConvertRecordsToJson(bodyList);
if (jsonBody == '') {
return;
}
if (USERID == "") {
alert("登陆信息丢失,请点击退出重新登陆");
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_ForeignPay/SaveList',
scope: this,
params: {
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeEditList.commitChanges();
this.onRefreshClick();
} 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
});
}
//alert('03');
}
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " (Curr is not null and Curr<>'') ";
var BillNo = form.findField('BillNo').getValue();
sql = sql + getAndConSql(sql, BillNo, " cm.BillNo like '%" + BillNo + "%' ");
var BsNo = form.findField('BsNo').getValue();
sql = sql + getAndConSql(sql, BsNo, " cm.Billno in (select BILLNO from ch_fee_do where bsno in(select bsno from v_op_bs where Custno like '%" + BsNo + "%' )) ");
var SettNo = form.findField('SettNo').getValue();
sql = sql + getAndConSql(sql, SettNo, " cm.Billno in (select PAYBILLNO from ch_fee_do_payapplication where Billno like '%" + SettNo + "%' )");
var companyid = form.findField('companyid').getValue();
sql = sql + getAndConSql(sql, companyid, "cm.companyid = '" + companyid + "'");
var custName = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, custName, "cm.CUSTOMERNAME like '%" + custName + "%'");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "cm.APPLYTIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "cm.APPLYTIME <='" + expDateEnd + " 23:59:59'");
var InvNo = form.findField('InvNo').getValue();
sql = sql + getAndConSql(sql, InvNo, "cm.INVNO like '%" + InvNo + "%'");
var BILLSTATUS = form.findField('BILLSTATUS').getValue();
sql = sql + getAndConSql(sql, BILLSTATUS, "cm.BILLSTATUS= " + BILLSTATUS + "");
var SettTimeBgn = form.findField('SettTimeBgn').getRawValue();
sql = sql + getAndConSql(sql, SettTimeBgn, "cm.billno in(select PAYBILLNO from ch_fee_do_payapplication where billno in (select BILLNO from ch_fee_settlement where SETTLETIME>='" + SettTimeBgn + "')) ");
var SettTimeEnd = form.findField('SettTimeEnd').getRawValue();
sql = sql + getAndConSql(sql, SettTimeEnd, "cm.billno in(select PAYBILLNO from ch_fee_do_payapplication where billno in (select BILLNO from ch_fee_settlement where SETTLETIME<='" + SettTimeEnd + "')) ");
var PayUser = form.findField('PayUser').getValue();
sql = sql + getAndConSql(sql, PayUser, "cm.APPLICANT= '" + PayUser + "'");
var SettUser = form.findField('SettUser').getValue();
sql = sql + getAndConSql(sql, SettUser, "cm.billno in(select PAYBILLNO from ch_fee_do_payapplication where billno in (select BILLNO from ch_fee_settlement where SETTLEUSER='" + SettUser + "')) ");
var IsLock = form.findField('IsLock').getValue();
if (IsLock != "") {
sql = sql + getAndConSql(sql, IsLock, "cm.billno in(select PAYBILLNO from ch_fee_do_payapplication where billno in (select BILLNO from ch_fee_settlement where BILLSTATUS='" + IsLock + "')) ");
}
var Amount_max = form.findField('Amount_max').getValue();
if (parseFloat(Amount_max) == 0 || Amount_max == "") {
var Amount_min = form.findField('Amount_min').getValue();
sql = sql + getAndConSql(sql, Amount_min, "(cm.AmountRMB = " + Amount_min + " or cm.AmountUSD = " + Amount_min + ")");
} else {
var Amount_min = form.findField('Amount_min').getValue();
sql = sql + getAndConSql(sql, Amount_min, "((cm.AmountRMB<>0 and cm.AmountRMB >= " + Amount_min + ") or (cm.AmountUSD<>0 and cm.AmountUSD >= " + Amount_min + "))");
var Amount_max = form.findField('Amount_max').getValue();
sql = sql + getAndConSql(sql, Amount_max, "((cm.AmountRMB<>0 and cm.AmountRMB <= " + Amount_max + ") or (cm.AmountUSD<>0 and cm.AmountUSD<= " + Amount_max + "))");
}
var portList = this.comboxPort.getValue();
//alert(CnameList);
var port = "";
for (var i = 0; i < portList.length; i++) {
if (port == "") { port = "'" + portList[i] + "'"; }
else { port = port + ",'" + portList[i] + "'"; }
}
if (port != "") {
sql = sql + getAndConSql(sql, port, "cm.billno in (select billno from ch_Fee_do where bsno in(select bsno from v_op_bill where portdischarge in(" + port + ")))");
}
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
,
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
Print: function () {//样本清单
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('BILLNO') + "'"; }
else {
MainList = MainList + ",'" + rec.get('BILLNO') + "'";
}
}
if (MainList == "") return;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var printType = 'ForeignPayApplication_List'; //样本清单
//var T = this.getCondition();
//if (T != "") { T = " where " + T; };
var sql1 = " SELECT cm.GID,cm.BILLNO 申请单号,BILLSTATUS,CUSTOMERNAME 结算单位,CURR 币别,CHEQUEPAYABLE,SETTLETYPE ";
sql1 = sql1 + " ,PAYABLETIME 申请支付日期,AMOUNTRMB RMB,RATE,AMOUNTUSD 外币,SETTLERMB,SETTLEUSD,SETTLERATE";
sql1 = sql1 + " ,APPLICANT,APPLYTIME 申请日期,ENTERTIME,SETTLEUSER,SETTLETIME,AUDITUSER,AUDITTIME ";
sql1 = sql1 + " ,REMARK 备注,COMPANYID,ISAPP,PAYAPPID,CHEQUENUMREMARK,INVDATE,INVNO 发票号";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97005 and EnumValueID=cm.BILLSTATUS) as 状态";
sql1 = sql1 + " ,(select ShowName from [user] where GID=cm.APPLICANT) 申请人";
sql1 = sql1 + " ,CUSTACCOUNTGID";
sql1 = sql1 + " ,(select CODENAME+'_'+bankname from info_client_bank where gid=cm.CUSTACCOUNTGID) 结算对象银行";
sql1 = sql1 + " ,(select ACCOUNT from info_client_bank where gid=cm.CUSTACCOUNTGID) 结算对象账户";
sql1 = sql1 + " ,PAYACCOUNTGID";
sql1 = sql1 + " ,(select NAME from company where gid=cm.COMPANYID) 付款公司";
sql1 = sql1 + " ,CURR1,CURR2,CURR3,isnull(Exchangerate1,0) Exchangerate1,isnull(Exchangerate2,0) Exchangerate2,isnull(Exchangerate3,0) Exchangerate3 ";
sql1 = sql1 + " ,isnull(AMOUNT1,0) AMOUNT1,isnull(AMOUNT2,0) AMOUNT2,isnull(AMOUNT3,0) AMOUNT3 ";
sql1 = sql1 + " ,ACCOUNT1,ACCOUNT2,ACCOUNT3,ContactGID,(select showname from info_client_contact where gid=ContactGID)ContactREF ";
sql1 = sql1 + " ,dbo.f_paySettBillno(cm.BILLNO) 结算单号,dbo.[F_PaySett_User](cm.BILLNO) 结算人 ";
sql1 = sql1 + " ,dbo.[F_PaySett_Settdate](cm.BILLNO) 结算时间,dbo.[F_PaySett_locked](cm.BILLNO) 结算状态 ";
sql1 = sql1 + " ,cm.BS_CUSTOMERNAME 相关业务委托单位,cm.PAYBANK 付款银行";
sql1 = sql1 + " ,(select top 1 PORTDISCHARGE from v_op_Bs where bsno in(select bsno from ch_fee_do where BILLNO=cm.BILLNO)) 目的港 ";
sql1 = sql1 + " FROM ch_fee_payapplication cm ";
sql1 = sql1 + " left join ch_fee_ForeignpayDetail D on D.billno=cm.billno ";
sql1 = sql1 + " where cm.BILLNO in(" + MainList + ") ";
sql1 = sql1 + " order by CM.BILLNO ";
var sql2 = "select '" + SHOWNAME + "' SHOWNAME,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print2: function () {//中国银行付汇申请表格
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('BILLNO') + "'"; }
else {
MainList = MainList + ",'" + rec.get('BILLNO') + "'";
}
}
if (MainList == "") return;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var printType = 'ForeignPayList_ChinaBank'; //样本清单
//var T = this.getCondition();
//if (T != "") { T = " where " + T; };
var sql1 = " select dbo.trimdate(getdate()) 当天日期,p.CURR 币别,p.AMOUNTUSD 汇款金额 ";
sql1 = sql1 + " ,b.ACCOUNT 购汇账户,p.AMOUNTUSD 购汇金额,REPLACE(comp.ORGANIZATIONCODE,' ','') 组织机构代码 ";
sql1 = sql1 + " ,b.ACCOUNT 支付手续费账户,comp.ENNAME 汇款人名称,comp.ENADDRESS 汇款人地址 ";
sql1 = sql1 + " ,cb.ACCOUNT 收款人账号,ic.EnFullName 收款人名称,ic.ADDR 收款人地址 ";
sql1 = sql1 + " ,cb.BANKNAME 收款人开户银行名称,cb.BANKACNO 银行SWIFT ,cb.BANKADDR 收款人开户银行地址 ";
sql1 = sql1 + " ,cb.BANKAGENTNAME 收款银行之代理行名称,cb.swift 代理银行SWIFT ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) [收款人常驻国家(地区)名称] ";
sql1 = sql1 + " ,dbo.F_PayAppCUSTNO(p.BILLNO) 合同号,cc.codenum 国家数字代码 ";
sql1 = sql1 + " from ch_fee_payapplication p ";
sql1 = sql1 + " left join ch_fee_ForeignpayDetail D on D.billno=p.billno ";
sql1 = sql1 + " left join sys_bank b on b.gid=d.ACCOUNT2 ";
sql1 = sql1 + " left join company comp on comp.GID=p.COMPANYID ";
sql1 = sql1 + " left join info_client_bank cb on cb.gid= p.CUSTACCOUNTGID ";
sql1 = sql1 + " left join info_client ic on ic.SHORTNAME=p.CUSTOMERNAME ";
sql1 = sql1 + " left join code_country cc on cc.COUNTRYID=cb.COUNTRYID ";
sql1 = sql1 + " where p.BILLNO in(" + MainList + ") ";
//sql1 = sql1 + " order by CM.BILLNO ";
var sql2 = "select '" + SHOWNAME + "' SHOWNAME,(select MOBILE from [user_baseinfo] where gid ='" + USERID + "' ),'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print3: function () {//建设银行付汇申请表格
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('BILLNO') + "'"; }
else {
MainList = MainList + ",'" + rec.get('BILLNO') + "'";
}
}
if (MainList == "") return;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var printType = 'ForeignPayList_CCB'; //样本清单
//var T = this.getCondition();
//if (T != "") { T = " where " + T; };
var sql1 = " select dbo.trimdate(getdate()) 当天日期,p.CURR 币别,p.AMOUNTUSD 汇款金额 ";
sql1 = sql1 + " ,b.ACCOUNT 购汇账户,p.AMOUNTUSD 购汇金额,REPLACE(comp.ORGANIZATIONCODE,' ','') 组织机构代码 ";
sql1 = sql1 + " ,b.ACCOUNT 支付手续费账户,comp.ENNAME 汇款人名称,comp.ENADDRESS 汇款人地址 ";
sql1 = sql1 + " ,cb.ACCOUNT 收款人账号,ic.EnFullName 收款人名称,ic.ADDR 收款人地址 ";
sql1 = sql1 + " ,cb.BANKNAME 收款人开户银行名称,cb.BANKACNO 银行SWIFT ,cb.BANKADDR 收款人开户银行地址 ";
sql1 = sql1 + " ,cb.BANKAGENTNAME 收款银行之代理行名称,cb.swift 代理银行SWIFT ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) [收款人常驻国家(地区)名称] ";
sql1 = sql1 + " ,dbo.F_PayAppCUSTNO(p.BILLNO) 合同号,cc.codenum 国家数字代码 ";
sql1 = sql1 + " from ch_fee_payapplication p ";
sql1 = sql1 + " left join ch_fee_ForeignpayDetail D on D.billno=p.billno ";
sql1 = sql1 + " left join sys_bank b on b.gid=d.ACCOUNT2 ";
sql1 = sql1 + " left join company comp on comp.GID=p.COMPANYID ";
sql1 = sql1 + " left join info_client_bank cb on cb.gid= p.CUSTACCOUNTGID ";
sql1 = sql1 + " left join info_client ic on ic.SHORTNAME=p.CUSTOMERNAME ";
sql1 = sql1 + " left join code_country cc on cc.COUNTRYID=cb.COUNTRYID ";
sql1 = sql1 + " where p.BILLNO in(" + MainList + ") ";
//sql1 = sql1 + " order by CM.BILLNO ";
var sql2 = "select '" + SHOWNAME + "' SHOWNAME,(select MOBILE from [user_baseinfo] where gid ='" + USERID + "' ),'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});