680 lines
23 KiB
JavaScript
680 lines
23 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.MsChJinzhangIndex = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.MsChJinzhangIndex.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.MsChJinzhangIndex, Ext.Panel, {
|
|
PageSize: 30,
|
|
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
SelectedRecord: null,
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
this.StoreLockOp = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsFeeOP',
|
|
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
|
|
});
|
|
this.StoreLockOp.load({ params: { optype: "modChequeLock"} });
|
|
|
|
this.StoreUnLockOp = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsFeeOP',
|
|
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
|
|
});
|
|
this.StoreUnLockOp.load({ params: { optype: "modChequeUnLock"} });
|
|
|
|
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsFeeOP',
|
|
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
|
|
});
|
|
|
|
this.StoreOpRange.load({ params: { optype: "modCheque"} });
|
|
//定义数据集
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
pageSize: this.PageSize,
|
|
model: 'MsChJinzhang',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/Account/Chfee_jinzhang/GetDataList',
|
|
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: 'BLTYPE',
|
|
header: '票据类型',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'BILLSTATUSREF',
|
|
header: '锁定',
|
|
width: 60
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'BILLNO',
|
|
header: '进账单编号',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CUSTOMERNAME',
|
|
header: '开票单位',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'JINZHANGCUSTNAME',
|
|
header: '出票单位全称',
|
|
width: 160
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CURRENCY',
|
|
header: '币别',
|
|
width: 60
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'AMOUNT',
|
|
header: '金额',
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
try {
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
if (lsValue != "NaN") {
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
}
|
|
}
|
|
else {
|
|
return value;
|
|
}
|
|
}
|
|
catch (e) {
|
|
return value;
|
|
}
|
|
return value;
|
|
},
|
|
align: 'right',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'ISPRINT',
|
|
header: '是否打印',
|
|
width: 60
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'JINZHANGMAKETIME',
|
|
header: '日期',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CREATEUSERREF',
|
|
header: '开票人',
|
|
width: 100
|
|
}, {
|
|
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';
|
|
var openSet = "height=400, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
var openType = "_blank";
|
|
var openUrl = "/Account/Chfee_jinzhang/Edit";
|
|
window.open(openUrl, openType, openSet);
|
|
|
|
}, this);
|
|
|
|
//#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: 'InvNo',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: '开票单位',
|
|
name: 'CustName',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
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=400, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
var openType = "_blank";
|
|
var openUrl = "/Account/Chfee_jinzhang/Edit";
|
|
window.open(openUrl, openType, openSet);
|
|
},
|
|
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
|
|
}, '-', {
|
|
text: '提交锁定',
|
|
tooltip: '提交锁定',
|
|
id: 'btnSubmitAudit',
|
|
handler: function (button, event) {
|
|
this.onSubmitAuditClick();
|
|
},
|
|
scope: this
|
|
}, '-', {
|
|
text: '撤销锁定',
|
|
tooltip: '撤销锁定',
|
|
id: 'btnSubmitAuditBack',
|
|
handler: function (button, event) {
|
|
this.onSubmitAuditBackClick();
|
|
},
|
|
scope: this
|
|
}
|
|
]
|
|
});
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
layout: "border",
|
|
region: "north",
|
|
height: 80,
|
|
items: [this.formSearch, this.panelBtn]
|
|
});
|
|
|
|
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.CREATEUSER;
|
|
var bsstatus = record.data.BILLSTATUS;
|
|
|
|
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();
|
|
}
|
|
|
|
|
|
var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
|
|
var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
|
|
|
|
var records = DsStoreQueryBy(this.StoreLockOp, 'OPID', op);
|
|
if (records.getCount() > 0) {
|
|
if (bsstatus == 1) {
|
|
btnESubmitAudit.disable();
|
|
} else {
|
|
btnESubmitAudit.enable();
|
|
}
|
|
} else {
|
|
btnESubmitAudit.disable();
|
|
}
|
|
|
|
var records = DsStoreQueryBy(this.StoreUnLockOp, 'OPID', op);
|
|
if (records.getCount() > 0) {
|
|
if (bsstatus == 1) {
|
|
btnESubmitAuditBack.enable();
|
|
} else {
|
|
btnESubmitAuditBack.disable();
|
|
}
|
|
} else {
|
|
btnESubmitAuditBack.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_jinzhang/Delete',
|
|
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_jinzhang/DeleteUp',
|
|
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
|
|
|
|
onSubmitAuditClick: function () {
|
|
|
|
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 BILLNOStr = '';
|
|
for (var i = 0; i < selections.length; i++) {
|
|
var rec = selections[i];
|
|
var BILLNO = rec.data.BILLNO;
|
|
if (rec.data.BILLSTATUS == '0') {
|
|
if (BILLNOStr == '')
|
|
BILLNOStr = BILLNO;
|
|
else {
|
|
|
|
BILLNOStr = BILLNOStr + ',' + BILLNO;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
_this = this;
|
|
|
|
if (BILLNOStr == '') {
|
|
|
|
} else {
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在添加数据...',
|
|
url: '/Account/Chfee_jinzhang/LockList',
|
|
params: {
|
|
bills: BILLNOStr
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
if (!result.Success) {
|
|
Ext.Msg.show({
|
|
title: '提示',
|
|
msg: result.Message,
|
|
icon: Ext.MessageBox.ERROR,
|
|
buttons: Ext.Msg.OK
|
|
});
|
|
return;
|
|
} else {
|
|
|
|
_this.onRefreshClick();
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
}
|
|
},
|
|
scope: this
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onSubmitAuditBackClick: function () {
|
|
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 BILLNOStr = '';
|
|
for (var i = 0; i < selections.length; i++) {
|
|
var rec = selections[i];
|
|
var BILLNO = rec.data.BILLNO;
|
|
if ((rec.data.BILLSTATUS == '1')) {
|
|
if (BILLNOStr == '')
|
|
BILLNOStr = BILLNO;
|
|
else {
|
|
|
|
BILLNOStr = BILLNOStr + ',' + BILLNO;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
_this = this;
|
|
|
|
if (BILLNOStr == '') {
|
|
|
|
} else {
|
|
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在添加数据...',
|
|
url: '/Account/Chfee_jinzhang/UnLockList',
|
|
params: {
|
|
bills: BILLNOStr
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
if (!result.Success) {
|
|
Ext.Msg.show({
|
|
title: '提示',
|
|
msg: result.Message,
|
|
icon: Ext.MessageBox.ERROR,
|
|
buttons: Ext.Msg.OK
|
|
});
|
|
return;
|
|
} else {
|
|
|
|
_this.onRefreshClick();
|
|
|
|
}
|
|
|
|
} else {
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
}
|
|
},
|
|
scope: this
|
|
});
|
|
|
|
};
|
|
|
|
},
|
|
|
|
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, "CHEQUENO like '%" + invoiceNo + "%'");
|
|
|
|
var custName = form.findField('CustName').getValue();
|
|
sql = sql + getAndConSql(sql, custName, "CUSTOMERNAME like '%" + custName + "%'");
|
|
|
|
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
|
|
sql = sql + getAndConSql(sql, expDateBgn, "JINZHANGMAKETIME >='" + expDateBgn + "'");
|
|
|
|
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
|
|
sql = sql + getAndConSql(sql, expDateEnd, "JINZHANGMAKETIME <='" + expDateEnd + "'");
|
|
|
|
|
|
return sql;
|
|
},
|
|
OprationSwap: function () {
|
|
var ret = new Array();
|
|
ret[0] = this.OprationStatus;
|
|
ret[1] = this.storeList;
|
|
ret[2] = this.SelectedRecord;
|
|
|
|
return ret;
|
|
}
|
|
|
|
});
|
|
|
|
|