js-pkg
Version:
Npm package of Syncfusion.JavaScript.
10 lines • 82.6 kB
JavaScript
/*!
* filename: ej.olap.base.min.js
* version : 15.3.0.33
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
(function(n){typeof define=="function"&&define.amd?define(["./../common/ej.core.min"],n):n()})(function(){(function(n,t,i){t.olap=t.olap||{};t.olap.base={_initProperties:function(){this._columnHeaders=[];this._rowHeaders=[];this._valueCells=[];this.pivotEngine=[];this.olapCtrlObj=null;this._cBIndx=null;this._rBIndx=null;this._OlapDataSource;this._measureDt={};this._cTotIndexInfo=null;this._rTotIndexInfo=null;this._kpi=null;this._rowCount=0;this._colCount=0;this._isPaging=!1;this._indexRCell=0;this._indexCCell=0},_initControlProperties:function(n){n._drilledCellSet=n.model.enablePaging||n.model.enableVirtualScrolling?t.isNullOrUndefined(n._drilledCellSet)?[]:n._drilledCellSet:[];n.XMLACellSet=null;(t.isNullOrUndefined(n._fieldData)||!t.isNullOrUndefined(n._fieldData)&&t.isNullOrUndefined(n._fieldData.hierarchy))&&this._getFieldItemsInfo(n);this._currIndex={};this._isRowDrilled=!1;this._isColDrilled=!1;this._isNoSummary=n.model.layout=="nosummaries"?!0:!1},getJSONData:function(n,i,r){var u,o,e,f;n.action&&(n.action=="initialLoad"||n.action=="navPaging")&&(this._initControlProperties(r),this._applyTrim(r));this._initProperties();this.olapCtrlObj=r;this._OlapDataSource=i;u="";o=i.data;r.model.enableGroupingBar&&r._createGroupingBar(i);this._isPaging=this.olapCtrlObj.model.enablePaging||this.olapCtrlObj.model.enableVirtualScrolling?!0:!1;u=i.MDXQuery?i.MDXQuery:this._getParsedMDX(i,i.cube,n.action&&n.action!="navPaging"&&this._isPaging&&!t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?!0:!1);f=this._getConnectionInfo(this.olapCtrlObj.model.dataSource.data);e=t.isNullOrUndefined(i.providerName)||i.providerName==t.olap.Providers.SSAS?'<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Header><\/Header> <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> <Command> <Statement> '+u+" <\/Statement> <\/Command> <Properties> <PropertyList> <Catalog>"+i.catalog+"<\/Catalog> <LocaleIdentifier>"+f.LCID+"<\/LocaleIdentifier> <\/PropertyList> <\/Properties><\/Execute> <\/Body> <\/Envelope>":'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><Execute xmlns="urn:schemas-microsoft-com:xml-analysis"><Command><Statement><![CDATA['+u+"]\]><\/Statement><\/Command><Properties><PropertyList><DataSourceInfo>"+i.sourceInfo+"<\/DataSourceInfo><Catalog>"+i.catalog+"<\/Catalog><AxisFormat>TupleFormat<\/AxisFormat><Content>Data<\/Content><Format>Multidimensional<\/Format><\/PropertyList><\/Properties><\/Execute><\/SOAP-ENV:Body><\/SOAP-ENV:Envelope>";n.action!="drilldown"||this._isPaging?this.olapCtrlObj.doAjaxPost("POST",f.url,{XMLA:e},n.action&&n.action!="navPaging"&&this._isPaging&&!t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?this._generatePagingData:this._generateJSONData,null,n):this.olapCtrlObj.doAjaxPost("POST",f.url,{XMLA:e},this._onDemandExpand,null,n)},_getParsedMDX:function(n,r,u){var o,e,f,c,s,h;if(n!=i){if(o="",s=n.providerName==t.olap.Providers.Mondrian,s&&n.columns.length==0&&!(n.values[0].axis=="columns"&&n.values[0].measures.length>0))return"";e=t.olap._mdxParser._getRowMDX(n);f=t.olap._mdxParser._getcolumnMDX(n);delete n._isCollapse;e=e.length>0?this._isPaging&&!u||s?"("+e+")":"NON EMPTY("+e+")":"";f=f.length>0?this._isPaging&&!u||s?"("+f+")":"NON EMPTY("+f+")":"";!this._isPaging||u||t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)||(h=this._getPagingQuery(e,f),e=h.rowQuery,f=h.columnQuery);c=t.olap._mdxParser._getSlicerMDX(n,this.olapCtrlObj);o="\nSelect \n"+(f==""?"{}":f)+"\ndimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON COLUMNS \n"+(e==""?"":","+e+"\ndimension properties MEMBER_TYPE,CHILDREN_CARDINALITY, PARENT_UNIQUE_NAME ON ROWS")+"\n "+t.olap._mdxParser._getIncludefilterQuery(n,r,this.olapCtrlObj)+c+"\n CELL PROPERTIES VALUE, FORMAT_STRING, FORMATTED_VALUE \n ";f==""&&o.replace(/NON EMPTY/g," ")}return o},_getPagingQuery:function(n,t){var i=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)==0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj._categCurrentPage)&&this._colCount>0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize):this.olapCtrlObj._categCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage),r=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)==0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj._seriesCurrentPage)&&this._rowCount>0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize):this.olapCtrlObj._seriesCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage),u=n;return{rowQuery:n!=""?"SUBSET({NONEMPTY("+n+(t!=""?","+t:"")+")},"+((r==0?1:r)-1)*this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize+","+this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize+")":"",columnQuery:t!=""?"SUBSET({NONEMPTY("+t+(u!=""?","+u:"")+")},"+((i==0?1:i)-1)*this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize+","+this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize+")":""}},_getAxisElementsUName:function(n){for(var i="",t=0;t<n.length;t++)i+=i==""?"{"+n[t].uniqueName+"}":", {"+n[t].uniqueName+"}";return i},_generatePagingData:function(i,r){var u,f,e;if(n(r).find("Error").length>0)return this.olapCtrlObj._createErrorDialog(n(r).find("faultstring").text(),i.action),!1;u=n(r).find("Axes, CellData");this._rowCount=n(u.find("Axis[name|='Axis1'] Tuples")).length>0?n(u.find("Axis[name|='Axis1'] Tuples")[0]).children().length:0;this._colCount=n(u.find("Axis[name|='Axis0'] Tuples")).length>0?n(u.find("Axis[name|='Axis0'] Tuples")[0]).children().length:0;f=this._getParsedMDX(this.olapCtrlObj.model.dataSource,this.olapCtrlObj.model.dataSource.cube,!1);e=this._getConnectionInfo(this.olapCtrlObj.model.dataSource.data);this.olapCtrlObj.doAjaxPost("POST",e.url,{XMLA:t.olap._mdxParser.getSoapMsg(f,this.olapCtrlObj.model.dataSource.data,this.olapCtrlObj.model.dataSource.catalog)},this._generateJSONData,null,i)},_generateJSONData:function(r,u){var o,s,h,p,b,w,c,a,v,f,e,y,l;if(this.olapCtrlObj.model.dataSource=this._OlapDataSource,this._isPaging&&r.action=="drilldown"&&this._onDemandExpand(r,u),o=[],s=[],n(u).find("Error").length>0)return t.Pivot._createErrorDialog(n(u).find("faultstring").text(),"Error",this.olapCtrlObj),!1;if(n(u).find("Axis[name|='SlicerAxis']").remove(),this.olapCtrlObj.XMLACellSet=n(u).find("Axes, CellData"),b=[],r=="onDemandDrill"&&(this.olapCtrlObj.XMLACellSet=u),h=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple"),p=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple"),h.length>0){if(w=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),this._rowHeaders=this._getHeaderCollection(p,"rowheader"),this._columnHeaders=this._getHeaderCollection(h,"colheader"),this._valueCells=this._getValueCells(w,h.length),this._indexRCell=this._measureDt.axis=="rowheader"?t.sum(this._rowHeaders.maxLvlLen)+1:t.sum(this._rowHeaders.maxLvlLen),this._indexCCell=this._measureDt.axis=="colheader"?t.sum(this._columnHeaders.maxLvlLen)+1:t.sum(this._columnHeaders.maxLvlLen),this._rowHeaders.headers.length>0&&t.sum(this._rowHeaders.maxLvlLen)==0&&(this._indexRCell=this._rowHeaders.headers[0].length),this._columnHeaders.headers.length>0&&t.sum(this._columnHeaders.maxLvlLen)==0&&(this._indexCCell=this._columnHeaders.headers[0].length),this._isPaging)for(f=0;f<this._rowHeaders.headers.length;f++)for(e=0;e<this._columnHeaders.headers.length;e++)t.isNullOrUndefined(this._valueCells[f])?(this._valueCells[f]=[],this._valueCells[f][e]={FormatString:"#,#",Value:""}):t.isNullOrUndefined(this._valueCells[f][e])&&(this._valueCells[f][e]={FormatString:"#,#",Value:""});for(this._populateEngine(this._rowHeaders.headers,this._columnHeaders.headers,this._valueCells),n(this.olapCtrlObj).find(".e-pivotGridTable").remove(),this.olapCtrlObj._measureDt=this._measureDt,c=this._rowHeaders.headers.length+this._indexCCell,a=this._columnHeaders.headers.length+this._indexRCell,this.pivotEngine.length>1&&(c=this.pivotEngine.length),f=0;f<c;f++)for(e=0;e<a;e++)o[e]==i&&(o[e]=[]),this.pivotEngine[f]!=i&&this.pivotEngine[f][e]!=i?(o[e][f]={Index:e+","+f,CSS:this.pivotEngine[f][e].CSS==""?"none":this.pivotEngine[f][e].CSS==i?"value":this.pivotEngine[f][e].CSS,Value:this.pivotEngine[f][e].Value,State:this.pivotEngine[f][e].ChildCount>0?2:this.pivotEngine[f][e].ChildCount<0?1:0,RowSpan:this.pivotEngine[f][e].RowSpan!=i?this.pivotEngine[f][e].RowSpan:1,ColSpan:this.pivotEngine[f][e].ColSpan!=i?this.pivotEngine[f][e].ColSpan:1,Info:this.pivotEngine[f][e].UName+"::"+this.pivotEngine[f][e].LName+"::"+this.pivotEngine[f][e].Value+"::"+this.pivotEngine[f][e].PUName,Span:this.pivotEngine[f][e].Span=="Block"?"Block":"None",Expander:1},this.pivotEngine[f][e].kpiInfo&&(o[e][f].kpi=this.pivotEngine[f][e].kpi,o[e][f].kpiInfo=this.pivotEngine[f][e].kpiInfo),this.pivotEngine[f][e].ActualValue&&(o[e][f].ActualValue=this.pivotEngine[f][e].ActualValue,o[e][f].Format=this.pivotEngine[f][e].FormatString)):this.pivotEngine[f]!=i&&(v="none",f<this._indexCCell&&e<this._indexRCell&&(v="rowheader"),o[e][f]={Index:e+","+f,CSS:v,Value:"",State:0,RowSpan:1,ColSpan:1,Info:"",Span:"Block",Expander:0});for(f=0;f<a;f++)for(e=0;e<c;e++)o[f]!=i&&o[f][e]!=i&&s.push(o[f][e]);for(y=0,l=0;l<s.length;l++)if(parseInt(s[l].Index.split(",")[0])==0)y++;else break}this.olapCtrlObj._pivotRecords={records:s,rowCount:y};typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotGrid"?typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotChart"&&typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotGauge"&&typeof this.olapCtrlObj.model.dataSource.data=="string"&&this.olapCtrlObj.pluginName!="ejPivotTreeMap"?(this._renderPager(r),this.olapCtrlObj.generateJSON({baseObj:this,tranposeEngine:o,jsonObj:s})):this.olapCtrlObj.generateJSON({baseObj:this},o):this._renderPivotGrid(r,s);this._columnHeaders=this._rowHeaders=this._valueCells=this.pivotEngine=[];this._cBIndx=this._rBIndx=null;this._measureDt={axis:"",posision:null};this._cTotIndexInfo=this._rTotIndexInfo=null},_renderPager:function(n){var i,r,u,f;this._isPaging&&n.action!="navPaging"&&(t.isNullOrUndefined(this.olapCtrlObj.model.dataSource.pagerOptions)?this.olapCtrlObj.model.enablePaging&&(u={CategorialCurrentPage:1,CategorialPageSize:1,SeriesCurrentPage:1,SeriesPageSize:1},f={Column:1,Row:1},this.olapCtrlObj._pagerObj.initPagerProperties(f,u),this.olapCtrlObj._pagerObj.element.css("opacity","0.5"),this.olapCtrlObj._pagerObj.element.find(".e-pagerTextBox").attr("disabled","disabled"),this.olapCtrlObj._pagerObj._unwireEvents()):(i=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage)==0?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize)<parseInt(this.olapCtrlObj._categCurrentPage)?Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize):this.olapCtrlObj._categCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage),r=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)||parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage)==0?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)<parseInt(this.olapCtrlObj._seriesCurrentPage)?Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize):this.olapCtrlObj._seriesCurrentPage:parseInt(this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage),i=i==0?1:i,r=r==0?1:r,this._colCount=this._colCount==0?1:this._colCount,this._rowCount=this._rowCount==0?1:this._rowCount,this.olapCtrlObj.model.enablePaging?(u={CategorialCurrentPage:i,CategorialPageSize:this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize,SeriesCurrentPage:r,SeriesPageSize:this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize},f={Column:this._colCount,Row:this._rowCount},this.olapCtrlObj._pagerObj.element.css("opacity","1"),this.olapCtrlObj._pagerObj.element.find(".e-pagerTextBox").removeAttr("disabled"),this.olapCtrlObj._pagerObj._unwireEvents(),this.olapCtrlObj._pagerObj._wireEvents(),this.olapCtrlObj._pagerObj.initPagerProperties(f,u)):this.olapCtrlObj.model.enableVirtualScrolling&&(this.olapCtrlObj._categPageCount=Math.ceil(this._colCount/this.olapCtrlObj.model.dataSource.pagerOptions.categoricalPageSize),this.olapCtrlObj._seriesPageCount=Math.ceil(this._rowCount/this.olapCtrlObj.model.dataSource.pagerOptions.seriesPageSize)),this.olapCtrlObj.model.dataSource.pagerOptions.categoricalCurrentPage=this.olapCtrlObj.model.dataSource.pagerOptions.seriesCurrentPage=0,this.olapCtrlObj._categCurrentPage=i,this.olapCtrlObj._seriesCurrentPage=r,t.isNullOrUndefined(this.olapCtrlObj._pivotGrid)||(this.olapCtrlObj._pivotGrid._categCurrentPage=i,this.olapCtrlObj._pivotGrid._seriesCurrentPage=r,this.olapCtrlObj._pivotGrid._categPageCount=this.olapCtrlObj._categPageCount,this.olapCtrlObj._pivotGrid._seriesPageCount=this.olapCtrlObj._seriesPageCount)))},_renderPivotGrid:function(n,i){this.olapCtrlObj._dataModel="XMLA";this.olapCtrlObj.setJSONRecords(JSON.stringify(i));this.olapCtrlObj.setOlapReport(this.olapCtrlObj.model.dataSource);this._renderPager(n);this.olapCtrlObj.model.enableGroupingBar&&this.olapCtrlObj._createGroupingBar(this.olapCtrlObj.model.dataSource);this.olapCtrlObj.model.layout!=null&&this.olapCtrlObj.layout().toLowerCase()==t.PivotGrid.Layout.ExcelLikeLayout?this.olapCtrlObj.excelLikeLayout(i):this.olapCtrlObj.renderControlFromJSON(i);n.action&&(n.action=="initialLoad"||n.action=="navPaging")&&(this.olapCtrlObj._trigger("renderSuccess",this.olapCtrlObj),this.olapCtrlObj._fieldData={hierarchy:this.olapCtrlObj._fieldData.hierarchy,measures:this.olapCtrlObj._fieldData.measures})},_onDemandExpand:function(t,i){var ot=i,e,rt,r="",o=this.olapCtrlObj.XMLACellSet,k,d,g=n(this.olapCtrlObj.XMLACellSet).find("Axis[name='Axis0'] Tuple").length,l=n(this.olapCtrlObj.XMLACellSet).find("Axis[name='Axis1'] Tuple").length,p,ut=0,ft=0,c,u,tt,et,f,it;l=l?l:1;ut=n(i).find("CellData Cell").length;ft=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell").length;rt=t.cellInfo.previousElements.split(">#>");var a=n(i).find("Axis[name|='Axis0'] Tuple"),v=n(i).find("Axis[name|='Axis1'] Tuple"),k=a.length;d=v.length;n(i).find("Axis[name='SlicerAxis']").remove();var nt=t.cellInfo.itemPosition,y,w,s=0,h=!1,b="";for(w=t.cellInfo.axis=="rowheader"?v[0]:a[0],r=y=n(w).find("Member:nth-child("+(nt+1)+") PARENT_UNIQUE_NAME").text(),c=nt+1;c>0;c--)o=n(o).find("Tuple Member:nth-child("+c+") UName:contains('"+y+"')").parents("tuple"),y=n(w).find("Member:nth-child("+(c-1)+") UName").text(),b=y+b;if(r=b+r,p=o.index()+1,r=t.cellInfo.previousElements.split(">#>").join().replace(/,/g,""),e=t.cellInfo.preRepItm.split(">#>").join().replace(/,/g,""),this.olapCtrlObj._drilledCellSet&&(s=this.olapCtrlObj._drilledCellSet.length),r=r+" !#"+t.cellInfo.axis,this.olapCtrlObj._drilledCellSet[0]&&s)for(u=0;u<s;u++){for(tt=this.olapCtrlObj._drilledCellSet[u].length,et=t.cellInfo.parentUniqueName,f=0;f<tt;f++)if(t.cellInfo.previousElements.startsWith(this.olapCtrlObj._drilledCellSet[u][f].key)){this.olapCtrlObj._drilledCellSet[u].push({key:r,repItms:e});h=!0;break}else if(this.olapCtrlObj._drilledCellSet[u][f].key.startsWith(t.cellInfo.previousElements)){this.olapCtrlObj._drilledCellSet[u].splice(f,0,{key:r,repItms:e});h=!0;break}if(h)break}else this.olapCtrlObj._drilledCellSet[0]=[],this.olapCtrlObj._drilledCellSet[0][0]={key:r,repItms:e},h=!0;h||(this.olapCtrlObj._drilledCellSet[s]=[],this.olapCtrlObj._drilledCellSet[s].push({key:r,repItms:e}));this._isPaging||(t.cellInfo.axis=="rowheader"?(it=n(i).find("Axis[name|='Axis1'] Tuple"),this._insertCellSet("rowheader",o,v,a,d,g,k,p,i)):(it=n(i).find("Axis[name|='Axis1'] Tuple"),this._insertCellSet("colheader",o,a,v,l,g,k,p,i)),this._generateJSONData("onDemandDrill",this.olapCtrlObj.XMLACellSet))},_insertCellSet:function(t,i,r,u,f,e,o,s,h){var g=n(n(h).find("CellData Cell")[0]).clone(),a,l,c,v,it;n(g).find("FmtValue").text("");i.length>1?n(i[0]).after(r):n(i).after(r);l=e;t=="rowheader"?a=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple"):(a=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple"),l=o);var y=0,nt=n(a).filter(function(t,i){if(u[y]&&n(i).find("UName").text()==n(u[y]).find("UName").text())return y++,!0}),p=0,w=!1;for(c=0;c<f;c++){var tt="",b=0,k=0,d;for(d=t=="rowheader"?(s+c)*l:c*(e+l)+s,v=0;v<l;v++)(t!="rowheader"||n(nt[b]).index()!=v)&&(t!="colheader"||n(nt[p]).index()!=c)&&a.length?n(this.olapCtrlObj.XMLACellSet).find("CellData Cell:nth-child("+(d+k)+")").after(n(g).clone()):(it=t=="rowheader"?c*o:p*o,tt=n(n(h).find("CellData Cell")[it+b]).clone(),n(this.olapCtrlObj.XMLACellSet).find("CellData Cell:nth-child("+(d+k)+")").after(tt),b++,w=!0),k++;t=="colheader"&&(w&&p++,w=!1)}this._setCellOrdinal(this.olapCtrlObj.XMLACellSet[1])},_clearDrilledCellSet:function(){for(var u=n.extend([],this.olapCtrlObj._drilledCellSet),t="",i,r=0;r<u.length;r++)t=u[r][0].key.split("!#"),t.length&&(i=this._getDrilledMemeber({item:{previousElements:t[0]}})),i.length&&this._onDemandCollapse({drilledMembers:i,action:""},t[1])},_onDemandCollapse:function(i,r){var u,f;f=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple");u=n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple");try{this.olapCtrlObj.model.dataSource=t.olap._mdxParser._clearCollapsedItems(r,i.drilledMembers[i.drilledMembers.length-1],this.olapCtrlObj.model.dataSource);i.drilledMembers=i.drilledMembers.splice(0,i.drilledMembers.length-1)}catch(e){this.olapCtrlObj._ogridWaitingPopup.hide()}i.drilledMembers.length?this._onDemandCollapse({drilledMembers:i.drilledMembers,action:i.action},r):i.action=="collapse"&&(this.olapCtrlObj.model.dataSource._isCollapse=!0,delete this._currIndex.axis,this.getJSONData({action:"onDemandCollapse"},this.olapCtrlObj.model.dataSource,this.olapCtrlObj))},_removeCellSets:function(t,i,r,u,f,e){for(var c,s,v,p,o,l=t.length,h,y,w=f[0],a=0;a<i.length;a++)if(n(i[a]).find("UName").text()==n(w).find("UName").text()){y=i[a];break}if(c=l,s=n(y).index(),s)if(e=="rowheader"){for(h=r.length;c>0;)n(n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis1'] Tuple")[s]).remove(),c--;for(o=ext=s;o<ext+l;o++)v=n(n(this.olapCtrlObj.XMLACellSet).find("CellData Cell")).splice(s*h,h),n(v).remove()}else{for(h=i.length,p=r.length;c>0;)n(n(this.olapCtrlObj.XMLACellSet).find("Axis[name|='Axis0'] Tuple")[s]).remove(),c--;for(o=0;o<p;o++)v=n(n(this.olapCtrlObj.XMLACellSet).find("CellData Cell")).splice(h*o-o*l+s,l),n(v).remove()}this._setCellOrdinal(this.olapCtrlObj.XMLACellSet[1])},_getDrilledMemeber:function(t){for(var e=[],o=t.item.previousElements.split(">#>").join().replace(/,/g,""),u=this.olapCtrlObj._drilledCellSet,r,f,e=n.map(this.olapCtrlObj._drilledCellSet,function(t){return e=n.map(t,function(n){if(n.key.startsWith(o))return n})}),i=0;i<u.length;i++)for(r=0,f=u[i];u[i]&&r<u[i].length;r++)f[r]&&f[r].key.startsWith(o)&&(f.splice(r,1),r--,f.length||(u.splice(i,1),i--));return e},_getHeaderCollection:function(t,r){var f,lt,c=[],tt,it="",w=[],k=null,rt={},p={},o=this,at,e,pt,ot,st,ht,ct,u,ft,h,dt,y,gt,nt;if(f=n(t).filter(function(t,i){var f=n(i).find("Member"),e=n(f[0]).find("LName").text().indexOf("[(All)]")!=-1,l=e?1:0,s=0,u,h;for(k=null,e?(tt=0,it="total"):(it="",tt=f.length),u=1,n(f[0]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1&&(u=0),u;u<f.length;u++)n(f[u]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1?(s=e,p.axis=r,p.posision=u,parseInt(n(f[u]).find("MEMBER_TYPE").text())==4&&(h=n(f[u]).find("UName").text().toLowerCase(),h.indexOf("trend]")!=-1?(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text(),"trend"))&&(k="trend",p.isKpiExist=!0)):h.indexOf("status]")!=-1?(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text(),"status"))&&(k="status",p.isKpiExist=!0)):h.indexOf("goal]")!=-1&&(o._kpi||o._loadKpi(o.olapCtrlObj.model.dataSource,this._loadKpiSuccess,""),(rt=o._isKpi(n(f[u]).find("UName").text()+"::"+n(f[u]).find("Caption").text(),"goal"))&&(k="goal",p.isKpiExist=!0)))):s=n(f[u]).find("LName").text().indexOf("[(All)]")!=-1,(e==!1&&s==!0||e==!0&&s==!1)&&(l++,tt=u,it="total"),e=s;return lt=t,l<2&&c.push({selIndx:lt,totLvl:tt,type:it,kpi:k,kpiInfo:rt}),l<2}).map(function(t,u){for(var s,a,l,e=n(u).find("Member"),h=[],f=0;f<e.length;f++)s=parseInt(n(e[f]).find("LNum").text()),r=="colheader"&&o._OlapDataSource.columns[f]?o._OlapDataSource.columns[f].hasAllMember&&(s+=1):r=="rowheader"&&o._OlapDataSource.rows[f]&&o._OlapDataSource.rows[f].hasAllMember&&(s+=1),a=n(e[f]).find("PARENT_UNIQUE_NAME").length?n(e[f]).find("PARENT_UNIQUE_NAME").text():"",h.push({CSS:r,Value:n(e[f]).find("Caption").text()==""?"(Blank)":n(e[f]).find("Caption").text(),ColSpan:1,RowSpan:1,HUName:n(e[f]).attr("Hierarchy"),LName:n(e[f]).find("LName").text(),UName:n(e[f]).find("UName").text(),ChildCount:parseInt(n(e[f]).find("CHILDREN_CARDINALITY").text()),PUName:a,LNum:s,MemberType:parseInt(n(e[f]).find("MEMBER_TYPE").text())}),n(e[f]).find("LName").text().toLowerCase().indexOf("[measures]")!=-1&&c[t].kpi&&(h[h.length-1].kpiInfo=c[t].kpiInfo,h[h.length-1].kpi=c[t].kpi),w[f]==i?w[f]=s:w[f]<s&&(w[f]=s);return l=[],l[0]=h,l}),r=="colheader"?this._cTotIndexInfo=c:this._rTotIndexInfo=c,f={headers:f,indxInfo:c,maxLvlLen:w},n.isEmptyObject(p)||(this._measureDt=n.extend({},p)),at=1,r.indexOf(this._OlapDataSource.values[0].axis.substring(0,3))>-1&&(at=this._measureDt.measureCount=this._OlapDataSource.values[0].measures.length),!this._OlapDataSource._enableBasicEngine&&!this._isPaging){var v={headers:[],indxInfo:[]},ni=c,s=c.length,et=v.length,ut=[],vt=[];try{for(u=0;u<s;u++)u<s&&f.indxInfo[u].type=="total"&&(v.indxInfo.push(f.indxInfo.splice(u,1)[0]),v.headers.push(f.headers.splice(u,1)[0]),s--,u--);var b=f.headers.length>0?f.headers[0].length:0,yt=0,d=0;for(this._measureDt.posision==b-1&&this._measureDt.axis==r&&(d=1),s=f.headers.length,u=0;u<=s;u++){var h=null,ft=null,l=null,a=null;for(a=this._updateMemberVariables(f.headers,h,ft,l,u),h=a.prev,ft=a.next,l=a.cur,a=null,e=b-2-d;e>=0;e--)if(pt=this._comparePrevMembers(f.headers,s,u,e,b,-2),u==s||u>0&&(h&&h[e].UName!=l[e].UName||h[e].UName==l[e].UName&&pt))if(l&&h[e].UName==l[e].PUName)ot=this._removeSubtotalMembers(f,u,e),u-=ot,s-=ot,a=this._updateMemberVariables(f.headers,h,ft,l,u),h=a.prev,ft=a.next,l=a.cur,a=null;else{var wt=h,et=0,g,bt=0,kt=0;for(h&&(kt=h[e].LNum),l&&(bt=l[e].LNum),st=!1,ht=bt;ht<=kt;ht++){for(g=this._getSummaryHeaders(wt,v,e,st,d),et=g.headers.length;g.headers.length>0;)f.headers.splice(u,0,g.headers.pop()),f.indxInfo.splice(u,0,g.indexInfo.pop());st=!0;u+=et;s+=et;wt=f.headers[u-1]}}if(u==s&&v.headers.length>0){for(ct=0;v.headers.length>0;)f.headers.splice(u,0,v.headers.pop()),f.indxInfo.splice(u,0,v.indxInfo.pop()),s++,ct++;u+=ct}}var e=0,dt="";for(ut={headers:[],indxInfo:[]},e=b-1-d,s=f.headers.length,u=0;u<s;u++)if(h=this._findPreviousMember(f.headers,u-1,e),u>0&&f.headers[u-1][e].UName!=f.headers[u][e].UName&&e==b-1-d&&w[e]>1){if(u>0&&f.headers[u]!=i&&f.headers[u-1][e].LNum!=0&&f.headers[u-1][e].UName==f.headers[u][e].PUName)for(y=h;y<0;y++)f.indxInfo[u+y].lnum=f.headers[u+y][e].LNum,f.indxInfo[u+y].type="total",ut.indxInfo.push(f.indxInfo.splice(u+y,1)[0]),ut.headers.push(f.headers.splice(u+y,1)[0]),u+1==s?dt=f.headers[u][e].PUName:(u--,s--);(u!=0&&f.headers[u]!=i&&f.headers[u-1][e].LNum>f.headers[u][e].LNum||!1)&&(gt=[],nt=this._insertSummaryHeaders(f,ut,gt,u,e,b,yt,dt,!1,vt),s=nt.itmCnt,u=nt.hCnt,yt=nt.insCnt,vt[e]=nt.subPos)}}catch(ti){this.olapCtrlObj._waitingPopup.hide()}}return r=="rowheader"?this._rBIndx=c:this._cBIndx=c,f},_insertSummaryHeaders:function(t,r,u,f,e,o,s,h,c,l){var u=[],w,b,v,k="",s=0,y,p,a,d;for(t.headers[f-1]&&(h=t.headers[f-1][e].PUName),v=t.headers.length,w=t.headers[f][e].LNum,b=t.headers[f-1][e].LNum,y=this._comparePrevMembers(t.headers,v,f,e,o,s),p=w;p<b;p++){for(n.grep(r.headers,function(n,r){(h==n[e].UName||t.headers[f+1+s]!=i&&t.headers[f][e].UName!=t.headers[f+1+s][e].UName&&t.headers[f][e].PUName==n[e].UName&&y)&&(k=n[e].PUName,u.push(r))}),h=k,y&&(u.reverse(),y=!1);u.length>0;){for(a=u.length-1,d=u[u.length-1],t.headers.splice(f,0,r.headers.splice(u[u.length-1],1)[0]),t.indxInfo.splice(f,0,r.indxInfo.splice(u[u.length-1],1)[0]);a>=0;)d<u[a]&&u[a]--,a--;u.pop();v++;s++;c&&l[e]++}s>0&&(f+=s,s=0)}return{itmCnt:v,hCnt:f,insCnt:s,subPos:l[e]}},_comparePrevMembers:function(n,t,i,r,u,f){var o=!1,e;if(r>0&&i<t&&i+1+f>=0&&i+1+f<t)for(e=r-1;e>=0;e--)n[i][e].UName!=n[i+1+f][e].UName&&(o=!0);return o},_updateMemberVariables:function(n,t,i,r,u){return n[u]&&(r=n[u]),i=n[u+1]?n[u+1]:null,t=n[u-1]?n[u-1]:null,{cur:r,prev:t,next:i}},_removeSubtotalMembers:function(n,t,i){for(var r=t-1,u=n.headers[r][i].UName;n.headers[r]&&n.headers[r][i].UName==u;)n.indxInfo.splice(r,1),n.headers.splice(r,1),r--;return t-(r+1)},_getSummaryHeaders:function(t,i,r,u){var o=i.headers,f=t,e=r,s=[],h=[],c=i.indxInfo,l;return l=n.grep(o,function(n,t){for(var r=!1,i=e;i>=0;i--)if(n[i].UName==f[i].UName||u&&i==e&&n[i].UName==f[i].PUName)i==0&&(r=!0,h.push(c[t]));else break;return r}),i.headers=n.grep(o,function(n,t){for(var r=!0,i=e;i>=0;i--)if(n[i].UName==f[i].UName||u&&i==e&&n[i].UName==f[i].PUName)i==0&&(r=!1);else break;return r&&s.push(c[t]),r}),i.indxInfo=s,{headers:l,indexInfo:h}},_drillOrderHeaderCollection:function(t,i,r){var o=t,s=i,e=r,u=0,f=this;return n(o).map(function(t,i){var o=n(s[i.selIndx]).find("Member"),h=[],r,l,a,c;for(h[u]=[],r=0;r<o.length;r++)l=parseInt(n(o[r]).find("LNum").text()),e=="colheader"&&f._OlapDataSource.columns[r]?f._OlapDataSource.columns[r].hasAllMember&&(l+=1):e=="rowheader"&&f._OlapDataSource.rows[r]&&f._OlapDataSource.rows[r].hasAllMember&&(l+=1),a=n(o[r]).find("PARENT_UNIQUE_NAME").length?n(o[r]).find("PARENT_UNIQUE_NAME").text():"",h[u].push({CSS:e,Value:n(o[r]).find("Caption").text(),ColSpan:1,RowSpan:1,HUName:n(o[r]).attr("Hierarchy"),LName:n(o[r]).find("LName").text(),UName:n(o[r]).find("UName").text(),ChildCount:parseInt(n(o[r]).find("CHILDREN_CARDINALITY").text()),PUName:a,LNum:l,MemberType:parseInt(n(o[r]).find("MEMBER_TYPE").text())}),c=h[u][h[u].length-1],i.kpiInfo&&c.UName.toLowerCase().indexOf("[measures]")>-1&&c.MemberType==4&&(h[u][h[u].length-1].kpiInfo=i.kpiInfo),i.kpi&&c.UName.toLowerCase().indexOf("[measures]")>-1&&c.MemberType==4&&(h[u][h[u].length-1].kpi=i.kpi);return h})},_loadKpi:function(n,t,i){i={action:"loadFieldElements"};var r=this._getConnectionInfo(n.data),u='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_KPIS<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.catalog+"<\/Catalog><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";this.olapCtrlObj.doAjaxPost("POST",r.url,{XMLA:u},this._loadKpiSuccess,null,i)},_loadKpiSuccess:function(n,t){this._kpi=t},_isKpi:function(t,i){var u=n(this._kpi).find("row:contains("+t.split("::")[0]+")"),r={};return u.length?(i=="trend"?(r.Graphic=n(u).find("KPI_TREND_GRAPHIC").text(),r.Value=n(u).find("KPI_NAME").text()):i=="status"?(r.Graphic=n(u).find("KPI_STATUS_GRAPHIC").text(),r.Value=n(u).find("KPI_NAME").text()):i=="goal"&&(r.Caption=t.split("::")[1],r.Value=n(u).find("KPI_NAME").text()),r):!1},_getValueCells:function(t,i){var s=this._columnHeaders.headers.length,c=this._rowHeaders.headers.length?this._rowHeaders.headers.length:1,e=0,u=0,f,l,r,o,h;if(this._valueCells[e]=[],this._fillAllValueCells(),t=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),this._OlapDataSource._enableBasicEngine||this._isPaging)for(r=0;r<t.length;r++)u<s&&(this._valueCells[e][u]={ActualValue:n(t[r]).find("Value").text(),Value:n(t[r]).find("FmtValue")[0]?n(t[r]).find("FmtValue").text():"",FormatString:n(t[r]).find("FormatString")[0]?n(t[r]).find("FormatString").text():""},u++),u==s&&e+1<c&&(u=0,e++,this._valueCells[e]=[]);else for(f=0;f<c;f++)for(l=this._rBIndx.length?this._rBIndx[f].selIndx:0,r=0;r<s;r++)o=n(t[l*i+this._cBIndx[r].selIndx]),h="",(this._columnHeaders.indxInfo[r]&&this._columnHeaders.indxInfo[r].type=="total"||this._rowHeaders.indxInfo[f]&&this._rowHeaders.indxInfo[f].type=="total")&&(h="summary"),u<s&&(this._valueCells[f][r]={ActualValue:n(o).find("Value").text(),Value:n(o).find("FmtValue")[0]?this._getFormatedValue(n(o),n(o).find("FormatString")[0]):"",FormatString:n(o).find("FormatString")[0]?n(o).find("FormatString").text():"",kpi:this._cBIndx[r].kpi?this._cBIndx[r].kpi:this._rBIndx[f]?this._rBIndx[f].kpi:"",summary:h,Span:this._isNoSummary&&h=="summary"?"Block":"None"},u++),u==s&&e+1<c&&(u=0,e++,this._valueCells[e]=[]);return this._valueCells},_fillAllValueCells:function(t){var u,o,i,f,e,r;for(t=n(this.olapCtrlObj.XMLACellSet).find("CellData Cell"),u=n(t[0]).clone(),n(u).find("FmtValue").text(""),o=t,i=0;i<t.length;i++)if(f=parseInt(n(t[i]).attr("CellOrdinal")),t[i+1]&&(e=parseInt(n(t[i+1]).attr("CellOrdinal"))),f+1<e)for(r=f+1;r<e;r++)n(t[i]).after(n(u).clone().attr("CellOrdinal",r)[0]);return t},_setCellOrdinal:function(t){for(var r=n(t).find("Cell"),i=0;i<r.length;i++)n(r[i]).attr("CellOrdinal",i)},_getFormatedValue:function(i,r){var r,u;if((this.olapCtrlObj.model.locale=="en-US"||!n.isNumeric(parseFloat(n(i).find("Value").text())))&&n(i).length>0)u=n(i).find("FmtValue").text();else{r=n(r).length>0?n(r).text().toLowerCase():t.isNullOrUndefined(r)?"":r.length>0?r:"";u=n(i).length>0?parseFloat(i.find("Value").text()):i;switch(r){case"decimal":u=parseFloat(t.widgetBase.formatting("{0:D2}",u,this.olapCtrlObj.model.locale));break;case"percent":u=t.widgetBase.formatting("{0:P0}",u,this.olapCtrlObj.model.locale);break;case"number":u=t.widgetBase.formatting("{0:N}",u,this.olapCtrlObj.model.locale);break;case"currency":u=t.widgetBase.formatting("{0:C2}",u,this.olapCtrlObj.model.locale);break;case"date":u=new Date((Number(u)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(u)&&(u=t.widgetBase.formatting("{0:MM/dd/yyyy}",u,this.olapCtrlObj.model.locale));break;case"scientific":u=Number(u).toExponential(2).replace("e","E");break;case"accounting":u=this._toAccounting(u,"{0:C2}",this.olapCtrlObj.model.locale);break;case"time":u=new Date((Number(u)-2)*864e5+new Date("01/01/1900").getTime());this._isDateTime(u)&&(u=t.widgetBase.formatting("{0:h:mm:ss tt}",u,this.olapCtrlObj.model.locale));break;case"fraction":u=this._toFraction(u);u="numerator"in u?u.integer+" "+u.numerator+"/"+u.denominator:u.integer;break;default:u=n(i).find("FmtValue").text()}}return u},_isDateTime:function(n){return Object.prototype.toString.call(n)==="[object Date]"&&!isNaN(n.valueOf())},_toAccounting:function(n,i,r){var h=t.preferredCulture(r).numberFormat,f,e,u=h.currency.symbol,o,s;return val=t.widgetBase.formatting(i,n,this.olapCtrlObj.model.locale),o=val.replace(u,""),s=val.indexOf(u),!s||n<0&&s===1?(f=u,e=Number(n)?o:"-"):(f=Number(n)?o:"-",e=u),f+" "+e},_toFraction:function(n){if(this._isNumber(n)){var r=n.toString(),e=r.split(".")[0],t=r.split(".")[1];if(!t)return{integer:n};var i=(+t).toString(),u=this._getPlaceValue(t,i),f=this._getGCD(i,u);return{integer:e,numerator:Number(i)/f,denominator:Number(u)/f}}return null},_isNumber:function(n){return n-parseFloat(n)>=0},_getGCD:function(n,t){return(n=Number(n),t=Number(t),!t)?n:this._getGCD(t,n%t)},_getPlaceValue:function(n,t){var i=n.indexOf(t)+t.length;return"1"+Array(i+1).join("0")},_populateEngine:function(r,u,f){var y=r.length,p=u.length,w=y?r[0].length:y,h=p?u[0].length:p,b=[],g=f.length,nt=f[0].length,o,v,ft,d,a,e,c;try{this.pivotEngine=[];var tt=[],it=[],et=!1,k=[],l=!1,s=[];for(e=0;e<p;e++)for(this.pivotEngine[e+h]==i&&(this.pivotEngine[e+h]=[]),e==0&&(this.pivotEngine[0]=[],this.pivotEngine[0][0]={CSS:"none",Value:"",ColSpan:this._indexCCell?this._indexCCell:1,RowSpan:this._indexRCell?this._indexRCell:1,HUName:"",LName:"",UName:"",LNum:""}),o=0;o<h;o++)l=!1,this._OlapDataSource.columns&&this._OlapDataSource.columns[o]&&this._OlapDataSource.columns[o].isNamedSets&&(l=!0),this._pivotEngineSpanCalculation("colheader",u,r,this._columnHeaders.maxLvlLen,f,o,e,it,tt,this._cTotIndexInfo,l,k);for(s=this.pivotEngine.slice(),this.pivotEngine=[],e=0;e<s.length;e++)if(s[e])for(o=0;o<s[e].length;o++)s[e][o]&&(this.pivotEngine[o]==i&&(this.pivotEngine[o]=[]),this.pivotEngine[o][e]={CSS:s[e][o].CSS,ColSpan:s[e][o].RowSpan,HUName:s[e][o].HUName,LName:s[e][o].LName,LNum:s[e][o].LNum,RowSpan:s[e][o].ColSpan,UName:s[e][o].UName,PUName:s[e][o].PUName,Value:s[e][o].Value,ChildCount:s[e][o].ChildCount,MemberType:s[e][o].MemberType,Span:s[e][o].Span=="Block"?"Block":"None"},s[e][o].kpiInfo&&(this.pivotEngine[o][e].kpiInfo=s[e][o].kpiInfo,this.pivotEngine[o][e].kpi=s[e][o].kpi));var rt=[],ut=[],et=!1,k=[];for(e=0;e<y;e++)for(this.pivotEngine[e+this._indexCCell]==i&&(this.pivotEngine[e+this._indexCCell]=[]),o=0;o<w;o++)l=!1,this._OlapDataSource.rows&&this._OlapDataSource.rows[o]&&this._OlapDataSource.rows[o].isNamedSets&&(l=!0),this._pivotEngineSpanCalculation("rowheader",r,u,this._rowHeaders.maxLvlLen,f,o,e,ut,rt,this._rTotIndexInfo,l,k);for(b=n.extend(!0,[],this.pivotEngine),w=this._measureDt.axis=="rowheader"?this._indexRCell+1:this._indexRCell,h=this._indexCCell?this._indexCCell:h,e=0;e<g;e++)for(this.pivotEngine[e+h]!=i&&(w=this.pivotEngine[e+h].length),o=0;o<nt;o++)t.isNullOrUndefined(f[e][o])||(this.pivotEngine[e+h]==i&&(this.pivotEngine[e+h]=[]),v=this._setClassName(f[e][o]),f[e][o].CSS=v,v.indexOf("kpiiconvalue")>-1&&(!1||this.olapCtrlObj.pluginName=="ejPivotGrid")?f[e][o].Value="":v.indexOf("kpiiconvalue")>-1&&(f[e][o].Value=parseInt(f[e][o].Value)),this.pivotEngine[e+this._indexCCell][o+this._indexRCell]=f[e][o]);if(ft=n.grep(this.pivotEngine,function(n){return n}),this._isPaging){for(t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName)||this.olapCtrlObj._pagingSavedObjects.curDrilledItem.action!="collapse"?t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index)?t.isNullOrUndefined(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName)||(n.each(this.olapCtrlObj._pagingSavedObjects.savedHdrEngine,function(i,r){n.each(r,function(n,r){if(!t.isNullOrUndefined(r)&&r.UName==t.olap.base.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName.split("::")[0].split("amp;").join(""))return t.olap.base.olapCtrlObj._pagingSavedObjects.drillEngine.push(t.olap.base.olapCtrlObj._pagingSavedObjects.savedHdrEngine[i][n]),!1})}),this.olapCtrlObj._pagingSavedObjects.drillEngine[this.olapCtrlObj._pagingSavedObjects.drillEngine.length-1].ChildCount=-1):(this.olapCtrlObj._pagingSavedObjects.drillEngine.push(this.olapCtrlObj._pagingSavedObjects.savedHdrEngine[parseInt(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index.split(",")[1])][parseInt(this.olapCtrlObj._pagingSavedObjects.curDrilledItem.index.split(",")[0])]),this.olapCtrlObj._pagingSavedObjects.drillEngine[this.olapCtrlObj._pagingSavedObjects.drillEngine.length-1].ChildCount=-1):n.each(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n,i){if(i.UName==t.olap.base.olapCtrlObj._pagingSavedObjects.curDrilledItem.uniqueName.split("::")[0].split("amp;").join(""))return t.olap.base.olapCtrlObj._pagingSavedObjects.drillEngine.splice(n,1),!1}),n.map(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(i){var r=n.map(t.olap.base.olapCtrlObj.model.dataSource.columns,function(n){return n.fieldName==i.HUName?!0:!1});i.CSS=r[0]?"colheader":"rowheader"}),this.olapCtrlObj._pagingSavedObjects.curDrilledItem={},e=this.pivotEngine[0][0].RowSpan-2;e>=0;e--){for(d="empty",o=1;o<this.pivotEngine[this.pivotEngine[0][0].RowSpan-1].length;o++)t.isNullOrUndefined(this.pivotEngine[e])&&(this.pivotEngine[e]=[]),t.isNullOrUndefined(this.pivotEngine[e+1])||!t.isNullOrUndefined(this.pivotEngine[e][o])||t.isNullOrUndefined(this.pivotEngine[e+1][o])||(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==t.olap.base.pivotEngine[e+1][o].PUName})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].ColSpan=t.isNullOrUndefined(this.pivotEngine[e][o-1])||this.pivotEngine[e][o-1].UName!=this.pivotEngine[e][o].UName?1:this.pivotEngine[e][o-1].ColSpan+1,this.pivotEngine[e][o].RowSpan=1,d=this.pivotEngine[e][o].UName));for(a=1,o=this.pivotEngine[this.pivotEngine[0][0].RowSpan-1].length-2;o>0;o--)t.isNullOrUndefined(this.pivotEngine[e])||t.isNullOrUndefined(this.pivotEngine[e][o])||t.isNullOrUndefined(this.pivotEngine[e][o+1])||this.pivotEngine[e][o+1].UName!=this.pivotEngine[e][o].UName?t.isNullOrUndefined(this.pivotEngine[e])||t.isNullOrUndefined(this.pivotEngine[e][o+1])||(this.pivotEngine[e][o+1].ColSpan=a==1?this.pivotEngine[e][o+1].ColSpan:a,a=1):(this.pivotEngine[e][o].ColSpan==this.pivotEngine[e][o+1].ColSpan,a++)}for(e=this.pivotEngine[0][0].RowSpan;e<this.pivotEngine.length;e++)for(c="empty",o=this.pivotEngine[0][0].ColSpan-1;o>=0;o--)t.isNullOrUndefined(this.pivotEngine[e][o])?t.isNullOrUndefined(this.pivotEngine[e-1][o])||this.pivotEngine[e-1][o].UName!=c?(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==c})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].RowSpan=1,this.pivotEngine[e][o].ColSpan=1,c=this.pivotEngine[e][o].PUName)):(this.pivotEngine[e][o]=n.grep(this.olapCtrlObj._pagingSavedObjects.drillEngine,function(n){return n.UName==c})[0],t.isNullOrUndefined(this.pivotEngine[e][o])||(this.pivotEngine[e][o].RowSpan=this.pivotEngine[e-1][o].RowSpan+1,this.pivotEngine[e][o].ColSpan=1,c=this.pivotEngine[e][o].PUName)):c=this.pivotEngine[e][o].PUName;this.olapCtrlObj._pagingSavedObjects.savedHdrEngine=b}}catch(ot){this.olapCtrlObj._waitingPopup.hide()}},_pivotEngineSpanCalculation:function(t,r,u,f,e,o,s,h,c,l,a,v){var at=r.length,ot="",k,gt=u.length,g=at?r[0].length:at,p=gt?u[0].length:gt,oi=e.length,si=e[0].length,ti,tt,ut,y,nt,ni,wt,ft,it,ht,ri,vt,bt,kt,yt,dt,ui,fi,ei,lt;t=="rowheader"?(p=this._indexCCell?this._indexCCell:p,ot="row"):(p=this._indexRCell?this._indexRCell:p,ot="col");ti=1;tt=0;a&&(r[s][o].ChildCount=0);this._measureDt.axis==t&&this._measureDt.posision==g-1&&(tt=1);h[o]||(h[o]=[]);this._isNoSummary&&!v[o]&&(v[o]=[]);this.pivotEngine[s+p]||(this.pivotEngine[s+p]=[]);c[o]=s;var ii=f[o]?f[o]:1,w=0,pt=0;for(ut=0;ut<o;ut++)f[ut]&&(w+=f[ut]-1,pt+=f[ut]);if(!this._OlapDataSource._enableBasicEngine||this._OlapDataSource._checkSummaryHeaders)for(y=1;y<=ii;y++){var d=null,st=!1,b=r[s][o].LNum;if(h[o][y]==i&&(h[o][y]=0),this._isNoSummary&&v[o][y]==i&&(v[o][y]=0),r[s-1]&&h[o][b]&&(r[s][o].LNum!=0&&r[s-1][o].PUName==r[s][o].UName||o+tt==g-1&&r[s-1][o].LNum<r[s][o].LNum)&&(nt=h[o][b],this._isNoSummary&&(nt+=v[o][b],v[o][b]=0),this.pivotEngine[s+p-nt][o+b-1+w]=r[s][o],o+tt!=g-1&&(this.pivotEngine[s+p][o+b-1+w]=n.extend({},r[s][o]),this._isNoSummary&&(this.pivotEngine[s+p][o+b-1+w].Span="Block")),this._isNoSummary&&(this.pivotEngine[s+p-nt][o+b-1+w].RowSpan=0),a||(this.pivotEngine[s+p-nt][o+b-1+w].ChildCount=-1),this.pivotEngine[s+p-nt][o+b-1+w].ColSpan=1,this.pivotEngine[s+p-nt][o+b-1+w].RowSpan+=h[o][b],this._drilledJSONData(s+p-nt,s+p,o+b-1+w,r[s][o]),h[o][b]=0,o+tt==g-1&&r[s-1][o].LNum>r[s][o].LNum)){for(ni=f[o]-b,wt=this._findNextMember(r,s,o),ft=0;ft<wt;ft++)this.pivotEngine[s+p+ft]||(this.pivotEngine[s+p+ft]=[]),this.pivotEngine[s+p+ft][o+w+b]={CSS:"summary "+ot,Value:"Total",ColSpan:ni,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"};this._isNoSummary||(this.pivotEngine[s+p-nt][o+b-1+w].RowSpan+=wt-1)}if(r[s][o].LNum>y&&!(this._isNoSummary&&l[s].type=="total")?h[o][y]++:r[s][o].LNum>y&&this._isNoSummary&&l[s].type=="total"&&v[o][y]++,d=s+p,y==r[s][o].LNum&&s==0&&r[s][o].LNum>1)this.pivotEngine[d]||(this.pivotEngine[d]=[]),this.pivotEngine[d][o+y-1+w]=r[s][o],(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+tt==g-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&(this.pivotEngine[d][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[d][o+y-1+w].LNum);else if(s!=0&&r[s][o].LNum>1&&y==r[s][o].LNum&&r[s-1][o].UName!=r[s][o].UName&&r[s-1][o].PUName!=r[s][o].UName)this.pivotEngine[d]==i&&(this.pivotEngine[d]=[]),this.pivotEngine[d][o+y-1+w]=r[s][o],(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+tt==g-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&(this.pivotEngine[d][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[d][o+y-1+w].LNum);else if(s!=0&&y==r[s][o].LNum&&r[s-1][o].UName==r[s][o].UName)this._isNoSummary&&l[s].type=="total"?this._isNoSummary&&l[s].type=="total"&&v[o][y]++:h[o][y]++,this.pivotEngine[s+p][o+y-1+w]=r[s][o],this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block"),(r[s+1]!=i&&r[s+1][o].UName!=r[s][o].UName||s+1==at&&h[o][y]>0)&&(it=h[o][y],ht=r[s][o].LNum,this._isNoSummary&&(it+=v[o][y],v[o][y]=0),it&&this.pivotEngine[s+p-it][o+ht-1+w]!=i&&this.pivotEngine[s+p-it][o+ht-1+w].Value!=i&&(this.pivotEngine[s+p-it][o+ht-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-it,s+p,o+ht-1+w,r[s][o])),h[o][y]=0);else if(r[s][o].LNum<2&&(y==r[s][o].LNum||r[s][o].LNum==0)||r[s][o].LNum<y&&r[s-1]&&r[s][o].LNum<r[s-1][o].LNum&&l[s].type=="total"&&this._measureDt.axis==t)if(ri=y-1,r[s-1]&&r[s-1][o].UName==r[s][o].UName&&r[s][o].LName.toLowerCase().indexOf("[measures]")>-1&&(this.pivotEngine[s+p][o+y-1+w]=n.extend({},r[s][o]),this._measureDt.measureCount>1&&t==this._measureDt.axis||this._isNoSummary&&l[s].type=="total"?this._measureDt.measureCount>1&&t==this._measureDt.axis||!this._isNoSummary||l[s].type!="total"||v[o][y]++:h[o][y]++,this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block")),r[s][o].UName.indexOf("Measures")!=-1&&this._isPaging||l[s].type=="total")if(l[s].type=="total"&&r[s][o].LName.toLowerCase().indexOf("[measures]")==-1&&r[s][o].LNum!=y&&f[o]!=0){if((r[s][o-1]&&r[s][o-1].LName.toLowerCase().indexOf("[measures]")==-1||this._measureDt.axis!=t)&&(o>l[s].totLvl||o==g-1&&y>l[s].totLvl&&l[s].totLvl!=0||l[s].totLvl==0&&y-1>l[s].totLvl))break;for(var rt=1,ct=1,et=0;r[s-ct][o]&&r[s-ct][o].LNum==0&&!r[s][o].LName.toLowerCase().indexOf("[measures]")>-1;)r[s][o-1]&&r[s-ct+1][o-1].UName!=r[s-ct][o-1].UName&&et++,ct++;if(0){for(vt=0,st=!1,et=0,o<this._measureDt.posision?(bt=o,kt=this._measureDt.posision):o>this._measureDt.posision&&(kt=f.length,bt=o,st=!0),yt=bt;yt<kt;yt++)vt+=f[yt];r[s][o+1]&&r[s][o+1].LName.toLowerCase().indexOf("[measures]")>-1&&f[o]>1&&(st=!0,vt-=r[s][o].LNum);rt=vt}else r[s][o].LNum==0&&!r[s][o].LName.toLowerCase().indexOf("[measures]")>-1&&(lt=0,dt=0,s>0&&o>0&&r[s][o].LName.indexOf("(All)")>-1&&r[s][o-1]&&f[o-1]>1&&(lt=this._findPreviousMember(r,s,o-1)),s!=0&&r[s][o-1]&&f[o-1]>1&&r[s+lt]&&r[s][o-1].LNum<r[s+lt][o-1].LNum&&(et=f[o-1]-r[s][o-1].LNum),t=="rowheader"?(rt=this._indexRCell-pt+et,dt=this._indexRCell-rt):t=="colheader"&&(rt=this._indexCCell-pt+et,dt=this._indexCCell-rt),(f.length!=1&&o==g-1||f.length>1&&o<g-1)&&(st=!0),this._measureDt.axis==t&&(rt-=1),fi=1,s!=0&&r[s][o-1]&&(ui=r[s][o-1].LNum+1),ei=1,lt=s+p,this.pivotEngine[s+p][o+y-1+w-et]={CSS:"summary "+ot,Value:"Total",ColSpan:rt,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"})}else r[s][o].LName.toLowerCase().indexOf("[measures]")!=-1?(r[s-1]&&r[s-1][o].UName==r[s][o].UName||(this.pivotEngine[s+p][o+y-1+w]=n.extend({},r[s][o]),this._isNoSummary&&l[s].type=="total"&&(this.pivotEngine[s+p][o+y-1+w].Span="Block")),(r[s-1]&&r[s-1][o].UName!=r[s][o].UName||s+1==at)&&(k=h[o][y],this._isNoSummary&&(k+=v[o][y],v[o][y]=0),k&&this.pivotEngine[s+p-k][o+y-1+w]!=i&&(this.pivotEngine[s+p-k][o+y-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-k,s+p,o+y-1+w,r[s][o])),h[o][y]=0)):l[s].type=="total"&&r.length==1&&(this.pivotEngine[s+p][o+y-1+w]={CSS:"summary "+ot,Value:"Total",ColSpan:1,RowSpan:1,HUName:"",LName:"",UName:"",LNum:"",MemberType:"",ChildCount:"",Span:this._isNoSummary?"Block":"None"});else r[s-1]&&r[s-1][o].UName==r[s][o].UName||(this.pivotEngine[s+p][o+y-1+w]=r[s][o],k=h[o][y],this._isNoSummary&&(k+=v[o][y],v[o][y]=0),k&&this.pivotEngine[s+p-k][o+y-1+w]!=i&&(this.pivotEngine[s+p-k][o+y-1+w].RowSpan+=h[o][y],this._drilledJSONData(s+p-k,s+p,o+y-1+w,r[s][o])),h[o][y]=0),!r[s][o].LNum==0&&(!(r[s+1]!=i&&r[s][o].LNum<r[s+1][o].LNum)||o+tt==g-1&&r[s+1]&&r[s][o].LNum<r[s+1][o].LNum)&&this.pivotEngine[s+p][o+y-1+w]&&(this.pivotEngine[s+p][o+y-1+w].ColSpan+=f[o]-this.pivotEngine[s+p][o+y-1+w].LNum);if(st)break}else this.pivotEngine[s+p][o]=r[s][o]},_findNextMember:function(n,t,i){for(var r=0;n[t+r]&&n[t][i].UName==n[t+r][i].UName;)r++;return r},_findPreviousMember:function(n,t,i){for(var r=-1;n[t+r]&&n[t][i].UName==n[t+r][i].UName;)r--;return r},_drilledJSONData:function(t,i,r,u){for(var f=t+1;f<i;f++)this.pivotEngine[f][r]=n.extend({},u),this._isNoSummary&&(this.pivotEngine[f][r].Span="Block")},_setClassName:function(n){var i=parseInt(n.Value),t="value";if(n.kpi)if(n.kpi=="trend")switch(i){case-1:t="value kpiiconvalue kpidownarrow";break;case 0:t="value kpiiconvalue kpirightarrow";break;case 1:t="value kpiiconvalue kpiuparrow"}else if(n.kpi=="status")switch(i){case-1:t="value kpiiconvalue kpidiamond";break;case 0:t="value kpiiconvalue kpitriangle";break;case 1:t="value kpiiconvalue kpicircle"}return n.summary+" "+t},_getFieldItemsInfo:function(n){var t=this._getConnectionInfo(n.model.dataSource.data),i='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_HIERARCHIES<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+n.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+n.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+n.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+t.LCID+"<\/LocaleIdentifier><\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>";n.doAjaxPost("POST",t.url,{XMLA:i},this._getHierarchyInfo,null,{pvtGridObj:n,action:"loadFieldElements"})},_getHierarchyInfo:function(t,i){for(var u,s,o=[],r=t.pvtGridObj,f=this._getConnectionInfo(r.model.dataSource.data),e=0;e<n(i).find("row").length;e++)u=n(n(i).find("row")[e]),o.push({pid:u.find("DIMENSION_UNIQUE_NAME").text(),id:u.find("HIERARCHY_UNIQUE_NAME").text(),name:u.find("HIERARCHY_CAPTION").text(),tag:u.find("HIERARCHY_UNIQUE_NAME").text(),hasAllMember:u.children("ALL_MEMBER").length==0?!0:!1});r._fieldData={hierarchy:o,hierarchySuccess:i,measures:[]};f.LCID.indexOf("1033")>=0&&!r.model.enableDrillThrough||(s='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_MEASURES<\/RequestType><Restrictions><RestrictionList><CATALOG_NAME>'+r.model.dataSource.catalog+"<\/CATALOG_NAME><CUBE_NAME>"+r.model.dataSource.cube+"<\/CUBE_NAME><\/RestrictionList><\/Restrictions><Properties><PropertyList><Catalog>"+r.model.dataSource.catalog+"<\/Catalog> <LocaleIdentifier>"+f.LCID+"<\/LocaleIdentifier> <\/PropertyList><\/Properties><\/Discover><\/Body><\/Envelope>",r.doAjaxPost("POST",f.url,{XMLA:s},this._getMeasureInfo,null,{pvtGridObj:r,action:"loadFieldElements"}))},_getMeasureInfo:function(t,i){for(var f=[],r=0;r<n(i).find("row").length;r++){var u=n(n(i).find("row")[r]),o=u.children("MEASUREGROUP_NAME").text(),e=u.find("MEASURE_UNIQUE_NAME").text();f.push({id:e,pid:o,name:u.children("MEASURE_CAPTION").text(),tag:e})}t.pvtGridObj._fieldData.measures=f;t.pvtGridObj._fieldData.measureSuccess=i},_getConnectionInfo:function(t){var i={url:"",LCID:"1033"};return t!=""&&n.map(t.split(";"),function(n){n.toLowerCase().indexOf("locale")<0&&i.url.length==0?i.url=n:n.toLowerCase().indexOf("locale")>=0&&(i.LCID=n.replace(/ /g,"").split("=")[1])}),i},_applyTrim:function(r){var f=[],u=r.model.dataSource,e=this;r._fieldData&&r._fieldData.measures&&r._fieldData.hierarchy?(n.merge(f,r._fieldData.hierarchy),n.merge(f,r._fieldData.measures)):r._fieldData&&r._fieldData.hierarchy?r._fieldData.hierarchy:[];u.rows=n.map(u.rows,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)return r.fieldName=n.trim(r.fieldName),e._getCaption(r,f)});u.columns=n.map(u.columns,function(r){if(!t.isNullOrUndefined(r)&&r.fieldName!=i)