Ext . namespace ( 'Shipping' ) ;
Shipping . MsRptCustDrCrIndex = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsRptCustDrCrIndex . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsRptCustDrCrIndex , Ext . Panel , {
PageSize : 2000 ,
OprationStatus : null , //仅当弹出界面时使用
SelectedRecord : null ,
sqlcontext : '1=2' ,
bslistsortfield : '' ,
bslistsortdire : '' ,
salelistsortfield : '' ,
salelistsortdire : '' ,
custlistsortfield : '' ,
custlistsortdire : '' ,
oplistsortfield : '' ,
oplistsortdire : '' ,
bssourcelistsortfield : '' ,
bssourcelistsortdire : '' ,
bssourcedetaillistsortfield : '' ,
bssourcedetaillistsortdire : '' ,
initUIComponents : function ( ) {
this . formname = 'MsRptCustDrCrIndex' ;
Ext . define ( 'Accitemsmb' , {
extend : 'Ext.data.Model' ,
idProperty : 'GID' ,
fields : [
{ name : 'GID' , type : 'string' } ,
{ name : 'ACCID' , type : 'string' } ,
{ name : 'ACCNAME' , type : 'string' } ,
{ name : 'ACCIDNAME' , type : 'string' } ,
{ name : 'DC' , type : 'string' } ,
{ name : 'ISFCY' , type : 'string' } ,
{ name : 'REMARKS' , type : 'string' } ,
{ name : 'DETAILED' , type : 'string' }
]
} ) ;
Ext . define ( 'MsFeeCurr' , {
extend : 'Ext.data.Model' ,
idProperty : 'CURR' ,
fields : [
{ name : 'CURR' , type : 'string' } ,
{ name : 'DEFRATE' , type : 'number' }
]
} ) ;
//定义数据集
this . storeList = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
fields : [
{ name : 'ACCYEAR' , type : 'string' } ,
{ name : 'ACCMONTH' , type : 'string' } ,
{ name : 'CUSTNAME' , type : 'string' } ,
{ name : 'CURRENCY' , type : 'string' } ,
{ name : 'UPMONTHDRBAL' , type : 'number' } ,
{ name : 'MONTHDR' , type : 'number' } ,
{ name : 'MONTHDRSTL' , type : 'number' } ,
{ name : 'MONTHDRBAL' , type : 'number' } ,
{ name : 'UPMONTHTTLDRBAL' , type : 'number' } ,
{ name : 'MONTHTTLDR' , type : 'number' } ,
{ name : 'MONTHTTLDRSTL' , type : 'number' } ,
{ name : 'MONTHTTLDRBAL' , type : 'number' } ,
{ name : 'UPMONTHCRBAL' , type : 'number' } ,
{ name : 'MONTHCR' , type : 'number' } ,
{ name : 'MONTHCRSTL' , type : 'number' } ,
{ name : 'MONTHCRBAL' , type : 'number' } ,
{ name : 'UPMONTHTTLCRBAL' , type : 'number' } ,
{ name : 'MONTHTTLCR' , type : 'number' } ,
{ name : 'MONTHTTLCRSTL' , type : 'number' } ,
{ name : 'MONTHTTLCRBAL' , type : 'number' }
] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsRptCustDrCr/CustListData' ,
reader : {
id : '' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//定义Grid
this . initgirdcolums = [ {
sortable : true ,
dataIndex : 'ACCYEAR' ,
text : '年' ,
width : 80
} , {
sortable : true ,
dataIndex : 'ACCMONTH' ,
text : '月' ,
width : 40
} , {
sortable : true ,
dataIndex : 'CUSTNAME' ,
text : '委托单位' ,
width : 110
} , {
sortable : true ,
dataIndex : 'CURRENCY' ,
text : '币别' ,
width : 60
} , {
text : '上月结余' ,
dataIndex : 'UPMONTH' ,
columns : [ {
sortable : true ,
dataIndex : 'UPMONTHDRBAL' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'UPMONTHTTLDRBAL' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'UPMONTHCRBAL' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'UPMONTHTTLCRBAL' ,
text : '应付合计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 : 80
} ]
} , {
text : '本月发生' ,
dataIndex : 'MONTH' ,
columns : [ {
sortable : true ,
dataIndex : 'MONTHDR' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLDR' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHCR' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLCR' ,
text : '应付合计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 : 80
} ]
} , {
text : '本月结算' ,
dataIndex : 'MONTHSTL' ,
columns : [ {
sortable : true ,
dataIndex : 'MONTHDRSTL' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLDRSTL' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHCRSTL' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLCRSTL' ,
text : '应付合计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 : 80
} ]
} , {
text : '本月结余' ,
dataIndex : 'MONTHBAL' ,
columns : [ {
sortable : true ,
dataIndex : 'MONTHDRBAL' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLDRBAL' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHCRBAL' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLCRBAL' ,
text : '应付合计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 : 80
} ]
}
] ;
// this.girdcolums = this.initgirdcolums;
this . girdcolums = DsTruck . GetGridPanel ( USERID , this . formname + 'bs' , this . initgirdcolums , 1 ) ;
this . gridList = new Ext . grid . GridPanel ( {
store : this . storeList ,
enableHdMenu : false ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
viewConfig : {
autoFill : true ,
getRowClass : function ( record , rowIndex , rowParams , store ) {
var feeStatus = record . get ( 'CURRENCY' ) ;
if ( feeStatus == 'USD' ) return 'feestatus_pass' ;
else if ( feeStatus != 'USD' && feeStatus != 'RMB' ) return 'feestatus_refer' ;
}
} ,
columns : this . girdcolums ,
// paging bar on the bottom
bbar : Ext . create ( 'Ext.PagingToolbar' , {
store : this . storeList ,
displayInfo : true ,
displayMsg : '当前显示 {0} - {1}条记录 /共 {2}条记录' ,
emptyMsg : "没有数据"
} )
} ) ;
// this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bs', this.girdcolums, 1);
// this.gridList.reconfigure(this.storeList, this.girdcolums);
this . gridList . addListener ( 'itemdblclick' , function ( dataview , record , item , index , e , b ) {
this . SelectedRecord = record ;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + ( screen . height - 750 ) / 2 + ",Left= " + ( screen . width - 1100 ) / 2
var openType = "_blank" ;
// var openUrl = "/Account/Chfee_settlement/SettementView";
// if (record.data.BILLTYPE == 'M')
// openUrl = "/Account/Chfee_management/CMView";
// if (record.data.BILLTYPE == 'Y')
// openUrl = "/Import/CWAdvancePayment/Edit";
// window.open(openUrl, openType, openSet);
} , this ) ;
_this = this ;
this . storeListSum = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
fields : [
{ name : 'CURRENCY' , type : 'string' } ,
{ name : 'UPMONTHDRBAL' , type : 'number' } ,
{ name : 'MONTHDR' , type : 'number' } ,
{ name : 'MONTHDRSTL' , type : 'number' } ,
{ name : 'MONTHDRBAL' , type : 'number' } ,
{ name : 'UPMONTHTTLDRBAL' , type : 'number' } ,
{ name : 'MONTHTTLDR' , type : 'number' } ,
{ name : 'MONTHTTLDRSTL' , type : 'number' } ,
{ name : 'MONTHTTLDRBAL' , type : 'number' } ,
{ name : 'UPMONTHCRBAL' , type : 'number' } ,
{ name : 'MONTHCR' , type : 'number' } ,
{ name : 'MONTHCRSTL' , type : 'number' } ,
{ name : 'MONTHCRBAL' , type : 'number' } ,
{ name : 'UPMONTHTTLCRBAL' , type : 'number' } ,
{ name : 'MONTHTTLCR' , type : 'number' } ,
{ name : 'MONTHTTLCRSTL' , type : 'number' } ,
{ name : 'MONTHTTLCRBAL' , type : 'number' }
] ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsRptCustDrCr/SumListData' ,
reader : {
id : '' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//定义Grid
this . initgirdsumcolums = [ {
sortable : true ,
dataIndex : 'CURRENCY' ,
text : '币别' ,
width : 60
} , {
text : '上月结余' ,
dataIndex : 'UPMONTH' ,
columns : [ {
sortable : true ,
dataIndex : 'UPMONTHDRBAL' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'UPMONTHTTLDRBAL' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'UPMONTHCRBAL' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'UPMONTHTTLCRBAL' ,
text : '应付合计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 : 80
} ]
} , {
text : '本月发生' ,
dataIndex : 'MONTH' ,
columns : [ {
sortable : true ,
dataIndex : 'MONTHDR' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLDR' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHCR' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLCR' ,
text : '应付合计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 : 80
} ]
} , {
text : '本月结算' ,
dataIndex : 'MONTHSTL' ,
columns : [ {
sortable : true ,
dataIndex : 'MONTHDRSTL' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLDRSTL' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHCRSTL' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLCRSTL' ,
text : '应付合计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 : 80
} ]
} , {
text : '本月结余' ,
dataIndex : 'MONTHBAL' ,
columns : [ {
sortable : true ,
dataIndex : 'MONTHDRBAL' ,
text : '应收' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLDRBAL' ,
text : '应收合计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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHCRBAL' ,
text : '应付' ,
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 : 80
} , {
sortable : true ,
dataIndex : 'MONTHTTLCRBAL' ,
text : '应付合计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 : 80
} ]
}
] ;
// this.girdcolums = this.initgirdcolums;
this . girdsumcolums = DsTruck . GetGridPanel ( USERID , this . formname + 'bssum' , this . initgirdsumcolums , 1 ) ;
this . gridListSum = new Ext . grid . GridPanel ( {
store : this . storeListSum ,
enableHdMenu : false ,
region : 'center' ,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
columns : this . girdsumcolums ,
// paging bar on the bottom
bbar : Ext . create ( 'Ext.PagingToolbar' , {
store : this . storeList ,
displayInfo : true ,
displayMsg : '当前显示 {0} - {1}条记录 /共 {2}条记录' ,
emptyMsg : "没有数据"
} )
} ) ;
//#region formSearch
//#region formSearch枚举参照相关
_this = this ;
//#endregion
this . storeCustCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefList' }
} ) ;
this . storeCustCode . load ( { params : { condition : "" } } ) ;
this . comboxCustCode = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '委托单位' ,
store : this . storeCustCode ,
forceSelection : true ,
name : 'CUSTOMERNAME' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
this . StoreOpLb = Ext . create ( 'DsExt.ux.RefEnumStore' , { } ) ;
this . StoreOpLb . load ( { params : { enumTypeId : 96005 } } ) ;
this . comboxOpLb = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '业务类型' ,
store : this . StoreOpLb ,
forceSelection : true ,
name : 'PS_OPLB' ,
valueField : 'EnumValueName' ,
displayField : 'EnumValueName' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
this . storeSalesCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.UserRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetUserRefList' }
} ) ;
this . storeSalesCode . load ( ) ;
this . comboxSalesCode = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '揽货人' ,
store : this . storeSalesCode ,
forceSelection : true ,
name : 'PS_SALE' ,
valueField : 'UserName' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
this . storeAddDCType = Ext . create ( 'Ext.data.Store' , {
fields : [ 'DC' , 'NAME' ]
} ) ;
this . storeAddDCType . add ( { "DC" : "" , "NAME" : "全部" } ) ;
this . storeAddDCType . add ( { "DC" : "1" , "NAME" : "应收" } ) ;
this . storeAddDCType . add ( { "DC" : "2" , "NAME" : "应付" } ) ;
this . comboxaddDCType = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '收付' ,
store : this . storeAddDCType ,
valueField : 'DC' ,
displayField : 'NAME' ,
// labelWidth: 50,
forceSelection : true ,
name : 'DC' ,
enableKeyEvents : true ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
_this . InitGrid ( ) ;
}
}
}
} ) ;
this . storeSource = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.SourceModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetSource' }
} ) ;
this . storeSource . load ( ) ;
this . storeSourceDetail = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.SourceDetailModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetSourceDetail2' }
} ) ;
this . comboxBSSOURCE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '业务来源' ,
store : this . storeSource ,
forceSelection : true ,
name : 'BSSOURCE' ,
valueField : 'SourceName' ,
displayField : 'SourceName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var recs = DsStoreQueryBy ( this . storeSource , 'SourceID' , records [ 0 ] . data . SourceID ) ;
if ( recs . getCount ( ) > 0 ) {
var data = recs . getAt ( 0 ) . data ;
var s = "SOURCEID='" + data . SourceID + "'" ;
this . storeSourceDetail . load ( { params : { condition : s } } ) ;
} else {
var BSSOURCEDETAIL = this . formSearch . getForm ( ) . findField ( 'BSSOURCEDETAIL' ) ;
BSSOURCEDETAIL . setValue ( '' ) ;
}
}
}
}
} ) ;
Ext . define ( 'SubComp' , {
extend : 'Ext.data.Model' ,
fields : [
{ name : 'GID' , type : 'string' } ,
{ name : 'NAME' , type : 'string' } ,
{ name : 'ENNAME' , type : 'string' }
]
} ) ;
this . StoreSubComp = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'SubComp' ,
proxy : { url : '/MvcShipping/MsBaseInfo/GetCompanyEN' }
} ) ;
this . StoreSubComp . load ( { params : { condition : "" } } ) ;
this . comboxSubComp = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '所属公司' ,
store : this . StoreSubComp ,
name : 'SUBCOMP' ,
// flex: 0.5,
// labelWidth: 55,
valueField : 'GID' ,
displayField : 'NAME' ,
enableKeyEvents : true ,
listeners : {
keyup : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} ) ;
//所属部门
this . storeDept = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.DeptModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetDeptList' }
} ) ;
this . storeDept . load ( ) ;
this . comboxDept = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '所属部门' , //'所属部门',
store : this . storeDept ,
// flex: 0.5,
// labelWidth: 55,
forceSelection : true ,
name : 'SALEDEPT' ,
valueField : 'DeptName' ,
displayField : 'DeptName'
//,hidden: true
} ) ;
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 : [
{
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '统计月份' ,
format : 'Y-m' ,
xtype : 'monthfield' ,
name : 'PS_MONTH' ,
enableKeyEvents : true ,
listeners : {
specialkey : function ( field , e ) {
if ( e . getKey ( ) == e . ENTER ) {
_this . onRefreshClick ( ) ;
}
}
}
} , this . comboxCustCode , this . comboxSalesCode , this . comboxOpLb , this . comboxBSSOURCE , this . comboxSubComp
]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ this . comboxaddDCType , this . comboxDept , {
xtype : 'radiogroup' ,
fieldLabel : '分析对象' ,
id : 'rdOBJNAME' ,
columns : 6 ,
vertical : true ,
flex : 4 ,
items : [
{ id : 'rdoCustome' , boxLabel : '委托单位' , name : 'OBJNAME' , inputValue : 'CUSTOMERNAME' , checked : true } ,
{ id : 'rdoBsSource' , boxLabel : '业务来源' , name : 'OBJNAME' , inputValue : 'BSSOURCE' } ,
{ id : 'rdoBsSourceDetail' , boxLabel : '贸易条款' , name : 'OBJNAME' , inputValue : 'BSSOURCEDETAIL' } ,
{ id : 'rdoSale' , boxLabel : '揽货人' , name : 'OBJNAME' , inputValue : 'SALE' } ,
{ id : 'rdoBsType' , boxLabel : '业务类别' , name : 'OBJNAME' , inputValue : 'OPLBNAME' } ,
] ,
listeners : {
change : function ( rd , newValue , oldValue , eOpts ) {
_this . InitGrid ( ) ;
}
}
} ]
}
] //end items(fieldset 1)
} //end fieldset 1
] //end root items
} ) ;
//#endregion formSearch
//查询工具条
this . CheckSaveQuery = new Ext . form . Checkbox ( {
fieldLabel : '记忆查询条件' ,
checked : true ,
width : 120
} ) ;
_this = this ;
this . SearchBtn = new Ext . Button ( {
text : '隐藏查询' ,
handler : function ( ) {
if ( _this . SearchBtn . text == '隐藏查询' ) {
_this . panelSearch . hide ( ) ;
_this . SearchBtn . setText ( "显示查询" ) ;
} else {
_this . panelSearch . show ( ) ;
_this . SearchBtn . setText ( "隐藏查询" ) ;
}
}
} ) ;
this . panelBtn = new Ext . Panel ( {
region : "north" ,
tbar : [
{
text : "执行查询" ,
iconCls : "btnrefresh" ,
handler : function ( button , event ) {
this . onRefreshClick ( button , event ) ;
var isvisible = true ;
var issavevalue = false ;
if ( _this . SearchBtn . text == '隐藏查询' )
isvisible = true
else
isvisible = false ;
if ( this . CheckSaveQuery . checked )
issavevalue = true
saveQuerySetting ( this . formname , this . formSearch , isvisible , issavevalue ) ;
} ,
scope : this
} , '-' , this . SearchBtn , {
xtype : 'button' ,
width : 90 ,
text : "清空条件" ,
iconCls : "btnreset" ,
handler : function ( button , event ) {
this . onClearSql ( button , event ) ;
} ,
scope : this
} , this . CheckSaveQuery , '-' , {
text : "导出Excel" ,
id : "btnExportExcel" ,
iconCls : 'btnexportexcel' ,
handler : function ( button , event ) {
this . onExportClick ( button , event ) ;
} ,
scope : this
} , '-' ,
{
text : "打印" ,
iconCls : 'btnprint' ,
handler : function ( button , event ) {
this . Print ( ) ;
} ,
scope : this
} , '-' , {
text : "保存列表样式" ,
id : "btntest" ,
menu : [
{ text : "保存列表" ,
handler : function ( button , event ) {
_this . onSaveGridClick ( button , event ) ;
}
} , { text : "列表初始化" ,
handler : function ( button , event ) {
_this . oninitGridClick ( button , event ) ;
}
} ] ,
scope : this
}
]
} ) ;
this . panelTop = new Ext . Panel ( {
layout : "border" ,
region : "north" ,
height : 29 ,
items : [ this . panelBtn ]
} ) ;
this . panelSearch = new Ext . Panel ( {
layout : "border" ,
region : "north" ,
height : 75 ,
items : [ this . formSearch ]
} ) ;
this . panelBody = new Ext . Panel ( {
layout : "border" ,
region : 'center' ,
margin : '0 0' ,
frame : true ,
items : [
this . gridList ]
} ) ;
this . panelSum = new Ext . Panel ( {
title : '合 计' ,
layout : "border" ,
height : 150 ,
region : 'south' ,
margin : '0 0' ,
split : true ,
frame : true ,
items : [ this . gridListSum ]
} ) ;
Ext . apply ( this , {
items : [ this . panelTop , this . panelSearch , this . panelBody , this . panelSum ]
} ) ;
this . storeList . on ( 'beforeload' , function ( store ) {
if ( ! this . checkSearchCondition ( ) )
return ;
var rdOBJNAME = Ext . getCmp ( 'rdOBJNAME' ) ;
var OBJNAME = rdOBJNAME . getValue ( ) ;
var sql = this . getCondition ( ) ;
Ext . apply ( store . proxy . extraParams , { condition : sql , groupfield : OBJNAME } ) ;
} , this ) ;
var gcolumns = this . gridList . columns ;
LoadQueryData ( this . formname , this . formSearch , this . CheckSaveQuery ) ;
this . LoadPeriod ( ) ;
} , //end initUIComponents
InitGrid : function ( ) {
var form = this . formSearch . getForm ( ) ;
var rdOBJNAME = Ext . getCmp ( 'rdOBJNAME' ) ;
var rOBJNAME = rdOBJNAME . getValue ( ) ;
var DC = form . findField ( 'DC' ) . getValue ( ) ;
var objnamestr = '委托单位' ;
var OBJNAME = rOBJNAME . OBJNAME ;
if ( OBJNAME == 'BSSOURCE' ) objnamestr = '业务来源'
else if ( OBJNAME == 'BSSOURCEDETAIL' ) objnamestr = '贸易条款'
else if ( OBJNAME == 'SALE' ) objnamestr = '贸易条款'
else if ( OBJNAME == 'OPLBNAME' ) objnamestr = '业务类别' ;
var agirdcolums = this . initgirdcolums ;
for ( var j = 0 ; j < agirdcolums . length ; j ++ ) {
if ( agirdcolums [ j ] . dataIndex == 'CUSTNAME' ) {
agirdcolums [ j ] . text = objnamestr ;
}
if ( DC == '1' ) {
if ( agirdcolums [ j ] . dataIndex == 'UPMONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHSTL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHBAL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
} else if ( DC == '2' ) {
if ( agirdcolums [ j ] . dataIndex == 'UPMONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHSTL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHBAL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
}
}
this . gridList . reconfigure ( this . storeList , agirdcolums ) ;
agirdcolums = this . initgirdsumcolums ;
for ( var j = 0 ; j < agirdcolums . length ; j ++ ) {
if ( DC == '1' ) {
if ( agirdcolums [ j ] . dataIndex == 'UPMONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHSTL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHBAL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
}
}
} else if ( DC == '2' ) {
if ( agirdcolums [ j ] . dataIndex == 'UPMONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'UPMONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTH' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDR' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHSTL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRSTL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
if ( agirdcolums [ j ] . dataIndex == 'MONTHBAL' ) {
for ( var m = 0 ; m < agirdcolums [ j ] . columns . length ; m ++ ) {
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLCRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = false ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
if ( agirdcolums [ j ] . columns [ m ] . dataIndex == 'MONTHTTLDRBAL' ) {
agirdcolums [ j ] . columns [ m ] . hidden = true ;
}
}
}
}
}
this . gridListSum . reconfigure ( this . storeListSum , agirdcolums ) ;
this . onRefreshClick ( ) ;
} ,
LoadPeriod : function ( opstatus ) {
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/Account/ChMonthClose/GetNowPeriod' ,
params : {
condition : ''
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
return ;
}
data = result . data ;
this . formSearch . getForm ( ) . findField ( 'PS_MONTH' ) . setValue ( data . CLOSEPERIOD ) ;
this . onRefreshClick ( ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
onRefreshClick : function ( button , event ) {
if ( ! this . checkSearchCondition ( ) )
return ;
var form = this . formSearch . getForm ( ) ;
var PS _MONTH = form . findField ( 'PS_MONTH' ) . getRawValue ( ) ;
if ( PS _MONTH == '' || PS _MONTH == null || PS _MONTH == undefined ) {
Ext . Msg . alert ( '提示' , '统计月份不能为空!' ) ;
return ;
}
var rdOBJNAME = Ext . getCmp ( 'rdOBJNAME' ) ;
var OBJNAME = rdOBJNAME . getValue ( ) ;
var sql = this . getCondition ( ) ;
this . sqlcontext = sql ;
this . storeList . load ( {
params : { start : 0 , limit : this . PageSize , condition : sql , groupfield : OBJNAME } ,
waitMsg : "正在查询数据..." ,
scope : this
} ) ;
this . storeListSum . load ( {
params : { condition : sql } ,
waitMsg : "正在查询数据..." ,
scope : this
} ) ;
} ,
getCondition : function ( ) {
var form = this . formSearch . getForm ( ) ;
var sql = '' ;
var PS _MONTH = form . findField ( 'PS_MONTH' ) . getRawValue ( ) ;
var myDate = new Date ( PS _MONTH + '-01' ) ;
var myyear = myDate . getFullYear ( ) ;
var mymonth = myDate . getMonth ( ) ;
var mymonth = Add ( mymonth , 1 ) ;
sql = sql + getAndConSql ( sql , myyear , " YEAR='" + myyear + "'" ) ;
sql = sql + getAndConSql ( sql , mymonth , " MONTH='" + mymonth + "'" ) ;
var CUSTOMERNAME = form . findField ( 'CUSTOMERNAME' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , CUSTOMERNAME , "CUSTOMERNAME='" + CUSTOMERNAME + "'" ) ;
var SALE = form . findField ( 'PS_SALE' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SALE , "SALE='" + SALE + "'" ) ;
var SALEDEPT = form . findField ( 'SALEDEPT' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SALEDEPT , "SALEDEPT='" + SALEDEPT + "'" ) ;
var OPLB = form . findField ( 'PS_OPLB' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , OPLB , "OPLBNAME='" + OPLB + "'" ) ;
var SUBCOMP = form . findField ( 'SUBCOMP' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , SUBCOMP , "CORPID='" + SUBCOMP + "'" ) ;
var BSSOURCE = form . findField ( 'BSSOURCE' ) . getValue ( ) ;
sql = sql + getAndConSql ( sql , BSSOURCE , "BSSOURCE='" + BSSOURCE + "'" ) ;
var DC = form . findField ( 'DC' ) . getValue ( ) ;
if ( DC == '1' ) {
sql = sql + ' and (UPMONTHDRBAL<>0 or MONTHDR<>0 or MONTHDRSTL<>0 or MONTHDRBAL<>0 or UPMONTHTTLDRBAL<>0 or MONTHTTLDR<>0 or MONTHTTLDRSTL<>0 or MONTHTTLDRBAL<>0) ' ;
}
if ( DC == '2' ) {
sql = sql + ' and (UPMONTHCRBAL<>0 or MONTHCR<>0 or MONTHCRSTL<>0 or MONTHCRBAL<>0 or UPMONTHTTLCRBAL<>0 or MONTHTTLCR<>0 or MONTHTTLCRSTL<>0 or MONTHTTLCRBAL<>0) ' ;
}
return sql ;
} ,
checkSearchCondition : function ( ) {
var form = this . formSearch . getForm ( ) ;
if ( ! form . isValid ( ) ) {
Ext . Msg . alert ( '提示' , '查询条件赋值错误,请检查。' ) ;
return false ;
}
return true ;
} ,
onClearSql : function ( ) {
var form = this . formSearch . getForm ( ) ;
form . reset ( ) ;
} ,
OprationSwap : function ( ) {
var ret = new Array ( ) ;
ret [ 0 ] = this . OprationStatus ;
ret [ 1 ] = this . storeList ;
ret [ 2 ] = this . SelectedRecord ;
ret [ 3 ] = "MsRptCustDrCrIndex" ;
return ret ;
} ,
onSaveGridClick : function ( button , event ) {
this . girdcolums = DsTruck . SaveGridPanel ( USERID , this . formname + 'bs' , this . gridList . columns , this . girdcolums , 1 , true ) ;
} ,
oninitGridClick : function ( button , event ) {
var agirdcolums = this . initgirdcolums ;
this . gridList . reconfigure ( this . storeList , agirdcolums ) ;
this . girdcolums = DsTruck . SaveGridPanel ( USERID , this . formname + 'bs' , this . gridList . columns , this . initgirdcolums , 1 , true ) ;
} ,
onExportClick : function ( button , event ) {
grid2Excel ( this . gridList , '应收应付总账' ) ;
} ,
Print : function ( ) {
_this = this ;
if ( this . storeList . getCount ( ) == 0 ) {
return ;
}
var form = this . formSearch . getForm ( ) ;
var PS _MONTH = form . findField ( 'PS_MONTH' ) . getRawValue ( ) ;
if ( PS _MONTH == '' || PS _MONTH == null || PS _MONTH == undefined ) {
Ext . Msg . alert ( '提示' , '统计月份不能为空!' ) ;
return ;
}
var rdOBJNAME = Ext . getCmp ( 'rdOBJNAME' ) ;
var ROBJNAME = rdOBJNAME . getValue ( ) ;
var OBJNAME = ROBJNAME . OBJNAME ;
Ext . Msg . wait ( '正在组织数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在组织数据...' ,
url : '/MvcShipping/MsRptCustDrCr/CustListData' ,
scope : this ,
params : {
start : 0 , limit : this . PageSize ,
condition : _this . sqlcontext ,
groupfield : OBJNAME ,
printstr : 'true'
} ,
callback : function ( options , success , response ) {
if ( success ) {
Ext . MessageBox . hide ( ) ;
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
var returnstr = jsonresult . Data ;
var printType = 'MSRPTCUSTDRCR' ;
var sql1 = returnstr ;
var sql2 = "" ;
var sql3 = "" ;
var sql4 = "" ;
var sql5 = "" ;
var sql6 = "" ;
PrintComm ( printType , sql1 , sql2 , sql3 , sql4 , sql5 , sql6 ) ;
} else {
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
} else {
Ext . Msg . show ( { title : '请重试' ,
msg : '服务器响应出错' ,
icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK
} ) ;
}
}
} ) ;
}
} ) ;