|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
|
|
|
|
|
|
Shipping.MsCtBankCheckingIndex = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsCtBankCheckingIndex.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsCtBankCheckingIndex, Ext.Panel, {
|
|
|
PageSize: 2000,
|
|
|
strCtSTARTGID: '',
|
|
|
strACCDATE: '',
|
|
|
strACCDAY: '',
|
|
|
strACCTODAY: '',
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.formname = "formMsCtBankCheckingIndex"; //页面名称
|
|
|
|
|
|
|
|
|
//#region formSearch 下拉框信息加载
|
|
|
//银行存款科目加载
|
|
|
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CwAccitemsGlModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
|
|
|
});
|
|
|
this.storeCwAccitems.load({ params: { condition: "DETAILED=1 and ISENABLE=1 and ISBANK=1"} });
|
|
|
this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '银行科目',
|
|
|
store: this.storeCwAccitems,
|
|
|
forceSelection: true, //输入值是否严格为待选列表中存在的值
|
|
|
id: 'ACCNAME',
|
|
|
name: 'ACCNAME',
|
|
|
valueField: 'ACCID',
|
|
|
displayField: 'ACCIDNAME',
|
|
|
allowBlank: false
|
|
|
});
|
|
|
|
|
|
//是否对账
|
|
|
Ext.define('CHECKINGModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
|
|
|
var dataCHECKING = [{ "Name": "" }, { "Name": "未达" }, { "Name": "已达"}];
|
|
|
var storeCHECKING = Ext.create('Ext.data.Store', { model: 'CHECKINGModel', data: dataCHECKING });
|
|
|
this.comboxCHECKING = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '是否对账',
|
|
|
forceSelection: true,
|
|
|
store: storeCHECKING,
|
|
|
name: 'CHECKING',
|
|
|
valueField: 'Name',
|
|
|
displayField: 'Name',
|
|
|
value: '未达',
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (combo.value.toString() == "已达") {
|
|
|
Ext.getCmp("VOUDATE").setValue("");
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp("VOUDATE").setValue(this.strACCTODAY);
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region formSearch 查询面板
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 60,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxACCNAME, this.comboxCHECKING, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, {
|
|
|
fieldLabel: '当前对账日期',
|
|
|
labelWidth: 80,
|
|
|
id: 'VOUDATE',
|
|
|
name: 'VOUDATE',
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
//allowBlank: false, //是否允许为空
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '会计期间(日记账)',
|
|
|
labelWidth: 100,
|
|
|
xtype: 'monthfield',
|
|
|
editable: false,
|
|
|
// allowBlank: false, //是否允许为空
|
|
|
id: 'ACCDATEbgn',
|
|
|
name: 'ACCDATEbgn',
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '至',
|
|
|
xtype: 'monthfield',
|
|
|
editable: false,
|
|
|
// allowBlank: false, //是否允许为空
|
|
|
id: 'ACCDATEend',
|
|
|
name: 'ACCDATEend',
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '结算日期(对账单)',
|
|
|
id: 'VOUbgn',
|
|
|
name: 'VOUbgn',
|
|
|
labelWidth:100,
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
// allowBlank: false, //是否允许为空
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '截止日期',
|
|
|
id: 'VOUend',
|
|
|
name: 'VOUend',
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
// allowBlank: false, //是否允许为空
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
xtype: "label", id: "HeJiDR", text: "日记账 选中借方:", width: 100
|
|
|
}, {
|
|
|
xtype: "label", id: "HeJi_DR", text: "", width: 120
|
|
|
}, {
|
|
|
xtype: "label", id: "HeJiCR", text: "选中贷方:", width: 60
|
|
|
}, {
|
|
|
xtype: "label", id: "HeJi_CR", text: "", width: 200
|
|
|
}, {
|
|
|
xtype: "label", id: "HeJiDR_2", text: "银行对账单 选中借方:", width: 130
|
|
|
}, {
|
|
|
xtype: "label", id: "HeJi_DR_2", text: "", width: 120
|
|
|
}, {
|
|
|
xtype: "label", id: "HeJiCR_2", text: "选中贷方:", width: 60
|
|
|
}, {
|
|
|
xtype: "label", id: "HeJi_CR_2", text: "", width: 150
|
|
|
}]
|
|
|
}]
|
|
|
}]
|
|
|
});
|
|
|
//#endregion formSearch
|
|
|
|
|
|
//#region 银行日记账
|
|
|
//#region 定义数据集
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'MsCtBankJournalModel',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsCtBankChecking/GetDataList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
//,autoLoad: true //自动加载
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 列定义
|
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.girdcolums = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: '', //唯一编码
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISCHECKING',
|
|
|
header: '对账',
|
|
|
align: 'center',
|
|
|
width: 35
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'SVOUDATE',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
align: 'center',
|
|
|
header: '结算日期',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VKNO',
|
|
|
header: '凭证字',
|
|
|
align: 'center',
|
|
|
width: 50
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOUNO',
|
|
|
header: '凭证号',
|
|
|
align: 'center',
|
|
|
width: 50
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'SETTLETYPENAME',
|
|
|
header: '结算方式',
|
|
|
align: 'center',
|
|
|
width: 60
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BILLNO',
|
|
|
header: '结算号',
|
|
|
align: 'center',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FCYNO',
|
|
|
header: '币别',
|
|
|
align: 'center',
|
|
|
width: 40
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'DR',
|
|
|
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: 'CR',
|
|
|
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: 'VOUDATE_C',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
align: 'center',
|
|
|
header: '对账日期',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOUDATE',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
align: 'center',
|
|
|
header: '凭证日期',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'EXPLAN',
|
|
|
header: '摘要',
|
|
|
width: 300
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CHECKINGGID',
|
|
|
header: '对账GID',
|
|
|
align: 'center',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}];
|
|
|
//#endregion
|
|
|
|
|
|
//#region gridList列表显示信息
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
title: '银行日记账',
|
|
|
store: this.storeList,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
columns: this.girdcolums,
|
|
|
selModel: this.GridCheckBoxModel,
|
|
|
// columnLines: true, //是否显示列分割线,默认为false
|
|
|
iconCls: 'icon-grid',
|
|
|
renderTo: Ext.getBody(),
|
|
|
// paging bar on the bottom
|
|
|
bbar: [Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
})]
|
|
|
});
|
|
|
//#endregion
|
|
|
//#endregion
|
|
|
|
|
|
//#region 银行日记账
|
|
|
//#region 定义数据集
|
|
|
this.storeListStatement = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'MsCtBankStatementModel',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsCtBankChecking/GetDataListStatement',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
//,autoLoad: true //自动加载
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 列定义
|
|
|
this.GridCheckBoxModelStatement = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.girdcolumsStatement = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: '', //唯一编码
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISCHECKING',
|
|
|
header: '对账',
|
|
|
align: 'center',
|
|
|
width: 35
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOUDATE',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
align: 'center',
|
|
|
header: '结算日期',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ACCNAME',
|
|
|
align: 'center',
|
|
|
header: '银行',
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'SETTLETYPENAME',
|
|
|
header: '结算方式',
|
|
|
align: 'center',
|
|
|
width: 60
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BILLNO',
|
|
|
header: '结算号',
|
|
|
align: 'center',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FCYNO',
|
|
|
header: '币别',
|
|
|
align: 'center',
|
|
|
width: 40
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'DR',
|
|
|
header: '银行借方',
|
|
|
align: 'right',
|
|
|
width: 100,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CR',
|
|
|
header: '银行贷方',
|
|
|
align: 'right',
|
|
|
width: 100,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOUDATE_C',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
align: 'center',
|
|
|
header: '对账日期',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CHECKINGGID',
|
|
|
header: '对账GID',
|
|
|
align: 'center',
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
}];
|
|
|
//#endregion
|
|
|
|
|
|
//#region gridListStatement列表显示信息
|
|
|
this.gridListStatement = new Ext.grid.GridPanel({
|
|
|
title: '银行对账单',
|
|
|
store: this.storeListStatement,
|
|
|
region: 'south',
|
|
|
height: 300,
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
columns: this.girdcolumsStatement,
|
|
|
selModel: this.GridCheckBoxModelStatement,
|
|
|
columnLines: true, //是否显示列分割线,默认为false
|
|
|
iconCls: 'icon-grid',
|
|
|
renderTo: Ext.getBody(),
|
|
|
// paging bar on the bottom
|
|
|
bbar: [Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeListStatement,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
})]
|
|
|
});
|
|
|
//#endregion
|
|
|
//#endregion
|
|
|
_this = this;
|
|
|
//#region 按钮工具条/页面布局
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [{
|
|
|
text: "查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "重置条件",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
this.onClearSql(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "自动对账",
|
|
|
iconCls: "btnadd",
|
|
|
handler: function (button, event) {
|
|
|
this.onAutoClick(false);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "手工对账",
|
|
|
iconCls: "btnadd",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "取消对账",
|
|
|
iconCls: "btndelete",
|
|
|
handler: function (button, event) {
|
|
|
this.onDeleteClick(false);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "EXCEL导出", //"保存列表样式",
|
|
|
iconCls: "btnexportexcel",
|
|
|
menu: [
|
|
|
{
|
|
|
text: "银行日记账", //"保存",
|
|
|
handler: function (button, event) {
|
|
|
_this.onExportClick();
|
|
|
}
|
|
|
}, {
|
|
|
text: "银行对账单", //"初始化",
|
|
|
handler: function (menu, event) {
|
|
|
_this.onExport2Click();
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
scope: this
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 135,
|
|
|
items: [this.panelBtn, this.formSearch]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.gridList, this.gridListStatement]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 页面加载
|
|
|
this.gridList.getSelectionModel().on('select', function (_this, record, index, eOpts) {
|
|
|
// this.onSelectFee(1);
|
|
|
var sCHECKING = this.formSearch.getForm().findField('CHECKING').getValue();
|
|
|
if (sCHECKING != null) {
|
|
|
if (sCHECKING != "未达") {
|
|
|
var sCHECKINGGID = record.data.CHECKINGGID.toString();
|
|
|
this.onSelectCls(sCHECKINGGID);
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
this.gridListStatement.getSelectionModel().on('select', function (_this, record, index, eOpts) {
|
|
|
// this.onSelectFee(2);
|
|
|
var sCHECKING = this.formSearch.getForm().findField('CHECKING').getValue();
|
|
|
if (sCHECKING != null) {
|
|
|
if (sCHECKING != "未达") {
|
|
|
var sCHECKINGGID = record.data.CHECKINGGID.toString();
|
|
|
this.onSelectCls(sCHECKINGGID);
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.gridList.on({
|
|
|
selectionchange: function (sm, selections) {
|
|
|
var sumDR = 0;
|
|
|
var sumCR = 0;
|
|
|
if (selections.length == 0) {
|
|
|
Ext.getCmp("HeJi_DR").setText(sumDR);
|
|
|
Ext.getCmp("HeJi_CR").setText(sumCR);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
var rec = selections[i];
|
|
|
sumDR = sumDR + rec.get("DR");
|
|
|
sumCR = sumCR + rec.get("CR");
|
|
|
}
|
|
|
|
|
|
sumDR = usMoney(sumDR, 2, '', false);
|
|
|
sumCR = usMoney(sumCR, 2, '', false);
|
|
|
Ext.getCmp("HeJi_DR").setText(sumDR);
|
|
|
Ext.getCmp("HeJi_CR").setText(sumCR);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.gridListStatement.on({
|
|
|
selectionchange: function (sm, selections) {
|
|
|
var sumDR = 0;
|
|
|
var sumCR = 0;
|
|
|
if (selections.length == 0) {
|
|
|
Ext.getCmp("HeJi_DR_2").setText(sumDR);
|
|
|
Ext.getCmp("HeJi_CR_2").setText(sumCR);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
var rec = selections[i];
|
|
|
sumDR = sumDR + rec.get("DR");
|
|
|
sumCR = sumCR + rec.get("CR");
|
|
|
}
|
|
|
|
|
|
sumDR = usMoney(sumDR, 2, '', false);
|
|
|
sumCR = usMoney(sumCR, 2, '', false);
|
|
|
Ext.getCmp("HeJi_DR_2").setText(sumDR);
|
|
|
Ext.getCmp("HeJi_CR_2").setText(sumCR);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
this.storeList.on('beforeload', function (store) {
|
|
|
var sql = this.getCondition();
|
|
|
if (sql.toString() != "") {
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
this.storeListStatement.on('beforeload', function (store) {
|
|
|
var sql = this.getCondition();
|
|
|
if (sql.toString() != "") {
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 加载事件
|
|
|
InitData: function () {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询...',
|
|
|
url: '/MvcShipping/MsCtBankJournal/GetInitData',
|
|
|
params: {
|
|
|
isInitial: 0
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
return;
|
|
|
}
|
|
|
var strArg = result.data.toString().split(",");
|
|
|
this.strCtSTARTGID = strArg[0].toString();
|
|
|
this.strACCDATE = strArg[1].toString();
|
|
|
this.strACCDAY = strArg[2].toString();
|
|
|
this.strACCTODAY = strArg[3].toString();
|
|
|
Ext.getCmp("VOUDATE").setValue(this.strACCTODAY);
|
|
|
//
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 查询/重置条件
|
|
|
onRefreshClick: function () {
|
|
|
var sql = this.getCondition();
|
|
|
var sqlstat = sql;
|
|
|
var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue();
|
|
|
if (ACCDATEbgn != null) {
|
|
|
if (ACCDATEbgn != "") {
|
|
|
sql = sql + getAndConSql(sql, ACCDATEbgn, "ACCDATE >='" + ACCDATEbgn.toString().trim() + "'");
|
|
|
}
|
|
|
}
|
|
|
var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue();
|
|
|
if (ACCDATEend != null) {
|
|
|
if (ACCDATEend != "") {
|
|
|
sql = sql + getAndConSql(sql, ACCDATEend, "ACCDATE <='" + ACCDATEend.toString().trim() + "'");
|
|
|
}
|
|
|
}
|
|
|
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在刷新数据...", scope: this });
|
|
|
|
|
|
|
|
|
var VOUDATEbgn = this.formSearch.getForm().findField('VOUbgn').getRawValue();
|
|
|
if (VOUDATEbgn != null) {
|
|
|
if (VOUDATEbgn != "") {
|
|
|
sqlstat = sqlstat + getAndConSql(sqlstat, VOUDATEbgn, "convert(varchar,VOUDATE,23)>='" + VOUDATEbgn.toString().trim() + "'");
|
|
|
}
|
|
|
}
|
|
|
var VOUDATEend = this.formSearch.getForm().findField('VOUend').getRawValue();
|
|
|
if (VOUDATEend != null) {
|
|
|
if (VOUDATEend != "") {
|
|
|
sqlstat = sqlstat + getAndConSql(sqlstat, VOUDATEend, "convert(varchar,VOUDATE,23)<='" + VOUDATEend.toString().trim() + "'");
|
|
|
}
|
|
|
}
|
|
|
this.storeListStatement.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sqlstat }, waitMsg: "正在刷新数据...", scope: this });
|
|
|
},
|
|
|
|
|
|
getCondition: function () {
|
|
|
if (!this.formSearch.getForm().isValid()) {
|
|
|
return "1<0";
|
|
|
}
|
|
|
|
|
|
var sql = '';
|
|
|
//银行科目
|
|
|
var sACCID = this.formSearch.getForm().findField('ACCNAME').getValue();
|
|
|
if (sACCID != null) {
|
|
|
if (sACCID != "") {
|
|
|
var sGID = "";
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', sACCID);
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
sGID = AccitemsRaw.GID.toString();
|
|
|
}
|
|
|
if (sGID != "") {
|
|
|
sql = sql + getAndConSql(sql, sGID, "ACCGID='" + sGID.trim() + "'");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//是否对账
|
|
|
var sCHECKING = this.formSearch.getForm().findField('CHECKING').getValue();
|
|
|
if (sCHECKING != null) {
|
|
|
if (sCHECKING == "未达") {
|
|
|
sql = sql + getAndConSql(sql, sCHECKING, "(CHECKINGGID='' or CHECKINGGID is null)");
|
|
|
}
|
|
|
else if (sCHECKING == "已达") {
|
|
|
sql = sql + getAndConSql(sql, sCHECKING, "(CHECKINGGID<>'' and CHECKINGGID is not null)");
|
|
|
|
|
|
//对账日期
|
|
|
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
|
|
|
if (sVOUDATE != null) {
|
|
|
if (sVOUDATE != "") {
|
|
|
sql = sql + getAndConSql(sql, sVOUDATE, "CHECKINGGID in (select GID from [ct_bank_checking] where STARTGID='" + this.strCtSTARTGID + "' and VOUDATE ='" + sVOUDATE.toString().trim() + "')");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
|
|
|
onExportClick: function (button, event) {
|
|
|
GridExportExcelPage(this.gridList);
|
|
|
},
|
|
|
|
|
|
onExport2Click: function (button, event) {
|
|
|
GridExportExcelPage(this.gridListStatement);
|
|
|
},
|
|
|
|
|
|
onClearSql: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
form.reset();
|
|
|
this.InitData();
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 点击列表合计金额
|
|
|
onSelectFee: function (iType) {
|
|
|
var selectedRecords = this.gridList.selModel.getSelection();
|
|
|
if (iType == 2) {
|
|
|
selectedRecords = this.gridListStatement.selModel.getSelection();
|
|
|
}
|
|
|
var sumDR = 0;
|
|
|
var sumCR = 0;
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
sumDR = sumDR + rec.get("DR");
|
|
|
sumCR = sumCR + rec.get("CR");
|
|
|
}
|
|
|
sumDR = usMoney(sumDR, 2, '', false);
|
|
|
sumCR = usMoney(sumCR, 2, '', false);
|
|
|
if (iType == 1) {
|
|
|
Ext.getCmp("HeJi_DR").setText(sumDR);
|
|
|
Ext.getCmp("HeJi_CR").setText(sumCR);
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp("HeJi_DR_2").setText(sumDR);
|
|
|
Ext.getCmp("HeJi_CR_2").setText(sumCR);
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 点击改变行颜色
|
|
|
onSelectCls: function (sCHECKINGGID) {
|
|
|
//x-grid-row-alt//x-grid-view//altRowCls//removeRowCls
|
|
|
var gView = this.gridList.getView();
|
|
|
for (var i = 0; i < gView.store.data.length; i++) {
|
|
|
var strCHECKINGGID = gView.store.data.items[i].data.CHECKINGGID.toString();
|
|
|
if (sCHECKINGGID == strCHECKINGGID && sCHECKINGGID != "") {
|
|
|
gView.addRowCls(i, 'feestatus_refer'); //grid.getView().addRowCls(行号, 'css类名')
|
|
|
}
|
|
|
else {
|
|
|
gView.removeRowCls(i, 'feestatus_refer'); //grid.getView().addRowCls(行号, 'css类名')
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
var gViewStatement = this.gridListStatement.getView();
|
|
|
for (var i = 0; i < gViewStatement.store.data.length; i++) {
|
|
|
var strCHECKINGGID = gViewStatement.store.data.items[i].data.CHECKINGGID.toString();
|
|
|
if (sCHECKINGGID == strCHECKINGGID && sCHECKINGGID != "") {
|
|
|
gViewStatement.addRowCls(i, 'feestatus_refer'); //grid.getView().addRowCls(行号, 'css类名')
|
|
|
}
|
|
|
else {
|
|
|
gViewStatement.removeRowCls(i, 'feestatus_refer'); //grid.getView().addRowCls(行号, 'css类名')
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 取消对账
|
|
|
onDeleteClick: function (win) {
|
|
|
if (!this.formSearch.getForm().isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
|
|
|
if (!win) {
|
|
|
//#region 编辑formDiv 基本信息
|
|
|
var formDiv = Ext.widget('form', {
|
|
|
id: 'delForm',
|
|
|
//title: '对账条件',
|
|
|
border: false,
|
|
|
bodyPadding: 10,
|
|
|
fieldDefaults: {
|
|
|
flex: 1,
|
|
|
labelAlign: 'right',
|
|
|
labelWidth: 110,
|
|
|
labelStyle: 'font-weight:bold'
|
|
|
},
|
|
|
items: [{
|
|
|
fieldLabel: '取消日期范围内的',
|
|
|
id: 'cbVOUDATE',
|
|
|
name: 'cbVOUDATE',
|
|
|
xtype: 'checkbox',
|
|
|
//style:'direction:rtl',//这样就可以让输入框的光标定位在右边
|
|
|
checked: false,
|
|
|
listeners: {
|
|
|
render: function (obj) {
|
|
|
var font = document.createElement("cbVOUDATE");
|
|
|
font.setAttribute("color", "black");
|
|
|
var redStar = document.createTextNode('(注:如果不选,则操作已经选择的及其对应的数据!)');
|
|
|
font.appendChild(redStar);
|
|
|
obj.el.dom.parentNode.appendChild(font);
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '取消日期',
|
|
|
id: 'VOUDATEbgn',
|
|
|
name: 'VOUDATEbgn',
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
value: this.strACCTODAY
|
|
|
}, {
|
|
|
fieldLabel: '至',
|
|
|
id: 'VOUDATEend',
|
|
|
name: 'VOUDATEend',
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
value: this.strACCTODAY
|
|
|
}],
|
|
|
buttons: [{
|
|
|
text: '返回',
|
|
|
handler: function () {
|
|
|
this.up('form').getForm().reset();
|
|
|
this.up('window').close();
|
|
|
}
|
|
|
}, {
|
|
|
text: '取消对账',
|
|
|
handler: function (options, success, response) {
|
|
|
var form = Ext.getCmp("delForm").getForm();
|
|
|
if (!form.isValid()) {
|
|
|
//Ext.Msg.show({ title: '错误', msg: "不允许为空!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
var sACCGID = "";
|
|
|
var comboxList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', Ext.getCmp('ACCNAME').getValue());
|
|
|
if (comboxList.length > 0) {
|
|
|
var comboxRaw = comboxList.getAt(0).raw;
|
|
|
sACCGID = comboxRaw.GID.toString();
|
|
|
}
|
|
|
//
|
|
|
var gidS = "";
|
|
|
var gidJ = "";
|
|
|
var sql = "";
|
|
|
var sCbVOUDATE = Ext.getCmp('cbVOUDATE').getValue() ? 1 : 0;
|
|
|
if (sCbVOUDATE == 0) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection();
|
|
|
var selections2 = this.gridListStatement.getSelectionModel().getSelection();
|
|
|
if (selections.length == 0 && selections2.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择要操作的单据!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
//this.up('form').getForm().reset();
|
|
|
form.reset();
|
|
|
//this.up('window').close();
|
|
|
win.close();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
var record = selections[i];
|
|
|
if (i == 0) {
|
|
|
//gidJ = record.get('GID');
|
|
|
gidJ = record.get('CHECKINGGID');
|
|
|
}
|
|
|
else {
|
|
|
//gidJ += "," + record.get('GID');
|
|
|
gidJ += "," + record.get('CHECKINGGID');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (var i = 0; i < selections2.length; i++) {
|
|
|
var record2 = selections2[i];
|
|
|
if (i == 0) {
|
|
|
//gidS = record2.get('GID');
|
|
|
gidS = record2.get('CHECKINGGID');
|
|
|
}
|
|
|
else {
|
|
|
//gidS += "," + record2.get('GID');
|
|
|
gidS += "," + record2.get('CHECKINGGID');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
var VOUDATEbgn = Ext.getCmp('VOUDATEbgn').getRawValue();
|
|
|
if (VOUDATEbgn != null) {
|
|
|
if (VOUDATEbgn != "") {
|
|
|
sql = sql + getAndConSql(sql, VOUDATEbgn, "convert(varchar,VOUDATE,23)>='" + VOUDATEbgn.toString().trim() + "'");
|
|
|
}
|
|
|
}
|
|
|
var VOUDATEend = Ext.getCmp('VOUDATEend').getRawValue();
|
|
|
if (VOUDATEend != null) {
|
|
|
if (VOUDATEend != "") {
|
|
|
sql = sql + getAndConSql(sql, VOUDATEend, "convert(varchar,VOUDATE,23)<='" + VOUDATEend.toString().trim() + "'");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定取消对账吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait('正在操作数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在操作数据...',
|
|
|
url: '/MvcShipping/MsCtBankChecking/Delete',
|
|
|
params: {
|
|
|
gidJ: gidJ,
|
|
|
gidS: gidS,
|
|
|
sql: sql,
|
|
|
sCbVOUDATE: sCbVOUDATE,
|
|
|
sACCGID: sACCGID
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.onRefreshClick();
|
|
|
Ext.Msg.alert('Success', jsonresult.Message);
|
|
|
//this.up('form').getForm().reset();
|
|
|
form.reset();
|
|
|
//this.up('window').close();
|
|
|
win.close();
|
|
|
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, 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.WARNING, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) { },
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}, this);
|
|
|
},
|
|
|
scope: this
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
win = Ext.widget('window', {
|
|
|
title: '取消对账',
|
|
|
closeAction: 'destroy', //hide,
|
|
|
width: 310,
|
|
|
height: 200,
|
|
|
layout: 'fit',
|
|
|
resizable: true,
|
|
|
modal: true,
|
|
|
closable: false, //为false时tab上不显示叉号
|
|
|
resizable: false, //是否可改变列宽,默认为true
|
|
|
items: formDiv
|
|
|
//draggable: false,//不允许窗体被拖拽
|
|
|
//获取当前鼠标坐标并设置为其生产的初始位置
|
|
|
//x: 250,
|
|
|
//y: 150,
|
|
|
});
|
|
|
}
|
|
|
win.show();
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 手工对账
|
|
|
onAddClick: function (button, event) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection();
|
|
|
var selections2 = this.gridListStatement.getSelectionModel().getSelection();
|
|
|
if (selections.length == 0 && selections2.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择要操作的单据!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
//var sVOUDATE = Ext.getCmp('VOUDATE').getRawValue();
|
|
|
//对账日期
|
|
|
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
|
|
|
if (sVOUDATE == null) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '对账日期不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
|
if (sVOUDATE == "") {
|
|
|
Ext.Msg.show({ title: '提示', msg: '对账日期不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
var sACCGID = "";
|
|
|
var comboxList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', Ext.getCmp('ACCNAME').getValue());
|
|
|
if (comboxList.length > 0) {
|
|
|
var comboxRaw = comboxList.getAt(0).raw;
|
|
|
sACCGID = comboxRaw.GID.toString();
|
|
|
}
|
|
|
//
|
|
|
//借贷是否平衡的判断提示
|
|
|
var dHeJi_DR = Ext.getCmp("HeJi_DR").text;
|
|
|
var dHeJi_CR = Ext.getCmp("HeJi_CR").text;
|
|
|
var dHeJi_DR2 = Ext.getCmp("HeJi_DR_2").text;
|
|
|
var dHeJi_CR2 = Ext.getCmp("HeJi_CR_2").text;
|
|
|
var dCE = dHeJi_DR - dHeJi_CR;
|
|
|
var dCE2 = dHeJi_DR2 - dHeJi_CR2;
|
|
|
var dCE3 = dCE + dCE2;
|
|
|
var _this = this;
|
|
|
if (dCE3 != 0) {
|
|
|
var sError = "银行日记账借方合计:" + dHeJi_DR + "</br>银行日记账贷方合计:" + dHeJi_CR + "</br>银行日记账借方合计减贷方合计:" + dCE + "</br>银行对账单借方合计:" + dHeJi_DR2 + "</br>银行对账单贷方合计:" + dHeJi_CR2 + "</br>是否继续对账?";
|
|
|
Ext.MessageBox.confirm('提示', sError, function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
//#region 手工对账
|
|
|
var gidJ = "";
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
var record = selections[i];
|
|
|
if (i == 0) {
|
|
|
gidJ = record.get('GID');
|
|
|
}
|
|
|
else {
|
|
|
gidJ += "," + record.get('GID');
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
var gidS = "";
|
|
|
for (var i = 0; i < selections2.length; i++) {
|
|
|
var record2 = selections2[i];
|
|
|
if (i == 0) {
|
|
|
gidS = record2.get('GID');
|
|
|
}
|
|
|
else {
|
|
|
gidS += "," + record2.get('GID');
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
Ext.MessageBox.confirm('提示', '确定手工对账吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait('正在操作数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在操作数据...',
|
|
|
url: '/MvcShipping/MsCtBankChecking/onAddClick',
|
|
|
params: {
|
|
|
sACCGID: sACCGID,
|
|
|
sVOUDATE: sVOUDATE,
|
|
|
gidJ: gidJ,
|
|
|
gidS: gidS
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
//this.storeList.remove(record);
|
|
|
_this.onRefreshClick();
|
|
|
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, 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.WARNING, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) { },
|
|
|
scope: this
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
//#region 手工对账
|
|
|
var gidJ = "";
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
var record = selections[i];
|
|
|
if (i == 0) {
|
|
|
gidJ = record.get('GID');
|
|
|
}
|
|
|
else {
|
|
|
gidJ += "," + record.get('GID');
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
var gidS = "";
|
|
|
for (var i = 0; i < selections2.length; i++) {
|
|
|
var record2 = selections2[i];
|
|
|
if (i == 0) {
|
|
|
gidS = record2.get('GID');
|
|
|
}
|
|
|
else {
|
|
|
gidS += "," + record2.get('GID');
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
var sVOUDATE = Ext.getCmp('VOUDATE').getRawValue();
|
|
|
Ext.MessageBox.confirm('提示', '确定手工对账吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait('正在操作数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在操作数据...',
|
|
|
url: '/MvcShipping/MsCtBankChecking/onAddClick',
|
|
|
params: {
|
|
|
sACCGID: sACCGID,
|
|
|
sVOUDATE: sVOUDATE,
|
|
|
gidJ: gidJ,
|
|
|
gidS: gidS
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
//this.storeList.remove(record);
|
|
|
this.onRefreshClick();
|
|
|
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, 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.WARNING, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) { },
|
|
|
scope: this
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 自动对账
|
|
|
onAutoClick: function (win) {
|
|
|
if (!this.formSearch.getForm().isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
|
|
|
if (!win) {
|
|
|
//#region 编辑formDiv 基本信息
|
|
|
var formDiv = Ext.widget('form', {
|
|
|
id: 'importForm',
|
|
|
//title: '对账条件',
|
|
|
border: false,
|
|
|
bodyPadding: 10,
|
|
|
fieldDefaults: {
|
|
|
flex: 1,
|
|
|
labelAlign: 'right',
|
|
|
labelWidth: 120,
|
|
|
labelStyle: 'font-weight:bold'
|
|
|
},
|
|
|
items: [{
|
|
|
fieldLabel: '截止日期',
|
|
|
id: 'VOUDATEend2',
|
|
|
name: 'VOUDATEend2',
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
allowBlank: false,
|
|
|
value: this.strACCTODAY
|
|
|
}, {
|
|
|
fieldLabel: '日期 允许相差天数',
|
|
|
id: 'DaysOf',
|
|
|
name: 'DaysOf',
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false, //是否允许为空
|
|
|
selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
allowDecimals: false, //允许输入小数
|
|
|
hideTrigger: true, //是否隐藏上下调节按钮
|
|
|
nanText: '请输入有效数值',
|
|
|
minValue: 0,
|
|
|
value: 0
|
|
|
}, {
|
|
|
fieldLabel: '结算方式相同',
|
|
|
id: 'cbSETTLETYPE',
|
|
|
name: 'cbSETTLETYPE',
|
|
|
xtype: 'checkbox',
|
|
|
checked: false
|
|
|
}, {
|
|
|
fieldLabel: '结算号相同',
|
|
|
id: 'cbBILLNO',
|
|
|
name: 'cbBILLNO',
|
|
|
xtype: 'checkbox',
|
|
|
checked: false
|
|
|
}, {
|
|
|
fieldLabel: '结算日期相同',
|
|
|
id: 'cbVOUDATE',
|
|
|
name: 'cbVOUDATE',
|
|
|
xtype: 'checkbox',
|
|
|
checked: false
|
|
|
}],
|
|
|
buttons: [{
|
|
|
text: '取消',
|
|
|
handler: function () {
|
|
|
this.up('form').getForm().reset();
|
|
|
this.up('window').close();
|
|
|
}
|
|
|
}, {
|
|
|
text: '对账',
|
|
|
handler: function (options, success, response) {
|
|
|
var form = Ext.getCmp("importForm").getForm();
|
|
|
if (!form.isValid()) {
|
|
|
//Ext.Msg.show({ title: '错误', msg: "不允许为空!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
//var sVOUDATE = Ext.getCmp('VOUDATE').getRawValue();
|
|
|
//对账日期
|
|
|
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
|
|
|
if (sVOUDATE == null) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '对账日期不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
|
if (sVOUDATE == "") {
|
|
|
Ext.Msg.show({ title: '提示', msg: '对账日期不能为空!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
var sACCGID = "";
|
|
|
var comboxList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', Ext.getCmp('ACCNAME').getValue());
|
|
|
if (comboxList.length > 0) {
|
|
|
var comboxRaw = comboxList.getAt(0).raw;
|
|
|
sACCGID = comboxRaw.GID.toString();
|
|
|
}
|
|
|
var sVOUDATE = Ext.getCmp('VOUDATE').getRawValue();
|
|
|
var sVOUDATEend = Ext.getCmp('VOUDATEend2').getRawValue();
|
|
|
var sDaysOf = Ext.getCmp('DaysOf').getValue();
|
|
|
var sCbSETTLETYPE = Ext.getCmp('cbSETTLETYPE').getValue() ? 1 : 0;
|
|
|
var sCbBILLNO = Ext.getCmp('cbBILLNO').getValue() ? 1 : 0;
|
|
|
var sCbVOUDATE = Ext.getCmp('cbVOUDATE').getValue() ? 1 : 0;
|
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定自动对账吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait('正在操作数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在操作数据...',
|
|
|
url: '/MvcShipping/MsCtBankChecking/onAutoClick',
|
|
|
params: {
|
|
|
sACCGID: sACCGID,
|
|
|
sVOUDATE: sVOUDATE,
|
|
|
sVOUDATEend: sVOUDATEend,
|
|
|
sDaysOf: sDaysOf,
|
|
|
sCbSETTLETYPE: sCbSETTLETYPE,
|
|
|
sCbBILLNO: sCbBILLNO,
|
|
|
sCbVOUDATE: sCbVOUDATE
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.onRefreshClick();
|
|
|
Ext.Msg.alert('Success', jsonresult.Message);
|
|
|
//this.up('form').getForm().reset();
|
|
|
form.reset();
|
|
|
//this.up('window').close();
|
|
|
win.close();
|
|
|
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, 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.WARNING, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) { },
|
|
|
scope: this
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
},
|
|
|
scope: this
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
win = Ext.widget('window', {
|
|
|
title: '自动对账',
|
|
|
closeAction: 'destroy', //hide,
|
|
|
width: 310,
|
|
|
height: 240,
|
|
|
layout: 'fit',
|
|
|
resizable: true,
|
|
|
modal: true,
|
|
|
closable: false, //为false时tab上不显示叉号
|
|
|
resizable: false, //是否可改变列宽,默认为true
|
|
|
items: formDiv
|
|
|
//draggable: false,//不允许窗体被拖拽
|
|
|
//获取当前鼠标坐标并设置为其生产的初始位置
|
|
|
//x: 250,
|
|
|
//y: 150,
|
|
|
});
|
|
|
}
|
|
|
win.show();
|
|
|
}
|
|
|
//#endregion
|
|
|
});
|
|
|
|
|
|
|