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.

1390 lines
47 KiB
JavaScript

10 months ago
Ext.namespace('DsTruck');
DsTruck.BaoxiaoAuditIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.BaoxiaoAuditIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.BaoxiaoAuditIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
VISIBLERANGE: 0,
OPERATERANGE: 0,
CurrentWorkFlowState:[],
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'BaoxiaoAuditmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/OA/BaoxiaoAudit/GetDataList',
reader: {
idProperty: 'Feeid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "OA_Baoxiao";
this.WorkFlowName="BaoxiaoMod";
//this.InWorkFlow=false;
//枚举参照
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: 'BXGID', id: "BXGID",
header: '报销单序列号',
width: 100
}, {
sortable: true,
dataIndex: 'BXNO', id: "BXNO",
header: '报销单号',
width: 100
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO', id: "BSNO",
header: '委托编号',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'COMPANY', id: "COMPANY",
header: '所属公司',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTNAME', id: "DEPTNAME",
header: '部门',
width: 80
},
{
sortable: true,
dataIndex: 'CREATEUSER', id: "CREATEUSER",
header: '报销人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATEDATE', id: "CREATEDATE",
header: '报销日期',
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT', id: "AMOUNT",
header: '报销金额',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ISDELETE', id: "ISDELETE",
header: 'ISDELETE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETEUSER', id: "DELETEUSER",
header: 'DELETEUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETETIME', id: "DELETETIME",
header: 'DELETETIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BXSTATUS', id: "BXSTATUS",
header: 'BXSTATUS',
width: 80
},
{
sortable: true,
dataIndex: 'CHEQUENO', id: "CHEQUENO",
header: '支票号',
width: 80
},
{
sortable: true,
dataIndex: 'CHEQUEAMOUNT', id: "CHEQUEAMOUNT",
header: '支票额度',
width: 80
}, {
sortable: true,
dataIndex: 'BXSTATUS_REF', id: "BXSTATUS_REF",
header: '报销状态',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK', id: "REMARK",
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'ISVOU_REF', id: "ISVOU_REF",
header: '已生成凭证',
width: 80
},
{
sortable: true,
dataIndex: 'VOUCHERNO', id: "VOUCHERNO",
header: '凭证号',
width: 100
},
{
sortable: true,
dataIndex: 'ISPAYED', id: "ISPAYED",
header: '已支付完成',
width: 100
},
{
sortable: true, hidden: true,
dataIndex: 'WORKFLOWID', id: "WORKFLOWID",
header: 'WORKFLOWID',
width: 80
}];
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [new Ext.grid.RowNumberer()],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的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();
////////////////////////////
//#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: 'CREATEUSER',
valueField: 'UserCode',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.comboxUser_1 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报销人',
store: this.storeUser,
name: 'CREATEUSER', id: "CREATEUSER",
valueField: 'UserName',
displayField: 'CodeAndName'
});
/*
Ext.define('BXSTATUSmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'status', type: 'string' },
{ name: 'statusRef', type: 'string' }
]
});
var StatusData = [{ "status": "0", "statusRef": "审核通过" },
{ "status": "1", "statusRef": "录入状态" },
{ "status": "2", "statusRef": "提交审核" },
{ "status": "6", "statusRef": "驳回提交"}];
this.storeStauts = Ext.create('Ext.data.Store', {
model: 'BXSTATUSmb',
data: StatusData
});
this.comboxStatus = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '报销单状态',
autosize: true,
bodyPadding: 5,
flex: 2, name: 'BXSTATUS',
width: 500,
labelWidth: 90,
store: this.storeStauts,
queryMode: 'local',
triggerOnClick: false,
valueField: 'status',
displayField: 'statusRef'
});*/
Ext.define('ISPAYEDmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'ID', type: 'string' },
{ name: 'ISPAYED', type: 'string' }
]
});
var ISPAYEDData = [{ "ID": "0", "ISPAYED": "全部" },
{ "ID": "1", "ISPAYED": "已支付" },
{ "ID": "2", "ISPAYED": "未支付"}];
this.storeISPAYED = Ext.create('Ext.data.Store', {
model: 'ISPAYEDmb',
data: ISPAYEDData
});
this.comboxISPAYED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '支付状态',
store: this.storeISPAYED,
name: 'ISPAYED', id: "ISPAYED",
valueField: 'ID',
displayField: 'ISPAYED'
});
this.storeWorkFlowStep = Ext.create('DsExt.ux.RefTableStore', {
model: 'WorkFlowStepmb',
proxy: { url: '/CommMng/WorkFlow/GetWorkFlowStep' }
});
this.storeWorkFlowStep.load({ params: { WorkFlowName: this.WorkFlowName} });
this.comboxWorkFlowStep = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '当前步骤',
store: this.storeWorkFlowStep,
name: 'WorkFlowStep', id: "WorkFlowStep",
valueField: 'GID',
displayField: 'NAME',
values:1,
flex:1
});
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: [this.comboxDEPT, {
fieldLabel: '报销单号',
name: 'BXGID', id: "BXGID_S"
}, this.comboxUser_1, {
fieldLabel: '从..报销日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CREATEDATE_min'
}, {
fieldLabel: '到..报销日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CREATEDATE_max'
}]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '包含审核通过',
xtype: 'checkbox',
name: 'Passed'
},
this.comboxISPAYED,
{
fieldLabel: '费用金额',
name: 'Fee_Amount'
}, {
fieldLabel: '支票号',
name: 'CHEQUENUM'
},{
xtype: 'hiddenfield',
flex: 1,
name:'hidden2',
layout: 'anchor'
}
//this.comboxStatus
]
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号/船名',
name: 'MBLNO', id: "MBLNO"
}, {
fieldLabel: '客户名称',
name: 'CUSTOMERNAME', id: "CUSTOMERNAME"
}, {
fieldLabel: '费用名称',
name: 'FEENAME', id: "FEENAME"
}, {
fieldLabel: '从..金额',
name: 'Amount_min'
}, {
fieldLabel: '到..金额',
name: 'Amount_max'
}
]
}]
}, //end items(fieldset 3)
{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
//layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [this.comboxWorkFlowStep,
{
xtype: 'hiddenfield',
flex: 4,
name:'hidden1',
layout: 'anchor'
}]
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//_this = this;
this.CBMWorkFlow = new Ext.form.Checkbox({
fieldLabel: '只显示待处理业务',
labelwidth:200,
});
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd", id: "NEW",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/OA/Baoxiao/Edit", "新建合同", "450", "800");
},
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: "打开",
iconCls: "btnright", id: "OPEN",
handler: function (button, event) {
this.onOpenClick(button, event);
},
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
}
]
});
//#region <<<< 收支费用明细 >>>>
this.comboxAccitems = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeAccitems,
name: 'FEENAME',
valueField: 'ACCID',
displayField: 'ACCIDNAME'
});
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', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
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', {
forceSelection: true,
store: this.storeCustomerNameRef,
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'currRef',
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
});
this.storecurr.load({ params: { condition: ""} });
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storecurr,
name: 'currid',
valueField: 'gid',
displayField: 'codename'
//币别
});
this.storeTAXRATE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTAXRATE.load({ params: { enumTypeId: 25} });
this.comboxTAXRATE = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '税率',
store: this.storeTAXRATE,
name: 'TAXRATE',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
id: "TAXRATE"
});
this.storeCHEQUENUM = Ext.create('DsExt.ux.RefTableStore', {
model: 'CHEQUENUMmb',
proxy: { url: '/CommMng/BasicDataRef/GetUnusedCHEQUENUM' }
});
//this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: bxgid} });
this.comboxCHEQUENUM = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '支票号',来自未使用的支票
store: this.storeCHEQUENUM,
name: 'CHEQUENUM',
valueField: 'CHEQUENUM',
displayField: 'CHEQUENUM'
//,id: "CHEQUENUM"
});
//数据集
this.storeBodyChfee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
readonly:true,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/OA/Baoxiao/GetFeeList',
reader: {
id: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.formFeeBody = new Ext.grid.GridPanel({
store: this.storeBodyChfee,
readonly:true,
enableHdMenu: false,
region: 'center',
//title: '费用明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditing],
selModel: this.CheckBoxModel,
selType: 'cellmodel',
tbar: [{
// id: "saveandclose",
text: "审核通过", id: "Pass",
handler: function (button, event) {
this.onAuditPassClick();
},
scope: this
},
{
// id: "saveandclose",
text: "驳回提交", id: "Refuse",
handler: function (button, event) {
//this.onAuditRefuseClick();
this.winReason.show();
},
scope: this
}],
columns: [
{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
editor: this.comboxCustomerNameRef,
width: 120
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号(台账号)',
//hidden: true,
width: 150,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.CUSTNO;
},
editor: this.comboxCUSTNO
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '业务编号(提单号)',
//hidden: true,
width: 150,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.MBLNO;
},
editor: this.comboxMBLNO
}, {
sortable: true,
dataIndex: 'Reason',
header: '支付种类',
width: 60,
editor: this.comboxPayType
},
//comboxPayType
{
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
//editor: this.comboxFeeNameRef,
width: 80
}, {
sortable: true,
dataIndex: 'BXGID',
header: '报销单号',
hidden: true,
width: 200
}, {
sortable: true, hidden: true,
dataIndex: 'FeeStatus',
header: '费用状态',
//renderer: function (value, p, record) {
// return record.data.FeeStatus_Ref;
//},
width: 66
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
hidden: true,
width: 200
}, {
sortable: true, hidden: true,
dataIndex: 'UnitPrice',
header: '单价',
//editor: {
// xtype: 'textfield', //numberfield
// selectOnFocus: true
//},
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: 'Quantity',
header: '数量',
//editor: {
// xtype: 'textfield',
// selectOnFocus: true
//},
width: 60
}, {
sortable: true,
dataIndex: 'NOTAXAMOUNT',
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;
}
//,editor: {
// xtype: 'textfield', //numberfield
// selectOnFocus: true
//}
}, {
sortable: true,
dataIndex: 'TAXRATE',
header: '税率(%)',
//editor: this.comboxTAXRATE,
//renderer: function (value, p, record) {
// return record.data.TAXRATE;
//},
width: 66
}, {
sortable: true,
dataIndex: 'TAX',
header: '税额',
//editor: {
// xtype: 'textfield', //numberfield
// selectOnFocus: true
//},
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: 'Amount',
header: '价税(票面)金额',
//editor: {
// xtype: 'textfield', //numberfield
// selectOnFocus: true
//},
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: 'Currency',
header: '币别',
//editor: this.comboxcurr,
width: 50
}, {
sortable: true, hidden: true,
dataIndex: 'ExChangerate',
header: '汇率',
//hidden: true,
//editor: {
// xtype: 'textfield',
// selectOnFocus: true
//},
width: 60
}, {
sortable: true, hidden: true,
dataIndex: 'EnterDate',
header: '时间',
//renderer: Ext.util.Format.dateRenderer('Y-m-d'),
//editor: {
// format: 'Y-m-d',
// xtype: 'datefield',
// selectOnFocus: true
//}
width: 80
}, {
sortable: true,
dataIndex: 'CHEQUENUM',
header: '支票号',
//editor: this.comboxCHEQUENUM,
width: 140
}, {
sortable: true,
dataIndex: 'IsOpen',
header: '是否抵扣销项税',
//editor: this.comboxIsOpen,
//renderer: function (value, p, record) {
// if (value == null || value == '') return '';
// else return record.data.IsOpen_REF;
//},
width: 95
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
//editor: {
// xtype: 'textfield',
// selectOnFocus: true
//},
width: 250
}]
});
//#endregion
//#region 报销单审核状态
this.formWorkFlowState = Ext.widget('form', { // layout: "border",
region: 'south',
layout: 'hbox',
readonly:true,
frame: true,
bodyPadding: 2,
height:45,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 5,
//labelWidth: 90,//label标签宽度
msgTarget: 'qtip',
sourcelabelWidth: '100' //,split:true
},
items: [ ]
}); //end this.formEdit
//#endregion
//#region 选择load
//var _this=this;
this.gridList.getSelectionModel().on('select', function (model, record, index) {
var BXGID = record.data.BXGID;
var WORKFLOWID=record.data.WORKFLOWID;
this.storeBodyChfee.load({ params: { BXGID: BXGID} });
/////////////以下部分为获取工作流
this.column = DsTruck.GetWorkFlowState(WORKFLOWID, BXGID);
//使用者id表名 中间column数组跳过一开始的几列
////////////////////
/*
this.formWorkFlowState.add({
xtype: 'textfield',
fieldLabel: '提单号/船名',
name: 'MBLNO'
});
*/
this.formWorkFlowState.removeAll();
//setTimeout('this.formWorkFlowState.add(this.column)',500*1);
this.formWorkFlowState.add(this.column);
//setTimeout('this.formWorkFlowState.doLayout()',550*1);
this.formWorkFlowState.doLayout();
}, this);
//#endregion 选择load
//#region 弹出理由窗口
this.formReason = 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: []
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '驳回理由',
xtype: 'textfield',
name: 'Reason'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winReason = Ext.create('Ext.window.Window', {
title: "驳回理由",
width: 450,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: true,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formReason],
buttons: [{
text: "驳回",
minWidth: 70,
handler: function () {
me.onAuditRefuseClick();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winReason.close();
}
}]
});
//#endregion
//#region 布局
this.panelFeeBody = new Ext.Panel({
layout: "border",
split: true,
region: "south",
height: 250,
items: [this.formFeeBody,this.formWorkFlowState]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 150,
split: true,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList,this.panelFeeBody]
});
//#endregion 布局
this.InitData();
//集中绑定事件
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
checkHandler: function () {
alert('Checked a menu item');
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeBodyChfee.removeAll();
//alert(this.storeList.getCount());
},
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();
Ext.getCmp("VOUCHER").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();
Ext.getCmp("VOUCHER").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();
Ext.getCmp("VOUCHER").enable();
} else {
Ext.getCmp("Submit").enable();
Ext.getCmp("Pass").disable();
Ext.getCmp("Refuse").enable();
Ext.getCmp("NEW").enable();
Ext.getCmp("DEL").enable();
Ext.getCmp("VOUCHER").disable();
}*/
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}, //end InitData
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 selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var candelete = DsTruck.CheckBaoxiaoDelete(selectedRecords);
if (candelete == false) {
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/OA/Baoxiao/Delete',
params: {
data: Ext.JSON.encode(record.data),
USERID: USERID
},
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: jsonresult.Message, 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);
InitData();
}, //onDeleteClick
onOpenClick: 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;
}
if (selections.length >1) {
Ext.Msg.show({ title: '提示', msg: '请注意,将打开所选内容的第一条!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
this.SelectedRecord = selectedRecords[0];
this.OprationStatus = 'edit';
DsOpenEditWin("/OA/Baoxiao/Edit", "", "620", "1000");
}, //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 == "0")//查看权限 全部
{
var sql = '';
}else
if (this.VISIBLERANGE == "1")//分公司
{
var sql = " BX.company='" + COMPANYID + "'";
} else
if (this.VISIBLERANGE == "2")//部门
{
var sql = " BX.DEPTNAME ='" + DEPTGID + "'";
} else
if (this.VISIBLERANGE == "3")//个人
{
var sql = " BX.createuser='" + SHOWNAME + "'";
}
else {
sql = " 1<0";
}
//OPERATERANGE
var DEPTID = Ext.getCmp("DEPTID").getValue();
sql = sql + getAndConSql(sql, DEPTID, "BX.DEPTNAME like '%" + DEPTID + "%'");
var BXGID = Ext.getCmp("BXGID_S").getValue();
sql = sql + getAndConSql(sql, BXGID, "BX.BXGID like '%" + BXGID + "%' or BX.BXNO like '%" + BXGID + "%'");
var CREATEUSER = Ext.getCmp("CREATEUSER").getValue();
sql = sql + getAndConSql(sql, CREATEUSER, "BX.CREATEUSER = '" + CREATEUSER + "'");
var CREATEDATE_min = form.findField('CREATEDATE_min').getRawValue();
sql = sql + getAndConSql(sql, CREATEDATE_min, "BX.CREATEDATE >= '" + CREATEDATE_min + "'");
var CREATEDATE_max = form.findField('CREATEDATE_max').getRawValue();
sql = sql + getAndConSql(sql, CREATEDATE_max, "BX.CREATEDATE <= '" + CREATEDATE_max + " 23:59:59'");
/*
var Status = this.comboxStatus.getValue();
if (Status != "") {
sql = sql + getAndConSql(sql, Status, "bx.bxstatus in (" + Status + ")");
}*/
var Passed = form.findField("Passed").getValue();
if (Passed)
{
sql = sql + getAndConSql(sql, Passed, " bx.bxstatus in (2,0,6) and bx.bxgid in(select distinct billno from workflow_do where auditor=@userid )");//and isdelete is null
}else
{
sql = sql + getAndConSql(sql, true, " dbo.[GetUsingStep](wu.workflowid,wu.currentid,@userid,wu.stepno)<>0 ");
}
var Amount_min = form.findField('Amount_min').getValue();
sql = sql + getAndConSql(sql, Amount_min, "BX.amount >= " + Amount_min );
var Amount_max = form.findField('Amount_max').getValue();
sql = sql + getAndConSql(sql, Amount_max, "BX.amount <= " + Amount_max);
var Fee_Amount = form.findField('Fee_Amount').getValue();
sql = sql + getAndConSql(sql, Fee_Amount, "BX.BXGID in (select bxgid from ch_fee where amount =" + Fee_Amount+")");
var CHEQUENUM = form.findField('CHEQUENUM').getValue();
sql = sql + getAndConSql(sql, CHEQUENUM, "BX.BXGID in (select bxgid from ch_fee where CHEQUENUM like '%" + CHEQUENUM + "%')");
var ISPAYED = this.comboxISPAYED.getValue();
var CUSTOMERNAME = Ext.getCmp("CUSTOMERNAME").getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "BX.BXGID in (select bxgid from ch_fee where customername like '%" + CUSTOMERNAME + "%')");
var FEENAME = Ext.getCmp("FEENAME").getValue();
sql = sql + getAndConSql(sql, FEENAME, "BX.BXGID in (select bxgid from ch_fee where FEENAME like '%" + FEENAME + "%')");
var MBLNO = Ext.getCmp("MBLNO").getValue();
sql = sql + getAndConSql(sql, MBLNO, "BX.BXGID in (select bxgid from ch_fee where bsno in( select bsno from vw_settlement where mblno like '%" + MBLNO + "%'))");
if (ISPAYED == "1") {//已支付
sql = sql + getAndConSql(sql, ISPAYED, " (select isnull(sum(obp.amount),0) from OA_Baoxiao_Pay obp where obp.BXGID=bx.BXGID)=isnull(bx.amount,0) ");
//alert("1");
};
if (ISPAYED == "2") {
sql = sql + getAndConSql(sql, ISPAYED, " (select isnull(sum(obp.amount),0) from OA_Baoxiao_Pay obp where obp.BXGID=bx.BXGID)<>isnull(bx.amount,0) ");
//alert("2");
};
/*
var WorkFlow = form.findField("WorkFlow").getValue();
if (WorkFlow)
{ sql = sql + getAndConSql(sql, WorkFlow, " (m.ReceiptStatus is null or m.ReceiptStatus=0 )"); }
*/
/*
var WorkFlowStep=form.findField("WorkFlowStep").getValue();
if (WorkFlowStep!="" && WorkFlowStep!=null ){
var index=this.storeWorkFlowStep.find("GID",WorkFlowStep);
//alert (this.storeWorkFlowStep.getAt(index).get("NAME"));
var STEPNO=this.storeWorkFlowStep.getAt(index).get("STEPNO");
var STEPID=this.storeWorkFlowStep.getAt(index).get("GID");
var BSNOList="";
var returnData=[];
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/WorkFlow/GetWorkFlowBSNO',
scope: this,
async:false,
params: {WorkFlowName:this.WorkFlowName, STEPNO:STEPNO },
waitMsg: "正在查询数据...",
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
//});
sql = sql + getAndConSql(sql, "1>2", " 1>2 ");
//return;
}else{
var jsonresult = Ext.JSON.decode(response.responseText);
returnData = jsonresult.data;
for (var i = 0; i < returnData.length; i++) {
var rec = returnData[i];
if (BSNOList == "") { BSNOList = "'" + rec.BSNO + "'"; }
else { BSNOList = BSNOList + ",'" + rec.BSNO + "'"; }
}
sql = sql + getAndConSql(sql, BSNOList, " BX.BXGID in ("+BSNOList+") ");
}
//this.InWorkFlow=true;
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
}else{
//this.InWorkFlow=false;
}*/
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 records = this.gridList.selModel.getSelection();
DsTruck.BaoxiaoAudit(records, 2, '正在审核数据, 请稍侯..');
InitData();
},
onAuditPassClick: function (button, event) {
//审核通过
//var records = this.MainCB.selected.items;
var records = this.gridList.selModel.getSelection();
DsTruck.BaoxiaoAudit(records, 0,this.WorkFlowName, '正在审核数据, 请稍侯..');
this.onRefreshClick(button, event);
},
onAuditRefuseClick: function (button, event) {
//驳回提交
var records = this.gridList.selModel.getSelection();
var form = this.formReason.getForm();
var Reason = form.findField('Reason').getRawValue();
DsTruck.BaoxiaoAudit(records, 6,this.WorkFlowName, '正在审核数据, 请稍侯..',Reason);
this.onRefreshClick(button, event);
this.winReason.close();
}
});