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.
475 lines
17 KiB
JavaScript
475 lines
17 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.MsChInvoiceBookIndex = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.MsChInvoiceBookIndex.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.MsChInvoiceBookIndex, Ext.Panel, {
|
|
PageSize: 30,
|
|
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
SelectedRecord: null,
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
//定义数据集
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
pageSize: this.PageSize,
|
|
model: 'MsChInvoiceBook',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/Account/Chfee_invoice/GetBookDataList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
//定义Grid
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
store: this.storeList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
columns: [{
|
|
sortable: true,
|
|
dataIndex: 'NAME',
|
|
header: '票册名称',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'DESCRIPTION',
|
|
header: '票册描述',
|
|
width: 60
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INVOICECODE',
|
|
header: '发票代码号',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INVOICENUMSTART',
|
|
header: '票册开始号',
|
|
width: 160
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INVOICENUMEND',
|
|
header: '票册结束号',
|
|
width: 160
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INVOICETOTAL',
|
|
header: '发票总数',
|
|
width: 160
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'ISPRINT',
|
|
header: '是否打印',
|
|
width: 60
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CREATEUSERREF',
|
|
header: '创建人',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CREATETIME',
|
|
header: '创建时间',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'ISDELETE',
|
|
header: '是否作废',
|
|
width: 80
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'DELOPERATORNAME',
|
|
header: '作废人',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'DELETETIME',
|
|
header: '作废时间',
|
|
width: 100
|
|
}
|
|
],
|
|
// paging bar on the bottom
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
store: this.storeList,
|
|
displayInfo: true,
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
emptyMsg: "没有数据"
|
|
})
|
|
});
|
|
|
|
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
this.SelectedRecord = record;
|
|
this.OprationStatus = 'edit';
|
|
this.SelectedRecord = record;
|
|
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
var openType = "_blank";
|
|
var openUrl = "/Account/Chfee_invoice/BookEdit";
|
|
window.open(openUrl, openType, openSet);
|
|
|
|
// DsOpenEditWin('/Account/Chfee_cheque/BookEdit');
|
|
|
|
}, this);
|
|
|
|
//#region formSearch
|
|
|
|
|
|
_this = this;
|
|
this.formSearch = Ext.widget('form', {
|
|
frame: true,
|
|
region: 'center',
|
|
bodyPadding: 5,
|
|
fieldDefaults: {
|
|
margins: '2 2 2 2',
|
|
labelAlign: 'right',
|
|
flex: 1,
|
|
labelWidth: 90,
|
|
msgTarget: 'qtip'
|
|
},
|
|
|
|
items: [
|
|
{//fieldset 1
|
|
xtype: 'container',
|
|
defaultType: 'textfield',
|
|
layout: 'anchor',
|
|
defaults: {
|
|
anchor: '100%'
|
|
},
|
|
items: [{
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '发票代码号',
|
|
name: 'INVOICECODE',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: '发票号',
|
|
name: 'InvNo',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: '从创建日期',
|
|
format: 'Y-m-d',
|
|
xtype: 'datefield',
|
|
name: 'ExpDateBgn',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: '到创建日期',
|
|
format: 'Y-m-d',
|
|
xtype: 'datefield',
|
|
name: 'ExpDateEnd',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]//end items(fieldset 1)
|
|
}//end fieldset 1
|
|
]//end root items
|
|
|
|
});
|
|
|
|
//#endregion formSearch
|
|
|
|
//查询工具条
|
|
this.panelBtn = new Ext.Panel({
|
|
region: "north",
|
|
tbar: [
|
|
{
|
|
text: "新增票册",
|
|
iconCls: "btnadd",
|
|
handler: function (button, event) {
|
|
this.OprationStatus = 'add';
|
|
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
var openType = "_blank";
|
|
var openUrl = "/Account/Chfee_invoice/BookEdit";
|
|
window.open(openUrl, openType, openSet);
|
|
},
|
|
scope: this
|
|
|
|
}, '-',
|
|
{
|
|
text: "执行查询",
|
|
iconCls: "btnrefresh",
|
|
handler: function (button, event) {
|
|
this.onRefreshClick(button, event);
|
|
},
|
|
scope: this
|
|
},
|
|
{
|
|
text: "重置条件",
|
|
iconCls: "btnreset",
|
|
handler: function (button, event) {
|
|
var form = this.formSearch.getForm();
|
|
form.reset();
|
|
},
|
|
scope: this
|
|
}, '-',
|
|
{
|
|
text: "删除",
|
|
iconCls: "btndelete",
|
|
id: "btndelete",
|
|
handler: function (button, event) {
|
|
this.onDeleteClick(button, event);
|
|
},
|
|
scope: this
|
|
}, '-',
|
|
{
|
|
text: "作废",
|
|
iconCls: "btndelete",
|
|
id: "btndeleteUp",
|
|
handler: function (button, event) {
|
|
this.onDeleteUpClick(button, event);
|
|
},
|
|
scope: this
|
|
}
|
|
]
|
|
});
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
layout: "border",
|
|
region: "north",
|
|
height: 80,
|
|
items: [this.panelBtn, this.formSearch]
|
|
});
|
|
|
|
Ext.apply(this, {
|
|
items: [this.panelTop, this.gridList]
|
|
});
|
|
|
|
this.storeList.on('beforeload', function (store) {
|
|
var sql = this.getCondition();
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
}, this);
|
|
|
|
this.onRefreshClick();
|
|
|
|
|
|
|
|
// _this = this;
|
|
// this.gridList.getSelectionModel().on('select', function (model, record, index) {
|
|
// var ISPRINT = record.data.ISPRINT;
|
|
// var btnEDeleteDetail = Ext.getCmp('btndelete');
|
|
// var btnEDeleteUpDetail = Ext.getCmp('btndeleteUp');
|
|
// var op = record.data.CREATEUSERREF;
|
|
|
|
// var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
|
|
// if (records.getCount() > 0) {
|
|
// if (bsstatus == 1) {
|
|
// btnEDeleteDetail.disable();
|
|
// btnEDeleteUpDetail.disable();
|
|
// } else {
|
|
// btnEDeleteDetail.enable();
|
|
// btnEDeleteUpDetail.enable();
|
|
// }
|
|
// } else {
|
|
// btnEDeleteDetail.disable();
|
|
// btnEDeleteUpDetail.disable();
|
|
// }
|
|
|
|
|
|
// }, this);
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
onRefreshClick: function (button, event) {
|
|
var sql = this.getCondition();
|
|
this.storeList.load({
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
|
|
waitMsg: "正在查询数据...",
|
|
scope: this
|
|
});
|
|
},
|
|
|
|
onDeleteClick: function (button, event) {
|
|
var selections = this.gridList.getSelectionModel().getSelection();
|
|
if (selections.length == 0) {
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
|
|
var record = selections[0];
|
|
|
|
|
|
var ISDELETE = record.data.ISDELETE;
|
|
|
|
var BILLSTATUS = record.data.BILLSTATUS;
|
|
|
|
if (BILLSTATUS == 1) {
|
|
Ext.Msg.show({ title: '提示', msg: '已锁定,无法删除或作废!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
|
|
}
|
|
if (ISDELETE == 'True') {
|
|
Ext.Msg.show({ title: '提示', msg: '此发票已作废,不能删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/Account/Chfee_invoice/DeleteBook',
|
|
params: {
|
|
data: Ext.JSON.encode(record.data)
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.storeList.remove(record);
|
|
Ext.Msg.show({ title: '提示', msg: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
}
|
|
else {
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
}
|
|
}
|
|
},
|
|
failure: function (response, options) {
|
|
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
},
|
|
success: function (response, options) {
|
|
},
|
|
scope: this
|
|
}); //end Ext.Ajax.request
|
|
}
|
|
}, this);
|
|
}, //onDeleteClick
|
|
|
|
onDeleteUpClick: function (button, event) {
|
|
var selections = this.gridList.getSelectionModel().getSelection();
|
|
if (selections.length == 0) {
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
|
|
var record = selections[0];
|
|
|
|
var ISDELETE = record.data.ISDELETE;
|
|
|
|
var BILLSTATUS = record.data.BILLSTATUS;
|
|
|
|
if (BILLSTATUS == 1) {
|
|
Ext.Msg.show({ title: '提示', msg: '已锁定,无法删除或作废!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
if (ISDELETE == 'True') {
|
|
Ext.Msg.show({ title: '提示', msg: '此发票已作废!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定要作废该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/Account/Chfee_invoice/DeleteUpBook',
|
|
params: {
|
|
data: Ext.JSON.encode(record.data)
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.onRefreshClick();
|
|
}
|
|
else {
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
}
|
|
}
|
|
},
|
|
failure: function (response, options) {
|
|
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
},
|
|
success: function (response, options) {
|
|
},
|
|
scope: this
|
|
}); //end Ext.Ajax.request
|
|
}
|
|
}, this);
|
|
}, //onDeleteClick
|
|
|
|
|
|
|
|
getCondition: function () {
|
|
var form = this.formSearch.getForm();
|
|
if (!form.isValid()) {
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
return '';
|
|
}
|
|
|
|
var sql = '';
|
|
|
|
|
|
var invoiceNo = form.findField('InvNo').getValue();
|
|
sql = sql + getAndConSql(sql, invoiceNo, " GID IN (SELECT BOOKID FROM ch_fee_invoiceitems WHERE INVOICENUM like '%" + invoiceNo + "%')");
|
|
|
|
var INVOICECODE = form.findField('INVOICECODE').getValue();
|
|
sql = sql + getAndConSql(sql, INVOICECODE, "INVOICECODE like '%" + INVOICECODE + "%'");
|
|
|
|
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
|
|
sql = sql + getAndConSql(sql, expDateBgn, "CREATETIME >='" + expDateBgn + "'");
|
|
|
|
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
|
|
sql = sql + getAndConSql(sql, expDateEnd, "CREATETIME <='" + expDateEnd + "'");
|
|
|
|
|
|
return sql;
|
|
},
|
|
OprationSwap: function () {
|
|
var ret = new Array();
|
|
ret[0] = this.OprationStatus;
|
|
ret[1] = this.storeList;
|
|
ret[2] = this.SelectedRecord;
|
|
|
|
return ret;
|
|
}
|
|
|
|
});
|
|
|
|
|