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.
646 lines
22 KiB
JavaScript
646 lines
22 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.MsChBalApplicationIndex = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.MsChBalApplicationIndex.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.MsChBalApplicationIndex, Ext.Panel, {
|
|
PageSize: 30,
|
|
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
SelectedRecord: null,
|
|
sqlcontext: '',
|
|
|
|
initUIComponents: function () {
|
|
|
|
this.formname = "formMsChBalApplicationIndex"; //页面名称
|
|
//定义数据集
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
pageSize: this.PageSize,
|
|
model: 'MsChBalapplication',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/Account/Chfee_Invoicehexiao/GetBalPayList',
|
|
reader: {
|
|
id: 'BILLNO',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
//定义Grid
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
store: this.storeList,
|
|
enableHdMenu: false,
|
|
selModel: this.GridCheckBoxModel,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
columns: [{
|
|
sortable: true,
|
|
dataIndex: 'BILLNO',
|
|
header: '入账单编号',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'BILLSTATUSREF',
|
|
header: '状态',
|
|
width: 80
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CUSTOMERNAME',
|
|
header: '结算单位',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CURR',
|
|
header: '币别',
|
|
width: 50
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'AMOUNTRMB',
|
|
header: 'RMB',
|
|
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: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'AMOUNTUSD',
|
|
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: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'APPLYTIME',
|
|
header: '申请日期',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'APPLICANTNAME',
|
|
header: '申请人',
|
|
width: 100
|
|
}
|
|
],
|
|
// paging bar on the bottom
|
|
bbar: [Ext.create('Ext.PagingToolbar', {
|
|
store: this.storeList,
|
|
displayInfo: true,
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
emptyMsg: "没有数据"
|
|
}), this.Pagenum]
|
|
});
|
|
|
|
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
this.SelectedRecord = record;
|
|
this.OprationStatus = 'edit';
|
|
DsOpenEditWin('/Account/Chfee_Invoicehexiao/BalEdit');
|
|
}, this);
|
|
|
|
//#region formSearch
|
|
|
|
//#region formSearch枚举参照相关
|
|
this.storeBILLSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
this.storeBILLSTATUS.load({ params: { enumTypeId: 97005} });
|
|
this.comboxBILLSTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
fieldLabel: '申请单状态',
|
|
forceSelection: true,
|
|
store: this.storeBILLSTATUS,
|
|
name: 'BILLSTATUS'
|
|
});
|
|
|
|
this.storeCust = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
});
|
|
|
|
this.storeCust.load({ params: { condition: ""} });
|
|
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
|
|
fieldLabel: '结算单位',
|
|
store: this.storeCust,
|
|
// forceSelection: true,
|
|
name: 'CustName',
|
|
valueField: 'CustName',
|
|
displayField: 'CodeAndName',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
keyup: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
_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: 'CustNo',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: '入账编号',
|
|
name: 'BsNo',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, this.comboxCust, this.comboxBILLSTATUS, {
|
|
xtype: 'button',
|
|
width: 90,
|
|
text: "执行查询",
|
|
iconCls: "btnrefresh",
|
|
handler: function (button, event) {
|
|
this.onRefreshClick(button, event);
|
|
},
|
|
scope: this
|
|
}, {
|
|
xtype: 'button',
|
|
width: 90,
|
|
text: "高级查询",
|
|
iconCls: "btnmore",
|
|
handler: function (button, event) {
|
|
var sql = this.getCondition();
|
|
var winAccess = new Shipping.DsQuery({
|
|
|
|
});
|
|
winAccess.StoreList = this.storeList;
|
|
winAccess.formname = this.formname;
|
|
winAccess.condition = sql;
|
|
winAccess.show();
|
|
return;
|
|
},
|
|
scope: this
|
|
}
|
|
]
|
|
}
|
|
]//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';
|
|
DsOpenEditWin('/Account/Chfee_Invoicehexiao/BalEdit');
|
|
},
|
|
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: '锁定',
|
|
tooltip: '锁定',
|
|
id: 'btnSubmitAudit',
|
|
handler: function (button, event) {
|
|
this.onSubmitAuditClick();
|
|
},
|
|
scope: this
|
|
}, '-', {
|
|
text: '撤销锁定',
|
|
tooltip: '撤销锁定',
|
|
id: 'btnSubmitAuditBack',
|
|
handler: function (button, event) {
|
|
this.onSubmitAuditBackClick();
|
|
},
|
|
scope: this
|
|
}, '-',
|
|
{
|
|
text: "删除",
|
|
iconCls: "btndelete",
|
|
handler: function (button, event) {
|
|
this.onDeleteClick(button, event);
|
|
},
|
|
scope: this
|
|
}, '-',
|
|
{
|
|
text: "打印",
|
|
handler: function (button, event) {
|
|
this.PrintSelect();
|
|
},
|
|
scope: this
|
|
}, '-', {
|
|
text: "导出Excel",
|
|
id: "btnExportExcel",
|
|
iconCls: 'btnexportexcel',
|
|
handler: function (button, event) {
|
|
this.onExportClick(button, event);
|
|
},
|
|
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.sqlcontext;
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
}, this);
|
|
|
|
this.onRefreshClick();
|
|
|
|
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
|
|
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在添加数据...',
|
|
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
|
|
params: {
|
|
modulename: 'modBalAppLock'
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
if (!result.Success) {
|
|
btnSubmitAudit.disable();
|
|
btnSubmitAuditBack.disable();
|
|
} else {
|
|
btnSubmitAudit.enable();
|
|
btnSubmitAuditBack.enable();
|
|
}
|
|
|
|
} else {
|
|
btnSubmitAudit.disable();
|
|
btnSubmitAuditBack.disable();
|
|
}
|
|
},
|
|
scope: this
|
|
});
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
onRefreshClick: function (button, event) {
|
|
var sql = this.getCondition();
|
|
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 },
|
|
waitMsg: "正在查询数据...",
|
|
scope: this
|
|
});
|
|
},
|
|
|
|
onDsQuery: function (button, event) {
|
|
var sql = this.sqlcontext;
|
|
this.PageSize = this.Pagenum.getValue();
|
|
this.storeList.pageSize = this.PageSize;
|
|
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 billstatus = record.data.BILLSTATUS;
|
|
|
|
if ((billstatus == '0')) {
|
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除此单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
|
|
}
|
|
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Msg.wait('正在删除数据...');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/Account/Chfee_Invoicehexiao/DeleteBal',
|
|
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
|
|
|
|
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 == '1') {
|
|
if (BILLNOStr == '')
|
|
BILLNOStr = BILLNO;
|
|
else {
|
|
|
|
BILLNOStr = BILLNOStr + ',' + BILLNO;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
_this = this;
|
|
|
|
if (BILLNOStr == '') {
|
|
|
|
} else {
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在添加数据...',
|
|
url: '/Account/Chfee_Invoicehexiao/LockBalList',
|
|
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 = '';
|
|
var strIsVOUCHERNO = "";
|
|
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_Invoicehexiao/UnLockBalList',
|
|
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
|
|
});
|
|
};
|
|
},
|
|
|
|
onExportClick: function (button, event) {
|
|
|
|
_this = this;
|
|
GridExportExcelPage(this.gridList);
|
|
},
|
|
|
|
getCondition: function () {
|
|
var form = this.formSearch.getForm();
|
|
if (!form.isValid()) {
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
return '';
|
|
}
|
|
|
|
var sql = '';
|
|
|
|
var customNo = form.findField('BsNo').getValue();
|
|
sql = sql + getAndConSql(sql, customNo, "BILLNO like '%" + customNo + "%'");
|
|
|
|
var custName = form.findField('CustName').getValue();
|
|
sql = sql + getAndConSql(sql, custName, "CUSTOMERNAME like '%" + custName + "%'");
|
|
|
|
|
|
var CustNo = form.findField('CustNo').getValue();
|
|
sql = sql + getAndConSql(sql, CustNo, "BILLNO IN (SELECT BILLNO FROM CH_FEE_DO WHERE BSNO IN (SELECT BSNO FROM V_OP_BILL b WHERE b.CUSTNO like '%" + CustNo + "%' or b.MBLNO like '%" + CustNo + "%' or b.HBLNO like '%" + CustNo + "%' or b.CUSTOMNO like '%" + CustNo + "%' or b.ORDERNO like '%" + CustNo + "%'))");
|
|
|
|
var BILLSTATUS = form.findField('BILLSTATUS').getValue();
|
|
sql = sql + getAndConSql(sql, BILLSTATUS, "BILLSTATUS= " + BILLSTATUS + "");
|
|
|
|
|
|
return sql;
|
|
},
|
|
OprationSwap: function () {
|
|
var ret = new Array();
|
|
ret[0] = this.OprationStatus;
|
|
ret[1] = this.storeList;
|
|
ret[2] = this.SelectedRecord;
|
|
|
|
return ret;
|
|
},
|
|
|
|
|
|
PrintSelect: 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 feeGidSql = '';
|
|
for (var i = 0; i < selections.length; i++) {
|
|
var record = selections[i];
|
|
var feeGId = "'" + record.get('BILLNO') + "'";
|
|
if (feeGidSql == '') {
|
|
feeGidSql = feeGId;
|
|
} else {
|
|
feeGidSql = feeGidSql + "," + feeGId;
|
|
}
|
|
};
|
|
|
|
var record = selections[0];
|
|
var billNo = record.data.BILLNO;
|
|
|
|
var printType = 'MSCHDUIBALPAYSEL';
|
|
var sql1 = "SELECT * FROM ch_fee_balapplication WHERE BILLNO IN (" + feeGidSql + ") ";
|
|
var sql2 = "";
|
|
|
|
var sql3 = "";
|
|
var sql4 = "";
|
|
var sql5 = "";
|
|
var sql6 = "";
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
}
|
|
|
|
});
|
|
|
|
|