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.

1176 lines
44 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');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
Shipping.MsCwVouchersIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwVouchersIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCwVouchersIndex, Ext.Panel, {
PageSize: 200,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formMsCwVouchersIndex"; //页面名称
this.selectGid = "";
//#region formSearch 下拉框信息加载
//键值维护表_凭证字
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',
flex: 0.5,
// width: 100,
labelAlign: 'right',
labelWidth: 50,
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
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();
}
}
}
});
//#region 明细列
//#region 定义数据集
//列表加载
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCwVVModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchers/GetDataCwVVList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
//,autoLoad: true //自动加载
});
//#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: 'VOUALLNO',
header: '', //凭证号
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
header: '凭证日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: false,
dataIndex: 'EXPLAN',
header: '摘要',
//align: 'center',
width: 200
},
{
sortable: false,
dataIndex: 'ACCALL',
header: '会计科目',
//align: 'center',
width: 200
},
{
sortable: true,
dataIndex: 'AMTDR',
header: '借方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
//return '<SPAN style="COLOR: red">' + value + '</SPAN>';
//return Ext.util.Format.number(value, '0,000.00');
//var fff = Ext.util.Format.number(value, '0,000.00') + ".00";
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'AMTCR',
header: '贷方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
//return Ext.util.Format.number(value, '0,000.00');
//var fff = Ext.util.Format.number(value, '0,000.00') + ".00";
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'PREPARED',
header: '制单人',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'ISEXPORT',
header: '', //是否导出凭证
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ORDNO',
header: '', //唯一编码
hidden: true,
width: 0
}];
//#endregion
//#region gridList列表显示信息
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
columns: this.girdcolums,
selModel: this.GridCheckBoxModel,
stripeRows: true, //斑马线效果
columnLines: true, //是否显示列分割线,默认为false
enableHdMenu: false, //是否显示表格列的菜单
rowLines: true,
iconCls: 'icon-grid',
renderTo: Ext.getBody(),
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
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';
DsOpenEditWin('/MvcShipping/MsCwVouchers/Edit', "凭证录入", "500", "940", "10", "10");
}, this);
//#endregion
//#endregion
//#region 合计列
//#region 定义数据集
//列表加载
this.storeListHJ = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCwVVModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchers/GetDataListHJ',
reader: {
id: 'ORDNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.GridCheckBoxModelHJ = Ext.create('Ext.selection.CheckboxModel');
this.girdcolumsHJ = [{
sortable: true,
dataIndex: 'ORDNO',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUALLNO',
header: '', //凭证号
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
header: '凭证日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'EXPVOUNO',
header: '导出凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'AMTDR',
header: '本位币借方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'AMTCR',
header: '本位币贷方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'FCYDR',
header: '外币借方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'FCYCR',
header: '外币贷方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'QTYDR',
header: '综合本位币借方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'QTYCR',
header: '综合本位币贷方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'PREPARED',
header: '制单人',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'ISEXPORT',
header: '', //是否导出凭证
hidden: true,
width: 0
}];
//#endregion
//#region gridList列表显示信息
this.gridListHJ = new Ext.grid.GridPanel({
store: this.storeListHJ,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
columns: this.girdcolumsHJ,
selModel: this.GridCheckBoxModelHJ,
columnLines: true, //是否显示列分割线,默认为false
iconCls: 'icon-grid',
renderTo: Ext.getBody(),
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeListHJ,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridListHJ.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsCwVouchers/Edit', "凭证录入", "500", "940", "10", "10");
}, this);
//#endregion
//#endregion
//#region formSearch 查询面板
//制单人
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.comboxZhiDanRen = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "制单人",
store: this.storeOpCode,
// forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'PREPARED',
flex: 1,
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeOpCode.load();
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
border: false,
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: [{
fieldLabel: '会计期间',
xtype: 'monthfield',
editable: false,
allowBlank: false, //是否允许为空
flex: 1,
id: 'ACCDATEbgn',
name: 'ACCDATEbgn',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m"),
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '至',
labelWidth: 20,
xtype: 'monthfield',
flex: 0.8,
editable: false,
allowBlank: false, //是否允许为空
id: 'ACCDATEend',
name: 'ACCDATEend',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m"),
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, this.comboxVKNO, {
id: 'VOUNO_NO',
fieldLabel: '凭证号',
labelAlign: 'right',
labelWidth: 50,
name: 'VOUNO_NO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
id: 'VOUNO_NOTO',
fieldLabel: '~',
labelAlign: 'right',
flex: 0.8,
labelWidth: 20,
name: 'VOUNO_NOTO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, this.comboxZhiDanRen,{
id: 'VOUNO_NOEXP',
fieldLabel: '导出凭证号',
labelAlign: 'right',
labelWidth: 80,
name: 'VOUNO_NOEXP',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
id: 'EXPLAN2',
fieldLabel: '摘要',
labelAlign: 'right',
labelWidth: 30,
name: 'EXPLAN2',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
xtype: "checkbox", //checkbox控件
id: "cbISEXPORT",
name: "cbISEXPORT",
boxLabel: "包括已导出的凭证",
fieldLabel: "",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
//checked: true //绘制时的选中状态
}]
}]//end items(fieldset 1)
}]//end root items
});
var _this = this;
this.formSearch2 = Ext.widget('form', {
frame: true,
region: "west",
border: false,
width: 140,
items: [{
xtype: 'radiogroup',
id: 'rdLBYS',
name: 'rdLBYS',
//fieldLabel: '列表样式',
//flex: 2,
//columns: 2,
vertical: true,
items: [
{ id: 'rdoHJ', boxLabel: '合计列', name: 'OBJNUM', inputValue: '合计列' },
{ id: 'rdoMX', boxLabel: '明细列', name: 'OBJNUM', inputValue: '明细列', checked: true}//
],
listeners: {
change: function (rd, newValue, oldValue, eOpts) {
saveQuerySetting(_this.formname, _this.formSearch2, false, true);
_this.onRefreshClick();
if (newValue.OBJNUM.toString() == "合计列") {
_this.gridListHJ.show(); //显示按钮
_this.gridList.hide(); //隐藏按钮
}
else {
_this.gridList.show(); //显示按钮
_this.gridListHJ.hide(); //隐藏按钮
}
}
}
}]//end root items
});
//#endregion formSearch
//#region 按钮工具条/页面布局
this.panelBtn = new Ext.Panel({
region: "north",
border: false,
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsCwVouchers/Edit', "凭证录入", "500", "940", "10", "10");
},
scope: this
}, '-', {
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: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
text: "批量设置导出凭证号",
menu: [
{ text: "选择设置",
handler: function (menu, event) {
_this.onSetVouNoClick('1');
}
}, { text: "全部设置",
handler: function (menu, event) {
_this.onSetVouNoClick('0');
}
}],
scope: this
}, {
text: "导出",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
menu: [
{ text: "选择导出",
handler: function (menu, event) {
_this.onExportClick('1');
}
}, { text: "全部导出",
handler: function (menu, event) {
_this.onExportClick('0');
}
}],
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 62,
border: false,
items: [this.panelBtn, this.formSearch2, this.formSearch]
});
Ext.apply(this, {
border: false,
items: [this.panelTop, this.gridList, this.gridListHJ]
});
//#endregion
//#region 页面加载
this.gridList.show(); //显示按钮
this.gridListHJ.hide(); //隐藏按钮
LoadQueryData(this.formname, this.formSearch2, this.CheckSaveQuery);
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
this.sqlcontext = sql;
if (sql.toString() != "") {
Ext.apply(store.proxy.extraParams, { condition: sql });
}
}, this);
this.storeList.on('refresh', function (store) {
mergeCells(this.gridList, [2, 3, 4, 5, 10, 11, 0]); // 加载完成后,执行函数
}, this)
this.storeListHJ.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 按钮函数
onRefreshClick: function () {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeListHJ.pageSize = this.PageSize;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在刷新数据...", scope: this });
this.storeListHJ.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在刷新数据...", timeout: 6000000, scope: this });
},
getCondition: function () {
var sql = ' 1=1 ';
//凭证号
var VKNO = this.formSearch.getForm().findField('VKNO').getValue();
if (VKNO != null) {
if (VKNO != "") {
sql = sql + getAndConSql(sql, VKNO, "VKNO='" + VKNO.toString().trim() + "'");
}
}
//凭证号
var VOUNO = Ext.getCmp("VOUNO_NO").value;
var VOUNOTO = Ext.getCmp("VOUNO_NOTO").value;
if (VOUNO != null) {
if (VOUNO != "") {
//sql = sql + getAndConSql(sql, VOUNO, "VOUNO like '%" + VOUNO.toString().trim() + "%'");
if (VOUNOTO != null && VOUNOTO != "")
sql = sql + getAndConSql(sql, VOUNO, " (VOUNO>='" + VOUNO.toString().trim() + "' and VOUNO<='" + VOUNOTO.toString().trim() + "') "); //烟台爱德林要求2016-03-22改
else
sql = sql + getAndConSql(sql, VOUNO, "VOUNO='" + VOUNO.toString().trim() + "'"); //烟台爱德林要求2016-03-22改
}
}
//摘要
var EXPLAN2 = Ext.getCmp("EXPLAN2").value;
if (EXPLAN2 != null) {
if (EXPLAN2 != "") {
sql = sql + getAndConSql(sql, EXPLAN2, "EXPLAN like '%" + EXPLAN2.toString().trim() + "%'");
}
}
var EXPVOUNO = Ext.getCmp("VOUNO_NOEXP").value;
if (EXPVOUNO != null) {
if (EXPVOUNO != "") {
sql = sql + getAndConSql(sql, EXPVOUNO, "EXPVOUNO like '%" + EXPVOUNO.toString().trim() + "%'");
}
}
//制单人
var PREPARED = this.formSearch.getForm().findField('PREPARED').getValue();
if (PREPARED != null) {
if (PREPARED != "") {
sql = sql + getAndConSql(sql, PREPARED, "PREPARED like '%" + PREPARED.toString().trim() + "%'");
}
}
//会计期间
//var ACCDATEbgn = Ext.getCmp("ACCDATEbgn").value;
var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue();
if (ACCDATEbgn != null) {
if (ACCDATEbgn != "") {
sql = sql + getAndConSql(sql, ACCDATEbgn, "SUBSTRING(convert(char(10),VOUDATE,120),1,7) >='" + ACCDATEbgn.toString().trim() + "'");
}
}
//var ACCDATEend = Ext.getCmp("ACCDATEend").value;
var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue();
if (ACCDATEend != null) {
if (ACCDATEend != "") {
sql = sql + getAndConSql(sql, ACCDATEend, "SUBSTRING(convert(char(10),VOUDATE,120),1,7) <='" + ACCDATEend.toString().trim() + "'");
}
}
var sCbISEXPORT = this.formSearch.getForm().findField('cbISEXPORT').getValue();
if (!sCbISEXPORT) {
sql = sql + " and ISEXPORT=0";
}
return sql;
},
onClearSql: function () {
//this.formSearch.getForm().findField('VKNO').setValue("记");
//this.formSearch.getForm().findField('VOUNO_NO').setValue("");
//this.formSearch.getForm().findField('ACCDATEbgn').setValue("");
//this.formSearch.getForm().findField('ACCDATEend').setValue("");
var form = this.formSearch.getForm();
form.reset();
this.InitData();
},
onDeleteClick: function (button, event) {
var selections;
if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") {
selections = this.gridListHJ.getSelectionModel().getSelection();
}
else {
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 (record.get('ISCHECKED') != "true") {
if (i == 0) {
gids = record.get('ORDNO');
}
else {
gids += "," + record.get('ORDNO');
}
}
else {
sError = "(注:已经审核的业务不允许删除!";
}
}
//
if (gids.trim() == "") {
Ext.Msg.show({ title: '提示', msg: '请选择未审核业务!' + sError, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsCwVouchers/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);
}
},
//#region 导出Excel
onSetVouNoClick: function (type) {
var selections;
if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() != "合计列") {
Ext.Msg.show({ title: '提示', msg: '请先选择合计列!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
selections = this.gridListHJ.getSelectionModel().getSelection();
if (selections.length == 0 && type == '1') {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.getCondition() == '' && type == '0') {
Ext.Msg.show({ title: '提示', msg: '请查询出需设置的凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
var bodyAddDatas = [];
if (selections.length > 0) {
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
bodyAddDatas.push(record);
}
}
//会计期间
//var ACCDATEbgn = Ext.getCmp("ACCDATEbgn").value;
var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue();
//var ACCDATEend = Ext.getCmp("ACCDATEend").value;
var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue();
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
this.selectGid = jsonbodyAddDatas;
if (this.winIFTMBFShow == undefined || this.winIFTMBFShow == NaN) {
this.formIFTMBFSShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [{
fieldLabel: '起始凭证号',
id: 'BEGINVOU',
name: 'BEGINVOU'
}]
}]
});
me = this;
this.winIFTMBFShow = Ext.create('Ext.window.Window', {
width: 320,
height: 160,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formIFTMBFSShow],
buttons: [{
text: "确认生成", //"确认生成",
minWidth: 70,
handler: function () {
var BEGINVOU = Ext.getCmp('BEGINVOU').getValue();
Ext.Msg.wait('正在导出数据...');
Ext.Ajax.request({
waitMsg: '正在导出数据...',
url: '/MvcShipping/MsCwVouchers/IsSetVouNo',
params: {
data: me.selectGid,
beginvou: BEGINVOU,
ACCDATEbgn: ACCDATEbgn,
ACCDATEend: ACCDATEend,
condition: me.getCondition(),
type: type
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
me.storeListHJ.reload();
me.storeList.reload();
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message + sError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
if (jsonresult.Data != "") {
Ext.MessageBox.confirm("提示", jsonresult.Message, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在导出数据...');
Ext.Ajax.request({
waitMsg: '正在导出数据...',
url: '/MvcShipping/MsCwVouchers/SetVouNo',
params: {
data: me.selectGid,
beginvou: BEGINVOU,
condition: me.getCondition(),
type: type
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
me.storeListHJ.reload();
me.storeList.reload();
//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
});
}
}, this);
} 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
});
me.winIFTMBFShow.close();
}
}, {
text: "关闭", //"关闭",
minWidth: 70,
handler: function () {
me.winIFTMBFShow.close();
}
}]
});
}
this.winIFTMBFShow.show();
},
onExportClick: function (type) {
var selections;
if (Ext.getCmp('rdLBYS').getValue().OBJNUM.toString() == "合计列") {
selections = this.gridListHJ.getSelectionModel().getSelection();
}
else {
selections = this.gridList.getSelectionModel().getSelection();
}
if (selections.length == 0&&type=='1') {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
var gids = "";
if (selections.length > 0) {
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
if (i == 0) {
gids = record.get('ORDNO');
}
else {
gids += "," + record.get('ORDNO');
}
}
}
if (this.getCondition() =='' && type == '0') {
Ext.Msg.show({ title: '提示', msg: '请查询出需导出的凭证!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
//
Ext.Msg.wait('正在导出数据...');
Ext.Ajax.request({
waitMsg: '正在导出数据...',
url: '/MvcShipping/MsCwVouchers/getIsExport',
params: {
condition: this.getCondition(),
gids: gids,
type:type
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
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";
if (type == '0')
var openUrl = "../../Reports/RptExport.aspx?handle=MsCwVouchersIndex&formname=" + this.formname + "&condition1=" + sql + "&gids=";
else
var openUrl = "../../Reports/RptExport.aspx?handle=MsCwVouchersIndex&formname=" + this.formname + "&condition1=" + sql + "&gids=" + gids;
Ext.MessageBox.hide();
window.open(openUrl, openType, openSet);
//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
});
},
//#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
//#endregion
// OprationSwap: function () {
// var ret = new Array();
// ret[0] = this.OprationStatus;
// ret[1] = this.storeList;
// ret[2] = this.SelectedRecord;
// ret[3] = this.sqlcontext;
// return ret;
// },
OprationSwapJK: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.sqlcontext;
ret[4] = Ext.getCmp('btnRefresh');
ret[5] = null;
ret[6] = null;
ret[7] = null;
ret[8] = null;
ret[9] = null;
ret[10] = null;
return ret;
}
});