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/MvcShipping/Viewsjs/MsCtBankJournal/MsCtBankJournalIndex.js

1711 lines
68 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
//#region 获取 YYYY-mm-dd 格式的日期
function GetDateStr(sdate, AddDayCount) {
var dd = new Date(sdate); //获取选择的时期对象
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
sdate = dd.toISOString();
sdate = sdate.toString().substr(0, 10);
return sdate;
};
//#endregion
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
Shipping.MsCtBankJournalIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCtBankJournalIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCtBankJournalIndex, Ext.Panel, {
PageSize: 2000,
SelectedRecord: null,
sqlcontext: '',
sCondition: '',
isInitial: 0,
strCtSTARTGID: '',
strACCDATE: '',
strACCDAY: '',
strACCTODAY: '',
sqlcontext: '',
initUIComponents: function () {
this.formname = "formMsCtBankJournalIndex"; //页面名称
_this = this;
//#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,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'select': function (_Field, newValue, eOpts) {
if (_Field.value != null) {
var sGID = "";
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', _Field.value.toString());
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
sGID = AccitemsRaw.GID.toString();
}
if (sGID != "") {
this.storeCwAccitemsCurrency.load({
params: { condition: "LINKGID = '" + sGID + "'" },
callback: function (options, success, response) {
var combo = Ext.getCmp("FCYNO");
combo.setValue(options[0].data.CURRENCY.toString()); //选中
},
scope: this
});
}
}
}
}
});
//币别选项
this.storeCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsCurrencyList' }
});
//this.storeCwAccitemsCurrency.load({ params: { condition: ""} });
this.comboxCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.storeCwAccitemsCurrency,
forceSelection: true, //输入值是否严格为待选列表中存在的值
id: 'FCYNO',
name: 'FCYNO',
valueField: 'CURRENCY',
displayField: 'CURRENCY',
allowBlank: false
});
//借贷方向
Ext.define('DCModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataDC = [{ "Name": "借" }, { "Name": "贷" }, { "Name": ""}];
var storeDC = Ext.create('Ext.data.Store', { model: 'DCModel', data: dataDC });
this.comboxDC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '方向',
forceSelection: true,
store: storeDC,
id: 'DC',
name: 'DC',
valueField: 'Name',
displayField: 'Name'
//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'
//allowBlank: false,
});
//时间范围
Ext.define('TimeFrameModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataTimeFrame = [{ "Name": "按期间" }, { "Name": "按日期" }, { "Name": "按未达天数"}];
var storeTimeFrame = Ext.create('Ext.data.Store', { model: 'TimeFrameModel', data: dataTimeFrame });
this.comboxTimeFrame = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '时间范围',
forceSelection: true,
store: storeTimeFrame,
id: 'TimeFrame',
name: 'TimeFrame',
valueField: 'Name',
displayField: 'Name',
value: '按期间',
allowBlank: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'select': function (_Field, newValue, eOpts) {
if (_Field.value == "按期间") {
Ext.getCmp('ACCDATEbgn').show();
Ext.getCmp('ACCDATEend').show();
Ext.getCmp('VOUDATEbgn').hide();
Ext.getCmp('VOUDATEend').hide();
Ext.getCmp('DaysOf').hide();
}
else if (_Field.value == "按日期") {
Ext.getCmp('ACCDATEbgn').hide();
Ext.getCmp('ACCDATEend').hide();
Ext.getCmp('VOUDATEbgn').show();
Ext.getCmp('VOUDATEend').show();
Ext.getCmp('DaysOf').hide();
}
else if (_Field.value == "按未达天数") {
Ext.getCmp('ACCDATEbgn').hide();
Ext.getCmp('ACCDATEend').hide();
Ext.getCmp('VOUDATEbgn').hide();
Ext.getCmp('VOUDATEend').show();
Ext.getCmp('DaysOf').show();
}
},
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//结算方式
this.StoreStlMode = Ext.create('DsExt.ux.RefTableStore', {
model: 'STLMODE',
proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' }
});
this.StoreStlMode.load({ params: { condition: ""} });
this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算方式',
store: this.StoreStlMode,
forceSelection: true,
id: 'SETTLETYPE',
name: 'SETTLETYPE',
valueField: 'STLCODE',
displayField: 'STLNAME'
});
//经手人信息加载
this.storeENTERED = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeENTERED.load();
this.comboxENTERED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '经手人',
store: this.storeENTERED,
forceSelection: true,
id: 'ENTERED',
name: 'ENTERED',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//制单人信息加载
this.storeCREATEUSER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeCREATEUSER.load();
this.comboxCREATEUSER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storeCREATEUSER,
forceSelection: true,
id: 'CREATEUSERNAME',
name: 'CREATEUSERNAME',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//键值维护表_凭证字
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='凭证字'"} });
this.comboxVKNO = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '凭证字',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
name: 'VKNO',
width: 100,
labelAlign: 'right',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE',
value: '记',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
//allowBlank: false,
});
//#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: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxACCNAME, this.comboxCwAccitemsCurrency, this.comboxDC, this.comboxCHECKING, {
id: 'EXPLAN',
name: 'EXPLAN',
fieldLabel: '摘要',
labelAlign: 'right',
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: [this.comboxENTERED, this.comboxCREATEUSER, this.comboxTimeFrame, {
fieldLabel: '会计期间',
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: 'VOUDATEbgn',
name: 'VOUDATEbgn',
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: 'VOUDATEend',
name: 'VOUDATEend',
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: 'DaysOf',
name: 'DaysOf',
xtype: 'numberfield',
allowBlank: false, //是否允许为空
enableKeyEvents: true, //激活键盘事件
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: false, //允许输入小数
hideTrigger: true, //是否隐藏上下调节按钮
nanText: '请输入有效数值',
minValue: 0,
value: 0,
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxStlMode, {
id: 'BILLNObgn',
name: 'BILLNObgn',
fieldLabel: '结算号',
labelAlign: 'right',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
id: 'BILLNOend',
name: 'BILLNOend',
fieldLabel: '至',
labelAlign: 'right',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
id: 'BLCbgn',
name: 'BLCbgn',
fieldLabel: '金额',
labelAlign: 'right',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
id: 'BLCend',
name: 'BLCend',
fieldLabel: '至',
labelAlign: 'right',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}]
}]
}]
});
//#endregion formSearch
//#region 定义数据集
//列表加载
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCtBankJournalModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCtBankJournal/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
//,autoLoad: true //自动加载
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',//每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
//#region 列定义
//Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 });
//this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ISCHECKING',
header: '对账',
width: 35
},
{
sortable: true,
dataIndex: 'VOUDATE',
//renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
header: '凭证日期',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var sEXPLAN = record.data.EXPLAN.toString()
if (sEXPLAN == "本日合计" || sEXPLAN == "本期合计" || sEXPLAN == "合计" || sEXPLAN == "(期初余额)") {
value = "";
}
else {
value = GetDateStr(value, 1);
}
return value;
}
},
{
sortable: true,
dataIndex: 'SVOUDATE',
//renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
header: '结算日期',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var sEXPLAN = record.data.EXPLAN.toString()
if (sEXPLAN == "本日合计" || sEXPLAN == "本期合计" || sEXPLAN == "合计" || sEXPLAN == "(期初余额)") {
value = "";
}
else {
value = GetDateStr(value, 1);
}
return value;
}
},
{
sortable: true,
dataIndex: 'ITEMNO',
header: '当日序号',
align: 'center',
width: 60,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var sEXPLAN = record.data.EXPLAN.toString()
if (sEXPLAN == "本日合计" || sEXPLAN == "本期合计" || sEXPLAN == "合计" || sEXPLAN == "(期初余额)") {
value = "";
}
return value;
}
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'EXPLAN',
header: '摘要',
width: 200
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'FENTRYID',
header: '分录号',
align: 'center',
width: 50,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var sEXPLAN = record.data.EXPLAN.toString()
if (sEXPLAN == "本日合计" || sEXPLAN == "本期合计" || sEXPLAN == "合计" || sEXPLAN == "(期初余额)") {
value = "";
}
return value;
}
},
{
sortable: true,
dataIndex: 'SETTLETYPENAME',
header: '结算方式',
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算号',
width: 80
},
{
sortable: true,
dataIndex: 'DR',
header: '借方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var sEXPLAN = record.data.EXPLAN.toString()
if (sEXPLAN == "(期初余额)") {
value = "";
}
else {
value = usMoney(value, 2, '', true);
}
return value;
}
},
{
sortable: true,
dataIndex: 'CR',
header: '贷方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
var sEXPLAN = record.data.EXPLAN.toString()
if (sEXPLAN == "(期初余额)") {
value = "";
}
else {
value = usMoney(value, 2, '', true);
}
return value;
}
},
{
sortable: true,
dataIndex: 'DC',
header: '方向',
align: 'center',
width: 35
},
{
sortable: true,
dataIndex: 'BLC',
header: '余额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'ENTERED',
header: '经手人',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'CREATEUSERNAME',
header: '制单人',
align: 'center',
width: 60
}];
//#endregion
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//#region gridList列表显示信息
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
columns: this.girdcolums,
//selModel: this.GridCheckBoxModel,
columnLines: true, //是否显示列分割线,默认为false
iconCls: 'icon-grid',
renderTo: Ext.getBody(),
selModel: this.GridCheckBoxModel,
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var iType = 1;
var sEXPLAN = record.get('EXPLAN');
if (sEXPLAN == "本日合计" || sEXPLAN == "本期合计" || sEXPLAN == "合计" || sEXPLAN == "(期初余额)") {
iType = 2;
//record.set('VOUDATE', '');
}
return Shipping.FeeGetRowClass(iType);
}
}, bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg:'当前显示条数据', //当前显示条数据
emptyMsg:'没有数据'//没有数据
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
//this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
//this.gridList.reconfigure(this.storeList, this.girdcolums);
//this.gridList.columns[1] = new Ext.grid.RowNumberer();
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
var sEXPLAN = record.get('EXPLAN');
if (sEXPLAN == "本日合计" || sEXPLAN == "本期合计" || sEXPLAN == "合计" || sEXPLAN == "(期初余额)") {
return;
}
var sISCHECKING = record.get('ISCHECKING');
if (sISCHECKING == "**" || sISCHECKING == "*") {
return;
}
//判断是否轧账
Ext.Ajax.request({
waitMsg: '正在判断数据...',
url: '/MvcShipping/MsCtCarryOver/onIsCARRY',
async: false,
params: {
gid: record.get('GID'),
voudate: '',
tablename: 'ct_bank_journal'
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.sCondition = this.getCondition2();
this.SelectedRecord = record;
DsOpenEditWin('/MvcShipping/MsCtBankJournal/Edit', "银行日记账", "700", "1220", "10", "10");
}
else {
if (jsonresult.Message.toString() != "") {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
}
},
scope: this
});
}, this);
//#endregion
//#region 按钮工具条/页面布局
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "查询",
id: "btnRefresh",
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.sCondition = this.getCondition2();
this.isInitial = 0;
DsOpenEditWin('/MvcShipping/MsCtBankJournal/Edit', "银行日记账", "700", "1220", "10", "10");
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
xtype: 'button',
width: 90,
text: "导入凭证",
iconCls: "btnmore",
handler: function (button, event) {
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = "formMsCwVouchersGlIndex"; //this.formname;
winAccess.condition = "ACCID in (select ACCID from cw_accitems_gl where ISBANK=1 and DETAILED=1)"; //
winAccess.show();
return;
},
scope: this
}
, {
text: "导出",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 130,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
//#endregion
//#region 页面加载
this.InitData();
//
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
this.sqlcontext = sql;
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: this.isInitial
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
//var data = result.data;
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("ACCDATEbgn").setValue(this.strACCDATE);
Ext.getCmp("ACCDATEend").setValue(this.strACCDATE);
Ext.getCmp("VOUDATEbgn").setValue(this.strACCDATE + "-01");
Ext.getCmp("VOUDATEend").setValue(this.strACCDAY);
//
Ext.getCmp('ACCDATEbgn').show();
Ext.getCmp('ACCDATEend').show();
Ext.getCmp('VOUDATEbgn').hide();
Ext.getCmp('VOUDATEend').hide();
Ext.getCmp('DaysOf').hide();
//
this.onRefreshClick();
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, //end InitData
//#endregion
//#region 查询/刷新
onRefreshClick: function () {
var sql = this.getCondition();
var sql3 = this.getCondition3();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, condition3: sql3 }, 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, sACCID, "ACCGID in (select GID FROM cw_accitems_gl WHERE ACCID='" + sACCID.trim() + "')");
//}
}
}
//币别
var sFCYNO = this.formSearch.getForm().findField('FCYNO').getValue();
if (sFCYNO != null) {
if (sFCYNO != "") {
sql = sql + getAndConSql(sql, sFCYNO, "FCYNO='" + sFCYNO.toString().trim() + "'");
}
}
//方向
var sDC = this.formSearch.getForm().findField('DC').getValue();
if (sDC != null) {
if (sDC != "") {
if (sDC == "借") {
sql = sql + getAndConSql(sql, sDC, "DR<>0");
}
else {
sql = sql + getAndConSql(sql, sDC, "CR<>0");
}
}
}
//是否对账
var sCHECKING = this.formSearch.getForm().findField('CHECKING').getValue();
if (sCHECKING != null) {
if (sCHECKING == "已达") {
sql = sql + getAndConSql(sql, sCHECKING, "(CHECKINGGID<>'' and CHECKINGGID is not null)");
}
if (sCHECKING == "未达") {
sql = sql + getAndConSql(sql, sCHECKING, "(CHECKINGGID='' or CHECKINGGID is null)");
}
}
//摘要
var sEXPLAN = this.formSearch.getForm().findField('EXPLAN').getValue();
if (sEXPLAN != null) {
if (sEXPLAN != "") {
sql = sql + getAndConSql(sql, sEXPLAN, "EXPLAN like '%" + sEXPLAN.toString().trim() + "%'");
}
}
//经手人
var sENTERED = this.formSearch.getForm().findField('ENTERED').getValue();
if (sENTERED != null) {
if (sENTERED != "") {
sql = sql + getAndConSql(sql, sENTERED, "ENTERED='" + sENTERED.toString().trim() + "'");
}
}
//制单人
var sMODIFIEDUSER = this.formSearch.getForm().findField('CREATEUSERNAME').getValue();
if (sMODIFIEDUSER != null) {
if (sMODIFIEDUSER != "") {
sql = sql + getAndConSql(sql, sMODIFIEDUSER, "MODIFIEDUSER=(select top 1 gid from [user] where SHOWNAME='" + sMODIFIEDUSER.toString().trim() + "')");
}
}
//时间范围
var sTimeFrame = this.formSearch.getForm().findField('TimeFrame').getValue();
if (sTimeFrame != null) {
if (sTimeFrame == "") {
sql = sql + getAndConSql(sql, sTimeFrame, "MODIFIEDUSER=(select top 1 gid from [user] where SHOWNAME='" + sMODIFIEDUSER.toString().trim() + "')");
}
if (sTimeFrame == "按期间") {
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() + "'");
}
}
}
else if (sTimeFrame == "按日期") {
var VOUDATEbgn = this.formSearch.getForm().findField('VOUDATEbgn').getRawValue();
if (VOUDATEbgn != null) {
if (VOUDATEbgn != "") {
sql = sql + getAndConSql(sql, VOUDATEbgn, "VOUDATE >='" + VOUDATEbgn.toString().trim() + "'");
}
}
var VOUDATEend = this.formSearch.getForm().findField('VOUDATEend').getRawValue();
if (VOUDATEend != null) {
if (VOUDATEend != "") {
sql = sql + getAndConSql(sql, VOUDATEend, "VOUDATE <='" + VOUDATEend.toString().trim() + "'");
}
}
}
else if (sTimeFrame == "按未达天数") {
var sDaysOf = this.formSearch.getForm().findField('DaysOf').getRawValue();
var VOUDATEend = this.formSearch.getForm().findField('VOUDATEend').getRawValue();
if (VOUDATEend != null) {
if (VOUDATEend != "") {
sql = sql + getAndConSql(sql, VOUDATEend, "VOUDATE <=convert(varchar(10),DateAdd(dd,(-" + sDaysOf + "),'" + VOUDATEend.toString().trim() + "'),120)");
}
}
}
}
//结算方式
var sSETTLETYPE = this.formSearch.getForm().findField('SETTLETYPE').getValue();
if (sSETTLETYPE != null) {
if (sSETTLETYPE != "") {
sql = sql + getAndConSql(sql, sSETTLETYPE, "SETTLETYPE='" + sSETTLETYPE.toString().trim() + "'");
}
}
//结算单号
var BILLNObgn = this.formSearch.getForm().findField('BILLNObgn').getValue();
if (BILLNObgn != null) {
if (BILLNObgn != "") {
sql = sql + getAndConSql(sql, BILLNObgn, "BILLNO >='" + BILLNObgn.toString().trim() + "'");
}
}
var BILLNOend = this.formSearch.getForm().findField('BILLNOend').getValue();
if (BILLNOend != null) {
if (BILLNOend != "") {
sql = sql + getAndConSql(sql, BILLNOend, "BILLNO <='" + BILLNOend.toString().trim() + "'");
}
}
//金额
var BLCbgn = this.formSearch.getForm().findField('BLCbgn').getValue();
var BLCend = this.formSearch.getForm().findField('BLCend').getValue();
if (BLCbgn != null && BLCend != null) {
if (BLCbgn != "" && BLCend != "") {
sql = sql + getAndConSql(sql, BLCbgn, "((DR >='" + BLCbgn.toString().trim() + "' and DR <='" + BLCend.toString().trim() + "') OR (CR >='" + BLCbgn.toString().trim() + "' and CR <='" + BLCend.toString().trim() + "'))");
}
else {
if (BLCbgn != "") {
sql = sql + getAndConSql(sql, BLCbgn, "(DR >='" + BLCbgn.toString().trim() + "' OR CR >='" + BLCbgn.toString().trim() + "')");
}
if (BLCend != "") {
sql = sql + getAndConSql(sql, BLCend, "(DR <='" + BLCend.toString().trim() + "' OR CR <='" + BLCend.toString().trim() + "')");
}
}
}
else {
if (BLCbgn != null) {
if (BLCbgn != "") {
sql = sql + getAndConSql(sql, BLCbgn, "(DR >='" + BLCbgn.toString().trim() + "' OR CR >='" + BLCbgn.toString().trim() + "')");
}
}
if (BLCend != null) {
if (BLCend != "") {
sql = sql + getAndConSql(sql, BLCend, "(DR <='" + BLCend.toString().trim() + "' OR CR <='" + BLCend.toString().trim() + "')");
}
}
}
return sql;
},
getCondition3: 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, "LINKGID='" + sGID.trim() + "'");
}
}
}
//币别
var sFCYNO = this.formSearch.getForm().findField('FCYNO').getValue();
if (sFCYNO != null) {
if (sFCYNO != "") {
sql = sql + getAndConSql(sql, sFCYNO, "CURRENCY='" + sFCYNO.toString().trim() + "'");
}
}
//时间范围
var sTimeFrame = this.formSearch.getForm().findField('TimeFrame').getValue();
if (sTimeFrame != null) {
if (sTimeFrame == "") {
sql = sql + getAndConSql(sql, sTimeFrame, "MODIFIEDUSER=(select top 1 gid from [user] where SHOWNAME='" + sMODIFIEDUSER.toString().trim() + "')");
}
if (sTimeFrame == "按期间") {
var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue();
if (ACCDATEbgn != null) {
if (ACCDATEbgn != "") {
sql = sql + getAndConSql(sql, ACCDATEbgn, "([YEAR]+'-'+[MONTH]) >='" + ACCDATEbgn.toString().trim() + "'");
}
}
var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue();
if (ACCDATEend != null) {
if (ACCDATEend != "") {
sql = sql + getAndConSql(sql, ACCDATEend, "([YEAR]+'-'+[MONTH]) <='" + ACCDATEend.toString().trim() + "'");
}
}
}
else if (sTimeFrame == "按日期") {
var VOUDATEbgn = this.formSearch.getForm().findField('VOUDATEbgn').getRawValue();
if (VOUDATEbgn != null) {
if (VOUDATEbgn != "") {
sql = sql + getAndConSql(sql, VOUDATEbgn, "([YEAR]+'-'+[MONTH]+'-'+[DAY]) >='" + VOUDATEbgn.toString().trim() + "'");
}
}
var VOUDATEend = this.formSearch.getForm().findField('VOUDATEend').getRawValue();
if (VOUDATEend != null) {
if (VOUDATEend != "") {
sql = sql + getAndConSql(sql, VOUDATEend, "([YEAR]+'-'+[MONTH]+'-'+[DAY]) <='" + VOUDATEend.toString().trim() + "'");
}
}
}
else if (sTimeFrame == "按未达天数") {
var sDaysOf = this.formSearch.getForm().findField('DaysOf').getRawValue();
var VOUDATEend = this.formSearch.getForm().findField('VOUDATEend').getRawValue();
if (VOUDATEend != null) {
if (VOUDATEend != "") {
sql = sql + getAndConSql(sql, VOUDATEend, "([YEAR]+'-'+[MONTH]+'-'+[DAY]) <=convert(varchar(10),DateAdd(dd,(-" + sDaysOf + "),'" + VOUDATEend.toString().trim() + "'),120)");
}
}
}
}
return sql;
},
getCondition2: 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 sFCYNO = this.formSearch.getForm().findField('FCYNO').getValue();
if (sFCYNO != null) {
if (sFCYNO != "") {
sql = sql + getAndConSql(sql, sFCYNO, "FCYNO='" + sFCYNO.toString().trim() + "'");
}
}
//时间范围
var sTimeFrame = this.formSearch.getForm().findField('TimeFrame').getValue();
if (sTimeFrame != null) {
if (sTimeFrame == "") {
sql = sql + getAndConSql(sql, sTimeFrame, "MODIFIEDUSER=(select top 1 gid from [user] where SHOWNAME='" + sMODIFIEDUSER.toString().trim() + "')");
}
if (sTimeFrame == "按期间") {
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() + "'");
}
}
}
else if (sTimeFrame == "按日期") {
var VOUDATEbgn = this.formSearch.getForm().findField('VOUDATEbgn').getRawValue();
if (VOUDATEbgn != null) {
if (VOUDATEbgn != "") {
sql = sql + getAndConSql(sql, VOUDATEbgn, "VOUDATE >='" + VOUDATEbgn.toString().trim() + "'");
}
}
var VOUDATEend = this.formSearch.getForm().findField('VOUDATEend').getRawValue();
if (VOUDATEend != null) {
if (VOUDATEend != "") {
sql = sql + getAndConSql(sql, VOUDATEend, "VOUDATE <='" + VOUDATEend.toString().trim() + "'");
}
}
}
else if (sTimeFrame == "按未达天数") {
var sDaysOf = this.formSearch.getForm().findField('DaysOf').getRawValue();
var VOUDATEend = this.formSearch.getForm().findField('VOUDATEend').getRawValue();
if (VOUDATEend != null) {
if (VOUDATEend != "") {
sql = sql + getAndConSql(sql, VOUDATEend, "VOUDATE <=convert(varchar(10),DateAdd(dd,(-" + sDaysOf + "),'" + VOUDATEend.toString().trim() + "'),120)");
}
}
}
}
//未达账
sql += " and (CHECKINGGID='' or CHECKINGGID is null)";
return sql;
//是否期初
sql += " and ISINITIAL=0";
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
this.InitData();
},
//#endregion
//#region 删除
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
var sError = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
if (i == 0) {
gids = record.get('GID');
}
else {
gids += "," + record.get('GID');
}
}
//
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsCtBankJournal/Delete',
params: {
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 + sError, 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
//#region 导入回调函数
onDsQuery: function () {
var sql = this.sqlcontext;
var sGID = "";
//
Ext.Msg.wait('正在筛选数据...');
Ext.Ajax.request({
waitMsg: '正在筛选数据...',
async: false,
url: '/MvcShipping/MsCtBankJournal/isImportExcelGID',
params: {
condition: sql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
if (jsonresult.Message == "") {
Ext.Msg.show({ title: '提示', msg: "没有符合条件的数据!(注意:引入的数据,只允许引入当前期间数据!)", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
else {
var sTYPE = "";
if (jsonresult.Message != "true") {
Ext.MessageBox.confirm('提示', jsonresult.Message, function (btn) {
if (btn == 'yes') {
sTYPE = "UPDATE";
Ext.Msg.wait('正在筛选数据...');
Ext.Ajax.request({
waitMsg: '正在筛选数据...',
async: false,
url: '/MvcShipping/MsCtBankJournal/onImportExcelData',
params: {
condition: sql,
sTYPE: sTYPE
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.onRefreshClick();
if (jsonresult.Message == "") {
Ext.Msg.show({ title: '提示', msg: "没有符合条件的数据!(注意:引入的数据,只允许引入当前期间数据!)", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
else {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
timeout: 60000000, //30秒
scope: this
});
}
else {
sTYPE = "INSERT";
Ext.Msg.wait('正在筛选数据...');
Ext.Ajax.request({
waitMsg: '正在筛选数据...',
async: false,
url: '/MvcShipping/MsCtBankJournal/onImportExcelData',
params: {
condition: sql,
sTYPE: sTYPE
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.onRefreshClick();
if (jsonresult.Message == "") {
Ext.Msg.show({ title: '提示', msg: "没有符合条件的数据!(注意:引入的数据,只允许引入当前期间数据!)", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
else {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
timeout: 60000000, //30秒
scope: this
});
}
}, this);
}
else {
Ext.Msg.wait('正在筛选数据...');
Ext.Ajax.request({
waitMsg: '正在筛选数据...',
async: false,
url: '/MvcShipping/MsCtBankJournal/onImportExcelData',
params: {
condition: sql,
sTYPE: sTYPE
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.onRefreshClick();
if (jsonresult.Message == "") {
Ext.Msg.show({ title: '提示', msg: "没有符合条件的数据!(注意:引入的数据,只允许引入当前期间数据!)", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
else {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
timeout: 60000000, //30秒
scope: this
});
}
//
}
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
scope: this
});
},
//#region 第二种,因速度问题,暂时放弃修改
onDsQuery2: function () {
var sql = this.sqlcontext;
var sGID = "";
//
Ext.Msg.wait('正在筛选数据...');
Ext.Ajax.request({
waitMsg: '正在筛选数据...',
async: false,
url: '/MvcShipping/MsCtBankJournal/onImportExcelData',
params: {
condition: sql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.onRefreshClick();
if (jsonresult.Message == "") {
Ext.Msg.show({ title: '提示', msg: "没有符合条件的数据!(注意:引入的数据,只允许引入当前期间数据!)", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
else {
sGID = jsonresult.Message.toString();
}
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
scope: this
});
if (sGID != "") {
var ArgList = new Array();
if (sGID.indexOf(",") >= 0) {
ArgList = sGID.split(",");
} else {
ArgList.push(sGID);
}
var inum = ArgList[0].toString();
if (ArgList.length <= 1) {
Ext.Msg.show({ title: '提示', msg: "共引入了" + inum + "条日记账资料(只引入当前期间的数据)!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick();
}
else {
this.onMessageBox(ArgList, inum, 0);
return;
}
}
},
//#endregion
//#region 层_显示信息
onMessageBox: function (ArgList, inum, ino) {
Ext.Msg.wait('正在筛选数据...');
for (var i = 1; i < ArgList.length; i++) {
var ArgGID = new Array();
ArgGID = ArgList[i].toString().split("。");
Ext.MessageBox.confirm('提示', ArgGID[1].toString(), function (btn) {
if (btn == 'yes') {
var sTYPE = "UPDATE";
ino++;
Ext.Msg.wait('正在导入数据...');
Ext.Ajax.request({
waitMsg: '正在导入数据...',
async: false, //同步请求数据
url: '/MvcShipping/MsCtBankJournal/onImportExcelGID2',
params: {
gids: ArgGID[0].toString(),
sTYPE: sTYPE,
sCtGID: ArgGID[2].toString()
},
callback: function (options, success, response) {
if (success) {
if (i == (ArgList.length - 1)) {
Ext.Msg.show({ title: '提示', msg: "共引入了" + inum + "条,更新了" + ino + "条日记账资料(注意:引入的数据,只允许引入当前期间数据!)!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick();
}
ArgList.splice(i, 1);
this.onMessageBox(ArgList, inum, ino);
}
},
scope: this
});
}
else {
if (i == (ArgList.length - 1)) {
Ext.Msg.show({ title: '提示', msg: "共引入了" + inum + "条,更新了" + ino + "条日记账资料(注意:引入的数据,只允许引入当前期间数据!)!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick();
}
ArgList.splice(i, 1);
this.onMessageBox(ArgList, inum, ino);
}
}, this);
return;
}
},
//#endregion
//#region 第一种因js同步异步问题暂时放弃修改
onDsQuery2: function () {
var sql = this.sqlcontext;
var sGID = "";
//
Ext.Msg.wait('正在筛选数据...');
Ext.Ajax.request({
waitMsg: '正在筛选数据...',
async: false,
url: '/MvcShipping/MsCtBankJournal/onImportExcelData',
params: {
condition: sql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.onRefreshClick();
if (jsonresult.Message == "") {
Ext.Msg.show({ title: '提示', msg: "没有符合条件的数据!(注意:引入的数据,只允许引入当前期间数据!)", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
else {
sGID = jsonresult.Message.toString();
}
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
scope: this
});
if (sGID != "") {
var ArgList = new Array();
if (sGID.indexOf(",") >= 0) {
ArgList = selectedVal.split(",");
} else {
ArgList.push(sGID);
}
var inum = 0;
var ino = 0;
for (var i = 0; i < ArgList.length; i++) {
var sError = "";
var blEnter = true;
var sTYPE = "INSERT";
var sCtGID = "";
Ext.Ajax.request({
waitMsg: '正在请求数据...',
async: false, //同步请求数据
url: '/MvcShipping/MsCtBankJournal/isImportExcelGID',
params: {
gids: ArgList[i].toString()
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
sCtGID = jsonresult.Message.toString();
}
else {
sError = jsonresult.Message;
blEnter = false;
//Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
//timeout: 3000000, //30秒
scope: this
});
//
if (sError != "") {
Ext.MessageBox.confirm('提示', sError, function (btn) {
if (btn == 'yes') {
blEnter = true;
var sTYPE = "UPDATE";
}
}, this);
}
//
if (blEnter) {
Ext.Msg.wait('正在导入数据...');
Ext.Ajax.request({
waitMsg: '正在导入数据...',
async: false, //同步请求数据
url: '/MvcShipping/MsCtBankJournal/onImportExcelGID2',
params: {
gids: ArgList[i].toString(),
sTYPE: sTYPE,
sCtGID: sCtGID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message + sError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
//Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
//timeout: 3000000, //30秒
scope: this
});
inum++;
}
else {
ino++;
continue;
}
}
//
Ext.Msg.show({ title: '提示', msg: "共引入了" + inum + "条日记账资料(只引入当前期间的数据)!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick();
}
},
//#endregion
//#endregion
//#region 导出Excel
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
//var strGIDs = "";
//var sql = escape(this.getCondition());
//var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
//var openType = "_blank";
//var openUrl = "../../Reports/RptExport.aspx?handle=MsCtBankJournalIndex&formname=" + this.formname + "&condition1=" + sql + "&gids=" + strGIDs;
//window.open(openUrl, openType, openSet);
},
//#endregion
//#region 获取 YYYY-mm-dd 格式的日期
// GetDateStr: function (sdate, AddDayCount) {
// var dd = new Date(sdate); //获取选择的时期对象
// dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
// sdate = dd.toISOString();
// sdate = sdate.toString().substr(0, 10);
// return sdate;
// },
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.storeList;
ret[1] = this.SelectedRecord;
ret[2] = this.sqlcontext;
ret[3] = this.sCondition;
ret[4] = this.isInitial;
ret[5] = Ext.getCmp('btnRefresh');
return ret;
}
});