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/OA/Viewsjs/Jiekuan2/JiekuanIndex.js

1236 lines
44 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.Chfee_managementIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.Chfee_managementIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.Chfee_managementIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
VISIBLERANGE: 0,
OPERATERANGE: 0,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'Jiekuanmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/OA/Jiekuan2/GetDataList',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "OA_Jiekuan";
//枚举参照
this.BXCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 45
});
this.column = [{
sortable: true,
dataIndex: '', id: "",
header: '',
width: 80
}, /*{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},*/
{
sortable: true, hidden: true,
dataIndex: 'ENTEROPERATOR',
header: 'ENTEROPERATOR',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 120
}, {
sortable: true,
dataIndex: 'GID',
header: '借款单号',
width: 140
}, {
sortable: true, hidden: true,
dataIndex: 'MBLNO',
header: '提单号',
width: 120
}, {
sortable: true,
dataIndex: 'SHOWNAME',
header: '制单人',
width: 80
},
{
sortable: true,
dataIndex: 'ENTERDATE',
header: '借款时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTID',
header: 'DEPTID',
width: 80
},
{
sortable: true,
dataIndex: 'DEPTNAME',
header: '部门',
width: 80
},
{
sortable: true,
dataIndex: 'RMBAMOUNT',
header: 'RMB金额',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'USDAMOUNT',
header: 'USD金额',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'OTHERAMOUNT',
header: '其他金额',
width: 80,
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;
}
},
{
sortable: true, hidden: true,
dataIndex: 'ISDELETE',
header: 'ISDELETE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETEUSER',
header: 'DELETEUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETETIME',
header: 'DELETETIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'JKSTATUS', id: "JKSTATUS",
header: 'JKSTATUS',
width: 80
}, {
sortable: true,
dataIndex: 'CHEQUENO',
header: '支票号',
width: 80
}, {
sortable: true,
dataIndex: 'JKSTATUS_REF', id: "JKSTATUS_REF",
header: '借款状态',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'REMAIN', id: "REMAIN",
header: 'REMAIN',
width: 80
}, {
sortable: true,
dataIndex: 'RMBAMOUNT_SETTLEMENT',
header: 'RMB核销金额',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'USDAMOUNT_SETTLEMENT',
header: 'USD核销金额',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'OTHERAMOUNT_SETTLEMENT',
header: '其他核销金额',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'REMARK',
header: '借款理由',
width: 200
},
{
sortable: true,
dataIndex: 'EXREPAYDATE',
header: '预计还款日',
width: 80
},
{
sortable: true,
dataIndex: 'SETTINFO',
header: '核销情况',
width: 200
}];
this.TtlSel = Ext.create('Ext.form.Label', {
name: 'bottleslbl',
labelAlign: 'right',
width: 800
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
stateful: true,
selModel: this.BXCB,
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.TtlSel]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column, 1, true);
//使用者id表名 中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.column);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin("/OA/Jiekuan2/Edit", "", "650", "800", "200", "500");
}, this);
this.storeCHEQUEList = Ext.create('Ext.data.Store', {
model: 'CHEQUEmb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/OA/Jiekuan2/GetCHEQUE',
reader: {
id: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer_CHEQUE = Ext.extend(Ext.grid.RowNumberer, {
width: 45
});
this.CHEQUEList = new Ext.grid.GridPanel({
store: this.storeCHEQUEList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
stateful: true,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
//selModel: this.BXCB,
columns: [new Ext.grid.RowNumberer_CHEQUE(),
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
editor: this.comboxCustomerNameRef,
width: 120
},
{
sortable: true, hidden: true,
dataIndex: 'BILLNO',
header: 'BILLNO',
width: 80
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '业务编号(提单号)',
//hidden: true,
width: 150
},
{
sortable: true,
dataIndex: 'CHEQUENO',
header: '支票号',
width: 80
},
{
sortable: true,
dataIndex: 'CHEQUEAMOUNTUPPER',
header: '借款金额',
summaryType: 'sum',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'PURPOSE',
header: '用途',
width: 80
},
{
sortable: true,
dataIndex: 'ModifiedTime',
header: '预计收回时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'CHEQUEAMOUNT',
header: '实际支取金额',
summaryType: 'sum',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'PASSWORD',
header: '密码',
width: 80
},
{
sortable: true,
dataIndex: 'CHEQUECUSTNAME',
header: '密码领取人',
width: 80
},
{
sortable: true,
dataIndex: 'CHEQUEMAKETIME',
header: '支取时间',
width: 80
},
{
sortable: true,
dataIndex: 'PRINTTIME',
header: '开出时间',
},
{
sortable: true,
dataIndex: 'PRINTUSER',
header: '开出人',
width: 80
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeCHEQUEList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#region formSearch
this.storeDEPT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.DEPTRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDEPT.load({ params: { condition: ""} });
this.comboxDEPT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '部门',
store: this.storeDEPT,
name: 'DEPTID', id: "DEPTID",
valueField: 'GID',
displayField: 'DeptName'
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '借款人',
store: this.storeUser,
name: 'ENTEROPERATOR',
id: "ENTEROPERATOR",
valueField: 'UserCode',
displayField: 'CodeAndName'
//,value: usercode
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
forceSelection:true,
store: this.storeCustomerNameRef,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeJKSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeJKSTATUS.load({ params: { enumTypeId: 99024} });
this.comboxJKSTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '借款单状态',
//forceSelection :true,
store: this.storeJKSTATUS,
name: 'JKSTATUS'
/*,
readOnly: true,
id: "JKSTATUS"*/
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用名称',
store: this.storeFeeNameRef,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
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: 'MAKETIMEUPPER', id: "MAKETIMEUPPER", flex: 1
},*/
{
fieldLabel: '借款单号',
name: 'GID', id: "GID_S", flex: 1
}, {
fieldLabel: '支票号',
name: 'CHEQUENO', id: "CHEQUENO", flex: 1
},this.comboxDEPT
, this.comboxUser
,{
fieldLabel: '借款理由',
name: 'REMARK', flex: 1
}
/*, {
fieldLabel: '只显示还未借出',
labelwidth: 120,
xtype: 'checkbox',
name: 'YJC'
}*/]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [//this.comboxCustomerNameRef,
{
fieldLabel: '从..借款时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ENTERDATE_min'
}, {
fieldLabel: '到..借款时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ENTERDATE_max'
},this.comboxJKSTATUS
,this.comboxFeeNameRef
,{xtype:'hiddenfield',flex:1}]
}]
}, //end items(fieldset 3)
{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd", id: "NEW",
handler: function (button, event) {
this.OprationStatus = 'add';
//DsOpenEditWin("/OA/Jiekuan2/Edit", "新建借款单", "450", "1000");
DsOpenEditWin("/OA/Jiekuan2/Edit", "", "650", "800", "200", "500");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete", id: "DEL",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onResetClick(button, event);
//alert(this.getCondition);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true);
//alert(this.column[0].id);
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "提交审核", id: "Submit",
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
},
{
// id: "saveandclose",
text: "审核通过", id: "Pass",
handler: function (button, event) {
this.onAuditPassClick();
},
scope: this
},
{
// id: "saveandclose",
text: "驳回提交", id: "Refuse",
handler: function (button, event) {
this.onAuditRefuseClick();
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
this.page_1 = new Ext.Panel({
id: "page_1",
layout: "border",
region: "center",
title: "借款单",
items: [this.gridList
]
});
this.page_2 = new Ext.Panel({
id: "page_2",
layout: "border",
region: "center",
title: "借款情况查询",
items: [this.CHEQUEList
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
items: [this.page_1, this.page_2]
})
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
this.InitData();
//集中绑定事件
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
_this=this;
this.gridList.on({
selectionchange: function (sm, selections) {
_this.TtlSel.setText('');
if (selections.length == 0) {
return;
}
var rmb = 0;
var rmbstl = 0;
var j = selections.length;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var rmb = rmb + rec.data.RMBAMOUNT;
var rmbstl = rmbstl + rec.data.RMBAMOUNT_SETTLEMENT;
}
if (rmb != 0) {
rmbstr = "RMB金额:" + returnfloat(rmb)+ "|";
// rmblb = "<span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:bold;display:inline-block;">统计信息(文字标题)<span style="margin:0;margin-left:40px;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段名-中文)</span><span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#ff0000;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段值-负值)</span><span style="margin:0;margin-left:20px;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段名-中文)</span><span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#009bdb;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段值-正值)</span></span>";
}
if (rmbstl != 0) {
rmbstlstr = "RMB核销金额:" + returnfloat(rmbstl)
// rmblb = "<span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:bold;display:inline-block;">统计信息(文字标题)<span style="margin:0;margin-left:40px;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段名-中文)</span><span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#ff0000;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段值-负值)</span><span style="margin:0;margin-left:20px;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段名-中文)</span><span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#009bdb;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段值-正值)</span></span>";
}
_this.TtlSel.setText('选中合计 :' + rmbstr + rmbstlstr);
}
});
}, //end initUIComponents
checkHandler: function () {
alert('Checked a menu item');
},
onRefreshClick: function (button, event) {
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
var sql = this.getCondition();
this.storeList.removeAll();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_2") {
var sql = this.getCHEQUECondition();
this.storeCHEQUEList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
},
InitData: function () {
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "mod_Baoxiao",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
//alert(rec.VISIBLERANGE);
//alert(rec.OPERATERANGE);
//可操作为0则全都可见3为可提交/驳回,2为可审核/驳回1为只能看
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
if (this.OPERATERANGE == '0') {
Ext.getCmp("Submit").enable();
Ext.getCmp("Pass").enable();
Ext.getCmp("Refuse").enable();
Ext.getCmp("NEW").enable();
Ext.getCmp("DEL").enable();
} else
if (this.OPERATERANGE == '1') {
Ext.getCmp("Submit").disable();
Ext.getCmp("Pass").disable();
Ext.getCmp("Refuse").disable();
Ext.getCmp("NEW").disable();
Ext.getCmp("DEL").disable();
} else
if (this.OPERATERANGE == '2') {
Ext.getCmp("Submit").disable();
Ext.getCmp("Pass").enable();
Ext.getCmp("Refuse").enable();
Ext.getCmp("NEW").disable();
Ext.getCmp("DEL").enable();
} else {
Ext.getCmp("Submit").enable();
Ext.getCmp("Pass").disable();
Ext.getCmp("Refuse").enable();
Ext.getCmp("NEW").enable();
Ext.getCmp("DEL").enable();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}, //end InitData
onDeleteClick: function (button, event) {
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.JKSTATUS!="1" && rec.data.JKSTATUS!="6"){
alert("不能删除'录入状态'、'驳回提交'状态之外借款单。");
return;
}
}
//var msg="";
//var icon="";
//var buttons="";
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
var _Used=0;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var JKGID=rec.data.GID;
if (JKGID==""||JKGID==null){
//continue;
continue;
}else{
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async:false,
params: {condition: "select Count(*) GVALUE,'' as GID from ch_fee where JKGID='"+JKGID+"' and isnull(bxgid,'')<>'' "} ,
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
_Used=parseFloat(result.data[0].GVALUE);
}
});
}
if (parseFloat( _Used)>0){
alert("此借款单已进行报销,不能删除");
}else{
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/OA/Jiekuan2/Delete',
params: {
data: Ext.JSON.encode(rec.data),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeList.remove(rec);
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//msg=jsonresult.Message;
//icon=Ext.Msg.INFO;
//buttons=Ext.Msg.OK;
this.onRefreshClick();
/*for (var j = 0; j < this.storeList.getCount(); j += 1) {
var member = this.storeList.getAt(j);
JieKuan2datas.push(member);
}*/
}
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) {
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}
Ext.Msg.hide();
//var _r=this.reLine();
}
}, this);
/*
var selections = this.gridList.getSelectionModel().getSelection();
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
}
}, this);
*/
//InitData();
}, //onDeleteClick
getToday: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var clock = year + "-";
if (month < 10)
clock += "0";
clock += month + "-";
if (day < 10)
clock += "0";
clock += day + " ";
return (clock);
},
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
if (this.VISIBLERANGE == null) {
this.VISIBLERANGE = '3';
}
var sql= " isnull(ISDELETE,0)=0 ";
if (this.VISIBLERANGE == '0')//查看权限 全部
{
//var sql = '';
}
if (this.VISIBLERANGE == '1')//分公司
{
sql = sql+" and jk.companyid='" + COMPANYID + "'";
}
if (this.VISIBLERANGE == '2')//部门
{
sql = sql+" and jk.DEPTID ='" + DEPTGID + "'";
}
if (this.VISIBLERANGE == '3')//个人
{
sql = sql+" and jk.ENTEROPERATOR='" + USERID + "'";
}
//OPERATERANGE
var _DEPTID = Ext.getCmp("DEPTID").getValue();
sql = sql + getAndConSql(sql, _DEPTID, "jk.DEPTID = '" + _DEPTID + "'");
var GID = Ext.getCmp("GID_S").getValue();
sql = sql + getAndConSql(sql, GID, "jk.GID like '%" + GID + "%'");
var ENTEROPERATOR = this.comboxUser.getValue();
sql = sql + getAndConSql(sql, ENTEROPERATOR, "jk.ENTEROPERATOR = (select gid from [user] where codename='" + ENTEROPERATOR + "')");
var CHEQUENO = Ext.getCmp("CHEQUENO").getValue();
sql = sql + getAndConSql(sql, CHEQUENO, " jk.CHEQUENO like '%" + CHEQUENO + "%' ");
var JKSTATUS = this.comboxJKSTATUS.getValue();
sql = sql + getAndConSql(sql, JKSTATUS, " jk.JKSTATUS = '" + JKSTATUS + "' ");
var ENTERDATE_min = form.findField('ENTERDATE_min').getRawValue();
sql = sql + getAndConSql(sql, ENTERDATE_min, "jk.ENTERDATE >= '" + ENTERDATE_min + "'");
var ENTERDATE_max = form.findField('ENTERDATE_max').getRawValue();
sql = sql + getAndConSql(sql, ENTERDATE_max, "jk.ENTERDATE <= '" + ENTERDATE_max + " 23:59:59'");
var FeeName = form.findField('FeeName').getValue();
sql = sql + getAndConSql(sql, FeeName, " EXISTS (select * from ch_fee where JKGID=jk.gid and FEENAME='"+FeeName+"') ");
var REMARK = form.findField('REMARK').getValue();
sql = sql + getAndConSql(sql, REMARK, " jk.REMARK like '%" + REMARK + "%'" );
return sql;
},
getCHEQUECondition: function () {
var form = this.formSearch.getForm();
if (this.VISIBLERANGE == null) {
this.VISIBLERANGE = '3';
}
if (this.VISIBLERANGE == '0')//查看权限 全部
{
var sql = '';
}
if (this.VISIBLERANGE == '1')//分公司
{
var sql = " Billno in(select GID from oa_jiekuan where companyid='" + COMPANYID + "')";
}
if (this.VISIBLERANGE == '2')//部门
{
var sql = " cfc.Billno in(select GID from oa_jiekuan where DEPTID='" + DEPTGID + "')";
}
if (this.VISIBLERANGE == '3')//个人
{
var sql = " cfc.Billno in(select GID from oa_jiekuan where enteroperator='" + USERID + "')";
}
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, " cfc.CUSTOMERNAME='" + CUSTOMERNAME + "' ");
var MAKETIMEUPPER = form.findField('MAKETIMEUPPER').getValue();
sql = sql + getAndConSql(sql, MAKETIMEUPPER, " cfc.MAKETIMEUPPER in( select bsno from vw_settlement where mblno like '%" + MAKETIMEUPPER + "%') ");
var ENTERDATE_min = form.findField('ENTERDATE_min').getRawValue();
sql = sql + getAndConSql(sql, ENTERDATE_min, " cfc.billno in(select gid from oa_jiekuan where ENTERDATE >= '" + ENTERDATE_min + "') ");
var ENTERDATE_max = form.findField('ENTERDATE_max').getRawValue();
sql = sql + getAndConSql(sql, ENTERDATE_max, " cfc.billno in(select gid from oa_jiekuan where ENTERDATE <= '" + ENTERDATE_max + " 23:59:59') ");
var GID = Ext.getCmp("GID_S").getValue();
sql = sql + getAndConSql(sql, GID, " cfc.billno like '%" + GID + "%'");
var CHEQUENO = Ext.getCmp("CHEQUENO").getValue();
sql = sql + getAndConSql(sql, CHEQUENO, " cfc.chequeno like '%" + CHEQUENO + "%' ");
var ENTEROPERATOR = this.comboxUser.getValue();
sql = sql + getAndConSql(sql, ENTEROPERATOR, " cfc.billno in ( select gid from oa_jiekuan where ENTEROPERATOR = (select gid from [user] where codename='" + ENTEROPERATOR + "') ) ");
var _DEPTID = Ext.getCmp("DEPTID").getValue();
sql = sql + getAndConSql(sql, _DEPTID, " cfc.billno in ( select gid from oa_jiekuan where DEPTID '" + _DEPTID + "') ");
return sql;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
onSubmitAuditClick: function (button, event) {
//提交审核
var selections = this.gridList.selModel.getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var GIDList="";
for (var i = 0; i < selections.length; i += 1) {
var _J = selections[i];
if (_J.data.JKSTATUS!="1" && _J.data.JKSTATUS!="6"){
alert("只能提交录入状态/驳回提交的借款单");
return;
}
}
JieKuanStart(selections);
this.onRefreshClick();
},
onAuditPassClick: function (button, event) {
//审核通过
//var records = this.MainCB.selected.items;
var selections = this.gridList.selModel.getSelection();
JieKuanAudit(selections);
//DsTruck.JKAudit(records, 0, '正在审核数据, 请稍侯..');
this.onRefreshClick();
},
onAuditRefuseClick: function (button, event) {
//驳回提交
var selections = this.gridList.selModel.getSelection();
JieKuanAuditBack(selections,"");
//DsTruck.JKAudit(records, 6, '正在审核数据, 请稍侯..');
this.onRefreshClick();
}
});