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/ChBankdataStlIndex.js

883 lines
30 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.MsChBankdataStlIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChBankdataStlIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChBankdataStlIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.invsqlcontext = '';
this.formname = "MsChBankdataStlIndex"; //页面名称
//定义数据集
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
}
],
// 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.StoreISSTL = Ext.create('Ext.data.Store', {
fields: ['OpLb']
});
this.StoreISSTL.add({ "OpLb": "全部" });
this.StoreISSTL.add({ "OpLb": "已结算" });
this.StoreISSTL.add({ "OpLb": "未结算" });
this.comboxISSTL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否结算',
store: this.StoreISSTL,
forceSelection: true,
value: '未结算',
name: 'ISSTL',
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: [ {
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.comboxISSTL,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导入",
handler: function (button, event) {
this.onCreateStlClick();
},
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
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
//定义数据集
//#region formSearch
//#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: 'south',
height: 320,
items: [
this.FitInvgridList
]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList,this.panelFit]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
_this = this;
}, //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
});
},
onCreateStlClick: 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];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.MessageBox.confirm('提示', '确定要生成结算吗?', function (btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: '正在生成数据...',
url: '/Account/Chfee_bankdata/BankDataStl',
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
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
});
},
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, "DRAWEE_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");
var ISSTL = form.findField('ISSTL').getValue();
if (ISSTL == '已结算')
sql = sql + getAndConSql(sql, ISSTL, "ISSTL=1");
else if (ISSTL == '未结算')
sql = sql + getAndConSql(sql, ISSTL, "ISNULL(ISSTL,0)=0");
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;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});