Ext.namespace('Shipping');
Shipping.MsChBankdataIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChBankdataIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChBankdataIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.invsqlcontext = '';
this.formname = "MsChBankdataIndex"; //页面名称
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChBankdata',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_bankdata/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.initgirdcolums = [{
sortable: true,
dataIndex: 'PCNO',
header: '批次号',
width: 30
}, {
sortable: true,
dataIndex: 'SFNO',
header: '顺序号',
width: 20
}, {
sortable: true,
dataIndex: 'TRANSTYPE',
header: '交易类型',
width: 40
}, {
sortable: true,
dataIndex: 'DRAWEE_BANK',
header: '付款人开户行',
width: 120
}, {
sortable: true,
dataIndex: 'DRAWEE_ACCOUNT',
header: '付款人账号',
width: 120
}, {
sortable: true,
dataIndex: 'DRAWEE_NAME',
header: '付款人名称',
width: 160
}, {
sortable: true,
dataIndex: 'PAYEE_BANK',
header: '收款人开户行',
width: 120
}, {
sortable: true,
dataIndex: 'PAYEE_ACCOUNT',
header: '收款人账号',
width: 120
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 40
}, {
sortable: true,
dataIndex: 'AMOUNT',
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 '' + lsValue + '';
}
}
else {
return '' + value +'' ;
}
}
catch (e) {
return '' + value + '';;
}
return '' + value + '';;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'BALANCE',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TRANSNO',
header: '流水号',
width: 70
}, {
sortable: true,
dataIndex: 'PAYEE_NAME',
header: '收款人名称',
width: 160
}, {
sortable: true,
dataIndex: 'TRANSDATE',
header: '交易日期',
width: 80
}, {
sortable: true,
dataIndex: 'IMPORTDATE',
header: '导入日期',
width: 80
}, {
sortable: true,
dataIndex: 'IMPORTER',
header: '导入人',
width: 80
}, {
sortable: true,
dataIndex: 'ISFIT',
header: '是否匹配',
width: 40,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "";
}
}
}, {
sortable: true,
dataIndex: 'FITCOUNT',
header: '匹配数量',
width: 60
}, {
sortable: true,
dataIndex: 'INVNO',
header: '发票号',
width: 100
}, {
sortable: true,
dataIndex: 'FITDATE',
header: '匹配日期',
width: 100
}, {
sortable: true,
dataIndex: 'FITTYPE',
header: '匹配类型',
width: 100
}, {
sortable: true,
dataIndex: 'ATTITIONAL',
header: '交易附言',
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 100
}, {
sortable: true,
dataIndex: 'SUMMARY',
header: '摘要',
width: 100
}, {
sortable: true,
dataIndex: 'ISSTL',
header: '是否结算',
width: 40,
renderer: function (value, cellmeta) {
if (value == 'true') {
return "";
}
}
}, {
sortable: true,
dataIndex: 'STLBILLNO',
header: '结算单号',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
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.TtlSel = Ext.create('Ext.form.Label', {
name: 'bottleslbl',
labelAlign: 'right',
width: 800
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
selModel: this.GridCheckBoxModel,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var TRANSTYPE = record.get('TRANSTYPE');
if (TRANSTYPE == '往账')
return 'text_red';
}
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum, this.TtlSel]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (record.data.TRANSTYPE == '往账') {
DsOpenEditWin('/Account/Chfee_bankdata/PayIndex?handle=check&GID=' + record.data.GID);
} else {
DsOpenEditWin('/Account/Chfee_bankdata/InvIndex?handle=check&GID=' + record.data.GID);
}
//var openSet = "height=400, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
//var openType = "_blank";
//var openUrl = "/Account/Chfee_jinzhang/Edit";
//window.open(openUrl, openType, openSet);
}, this);
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
//#region formSearch
this.StoreISFIT = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'OpLb']
});
this.StoreISFIT.add({ "FSTATUS": "", "OpLb": "全部" });
this.StoreISFIT.add({ "FSTATUS": "已匹配", "OpLb": "已匹配" });
this.StoreISFIT.add({ "FSTATUS": "未匹配", "OpLb": "未匹配" });
this.comboxISFIT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否匹配',
store: this.StoreISFIT,
forceSelection: true,
value: '',
flex: 0.5,
name: 'ISFIT',
valueField: 'FSTATUS',
displayField: 'OpLb',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreTRANSTYPE = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'OpLb']
});
this.StoreTRANSTYPE.add({ "FSTATUS": "", "OpLb": "全部" });
this.StoreTRANSTYPE.add({ "FSTATUS": "来账", "OpLb": "来账" });
this.StoreTRANSTYPE.add({ "FSTATUS": "往账", "OpLb": "往账" });
this.comboxTRANSTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '交易类型',
store: this.StoreTRANSTYPE,
forceSelection: true,
value: '',
flex: 0.5,
name: 'TRANSTYPE',
valueField: 'FSTATUS',
displayField: 'OpLb',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreBANK = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' }
});
this.StoreBANK.load({ params: { condition: "" } });
this.StoreBANK.on('beforeload', function (store) {
var companyid = this.formEdit.getForm().findField('SALECORPID').getValue();
Ext.apply(store.proxy.extraParams, { companyid: companyid });
}, this);
this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '银行账号',
store: this.StoreBANK,
forceSelection: true,
name: 'ACCOUNT',
valueField: 'ACCOUNT',
displayField: 'BANKACCOUNT'
});
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 65,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxTRANSTYPE,this.comboxBANK,{
fieldLabel: '批次号',
name: 'PCNo',
flex: 0.5,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '流水号',
name: 'TRANSNO',
flex: 0.5,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '付款人名称',
name: 'CustName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxISFIT, {
fieldLabel: '从交易日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 0.7,
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到交易日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 0.7,
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: '导入流水', //"EXCEL导入",
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onImportBillClick(1);
},
scope: this
}, '-',
{
text: "自动匹配结算",
handler: function (button, event) {
this.onAutoPIPEIClick();
},
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
}, '-',
{
text: "删除",
iconCls: "btndelete",
id: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
text:'发票匹配',
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Account/Chfee_bankdata/InvIndex');
},
scope: this
}, {
text: '付费申请匹配',
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Account/Chfee_bankdata/PayIndex');
},
scope: this
},
'-', {
text: "保存列表样式",
id: "btntest",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
//定义数据集
//this.gridSelectSum = new Ext.grid.GridPanel({
// store: this.storeSelectSum,
// enableHdMenu: false,
// // anchor: '100% 50%',
// region: 'south',
// height: 80,
// loadMask: { msg: '数据加载中,请稍等...' }, //数据加载中,请稍等...
// trackMouseOver: true,
// disableSelection: false,
// tbar: [{
// xtype: 'label',
// width: 220,
// id: 'SelectGrid',
// height: 22,
// text: '合计'//所选费用合计
// }],
// columns: [{
// sortable: true,
// dataIndex: 'RMBDR',
// header: 'RMB' + Zi.LAN.weishou, //RMB未收
// width: 80
// }, {
// sortable: true,
// dataIndex: 'RMBCRAMOUNT',
// header: 'RMB' + Zi.LAN.weifu, //RMB未付
// width: 80
// }, {
// sortable: true,
// dataIndex: 'USDDRAMOUNT',
// header: 'USD' + Zi.LAN.weishou, //USD未收
// width: 80
// }, {
// sortable: true,
// dataIndex: 'USDCRAMOUNT',
// header: 'USD' + Zi.LAN.weifu, //USD未付
// width: 80
// }, {
// sortable: true,
// dataIndex: 'OTDRAMOUNT',
// header: Zi.LAN.otherws, //其他未收
// width: 80
// }, {
// sortable: true,
// dataIndex: 'OTCRAMOUNT',
// header: Zi.LAN.Otherwf, //其他未付
// width: 80
// }
// ]
//});
this.panelcenter = new Ext.Panel({
layout: "border",
region: 'center',
items: [
this.gridList
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelcenter]
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
_this.sqlcontext = "TRANSDATE>='" + mydatestr + "' and TRANSDATE<='" + mydatestr + " 23:59:59'";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: _this.sqlcontext },
waitMsg: "正在查询数据...",
scope: this
});
/* this.onRefreshClick();*/
_this = this;
this.formFit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '开票日期',//从业务日期
format: 'Y-m-d',
//labelWidth: 80,
xtype: 'datefield',
name: 'PS_INVDATEBGN'
}, {
fieldLabel: '至开票日期',//至业务日期
format: 'Y-m-d',
labelWidth: 80,
xtype: 'datefield',
name: 'PS_INVDATEEND'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '支付申请日期',//从业务日期
format: 'Y-m-d',
//labelWidth: 80,
xtype: 'datefield',
name: 'PS_PAYDATEBGN'
}, {
fieldLabel: '支付申请日期',//至业务日期
format: 'Y-m-d',
labelWidth: 80,
xtype: 'datefield',
name: 'PS_PAYDATEEND'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
_thisFitIndex = this;
this.winFitShow = Ext.create('Ext.window.Window', {
title: '匹配范围', //"批量修改",
width: 420,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formFit],
buttons: [{
text: '确认匹配', //"确认修改",
minWidth: 70,
handler: function () {
_thisFitIndex.onFitClick()
}
}, {
text:'关闭', //"关闭",
minWidth: 70,
handler: function () {
_thisFitIndex.winFitShow.close();
}
}]
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.currentPage = 1;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
setTotalHead: function () {
var rmbdr = 0;
var rmbcr = 0;
var usddr = 0;
var usdcr = 0;
for (i = 0; i < this.storeBodySum.getCount(); i += 1) {
var memberyf = this.storeBodySum.getAt(i);
rmbdr = memberyf.data.RMBDR;
rmbcr = memberyf.data.RMBCR;
usddr = memberyf.data.USDDR;
usdcr = memberyf.data.USDCR;
}
var rmblb = "";
rmblb = "   来账RMB:" + returnfloat(rmbdr) + "    来账USD: " + returnfloat(usddr) + "   往账RMB:" + returnfloat(rmbcr) + "   往账USD:" + returnfloat(usdcr) +"";
this.TtlSel.setTitle(rmblb);
},
onFitClick: function () {
var sql = this.getCondition();
var fitsql = this.getFitInvCondition();
var fitpaysql = this.getFitPayCondition();
//var PS_INVDATEBGN=this.formFit.getForm().findField('PS_INVDATEBGN').getRawValue();
//var PS_INVDATEEND = this.formFit.getForm().findField('PS_INVDATEEND').getRawValue();
Ext.Ajax.request({
waitMsg: Zi.LAN.Msg_Adding,
url: '/Account/Chfee_bankdata/AddAutoBankDataDetail',
params: {
condition: sql,
fitcondition: fitsql,
payfitcondition: fitpaysql
},
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.storeList.reload();
_thisFitIndex.winFitShow.close();
}
} else {
Ext.MessageBox.alert('错误', response.responseText);
}
},
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 bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.ISFIT=='true') {
Ext.Msg.show({ title: '提示', msg: '已匹配发票,无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
bodyAddDatas.push(rec);
}
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Account/Chfee_bankdata/DeleteList',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.reload();
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
DelBankDataDetail: 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 bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.ISFIT) {
bodyAddDatas.push(rec);
} else {
Ext.Msg.show({ title: '提示', msg: '未匹配发票,无法取消!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.MessageBox.confirm('提示', '确定取消匹配吗?', function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: '正在处理数据...',
url: '/Account/Chfee_bankdata/DelBankDataDetail',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.reload();
this.storeFitInvList.removeAll();
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
onRefreshInvClick: function (button, event) {
saveQuerySetting(this.formname, this.InvformSearch, true, true);
var sql = this.getInvCondition();
this.invsqlcontext = sql;
this.PageSize = this.InvPagenum.getValue();
this.storeInvList.pageSize = this.PageSize;
this.storeInvList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function (button, event) {
var sql = this.invsqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeInvList.pageSize = this.PageSize;
this.storeInvList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAutoPIPEIClick: function () {
this.winFitShow.show();
},
onPIPEIClick: function () {
var selections = this.GridCheckBoxModel.selected.items;
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg:'请选择要匹配的银行流水', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要更新的业务!
return;
}
var billno = selections[0].data.GID;
var selectedRecords = this.InvGridCheckBoxModel.selected.items;
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要匹配的发票信息', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: Zi.LAN.Msg_Adding,
url: '/Account/Chfee_bankdata/AddBankDataDetail',
params: {
billno: billno,
data: jsonbodyAddDatas
},
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.storeList.reload();
this.storeInvList.reload();
}
} else {
Ext.MessageBox.alert('错误', response.responseText);
}
},
scope: this
});
},
onImportBillClick: function (type) {
var BSNO = "";
me = this;
var url = '/Account/Chfee_bankdata/ImpExcel';
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 20,
frame: true,
autoScroll: false,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'DsLoadExcel',
name: 'DsLoadExcel',
emptyText: '请选择EXCEL文件', //'请选择EXCEL文件',
fieldLabel: 'EXCEL', //'EXCEL',
buttonText: '选择文件', //'选择文件',
allowBlank: false,
width: 200,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传', //'上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('DsLoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.xls|.xlsx|.csv/i)) {
Ext.Msg.show({ title: '错误', msg: '请选择正确的EXCEL文件', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请确认你上传的文件为EXCEL文件!'
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: url,
waitMsg: '正在操作数据...',
method: 'POST',
params: {
bsno: BSNO
},
success: function (form, action) {
win.close(this);
_this.storeList.reload();
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.Message);
}
});
}
}, {
text: '关闭', //'关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传EXCEL", //"上传EXCEL",
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var PCNo = form.findField('PCNo').getValue();
sql = sql + getAndConSql(sql, PCNo, "PCNO=" + PCNo);
var custName = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, custName, " ((TRANSTYPE='来账' AND DRAWEE_NAME like '%" + custName + "%') OR (TRANSTYPE='往账' AND PAYEE_NAME like '%" + custName + "%')) ");
var TRANSNO = form.findField('TRANSNO').getValue();
sql = sql + getAndConSql(sql, TRANSNO, "TRANSNO like '%" + TRANSNO + "%'");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "TRANSDATE >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "TRANSDATE <='" + expDateEnd + " 23:59:59'");
var ISFIT = form.findField('ISFIT').getValue();
if (ISFIT == '已匹配')
sql = sql + getAndConSql(sql, ISFIT, "ISFIT=1");
else if (ISFIT == '未匹配')
sql = sql + getAndConSql(sql, ISFIT, "ISNULL(ISFIT,0)=0");
var TRANSTYPE = form.findField('TRANSTYPE').getValue();
sql = sql + getAndConSql(sql, TRANSTYPE, "TRANSTYPE='" + TRANSTYPE+"'");
var ACCOUNT = form.findField('ACCOUNT').getValue();
sql = sql + getAndConSql(sql, ACCOUNT, " ((TRANSTYPE='来账' and PAYEE_ACCOUNT like '%" + ACCOUNT + "%') or (TRANSTYPE='往账' and DRAWEE_ACCOUNT like '%" + ACCOUNT + "%')) ");
return sql;
},
getInvCondition: function () {
var form = this.InvformSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
sql = " CM.BILLNO NOT IN (SELECT BILLNO FROM ch_fee_bankdata_fitdetail) ";
var CustNo = form.findField('BsNo').getValue();
// sql = sql + getAndConSql(sql, customNo, "BILLNO like '%" + customNo + "%'");
sql = sql + getAndConSql(sql, CustNo, "EXISTS (SELECT 1 FROM CH_FEE_DO d left join v_op_bill b on (b.BSNO=D.BSNO) WHERE D.BILLNO=CM.BILLNO AND b.CUSTNO+b.MBLNO+B.HBLNO+B.ORDERNO like '%" + CustNo + "%' )");
var invoiceNo = form.findField('InvNo').getValue();
sql = sql + getAndConSql(sql, invoiceNo, " INVOICENO like '%" + invoiceNo + "%' ");
var custName = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, custName, " INVOICECUSTNAME like '%" + custName + "%' ");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "INVOICEMAKETIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "INVOICEMAKETIME <='" + expDateEnd + " 23:59:59'");
var TRANSTYPE = form.findField('TRANSTYPE').getValue();
sql = sql + getAndConSql(sql, TRANSTYPE, " TRANSTYPE= '" + TRANSTYPE + "' ");
return sql;
},
getFitInvCondition: function () {
var form = this.formFit.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
sql = " CM.BILLNO NOT IN (SELECT BILLNO FROM ch_fee_bankdata_fitdetail) ";
var expDateBgn = form.findField('PS_INVDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "INVOICEMAKETIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('PS_INVDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "INVOICEMAKETIME <='" + expDateEnd + " 23:59:59'");
return sql;
},
getFitPayCondition: function () {
var form = this.formFit.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
sql = " CM.BILLNO NOT IN (SELECT BILLNO FROM ch_fee_bankdata_fitdetail) ";
var expDateBgn = form.findField('PS_PAYDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "APPLYTIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('PS_PAYDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "APPLYTIME <='" + expDateEnd + " 23:59:59'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});