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 : 'Baoxiaomb' ,
remoteSort : false ,
pageSize : this . PageSize ,
proxy : {
type : 'ajax' ,
url : '/OA/Baoxiao/GetDataList' ,
reader : {
idProperty : 'Feeid' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
this . formname = "OA_Baoxiao" ;
this . WorkFlowName = "BaoxiaoMod" ;
//this.InWorkFlow=false;
//枚举参照
this . column = [ {
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
} ] ;
//定义Grid
this . BXCB = Ext . create ( 'Ext.selection.CheckboxModel' , { checkOnly : true } ) ;
Ext . grid . RowNumberer = Ext . extend ( Ext . grid . RowNumberer , {
width : 45
} ) ;
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 : "没有数据"
} )
} ) ;
/////////////以下部分为获取存储的gridpanel显示样式
this . column = DsTruck . GetGridPanel ( USERID , this . formname , this . column ) ;
//使用者id, 表名 , 中间column数组, 跳过一开始的几列
this . column . unshift ( new Ext . grid . RowNumberer ( ) ) ;
this . gridList . reconfigure ( this . storeList , this . column ) ;
////////////////////////////
this . gridList . addListener ( 'itemdblclick' , function ( dataview , record , item , index , e , b ) {
this . SelectedRecord = record ;
this . OprationStatus = 'edit' ;
DsOpenEditWin ( "/TruckMng/Baoxiao/Edit" , "" , "620" , "1000" ) ;
} , this ) ;
/ * t h i s . g r i d L i s t . a d d L i s t e n e r ( ' i t e m d b l c l i c k ' , f u n c t i o n ( d a t a v i e w , r e c o r d , i t e m , i n d e x , e , b ) {
alert ( record . get ( "ContractNo" ) )
} , this ) ; * /
//#region formSearch
this . storeDEPT = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsTruckMng.ux.DEPTRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetDeptList_All_Group' } //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_1" ,
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
} ) ;
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 : [ this . comboxISPAYED ,
{
fieldLabel : '费用金额' ,
name : 'Fee_Amount'
} , {
fieldLabel : '支票号' ,
name : 'CHEQUENUM'
} ,
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 : [ ]
} //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 ( "/TruckMng/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
} , '-' ,
{
// id: "saveandclose",
text : "提交审核" , id : "Submit" ,
handler : function ( button , event ) {
this . onSubmitAuditClick ( ) ;
} ,
scope : this
} ,
{
// id: "saveandclose",
text : "撤回提交" , id : "CallBack" ,
handler : function ( button , event ) {
this . onCallBackClick ( ) ;
} ,
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
} , '-' , {
text : "生成凭证" ,
iconCls : "btnadd" , id : "VOUCHER" ,
handler : function ( button , event ) {
var form = this . formVoucherShow . getForm ( ) ;
var VoucherDate = form . findField ( 'VoucherDate' ) ;
this . thisday = this . getToday ( ) ;
VoucherDate . setRawValue ( this . thisday )
this . winVoucherShow . show ( ) ;
} ,
scope : this
}
]
} ) ;
/////////////生成凭证对话框
this . CheckRate = new Ext . form . Checkbox ( {
fieldLabel : '显示已生成凭证' ,
checked : true
} ) ;
this . formVoucherShow = 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 : '凭证日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'VoucherDate'
} , this . comboxUser
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '美元汇率' ,
xtype : 'numberfield' ,
name : 'UsdExrate'
} , this . CheckRate
]
}
] //end items(fieldset 1)
} //end fieldset 1
] //end root items
} ) ;
me = this ;
this . winVoucherShow = 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 . formVoucherShow ] ,
buttons : [ {
text : "生成凭证" ,
minWidth : 70 ,
handler : function ( ) {
var selectedRecords = me . gridList . selModel . getSelection ( ) ;
if ( selectedRecords . length == 0 ) {
Ext . Msg . show ( { title : '提示' , msg : '没有选择要生成凭证的业务!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
var form = me . formVoucherShow . getForm ( ) ;
var VoucherDate = form . findField ( 'VoucherDate' ) . getRawValue ( ) ;
if ( VoucherDate == '' || VoucherDate == null || VoucherDate == undefined ) {
Ext . Msg . show ( { title : '提示' , msg : '必须填凭证日期!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
var UsdExrate = form . findField ( 'UsdExrate' ) . getValue ( ) ;
if ( ! me . CheckRate . checked ) {
if ( UsdExrate == '' || UsdExrate == null || UsdExrate == undefined ) {
Ext . Msg . show ( { title : '提示' , msg : '必须填凭证汇率!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
} ;
var User = me . comboxUser . getValue ( ) ;
if ( User == '' || User == null || User == undefined ) {
Ext . Msg . show ( { title : '提示' , msg : '必须填凭证制单人!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
me . onCreateVoucherClick ( ) ;
}
} , {
text : "关闭" ,
minWidth : 70 ,
handler : function ( ) {
me . winVoucherShow . close ( ) ;
}
} ]
} ) ;
this . panelTop = new Ext . Panel ( {
layout : "border" ,
region : "north" ,
height : 125 ,
items : [ this . formSearch , this . panelBtn ]
} ) ;
Ext . apply ( this , {
items : [ this . panelTop , this . gridList ]
} ) ;
this . InitData ( ) ;
//集中绑定事件
this . storeList . on ( 'beforeload' , function ( store ) {
var sql = this . getCondition ( ) ;
Ext . apply ( store . proxy . extraParams , { condition : sql } ) ;
} , this ) ;
} , //end initUIComponents
onCreateVoucherClick : function ( button , event ) {
var feeBSNOSql = '' ;
var selectedRecords = this . gridList . selModel . getSelection ( ) ;
var form = this . formVoucherShow . getForm ( ) ;
var zhaiyao = "" ;
if ( selectedRecords . length != 1 ) {
Ext . Msg . show ( { title : '提示' , msg : '只能每报销单生成一个凭证' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
var this _deptid = "" ;
for ( var i = 0 ; i < selectedRecords . length ; i ++ ) {
var rec = selectedRecords [ i ] ;
if ( rec . data . BXSTATUS _REF == '审核通过' ) {
if ( rec . data . ISVOU _REF != '是' ) {
var feeBSNO = "'" + rec . data . BXGID + "'" ;
if ( feeBSNOSql == '' ) {
feeBSNOSql = feeBSNO ;
} else {
feeBSNOSql = feeBSNOSql + "," + feeBSNO ;
}
if ( zhaiyao == "" ) {
if ( rec . data . BXNO != "" ) {
zhaiyao = "报销单(" + rec . data . BXNO + "/" + rec . data . BXGID + ")" ;
} else {
zhaiyao = "报销单(" + rec . data . BXGID + ")" ;
}
} else {
//zhaiyao = " 等";
}
this _deptid = rec . data . DEPTNAME ;
}
}
}
if ( feeBSNOSql == '' ) {
Ext . Msg . show ( { title : '提示' , msg : '没有选择要生成凭证的业务,必须是没有生成凭证的业务!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
} ;
feeBSNOSql = " (" + feeBSNOSql + ")" ;
var VoucherDate = form . findField ( 'VoucherDate' ) . getRawValue ( ) ;
var UsdExrate = form . findField ( 'UsdExrate' ) . getValue ( ) ;
var User = this . comboxUser . getValue ( ) ;
var useRate = 1 ;
if ( ! this . CheckRate . checked ) { useRate = 0 } ;
Ext . Ajax . request ( {
waitMsg : '正在添加数据...' ,
url : '/TruckMng/Baoxiao/CreateVoucher' ,
params : {
VoucherDate : VoucherDate ,
UsdExrate : UsdExrate ,
User : User ,
useRate : useRate ,
feesql : feeBSNOSql ,
DEPTGID : this _deptid ,
zhaiyao : zhaiyao
} ,
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 . winVoucherShow . close ( ) ;
this . onRefreshClick ( ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
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
} ) ;
//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
//var STEPNO=this.storeWorkFlowStep.getAt(index).get("STEPNO");
} , //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_1" ) . 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 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 + "%' or remark like '%" + FEENAME + "%') or BX.Remark 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 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 , "BaoxiaoMod" , '正在审核数据, 请稍侯..' ) ;
InitData ( ) ;
} ,
onCallBackClick : function ( button , event ) {
//提交审核
var records = this . gridList . selModel . getSelection ( ) ;
DsTruck . BaoxiaoAudit ( records , 1 , "BaoxiaoMod" , '正在审核数据, 请稍侯..' ) ;
InitData ( ) ;
} ,
onAuditPassClick : function ( button , event ) {
//审核通过
//var records = this.MainCB.selected.items;
var records = this . gridList . selModel . getSelection ( ) ;
DsTruck . BaoxiaoAudit ( records , 0 , "BaoxiaoMod" , '正在审核数据, 请稍侯..' ) ;
this . onRefreshClick ( button , event ) ;
} ,
onAuditRefuseClick : function ( button , event ) {
//驳回提交
var records = this . gridList . selModel . getSelection ( ) ;
DsTruck . BaoxiaoAudit ( records , 6 , "BaoxiaoMod" , '正在审核数据, 请稍侯..' ) ;
this . onRefreshClick ( button , event ) ;
}
} ) ;