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_bankdata/ChBankdataIndex.js

1847 lines
64 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.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,
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');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
selModel: this.GridCheckBoxModel,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
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: 'IMPORTDATE',
header: '导入日期',
width: 80
}, {
sortable: true,
dataIndex: 'IMPORTER',
header: '导入人',
width: 80
}, {
sortable: true,
dataIndex: 'ISFIT',
header: '是否匹配',
width: 40
}, {
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
}, {
sortable: true,
dataIndex: 'STLBILLNO',
header: '结算单号',
width: 100
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
//this.SelectedRecord = record;
//this.OprationStatus = 'edit';
//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.gridList.getSelectionModel().on('select', function (model, record, index) {
if (record.data.ISFIT) {
var bsno = record.data.GID;
var sql = "";
sql = " BILLNO IN (SELECT BILLNO FROM ch_fee_bankdata_fitdetail WHERE LINKGID='" + bsno + "') ";
isloadfee = false;
this.storeFitInvList.load({
params: { start: 0, limit: 1000, condition: sql },
callback: function (r, options, success) {
if (success) {
isloadfee = true;
}
}
});
} else {
this.storeFitInvList.removeAll();
}
}, this);
//#region formSearch
this.StoreISFIT = Ext.create('Ext.data.Store', {
fields: ['OpLb']
});
this.StoreISFIT.add({ "OpLb": "全部" });
this.StoreISFIT.add({ "OpLb": "已匹配" });
this.StoreISFIT.add({ "OpLb": "未匹配" });
this.comboxISFIT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否匹配',
store: this.StoreISFIT,
forceSelection: true,
value:'未匹配',
name: 'ISFIT',
valueField: 'OpLb',
displayField: 'OpLb',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreTRANSTYPE = Ext.create('Ext.data.Store', {
fields: ['OpLb']
});
this.StoreTRANSTYPE.add({ "OpLb": "全部" });
this.StoreTRANSTYPE.add({ "OpLb": "来账" });
this.StoreTRANSTYPE.add({ "OpLb": "往账" });
this.comboxTRANSTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '交易类型',
store: this.StoreTRANSTYPE,
forceSelection: true,
value: '',
name: 'TRANSTYPE',
valueField: 'OpLb',
displayField: 'OpLb',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
_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: [this.comboxTRANSTYPE, {
fieldLabel: '银行账号',
name: 'ACCOUNT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '批次号',
name: 'PCNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '流水号',
name: 'TRANSNO',
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',
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到导入日期',
format: 'Y-m-d',
xtype: 'datefield',
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: "取消匹配",
handler: function (button, event) {
this.DelBankDataDetail(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
//定义数据集
this.storeInvList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChInvoice',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_invoice/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.InvPagenum = 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.onRefreshInvClick();
}
}
}
});
this.initInvgirdcolums = [{
sortable: true,
dataIndex: 'INVOICETYPEREF',
header: '发票类别',
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUS',
header: '发票锁定',
width: 60,
renderer: function (value, meta, record) {
return record.data.BILLSTATUSREF;
}
}, {
sortable: true,
dataIndex: 'BILLNO',
header: '发票业务编号',
width: 120
}, {
sortable: true,
dataIndex: 'INVOICENO',
header: '发票号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '开票单位',
width: 120
}, {
sortable: true,
dataIndex: 'INVOICECUSTNAME',
header: '发票抬头',
width: 160
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 60
}, {
sortable: true,
dataIndex: 'INVAMOUNT',
header: '开票金额',
align: 'right',
width: 100,
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: 'AMOUNT',
header: '申请金额',
align: 'right',
width: 100,
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: 'ISNEEDPRINT',
header: '是否打印',
width: 60
}, {
sortable: true,
dataIndex: 'NOSTL',
header: '未结算',
width: 120
}, {
sortable: true,
dataIndex: 'RECVCURR',
header: '实收币别',
width: 60
}, {
sortable: true,
dataIndex: 'FEEAMOUNT',
header: '原币金额',
width: 120,
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: 'INVOICEMAKETIME',
header: '开票日期',
width: 100
}, {
sortable: true,
dataIndex: 'OPERATORNAME',
header: '开票人',
width: 100
}, {
sortable: true,
dataIndex: 'APPLICANT',
header: '申请人',
width: 100
}, {
sortable: true,
dataIndex: 'APPLICANTDEPT',
header: '所属部门',
width: 100
}, {
sortable: true,
dataIndex: 'SALECORP',
header: '所属分部',
width: 100
}, {
sortable: true,
dataIndex: 'INVOICECATEGORYREF',
header: '发票类别',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '开票税率',
width: 80
}, {
sortable: true,
dataIndex: 'TAX',
header: '税额',
width: 80
}, {
sortable: true,
dataIndex: 'NOTAXAMOUNT',
header: '不含税金额',
width: 80,
renderer: function (value, meta, record) {
var notaxamount = (parseFloat(record.data.INVAMOUNT).add(parseFloat(-record.data.TAX))).toFixed(2)
try {
var lsValue = usMoney(notaxamount, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return lsValue;
}
}
catch (e) {
return notaxamount;
}
return notaxamount;
}
}, {
sortable: true,
dataIndex: 'ISDELETE',
header: '是否作废',
width: 80
}, {
sortable: true,
dataIndex: 'DZSTATUS',
header: '电子发票',
width: 80
}, {
sortable: true,
dataIndex: 'DELOPERATORNAME',
header: '作废人',
width: 100
}, {
sortable: true,
dataIndex: 'DELETETIME',
header: '作废时间',
width: 100
}, {
sortable: true,
dataIndex: 'INVSHENNO',
header: '发票申请单号',
width: 100
}, {
sortable: true,
dataIndex: 'VOUCHERNO',
header: '接口凭证',
width: 0
}, {
sortable: true,
dataIndex: 'VOUNO',
header: '总账凭证',
width: 0
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
header: '录入人',
width: 100
}
];
this.Invgirdcolums = this.initInvgirdcolums;
this.InvGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.InvgridList = new Ext.grid.GridPanel({
store: this.storeInvList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.InvGridCheckBoxModel,
viewConfig: {
enableTextSelection: true,
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var ISDELETE = record.get('ISDELETE');
if (ISDELETE == 'True')
return 'feestatus_Del';
if (record.get('PTORRED') == "2")
return 'text_red';
if (record.get('SETRED') == "1" || record.get('SETRED') == "True")
return 'text_blue';
var BILLSTATUSREF = record.get('BILLSTATUSREF');
if (BILLSTATUSREF == '已锁定') return 'feestatus_settle';
}
},
columns: this.Invgirdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeInvList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.InvPagenum]
});
this.InvgridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (record.data.INVOICETYPE == 2)
DsOpenEditWin('/Account/Chfee_invoice/AppEdit', record.data.BILLNO);
else
DsOpenEditWin('/Account/Chfee_invoice/BLEdit', record.data.BILLNO);
}, this);
this.Invgirdcolums = DsTruck.GetGridPanel(USERID, this.formname+'Inv', this.Invgirdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.Invgirdcolums.unshift(new Ext.grid.RowNumberer());
this.InvgridList.reconfigure(this.storeInvList, this.Invgirdcolums);
this.InvgridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch
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,
labelWidth: 60,
// forceSelection: true,
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshInvClick();
}
}
}
});
this.InvformSearch = Ext.widget('form', {
frame: true,
region: 'north',
height:40,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 50,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'BsNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshInvClick();
}
}
}
}, {
fieldLabel: '发票号',
name: 'InvNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshInvClick();
}
}
}
}, {
fieldLabel: '发票抬头',
name: 'CustName',
labelWidth: 60,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshInvClick();
}
}
}
}
, {
fieldLabel: '从开票日期',
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 65,
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshInvClick();
}
}
}
}, {
fieldLabel: '到开票日期',
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 65,
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshInvClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshInvClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getInvCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeInvList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "手动匹配",
handler: function (button, event) {
this.onPIPEIClick(button, event);
},
scope: this
}
//, '-',
//{
// text: "手动匹配",
// xtype: 'button',
// width: 90,
// iconCls: "btnrefresh",
// handler: function (button, event) {
// this.onPIPEIClick();
// },
// scope: this
//}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.paneladd = new Ext.Panel({
title: '发票列表',
layout: "border",
region: 'south',
height: 320,
split: true,
items: [
this.InvformSearch, this.InvgridList
]
});
//#endregion formSearch
this.storeFitInvList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChInvoice',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_invoice/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initFitInvgirdcolums = [{
sortable: true,
dataIndex: 'INVOICENO',
header: '发票号',
width: 120
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 60
}, {
sortable: true,
dataIndex: 'INVAMOUNT',
header: '开票金额',
align: 'right',
width: 100,
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: 'CUSTOMERNAME',
header: '开票单位',
width: 120
}, {
sortable: true,
dataIndex: 'BILLNO',
header: '发票业务编号',
width: 120
}, {
sortable: true,
dataIndex: 'INVOICECUSTNAME',
header: '发票抬头',
width: 160
}, {
sortable: true,
dataIndex: 'INVOICETYPEREF',
header: '发票类别',
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUS',
header: '发票锁定',
width: 60,
renderer: function (value, meta, record) {
return record.data.BILLSTATUSREF;
}
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '申请金额',
align: 'right',
width: 100,
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: 'ISNEEDPRINT',
header: '是否打印',
width: 60
}, {
sortable: true,
dataIndex: 'NOSTL',
header: '未结算',
width: 120
}, {
sortable: true,
dataIndex: 'RECVCURR',
header: '实收币别',
width: 60
}, {
sortable: true,
dataIndex: 'FEEAMOUNT',
header: '原币金额',
width: 120,
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: 'INVOICEMAKETIME',
header: '开票日期',
width: 100
}, {
sortable: true,
dataIndex: 'OPERATORNAME',
header: '开票人',
width: 100
}, {
sortable: true,
dataIndex: 'APPLICANT',
header: '申请人',
width: 100
}, {
sortable: true,
dataIndex: 'APPLICANTDEPT',
header: '所属部门',
width: 100
}, {
sortable: true,
dataIndex: 'SALECORP',
header: '所属分部',
width: 100
}, {
sortable: true,
dataIndex: 'INVOICECATEGORYREF',
header: '发票类别',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '开票税率',
width: 80
}, {
sortable: true,
dataIndex: 'TAX',
header: '税额',
width: 80
}, {
sortable: true,
dataIndex: 'NOTAXAMOUNT',
header: '不含税金额',
width: 80,
renderer: function (value, meta, record) {
var notaxamount = (parseFloat(record.data.INVAMOUNT).add(parseFloat(-record.data.TAX))).toFixed(2)
try {
var lsValue = usMoney(notaxamount, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return lsValue;
}
}
catch (e) {
return notaxamount;
}
return notaxamount;
}
}, {
sortable: true,
dataIndex: 'ISDELETE',
header: '是否作废',
width: 80
}, {
sortable: true,
dataIndex: 'DZSTATUS',
header: '电子发票',
width: 80
}, {
sortable: true,
dataIndex: 'DELOPERATORNAME',
header: '作废人',
width: 100
}, {
sortable: true,
dataIndex: 'DELETETIME',
header: '作废时间',
width: 100
}, {
sortable: true,
dataIndex: 'INVSHENNO',
header: '发票申请单号',
width: 100
}, {
sortable: true,
dataIndex: 'VOUCHERNO',
header: '接口凭证',
width: 0
}, {
sortable: true,
dataIndex: 'VOUNO',
header: '总账凭证',
width: 0
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
header: '录入人',
width: 100
}
];
this.FitInvgirdcolums = this.initFitInvgirdcolums;
this.FitInvGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.FitInvgridList = new Ext.grid.GridPanel({
store: this.storeFitInvList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.FitInvGridCheckBoxModel,
viewConfig: {
enableTextSelection: true,
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var ISDELETE = record.get('ISDELETE');
if (ISDELETE == 'True')
return 'feestatus_Del';
if (record.get('PTORRED') == "2")
return 'text_red';
if (record.get('SETRED') == "1" || record.get('SETRED') == "True")
return 'text_blue';
var BILLSTATUSREF = record.get('BILLSTATUSREF');
if (BILLSTATUSREF == '已锁定') return 'feestatus_settle';
}
},
columns: this.FitInvgirdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeFitInvList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})]
});
this.FitInvgridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
}, this);
this.FitInvgirdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'FitInv', this.FitInvgirdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.FitInvgirdcolums.unshift(new Ext.grid.RowNumberer());
this.FitInvgridList.reconfigure(this.storeFitInvList, this.FitInvgirdcolums);
this.FitInvgridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
this.panelFit = new Ext.Panel({
title: '匹配发票信息',
layout: "border",
split: true,
region: 'east',
width: 320,
items: [
this.FitInvgridList
]
});
this.panelcenter = new Ext.Panel({
layout: "border",
region: 'center',
items: [
this.gridList, this.panelFit
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelcenter, this.paneladd]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, 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.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
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();
this.storeInvList.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, "IMPORTDATE >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "IMPORTDATE <='" + 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");
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 + "' ");
var ACCOUNT = form.findField('ACCOUNT').getValue();
sql = sql + getAndConSql(sql, ACCOUNT, " ACCOUNT like '%" + ACCOUNT + "%' ");
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;
}
});