Files
yanpeng200212 a8890c81e9 新增质量模块(工艺执行书 / 样茧试缫)与报表中心
质量模块:
- 11 张工艺执行书表:封面、试产、选剥茧(含混茧明细)、试缫与大样、煮茧(含分车间配温、副煮车间)、自动缫(含大样)、后缫
- 10 张样茧试缫表:原料小样/综合样主表 + 选茧、解舒、茧幅、切剖、清洁洁净、茧丝百回纤度
- 服务与接口、主控指针回写(列表 √ 标记)、封面编号自增、报表数据包
- 前端 8 张报表打印版式、7 类工艺单据与 6 类调查录入弹窗、字段驱动表单/表格组件
- 菜单种子新增「质量」目录,样茧子表增加 YjssType 判别列,避免原料小样与综合样自增 Id 重号串数据

报表中心:
- 报表模板管理、锐浪 grhtml5 加载与预览、全屏设计面板、数据源 Provider(落丝记录、职工花名册)

其他:同步工作进度 1-11 文档、开发数据库快照、.gitignore 忽略运行日志目录
2026-10-22 10:30:37 +08:00

9 lines
264 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var gr={},DEBUG=0;!function(){"use strict";gr.const_={VERSION:"7.0.26.0930",ID_REPORT_STYLE:"_gridcss",ID_DETAILGRID:"_griddg",ATTR_CONTENT_RECNO:"_grRecNo",ATTR_GROUPH_INDEX:"_grGHIndex",ATTR_GROUPF_INDEX:"_grGFIndex",ATTR_GROUP_RECNO:"_grGRecNo",ATTR_FIELD:"_grfld",CSS_DG:"_grdg",CSS_DG_F:"._grdg",CSS_SH:"_grcsssh",CSS_CB:"_grcsscb",BIG_AMT_NUMBER:"零壹贰叁肆伍陆柒捌玖",HZ_NUMBER:"零一二三四五六七八九十",HZ_NUMRANK:"元十百千万十百千亿十百千",HZ_NEGATIVE:"负",HZ_ZERO_YUAN:"零元整",HZ_AMT_STEP:"元拾佰仟万拾佰仟亿拾佰仟",HZ_AMT_UNIT:"整角分",HZ_DATETIME_UNIT:"周日星期天",MILLISECONDS_DAY:864e5,TIMEZONE_OFFSET:6e4*(new Date).getTimezoneOffset()},gr.enum_={ColorIdent:{Black:0,Maroon:128,Green:32768,Olive:32896,Navy:8388608,Purple:8388736,Teal:8421376,Gray:10526880,Silver:12632256,Red:255,Lime:65280,Yellow:65535,Blue:16711680,Fuchsia:16711935,Aqua:16776960,LtGray:12698049,DkGray:8421504,White:16777215},PenStyle:{Solid:0,Dash:1,Dot:2,DashDot:3,DashDotDot:4},BorderStyle:{DrawLeft:1,DrawTop:2,DrawRight:4,DrawBottom:8},BackStyle:{Normal:1,Transparent:2},TextAlign:{TopLeft:17,TopCenter:18,TopRight:20,TopJustiy:144,BottomLeft:65,BottomCenter:66,BottomRight:68,BottomJustiy:192,MiddleLeft:33,MiddleCenter:34,MiddleRight:36,MiddleJustiy:160},TextOrientation:{Default:0,U2DL2R0:5,D2UL2R1:22,U2DR2L0:9,U2DR2L1:25,Invert:58,L2RD2U0:38,L2RD2U1:54},ParameterDataType:{String:1,Integer:2,Float:3,Boolean:5,DateTime:6},FieldType:{String:1,Integer:2,Float:3,Currency:4,Boolean:5,DateTime:6,Binary:7},ControlType:{StaticBox:1,ShapeBox:2,SystemVarBox:3,FieldBox:4,SummaryBox:5,RichTextBox:6,PictureBox:7,MemoBox:8,SubReport:9,Line:10,Chart:11,Barcode:12,FreeGrid:13,CharGridBox:14},SummaryFun:{Sum:1,Avg:2,Count:3,Min:4,Max:5,Var:6,VarP:7,StdDev:8,StdDevP:9,AveDev:10,DevSq:11,CountBlank:12,CountA:13,Distinct:14,AvgA:15,MinN:16,MaxN:17,StrMin:18,StrMax:19,VarA:20,VarPA:21,StdDevA:22,StdDevPA:23,AveDevA:24,DevSqA:25,SumAbs:26,SumAcc:27,GroupSumAcc:28,Join:29,JoinUnique:30},MathFun:{round45:1,round465:2,abs:5,acos:6,asin:7,atan:8,atan2:9,ceil:15,cos:16,exp:17,floor:18,log:19,maxArray:20,minArray:21,pow:22,round:23,sin:24,sqrt:25,tan:26},SystemVarType:{CurrentDateTime:1,RecordNo:4,RowNo:8,RecordCount:19,GroupNo:20,GroupCount:21,GroupRowNo:22,GroupRowCount:23},AnchorStyle:{Left:1,Top:2,Right:4,Bottom:8},AlignColumnSideStyle:{Left:1,Right:2,Both:3},DockStyle:{None:0,Left:1,Top:2,Right:3,Bottom:4,Fill:5},CenterStyle:{None:0,Horizontal:1,Vertical:2,Both:3},ShiftMode:{Never:0,Always:1,WhenOverLapped:2},Unit:{Cm:1,Inch:2},ShapeBoxType:{Circle:1,Ellipse:2,Rectangle:3,RoundRect:4,RoundSquare:5,Square:6,Line:7},PictureAlignment:{TopLeft:1,TopRight:2,Center:3,BottomLeft:4,BottomRight:5},PictureSizeMode:{Clip:1,Stretch:2,Zoom:3,EnsureFullView:4,Tile:5},PictureTransparentMode:{None:0,Overlying:1,Background:2},PictureRotateMode:{None:0,Left:1,Right:2,Flip:3,Mirror:4},ChartType:{BarChart:1,PieChart:2,LineChart:3,StackedBarChart:4,XYScatterChart:5,XYLineChart:6,CurveLineChart:7,XYCurveLineChart:8,Bubble:9,StackedBar100Chart:10,ColumnChart:11,StackedColumnChart:12,StackedColumn100Chart:13},ChartVarType:{XVal:1,YVal:2,ZVal:3,YVal100ByGroup:4,YVal100BySeries:5,YValTotalByGroup:6,YValTotalBySeries:7,SeriesLabel:8,GroupLabel:9},PointMarkerStyle:{None:-1,Square:0,SquareCheck:1,SquareCross:2,Circle:3,CirclePoint:4,CircleCross:5,Dimond:6,Triangle:7,Cross:8,Cross4:9,Star4:10,Star5:11,Star6:12,Star10:13},BarcodeType:{Code25Intlv:1,Code25Ind:2,Code25Matrix:3,Code39:4,Code39X:5,Code128A:6,Code128B:7,Code128C:8,Code93:9,Code93X:10,CodeMSI:11,CodePostNet:12,CodeCodabar:13,CodeEAN8:14,CodeEAN13:15,CodeUPC_A:16,CodeUPC_E0:17,CodeUPC_E1:18,CodeUPC_Supp2:19,CodeUPC_Supp5:20,CodeEAN128A:21,CodeEAN128B:22,CodeEAN128C:23,Code128Auto:24,CodeEAN128Auto:25,ITF_14:26,Pharmacode1T:27,Pharmacode2T:28,PDF417:50,QRCode:51,DataMatrix:52,GS1DataMatrix:53,GS1QRCode:54},BarcodeCaptionPosition:{None:1,Above:2,Below:3},BarcodeDirection:{LeftToRight:1,RightToLeft:2,TopToBottom:3,BottomToTop:4},DtmxEncoding:{Auto:2,Ascii:3,C40:4,Text:5,X12:6,Edifact:7,Base256:8},DtmxMatrixSize:{Auto:2,"10x10":4,"12x12":5,"14x14":6,"16x16":7,"18x18":8,"20x20":9,"22x22":10,"24x24":11,"26x26":12,"32x32":13,"36x36":14,"40x40":15,"44x44":16,"48x48":17,"52x52":18,"64x64":19,"72x72":20,"80x80":21,"88x88":22,"96x96":23,"104x104":24,"120x120":25,"132x132":26,"144x144":27,"8x18":28,"8x32":29,"12x26":30,"12x36":31,"16x36":32,"16x48":33},StringAlignment:{Near:1,Center:2,Far:3},PeriodType:{None:0,Day:1,Week:2,ThirdMonth:3,HalfMonth:4,Month:5,Quarter:6,HalfYear:7,Year:8,Calendar:9},OCGroupHeaderVAlign:{Top:1,Bottom:2,Middle:3},controlLayout:{auto:0,table:1,absolute:2},detailgridResize:{asDesign:0,fitWidth:1,onlyGrow:2}},gr.locale={supportIntl:!!window.Intl,decimalSep:".",thousandSep:",",dateSep:"-",timeSep:":",textAM:"上午",textPM:"下午",currencySymbol:"¥"},gr.script={names:{Global:"GlobalScript",Initialize:"InitializeScript",FetchRecord:"FetchRecordScript",BeforePostRecord:"BeforePostRecordScript",BeforeSort:"BeforeSortScript",ProcessBegin:"ProcessBeginScript",ProcessEnd:"ProcessEndScript",ProcessRecord:"ProcessRecordScript",GroupBegin:"GroupBeginScript",GroupEnd:"GroupEndScript",Format:"FormatScript",FieldGetDisplayText:"FieldGetDisplayTextScript",TextBoxGetDisplayText:"TextBoxGetDisplayTextScript",CustomDraw:"CustomDrawScript"},calcExp:function(expText){var result=NaN;expText="result="+expText;try{eval(expText)}catch(e){result=NaN}return result},nameMember:function(e){return e+"_f"},execEvent:function(Report,Sender,scriptName){try{eval("Report._rsns."+Sender[gr.script.nameMember(scriptName)]+"(Sender);")}catch(e){Sender.report.root._scriptFailed||(alert("执行报表脚本 '"+scriptName+"' 失败"+(Sender.Name?"\n对象名称: "+Sender.Name:"")+"\n错误信息: "+e.toString()+"\n脚本代码:\n"+Sender[scriptName]),Sender.report.root._scriptFailed=1)}}}}(),function(e){"use strict";var t=gr.enum_,r=gr.const_,o=gr.helper={},n=gr.common={},i=r.MILLISECONDS_DAY,a=r.TIMEZONE_OFFSET,l=o.assignJSONMembers=function(t,r,o){var n,i,a;o===e&&(o=t.report.isWR),o&&(a=gr.wr.wrPropNameDecode);for(i in r)n=r[i],"object"!=typeof n&&(o&&(i=a(i)),t.hasOwnProperty(i)&&(t[i]=n))},s=o.enumMemberValid=function(e,t,r){"number"!=typeof e[t]&&(e[t]=x(r,e[t]))},c=o.enumBitMemberValid=function(e,t,r){"number"!=typeof e[t]&&(e[t]=S(r,e[t]))},u=o.colorMemberValid=function(e,r,o){var n=e[r];"number"==typeof n?4278190080&n||!o||(e[r]=n|o<<24):(n=t.ColorIdent.hasOwnProperty(n)?t.ColorIdent[n]:parseInt("0x"+n,16),4278190080&n||!o||(n|=o<<24),e[r]=n)},d=o.penStyleText=function(e){var r={Solid:"solid",Dash:"dashed",Dot:"dotted",DashDot:"dashed",DashDotDot:"dotted"};return g(e.Width)+" "+r[v(t.PenStyle,e.Style)]+" "+w(e.Color)},f=o.fontHeight=function(e){return 4*e.Point/3},p=(o.fontString=function(e,t,r){return t+" "+g(e)+" "+r},o.fontCSSText=function(e){var t="",r=[];return e.Italic&&r.push("italic"),e.Bold&&r.push("bold"),r.push(g(f(e)),e.Name),r.forEach(function(e){t&&(t+=" "),t+=e}),t}),h=(o.tagCSSChild=function(e){return 1==e?"first-child":"nth-child("+e+")"},o.tagCSSChildR=function(e){return 1==e?"last-child":"nth-last-child("+e+")"},o.intFixed=function(e,t){var r,o=e+"";if(t>0)if(r=t-o.length,0>r)o=o.substr(-r);else for(;r-- >0;)o="0"+o;return o},function(e){var t=e.toFixed(2),r=t.length-1;return"0"===t.charAt(r)&&("0"===t.charAt(r-1)&&(r-=2),t=t.substr(0,r)),t}),g=o.pixelsToHtml=function(e){return h(e)+"px"},m=(o.percentToHtml=function(e){return h(e)+"%"},o.cloneDate=function(e){return new Date(e)}),C=o.confirmDateValue=function(t){function o(){function o(){var e=t.indexOf(":"),o=e>0&&8>e,n=t.split(/[\:\-\/ ]/g),i=n.length,a=i>0?+n[0]:0,l=i>1?+n[1]:0,s=i>2?+n[2]:0,c=i>3?+n[3]:0,u=i>4?+n[4]:0,d=i>5?+n[5]:0;return isNaN(l)&&(e=n[1],l=r.HZ_NUMBER.indexOf(e.charAt(0))+1,e.length>=3&&(l+=r.HZ_NUMBER.indexOf(e.charAt(1))+1)),o&&(e=a,a=c,c=e,e=l,l=u,u=e,e=s,s=d,d=e),s>31&&(e=a,a=s,s=e,e=l,l=s,s=e),l>12&&(e=l,l=s,s=e),new Date(a,--l,s,c,u,d)}var n;return"string"==typeof t?(n=Date.parse(t),t=t?isNaN(n)?o():new Date(n):e):(n=new L,n.AsFloat=+t,t=n.value),t}return Date.prototype.isPrototypeOf(t)?t:L.prototype.isPrototypeOf(t)?t.value:o()},b=(o.confirmCloneDateValue=function(e){return Date.prototype.isPrototypeOf(e)?m(e):C(e)},o.strimDate=function(e){var t=e.getTime();e.setTime(t-(t-6e4*e.getTimezoneOffset())%i)},o.incDate=function(e){e.setTime(e.getTime()+i)},o.incDate2=function(e,t){e.setTime(e.getTime()+t*i)}),x=(o.periodRangeBy=function(e,t){function r(){11>s?++s:(++c,s=0)}var o,n=e.getDate(),i=e.getMonth(),a=e.getFullYear(),l=n,s=i,c=a;if(2>=t)o={begin:m(e),end:m(e)},b(o.end,1===t?1:7);else{switch(t){case 3:10>=n?(n=1,l=11):20>=n?(n=11,l=21):(n=21,r(),l=1);break;case 4:15>=n?(n=1,l=16):(n=16,r(),l=1);break;case 5:n=l=1,r();break;case 6:n=l=1,i-=i%3,s=i,r(),r(),r();break;case 7:n=l=1,i=6>i?0:6,s=6>i?6:0,s||c++;break;case 8:n=l=1,i=s=0,c++}o={begin:new Date(a,i,n),end:new Date(c,s,l)}}return o},o.periodRangeNext=function(e,t){function r(){11>s?++s:(++c,s=0)}var o,n=e.begin.getDate(),i=e.begin.getMonth(),a=e.begin.getFullYear(),l=n,s=i,c=a;if(2>=t)o={begin:m(e.end),end:m(e.end)},b(o.end,1===t?1:7);else{switch(t){case 3:10>=n?(n=11,l=21):20>=n?(n=21,l=1,r()):(n=1,l=11,r(),a=c,i=s);break;case 4:15>=n?(n=16,l=1,r()):(n=1,l=16,r(),a=c,i=s);break;case 5:r(),a=c,i=s,r();break;case 6:r(),r(),r(),a=c,i=s,n=l,r(),r(),r();break;case 7:i?(i=0,a++,s=6):(i=6,s=0),c++;break;case 8:a++,c++,c++}o={begin:new Date(a,i,n),end:new Date(c,s,l)}}return o},o.confirmBooleanValue=function(e){if(e.constructor===Boolean.prototype.constructor)return e;if("string"==typeof e){if(e.toLowerCase(),"TRUE"===e||"true"===e)return!0;e=parseInt(e)}return!!e},o.ensureNameText=function(e){return/^[A-Za-z_\u0100-\uffff][\w\u0100-\uffff]*$/.test(e)||(e="["+e+"]"),e},o.enumName2Value=function(t,r){var o=t[r];if(o===e){r=r.toUpperCase();for(var n in t)if(n.toUpperCase()===r)return t[n];o=-1}return o}),v=o.enumValue2Name=function(e,t){for(var r in e)if(e[r]===t)return r;return""},S=function(e,t){var r,o,n,i=0;for(t=t.substring(1,t.length-1),r=t.split("|"),n=r.length,o=0;n>o;o++)i+=e[r[o]]||0;return i},T=o.rgba2color=function(e,t,r,o){return y(e|t<<8|r<<16,o)},y=o.colorAlpha=function(e,t){return e|t<<24},F=o.color2rgba=function(e){return{r:255&e,g:e>>8&255,b:e>>16&255,a:e>>24&255}},w=o.colorValue2Html=function(e){function t(e){return(16>e?"0":"")+e.toString(16)}var r=255&e,o=e>>8&255,n=e>>16&255,i=e>>24&255;return"#"+t(r)+t(o)+t(n)+(i?t(255-i):"")},D=o.colorIsBlack=function(e){return 16777215&e},P=(o.decodeTextColor=function(e){var t,r,o,n,i,a=4;return"rgb("===e.substr(0,4)&&(t=e.indexOf(")",a),-1!==t&&(e=e.substring(4,t),r=e.split(","),3===r.length&&(o=parseInt(r[0]),n=parseInt(r[1]),i=parseInt(r[2]),o>=0&&255>=o&&n>=0&&255>=n&&i>=0&&255>=i)))?{color:T(o,n,i,255),index:t+1}:0},o.colorGradientLight=function(e){var t=F(e),r=120/255;return t.r+=(255-t.r)*r,t.g+=(255-t.g)*r,t.b+=(255-t.b)*r,t.r>255&&(t.r=255),t.g>255&&(t.g=255),t.b>255&&(t.b=255),T(t.r,t.g,t.b,t.a)},o.colorGradientDark=function(e){var t=F(e),r=30/255;return t.r-=t.r*r,t.g-=t.g*r,t.b-=t.b*r,t.r<0&&(t.r=0),t.g<0&&(t.g=0),t.b<0&&(t.b=0),T(t.r,t.g,t.b,t.a)},o.prototypeLinkExtend=function(e,t){function r(){}var o,n=e.prototype;r.prototype=t.prototype,o=new r;for(var i in n)o[i]=n[i];e.prototype=o,e.prototype.constructor=e},o.prototypeCopyExtend=function(e,t){var r=t.prototype,o=e.prototype;for(var n in r)o.hasOwnProperty(n)||(o[n]=r[n]);o.constructor=e},o.createArray=function(e,t){for(var r=[],o=0;o++<e;)r.push(t);return r},o.assignObjectEx=function(e,t,r){var o,n;for(var i in t)t.hasOwnProperty(i)&&(o=t[i],n=typeof o,r&&"object"===n?(e[i]||(e[i]={}),R(e[i],o)):e[i]=o);return e}),R=o.assignObject=function(e,t){P(e,t,1)},A=(o.assignObjectAtom=function(e,t){var r;for(var o in t)t.hasOwnProperty(o)&&(r=t[o],"object"!=typeof r&&(e[o]=r));return e},o.compareObject=function(e,t){var r;if(e===t)return 1;if(!e||!t)return 0;for(var o in e)if(r=typeof e[o],"object"===r){if(!A(e[o],t[o]))return 0}else if("function"!==r&&e[o]!==t[o])return 0;return 1}),B=(o.parseXML=function(t){function r(){for(var e,r=0,o=t.indexOf("<",r),n=[];o>=0;)o>r&&(e=t.substring(r,o),/\S/g.test(e)&&n.push(e)),r=o,o=t.indexOf(">",r+1),n.push(t.substring(r,++o)),r=o,o=t.indexOf("<",r);return n}var o;/\s/g.test(t)&&(t=r().join(""));try{o=(new DOMParser).parseFromString(t,"text/xml")}catch(n){o=e}return o},o.xmlToReportDataJSON=function(e){var t,r,o,n,i="",a={};for(o=e.childNodes[0].firstChild;o;){for(o.nodeName!==i&&(i=o.nodeName,r=[],a[o.nodeName]=r),t={},n=o.firstChild;n;)t[n.nodeName]=n.hasOwnProperty("text")?n.text:n.textContent,n=n.nextSibling;r.push(t),o=o.nextSibling}return a},o.getRelativePosition=function(e){var t,r,o=e.originalEvent||e,n=e.currentTarget||e.srcElement,i=n.getBoundingClientRect();return o.touches?(t=o.touches[0].clientX-i.left,r=o.touches[0].clientY-i.top):(t=o.clientX-i.left,r=o.clientY-i.top),{x:t,y:r}},o.addEvent=function(e,t,r){e.addEventListener?e.addEventListener(t,r):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r}),E=o.removeEvent=function(e,t,r){e.removeEventListener?e.removeEventListener(t,r,!1):e.detachEvent?e.detachEvent("on"+t,r):e["on"+t]=noop},G=(o.bindEvents=function(e,t,r){e.events||(e.events={}),t.forEach(function(t){e.events[t]=function(){r.apply(e,arguments)},B(e.canvas,t,e.events[t])})},o.unbindEvents=function(e,t){t.forEach(function(t,r){E(e.canvas,r,t)})},o.toRadians=function(e){return e*Math.PI/180}),L=(o.toDegree=function(e){return 180*e/Math.PI},n.DateTime=function(){this.value=new Date});n.DateTime.prototype={get Year(){return this.value.getFullYear()},get Month(){return this.value.getMonth()+1},get Day(){return this.value.getDate()},get Hour(){return this.value.getHours()},get Minute(){return this.value.getMinutes()},get Second(){return this.value.getSeconds()},get DayOfWeek(){return this.value.getDay()},get DayOfYear(){var e=this.value,t=e.getFullYear();return(new Date(t,e.getMonth(),e.getDate()).getTime()-new Date(t,0,1).getTime())/i+1},get AsFloat(){return(this.value.getTime()+new Date(1970,0,1).getTime()-new Date(1899,11,30).getTime()-a)/i},set AsFloat(e){this.value.setTime(e*i+new Date(1899,11,30).getTime()-new Date(1970,0,1).getTime()+a)},ValueFromDate:function(e,t,r){this.value=new Date(e,t-1,r)},ValueFromDateTime:function(e,t,r,o,n,i){this.value=new Date(e,t-1,r,o,n,i)},Format:function(e){return new gr.format.DateTimeFormatter(e).format(this.value)}};var N=n.Rect=function(e,t,r,o){var n=this;n.left=e,n.top=t,n.right=r,n.bottom=o};n.Rect.prototype={clone:function(){var e=this;return new n.Rect(e.left,e.top,e.right,e.bottom)},IsRectEmpty:function(){var e=this;return e.left>=e.right||e.top>=e.bottom},PtInRect:function(e,t){var r=this;return r.left<=e&&e<r.right&&r.top<=t&&t<r.bottom},Width:function(){var e=this;return e.right-e.left},Height:function(){var e=this;return e.bottom-e.top},SetRect:function(e,t,r,o){var n=this;n.left=e,n.top=t,n.right=r,n.bottom=o},InflateRect:function(e,t){var r=this;r.left-=e,r.top-=t,r.right+=e,r.bottom+=t},OffsetRect:function(e,t){var r=this;r.left+=e,r.top+=t,r.right+=e,r.bottom+=t},IntersectRect:function(e){var t=this;t.left=Math.max(t.left,e.left),t.top=Math.max(t.top,e.top),t.right=Math.min(t.right,e.right),t.bottom=Math.min(t.bottom,e.bottom)}};var M=n.Pen=function(t,r,o){var n=this;t===e&&(t=1),r===e&&(r=0),o===e&&(o=0),n.Width=t,n.Color=r,n.Style=o};M.prototype={clone:function(){var e=this,t=new M;return t.Width=e.Width,t.Style=e.Style,t.Color=e.Color,t},loadFromJSON:function(e,r,o){e&&(l(this,e,o),s(this,"Style",t.PenStyle),u(this,"Color",r))},getDashStyle:function(){var e;switch(this.Style){case 1:e=[2,2];break;case 2:e=[1,1];break;case 3:e=[2,1,1,1];break;case 4:e=[2,1,1,1,1,1];break;default:e=[]}return e}};var O=n.Border=function(e){var t=this;t.Styles=e,t.Shadow=!1,t.ShadowWidth=4,t.ShadowColor=0,t.Pen=new M};n.Border.prototype={loadFromJSON:function(e,r,o){var n=this;e&&(l(n,e,o),c(n,"Styles",t.BorderStyle),u(n,"ShadowColor",0),e.Pen&&n.Pen.loadFromJSON(e.Pen,r,o))},clone:function(){var e=this,t=new O;return t.Styles=e.Styles,t.Shadow=e.Shadow,t.ShadowWidth=e.ShadowWidth,t.ShadowColor=e.ShadowColor,t.Pen=e.Pen.clone(),t},getLeftWidth:function(){var e=this;return 1&e.Styles?e.Pen.Width:0},getRightWidth:function(){var e=this;return(4&e.Styles?e.Pen.Width:0)+(e.Shadow?e.ShadowWidth:0)},getTopWidth:function(){var e=this;return 2&e.Styles?e.Pen.Width:0},getBottomWidth:function(){var e=this;return(8&e.Styles?e.Pen.Width:0)+(e.Shadow?e.ShadowWidth:0)}};var _=n.Font=function(){var e=this;e.Point=10.5,e.Bold=!1,e.Italic=!1,e.Underline=!1,e.Strikethrough=!1,e.Name=""};_.prototype={loadFromJSON:function(e,t){e&&l(this,e,t)},clone:function(){var e=this,t=new _;return t.Point=e.Point,t.Bold=e.Bold,t.Italic=e.Italic,t.Underline=e.Underline,t.Strikethrough=e.Strikethrough,t.Name=e.Name,t},get Height(){return this.Point},get LineWidth(){return 1.168*this.Height}},n.FontWrapper=function(e){this.parentFont=e},n.FontWrapper.prototype={loadFromJSON:function(e,t){var r=this;e&&(r.prepareModify(),r.font.loadFromJSON(e,t))},assign:function(e){var t=this;e.font?t.font=e.font.clone():delete t.font},prepareModify:function(){var e=this;e.font||(e.font=e.parentFont.UsingFont().clone())},Clone:function(){var e=this,t=new n.FontWrapper(e.parentFont);return t.font=e.UsingFont().clone(),t},UsingFont:function(){var e=this;return e.font?e.font:e.parentFont.UsingFont()},get Name(){return this.UsingFont().Name},set Name(e){var t=this;t.prepareModify(),t.font.Name=e},get Point(){return this.UsingFont().Point},set Point(e){var t=this;t.prepareModify(),t.font.Point=e},get Bold(){return this.UsingFont().Bold},set Bold(e){var t=this;t.prepareModify(),t.font.Bold=e},get Italic(){return this.UsingFont().Italic},set Italic(e){var t=this;t.prepareModify(),t.font.Italic=e},get Underline(){return this.UsingFont().Underline},set Underline(e){var t=this;t.prepareModify(),t.font.Underline=e},get Strikethrough(){return this.UsingFont().Strikethrough},set Strikethrough(e){var t=this;t.prepareModify(),t.font.Strikethrough=e}};var V=n.TextFormat=function(){var e=this;e.WordWrap=!1,e.EndEllipsis=!1,e.TextAlign=33,e.TextOrientation=0,e.TextAngle=0,e.CharacterSpacing=0,e.LineSpacing=0,e.FirstCharIndent=0,e.HtmlTags=!1};V.prototype={loadFromJSON:function(e,r){var o=this,n="CharSpacing",i="LnSpacing";e&&(l(o,e,r),r&&(n=gr.wr.wrPropNameEncode(n),i=gr.wr.wrPropNameEncode(i)),n=e[n],n&&(o.CharacterSpacing=n),i=e[i],i&&(o.LineSpacing=i),s(o,"TextAlign",t.TextAlign),s(o,"TextOrientation",t.TextOrientation))},Clone:function(){var e=this,t=new V;return t.WordWrap=e.WordWrap,t.EndEllipsis=e.EndEllipsis,t.TextAlign=e.TextAlign,e.TextOrientation=e.TextOrientation,e.TextAngle=e.TextAngle,t.CharacterSpacing=e.CharacterSpacing,t.LineSpacing=e.LineSpacing,t.FirstCharIndent=e.FirstCharIndent,t}},n.BinaryObject=function(){},n.BinaryObject.prototype={Empty:function(){delete this._v},Free:function(){},GetItemBuf:function(e){return 0},GetItemSize:function(e){return 0},LoadFromBase64Text:function(e){return this._v=e,1},LoadFromField:function(e){return this._v=e.AsString,1},LoadFromFile:function(e){return this._v=e,1},SaveToFile:function(e){return 0},get AsBase64Text(){return this._v},get DataBuf(){return this._v},get DataSize(){var e=this._v;return e?e.length():0},get ItemCount(){return 0}},n.Picture=function(){},n.Picture.prototype={get Height(){return 0},get Type(){return 0},get Width(){return 0},Free:function(){},LoadFromBinary:function(e){return this._v=e._v,1},LoadFromFile:function(e){return this._v=e,1},SaveToFile:function(e){return 0}},n.BigNum=function(){},n.BigNum.prototype={get AsFloat(){return 0},set AsFloat(e){},get AsInteger(){return 0},set AsInteger(e){},get AsString(){return""},set AsString(e){},get DDBits(){return 0},set DDBits(e){},get Positive(){return 1},set Positive(e){},get Height(){return 0},get Type(){return 0},get Width(){return 0},Add:function(e){},Add2:function(e){},Assign:function(e){},Clone:function(e){return new n.BigNum},Divide:function(e){},Divide2:function(e){},Format:function(e){return""},Free:function(){},Multiply:function(e){},Multiply2:function(e){},Subtract:function(e){},Subtract2:function(e){}},n.ImageList=function(){this.items=[]},n.ImageList.prototype={Item:function(e){var t=this;return t.items[e-1]},loadFromJSON:function(e,t){var r=this.items;e&&e.forEach(function(e){r.push(e.Image?e.Image:e.cB)})},get Count(){return this.items.length}},n.Context=function(e){var t=this;t.ctx=e,e.textBaseline="top",t.pens=[new M],t.fills=[e.fillStyle],t.fonts=[],t.clips=[]},n.Context.prototype={get width(){return this.ctx.canvas.width},get height(){return this.ctx.canvas.height},get usingFont(){var e=this.fonts,t=e.length;return e[t-1]},selectFillStyle:function(e){var t=this;t.fills.push(e),t.ctx.fillStyle=e},selectFillColor:function(e){this.selectFillStyle(w(e))},restoreFillStyle:function(){var e=this,t=e.fills;t.pop(),e.ctx.fillStyle=t[t.length-1]},selectPen:function(e){var t=this;t.pens.push(e),t._applyPen()},selectPen2:function(e,t,r){this.selectPen(new M(e,t,r))},restorePen:function(){var e=this;e.pens.pop(),e._applyPen()},selectFont:function(e){var t=this,r=t.fonts,o=r[r.length-1];e!==o&&(t.ctx.font=p(e)),r.push(e)},restoreFont:function(){var e=this,t=e.fonts,r=t.pop(),o=t[t.length-1];t.length>0?o!==r&&(e.ctx.font=p(o)):e.ctx.font=""},fontPointTo:function(e){var t=this,r=t.usingFont.clone();r.Point=e,t.selectFont(r)},pushClipRect:function(e,t,r,o){var n=this,i=this.ctx,a=n.clips,l=a.length,s=new N(e,t,e+r,t+o);l&&s.IntersectRect(a[l-1]),a.push(s),i.beginPath(),i.rect(s.left,s.top,s.Width(),s.Height()),i.clip()},popClipRect:function(){var e=this,t=this.ctx,r=t.canvas,o=e.clips,n=o.length;rect,o.pop(rect),rect=n>1?o[n-2]:new N(0,0,r.width,r.height),t.beginPath(),t.rect(rect.left,rect.top,rect.Width(),rect.Height()),t.clip()},measureTextWidth:function(e){return this.ctx.measureText(e).width},measureTextHeight:function(e){return f(this.usingFont)},drawText:function(e,t,r){this.ctx.fillText(e,t,r)},drawTextCenter:function(e,t,r){var o=this.ctx;o.textAlign="center",o.fillText(e,t,r),o.textAlign="start"},drawTextAlign:function(e,t,r,o,n,i,a){var l,s=this,c=f(s.usingFont),u=2&i,d=4&i,p=32&i,h=64&i;p?r+=(n-c)/2:h&&(r+=n-c),(u||d)&&(l=s.measureTextWidth(e),(!a||o>l)&&(t+=u?(o-l)/2:o-l)),a?s.ctx.fillText(e,t,r,o):s.ctx.fillText(e,t,r)},drawTextAlign2:function(e,t,r,o){this.drawTextAlign(e,t.left,t.top,t.Width(),t.Height(),r,o)},drawFormatText:function(e,t,r,o,n,i){var a=this;0===i.TextOrientation?i.TextAngle?a.drawTextRotate(e,t,r,i.TextAngle):i.CharacterSpacing||i.LineSpacing||i.FirstCharIndent||i.ParagraphSpacing||1!==i.FontWidthRatio||128&i.TextAlign?a.drawTextAlign(e,t,r,o,n,i.TextAlign):a.drawTextAlign(e,t,r,o,n,i.TextAlign):a.drawOrientationText(e,t,r,o,n,i)},drawFormatText2:function(e,t,r){this.drawFormatText(e,t.left,t.top,t.Width(),t.Height(),r)},drawOrientationText:function(e,t,r,o,n,i){var a=this,l=a.ctx,s=0,c=e.length,u=f(a.usingFont),d=i.TextOrientation,p=32&d;if(p)a.drawTextAlign(e,t,r,o,n,i.TextAlign);else for(;c>s;)l.fillText(e[s++],t,r),r+=u},drawTextRotate:function(e,t,r,o){var n=this.ctx;n.translate(t,r),n.rotate(G(-o)),this.ctx.fillText(e,0,0),n.setTransform(1,0,0,1,0,0)},drawEqualSpaceText:function(e,t,r,o){for(var n,i,a=this,l=t,s=e.length,c=0,u=(r-t)/s;s>c;)n=t+u*(c+1),i=e.substr(c++,1),a.drawText(i,(n+l-a.measureTextWidth(i))/2,o),l=n},beginPath:function(){var e=this;e.ctx.beginPath(),e.inpath=1},closePath:function(){this.ctx.closePath()},stroke:function(){var e=this;e.ctx.stroke(),e.inpath=0},fill:function(){var e=this;e.ctx.fill(),e.inpath=0},strokefill:function(){var e=this;e.ctx.stroke(),e.ctx.fill(),e.inpath=0},fillRect:function(e,t,r,o,n){var i=this;i.selectFillColor(n),i.ctx.fillRect(e,t,r,o),i.restoreFillStyle(n)},fillRect2:function(e,t){this.fillRect(e.left,e.top,e.Width(),e.Height(),t)},moveTo:function(e,t){var r=this,o=r.ctx;!r.inpath&&o.beginPath(),o.moveTo(e,t)},lineTo:function(e,t){var r=this,o=r.ctx;o.lineTo(e,t),!r.inpath&&o.stroke()},drawLine:function(e,t,r,o){var n=this.ctx;n.beginPath(),n.moveTo(e,t),n.lineTo(r,o),n.stroke()},drawPolyLine:function(e,t,r){var o=this.ctx,n=0,i=e.length;for(o.beginPath(),o.moveTo(e[n++],e[n++]);i>n;)o.lineTo(e[n++],e[n++]);r&&o.closePath(),o.stroke(),t&&o.fill()},bezierCurveTo:function(e,t,r,o,n,i){this.ctx.bezierCurveTo(e,t,r,o,n,i)},polyBezier:function(e){var t,r=this.ctx,o=e.length;for(r.beginPath(),r.moveTo(e[0].x,e[0].y),t=1;o>t;t++)r.bezierCurveTo(e[t].x,e[t++].y,e[t].x,e[t++].y,e[t].x,e[t].y);r.stroke()},circle:function(e,t,r,o,n){var i=this.ctx,a=(o>r?r:o)/2;e+=r/2,t+=o/2,i.beginPath(),i.arc(e,t,a,0,2*Math.PI),i.stroke(),n&&i.fill()},ellipse:function(e,t,r,o,n){var i=this.ctx,a=r>o?r:o,l=r/a,s=o/a;e+=r/2,t+=o/2,a/=2,i.beginPath(),i.save(),i.scale(l,s),i.arc(e/l,t/s,a,0,2*Math.PI),i.restore(),i.stroke(),n&&i.fill()},rectangle:function(e,t,r,o,n){var i=this;i.ctx.strokeRect(e,t,r,o),n&&i.ctx.fillRect(e,t,r,o)},rectangle2:function(e,t){this.rectangle(e.left,e.top,e.Width(),e.Height(),t)},square:function(e,t,r,o,n){var i=o>r?r:o;e+=(r-i)/2,t+=(o-i)/2,this.rectangle(e,t,i,i,n)},roundRectangle:function(e,t,r,o,n,i,a){var l=this.ctx;l.beginPath(),l.moveTo(e+n,t),l.lineTo(e+r-n,t),l.quadraticCurveTo(e+r,t,e+r,t+i),l.lineTo(e+r,t+o-i),l.quadraticCurveTo(e+r,t+o,e+r-n,t+o),l.lineTo(e+n,t+o),l.quadraticCurveTo(e,t+o,e,t+o-i),l.lineTo(e,t+i),l.quadraticCurveTo(e,t,e+n,t),l.stroke(),a&&l.fill()},roundSquare:function(e,t,r,o,n,i,a){var l=o>r?r:o;e+=(r-l)/2,t+=(o-l)/2,this.roundRectangle(e,t,l,l,n,i,a)},arc:function(e,t,r,o,n){var i=this,a=i.ctx,l=!i.inpath;l&&a.beginPath(),a.arc(e,t,r,-G(o),-G(n),n>=o),l&&a.stroke()},ellipseArc:function(e,t,r,o,n,i){var a=this,l=a.ctx,s=!a.inpath,c=l.ellipse,u=r/2,d=o/2,f=e+u,p=t+d,h=i>=n,n=-G(n),i=-G(i);s&&l.beginPath(),c?l.ellipse(f,p,u,d,0,n,i,h):l.arc(f,p,Math.min(u,d),n,i,h),s&&l.stroke()},pie:function(e,t,r,o,n,i){var a=this,l=a.ctx;o=G(o),n=G(n),l.beginPath(),l.moveTo(e,t),l.arc(e,t,r,-o,-n,1),l.closePath(),l.stroke(),i&&l.fill()},ellipsePie:function(e,t,r,o,n,i,a){var l,s,c=this.ctx,u=c.ellipse,d=r/2,f=o/2,p=e+d,h=t+f,g=i>=n;n=G(n),i=G(i),u||(d=f=Math.min(d,f)),l=p+Math.cos(n)*d,s=h-Math.sin(n)*f,c.beginPath(),c.moveTo(p,h),c.lineTo(l,s),u?c.ellipse(p,h,d,f,0,-n,-i,g):c.arc(p,h,d,-n,-i,g),c.closePath(),c.stroke(),a&&c.fill()},drawBar:function(e,t,r,o){var n,i=this,a=i.ctx,l=[{x:e.left,y:e.bottom},{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.right,y:e.bottom}];i.selectFillColor(r),i.selectPen(t),a.fillRect(e.left,e.top,e.Width(),e.Height()),a.beginPath(),n=l[o],a.moveTo(n.x,n.y),n=l[++o%4],a.lineTo(n.x,n.y),n=l[++o%4],a.lineTo(n.x,n.y),n=l[++o%4],a.lineTo(n.x,n.y),a.stroke(),i.restorePen(),i.restoreFillStyle()},DrawHorzLine:function(e,t,r){this.drawLine(t,e,r,e)},DrawVertLine:function(e,t,r){this.drawLine(e,t,e,r)},DrawPointMarker:function(t,r,o,n){function i(){var e,o=10===r?4:11===r?5:12===r?6:10,n=2*Math.PI/o,i=n/2,a=t.Width()/2,l=a/2,s=t.left+a,u=t.top+a,d=Math.PI/2,f=[];for(e=0;o>e;e++)f.push(s+Math.cos(d)*a,u-Math.sin(d)*a),d+=i,f.push(s+Math.cos(d)*l,u-Math.sin(d)*l),d+=i;c.drawPolyLine(f,1,1)}function a(){var e,i=o&&u;i&&(e=o.clone(),e.Color=n,c.selectPen(e)),c.drawLine(t.left,t.top,t.right,t.bottom),c.drawLine(t.left,t.bottom,t.right,t.top),9===r&&(l=(t.left+t.right)/2,c.drawLine(l,t.top,l,t.bottom),s=(t.top+t.bottom)/2,c.drawLine(t.left,s,t.right,s)),i&&c.restorePen()}var l,s,c=this,u=n!==e,d=t.Width(),f=Math.min(4,(d-4)/2);switch(u&&c.selectFillColor(n),o&&c.selectPen(o),r){case 3:case 4:case 5:c.ellipse(t.left,t.top,t.Width(),t.Height(),1),4===r?c.circle((t.left+t.right)/2-1,(t.top+t.bottom)/2-1,2,2,0):5===r&&(d=Math.min(4,d/3),c.drawLine(t.left+d,t.top+d,t.right-d,t.bottom-d),c.drawLine(t.right-d,t.top+d,t.left+d,t.bottom-d));break;case 0:case 1:case 2:c.rectangle(t.left,t.top,t.Width(),t.Height(),1),1===r?c.drawPolyLine([t.left+f,t.top+d/2,t.left+d/2,t.bottom-f,t.right-f,t.top+f]):2===r&&(c.drawLine(t.left+f,t.top+f,t.right-f,t.bottom-f),c.drawLine(t.right-f,t.top+f,t.left+f,t.bottom-f));break;case 8:case 9:a();break;case 6:c.drawPolyLine([(t.left+t.right)/2,t.top,t.left,(t.top+t.bottom)/2,(t.left+t.right)/2,t.bottom,t.right,(t.top+t.bottom)/2],1,1);break;case 7:c.drawPolyLine([(t.left+t.right)/2,t.top,t.left,t.bottom,t.right,t.bottom],1,1);break;case 10:case 11:case 12:case 13:i()}o&&c.restorePen(),u&&c.restoreFillStyle()},_applyPen:function(){var e=this,t=e.ctx,r=e.pens,o=r[r.length-1];t.lineWidth=o.Width,t.strokeStyle=w(o.Color),t.setLineDash(o.getDashStyle())}},n.Graphics=function(e){var t=this;t.report=e,t.ByUnit=0},n.Graphics.prototype={toPixels:function(e){var t=this;return t.ByUnit?t.report.UnitToPixels(e):e},pixelsTo:function(e){var t=this;return t.ByUnit?t.report.PixelsToUnit(e):e},get Left(){return 0},get Top(){return 0},get Width(){var e=this;return e.pixelsTo(e.ctx.width)},get Height(){var e=this;return e.pixelsTo(e.ctx.height)},attach:function(e){this.ctx=e},MoveTo:function(e,t){var r=this;r.ctx.moveTo(r.toPixels(e),r.toPixels(t))},LineTo:function(e,t){var r=this;r.ctx.lineTo(r.toPixels(e),r.toPixels(t))},FillRect:function(e,t,r,o,n){var i=this;i.ctx.fillRect(i.toPixels(e),i.toPixels(t),i.toPixels(r),i.toPixels(o),n)},Rectangle:function(e,t,r,o,n){var i=this;i.ctx.rectangle(i.toPixels(e),i.toPixels(t),i.toPixels(r),i.toPixels(o),n)},RoundRect:function(e,t,r,o,n,i,a){var l=this;l.ctx.roundRectangle(l.toPixels(e),l.toPixels(t),l.toPixels(r),l.toPixels(o),l.toPixels(n),l.toPixels(i),a)},Ellipse:function(e,t,r,o,n){var i=this;i.ctx.ellipse(i.toPixels(e),i.toPixels(t),i.toPixels(r),i.toPixels(o),n)},Pie:function(e,t,r,o,n,i){var a=this;a.ctx.pie(a.toPixels(e),a.toPixels(t),a.toPixels(r),o,n,i)},Arc:function(e,t,r,o,n){var i=this;i.ctx.arc(i.toPixels(e),i.toPixels(t),i.toPixels(r),o,n)},EllipseArc:function(e,t,r,o,n,i){var a=this;a.ctx.ellipseArc(a.toPixels(e),a.toPixels(t),a.toPixels(r),a.toPixels(o),n,i)},EllipsePie:function(e,t,r,o,n,i,a){var l=this;l.ctx.ellipsePie(l.toPixels(e),l.toPixels(t),l.toPixels(r),l.toPixels(o),n,i,a)},DrawLabelText:function(e,t,r){var o=this;o.ctx.drawText(e,o.toPixels(t),o.toPixels(r))},DrawRotateText:function(e,t,r,o){var n=this;n.ctx.drawTextRotate(e,n.toPixels(t),n.toPixels(r),o)},DrawText:function(e,t,r,o,n,i,a){var l=this;l.ctx.drawTextAlign(e,l.toPixels(t),l.toPixels(r),l.toPixels(o),l.toPixels(n),i)},DrawFormatText:function(e,t,r,o,n,i){var a=this;a.ctx.drawFormatText(e,a.toPixels(t),a.toPixels(r),a.toPixels(o),a.toPixels(n),i)},DrawFormatTextShrinkToFit:function(e,t,r,o,n,i){var a=this;a.ctx.drawTextAlign(e,a.toPixels(t),a.toPixels(r),a.toPixels(o),a.toPixels(n),i.TextAlign,1)},CalcLabelTextWidth:function(e){var t=this;return t.pixelsTo(t.ctx.measureTextWidth(e))},CalcLabelTextHeight:function(e){var t=this;return t.pixelsTo(t.ctx.measureTextHeight(e))},CalcTextOutLen:function(e,t,r,o){return r.length},CalcDrawFormatTextHeight:function(e,t,r){var o=this;return o.pixelsTo(o.ctx.measureTextHeight(e))},CalcDrawFormatTextWidth:function(e,t){var r=this;return r.pixelsTo(r.ctx.measureTextWidth(e))},CalcDrawFormatTextOutLen:function(e,t,r,o){return e.length},DrawPicture:function(e,t,r,o,n,i,a,l){},SelectFont:function(e){this.ctx.selectFont(e.font)},RestoreFont:function(){this.ctx.restoreFont()},FontPointChangeTo:function(e){this.ctx.fontSizeTo(e)},FontSizeRestore:function(){this.ctx.restoreFont()},SelectTextColor:function(e){this.ctx.selectFillColor(e)},RestoreTextColor:function(){this.ctx.restoreFillStyle()},SelectPen:function(e,t,r){this.ctx.selectPen2(e,t,r)},RestorePen:function(){this.ctx.restorePen()},SelectFillColor:function(e){this.ctx.selectFillColor(e)},RestoreFillColor:function(){this.ctx.restoreFillStyle()},PushClipRect:function(e,t,r,o){var n=this;n.ctx.pushClipRect(n.toPixels(e),n.toPixels(t),n.toPixels(r),n.toPixels(o))},PopClipRect:function(){this.ctx.popClipRect()},CurveTo:function(e,t,r,o,n,i){var a=this;a.ctx.bezierCurveTo(a.toPixels(e),a.toPixels(t),a.toPixels(r),a.toPixels(o),a.toPixels(n),a.toPixels(i))},CalcCurveControlPoints:function(e,t,r,o,n,i){var a=this,l=.4,s=Math.sqrt(Math.pow(r-e,2)+Math.pow(o-t,2)),c=Math.sqrt(Math.pow(n-r,2)+Math.pow(i-o,2)),u=s+c,d=1,f=1;
u>0&&(d=l*s/u,f=l*c/u),a.CCPInnerX=r-d*(n-e),a.CCPInnerY=o-d*(i-t),a.CCPOuterX=r+f*(n-e),a.CCPOuterY=o+f*(i-t)},DrawPointMarker:function(e,t,r,o){var n=this;t=n.toPixels(t),r=n.toPixels(r),o=n.toPixels(o/2),n.ctx.DrawPointMarker(new N(t-o,r-o,t+o,r+o),e)},BeginPath:function(){this.ctx.beginPath()},ClosePath:function(){this.ctx.closePath()},EndPath:function(){},StrokePath:function(){this.stroke()},FillPath:function(){this.fill()},StrokeAndFillPath:function(){this.strokefill()}},n.HtmlStyles=function(){this.items=[]},n.HtmlStyles.prototype={add:function(e,t){this.items.push({name:e,value:t})},addBackColor:function(e){this.add("background-color",w(e))},addCellBorder:function(e){var t=this;e.ShowRowLine&&t.add("border-bottom",d(e.ColLinePen)),e.ShowColLine&&t.add("border-right",d(e.RowLinePen))},addObjectPadding:function(e){var t=e.padding,r="";return t.Right===t.Left&&t.Top===t.Bottom?(t.Right!==t.Top&&(r=g(t.Top)+" "),r+=g(t.Right)):r=g(t.Top)+" "+g(t.Right)+" "+g(t.Bottom)+" "+g(t.Left),this.add("padding",r)},addBorder:function(e){var t,r=this;e.Styles&&(t=d(e.Pen),15===e.Styles?r.add("border",t):(1&e.Styles&&r.add("border-left",t),4&e.Styles&&r.add("border-right",t),2&e.Styles&&r.add("border-top",t),8&e.Styles&&r.add("border-bottom",t))),e.Shadow&&(t=g(e.ShadowWidth)+" ",r.add("box-shadow",t+t+w(e.ShadowColor)))},addTextFormat:function(e,t){var r,o=this,n=e.TextFormat,i=n.LineSpacing,a="text-align",l=n.WordWrap;1&n.TextAlign?o.add(a,"left"):2&n.TextAlign?o.add(a,"center"):4&n.TextAlign?o.add(a,"right"):o.add(a,"justify"),t&&(a="vertical-align",16&n.TextAlign?o.add(a,"top"):32&n.TextAlign?o.add(a,"middle"):o.add(a,"bottom")),n.EndEllipsis&&(o.add("text-overflow","ellipsis"),l=!1),l?o.add("white-space","normal"):(o.add("overflow","hidden"),o.add("white-space","nowrap")),n.CharacterSpacing&&o.add("letter-spacing",g(n.CharacterSpacing)),i&&(r=f(e.obj.getUsingFont()),o.add("line-height",h((r+i)/r))),n.FirstCharIndent&&o.add("text-indent",g(n.FirstCharIndent)),D(n.ForeColor)&&o.add("color",w(n.ForeColor))},getText:function(){var e="";return this.items.forEach(function(t){e+=t.name+":"+t.value+";"}),e},clear:function(){this.items=[]}};var H=n.HtmlStyles;n.HtmlElement=function(e,t){var r=this;r.tag=e,r.classes=[],t.addChild(this)},n.HtmlElement.prototype={get styles(){var e=this;return e._styles||(e._styles=new H),e._styles},addClass:function(e){this.classes.push(e)},addStyle:function(e,t){this.styles.add(e,t)},addBackColorStyle:function(e){this.styles.addBackColor(e)},addAttribute:function(e,t){var r=this;r._attributes||(r._attributes=[]),r._attributes.push({name:e,value:t})},addChild:function(e){var t=this;t.children||(t.children=[]),t.children.push(e)},beginText:function(){var t=this,r="<"+t.tag;return t.classes.length>0&&(r+=' class="',t.classes.forEach(function(e,t){t>0&&(r+=" "),r+=e}),r+='"'),t._styles&&(r+=' style="'+t._styles.getText()+'"'),t._attributes&&t._attributes.forEach(function(t){var o=t.value;r+=" "+t.name,o!==e&&(r+='="'+o+'"')}),t.skipend&&(r+="/"),r+=">"},endText:function(){var e=this;return e.skipend?"":"</"+e.tag+">"}}}(),function(e){"use strict";gr.wr={WRZipSource:['":"','","','"},{"','":{"','},{"','":',',"',"false"],WRZipDest:"!$%&@^`~",WRAsciiMap_R:"r<~VH6SAZ?yiO %1#Ek>]`+|F_t/$RgQnX=YbqL)7uU9,oaB5}-'ev4;JD.2WsP@3zhl\"cfC^(K0mx!&Td{*GM:[pIj8\\Nw",propNameMap:{AlternatingBackColor:"G",BackColor:"Q",BarcodeType:"b",BorderCustom:"i",CharSpacing:"x",DBFieldName:"WA",FreeCell:"AB",GroupLabel:"OB",GroupTitle:"PB",Height:"ZB",IsCrossTab:"jB",LeftMargin:"tB",LnSpacing:"JC",Name:"YC",Oriention:"eC",RightMargin:"qD",SeriesLabel:"HE",Type:"LF",Value:"UF",Width:"eF"},propNameMap_R:{UG:"AbortOnError",A:"AdjustRowHeight",B:"AlignColumn",C:"AlignColumnEx",D:"AlignColumnSide",E:"AlignToGrid",F:"Alignment",VG:"AlternateFonts",G:"AlternatingBackColor",H:"AlwaysShowHScrollBar",I:"AlwaysShowVScrollBar",J:"Anchor",K:"AppendBlankCol",L:"AppendBlankColWidth",M:"AppendBlankRow",N:"AppendBlankRowAtLast",O:"AppendBlankRowExclude",P:"Author",Q:"BackColor",R:"BackImage",S:"BackImageFile",T:"BackImagePreview",U:"BackImagePrint",V:"BackStyle",W:"BackgroundColor",WG:"Bar3DAxisDepth",XG:"BarDPI",X:"BarRatio",Y:"BarSingleSeriesColor",Z:"BarWidth",a:"BarWidthPercent",b:"BarcodeType",YG:"BeforeHeaders",c:"BeforePostRecordScript",d:"BeforeSortScript",e:"BeginDateParameter",f:"Bold",ZG:"BookmarkLevel",g:"BookmarkText",h:"BorderColor",i:"BorderCustom",j:"BorderPrintType",k:"BorderStyles",l:"BorderWidth",m:"BottomMargin",n:"BubbleScalePerCm",o:"ByFields",p:"ByY2Axis",q:"CanGrow",r:"CanShrink",s:"CaptionAlignment",t:"CaptionPosition",u:"Center",v:"CenterView",w:"CenterWithDetailGrid",x:"CharSpacing",y:"CharacterSpacing",z:"Charset",AA:"Chart3D",aG:"Chart3DViewAngle",BA:"ChartType",CA:"CheckSum",bG:"ClassPos",DA:"CodePage",EA:"ColLineColor",FA:"ColLineWidth",GA:"ColSpan",HA:"Color",IA:"Column",JA:"ColumnCount",KA:"ColumnMove",LA:"ColumnResize",MA:"ConditionScript",NA:"ConnectionString",OA:"ContinuePrint",PA:"CoordLineColor",QA:"CoordLineVisible",RA:"CornerDx",SA:"CornerDy",TA:"Cursor",UA:"CustomDraw",VA:"CustomDrawScript",WA:"DBFieldName",XA:"DataField",YA:"DataName",ZA:"DataType",cG:"DateTimeAxis",aA:"Description",tG:"DetailToLastPage",bA:"Direction",cA:"DisabledSumFields",dA:"DisplayField",eA:"Dock",fA:"DtmxEncoding",gA:"DtmxMatrixSize",hA:"DtmxModuleSize",iA:"Editable",jA:"EndDateParameter",kA:"EndEllipsis",lA:"ExportBeginScript",mA:"ExportEndScript",nA:"FalseText",oA:"FetchRecordScript",pA:"FillColor",qA:"FillColorAuto",rA:"FillStyle",sA:"FirstCharIndent",tA:"FixCols",uA:"FixedWidth",vA:"FlowTo",wA:"FontWidthRatio",xA:"ForeColor",yA:"Format",zA:"FormatScript",AB:"FreeCell",dG:"GeneratePagesBeginScript",eG:"GeneratePagesEndScript",BB:"GetDisplayTextScript",CB:"GlobalScript",DB:"GridColsPerUnit",fG:"GridCount",EB:"GridLinePrintType",FB:"GridRowsPerUnit",gG:"GridSpacing",hG:"GridWidth",GB:"GroupAuto",HB:"GroupAutoSum",IB:"GroupBeginScript",JB:"GroupCount",KB:"GroupEndScript",LB:"GroupField",MB:"GroupIndex",NB:"GroupKeepTogether",OB:"GroupLabel",PB:"GroupTitle",QB:"GrowToBottom",RB:"GrowToNextRow",SB:"HCrossFields",TB:"HCrossPeriodType",UB:"HNewPageFixed",VB:"HPercentColumns",WB:"HResort",XB:"HSortAsc",YB:"HTotalAtFirst",ZB:"Height",iG:"HeightScale",aB:"HideOnRecordsetEmpty",bB:"HtmlTags",cB:"Image",dB:"ImageFile",eB:"ImageIndex",fB:"IncludeFooter",gB:"InitializeScript",hB:"InnerIndent",iB:"InnerStyles",jB:"IsCrossTab",kB:"Italic",lB:"KeepTogether",mB:"L2R",nB:"Label",oB:"LabelAsGroup",pB:"LabelInBar",qB:"LabelText",rB:"LabelTextAngle",sB:"Left",tB:"LeftMargin",uB:"LegendAtBottom",vB:"LegendColumnCount",wB:"LegendCursor",xB:"LegendShowSum",yB:"LegendSumLabel",zB:"LegendValueVisible",AC:"LegendVisible",BC:"Length",CC:"LimitsPerPage",DC:"LineColor",EC:"LineSpacing",FC:"LineType",GC:"LineVisible",HC:"LineWeight",IC:"ListCols",JC:"LnSpacing",KC:"Lock",LC:"Locked",MC:"MarginBeginWeight",NC:"MarginEndWeight",OC:"MarginGap",PC:"MarkerColor",QC:"MarkerColorAuto",RC:"MarkerLegendShow",SC:"MarkerSize",TC:"MarkerStyle",UC:"Max",jG:"MaxAtScale",VC:"Min",WC:"MirrorMargins",XC:"MonoPrint",YC:"Name",ZC:"NegativeAsZero",kG:"NegativeValueAbs",lG:"NegativeValueColor",aC:"NewPage",bC:"NewPageColumn",cC:"OccupiedColumns",dC:"OccupyColumn",eC:"Oriention",fC:"PDF417Columns",gC:"PDF417ErrorLevel",hC:"PDF417Rows",iC:"PDF417Simple",jC:"PaddingBottom",kC:"PaddingLeft",lC:"PaddingRight",mC:"PaddingTop",nC:"PageColumnCount",oC:"PageColumnDirection",pC:"PageColumnGroupNA",qC:"PageColumnSpacing",rC:"PageDivideCount",sC:"PageDivideLine",tC:"PageDivideSpacing",uC:"PageEndScript",vC:"PageGroup",wC:"PageProcessRecordScript",xC:"PageStartScript",yC:"ParagraphSpacing",zC:"Parameter",AD:"ParentPageSettings",BD:"PenColor",CD:"PenStyle",DD:"PenWidth",ED:"PercentFormat",FD:"Picture",mG:"Pie3DHeightDepth",GD:"Pitch",nG:"Point",HD:"PointWeight",ID:"PrintAdaptFitText",JD:"PrintAdaptMethod",KD:"PrintAdaptRFCStep",LD:"PrintAdaptRepeat",MD:"PrintAdaptTryToOnePage",ND:"PrintAsDesignPaper",OD:"PrintAtBottom",PD:"PrintBeginScript",QD:"PrintEndScript",RD:"PrintGridBorder",SD:"PrintOffsetSaveToLocal",TD:"PrintOffsetX",UD:"PrintOffsetY",VD:"PrintPageScript",WD:"PrintRotation",XD:"PrintToStretch",YD:"PrintType",ZD:"PrinterName",aD:"ProcessBeginScript",bD:"ProcessEndScript",cD:"ProcessRecordScript",dD:"QRCodeErrorLevel",eD:"QRCodeMask",fD:"QRCodeVersion",gD:"QuerySQL",hD:"RTF",iD:"RTrimBlankChars",jD:"RankNo",kD:"RegisterNo",lD:"RelationFields",mD:"RepeatOnPage",nD:"RepeatStyle",oD:"ReportFile",pD:"ResetPageNumber",qD:"RightMargin",oG:"RotateDegree",rD:"RotateMode",sD:"RowCount",tD:"RowLineColor",uD:"RowLineWidth",vD:"RowSelection",wD:"RowSpan",xD:"RowsIncludeGroup",yD:"RowsPerPage",zD:"SameAsColumn",AE:"ScriptType",BE:"SelectionBackColor",CE:"SelectionForeColor",DE:"SeriesAuto",EE:"SeriesCount",FE:"SeriesCursor",GE:"SeriesField",HE:"SeriesLabel",IE:"SeriesName",JE:"Shadow",KE:"ShadowColor",LE:"ShadowWidth",ME:"ShapeType",NE:"SharePrintSetupOptions",OE:"ShiftMode",pG:"ShiftModeOnHide",PE:"ShowColLine",QE:"ShowGrid",RE:"ShowMoneyDigit",SE:"ShowMoneyLabel",TE:"ShowMoneyLine",UE:"ShowMoneyLineColor",VE:"ShowMoneySepLineColor",WE:"ShowMoneyWidth",XE:"ShowPreviewWndScript",YE:"ShowRowLine",ZE:"ShrinkFontToFit",aE:"SingleSeriesColored",bE:"Size",cE:"SizeMode",dE:"SkipQuery",qG:"SmartRowHeight",eE:"SortAsc",fE:"SortCaseSensitive",gE:"SortFields",hE:"SortSummaryBox",iE:"Space",jE:"SpanToNewPage",uG:"SpanpageOptimize",kE:"Strikethrough",lE:"Style",mE:"Styles",nE:"SubtotalCols",oE:"SummaryFun",pE:"SystemVar",rG:"TOCColumnCount",sG:"TOCReportHeader",qE:"Tag",rE:"Text",sE:"TextAlign",tE:"TextAngle",uE:"TextFormat",vE:"TextOrientation",wE:"TextVisible",xE:"Title",yE:"TitleRepeat",zE:"TitleRows",AF:"ToNewExcelSheet",BF:"TooltipText",CF:"Top",DF:"TopMargin",EF:"TotalCols",FF:"TotalExcludeColumns",GF:"TotalHPercentColumns",HF:"TotalVPercentColumns",IF:"Transparent",JF:"TransparentMode",KF:"TrueText",LF:"Type",MF:"U2D",NF:"Underline",OF:"Unit",PF:"VAlign",QF:"VCrossFields",RF:"VPercentColumns",SF:"VResort",TF:"VSortAsc",UF:"Value",VF:"ValueAsPercent",WF:"ValueFormat",XF:"ValueVisible",YF:"Version",ZF:"Visible",aF:"Watermark",bF:"WatermarkAlignment",cF:"WatermarkSizeMode",dF:"Weight",eF:"Width",fF:"WordWrap",gF:"XAxisLabel",hF:"XAxisMaximum",iF:"XAxisMinimum",jF:"XAxisSpace",kF:"XAxisTextAngle",lF:"XAxisTextFormat",mF:"XAxisTextVisible",nF:"XAxisVisible",oF:"XValueField",pF:"XmlTableName",qF:"YAxisLabel",rF:"YAxisMaximum",sF:"YAxisMinimum",tF:"YAxisSpace",uF:"YAxisTextFormat",vF:"YAxisTextVisible",wF:"YAxisVisible",xF:"YValueField",yF:"ZValueField",zF:"ZValueFormat"},wrPropNameEncode:function(e){var t=gr.wr.propNameMap[e];return t?t:e},wrPropNameDecode:function(e){var t=gr.wr.propNameMap_R[e];return t?t:e},decodeWR:function(e){function t(e){return e>=" "&&"~">=e?p[e.charCodeAt(0)-32]:e}function r(e){return e>=" "&&"~">=e?p[e.charCodeAt(0)-32]:String.fromCharCode(21^e.charCodeAt(0))}var o,n,i,a,l,s="",c=4,u=1,d=e.length,f=gr.wr,p=f.WRAsciiMap_R,h=f.WRZipSource,g=f.WRZipDest,m=[];if("_"===e[c]&&(++c,u=0),u)for(;d>c;)s+=t(e[c++]);else for(;d>c;)s+=r(e[c++]);for(c=0,d=0,a=s[c];"["==a;){for(l={},o=++c;","!=a&&(a=s[++c],!("0">a||a>"9")););if(","!=a)break;for(l.f=+s.substring(o,c),o=++c;"]"!=a&&(a=s[++c],!("0">a||a>"9")););if("]"!=a)break;l.s=+s.substring(o,c++),m.push(l),d=c,a=s[c]}for(e=s.substr(d).split(""),l=m.length;l-- >0;)n=m[l].f,i=m[l].s,a=e[n],e[n]=e[i],e[i]=a;for(d=e.length,s="",c=0;d>c;c++)a=e[c],l=g.indexOf(a),l>=0?s+=h[l]:("#"==a&&(a=e[++c]),s+=a);return s}}}(),function(e){"use strict";var t=(gr.enum_,gr.const_),r=gr.common,o=gr.locale,n=gr.helper,i=n.intFixed,a=n.confirmDateValue,l=n.confirmBooleanValue,s=n.rgba2color,c=n.color2rgba,u=n.decodeTextColor,d=gr.format={};d.BooleanFormatter=function(e){this.parse(e)},d.BooleanFormatter.prototype={parse:function(e){var t,r=this;e?(t=e.indexOf(":"),-1===t?(r.trueValueText=e,r.falseValueText=""):(r.trueValueText=e.substr(0,t),r.falseValueText=e.substr(t+1))):(r.trueValueText="true",r.falseValueText="false")},format:function(e){var t=this;return e=l(e),e?t.trueValueText:t.falseValueText}};var f=function(){this.defaultMe()};f.prototype={defaultMe:function(){var e=this;e.precision=9,e.leastPrecision=0,e.leastIntegerWidth=1,e.showPositive=!1,e.showNegative=!0,e.showSymbolAtHead=!0,e.negativeBracket=!1,e.intSepStep=0,e.asPercent=!1,e.asCurrency=!1,e.blankSepSymbol=!1,e.firstCurrencySymbol=!0,e.exponent=!1,e.textColor=0,e.prefix="",e.suffix=""},isCustomTextColor:function(){return 0!==this.textColor},parse:function(e){function t(e){return-1!=="0#.,+-()$%".indexOf(e)}var r,o,n,i,a,l=this;if(l.defaultMe(),e){if(r=u(e),r&&(e=e.substr(r.index),l.textColor=r.color),a=e.length,l.exponent="e"===e.charAt(0),!l.exponent){for(o=0;a>o&&!t(e.charAt(o));)++o;if(o>0&&(l.prefix=e.substr(0,o),e=e.substr(o),a=e.length),a>o){for(o=a-1;!t(e.charAt(o))&&o>0;)--o;a-1>o&&(l.suffix=e.substr(o+1),e=e.substr(0,o+1),a=e.length)}}for(i=e.indexOf("."),-1===i&&(i=a),o=e.indexOf(","),o>=0&&(l.intSepStep=i-o-1,l.intSepStep<0&&(l.intSepStep=3)),l.negativeBracket=e.indexOf("(")>=0&&e.indexOf(")")>=0,l.asPercent=e.indexOf("%")>=0,l.blankSepSymbol=e.indexOf(" ")>=0,o=e.indexOf("+"),l.showPositive=o>=0,n=e.indexOf("-"),l.showNegative=n>=0||!l.negativeBracket&&!l.isCustomTextColor(),n>o&&(o=n),n=e.indexOf("$"),l.asCurrency=n>=0,n>o&&(o=n),l.showSymbolAtHead=-1===o||i>o,l.asCurrency&&(l.negativeBracket?(o=e.indexOf(l.showSymbolAtHead?"(":")"),l.firstCurrencySymbol=o>n):l.firstCurrencySymbol=o>=n),l.leastIntegerWidth=0,o=0;i>o;++o)"0"===e.charAt(o)&&++l.leastIntegerWidth;for(l.leastPrecision=0,l.precision=0,o=i+1;a>o;++o)"0"===e.charAt(o)?(++l.leastPrecision,++l.precision):"#"===e.charAt(o)&&++l.precision}},format:function(e){var t,r,n,i,a,l,s,u,d,f,p,h=this,g="";if(e=+e,h.isCustomTextColor()&&(t=c(h.textColor),g="[_color#=rgb("+t.r+","+t.g+","+t.b+")]"),h.asPercent&&(e*=100),h.exponent){if(r=e,0>r&&(r=-r),n=0,0!==r){for(;r>=10;)r/=10,++n;for(;1>r;)r*=10,--n}return h.exponent=!1,0>e&&(r=-r),g+=h.format(r),g+="e",n>=0?g+="+":(g+="-",n=-n),g+=n,h.exponent=!0,g}if(p=e.toFixed(h.precision),f=p.length,h.precision>h.leastPrecision){for(i=f-1,a=i-h.precision+h.leastPrecision;i>a&&"0"===p.charAt(i);i--);"."!==p.charAt(i)&&i++,i<p.length&&(p=p.substr(0,i),f=i)}if(l=p.indexOf("."),0>l&&(l=f),g+=h.prefix,h.showSymbolAtHead?(h.asCurrency&&h.firstCurrencySymbol&&(g+=o.currencySymbol),0>e?h.negativeBracket&&(g+="("):h.showPositive&&e>0&&(g+="+"),h.asCurrency&&!h.firstCurrencySymbol&&(g+=o.currencySymbol),h.blankSepSymbol&&(g+=" ")):h.negativeBracket&&0>e&&(g+="("),i=0,s=l,0>e&&(--s,++i,h.showNegative&&(g+="-")),u=h.leastIntegerWidth-s,d=s,u>0)for(d+=u;d>s;)g+="0",d--,h.intSepStep>0&&d%h.intSepStep===0&&(g+=o.thousandSep);else for(;u++<0&&"0"===p.charAt(i);)i++;if(h.intSepStep>0)for(;d>0;)g+=p.charAt(i++),--d%h.intSepStep===0&&0!==d&&(g+=o.thousandSep);else g+=p.substring(i,l);return f>l&&(g+=p.substr(l)),h.showSymbolAtHead?h.negativeBracket&&0>e&&(g+=")"):(h.blankSepSymbol&&(g+=" "),h.asCurrency&&h.firstCurrencySymbol&&(g+=o.currencySymbol),0>e?g+=h.negativeBracket?")":"-":h.showPositive&&e>0&&(g+="+"),h.asCurrency&&!h.firstCurrencySymbol&&(g+=o.currencySymbol)),h.asPercent&&(g+="%"),g+=h.suffix}};var p=function(e){e=e.substring(1,e.length-1);for(var t=e.split(","),r=0;r<t.length;r++){var o=t[r],n=o.indexOf("=");this[o.substr(0,n)]=o.substr(n+1)}};p.prototype={format:function(t){var r=this[t];return r===e&&(r=""),r}};var h="$$",g="$$$";d.NumericFormatter=function(e){this.parse(e)},d.NumericFormatter.prototype={defaultMe:function(){var t=this;t.formatType=0,t.positiveAnalyser=new f,t.negativeAnalyser&&(t.negativeAnalyser=e),t.zeroAnalyser&&(t.zeroAnalyser=e),t.intEnumAnalyser&&(t.intEnumAnalyser=e)},parse:function(e){function t(e){var t,r;t=e.split(";"),r=t.length,o.positiveAnalyser.parse(t[0]),r>1&&""!==t[1]&&(o.negativeAnalyser=new f,o.negativeAnalyser.parse(t[1])),r>2&&""!==t[2]&&(o.zeroAnalyser=new f,o.zeroAnalyser.parse(t[2]))}var r,o=this;if(o.defaultMe(),e){var n=e.length;r=e.indexOf(g),-1!==r?(o.formatType=1,e=e.substr(0,r)+e.substr(r+g.length),""!==e&&t(e)):n>=2&&e.substr(0,2)===h?2===n?o.formatType=2:(o.formatType=3,t(e.substr(2))):"{"===e.charAt(0)&&"}"===e.charAt(n-1)?(o.formatType=4,o.intEnumAnalyser=new p(e)):"!hz"===e?o.formatType=5:"!rm"===e?o.formatType=6:"!c"===e?o.formatType=7:"!b"===e?o.formatType=8:"!a"===e?o.formatType=9:"!A"===e?o.formatType=10:t(e)}},format:function(r){function o(e,t,r,o){var n,i,a=!1,l=!1,s=0,c="";for(n=t-1;n>=0;n--,s++)i=parseInt(e.charAt(n)),s%4===0&&s>0&&(a=!0),0===i?l=!0:(l&&(""!==c&&(c=r.charAt(0)+c),l=!1),s>0&&(a&&s%4!==0&&(c=o.charAt(s-s%4)+c),a=!1,c=o.charAt(s)+c),c=r.charAt(i)+c);return""==c&&(c=r.charAt(0)),c}function n(e,r){return o(e,r,t.BIG_AMT_NUMBER,t.HZ_AMT_STEP)}function i(e){var r,o,n="",i=e.length;for(o=0;i>o;o++)r=parseInt(e.charAt(o)),isNaN(r)||(n+=t.BIG_AMT_NUMBER.charAt(r));return n}function a(e){var r,o,i,a,l,s=0>=e;return e>-.005&&.005>e?t.HZ_ZERO_YUAN:(s&&(e=-e),a=e.toFixed(2),r=a.indexOf("."),l=n(a,r),""!==l&&(l+=t.HZ_AMT_STEP.charAt(0)),o=parseInt(a.charAt(r+1)),i=parseInt(a.charAt(r+2)),0===o&&0===i?l+=t.HZ_AMT_UNIT[0]:(0===o&&""===l||(l+=t.BIG_AMT_NUMBER.charAt(o)),0!==o&&(l+=t.HZ_AMT_UNIT.charAt(1)),0!==i?(l+=t.BIG_AMT_NUMBER.charAt(i),l+=t.HZ_AMT_UNIT.charAt(2)):l+=t.HZ_AMT_UNIT.charAt(0)),s&&(l=t.HZ_NEGATIVE+l),l)}function l(e,r){var o,i,a,l,s=Math.max(0,r.precision),c=Math.min(s,r.leastPrecision),u=-.5*Math.pow(.1,s),d=u>=e;for(0>e&&(e=-e),a=e.toFixed(s),o=a.length,i=a.indexOf("."),-1===i&&(i=o),l=n(a,i),""===l&&(l=t.BIG_AMT_NUMBER.charAt(0)),o--;o>i+c&&"0"===a.charAt(o);o--);if(o>i)for(l+="点",i++;o>=i;i++)l+=t.BIG_AMT_NUMBER.charAt(parseInt(a.charAt(i)));return d&&(l=t.HZ_NEGATIVE+l),""!==r.prefix&&(l=r.prefix+l),""!==r.suffix&&(l+=r.suffix),l}function s(e){var r,n=new f;return n.Precision=0,r=n.format(e),r=o(r,r.length,t.HZ_NUMBER,t.HZ_NUMRANK),e>=10&&20>e&&(r=r.substr(1)),r}function c(e){var t,r="";if(0>e||e>=4e3)return"N/A";for(t=Math.floor(e/1e3)%10;t-- >0;)r+="Ⅿ";if(t=Math.floor(e/100)%10,3>=t)for(;t-- >0;)r+="Ⅽ";else 4==t?(r+="Ⅽ",r+="Ⅾ"):5==t?r+="Ⅾ":8>=t?(r+="Ⅾ",r+="Ⅽ",t>=7&&(r+="Ⅽ"),t>=8&&(r+="Ⅽ")):(r+="Ⅽ",r+="Ⅿ");if(t=Math.floor(e/10)%10,3>=t)for(;t-- >0;)r+="Ⅹ";else 4==t?(r+="Ⅹ",r+="Ⅼ"):5==t?r+="Ⅼ":8>=t?(r+="Ⅼ",r+="Ⅹ",t>=7&&(r+="Ⅹ"),t>=8&&(r+="Ⅹ")):(r+="Ⅹ",r+="Ⅽ");return t=e%10,t&&(r+=String.fromCharCode(8544+t-1)),r}function u(e){var t="N/A";return e>=0&&50>=e&&(t=0==e?"⓪":20>=e?String.fromCharCode(9312+e-1):35>=e?String.fromCharCode(12881+e-21):String.fromCharCode(12977+e-36)),t}function d(e){return e>0&&20>e?String.fromCharCode(9332+e-1):"N/A"}function p(e){return e>0&&26>=e?String.fromCharCode(97+e-1):"N/A"}function h(e){return e>0&&26>=e?String.fromCharCode(65+e-1):"N/A"}var g,m=this;if(r=+r,isNaN(r))return"";switch(m.formatType){case 0:case 1:if(m.zeroAnalyser&&r>-.5&&.5>r){var C=m.positiveAnalyser.precision;m.positiveAnalyser.asPercent&&(C+=2);var b=C;m.negativeAnalyser&&(b=m.negativeAnalyser.precision,m.negativeAnalyser.asPercent&&(b+=2));var x=Math.pow(.1,b)*-.5,v=.5*Math.pow(.1,C);r>x&&v>r&&(g=m.zeroAnalyser.format(0))}g===e&&(g=m.negativeAnalyser&&0>r?m.negativeAnalyser.format(r):m.positiveAnalyser.format(r)),1===m.formatType&&(g=i(g));break;case 2:g=a(r);break;case 3:g=l(r,m.positiveAnalyser);break;case 4:g=m.intEnumAnalyser.format(r);break;case 5:g=s(r);break;case 6:g=c(r);break;case 7:g=u(r);break;case 8:g=d(r);break;case 9:g=p(r);break;case 10:g=h(r)}return g}},d.DateTimeFormatter=function(e){this.parse(e)},d.DateTimeFormatter.prototype={parse:function(r){function n(){for(w=1;D[F+1]===P;)F++,w++}function a(){var e=w;w%=2,e=(e-w)/2,e>0&&l(e)}function l(e){var t="",r=B.length;do t+=P;while(--e>0);r>0&&15===B[r-1].type?B[r-1].data+=t:B.push({type:15,data:t,funDisplayText:x})}function s(e,t){return i(e.getFullYear(),t.subtype)}function c(r,n){var a=r.getMonth();return n.subtype<=4?i(a+1,n.subtype):o.supportIntl?5===n.subtype?new Intl.DateTimeFormat(e,{month:"short"}).format(r):new Intl.DateTimeFormat(e,{month:"long"}).format(r):10>a?t.HZ_NUMBER.charAt(a):t.HZ_NUMBER.charAt(9)+t.HZ_NUMBER.charAt(a-10)+t.HZ_DATETIME_UNIT.charAt(5)}function u(e,t){return i(e.getDate(),t.subtype)}function d(r,n){var i;return o.supportIntl?5===n.subtype?new Intl.DateTimeFormat(e,{weekday:"short"}).format(r):new Intl.DateTimeFormat(e,{weekday:"long"}).format(r):(i=r.getDay(),(5===n.subtype?t.HZ_DATETIME_UNIT.substr(0,1):t.HZ_DATETIME_UNIT.substring(2,4))+(i>0?t.HZ_NUMBER.charAt(i-1):t.HZ_DATETIME_UNIT.charAt(1)))}function f(e,t){var r=e.getHours()%12;return r||(r=12),i(r,t.subtype)}function p(e,t){return i(e.getHours(),t.subtype)}function h(e,t){return i(e.getMinutes(),t.subtype)}function g(e,t){return i(e.getSeconds(),t.subtype)}function m(e,t){return e.toLocaleDateString()}function C(e,t){return e.toLocaleTimeString()}function b(e,t){return e.toLocaleString()}function x(e,t){return t.data}function v(e,t){return e.getHours()<12?o.textAM:o.textPM}function S(e,t){return o.dateSep}function T(e,t){return o.timeSep}var y,F,w,D,P,R,A,B=this.items=[];if(r){D=r.split(""),y=D.length,F=0;do{switch(P=D[F],n(),A={},P){case"d":3>w?(A.type=3,A.funDisplayText=u,A.subtype=1===w?0:2):(A.type=4,A.funDisplayText=d,A.subtype=3===w?5:6);break;case"M":A.type=2,A.funDisplayText=c,1===w?A.subtype=0:2===w?A.subtype=2:3===w?A.subtype=5:A.subtype=6;break;case"y":A.type=1,A.funDisplayText=s,A.subtype=3>w?2:0;break;case"h":A.type=5,A.funDisplayText=f,A.subtype=1===w?0:2;break;case"H":A.type=6,A.funDisplayText=p,A.subtype=1===w?0:2;break;case"m":A.type=7,A.funDisplayText=h,A.subtype=1===w?0:2;break;case"s":A.type=8,A.funDisplayText=g,A.subtype=1===w?0:2;break;case"t":2===w&&(A.type=20,A.funDisplayText=v);break;case"%":a(),w&&(R=D[F+1],++F,"d"===R?(A.type=10,A.funDisplayText=m):"t"===R?(A.type=11,A.funDisplayText=C):"g"===R?(A.type=12,A.funDisplayText=b):F--);break;case":":a(),w&&(A.type=22,A.funDisplayText=T);break;case"/":a(),w&&(A.type=21,A.funDisplayText=S);break;default:l(w)}A.type&&15!==A.type&&B.push(A)}while(++F<y)}else B.push({type:12,funDisplayText:b})},format:function(t){var r="";return t!==e&&(t=a(t),this.items.forEach(function(e){r+=e.funDisplayText(t,e)})),r}};var m=gr.Utility={get CCPInnerX(){return 0},get CCPInnerY(){return 0},get CCPOuterX(){return 0},get CCPOuterY(){return 0},get DisableExceptionMsg(){return 0},set DisableExceptionMsg(e){},get DisableHttpFailedMsg(){return 0},set DisableHttpFailedMsg(e){},get DisableNormalMsg(){return 0},set DisableNormalMsg(e){},get MissingCharBox(){return 0},set MissingCharBox(e){},get ShrinkFontMinWidthRatio(){return 0},set ShrinkFontMinWidthRatio(e){},get TextLeftPunctuations(){return 0},set TextLeftPunctuations(e){},get TextRightPunctuations(){return 0},set TextRightPunctuations(e){},get TextWrapByWord(){return 0},set TextWrapByWord(e){},get TextWrapToJustify(){return 0},set TextWrapToJustify(e){},Alert:function(e){alert(e)},AppendResponseBoolean:function(e,t){},AppendResponseNumber:function(e,t){},AppendResponseString:function(e,t){},CalcCurveControlPoints:function(e,t,r,o,n,i){},ColorFromRGB:function(t,r,o,n){return n===e&&(n=1),s(t,r,o,n)},CreatePathOnNeed:function(e){return 0},CreateBigNum:function(){return new r.BigNum},CreateBinaryObject:function(){return new r.BinaryObject},CreateDateTime:function(){return new r.DateTime},CreatePicture:function(){return new r.Picture},CreateRecordset:function(){return new gr.dom.Recordset},CreateTextFormat:function(){return new r.TextFormat},DateTimeFormat:function(e,t){return new d.DateTimeFormatter(t).format(a(e))},NumberFormat:function(e,t){return new d.NumericFormatter(t).format(e)},NumberFormatToBigHZ:function(e,t){var r,o="$$0";if(t>0)for(o+=".",r=0;t>r;r++)o+="0";return m.NumberFormat(e,o)},NumberFormatToBigHZAmount:function(e){return m.NumberFormat(e,"$$")},NumberRound45:function(e,t){var r=Math.pow(10,t);return Math.round(e*r)/r},NumberRound465:function(e,t){var r,o,n,i=Math.pow(10,t+2);return e=Math.floor(e*i),r=e%10,o=e%100-r,e-=o+r,o>=60?e+=100:50===o&&(r>0?e+=100:(n=e%1e3/100,n%2&&(e+=100))),e/i},DisableDebug:function(){},ExtractFileName:function(e){return""},ExtractFilePath:function(e){return""},FormatTextHeight:function(e,t,r,o){return 0},FormatTextOutLen:function(e,t,r,o,n){return 0},FormatTextWidth:function(e,t,r){return 0},GetDefaultPrinterName:function(){return""},GetFontCount:function(){return 0},GetFontName:function(e){return""},GetPrinterCount:function(){return 0},GetPrinterName:function(e){return""},GetPrinterPaperCount:function(e){return 0},GetPrinterPaperName:function(e){return""},LoadFontFromDir:function(e){},LoadFontFromFile:function(e){return 0},Log:function(e){},PathFileExist:function(e){return 0},ReportFontReplace:function(e,t,r){return 0},SetMoneyLabelText:function(e){},TransferResponse:function(){return""}}}(),function(e){"use strict";var t=gr.enum_,r=gr.helper,o=gr.format,n=gr.Utility,i=r.ensureNameText,a=r.enumName2Value,l=r.enumValue2Name,s=r.prototypeCopyExtend,c=(o.BooleanFormatter,o.DateTimeFormatter),u=o.NumericFormatter,d=gr.exp={},f="[#",p="#]",h=2,g=function(e){for(var t,r,o=e.length,n=0,i=0,a=0,l=[];o>n;)t=e[n],a?")"===t?a--:"("===t&&a++:","===t?(r=e.substring(i,n),r&&l.push(r),i=n+1):"("===t&&++a,++n;return r=e.substring(i,n),r&&l.push(r),l},m=d.SummaryItem=function(){};m.prototype={init:function(e,t){var r=this;e&&(r.paramExp=new w(r.report,e)),t&&(r.displayField=r.report.RunningFieldByName(t))},getAsFloat:function(){var e=this;return e.valueField?e.valueField.AsFloat:e.value},getAsString:function(){var e=this;return e.valueField?e.valueField.AsString:e.value},getValue:function(){return this.getAsFloat()},setValue:function(e){var t=this;t.valueField?t.valueField.AsFloat=e:t.value=e},isDateTimeValue:function(){var e=this;return e.argExp&&e.argExp.isSingleVariable()&&e.argExp.varItems[0].varField.isDateTimeValue()},beginSummaryValue:function(){var t=this,r=t.SummaryFun;t.recordCount=0,4===r||5===r?t.value=e:27!==r&&28!==r&&(t.value=0),t.values=[]},summaryCurRecord:function(){var t,r=this,o=r.values,n=r.SummaryFun,i=r.paramExp;switch(++r.recordCount,n){case 12:case 13:return void(i&&i.isNull()&&(r.value+=1));case 14:case 29:case 30:return void(i&&o.push(i.getDisplayText()));case 19:case 18:return void(i&&(t=i.getDisplayText(),0===r.value?r.value=t:(19===n&&r.value.localeCompare(t)<0||18===n&&r.value.localeCompare(t)>0)&&(r.value=t)))}switch(t=i?i.calculate():0,n){case 1:case 2:case 27:case 28:isNaN(t)||(r.value+=t);break;case 26:isNaN(t)||(r.value+=Math.abs(t));break;case 4:case 5:i&&!i.isNull()&&(r.value===e||5===n&&r.value<t||4===n&&r.value>t)&&(r.value=t,r.displayField&&(r.stringValue=r.displayField.DisplayText));break;case 6:case 7:case 8:case 9:case 10:case 11:o.push(t);break;case 16:case 17:case 15:case 20:case 21:case 22:case 23:case 24:case 25:i&&!i.isNull()&&o.push(t)}},endSummaryValue:function(){var t,r,o=this,n=o.values,i=n?n.length:0;switch(o.SummaryFun){case 2:o.recordCount>0?o.value/=o.recordCount:o.value=e;break;case 3:o.value=o.recordCount;break;case 6:case 20:o.value=i>1?o.devSq()/(i-1):e;break;case 7:case 21:o.value=i>1?o.devSq()/i:e;break;case 8:case 22:o.value=i>1?Math.sqrt(o.devSq()/(i-1)):e;break;case 9:case 23:o.value=i>1?Math.sqrt(o.devSq()/i):e;break;case 10:case 24:o.value=o.aveDev();break;case 11:case 25:o.value=o.devSq();break;case 16:case 17:if(n.sort(function(e,t){return e-t}),i<o.rankNo)return e;o.value=n[17===o.SummaryFun?i-o.rankNo:o.rankNo];break;case 13:o.value=o.recordCount-o.value;break;case 15:o.value=o.average();break;case 14:o.value=o.distinct();break;case 30:n=Array.from(new Set(n));case 29:t="",r=o.format,r||(r=o.Format),n.forEach(function(e){r&&t&&(t+=r),t+=e}),o.stringValue=t;break;case 19:case 18:o.stringValue=o.value}},average:function(){var t=this,r=t.values.length,o=0;return t.values.forEach(function(e){o+=e}),r?o/r:e},aveDev:function(){var t=this,r=t.values.length,o=average(),n=0;return t.values.forEach(function(e){n+=Math.abs(e-o)}),r?n/r:e},devSq:function(){var e=average(),t=0;return this.values.forEach(function(r){var o=r-e;t+=o*o}),t},distinct:function(){var e,t,r=this,o=1,n=r.values.length,i=n;for(r.values.sort(function(e,t){return e.localeCompare(t)}),e=r.values[0];n>o;)t=r.values[o++],e===t?i--:e=t;return i}};var C=function(e,t,r){var o,n=this,i=g(r),a="";n.report=e,n.SummaryFun=t,i.length>0&&(o=i[0]),i.length>1&&(n.rankNo=parseInt(i[1])),n.init(o),n.paramExp&&(i=n.paramExp.varItems,1===i.length&&i[0].varField.object&&(a=i[0].varField.object.Format)),n.formater=new u(a)};C.prototype={type:4,getDisplayText:function(){var e=this,t=e.SummaryFun;return 29===t||30===t||18===t||19===t?e.getAsString():e.formater.format(e.getAsFloat())},getExpText:function(){var e=this;return l(t.SummaryFun,e.SummaryFun)+"("+e.paramExp?e.paramExp.getExpText():""+e.RankNo?","+e.RankNo:")"}},s(C,m);var b=function(e,t,r){var o=this,n=g(r);o.report=e,o.MathFun=t,o.paramExps=[],n.forEach(function(t){o.paramExps.push(new w(e,t))})};b.prototype={type:5,getAsFloat:function(){var e,r,o=this,i=o.MathFun,a=o.paramExps,s=a.length,c=1===s,u=0;if(1===i||2===i||22===i||9===i?c=2==s:20!==i&&21!==i||(c=s>1),!c)return alert("表达式中函数 '"+l(t.MathFun,i)+"' 的参数未正确提供。"),NaN;switch(e=a[0].calculate(),r=2===s?a[1].calculate():0,i){case 1:u=n.NumberRound45(e,r);break;case 2:u=n.NumberRound465(e,r);break;case 5:u=Math.abs(e);break;case 6:u=Math.acos(e);break;case 7:u=Math.asin(e);break;case 8:u=Math.atan(e);break;case 9:u=Math.atan2(e,r);break;case 15:u=Math.ceil(e);break;case 16:u=Math.cos(e);break;case 17:u=Math.exp(e);break;case 18:u=Math.floor(e);break;case 19:u=Math.log(e);break;case 20:if(u=e,s>1&&(r>e&&(u=r),s>2))for(;s-- >2;)e=a[s].calculate(),e>u&&(u=e);break;case 21:if(u=e,s>1&&(e>r&&(u=r),s>2))for(;s-- >2;)e=a[s].calculate(),u>e&&(u=e);break;case 22:u=Math.pow(e,r);break;case 23:u=Math.round(e);break;case 24:u=Math.sin(e);break;case 25:u=Math.sqrt(e);break;case 26:u=Math.tan(e)}return u},getValue:function(){var e=this,t=e.valueField;return t?t.AsFloat:e.getAsFloat()},getDisplayText:function(){var e=this,t=e.valueField;return t?t.DisplayText:e.getAsFloat()+""},getExpText:function(){for(var e=this,r=e.paramExps,o=r.length,n=0,i=l(t.MathFun,e.MathFun)+"(";o>n;)n>0&&(i+=","),i+=r[n].getExpText();return i+=")"},isDateTimeValue:function(){return 0}};var x=function(e,r){var o=this,n=r.split(",");o["var"]=a(t.SystemVarType,n[0]),n.length>1&&(o.groupIndex=parseInt(n[1])),o.report=e};x.prototype={type:3,getAsFloat:function(){var e=this;return e.report.SystemVarValue2(e["var"],e.groupIndex)},getValue:function(){return this.getAsFloat()},getDisplayText:function(){var e=this;return e["var"]>0?e.getAsFloat()+"":""},getExpText:function(){var e=this;return"SystemVar("+l(t.SystemVarType,e["var"])+e.groupIndex?","+e.groupIndex:")"},isDateTimeValue:function(){return 1===this["var"]}};var v=function(e){this.oParameter=e};v.prototype={type:2,getAsFloat:function(){return this.oParameter.AsFloat},getValue:function(){return this.oParameter.Value},getDisplayText:function(){var e=this;return e.valueField?e.valueField.DisplayText:e.oParameter.DisplayText},getExpText:function(){return i(this.oParameter.Name)},isDateTimeValue:function(){return 6===this.oParameter.DataType}};var S=function(e){this.object=e};S.prototype={type:1,getAsFloat:function(){return this.object.AsFloat},getValue:function(){return this.object.Value},getDisplayText:function(){return this.object.DisplayText},getExpText:function(){return i(this.object.Name)},isDateTimeValue:function(){return 6===this.object.FieldType}};var T=function(e){this.object=e};T.prototype={type:6,getAsFloat:function(){return parseFloat(this.object.DisplayText)},getValue:function(){return this.getDisplayText()},getDisplayText:function(){return this.object.DisplayText},getExpText:function(){return i(this.object.Name)},isDateTimeValue:function(){return 0}};var y=function(e,t,r){var o=this;o.varField=e,o.beginIndex=t,o.endIndex=r},F=function(e,t){function r(){for(c=u[n];C.test(c);)c=u[++n]}function o(e,r){var o=c===e;return o&&(n=t.indexOf(r,i),-1===n?m=!1:(d=t.substring(i+1,n),
a=++n)),o}var n,i,a,l,s,c,u,d,f,p,h,g=this,m=!0,C=/\s/,b=/[\d.]/,x=/[()+-\/%*]/,v=/[()+-\/%*\s]/;for(u=t.split(""),s=u.length,g.expText=t,g.varItems=[],n=0;s>n&&m;)if(r(),x.test(c)||b.test(c))n++;else{if(i=n,o("{","}"))p=g.decodeVariable(e,d,1);else{if(!o("[","]")){for(;s>n&&!v.test(u[n]);)n++;if(a=n,d=t.substring(i,a),!d)continue}if(r(),"("===c){for(l=++n,h=1;s>n;)if(c=u[n++],")"===c){if(h--,0>=h)break}else"("===c&&h++;f=t.substring(l,n-1),a=n,p=g.decodeFunction(e,d,f)}else p=g.decodeVariable(e,d,0)}p?g.varItems.push(new y(p,i,a)):m=!1}g.valid=m};F.prototype={calculate:function(){var e=this,t=0,r="",o=NaN;return e.valid&&(e.varItems.forEach(function(o){t<o.beginIndex&&(r+=e.expText.substring(t,o.beginIndex)),t=o.endIndex,r+=o.varField.getAsFloat()+""}),r+=e.expText.substr(t),o=gr.script.calcExp(r),(o>=Number.POSITIVE_INFINITY||o<=Number.NEGATIVE_INFINITY)&&(o=NaN)),o},isSingleVariable:function(){var e=this;return 1===e.varItems.length&&0===e.varItems[0].beginIndex&&e.varItems[0].endIndex===e.expText.length}};var w=function(e,t){F.call(this,e,t)};w.prototype={decodeVariable:function(t,r,o){var n,i=e;return o?(n=t.ParameterByName(r))&&(i=new v(n)):(n=t.RunningFieldByName(r))?i=new S(n):(n=t.ParameterByName(r))?i=new v(n):(n=t.ControlByName(r))&&(i=new T(n)),i},decodeFunction:function(e,r,o){var n,i=a(t.SummaryFun,r);return i>=0?n=new C(e,i,o):"SystemVar"===r?n=new x(e,o):(i=a(t.MathFun,r),i>=0&&(n=new b(e,i,o))),n},getExpText:function(){var e=this,t=0,r="";return e.varItems.forEach(function(o){t<o.beginIndex&&(r+=e.expText.substring(t,o.beginIndex)),t=o.endIndex,r+=o.varField.getExpText()}),r+=e.expText.substr(t)},getDisplayText:function(){var e=this;return e.isSingleVariable()?e.varItems[0].varField.getDisplayText():e.calculate()+""},isNull:function(){return this.varItems.some(function(e){return e.varField.object.IsNull})}},s(w,F);var D=function(e,t){var r,o,n,i,a,l=this,s=0,d="";for(r=t.indexOf(":");r>=0&&(o=t.indexOf("[",s),!(-1===o||o>r))&&(o=t.indexOf("]",r),-1!==o);)s=o+1,r=t.indexOf(":",s);r>=0&&(d=l.format=t.substr(r+1),t=t.substr(0,r)),F.call(l,e,t),i=l.isSingleVariable(),i&&(a=l.varItems[0].varField),!d&&i||(n=i&&a.isDateTimeValue(),!n&&d&&"!"!=d.charAt(0)&&(n=/[yMdthHms]/.test(d)&&!/[0#e$]/.test(d)),l.formater=n?new c(d):new u(d)),d&&i&&(a.format=d)};D.prototype={getDisplayText:function(){function e(e){return'"'+e.expText+'" 不是有效的运算表达式'}var t,r=this,o=r.isSingleVariable(),n=r.varItems;return r.valid?!r.formater||o&&n[0].varField.stringValue?t=n[0].varField.getDisplayText():(t=o?n[0].varField.getValue():r.calculate(),t=r.formater.format(t)):t=e(this),t}},s(D,F);var P=function(e,t){D.call(this,e,t)};P.prototype={decodeVariable:w.prototype.decodeVariable,decodeFunction:w.prototype.decodeFunction,isPureNumeric:function(){var e=this;return u.prototype.isPrototypeOf(e.formater)||e.isSingleVariable()&&!e.varItems[0].varField.isDateTimeValue()}},s(P,D);var R=function(e){this.oParameter=e};R.prototype={getAsFloat:function(){return this.oParameter.AsFloat},getValue:function(){return this.oParameter.Value},getDisplayText:function(){return this.oParameter.DisplayText},isDateTimeValue:function(){return 6===this.oParameter.DataType}};var A=function(e,t){var r=this;r.textBuilder=e,r.varType=t};A.prototype={getAsFloat:function(){function e(){var e,t,r=n.graphs,o=r.length;for(e=0;o>e&&(t=r[e],!t.some(function(e){return e===i}));e++);return t}var t,r=this,o=r.textBuilder,n=o.chart,i=o.seriesIndex,a=o.groupIndex;if(n.IsScatterGraph())switch(t=n.Value(i,a),r.varType){case 1:t=t.x;break;case 2:t=t.y;break;case 3:t=t.z;break;case 5:t=t.z/n.GetSeriesTotalValue(i);break;case 7:t=n.GetSeriesTotalValue(i)}else switch(t=n.Value(i,a),r.varType){case 4:t/=n.GetGroupTotalValue(e(),a);break;case 6:t=n.GetGroupTotalValue(e(),a);break;case 5:t/=n.GetSeriesTotalValue(i);break;case 7:Val=n.GetSeriesTotalValue(i)}return t},getValue:function(){return this.getAsFloat()},getDisplayText:function(){var e=this,t=e.varType,r=e.textBuilder,o=r.seriesIndex,i=r.groupIndex,a=r.chart,l=a.IsScatterGraph(),s=a.graphSerieses[o],c=e.getAsFloat(),u=0;if(l)switch(t){case 1:u=1;break;case 2:u=2;break;case 3:case 7:u=3;break;case 5:u=5;break;case 8:u=4}else switch(t){case 1:case 8:case 9:u=4;break;case 2:case 6:case 7:u=2;break;case 4:case 5:u=5}switch(u){case 1:c=a.XAxis.ScaleFormatParser.format(c);case 2:c=l?a.YAxisOfSeries(s).ScaleFormatParser.format(c):s.ValueFormatParser.format(c);break;case 3:c=s.ValueFormatParser.format(c);break;case 4:c=8===t?a.SeriesLabel(o):a.GroupLabel(i);break;case 5:c=n.NumberFormat(c,"0.00%")}return c},isDateTimeValue:function(){return 0}};var B=function(e,t){D.call(this,e,t)};B.prototype={decodeVariable:function(t,r,o){var n=t.chart.report.ParameterByName(r);return n?new R(n):e},decodeFunction:function(e,r,o){var n;return"chartvar"===r.toLowerCase()&&(o=a(t.ChartVarType,o),o>0&&(n=new A(e,o))),n}},s(B,D);var E=function(e){this.text=e};E.prototype={getDisplayText:function(){return this.text}};var G=d.TextBuilder=function(e,t){var r,o=this,n=e.XAxis?B:P,i=0,a=0,l=0;for(o.items=[],e.XAxis&&(o.chart=e,e=this);(a=t.indexOf(f,l))>=0;)l=t.indexOf(p,a+h),l>=0&&(r=new n(e,t.substring(a+h,l)),l+=h,r.valid&&(a>i&&o.items.push(new E(t.substring(i,a))),i=l,o.items.push(r)),a=l);i<t.length&&o.items.push(new E(t.substr(i)))};G.prototype={forEach:function(e){this.items.forEach(e)},generateDisplayText:function(){for(var e,t,r,o,n,i=this,a=i.items,l=0,s=a.length,c="";s>l;){if(e=a[l++],t=e.varItems)for(n=t.length,o=0;n>o;++o)if(r=t[o].varField,3===r.type&&r["var"]<0)return"";c+=e.getDisplayText()}return c},generateChartDisplayText:function(e,t){var r=this;return r.seriesIndex=e,r.groupIndex=t,r.generateDisplayText()},isStaticText:function(){var e=this;return 1==e.items.length&&E.prototype.isPrototypeOf(e.items[0])}}}(),function(undefined){"use strict";function CrossSummaryGetFieldSuffix(e){switch(e){case 2:return csz_HAverage_Suffix;case 15:return csz_HAverageA_Suffix;case 3:return csz_HCount_Suffix;case 13:return csz_HCountA_Suffix;case 4:return csz_HMin_Suffix;case 5:return csz_HMax_Suffix}return""}function CalcPointMarkerRect(e,t,r){return new Rect(e-r,t-r,e+r,t+r)}gr.dom={};var grenum=gr.enum_,grconst=gr.const_,grcommon=gr.common,grhelper=gr.helper,grformat=gr.format,grexp=gr.exp,script=gr.script,BooleanFormatter=grformat.BooleanFormatter,DateTimeFormatter=grformat.DateTimeFormatter,NumericFormatter=grformat.NumericFormatter,SummaryItem=grexp.SummaryItem,TextBuilder=grexp.TextBuilder,DateTime=grcommon.DateTime,Rect=grcommon.Rect,Pen=grcommon.Pen,Border=grcommon.Border,Font=grcommon.Font,FontWrapper=grcommon.FontWrapper,TextFormat=grcommon.TextFormat,ImageList=grcommon.ImageList,Context=grcommon.Context,Graphics=grcommon.Graphics,HtmlStyles=grcommon.HtmlStyles,HtmlElement=grcommon.HtmlElement,assignJSONMembers=grhelper.assignJSONMembers,enumMemberValid=grhelper.enumMemberValid,enumBitMemberValid=grhelper.enumBitMemberValid,colorMemberValid=grhelper.colorMemberValid,fontString=grhelper.fontString,fontHeight=grhelper.fontHeight,intFixed=grhelper.intFixed,pixelsToHtml=grhelper.pixelsToHtml,percentToHtml=grhelper.percentToHtml,penStyleText=grhelper.penStyleText,tagCSSChild=grhelper.tagCSSChild,tagCSSChildR=grhelper.tagCSSChildR,cloneDate=grhelper.cloneDate,confirmDateValue=grhelper.confirmDateValue,confirmCloneDateValue=grhelper.confirmCloneDateValue,strimDate=grhelper.strimDate,incDate=grhelper.incDate,incDate2=grhelper.incDate2,confirmBooleanValue=grhelper.confirmBooleanValue,ensureNameText=grhelper.ensureNameText,enumName2Value=grhelper.enumName2Value,enumValue2Name=grhelper.enumValue2Name,rgba2color=grhelper.rgba2color,colorAlpha=grhelper.colorAlpha,color2rgba=grhelper.color2rgba,colorGradientLight=grhelper.colorGradientLight,colorGradientDark=grhelper.colorGradientDark,colorValue2Html=grhelper.colorValue2Html,prototypeLinkExtend=grhelper.prototypeLinkExtend,prototypeCopyExtend=grhelper.prototypeCopyExtend,createArray=grhelper.createArray,assignObjectEx=grhelper.assignObjectEx,assignObject=grhelper.assignObject,assignObjectAtom=grhelper.assignObjectAtom,parseXML=grhelper.parseXML,getRelativePosition=grhelper.getRelativePosition,addEvent=grhelper.addEvent,bindEvents=grhelper.bindEvents,wrPropNameEncode=gr.wr?gr.wr.wrPropNameEncode:undefined,toDegree=grhelper.toDegree,toRadians=grhelper.toRadians,uidCanvas=function(){var e=0;return function(){return"-gr-canvas-"+e++}}(),calcSectionsHeightPercent=function(e){var t=0,r=0;e.length&&(e.forEach(function(e){t+=e.pxHeight}),e.forEach(function(e){e.pctHeight=Math.round(100*e.pxHeight/t),r+=e.pctHeight}),e[0].pctHeight+=100-r)},calcSectionsPixelTotalHeight=function(e){var t=0;return e.forEach(function(e){t+=e.pxHeight}),t},Collection=function(e){var t=this;t.owner=e,t.items=[]};Collection.prototype={loadFromJSON:function(e){var t,r=0;if(e)for(t=e.length;t>r;)this._doloadItem(e[r++])},getJsonMember:function(e){return this.owner.report.isWR?wrPropNameEncode(e):e},assign:function(e){var t=this;t.RemoveAll(),e.forEach(function(e){t.Add().assign(e)})},attachData:function(){for(var e=this.items,t=e.length;t--;)e[t].attachData()},prepare:function(){for(var e=this.items,t=0,r=e.length;r>t;)e[t++].prepare()},unprepare:function(){for(var e=this.items,t=e.length;t--;)e[t].unprepare()},generate:function(e){for(var t=this.items,r=0,o=t.length;o>r;)t[r++].generate(e)},itemByName:function(e){var t,r=this.items,o=r.length;if(e)for(e=e.toUpperCase();o--;)if(t=r[o],t.Name.toUpperCase()===e)return t;return undefined},indexOfCOMIndex:function(e){return e?("number"!=typeof e&&(e=this.IndexByName(e||"")),--e):e=-1,e},indexOf:function(e){for(var t=this.items,r=t.length;r--;)if(e===t[r])return r;return-1},decodeItems:function(e){var t,r=this,o=[];return e&&(t=e.split(";"),t.forEach(function(e){var t;e=e.trim(),t=r.itemByName(e),t&&o.push(t)})),o},forEach:function(e){this.items.forEach(e)},_doloadItem:function(e){this.Add().loadFromJSON(e)},get Count(){return this.items.length},Item:function(e){var t=this;return t.items[t.indexOfCOMIndex(e)]},Add:function(){var e=this,t=e._createItem();return e.items.push(t),t},Remove:function(e){var t=this;e=t.indexOfCOMIndex(e),e>=0&&t.items.splice(e,1)},RemoveAll:function(){this.items=[]},IndexByName:function(e){var t=this.items,r=t.length;if(e)for(;r--;)if(t[r].Name===e)return r+1;return-1},ItemAt:function(e){var t=this.items;return e--,e>=0&&e<t.length?t[e]:undefined},ChangeItemOrder:function(e,t){var r=this.items;if(o,len=r.length,t=Math.max(1,Math.min(len,t))-1,e!=t&&e>0&&e--<=len)if(o=r[e],t>e){do r[e]=r[e+1];while(++e<t)}else{do r[e]=r[e-1];while(--e>t);r[t]=o}}};var Controls=function(e){Collection.call(this,e)};Controls.prototype={_doloadItem:function(e){var t=this,r=t.Add(enumName2Value(grenum.ControlType,e[t.getJsonMember("Type")]));r&&r.loadFromJSON(e)},assign:function(e){var t=this;t.RemoveAll(),e.forEach(function(e){t.Add(e.ControlType).assign(e)})},layout:function(){for(var e=this,t=e.items,r=e.owner.getRect(),o=0,n=t.length;n>o;)t[o++].layout(r)},generate:function(e){for(var t,r=this.items,o=r.length;o--;)t=r[o],t.Visible&&t.generate(e)},Add:function(e){function t(e,t){var r=undefined;switch(e){case 1:r=new StaticBox(t);break;case 2:r=new ShapeBox(t);break;case 10:r=new Line(t);break;case 3:r=new SystemVarBox(t);break;case 4:r=new FieldBox(t);break;case 5:r=new SummaryBox(t);break;case 7:r=new PictureBox(t);break;case 8:r=new MemoBox(t);break;case 9:r=new SubReport(t);break;case 11:r=new Chart(t);break;case 12:r=new Barcode(t);break;case 13:r=new FreeGrid(t);break;case 14:r=new CharGridBox(t);break;case 6:r=new RichTextBox(t)}return r}var r=this,o=t(e,r.owner);return o&&r.items.push(o),o}},prototypeLinkExtend(Controls,Collection);var Columns=function(e){Collection.call(this,e)};Columns.prototype={_doloadItem:function(e){var t=this,r=new Column(t.owner);r.loadFromJSON(e),t.items.push(r)},addTo:function(e){var t,r,o=this,n=o.owner.ColumnContent.ContentCells,i=new Column(o.owner);return o.items.push(i),t=new ColumnTitleCell(e,!1),e.items.push(t),i.TitleCell=t,t.Column=i,r=new ColumnContentCell(n),n.items.push(r),i.ContentCell=r,r.Column=i,i},Add:function(){var e=this;return e.addTo(e.owner.ColumnTitle.TitleCells)},Remove:function(e){function t(e,r){var o,n,i=e.indexOf(e);if(i>=0)return e.splice(i,1),1;for(i=e.length,n=0;i>n;n++)if(o=e[n],o.GroupTitle&&t(o.SubTitles.items,r))return 1;return 0}var r,o=this,n=o.owner,i=n.ColumnContent.ContentCells.items;e=o.indexOfCOMIndex(e),e>=0&&(r=o.items[e],i.splice(i.indexOf(r.ContentCell),1),t(n.ColumnTitle.TitleCells.items,r.TitleCell),o.items.splice(e,1))},RemoveAll:function(){var e=this,t=e.owner;e.items=[],t.ColumnContent.ContentCells.items=[],t.ColumnTitle.TitleCells.items=[]}},prototypeLinkExtend(Columns,Collection);var ColumnTitleCells=function(e,t){var r=this;Collection.call(r,e),r.supcell=t};ColumnTitleCells.prototype={_doloadItem:function(e){var t=this,r=new ColumnTitleCell(t,e[t.getJsonMember("GroupTitle")]);r.loadFromJSON(e),t.items.push(r)},assign:function(e){var t=this;t.items=[],e.forEach(function(e){var r=new ColumnTitleCell(t,e.GroupTitle);t.items.push(r),r.assign(e),e.GroupTitle&&r.SubTitles.assign(e.SubTitles)})},AddGroup:function(e,t){var r=this,o=new ColumnTitleCell(r,!0);return o.Name=e,o.Text=t,r.items.push(o),o},RemoveGroup:function(e){var t=this,r=t.Item(e);r&&r.GroupTitle&&(Collection.prototype.Remove.call(t,e),t.items=t.items.concat(r.SubTitles.items))},Add:function(){},Remove:function(e){},RemoveAll:function(){}},prototypeLinkExtend(ColumnTitleCells,Collection);var ColumnContentCells=function(e){Collection.call(this,e)};ColumnContentCells.prototype={_doloadItem:function(e){var t=this,r=new ColumnContentCell(t);r.loadFromJSON(e),t.items.push(r)},assign:function(e){var t=this;t.items=[],e.forEach(function(e){var r=new ColumnContentCell(t);t.items.push(r),r.assign(e)})},Add:function(){},ChangeItemOrder:function(e,t){},Remove:function(e){},RemoveAll:function(){}},prototypeLinkExtend(ColumnContentCells,Collection);var Fields=function(e){Collection.call(this,e)};Fields.prototype._createItem=function(){return new Field(this.owner)},prototypeLinkExtend(Fields,Collection);var Groups=function(e){Collection.call(this,e)};Groups.prototype={_createItem:function(){return new Group(this.owner)},_doloadItem:function(e){this.Add().loadFromJSON(e)}},prototypeLinkExtend(Groups,Collection);var ReportHeaders=function(e){Collection.call(this,e)};ReportHeaders.prototype._createItem=function(){return new ReportHeader(this.owner)},prototypeLinkExtend(ReportHeaders,Collection);var ReportFooters=function(e){Collection.call(this,e)};ReportFooters.prototype._createItem=function(){return new ReportFooter(this.owner)},prototypeLinkExtend(ReportFooters,Collection);var Parameters=function(e){Collection.call(this,e)};Parameters.prototype._createItem=function(){return new Parameter(this.owner)},prototypeLinkExtend(Parameters,Collection);var Object=function(e){var t=this;t.owner=e,t.report=e.report,t.Tag=""};Object.prototype={afterLoad:function(e){},loadFromJSON:function(e){var t=this;e&&(assignJSONMembers(t,e),t.afterLoad(e))},assign:function(e){var t,r,o=this,n=o.Font,i=e.onclick,a=e.ondblclick;for(var l in e)o.hasOwnProperty(l)&&(t=e[l],r=typeof t,"object"!==r&&"array"!==r&&(o[l]=t));n&&n.assign(e.Font),i&&(o.onclick=i),a&&(o.ondblclick=a),o.children&&o.children.forEach(function(t){var r=e[t];r&&(r.owner?o[t].assign(r):assignObject(o[t],r))})},registerEventClass:function(){var e=this,t=e.report.viewer._domevents,r=e.onclick,o=e.ondblclick;r&&!e.onclickClassID&&(t.push({obj:e,type:1,fun:r}),e.onclickClassID=t.length),o&&!e.ondblclickClassID&&(t.push({obj:e,type:2,fun:o}),e.ondblclickClassID=t.length)},resetEventClass:function(){var e=this;e.onclickClassID&&delete e.onclickClassID,e.ondblclickClassID&&delete e.ondblclickClassID},addElementEventClass:function(e){var t=this,r=t.report.viewer,o=t.onclickClassID,n=t.ondblclickClassID;o&&e.addClass(r._getEventCSSName(o)),n&&e.addClass(r._getEventCSSName(n))},getUsingFont:function(){return this.Font.UsingFont()},getJsonMember:function(e){return this.report.isWR?wrPropNameEncode(e):e},toFillBack:function(){var e=this;return e.BackColor!==e.owner.BackColor||e.fixed},getRunningNo:function(){var e=this,t=e.report.ownerSR,r=t?1e4*t.getRunningNo():0;return r+e._runningNo()},_runningNo:function(){return 0}};var CellBase=function(e){var t=this;Object.call(t,e),t._borderCustom=!1,t.BackColor=e.BackColor,t.CanGrow=!1,t.CanShrink=!1,t.Font=new FontWrapper(e.Font),t._freeCell=!0,t.setFreeCell(!1)};CellBase.prototype={loadFromJSON:function(e){var t=this;e&&(t.setFreeCell(!!e[t.getJsonMember("FreeCell")]),assignJSONMembers(t,e),t.afterLoad(e))},afterLoad:function(e){var t=this,r=t.report,o=r.viewer.alpha,n=r.isWR;colorMemberValid(t,"BackColor",o.background),colorMemberValid(t,"ForeColor",o.text),t.Font.loadFromJSON(e.Font,n),t.setBorderCustom(e[t.getJsonMember("BorderCustom")]),t._borderCustom&&t.Border.loadFromJSON(e.Border,o.border,n),t.FreeCell?t.Controls.loadFromJSON(e.Control):t.TextFormat.loadFromJSON(e,n)},assign:function(e){var t,r=this;r.setFreeCell(e.FreeCell),r.setBorderCustom(e.BorderCustom),Object.prototype.assign.call(r,e),r.Font.assign(e.Font),e.Border&&assignObject(r.Border,e.Border),e.FreeCell?(r.Controls.assign(e.Controls),r.isSingleDockControl()&&(t=r.Controls.items[0],!t.onclick&&r.onclick&&(t.onclick=r.onclick),!t.ondblclick&&r.ondblclick&&(t.ondblclick=r.ondblclick))):assignObject(r.TextFormat,e.TextFormat)},attachData:function(){var e=this;e.FreeCell?e.Controls.attachData():e._getWrapperClass().attachData.call(e)},prepare:function(){var e,t=this,r=t.report.viewer,o=t.Controls,n=t.Font.font;t.registerEventClass(),t.FreeCell&&(o.layout(),t.isSingleDockControl()||2===t.report.controlPosition||(e=t.getRect(),Section.prototype.buildTableLayout.call(t,e.Width(),e.Height())),o.prepare(),t.isSingleDockControl()&&(e=o.items[0],!e.onclick&&t.onclick&&(e.onclick=t.onclick,e.onclickClassID=t.onclickClassID),!e.ondblclick&&t.ondblclick&&(e.ondblclick=t.ondblclick,e.ondblclickClassID=t.ondblclickClassID))),n&&(t.defaultFontStyle=r.selectFontItem(n)),t.tableRows&&t.tableRows.forEach(function(e){e.defaultStyle=r.selectSectionItem(e)}),t.defaultStyle=r.selectCellItem(t)},unprepare:function(){var e=this;e.FreeCell?e.Controls.unprepare():e._getWrapperClass().unprepare.call(e),e.resetEventClass(),delete e.defaultFontStyle,delete e.defaultStyle},doGenerate:function(e){var t=this,r=t.report.viewer,o=t.Controls,n=t.Font.font,i=t.defaultFontStyle;e.addClass(r.selectCell(t)),n&&i&&e.addClass(r.selectFont(n,i)),t.addStyles&&t.addStyles(e),t.FreeCell?t.isSingleDockControl()?o.items[0].generateInCell(e):(t.addElementEventClass(e),t.tableRows?(e.addStyle("padding","0px"),e=new HtmlElement("table",e),e.addStyle("border-collapse","collapse"),Section.prototype.generateTableRows.call(t,e)):(e.addStyle("position","relative"),o.generate(e))):(t.addElementEventClass(e),TextBox.prototype.generateNormal.call(t,e))},setFreeCell:function(e){var t,r=this;r._freeCell!==e&&(r._freeCell=e,e?(r.Controls=new Controls(r),delete r.ControlType):(t=r._getWrapperClass(),t.createWrapper.call(r),r.ControlType=t.ControlType,delete r.Controls))},setBorderCustom:function(e){var t=this;t._borderCustom!==e&&(t._borderCustom=e,e?t.Border=new Border(12):delete t.Border)},setForeColor:function(e){var t=this;t.FreeCell?t.Controls.forEach(function(t){t.ForeColor=e}):t.ForeColor=e},getDisplayText:function(){var e=this;return e._getWrapperClass().getDisplayText.call(e)},setDisplayText:function(e){var t=this;return t._getWrapperClass().setDisplayText.call(t,e)},getControls:function(){var e=this;return e.FreeCell?e.Controls.items:[e]},isSingleDockControl:function(){var e=this.Controls.items;return 1===e.length&&5===e[0].Dock},isControlPositionClass:function(){return 0},_getDisplayText:function(){var e=this;return e._getWrapperClass()._getDisplayText.call(e)},get AsTextBox(){var e=this;return e._freeCell?undefined:e}},prototypeCopyExtend(CellBase,Object);var FreeGridCell=function(e,t,r){var o=this;CellBase.call(o,e),o.row=t,o.col=r,o.ColSpan=1,o.RowSpan=1,o.Text="",o.DataName=""};FreeGridCell.prototype={generate:function(e){var t=this;e=new HtmlElement("td",e),t.ColSpan>1&&e.addAttribute("colspan",t.ColSpan+""),t.RowSpan>1&&e.addAttribute("rowspan",t.RowSpan+""),t.doGenerate(e)},ownerGrid:function(){return this.owner},_getWrapperClass:function(){return MemoBox.prototype},getRect:function(){for(var e=this,t=e.owner,r=e.col,o=e.row,n=r+e.ColSpan,i=o+e.RowSpan,a=0,l=0;n>r;)a+=t.columns[r++].pxWidth;for(;i>o;)l+=t.rows[o++].pxHeight;return new Rect(0,0,a,l)},_runningNo:function(){return this.owner.owner._runningNo()},get FreeCell(){return!!this._freeCell},set FreeCell(e){this.setFreeCell(e)},get BorderCustom(){return!!this._borderCustom},set BorderCustom(e){this.setBorderCustom(e)},get DisplayText(){var e=this;return e.FreeCell?"":e.getDisplayText()},set DisplayText(e){var t=this;!t.FreeCell&&t.setDisplayText(e)}},prototypeCopyExtend(FreeGridCell,CellBase);var ColumnCell=function(e){var t=this;CellBase.call(t,e),t.Column=""};ColumnCell.prototype={afterLoad:function(e){var t=this;CellBase.prototype.afterLoad.call(t,e),t.Column=t.owner.owner.Columns.itemByName(t.Column)},prepare:function(){var e=this;CellBase.prototype.prepare.call(e),e.CanShrink&&(e.owner.CanShrink=1)},ownerGrid:function(){return this.owner.owner}},prototypeCopyExtend(ColumnCell,CellBase);var ColumnContentCell=function(e){var t=this;ColumnCell.call(t,e.owner),t.DataField=""};ColumnContentCell.prototype={_getWrapperClass:function(){return FieldBox.prototype},afterLoad:function(e){var t=this;ColumnCell.prototype.afterLoad.call(t,e),t.Column.ContentCell=t},generate:function(e){var t=this,r=t.Column,o=r._crossOrderNo;e=new HtmlElement("td",e),o&&e.addAttribute("_grcrossno",o),t.fixed&&t.ownerGrid().hasMergedColumn&&e.addAttribute("id",r.idMGC),t.doGenerate(e)},generateMerge:function(e,t){var r=this,o=r.report.viewer,n=r.Font.font,i=r.Column._crossOrderNo;e=new HtmlElement("td",e),i&&e.addAttribute("_grcrossno",i),e.addClass(o.selectCell(r)),n&&e.addClass(o.selectFont(n,r.defaultFontStyle)),t.generateInCell(e)},isControlPositionClass:function(){return this.FreeCell},get Name(){return this.Column.Name},set Name(e){this.Column.Name=e},get FreeCell(){return!!this._freeCell},set FreeCell(e){this.setFreeCell(e)},get BorderCustom(){return!!this._borderCustom},set BorderCustom(e){this.setBorderCustom(e)},get DisplayText(){var e=this;return e.FreeCell?"":e.getDisplayText()},set DisplayText(e){var t=this;!t.FreeCell&&t.setDisplayText(e)},getRect:function(){var e=this;return new Rect(0,0,e.Column.pxWidth,e.owner.pxHeight)},_runningNo:function(){return this.ownerGrid().Recordset.RecordNo+1}},prototypeCopyExtend(ColumnContentCell,ColumnCell);var ColumnTitleCell=function(e,t){var r=this;ColumnCell.call(r,e.owner),r.SupCell=e.supcell,r.Visible=!0,r.GroupTitle=t,r.Text="",r.Height=0,t&&(r._name="",r.SubTitles=new ColumnTitleCells(r.owner,r))};ColumnTitleCell.prototype={_getWrapperClass:function(){return MemoBox.prototype},afterLoad:function(e){var t=this;ColumnCell.prototype.afterLoad.call(t,e),t.GroupTitle?(t._name=e[t.getJsonMember("Name")],t.SubTitles.loadFromJSON(e.ColumnTitleCell)):t.Column.TitleCell=t},prepare:function(){var e=this;ColumnCell.prototype.prepare.call(e),e.SubTitles&&e.SubTitles.prepare()},generate:function(e){e=new HtmlElement("th",e),this.doGenerate(e)},addStyles:function(e){var t=this,r=t.GroupTitle?1:t.owner.layerCount-t.owner.generatingLayer;t.colspan>1&&e.addAttribute("colspan",t.colspan+""),r>1&&e.addAttribute("rowspan",r+"")},getRect:function(){var e=this,t=e.owner.layerCount-e.layer,r=e.Column,o=0;return e.GroupTitle?(t=1,r=e.findFirstColumn(),r&&(o=e.findLastColumn().pxRight-r.pxLeft)):o=r.pxWidth,new Rect(0,0,o,e.owner.pxHeight*t)},toFillBack:function(){var e=this;return e.report.fixed?1:Object.prototype.toFillBack.call(e)},findFirstColumn:function(){var e,t=this,r=t.Column;return t.GroupTitle&&(e=t.SubTitles.items,r=e.length>0?e[0].findFirstColumn():undefined),r},findLastColumn:function(){var e,t=this,r=t.Column;return t.GroupTitle&&(e=t.SubTitles.items,r=e.length>0?e[e.length-1].findLastColumn():undefined),r},encloseColumnObject:function(e){var t=this;t.owner.owner._ColumnMoveTo(e,t)},get FreeCell(){return!!this._freeCell},set FreeCell(e){this.setFreeCell(e)},get BorderCustom(){return!!this._borderCustom},set BorderCustom(e){this.setBorderCustom(e)},get DisplayText(){var e=this;return e.FreeCell?"":e.getDisplayText()},set DisplayText(e){var t=this;!t.FreeCell&&t.setDisplayText(e)},get Name(){var e=this;return e.GroupTitle?e._name:e.Column.Name},set Name(e){var t=this;t.GroupTitle?t._name=e:t.Column.Name=e},EncloseColumn:function(e){var t=this,r=t.owner.owner,o=r.Columns.Item(e);o&&r._ColumnMoveTo(o,t)},AddSubGroupTitle:function(e,t){return this.SubTitles.AddGroup(e,t)}},prototypeCopyExtend(ColumnTitleCell,ColumnCell);var Control=function(e){var t=this;Object.call(t,e),t.Left=0,t.Top=0,t.Width=0,t.Height=0,t.Anchor=3,t.Dock=0,t.Center=0,t.AlignColumnSide=3,t.AlignColumn="",t.AlignColumnEx="",t.Locked=!1,t.ShiftMode=1,t.PaddingLeft=0,t.PaddingRight=0,t.PaddingTop=0,t.PaddingBottom=0,t.BackColor=e.BackColor,t.BackStyle=2,t.ForeColor=e.ForeColor?e.ForeColor:colorAlpha(0,t.report.viewer.alpha.text),t.Visible=!0,t.CustomDraw=!1,t.Border=new Border(0),t.Font=new FontWrapper(e.Font),t.Name="",t.CustomDrawScript=""};Control.prototype={children:["Border"],attachData:function(){},afterLoad:function(e){var t=this,r=t.report.isWR,o=t.report.viewer.alpha;enumMemberValid(t,"Dock",grenum.DockStyle),enumMemberValid(t,"Center",grenum.CenterStyle),enumMemberValid(t,"AlignColumnSide",grenum.AlignColumnSideStyle),enumMemberValid(t,"ShiftMode",grenum.ShiftMode),enumMemberValid(t,"BackStyle",grenum.BackStyle),enumBitMemberValid(t,"Anchor",grenum.AnchorStyle),colorMemberValid(t,"BackColor",o.background),colorMemberValid(t,"ForeColor",o.text),t.Font.loadFromJSON(e.Font,r),t.Border.loadFromJSON(e.Border,o.border,r)},layout:function(e){var t,r=this,o=r.report,n=o.size2Pixel(r.Left),i=o.size2Pixel(r.Top),a=o.size2Pixel(r.Width),l=o.size2Pixel(r.Height),s=new Rect(n,i,n+a,i+l),c=o.getRunningColumn(r.AlignColumn),u=o.getRunningColumn(r.AlignColumnEx);if(c&&!c.Visible&&(c=undefined),u&&!u.Visible&&(u=undefined),c||u)switch(c&&u?u.pxLeft<c.pxLeft&&(t=u,u=c,c=t):u?c=u:u=c,r.AlignColumnSide){case 1:s.left=c.pxLeft,s.right=s.left+a;break;case 2:s.right=u.pxRight,s.left=s.right-a;break;default:s.left=c.pxLeft,s.right=u.pxRight}else{if(0!==r.Dock)switch(s=e.clone(),r.Dock){case 5:e.left=e.right,e.top=e.bottom;break;case 1:s.right=Math.min(e.right,e.left+a),e.left=s.right;break;case 2:s.bottom=Math.min(e.bottom,e.top+l),e.top=s.bottom;break;case 3:s.left=Math.max(e.left,e.right-a),e.right=s.left;break;case 4:s.top=Math.max(e.top,e.bottom-l),e.bottom=s.top}0!==r.Center&&5!==r.Dock&&(1!==r.Center&&3!==r.Center||(a=s.Width(),s.left=(e.left+e.right-a)/2,s.right=s.left+a),2!==r.Center&&3!==r.Center||(l=s.Height(),s.top=(e.top+e.bottom-l)/2,s.bottom=s.top+l))}r.pxRect=s,r.oAlignColumn=c,r.oAlignColumnEx=u},prepare:function(){var e=this,t=e.report.viewer,r=!e.owner.isSingleDockControl&&e.owner.isControlPositionClass();e.registerEventClass(),e.defaultStyle=t.selectControlItem(e),e.Font.font&&(e.defaultFontStyle=t.selectFontItem(e.Font.font)),r&&(e.defaultPositionStyle=t.selectPositionItem(e))},unprepare:function(){var e=this;e.resetEventClass(),delete e.defaultStyle,delete e.defaultFontStyle,delete e.defaultPositionStyle,delete e.oAlignColumn,delete e.oAlignColumnEx},prepareLayout:function(e){return e},generate:function(e){var t,r=this,o=r.report.viewer,n=r.pxRect;t=new HtmlElement("span",e),r.addElementEventClass(t),t.addClass(o.selectControl(r)),r.Font.font&&t.addClass(o.selectFont(r.Font.font,r.defaultFontStyle)),r.defaultPositionStyle?t.addClass(o.selectPosition(r)):(t.addStyle("left",pixelsToHtml(n.left)),t.addStyle("top",pixelsToHtml(n.top)),t.addStyle("width",pixelsToHtml(r.getContentWidth())),t.addStyle("height",pixelsToHtml(r.getContentHeight()))),r.generateContent(r.prepareLayout(t))},generateInCell:function(e){var t=this;t.addElementEventClass(e),t.oAlignColumn&&t.setCrossNoAttr(e),t.generateContent(e)},generateContent:function(e){var t=this;t.CustomDraw?t.generateCanvas(e):t.generateNormal(e)},generateCanvas:function(e){var t=this,r=t.getRunningNo(),o=r?t.cloneCanvas(r):t;return t.report.registerCanvas(o,e),o},cloneCanvas:function(e){var t,r,o=this,n=new o.constructor(o.owner);n.runningNo=e,n.origin=o,n.assign(o);for(t in o)"_clones"!=t&&(r=o[t],"object"!=typeof r||n[t]||(n[t]=r));return!o._clones&&(o._clones=[]),o._clones.push(n),n},resizeCanvas:function(){var e=this,t=e.canvas;e.report.controlDynamicSize(e)&&(t.width=Math.min(t.parentNode.clientWidth,window.innerWidth),t.height=Math.min(t.parentNode.clientHeight,window.innerHeight)),e.drawCanvas(1)},drawCanvas:function(e){var t=this,r=t.getOwnerDetailGrid();r&&r.syncElementData(t.canvas),t.report.fireControlCustomDraw(t)},setCrossNoAttr:function(e){var t=this.oAlignColumn._crossOrderNo;t&&e.addAttribute("_grcrossno",t)},toFillBack:function(){var e=this;return 1===e.BackStyle&&e.BackColor!==e.owner.BackColor||e.fixed},BackColor2:function(){var e=this;return e.fixed?e.owner.BackColor:e.BackColor},getRunningNo:function(){return this.owner.getRunningNo()},getContentWidth:function(){var e=this,t=e.Border;return e.pxRect.Width()-e.PaddingLeft-e.PaddingRight-t.getLeftWidth()-t.getRightWidth()},getContentHeight:function(){var e=this,t=e.Border;return e.pxRect.Height()-e.PaddingTop-e.PaddingBottom-t.getTopWidth()-t.getBottomWidth()},getOwnerDetailGrid:function(){var e,t=this,r=t.owner,o=r.owner,n=o?o.owner:undefined;return n&&(n.ColumnTitle?e=n:o.isPrototypeOf(FreeGrid)&&(e=n.getOwnerDetailGrid())),e},SetBounds:function(e,t,r,o){var n=this;n.Left=e,n.Top=t,n.Width=r-e,n.Height=o-t},BringToFront:function(){var e=this,t=e.owner.Controls;t.ChangeItemOrder(t.indexOf(e),t.length)},SendToBack:function(){var e=this,t=e.owner.Controls;t.ChangeItemOrder(t.indexOf(e),1)},DrawDefault:function(){}},prototypeCopyExtend(Control,Object);var TextBox=function(e){var t=this;Control.call(t,e),t.createWrapper(),t.AsTextBox=t};TextBox.prototype={children:["Border","TextFormat"],afterLoad:function(e){var t=this;Control.prototype.afterLoad.call(t,e),t.TextFormat.loadFromJSON(e,t.report.isWR)},createWrapper:function(){var e=this;e.PaddingLeft=2,e.PaddingRight=1,e.PaddingTop=1,e.PaddingBottom=1,e.CanGrow=!1,e.CanShrink=!1,e.ShrinkFontToFit=!1,e.ForeColor=e.owner.ForeColor?e.owner.ForeColor:colorAlpha(0,e.report.viewer.alpha.text),e.TextFormat=new TextFormat,e.GetDisplayTextScript=""},prepareLayout:function(e){var t=this,r=t.TextFormat,o=r.TextAlign;return 16&o||(r.WordWrap||64&o?(e.addStyle("display","table"),e=new HtmlElement("span",e),e.addStyle("display","table-cell"),e.addStyle("vertical-align",32&o?"middle":"bottom")):e.addStyle("line-height",pixelsToHtml(t.getContentHeight()))),e},generateNormal:function(e){function t(){var e,t=n.split(""),r=t.length,o=0;for(n="";r>o;)if(e=t[o]," "===e&&r-1>o&&" "===t[o+1])for(;r>o&&" "===t[o];)n+="&nbsp;",o++;else n+=e,o++}var r=this,o="<br />",n=r.getDisplayText();r.TextFormat.HtmlTags||(/[\r\n&<>"]/.test(n)&&(n=n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\r\n/g,o).replace(/\r/g,o).replace(/\n/g,o)),/ /.test(n)&&t()),e.innerText=n},getDisplayText:function(){var e=this;return e.displayTextAssigned=!1,e.doingGetDisplayText||(e.doingGetDisplayText=!0,e.report.fireTextBoxGetDisplayText(e),e.doingGetDisplayText=!1),e.displayTextAssigned?e.assignedDisplayText:e._getDisplayText()},setDisplayText:function(e){var t=this;t.assignedDisplayText=e,t.displayTextAssigned=!0},DrawDefault:function(){var e=this,t=e.getDisplayText(),r=e.canvas;e.report.Graphics.DrawFormatText(t,0,0,r.width,r.height,e.TextFormat)}},prototypeCopyExtend(TextBox,Control);var StaticBox=function(e){var t=this;TextBox.call(t,e),
t.Text="",t.Parameter=""};StaticBox.prototype={ControlType:1,_getDisplayText:function(){var e=this;return e.valueField?e.valueField.DisplayText:e.oParameter?e.oParameter.DisplayText:e.Text},attachData:function(){var e=this;e.Parameter&&(e.oParameter=e.report.ParameterByName(e.Parameter))},unprepare:function(){var e=this;TextBox.prototype.unprepare.call(e),delete e.oParameter},get DisplayText(){return this.getDisplayText()},set DisplayText(e){this.setDisplayText(e)},get AsStaticBox(){return this}},prototypeCopyExtend(StaticBox,TextBox);var MemoBox=function(e){var t=this;TextBox.call(t,e),t.Text=""};MemoBox.prototype={ControlType:8,createWrapper:function(){var e=this;TextBox.prototype.createWrapper.call(e),e.Text=""},_getDisplayText:function(){return this.textBuilder.generateDisplayText()},attachData:function(){var e=this;e.textBuilder=new TextBuilder(e.report,e.Text)},getGroupVars:function(){function e(r){r.varItems&&r.varItems.forEach(function(r){var o=r.varField,n=o.type;4!==n&&2!==n&&5!==n||t.push(o),4===n?o.paramExp&&e(o.paramExp):5===n&&o.paramExps.forEach(e)})}var t=[];return this.textBuilder.forEach(e),t},isPureNumericExpression:function(){var e=this;return e.prepare(),e.textBuilder&&1===e.textBuilder.items.length&&e.textBuilder.items[0].isPureNumeric()},get DisplayText(){return this.getDisplayText()},set DisplayText(e){this.setDisplayText(e)},get AsFloat(){var e=this.textBuilder.items[0],t=e&&e.__proto__.hasOwnProperty("calculate")?e.calculate():0;return isNaN(t)?0:t},get Value(){return this.getDisplayText()},get AsMemoBox(){return this}},prototypeCopyExtend(MemoBox,TextBox);var FieldBox=function(e){var t=this;TextBox.call(t,e),t.DataField=""};FieldBox.prototype={ControlType:4,createWrapper:function(){var e=this;TextBox.prototype.createWrapper.call(e),e.DataField=""},attachData:function(){var e=this;e.oDataField=e.report.RunningFieldByName(e.DataField)},unprepare:function(){var e=this;TextBox.prototype.unprepare.call(e),delete e.oDataField},_getDisplayText:function(){var e=this.oDataField;return e?e.DisplayText:""},get DisplayText(){return this.getDisplayText()},set DisplayText(e){this.setDisplayText(e)},get AsFieldBox(){return this}},prototypeCopyExtend(FieldBox,TextBox);var SummaryBox=function(e){var t=this;TextBox.call(t,e),t.SummaryFun=1,t.RankNo=1,t.DataField="",t.DisplayField="",t.Format=""};SummaryBox.prototype={ControlType:5,afterLoad:function(e){var t=this;TextBox.prototype.afterLoad.call(t,e),enumMemberValid(t,"SummaryFun",grenum.SummaryFun)},attachData:function(){var e,t,r=this,o=r.Format;r.init(r.DataField,r.DisplayField),o||(e=r.report.RunningFieldByName(r.DataField),e&&(o=e.Format)),t=r.paramExp,t&&1===t.varItems.length&&1===t.varItems[0].type&&6===t.varItems[0].object.FieldType?r.formater=new DateTimeFormatter(o):r.formater=new NumericFormatter(o)},_getDisplayText:function(){var e,t=this,r=t.SummaryFun,o=t.valueField;if(18===r||19===r||29===r||30===r||t.displayField)e=o?o.DisplayText:t.value;else{if(o){if(o.IsNull)return"";e=o.AsFloat}else e=t.value;e=t.formater.format(e)}return e},get DisplayText(){return this.getDisplayText()},set DisplayText(e){this.setDisplayText(e)},get Value(){return this.getValue()},set Value(e){this.setValue(e)},get AsSummaryBox(){return this}},prototypeCopyExtend(SummaryBox,TextBox),prototypeCopyExtend(SummaryBox,SummaryItem);var SystemVarBox=function(e){var t=this;TextBox.call(t,e),t.SystemVar=-1,t.GroupIndex=1,t.Format=""};SystemVarBox.prototype={ControlType:3,afterLoad:function(e){var t=this;TextBox.prototype.afterLoad.call(t,e),enumMemberValid(t,"SystemVar",grenum.SystemVarType)},attachData:function(){var e=this,t=e.Format;1===e.SystemVar?e.formater=new DateTimeFormatter(t):e.formater=new NumericFormatter(t)},_getDisplayText:function(){var e=this,t=e.SystemVar;return t>0?e.formater.format(e.report.SystemVarValue2(t,e.GroupIndex)):""},get DisplayText(){return this.getDisplayText()},set DisplayText(e){this.setDisplayText(e)},get AsSystemVarBox(){return this}},prototypeCopyExtend(SystemVarBox,TextBox);var CanvasBox=function(e){Control.call(this,e)};CanvasBox.prototype={generateContent:function(e){this.generateCanvas(e)},drawCanvas:function(e){var t=this;t.draw(e),t.CustomDraw&&Control.prototype.drawCanvas.call(t,e)},DrawDefault:function(){this.draw()}},prototypeCopyExtend(CanvasBox,Control);var Line=function(e){var t=this;CanvasBox.call(t,e),t.L2R=!0,t.U2D=!0,t.LinePen=new Pen};Line.prototype={ControlType:10,children:["LinePen"],afterLoad:function(e){var t=this,r=t.report,o=r.PixelsToUnit(t.LinePen.Width);CanvasBox.prototype.afterLoad.call(t,e),t.LinePen.loadFromJSON(e.Pen,r.viewer.alpha.stroke,r.isWR),t.Height<o&&(t.Height=o,t.HL=1),t.Width<o&&(t.Width=o,t.VL=1)},draw:function(e){var t,r=this,o=r.canvas,n=new Context(o.getContext("2d")),i=0,a=0,l=r.VL?0:o.width,s=r.HL?0:o.height;n.selectPen(r.LinePen),r.L2R||(t=i,i=l,l=t),r.U2D||(t=a,a=s,s=t),n.drawLine(i,a,l,s)},get AsLine(){return this}},prototypeCopyExtend(Line,CanvasBox);var CharGridBox=function(e){var t=this;CanvasBox.call(t,e),t.LabelText="",t.Text="",t.ClassPos=0,t.GridCount=0,t.GridSpacing=0,t.GridWidth=0,t.LabelFont=new FontWrapper(t.Font),t.ClassLinePen=new Pen,t.GridLinePen=new Pen};CharGridBox.prototype={ControlType:14,children:["ClassLinePen","GridLinePen"],afterLoad:function(e){var t=this,r=t.report,o=t.report.viewer.alpha;CanvasBox.prototype.afterLoad.call(t,e),t.ClassLinePen.loadFromJSON(e.Pen,o.stroke,r.isWR),t.GridLinePen.loadFromJSON(e.Pen,o.stroke,r.isWR)},attachData:function(){var e=this;e.tbLabel=new TextBuilder(e.report,e.LabelText),e.tbText=new TextBuilder(e.report,e.Text)},draw:function(e){function t(e){return e/6}function r(){var e=b.clone();e.bottom=(e.top+e.bottom)/2,x.top=e.bottom,F.selectFont(l.LabelFont.UsingFont()),F.drawTextAlign2(y,e,34),F.restoreFont(),F.DrawHorzLine(e.bottom,e.left,e.right)}function o(){var e,t,r;if("<icon>"==T.substr(0,6)){for(e=7,t=T.length;t>e&&"<"!=T.charAt(e);)++e;t>e&&"</icon>"==T.substr(e,7)&&(r=T.substr(7,e-7),v.IsIcon=1,v.IconIndex=+r,T=T.substr(e+7))}v.IsIcon||(v.Char=T.charAt(0),T=T.substr(1))}function n(){var e,t,r;e=1.25*F.usingFont.Point,t=(i.Width()-e)/2,r=i.clone(),t>0&&(r.left+=t,r.right-=t),v.IconIndex<0}var i,a,l=this,s=l.report,c=l.canvas,u=s.UnitToPixels(l.GridWidth),d=s.UnitToPixels(l.GridSpacing),f=l.GridCount,p=l.ClassPos,h=l.GridLinePen,g=l.ClassLinePen,m=c.width,C=c.height,b=new Rect(0,0,m,C),x=b.clone(),v={},S=[],T=l.tbText.generateDisplayText(),y=l.tbLabel.generateDisplayText(),F=new Context(c.getContext("2d"));if(F.selectFont(l.getUsingFont()),F.selectPen(h),0==u&&(u=f>0?(b.Width()-d*(f-1))/f:F.usingFont.LineWidth),y&&r(),0>=f&&(f=(x.Width()+d+u/4)/(u+d)),h.Width>0&&f>0){for(F.beginPath(),i=x.clone(),a=0;f>a;++a){if(i.left=i.right-u,d>0){if(y?(F.moveTo(i.left,i.top),F.lineTo(i.left,i.bottom),f-1>a&&(F.moveTo(i.left+d,i.top),F.lineTo(i.left+d,i.bottom))):F.rectangle2(i),i.left<x.left)break}else{if(i.left-u+t(u)<x.left)break;f-1>a&&a+1!=p&&(F.moveTo(i.left,i.top),F.lineTo(i.left,i.bottom))}i.right-=u+d}F.stroke()}for(0==d&&p>0&&g.Width>0&&(F.selectPen(g),a=x.right-u*p,F.moveTo(a,i.top),F.lineTo(a,i.bottom),F.restorePen());T;)v={},o(),S.push(v);for(S.length>f&&(S.length=f),i=x.clone(),a=S.length;--a>=0&&(v=S[a],i.left=i.right-u,!(i.left+t(u)<x.left));)v.IsIcon?n():F.drawTextAlign2(v.Char,i,34),i.right-=u+d},get AsCharGridBox(){return this}},prototypeCopyExtend(CharGridBox,CanvasBox);var ShapeBox=function(e){var t=this;CanvasBox.call(t,e),t.ShapeType=4,t.FillColor=0,t.FillStyle=2,t.CornerDx=4,t.CornerDy=4,t.LinePen=new Pen};ShapeBox.prototype={ControlType:2,children:["LinePen"],afterLoad:function(e){var t=this,r=t.report,o=t.report.viewer.alpha;CanvasBox.prototype.afterLoad.call(t,e),enumMemberValid(t,"ShapeType",grenum.ShapeBoxType),enumMemberValid(t,"FillStyle",grenum.BackStyle),colorMemberValid(t,"FillColor",o.background),t.LinePen.loadFromJSON(e.Pen,o.stroke,r.isWR)},draw:function(e){var t,r,o,n=this,i=n.canvas,a=i.width,l=i.height,s=new Context(i.getContext("2d")),c=n.LinePen.Width/2,u=1===n.FillStyle;switch(s.selectPen(n.LinePen),u&&s.selectFillColor(n.FillColor),n.ShapeType){case 7:s.drawLine(0,c,a,c);break;case 1:t=s.circle;break;case 2:t=s.ellipse;break;case 3:t=s.rectangle;break;case 6:t=s.square;break;case 4:t=s.roundRectangle,r=1;break;case 5:t=s.roundSquare,r=1}t&&(o=[c,c,a-2*c,l-2*c],r&&o.push(n.CornerDx,n.CornerDy),o.push(u),t.apply(s,o)),u&&s.restoreFillStyle(),s.restorePen()},get AsShapeBox(){return this}},prototypeCopyExtend(ShapeBox,CanvasBox);var Barcode=function(e){var t=this;CanvasBox.call(t,e),t.Text="",t.BarcodeType=4,t.BarWidth=0,t.BarRatio=2,t.CheckSum=!1,t.Direction=1,t.Alignment=2,t.CaptionPosition=3,t.CaptionAlignment=2,t.PDF417Rows=0,t.PDF417Columns=0,t.PDF417ErrorLevel=0,t.PDF417Simple=!1,t.QRCodeVersion=0,t.QRCodeErrorLevel=1,t.QRCodeMask=0,t.DtmxEncoding=2,t.DtmxMatrixSize=2,t.DtmxModuleSize=0};Barcode.prototype={ControlType:12,attachData:function(){var e=this;e.textBuilder=new TextBuilder(e.report,e.Text)},afterLoad:function(e){var t=this,r=e[t.getJsonMember("BarcodeType")];switch(CanvasBox.prototype.afterLoad.call(t,e),r){case"Code25_Interleaved":t.BarcodeType=1;break;case"Code25_Industrial":t.BarcodeType=2;break;case"Code25_Matrix":t.BarcodeType=3;break;case"Code39Extended":t.BarcodeType=5;break;case"Code93Extended":t.BarcodeType=10;break;default:enumMemberValid(t,"BarcodeType",grenum.BarcodeType)}enumMemberValid(t,"Direction",grenum.BarcodeDirection),enumMemberValid(t,"Alignment",grenum.StringAlignment),enumMemberValid(t,"CaptionPosition",grenum.BarcodeCaptionPosition),enumMemberValid(t,"CaptionAlignment",grenum.StringAlignment),enumMemberValid(t,"DtmxEncoding",grenum.DtmxEncoding),enumMemberValid(t,"DtmxMatrixSize",grenum.DtmxMatrixSize)},getDisplayText:function(){return this.textBuilder.generateDisplayText()},generateCanvas:function(e){var t,r=this,o=r.BarcodeType,n=encodeURI(window.rubylong.grhtml5.barcodeURL),i={type:o,text:r.DisplayText,codepage:r.report.CodePage};t=CanvasBox.prototype.generateCanvas.call(r,e),1!==r.CaptionPosition&&(i.requireShowText=!0),n&&i.text&&(51===o||54===o?(i.Version=r.QRCodeVersion,i.ErrorLevel=r.QRCodeErrorLevel,i.Mask=r.QRCodeMask):50===o?(i.Rows=r.PDF417Rows,i.Columns=r.PDF417Columns,i.ErrorLevel=r.PDF417ErrorLevel,i.Simple=r.PDF417Simple):52===o||53===o?(i.Encoding=r.DtmxEncoding,i.MatrixSize=r.DtmxMatrixSize,i.ModuleSize=r.DtmxModuleSize):i.CheckSum=r.CheckSum,n+="?params="+encodeURIComponent(JSON.stringify(i)),window.rubylong.ajax(n,function(e,t){var r,o=this;t&&(r=o.getOwnerDetailGrid(),r&&r.syncElementData(o.canvas),o._dodraw(JSON.parse(e.responseText)))},t,"POST"))},draw:function(e){},_dodraw:function(e){function t(e){return 50===e||51===e||54===e||52===e||53===e}function r(e){return 15===e||14===e||16===e||17===e||18===e}function o(e){return parseInt(e,16)}function n(){var e,t,r,n,i,a,l,u=s/w,m=c/D,C={init:function(){h.right=W.left,h.bottom=W.top+m},draw:function(){h.right+=u*i,b.fillRect2(h,p),h.left=h.right},end:function(){h.right+=u*i,b.fillRect2(h,p),h.top=h.bottom,h.bottom+=m,h.left=W.left,h.right=W.left}},x={init:function(){h.left=W.right,h.top=W.bottom-m},draw:function(){h.left-=u*i,b.fillRect2(h,p),h.right=h.left},end:function(){h.left-=u*i,b.fillRect2(h,p),h.bottom=h.top,h.top-=m,h.left=W.right,h.right=W.right}},F={init:function(){h.bottom=W.top,h.left=W.right-m},draw:function(){h.bottom+=u*i,b.fillRect2(h,p),h.top=h.bottom},end:function(){h.bottom+=u*i,b.fillRect2(h,p),h.right=h.left,h.left-=m,h.top=W.top,h.bottom=W.top}},A={init:function(){h.top=W.bottom,h.right=W.left+m},draw:function(){h.top-=u*i,b.fillRect2(h,p),h.bottom=h.top},end:function(){h.top-=u*i,b.fillRect2(h,p),h.left=h.right,h.right+=m,h.top=W.bottom,h.bottom=W.bottom}};switch(50!=T&&(u>m?u=m:m=u),d=u*w,f=m*D,I=(s-d)/2,k=(c-f)/2,B||(g=I,I=k,k=g),W.left+=I,W.right=W.left+d,W.top+=k,W.bottom=W.top+f,y){case 1:l=C;break;case 2:l=x;break;case 3:l=F;break;default:l=A}for(h=W.clone(),l.init(),R=P.length,g=0,t=0;D>t;++t){for(r=o(P[g++])<<4|o(P[g++]),n=128,p=r&n?S:v,i=1,n>>=1,e=1;w>e;++e)0==e%8&&(r=o(P[g++])<<4|o(P[g++]),n=128),a=r&n?S:v,p===a?++i:(l.draw(),p=a,i=1),n>>=1;l.end()}}function i(){switch(T){case 15:M=15,O=0;break;case 16:case 17:case 18:M=12,O=12}}function a(){function e(){var e=m.BarRatio;switch(T){case 1:case 2:case 4:case 14:case 15:case 5:case 13:case 16:case 17:case 18:case 19:case 20:2>e&&(e=2),e>3&&(e=3);break;case 3:2.25>e&&(e=2.25),e>3&&(e=3)}return[1,e,1.5*e,2*e]}function t(e){var t=o(e);return{w:p[t%4],lt:Math.floor(t/4)}}function r(e){for(var r=e.length,o=0;r-- >0;)o+=t(e[r]).w;return o}var n,i,a,l,f=m.Alignment,p=e(),C=r(P),i=m.BarWidth,x=G/A.length/10,F=2*c/5,w=E?c+2*L/3:c;if(_=x*M,V=x*O,u=i?report.UnitToPixels(i):(s-_-V)/C,d=u*C+_+V,H=d>s+1,!H){switch(f){case 1:I=_;break;case 2:I=(s-d)/2+_;break;default:I=s-d+_}switch(h=W,y){case 1:h.left+=I;break;case 2:h.right-=I;break;case 3:h.top+=I;break;default:h.bottom-=I}for(g=0;R>g;++g)switch(n=t(P[g]),i=n.w*u,a=2===n.lt?F:3==n.lt?w:c,l=0==n.lt?v:S,y){case 1:h.right=h.left+i,h.bottom=h.top+a,b.fillRect2(h,l),h.left=h.right;break;case 2:h.left=h.right-i,h.bottom=h.top+a,b.fillRect2(h,l),h.right=h.left;break;case 3:h.bottom=h.top+i,h.left=h.right-a,b.fillRect2(h,l),h.top=h.bottom;break;default:h.top=h.bottom-i,h.left=h.right-a,b.fillRect2(h,l),h.bottom=h.top}}}function l(){var e,t,r,o,n=m.CaptionAlignment,i=1===n?33:2===n?34:36,a=m.Alignment,l=U.left+I;if(B?(3===F&&(k=-k),U.top+=k,U.bottom+=k):(2===F&&(I=-I),U.left+=I,U.right+=I),E)switch(g=0,T){case 15:l-=_,b.drawText(A.substr(g++,1),l,U.top),l=U.left+I+4*u,o=l+42*u,b.drawEqualSpaceText(A.substr(g,6),l,o,U.top),g+=6,l=U.left+I+50*u,o=l+41*u,b.drawEqualSpaceText(A.substr(g,6),l,o,U.top);break;case 14:l+=4*u,o=l+28*u,b.drawEqualSpaceText(A.substr(g,4),l,o,U.top),g+=4,l=U.left+I+36*u,o=l+27*u,b.drawEqualSpaceText(A.substr(g,4),l,o,U.top);break;case 17:case 18:b.fontPointTo(Math.floor(.77*b.usingFont.Point)),L=fontHeight(b.usingFont),G=b.measureTextWidth("0"),l-=_,b.drawText("0",l,U.bottom-L),e=A.substr(6),G=b.measureTextWidth(e),l=U.right-I+V-G,b.drawText(e,l,U.bottom-L),b.restoreFont(),l=U.left+I+4*u,o=l+42*u,b.drawEqualSpaceText(A.substr(0,6),l,o,U.top);break;case 16:b.fontSizeTo(Math.floor(.77*b.usingFont.Point)),L=fontHeight(b.usingFont),e=A.substr(0,1),G=b.measureTextWidth(e),l-=_,b.drawText(e,l,U.bottom-L),e=A.substr(11),G=b.measureTextWidth(e),l=U.left+I+95*u+Math.max(V-G,2),b.drawText(e,l,U.bottom-L),b.restoreFont(),l=U.left+I+11*u,o=l+35*u,++g,b.drawEqualSpaceText(A.substr(g,5),l,o,U.top),l=o+5*u,o=l+35*u,g+=5,b.drawEqualSpaceText(A.substr(g,5),l,o,U.top)}else if(B){switch(a){case 1:U.right=U.left+d;break;case 2:U.left=(U.left+U.right-d)/2,U.right=U.left+d;break;default:U.left=U.right-d}b.drawTextAlign2(A,U,i)}else{switch(a){case 1:U.bottom=U.top+d;break;case 2:U.top=(U.top+U.bottom-d)/2,U.bottom=U.top+d;break;default:U.top=U.bottom-d}switch(t=U.right,n){case 1:r=U.top;break;case 2:r=(U.top+U.bottom-G)/2;break;default:r=U.bottom-G}b.drawTextRotate(A,t,r,270)}}var s,c,u,d,f,p,h,g,m=this,C=m.canvas,b=new Context(C.getContext("2d")),x=m.getUsingFont(),v=m.BackColor,S=m.ForeColor,T=m.BarcodeType,y=m.Direction,F=m.CaptionPosition,w=e.cols,D=e.rows,P=e.graph,R=P?P.length:0,A=e.text?e.text:m.DisplayText,t=t(T),B=1===y||2===y,E=r(T)&&1===y&&3===F,G=0,L=fontHeight(x),N=t?Math.max(L,10):0,M=0,O=0,_=0,V=0,H=!1,I=0,k=0,j=new Rect(0,0,C.width,C.height),W=j.clone(),U=j.clone();if(w){if(b.selectFont(x),1!==F&&(B?2===F?(U.bottom=U.top+L,W.top=U.bottom+N):(U.top=U.bottom-L,W.bottom=U.top-N):2===F?(U.left=U.right-L,W.right=U.left-N):(U.right=U.left+L,W.left=U.right+N)),s=B?W.Width():W.Height(),c=B?W.Height():W.Width(),10>s||10>c)return void b.restoreFont();1!=F&&(G=b.measureTextWidth(A)),t?n():(i(),a()),H?pdd.drawTextCenter("条宽度太大,条码无法完整显示",(j.left+j.right)/2,(j.top+j.bottom-L)/2):1!=F&&l(),b.restoreFont()}},get Value(){return this.getDisplayText()},get DisplayText(){return this.getDisplayText()},get AsBarcode(){return this}},prototypeCopyExtend(Barcode,CanvasBox);var PictureBox=function(e){var t=this;Control.call(t,e),t.Alignment=3,t.SizeMode=3,t.TransparentMode=0,t.RotateMode=0,t.ImageIndex=0,t.Picture="",t.ImageFile="",t.DataField=""};PictureBox.prototype={ControlType:7,afterLoad:function(e){var t=this;Control.prototype.afterLoad.call(t,e),enumMemberValid(t,"SizeMode",grenum.PictureSizeMode),enumMemberValid(t,"TransparentMode",grenum.PictureTransparentMode),enumMemberValid(t,"RotateMode",grenum.PictureRotateMode)},attachData:function(){var e=this;e.oDataField=e.report.RunningFieldByName(e.DataField)},generateNormal:function(e){var t,r,o,n,i,a,l,s,c,u,d=this,f=d.Picture,p=d.oDataField,h=d.ImageFiles,g=h?h[d.getOwnerDetailGrid().Recordset.RecordNo]:d.ImageFile,m=d.ImageIndex,C=d.SizeMode;if(f?i="data:image;base64,"+f:p?(i=p.AsString,a=i.length,a>256?i="data:image;base64,"+i:5>a&&(i=p.AsInteger)):g?i=g:m&&(i=m),i&&!isNaN(i)&&i>0&&(t=d.report._imageList,i=t&&i<=t.Count?"data:image;base64,"+t.Item(i):undefined),i)if(isNaN(i))if(5===C)e.addStyle("background-image","url("+i+")");else{if(r=d.pxRect,r||(r=d.owner.getRect()),o=r.Width(),n=r.Height(),e.addStyle("text-align","center"),e.addStyle("vertical-align","middle"),l=new HtmlElement("img",e),l.skipend=1,2===d.SizeMode)c=o,u=n;else try{s=document.createElement("img"),s.src=i,s.width&&s.height?3===d.SizeMode||s.width>o||s.height>n?s.width*n>o*s.height?c=o:u=n:s.width&&s.height?(c=s.width,u=s.height):(c=o,u=n):(c=o,u=n)}catch(b){c=o,u=n}c&&l.addAttribute("width",Math.round(c)),u&&l.addAttribute("height",Math.round(u)),l.addAttribute("src",i)}else i=+i,e.addStyle("text-align","center"),e.addStyle("vertical-align","middle"),l=new HtmlElement("input",e),l.skipend=1,l.addAttribute("type","checkbox"),l.addAttribute("id",d.getCheckBoxID()),l.addClass(grconst.CSS_CB),-1!==i&&-3!==i||l.addAttribute("checked"),p&&l.addAttribute(grconst.ATTR_FIELD,p.Name),d.report._has_cb=1},getCheckBoxID:function(){var e,t=this,r=t.owner.owner;return e=r.ContentCells?"CBC"+r.owner.Recordset.RecordNo:r.Header?"CBG"+r.recordset.recordNo:t.Name},set Text(e){this[e.length>256?"Picture":"ImageFile"]=e},get checked(){var e=this,t=e.oDataField,r=t?t.AsInteger:e.ImageIndex;return-1===r||-3===r},set checked(e){var t,r=this,o=r.oDataField,n=e?-1:-2;o?(t=o.owner,t.Edit(),o.AsInteger=n,t.Post()):r.ImageIndex=n,document.getElementById(r.getCheckBoxID()).checked=e},get AsPictureBox(){return this},LoadFromFile:function(e){var t=this,r=t.getOwnerDetailGrid();r?(t.ImageFiles||(t.ImageFiles={}),t.ImageFiles[r.Recordset.RecordNo]=e):t.ImageFile=e}},prototypeCopyExtend(PictureBox,Control);var RichTextBox=function(e){var t=this;Control.call(t,e)};RichTextBox.prototype={ControlType:6,get AsRichTextBox(){return this},generateNormal:function(e){e.innerText="不支持RichTextBox"}},prototypeCopyExtend(RichTextBox,Control);var SubReport=function(e){var t=this;Control.call(t,e),t.HideOnRecordsetEmpty=!1,t.RelationFields="",t.Report=new Report(e.report.viewer,t)};SubReport.prototype={ControlType:9,afterLoad:function(e){var t=this,r=e.Report;Control.prototype.afterLoad.call(t,e),t.Report.isWR=t.report.isWR,r&&t.Report.loadFromJSON(r)},prepare:function(){var e=this,t=e.report;Control.prototype.prepare.call(e),t._srChildren||(t._srChildren=[]),t._srChildren.push(e),e.prepareRelationRecordset()},unprepare:function(){var e=this;Control.prototype.unprepare.call(e),e.Report.unprepare()},prepareRelationRecordset:function(){var e,t,r,o,n,i,a=this,l=a.RelationFields,s=a.report,c=s.DetailGrid,u=a.Report,d=u.DetailGrid;if(l&&d&&c&&(e=c.Recordset,r=d.Recordset,t=e.decodeFields(l),o=r.decodeFields(l),t.length===o.length&&r.RecordCount)){for(a._rmFields=t,a._rdFields=o,i=a._relations=[],r.First(),n=[],i.push(n),n.push(r.curRecord),r.keepValue(),r.Next();!r.Eof();)r.fieldsKeepedValueChanged(o)&&(n=[],i.push(n),r.keepValue()),n.push(r.curRecord),r.Next();i.sort(function(e,t){for(var r,n,i,a=0,l=o.length;l>a;){if(r=o[a++]._tableMember,n=e[0][r],i=t[0][r],i>n)return-1;if(n>i)return 1}return 0})}},generateNormal:function(e){for(var t,r,o,n=this,i=n.Report.DetailGrid?n.Report.DetailGrid.Recordset:undefined,a=n._relations,l=n.report,s=l.DetailGrid,c=n.getOwnerDetailGrid(),u=n.Report.Parameters,d=u.Count;d>0;)r=u.Item(d--),o=r.Name,c?(t=l.FieldByName(o),t?r.Value=t.Value:(t=l.ParameterByName(o),t&&(r.Value=t.Value))):(t=l.ParameterByName(o),t?r.Value=t.Value:s&&(t=l.FieldByName(o),t&&(r.Value=t.Value)));a&&n.attachRelationTable(),(!n.HideOnRecordsetEmpty||!i||i.RecordCount)&&n.Report.generate(e),a&&n.detachRelationTable()},detachRelationTable:function(){var e=this.Report.DetailGrid.Recordset;e._dataTable=e._bakTable,e._relTblIndex=-1,delete e._bakTable},attachRelationTable:function(){function e(){for(var e,r,o=n._rmFields,i=n._rdFields,a=o.length,s=0;a>s;){if(r=t[i[s]._tableMember],e=l[o[s++]._tableMember],e>r)return-1;if(r>e)return 1}return 0}var t,r,o,n=this,i=n._relations,a=n.Report.DetailGrid.Recordset,l=n.report.DetailGrid.Recordset.curRecord,s=i.length-1,c=0;for(a._bakTable=a._dataTable,a._dataTable=[];s>=c;)if(r=Math.floor((c+s)/2),t=i[r][0],o=e(),0>o)c=r+1;else{if(!(o>0)){a._dataTable=i[r],a._relTblIndex=r;break}s=r-1}return!0},attachRelationTable2:function(e){var t=this;t.Report.DetailGrid.Recordset._dataTable=t._relations[e]},get AsSubReport(){return this}},prototypeCopyExtend(SubReport,Control);var FreeGridColumn=function(e){var t=this;Object.call(t,e),t.Visible=!0,t.FixedWidth=!1,t.Width=t.report.cm2Size(3)};FreeGridColumn.prototype={prepare:function(){self.pxWidth=this.report.size2Pixel(self.Width)},get FreeGrid(){return this.owner}},prototypeCopyExtend(FreeGridColumn,Object);var FreeGridRow=function(e){var t=this;Object.call(t,e),t.Visible=!0,t.Height=t.report.cm2Size(.58)};FreeGridRow.prototype={prepare:function(){self.pxHeight=this.report.size2Pixel(self.Height)},get FreeGrid(){return this.owner}},prototypeCopyExtend(FreeGridRow,Object);var FreeGrid=function(e){var t=this;Control.call(t,e),t.ColumnCount=5,t.RowCount=5,t.TitleRows=1,t.ShowColLine=!0,t.ShowRowLine=!0,t.ColLinePen=new Pen,t.RowLinePen=new Pen,t.columns=[],t.rows=[],t.cells=[]};FreeGrid.prototype={ControlType:13,attachData:function(){var e,t,r,o=this;for(t=o.cells.length,e=0;t>e;e++)r=o.cells[e],r&&r.forEach(function(e){e.attachData(),e.prepare()})},prepareChildren:function(){var e,t=this,r=t.columns,o=t.rows,n=t.cells;for(e=r.length=t.ColumnCount;e--;)r[e]||(r[e]=new FreeGridColumn(t));for(e=n.length=o.length=t.RowCount;e--;)o[e]||(o[e]=new FreeGridRow(t)),n[e]||(n[e]=[],n[e].length=t.ColumnCount)},prepare:function(){var e=this,t=new HtmlStyles;e.columns.length===e.ColumnCount&&e.rows.length===e.RowCount&&e.cells.length===e.RowCount||e.prepareChildren(),Control.prototype.prepare.call(e),t.addCellBorder(e),e.blankCellStyle=e.report.viewer.addCustomStyle(t)},assign:function(e){var t=this;Control.prototype.assign.call(t,e),e.columns.forEach(function(e,r){var o=new FreeGridColumn(t);o.assign(e),o.pxWidth=e.pxWidth,t.columns[r]=o}),e.rows.forEach(function(e,r){var o=new FreeGridRow(t);o.assign(e),o.pxHeight=e.pxHeight,t.rows[r]=o}),e.cells.forEach(function(e,r){e.forEach(function(e,o){var n=new FreeGridCell(t,r,o);n.assign(e),t.cells[r]||(t.cells[r]=[]),t.cells[r][o]=n})}),t.Height=e.Height},afterLoad:function(e){var t,r,o,n,i,a=this,l=a.report,s=a.Border,c=a.columns=[],u=a.rows=[],d=a.cells=[];if(Control.prototype.afterLoad.call(a,e),a.prepareChildren(),e.FreeGridColumn)for(n=e.FreeGridColumn.length,o=0;n>o;o++)r=e.FreeGridColumn[o],c[r.index-1].loadFromJSON(r);if(e.FreeGridRow)for(n=e.FreeGridRow.length,o=0;n>o;o++)r=e.FreeGridRow[o],u[r.index-1].loadFromJSON(r);if(e.FreeGridCell)for(n=e.FreeGridCell.length,o=0;n>o;o++)r=e.FreeGridCell[o],--r.row,--r.col,t=d[r.row][r.col]=new FreeGridCell(a,r.row,r.col),t.loadFromJSON(r);for(n=c.length,i=0,o=0;n>o;o++)t=c[o],t.pxWidth=l.size2Pixel(t.Width),i+=t.Width;for(a.Width=i+l.pixel2Size(s.getLeftWidth()+s.getRightWidth()),n=u.length,i=0,o=0;n>o;o++)t=u[o],t.pxHeight=l.size2Pixel(t.Height),i+=t.Height;a.Height=i+l.pixel2Size(s.getTopWidth()+s.getBottomWidth())},generateNormal:function(e){var t,r,o,n,i=this,a=i.report.viewer,l=new HtmlElement("table",e),s=new HtmlElement("colgroup",l),c=[];for(i.Font.font&&l.addClass(a.selectFont2(i.Font.font)),l.styles.addBorder(i.Border),l.addStyle("border-collapse","collapse"),l.addStyle("width","100%"),i.toFillBack()&&l.addBackColorStyle(i.BackColor),n=i.ColumnCount,r=0,o=0;n>o;o++)r+=i.columns[o].pxWidth;for(o=0;n>o;o++)t=new HtmlElement("col",s),t.skipend=1,t.addStyle("width",percentToHtml(100*i.columns[o].pxWidth/r));for(o=0;o<i.RowCount;o++)r=[],r.length=i.ColumnCount,c.push(r);i.cells.forEach(function(e,t){e.forEach(function(e){function t(){for(var t,r=e.row,o=r+e.RowSpan,n=e.col+e.ColSpan;o>r;r++)for(t=e.col;n>t;t++)c[r][t]=1}(e.ColSpan>1||e.RowSpan>1)&&t(),c[e.row][e.col]=e})}),c.forEach(function(e,t){var r,o=i.ColumnCount,n=0,s=new HtmlElement("tr",l);s.addStyle("height",pixelsToHtml(i.rows[t].pxHeight));do{for(;o>n&&!e[n];)r=new HtmlElement("td",s),r.addClass(a._getCSSName(i.blankCellStyle)),n++;for(;o>n&&1===e[n];)n++;o>n&&(r=e[n])&&(r.generate(s),n=r.col+r.ColSpan)}while(o>n)})},get AsFreeGrid(){return this},ColumnAt:function(e){var t=this,r=t.columns;return r.length!==t.ColumnCount&&t.prepareChildren(),r[e-1]},RowAt:function(e){var t=this,r=t.rows;return r.length!==t.RowCount&&t.prepareChildren(),r[e-1]},CellAt:function(e,t){var r,o=this,n=o.cells,i=undefined;return n.length!==o.RowCount&&o.prepareChildren(),e>0&&e<=o.RowCount&&t>0&&t<=o.ColumnCount&&(r=n[--e],i=r[--t],i||(i=r[t]=new FreeGridCell(o,e,t))),i},CellByDataName:function(e){for(var t,r,o,n=this,i=n.cells,a=i.length,l=a;l--;)for(t=i[l],r=t.length;r--;)if(o=t[r],o&&o.DataName===e)return o;return undefined}},prototypeCopyExtend(FreeGrid,Control);var SectionRoot=function(e){var t=this;Object.call(t,e),t.Visible=!0,t.CanGrow=!1,t.CanShrink=!1,t.Height=e.report.cm2Size(t.defaultHeight()),t.BackColor=e.BackColor,t.FormatScript="",t.Font=new FontWrapper(t.getParentFont())};SectionRoot.prototype={afterLoad:function(e){var t=this,r=t.report;e[t.getJsonMember("BackColor")]||(t.BackColor=t.getParentBackColor()),colorMemberValid(t,"BackColor",r.viewer.alpha.background),t.Font.loadFromJSON(e.Font,r.isWR)},prepare:function(){var e=this,t=e.Controls;e.registerEventClass(),e.pxHeight=e.report.size2Pixel(e.Height),e._singleHidableSR=e.getSingleHidableSR(),e._singleSR=t&&1===t.Count&&9===t.Item(1).ControlType},unprepare:function(){var e=this;e.resetEventClass(),delete e.defaultStyle},generate:function(e){var t=this;t.report.fireSectionFormat(t),t.pxHeight=t.report.size2Pixel(t.Height),t.isToGenerate()&&(t._singleSR&&!t.Group?t.Controls.Item(1).generateContent(e):t.doGenerate(e))},defaultHeight:function(){return 3},getParentBackColor:function(e){return this.owner.BackColor},getParentFont:function(){return this.owner.Font},getSingleHidableSR:function(){return undefined},isControlPositionClass:function(){return 0},isToGenerate:function(){function e(){var e,r=t._singleHidableSR,o=r._relations;return o&&r.attachRelationTable(),e=!r.Report.DetailGrid||r.Report.DetailGrid.Recordset.RecordCount,o&&r.detachRelationTable(),e}var t=this,r=t.Visible&&t.Height>0;return r&&t._singleHidableSR&&(r=e()),r}},prototypeCopyExtend(SectionRoot,Object);var Section=function(e){var t=this;SectionRoot.call(t,e),t.Controls=new Controls(t)};Section.prototype={children:["Controls"],afterLoad:function(e){var t=this;SectionRoot.prototype.afterLoad.call(t,e),t.Controls.loadFromJSON(e.Control)},attachData:function(){this.Controls.attachData()},prepare:function(){var e=this,t=e.Controls,r=e.report,o=r.viewer;SectionRoot.prototype.prepare.call(e),t.layout(),2!==r.controlPosition&&e.buildTableLayout(r.getReportWidth(),e.pxHeight),t.prepare(),e.tableRows&&(r.reportFitHeight&&calcSectionsHeightPercent(e.tableRows),e.tableRows.forEach(function(e){e.defaultStyle=o.selectSectionItem(e)})),e.defaultStyle=o.selectSectionItem(e)},unprepare:function(){var e=this;SectionRoot.prototype.unprepare.call(e),e.Controls.unprepare()},buildTableLayout:function(e,t){function r(e,t,r,o){var n,i,a,l=[];for(s.forEach(function(r){l.push({pos:r.pxRect[e],count:1},{pos:r.pxRect[t],count:1})}),l.sort(function(e,t){return e.pos-t.pos}),n=l.length,i=0;n>i&&l[i].pos<r;)l[i++]=undefined;if(i>0&&(l.unshift({pos:r,count:i}),++n),!isNaN(o)){for(i=n-1;i>=0&&l[i]&&l[i].pos>o;)l[i--]=undefined;i=n-1-i,i>=0&&l.push({pos:o,count:i})}return a={pos:-98765},l.forEach(function(e,t){e&&(a.pos===e.pos?(a.count++,l[t]=undefined):a=e)}),a={pos:-98765},l.forEach(function(e,t){e&&(e.pos-a.pos<8?a.count>e.count?(a.count+=e.count,l[t]=undefined):(e.count+=a.count,l[i]=undefined,a=e,i=t):(a=e,i=t))}),l=l.filter(function(e){return e}),n=l.length,n>1&&(l[0].pos<r+4&&(l[0].pos=r),l[0].pos!==r&&(l.unshift({pos:r,count:0}),n++),isNaN(o)||(n--,o-l[n].pos<4&&(l[n].pos=o),l[n].pos!==o&&l.push({pos:o,count:0}))),l}function o(e,t,r){var o=0,n=r.length;s.sort(function(t,r){return t.pxRect[e]-r.pxRect[e]}),s.forEach(function(i){for(var a=i.pxRect[e];n>o&&r[o].pos<a;)o++;(o>=n||o>0&&a-r[o-1].pos<r[o].pos-a)&&--o,i.cell[t]=o})}var n,i,a,l,s,c,u,d,f=this,p=(f.report.viewer,f.getTableColEdges),h=f.getMergedColumns?f.getMergedColumns():0,g=[],m=[];if(s=f.Controls.items.filter(function(e){return e.cell={control:e},e.Visible}),i=s.length,c=r("top","bottom",0,t),a=c.length-1,p?(u=f.getTableColEdges(),l=u.length-1,8>l&&(d=r("left","right",0,e),d.length>2*l&&(u=d,p=undefined))):u=r("left","right",0,e),l=u.length-1,!p)for(f.tableCols=[],n=0;l>n;)f.tableCols.push(u[n+1].pos-u[n++].pos);for(o("top","beginRow",c),o("bottom","endRow",c),o("left","beginCol",u),o("right","endCol",u),s.forEach(function(e){var t=e.cell;t.endCol<=t.beginCol&&t.endCol<l&&t.endCol++,t.endRow<=t.beginRow&&t.endRow<a&&t.endRow++}),n=0;a>n;)m.push({section:f,pxHeight:c[n+1].pos-c[n++].pos,cells:[]});for(s=s.filter(function(e){var t=e.cell;return t.beginCol<t.endCol&&t.beginRow<t.endRow}),s.sort(function(e,t){var r=e.cell.beginRow-t.cell.beginRow;return r?r:e.cell.beginCol-t.cell.beginCol}),n=0;a>n;n++)d=[],d.length=l,g.push(d);h&&h.forEach(function(e){var t=e.index;g.forEach(function(e){e[t]=1})}),n=0,s.forEach(function(e){for(var t,r,o=e.cell,i=g[o.beginRow];o.beginCol<o.endCol&&i[o.beginCol];)o.beginCol++;for(;o.endCol>o.beginCol&&i[o.endCol-1];)o.endCol--;if(o.beginCol<o.endCol){for(t=o.beginRow;t<o.endRow;t++)for(r=o.beginCol;r<o.endCol;r++)g[t][r]=1;i[o.beginCol]=e,n++}}),1===f.report.controlPosition||h||i&&n/i>.8?(g.forEach(function(e,t){var r,o,n,i=m[t].cells;r=o=0;do{for(;l>o&&!e[o];)o++;for(o>r&&(i.push({beginCol:r,endCol:o}),r=o);l>o&&1===e[o];)o++;r=o,l>r&&(n=e[r])&&(n=n.cell,i.push(n),r=o=n.endCol)}while(l>o)}),m.forEach(function(e){var t=0,r=0;e.cells.forEach(function(e){e.control&&(t++,e.control.CanShrink&&r++)}),t&&r===t&&delete e.pxHeight}),f.tableRows=m):(delete f.tableCols,delete f.tableRows,f.Controls.items.forEach(function(e){delete e.cell}))},doGenerate:function(e){var t=this,r=t.report.viewer;e=new HtmlElement(t.tableRows?"table":"div",e),t.addElementEventClass(e),e.addClass(r.selectSection(t)),t.tableRows?(e.addStyle("border-collapse","collapse"),t.generateTableRows(e)):(e.addStyle("position","relative"),t.Controls.generate(e))},generateTableRows:function(e,t){function r(){var e,t,r=h.length-1,o=h[r],n=s.showingColumns,i=s.Border;n.length>0&&(e=n[n.length-1],t=i.getLeftWidth()+i.getRightWidth(),Math.abs(o-e.pxWidth-t)<.5&&(h[r]-=t))}var o,n,i=this,a=i.owner,l=i.report,s=a.RunningDetailGrid,c=l.viewer,u=i.owner!==l||l.reportFitWidth,d=l.fixedColsLeft,f=a.Header?a.owner:0,p=f&&f.hasMergedColumn&&d>0,h=i.tableCols,g=0;h&&(h.forEach(function(e){g+=e}),a==i.report&&s&&r(),o=new HtmlElement("colgroup",e),e.addStyle("width",u?"100%":pixelsToHtml(g)),h.forEach(function(e){n=new HtmlElement("col",o),n.skipend=1,n.addStyle("width",percentToHtml(100*e/g))})),i.tableRows.forEach(function(r,o){function n(e){e.ContentCell.generate(a),e.mergingElement=a.children[a.children.length-1],e.ContentCell.getUsingFont()!==i.getUsingFont()&&e.mergingElement.addClass(c.selectFont2(e.ContentCell.getUsingFont())),
e.ContentCell.BackColor!==i.BackColor&&e.mergingElement.addBackColorStyle(e.ContentCell.BackColor),e.mergedHeader.todoMerge=0}var a;a=new HtmlElement("tr",e),a.addClass(c.selectSection(r)),r.cells.forEach(function(e){var r,l,s,u=e.control;if(!o&&t)for(;(s=t[0])&&s.index<=e.beginCol;)n(s),t.shift();r=new HtmlElement("td",a),l=e.endCol-e.beginCol,l>1&&r.addAttribute("colspan",l+""),u?(l=e.endRow-e.beginRow,l>1&&r.addAttribute("rowspan",l+""),u.Visible&&(13!==u.ControlType?(r.addClass(c.selectControl(u)),u.Font.font&&r.addClass(c.selectFont(u.Font.font,u.defaultFontStyle))):r.addStyle("padding","0px"),u.generateInCell(r))):e.fixed&&r.addStyle("background-color",colorValue2Html(i.BackColor)),p&&e.endCol<=d&&(r.addAttribute("id",f.showingColumns[e.beginCol].idMGC),r.addStyle("background-color",colorValue2Html(i.BackColor)))}),!o&&t&&t.forEach(function(e){n(e)})})},getRect:function(){var e=this;return new Rect(0,0,e.report.getReportWidth(),e.pxHeight)},getSingleHidableSR:function(){var e=this,t=e.Controls.items,r=t[0];return 1===t.length&&9===r.ControlType&&r.HideOnRecordsetEmpty?r:undefined},_runningNo:function(){return 0}},prototypeCopyExtend(Section,SectionRoot);var ReportHeader=function(e){var t=this;Section.call(t,e),t.Name=""};ReportHeader.prototype={toFillBack:function(){return 1}},prototypeCopyExtend(ReportHeader,Section);var ReportFooter=function(e){var t=this;Section.call(t,e),t.Name=""};ReportFooter.prototype={toFillBack:function(){return 1}},prototypeCopyExtend(ReportFooter,Section);var ColumnSection=function(e){var t=this;SectionRoot.call(t,e),t.Height=t.report.cm2Size(.58)};ColumnSection.prototype={defaultHeight:function(){return.58}},prototypeCopyExtend(ColumnSection,SectionRoot);var ColumnContent=function(e){var t=this;ColumnSection.call(t,e),t.ContentCells=new ColumnContentCells(t),t.AlternatingBackColor=t.BackColor};ColumnContent.prototype={afterLoad:function(e){var t=this;ColumnSection.prototype.afterLoad.call(t,e),e[t.getJsonMember("AlternatingBackColor")]?colorMemberValid(t,"AlternatingBackColor",t.report.viewer.alpha.background):t.AlternatingBackColor=t.BackColor,t.ContentCells.loadFromJSON(e.ColumnContentCell)},prepare:function(){var e,t=this,r=t.report.viewer;ColumnSection.prototype.prepare.call(t),t.defaultStyle=r.selectSectionItem(t),t.AlternatingBackColor!==t.BackColor&&(e=t.BackColor,t.BackColor=t.AlternatingBackColor,t.altSectionStyle=r.selectSectionItem(t),t.BackColor=e),t.ContentCells.prepare()},unprepare:function(){var e=this;ColumnSection.prototype.unprepare.call(e),e.ContentCells.unprepare()},generate:function(e,t){var r=this;r.owner.Recordset.moveTo(t),ColumnSection.prototype.generate.call(r,e)},doGenerate:function(e){var t=this,r=t.report.viewer,o=t.owner,n=o.showingColumns,i=o.Recordset.RecordNo;e=new HtmlElement("tr",e),t.addElementEventClass(e),e.addAttribute(grconst.ATTR_CONTENT_RECNO,i+""),t.altSectionStyle&&i%2?(t._BackColor=t.BackColor,t._defaultStyle=t.defaultStyle,t.BackColor=t.AlternatingBackColor,t.defaultStyle=t.altSectionStyle,e.addClass(r.selectSection(t)),t.BackColor=t._BackColor,t.defaultStyle=t._defaultStyle):e.addClass(r.selectSection(t)),o.hasMergedColumn?n.forEach(function(t){var r,o,n,i=t.ContentCell,a=t.mergedHeader;if(a){if(a.todoMerge){if(a.SameAsColumn)i.generate(e);else for(r=a.Controls,o=r.Count;o>0;)if(n=r.Item(o--),n.oAlignColumn===t){i.generateMerge(e,n);break}e.children&&(t.mergingElement=e.children[e.children.length-1])}}else i.generate(e)}):n.forEach(function(t){t.ContentCell.generate(e)}),o.hasMergedColumn&&o.Groups.forEach(function(e){e.Header.todoMerge&&(e.Header.todoMerge=0)})},getSingleHidableSR:function(){for(var e,t,r=this,o=r.ContentCells.items,n=o.length,i=0,a=0,l=0;n>i&&(e=o[i++],e._freeCell);)if(l=e.Controls.Count,l>0)if(a+=l,1===a)t=e.Controls.Item(1);else if(a>1)break;return 1===a&&9===t.ControlType&&t.HideOnRecordsetEmpty?t:undefined},SetCellsBackColor:function(e){this.ContentCells.forEach(function(t){t.BackColor=e})},SetCellsForeColor:function(e){this.ContentCells.forEach(function(t){t.setForeColor(e)})}},prototypeCopyExtend(ColumnContent,ColumnSection);var ColumnTitle=function(e){var t=this;ColumnSection.call(t,e),t.TitleCells=new ColumnTitleCells(t)};ColumnTitle.prototype={afterLoad:function(e){var t=this;ColumnSection.prototype.afterLoad.call(t,e),t.TitleCells.loadFromJSON(e.ColumnTitleCell)},prepare:function(){function e(t){var n=1;return t.showingItems=[],t.forEach(function(i){var a,l,s;i.layer=o,i.GroupTitle?i.Visible&&(o++,a=e(i.SubTitles)+1,o--,l=i.SubTitles.showingItems,l.length>0&&(t.showingItems.push(i),a>n&&(n=a),i.colspan=0,l.forEach(function(e){i.colspan+=e.colspan}))):(s=i.Column,s.Visible&&s.pxWidth>0&&(t.showingItems.push(i),i.colspan=1,s.pxLeft=r.columnsTotalWidth,s.index=r.showingColumns.length,r.columnsTotalWidth+=s.pxWidth,r.showingColumns.push(s)))}),n}var t=this,r=t.owner,o=0;ColumnSection.prototype.prepare.call(t),r.columnsTotalWidth=0,r.showingColumns=[],t.layerCount=e(t.TitleCells),t.pxHeight/=t.layerCount,t.TitleCells.prepare(),t.defaultStyle=t.report.viewer.selectSectionItem(t)},unprepare:function(){var e=this;ColumnSection.prototype.unprepare.call(e),e.TitleCells.unprepare()},doGenerate:function(e){function t(e){e.forEach(function(e){e.layer===o.generatingLayer&&e.generate(r),e.GroupTitle&&t(e.SubTitles.showingItems)})}var r,o=this,n=o.report.viewer;for(o.pxHeight/=o.layerCount,o.generatingLayer=0;o.generatingLayer<o.layerCount;)r=new HtmlElement("tr",e),o.addElementEventClass(r),r.addClass(n.selectSection(o)),t(o.TitleCells.showingItems),o.generatingLayer++},FindColumnTitlesOfTitleCell:function(e){function t(e,r){var o,n,i,a=e.items.length;for(o=0;a>o;o++){if(n=e.items[o],n===r)return e;if(n.GroupTitle&&(i=t(n.SubTitles,r)))return i}return undefined}return t(this.TitleCells,e)},SetCellsBackColor:function(e){function t(r){r.forEach(function(r){r.BackColor=e,r.GroupTitle&&t(r.SubTitles)})}t(this.TitleCells)},SetCellsForeColor:function(e){function t(r){r.forEach(function(r){r.setForeColor(e),r.GroupTitle&&t(r.SubTitles)})}t(this.TitleCells)}},prototypeCopyExtend(ColumnTitle,ColumnSection);var GroupSection=function(e){var t=this;Section.call(t,e),t.Height=t.report.cm2Size(1.2)};GroupSection.prototype={generate:function(e,t){var r=this,o=r.owner;o.recordset.moveTo(t),o.owner.Recordset.moveTo((r===o.Header?o.beginNoField:o.endNoField).Value),Section.prototype.generate.call(r,e)},doGenerate:function(e){function t(e){var t=o.owner,r=o===t.Header?grconst.ATTR_GROUPH_INDEX:grconst.ATTR_GROUPF_INDEX;e.addAttribute(grconst.ATTR_GROUP_RECNO,t.recordset.recordNo),e.addAttribute(r,t.index)}var r,o=this,n=o.report.viewer,i=o.owner.owner,a=i.showingColumns,l=a.length;i.hasMergedColumn&&(r=[],a.forEach(function(e){e.mergedHeader&&e.mergedHeader.todoMerge&&(o.owner.Footer!==o||o.owner===i.Groups.Item(i.Groups.Count)&&e.mergedHeader!==o.owner.Header)&&r.push(e)}),r.length||(r=undefined)),o.tableRows&&!o.tableCols?(o.generateTableRows(e,r),e.children&&e.children.slice(-o.tableRows.length).forEach(function(e){o.addElementEventClass(e),t(e)})):(e=new HtmlElement("tr",e),e.addClass(n.selectSection(o)),o.addElementEventClass(e),t(e),e=new HtmlElement("td",e),l>1&&e.addAttribute("colspan",l),o.tableCols?(e=new HtmlElement("table",e),e.addClass(n.selectSection(o)),e.addStyle("border-collapse","collapse"),o.generateTableRows(e)):(e.addStyle("position","relative"),o.Controls.generate(e)))},getTableColEdges:function(){var e,t=this.owner.owner.showingColumns;return e=t.map(function(e){return{pos:e.pxLeft,count:1}}),e.push({pos:t[t.length-1].pxRight,count:1}),e},getMergedColumns:function(){var e,t,r=this;return e=r.owner.index,t=r.owner.owner.showingColumns.filter(function(t){var o,n,i=t.mergedHeader;return i&&((n=(o=i.owner).index)<e||n===e&&r===o.Footer&&o.Header.IncludeFooter)}),0===t.length&&(t=0),t},getParentBackColor:function(e){return this.owner.owner.BackColor},getParentFont:function(){return this.owner.owner.Font},_runningNo:function(){return this.owner.recordset.RecordNo+1}},prototypeCopyExtend(GroupSection,Section);var GroupHeader=function(e){var t=this;GroupSection.call(t,e),t.OccupiedColumns="",t.OccupyColumn=!1,t.SameAsColumn=!0,t.IncludeFooter=!1,t.VAlign=1};GroupHeader.prototype={afterLoad:function(e){var t=this;GroupSection.prototype.afterLoad.call(t,e),enumMemberValid(t,"VAlign",grenum.OCGroupHeaderVAlign)},prepare:function(){var e,t=this;t.OccupiedColumns&&(e=t.owner.owner.Columns.decodeItems(t.OccupiedColumns),e=e.filter(function(e){return e.Visible}),e.length>0&&(t.groupMergedColumns=e,e.forEach(function(e){e.mergedHeader=t,t.owner.owner.hasMergedColumn=1}))),!(t.groupMergedColumns&&t.SameAsColumn)&&GroupSection.prototype.prepare.call(t)},unprepare:function(){},generate:function(e,t){var r=this;r.groupMergedColumns?(r.owner.recordset.moveTo(t),r.curItemBegin=e.children?e.children.length:0,r.todoMerge=1):GroupSection.prototype.generate.call(r,e,t)},get Group(){return this.owner}},prototypeCopyExtend(GroupHeader,GroupSection);var GroupFooter=function(e){GroupSection.call(this,e)};GroupFooter.prototype={generate:function(e,t){var r,o=this,n=o.owner.Header,i=n.groupMergedColumns;GroupSection.prototype.generate.call(o,e,t),i&&e.children&&(r=e.children.length-n.curItemBegin,!n.IncludeFooter&&o.isToGenerate()&&r--,i.forEach(function(e){var t=e.mergingElement;t&&r>1&&t.addAttribute("rowspan",r+"")}))},get Group(){return this.owner}},prototypeCopyExtend(GroupFooter,GroupSection);var Field=function(e){var t=this;Object.call(t,e),t.FieldType=1,t._name="",t._dbFieldName="",t._tableMember=undefined,t.Format="",t.Length=0,t.RTrimBlankChars=!1,t.GetDisplayTextScript=""};Field.prototype={afterLoad:function(e){var t,r=this;t=e[r.getJsonMember("Type")],t&&(r.FieldType=t),t=e[r.getJsonMember("Name")],t&&(r.Name=t),t=e[r.getJsonMember("DBFieldName")],t&&(r.DBFieldName=t),enumMemberValid(r,"FieldType",grenum.FieldType)},prepare:function(){var e=this,t=e.FieldType,r=e.Format;6===t?e.formater=new DateTimeFormatter(r):5===t?e.formater=new BooleanFormatter(r):2!==t&&3!==t&&4!==t||(e.formater=new NumericFormatter(r))},unprepare:function(){var e=this;delete e.formater,delete e._fts},isNumeric:function(){var e=this.FieldType;return 2===e||3===e||4===e},valUeq:function(e){var t=this.Value,r=e.Value;return r>t||t>r||(t===undefined||r===undefined)&&t!==r},get Value(){var e=this,t=e.owner.curRecord;return t?t[e._tableMember]:undefined},set Value(e){var t=this,r=t.owner.curRecord;if(r){if(e!==undefined&&null!==e)switch(t.FieldType){case 2:case 3:case 4:e=+e;break;case 5:e=confirmBooleanValue(e);break;case 6:e=confirmCloneDateValue(e);break;default:e+=""}else e=undefined;r[t._tableMember]=e}},get AsBoolean(){return confirmBooleanValue(this.Value)},set AsBoolean(e){this.Value=e},get AsCurrency(){return+this.Value},set AsCurrency(e){this.Value=e},get AsDateTime(){return cloneDate(this.Value)},set AsDateTime(e){this.Value=e},get AsFloat(){var e,t=this;if(t.IsNull)e=0;else if(6===t.FieldType){var r=new DateTime;r.value=t.Value,e=r.AsFloat}else e=+t.Value;return isNaN(e)?0:e},set AsFloat(e){var t,r=this;6===r.FieldType&&(t=new DateTime,t.AsFloat=e,e=t.value),r.Value=e},get AsInteger(){return Math.floor(this.AsFloat)},set AsInteger(e){this.AsFloat=Math.floor(+e)},get AsString(){var e=this;return e.IsNull?"":e.Value+""},set AsString(e){this.Value=e},get DisplayText(){var e=this,t=e.FieldType,r=e.Value;return e.displayTextAssigned=0,e.doingGetDisplayText||(e.doingGetDisplayText=1,e.report.fireFieldGetDisplayText(e),e.doingGetDisplayText=0),e.displayTextAssigned?e.assignedDisplayText:e.IsNull?"":1===t||7===t?r+"":e.formater.format(r)},set DisplayText(e){var t=this;t.assignedDisplayText=e+"",t.displayTextAssigned=1},get IsNull(){var e=this.Value;return e===undefined||null===e},get DataSize(){return 0},get DataBuffer(){return undefined},get Name(){return this._name},set Name(e){var t=this;t._tableMember&&t._tableMember!==t._name||(t._tableMember=e),t._name=e},get DBFieldName(){return this._name},set DBFieldName(e){var t=this;t._dbFieldName=e,e&&(t._tableMember=e)},get RunningDBField(){var e=this;return e._dbFieldName||e._name},Clear:function(){this.Value=undefined}},prototypeCopyExtend(Field,Object);var Recordset=function(e){var t=this;Object.call(t,e),t.QuerySQL="",t.Fields=new Fields(t),t.SortAsc=!0,t.SortCaseSensitive=!1,t.SortFields="",t.XmlTableName="",t.FetchRecordScript="",t.BeforePostRecordScript="",t.ProcessRecordScript="",t._dataTable=[],t.recordNo=0};Recordset.prototype={children:["Fields"],afterLoad:function(e){this.Fields.loadFromJSON(e.Field)},attachDataTable:function(e){var t=this;t._dataTable=e,t.moveTo(0)},appendRefRecord:function(e){this._dataTable.push(e)},prepareTableData:function(){function e(e,t){if(e.hasOwnProperty(t))return t;t=t.toUpperCase();for(var r in e)if(t===r.toUpperCase())return r;return undefined}var t,r,o,n,i,a=this,l=a._dataTable,s=a.Fields.items,c=l.length,u=s.length;if(DEBUG)for(;u--;)r=s[u];for(;c--;)for(t=l[c],u=s.length;u--;){if(r=s[u],i=r._fts,n=r._tableMember,i===undefined&&(n=e(t,n))){switch(r.FieldType){case 1:i="string"!=typeof t[n];break;case 2:case 3:case 4:i="number"!=typeof t[n];break;case 5:i="boolean"!=typeof t[n];break;case 6:i=!Date.prototype.isPrototypeOf(t[n]);break;default:i=!1}r._fts=i,r._tableMember=n}if(n&&(o=t[n],null!==o&&""!==o||(o=undefined,t[n]=o),i&&o!==undefined))switch(r.FieldType){case 1:t[n]=o+"";break;case 2:case 3:case 4:t[n]=+o;break;case 5:t[n]=confirmBooleanValue(o);break;case 6:t[n]=confirmDateValue(o)}}a.SortFields&&a.Resort(a.SortFields,a.SortAsc,a.SortCaseSensitive)},prepare:function(){var e=this,t=e._dataTable.length,r=0;for(e.Fields.prepare(),e.prepareTableData();t>r;)e.moveTo(r++),e.beforePost();e.moveTo(0)},unprepare:function(){var e=this;e.Fields.unprepare(),e._dataTable=[]},beforePost:function(){var e=this,t=e.report,r=e.BeforePostRecordScript;r&&t.executeEventScript(r,script.names.BeforePostRecord,e),e.isDetailGridRecordset()&&t.fireBeforePostRecord()},decodeFields:function(e){return this.Fields.decodeItems(e)},isDetailGridRecordset:function(){var e=this;return e.owner===e.report.DetailGrid},isAppendingRecord:function(){return 1===this.editStatus},keepValue:function(){var e=this;e.keepedRecord=e.curRecord},fieldsKeepedValueChanged:function(e){var t=this;return e.some(function(e){var r=e._tableMember,o=t.keepedRecord[r],n=t.curRecord[r];return n>o||o>n||(o===undefined||n===undefined)&&o!==n})},sortRecords:function(e,t){for(var r=this,o=r._dataTable,n=o.length,i=0,a=[];n>i;)a.push(i++);return e.length>0&&(e.forEach(function(e){e.fieldName=e.field._tableMember}),a.sort(function(t,r){var n;return e.some(function(e){var i=o[t][e.fieldName],a=o[r][e.fieldName];return i!==undefined&&a!==undefined?1===e.field.FieldType?(e["case"]||(i=i.toUpperCase(),a=a.toUpperCase()),n=i.localeCompare(a)):n=a>i?-1:i>a?1:0:n=i===undefined&&a===undefined?0:i===undefined?-1:1,e.asc||(n=-n),n}),n})),t?a:(i=[],a.forEach(function(e){i.push(o[e])}),r._dataTable=i,void r.moveTo(0))},get RecordCount(){var e=this;return e._dataTable?e._dataTable.length:0},get RecordNo(){return this.recordNo},FieldByName:function(e){return this.Fields.itemByName(e)},FieldByDBName:function(e){var t,r=this.Fields.items,o=r.length;for(e=e.toUpperCase(),t=0;o>t;t++)if(r[t].RunningDBField.toUpperCase()===e)return r[t];return undefined},Append:function(){var e=this;return e.editStatus=1,e.recordNo=e._dataTable.length,e.curRecord={},1},Duplicate:function(){},Edit:function(){var e,t,r=this,o=r.Fields.items,n=o.length,i=r.curRecord,a={};if(r.recordNo>=0&&r.recordNo<r._dataTable.length){for(r.editStatus=2;n--;)e=o[n],t=e._tableMember,i[t]!==undefined&&(6===e.FieldType?a[t]=confirmCloneDateValue(i[t]):a[t]=i[t]);r.curRecord=a}},Cancel:function(){var e=this;e.editStatus&&(1===e.editStatus?e.Last():e.curRecord=e._dataTable[e.recordNo],e.editStatus=0)},Post:function(){var e=this,t=e._dataTable;e.editStatus&&(e.beforePost(),1===e.editStatus?t.push(e.curRecord):t[e.recordNo]=e.curRecord,e.editStatus=0)},First:function(){this.moveTo(0)},Next:function(){var e=this;e.moveTo(e.recordNo+1)},Prior:function(){var e=this;e.moveTo(e.recordNo-1)},Last:function(){var e=this;e.moveTo(e._dataTable.length-1)},MoveBy:function(e){var t=this;t.moveTo(t.recordNo+e)},Bof:function(){var e=this;return e.recordNo<0||!e._dataTable.length},Eof:function(){var e=this;return e.recordNo>=e._dataTable.length},moveTo:function(e){var t=this,r=t._dataTable;t.recordNo=e,t.curRecord=r[Math.min(Math.max(0,e),r.length-1)]},Empty:function(){this.attachDataTable([])},AddField:function(e,t){var r=this.Fields.Add();return r.Name=e,r.FieldType=t,r},RemoveAllFields:function(){this.Fields.RemoveAll()},Resort:function(e,t,r){function o(){var o=[],n=e.split(";");return n.forEach(function(e){function n(e){e=e.trim().toUpperCase(),"ASC"===e?l.asc=!0:"DESC"===e?l.asc=!1:"CASE"===e?l["case"]=!0:"CASEIN"===e&&(l["case"]=!1)}var i,l={};e=e.trim(),i=e.split(" "),i[0]=i[0].trim(),l.field=a.Fields.Item(i[0]),l.field&&(l.asc=t,l["case"]=r,i.length>1&&n(i[1]),i.length>2&&n(i[2]),o.push(l))}),o}var n,i,a=this,l=[];e&&(n=o(),i=n.length,i>0&&(a.report.fireBeforeSort(e,a),a.isDetailGridRecordset()&&(a.owner.Groups.forEach(function(e){a.decodeFields(e.ByFields).forEach(function(e){l.indexOf(e)<0&&l.push(e)})}),n.forEach(function(e){var t=l.indexOf(e.field);0>t?l.push(e):l[t]=e}),l.forEach(function(e,o){e.field||(l[o]={field:e,asc:t,"case":r})}),n=l,i=n.length)),a.sortRecords(n,0))},FilterByStep:function(e,t){var r=this,o=r.RecordCount(),n=0;if(r._dataTable&&!r.isAppendingRecord()&&e>0){for(r.FilterBegin();o>n;)r.moveTo(n),r.FilterSelect(),n+=e;t&&n-e+1!=o&&(r.Last(),r.FilterSelect()),r.FilterEnd()}},FilterByCount:function(e){var t,r,o=this,n=o.RecordCount(),i=0;if(o._dataTable&&!o.isAppendingRecord()&&e>1&n>e){for(t=(n-1)/(e-1),o.FilterBegin();n>i;)r=Math.round(i),o.moveTo(r),o.FilterSelect(),i+=t;o.FilterEnd()}},FilterBegin:function(){this._dtf=[]},FilterEnd:function(){var e=this,t=e._dataTable;e._dtf&&(e._dataTable=e._dtf,e._dtf=t)},FilterSelect:function(){var e=this;!(!e._dtf||e.isAppendingRecord()||e.Bof()||e.Eof())&&e._dtf.push(e.curRecord)},FilterReset:function(){var e=this;e._dtf&&(e._dataTable=e._dtf,delete e._dtf)}},prototypeCopyExtend(Recordset,Object);var Column=function(e){var t=this;Object.call(t,e),t.Name="",t.Visible=!0,t.FixedWidth=!1,t.Width=t.report.cm2Size(3)};Column.prototype={prepare:function(){var e=this;e.pxWidth=e.report.size2Pixel(e.Width)},get pxRight(){var e=this;return e.pxLeft+e.pxWidth},get idMGC(){var e=this;return"_mgc"+e.owner.index+"_"+e.index}},prototypeCopyExtend(Column,Object);var Group=function(e){var t=this;Object.call(t,e),t.Header=new GroupHeader(t),t.Footer=new GroupFooter(t),t.Name="",t.ByFields="",t.PageGroup=!1,t.SortSummaryBox="",t.SortAsc=!1,t.GroupBeginScript="",t.GroupEndScript=""};Group.prototype={children:["Header","Footer"],afterLoad:function(e){var t=this;t.Header.loadFromJSON(e.GroupHeader),t.Footer.loadFromJSON(e.GroupFooter)},prepare:function(e){function t(e){e.forEach(function(e){function o(e){function n(e){var t,o,n,a=i.length+"",l="";i.push(e),e.SummaryFun?(e.value=0,28===e.SummaryFun&&(t=r.owner.Groups.indexOf(r),t>0&&(o=new SummaryItem,o.SummaryFun=-1,o.init(),r.owner.Groups.items[t-1].summaryItems.push(o))),e.displayField?(n=e.displayField.FieldType,l=e.displayField.Format):(n=18===e.SummaryFun||19===e.SummaryFun||29===e.SummaryFun||30===e.SummaryFun?1:3,e.paramExp&&(o=e.paramExp.varItems,1===o.length&&(o=o[0].varField.object,o&&o.Format&&(l=o.Format))))):e.oParameter?(n=e.oParameter.DataType,l=e.oParameter.Format):n=3,e.valueField=r.recordset.AddField(a,n),e.valueField.Format=l}var i=r.summaryItems,a=e.ControlType;5===a?n(e):8===a?MemoBox.prototype.getGroupVars.call(e).forEach(function(e){n(e)}):1===a?e.oParameter&&n(e):13===a&&e.cells.forEach(function(e){e.forEach(function(e){e.FreeCell?t(e.Controls):o(e)})})}o(e)})}var r=this;r.index=e,r.Header.prepare(),r.Footer.prepare(),r.oByFields=r.owner.Recordset.decodeFields(r.ByFields),r.SortSummaryBox&&(r.sortSummaryBoxObj=r.Footer.Controls.itemByName(r.SortSummaryBox),r.sortSummaryBoxObj||(r.sortSummaryBoxObj=r.Header.Controls.itemByName(r.SortSummaryBox)),r.sortSummaryBoxObj&&5!==r.sortSummaryBoxObj.ControlType&&delete r.sortSummaryBoxObj),r.recordset=new Recordset(r),r.beginNoField=r.recordset.AddField("b",2),r.endNoField=r.recordset.AddField("e",2),r.groupItemNo=0,r.summaryItems=[],t(r.Header.Controls),t(r.Footer.Controls),r.recordset.prepare()},unprepare:function(){},inphaseByDetail:function(e){var t=this,r=t.recordset;if(!r.isAppendingRecord()&&r.RecordCount){for(;t.beginNoField.Value>e&&!r.Bof();)r.Prior();for(;t.endNoField.Value<e&&!r.Eof();)r.Next()}},get Parent(){return this.owner}},prototypeCopyExtend(Group,Object);var DetailGrid=function(e){var t=this;Object.call(t,e),t.FixCols=0,t.BackColor=e.BackColor,t.ShowColLine=!0,t.ShowRowLine=!0,t.Font=new FontWrapper(e.Font),t.Border=new Border(15),t.ColLinePen=new Pen,t.RowLinePen=new Pen,t.Recordset=new Recordset(t),t.ColumnContent=new ColumnContent(t),t.ColumnTitle=new ColumnTitle(t),t.Columns=new Columns(t),t.Groups=new Groups(t)};DetailGrid.prototype={children:["Border","ColLinePen","RowLinePen","Recordset","Groups"],afterLoad:function(e){var t=this,r=t.report.viewer.alpha,o=t.report.isWR;colorMemberValid(t,"BackColor",r.background),t.Border.loadFromJSON(e.Border,r.border,o),t.ColLinePen.loadFromJSON(e.ColLine,r.stroke,o),t.RowLinePen.loadFromJSON(e.RowLine,r.stroke,o),t.Font.loadFromJSON(e.Font,o),t.Recordset.loadFromJSON(e.Recordset),t.Groups.loadFromJSON(e.Group),t.Columns.loadFromJSON(e.Column),t.ColumnContent.loadFromJSON(e.ColumnContent),t.ColumnTitle.loadFromJSON(e.ColumnTitle),t.IsCrossTab=e[t.getJsonMember("IsCrossTab")],t.IsCrossTab&&t.CrossTab.loadFromJSON(e.CrossTab)},assign:function(e){function t(e,o){o.forEach(function(o){var n;o.GroupTitle?(n=e.AddGroup("",""),n.assign(o),t(n.SubTitles,o.SubTitles)):(n=r.Columns.addTo(e),n.assign(o.Column),n.TitleCell.assign(o),n.ContentCell.assign(o.Column.ContentCell))})}var r=this;Object.prototype.assign.call(r,e),r.ColumnContent.assign(e.ColumnContent),r.ColumnTitle.assign(e.ColumnTitle),t(r.ColumnTitle.TitleCells,e.ColumnTitle.TitleCells),r.IsCrossTab=e.IsCrossTab,r.IsCrossTab&&r.CrossTab.assign(e.CrossTab)},attachData:function(){function e(t){t.forEach(function(t){t.attachData(),t.GroupTitle&&e(t.SubTitles)})}var t=this;t.Recordset.prepare(),t.ColumnContent.ContentCells.forEach(function(e){e.attachData()}),e(t.ColumnTitle.TitleCells),t.Groups.forEach(function(e){e.Header.Controls.attachData(),e.Footer.Controls.attachData()})},buildColumnsOrder:function(){function e(t){t.forEach(function(t){t.GroupTitle?e(t.SubTitles):(t.Column.orderNo=r.length,r.push(t.Column))})}var t=this,r=[];e(t.ColumnTitle.TitleCells),t.Columns.items=r},beginGroupItem:function(e){var t=this;e.PageGroup||(t.rows.push({header:e.Header,recordNo:e.groupItemNo}),e.recordset.Append(),e.beginNoField.Value=t.Recordset.recordNo,e.groupRecordCount=0,e.summaryItems.forEach(function(e){e.SummaryFun&&e.beginSummaryValue()}),t.report.fireGroupBegin(e))},endGroupItem:function(e){var t,r,o,n=this,i=n.report,a=e.summaryItems,l=a.length;if(!e.PageGroup){for(n.rows.push({footer:e.Footer,recordNo:e.groupItemNo++}),i.fireGroupEnd(e),a.forEach(function(e){e.SummaryFun&&e.endSummaryValue()});l-- >0;)t=a[l],r=t.SummaryFun,r?-1!==r&&(t.displayField||29===r||30===r||18===r||19===r?(o=t.stringValue,o&&(t.valueField.AsString=o)):(o=t.value,o!==undefined&&(t.valueField.AsFloat=o))):t.MathFun?t.valueField.Value=t.getAsFloat():t.valueField.Value=t.oParameter.Value;i.DetailGrid.CrossTab&&i.DetailGrid.CrossTab.GroupEndProcess(e),e.endNoField.Value=Math.min(n.Recordset.recordNo,n.Recordset.RecordCount-1),e.recordset.Post()}},prepare:function(){function e(r){r.forEach(function(r){function o(r){var n=t.globalSummaryItems,i=r.ControlType;5===i?n.push(r):8===i?MemoBox.prototype.getGroupVars.call(r).forEach(function(e){e.SummaryFun&&n.push(e)}):13===i&&r.cells.forEach(function(t){t.forEach(function(t){t.FreeCell?e(t.Controls):o(t)})})}o(r)})}var t=this,r=t.report;t.CrossTab?(t.buildColumnsOrder(),t.CrossTab.prepare()):(t.Columns.prepare(),t.ColumnContent.prepare(),t.ColumnTitle.prepare(),t.Groups.forEach(function(e,t){e.prepare(t)}),t.globalSummaryItems=[],r.ReportHeaders.items.concat(r.ReportFooters.items).forEach(function(t){e(t.Controls)}))},unprepare:function(){var e=this;e.CrossTab&&e.CrossTab.unprepare(),e.Recordset.unprepare(),e.ColumnContent.unprepare(),e.ColumnTitle.unprepare(),e.Groups.forEach(function(e,t){e.unprepare(t)})},generate:function(e){function t(){var e=n.ownerReport,t=n.detailgridResize;return a||1===t||2===t&&window.innerWidth&&o.width<window.innerWidth&&(!e||e.owner._singleSR)}var r,o=this,n=o.report,i=o.Recordset,a=n.fixed,l=n.viewer,s=new HtmlElement("table",e),c=new HtmlElement("colgroup",s);l._detailgrids.push(o),s.addAttribute("id",l._getDetailGridID(o.index)),s.addClass(grconst.CSS_DG),s.addBackColorStyle(o.BackColor),o.Font.font&&s.addClass(l.selectFont2(o.Font.font)),a?(s.addStyle("border-collapse","separate"),s.addStyle("border-spacing","0")):(s.styles.addBorder(o.Border),s.addStyle("border-collapse","collapse")),s.addStyle("width",t()?"100%":pixelsToHtml(o.width)),o.toFillBack()&&s.addBackColorStyle(o.BackColor),o.showingColumns.forEach(function(e){var t=new HtmlElement("col",c),r=e.pxWidth,n=a?pixelsToHtml(r):percentToHtml(100*r/o.columnsTotalWidth);t.skipend=1,t.addStyle("width",n)}),o.ColumnTitle.generate(new HtmlElement("thead",s)),i._relTblIndex>=0&&s.addAttribute("_grrelTblIndex",i._relTblIndex),r=new HtmlElement("tbody",s),o.generatingRowNo=1,o.rows.forEach(function(e,t){var n;e.tfoot&&(r=new HtmlElement("tfoot",s)),e.header?(n=e.header,n.generate(r,e.recordNo)):e.footer?(n=e.footer,n.generate(r,e.recordNo)):(n=o.ColumnContent,n.generate(r,e)),n.Visible&&n.Height>0&&++o.generatingRowNo})},buildRows:function(){function e(e){e.summaryItems.forEach(function(e){e.SummaryFun&&e.summaryCurRecord()}),e.groupRecordCount++}function t(e){function t(){var t,r=l.length,o=e.owner.rows,n=[];1>=r||(t=l[0].beginRowNo,l.forEach(function(t){e.recordset.moveTo(t.groupItemNo),t.sortValue=e.sortSummaryBoxObj.valueField.AsFloat}),l.sort(function(t,r){return e.SortAsc?t.sortValue-r.sortValue:r.sortValue-t.sortValue}),l.forEach(function(e){n=n.concat(o.slice(e.beginRowNo,e.endRowNo))}),n.forEach(function(e){o[t++]=e}))}var r,o,n,i=e.owner.rows,a=i.length,l=[];for(r=0;a>r;){for(n={},o=i[r],o.footer&&o.footer.owner.index<e.index&&(t(),l=[],r++);a>r;)if(o=i[r++],o.header&&o.header.owner.index===e.index){n.beginRowNo=r-1,n.groupItemNo=o.recordNo;break}for(;a>r;)if(o=i[r++],o.footer&&o.footer.owner.index===e.index){n.endRowNo=r,l.push(n);break}}t()}var r,o,n,i=this,a=i.report,l=i.Recordset,s=i.Groups.items,c=s.length,u=0;for(i.rows=[],i.globalSummaryItems.forEach(function(e){e.beginSummaryValue()}),l.First(),l.keepValue(),s.forEach(function(e){i.beginGroupItem(e)});!l.Eof();){for(r=0;c>r&&!l.fieldsKeepedValueChanged(s[r].oByFields);r++);if(c>r){for(l.Prior(),o=c-1;o>=r;o--)i.endGroupItem(s[o]);for(l.Next(),o=r;c>o;o++)i.beginGroupItem(s[o])}a.fireProcessRecord(l),s.forEach(function(t){e(t)}),i.globalSummaryItems.forEach(function(e){e.summaryCurRecord()}),i.rows.push(l.recordNo),l.keepValue(),l.Next()}for(a.fireProcessEnd(),o=c-1;o>=0;o--)i.endGroupItem(s[o]);i.globalSummaryItems.forEach(function(e){e.endSummaryValue()}),s.forEach(function(e){e.sortSummaryBoxObj&&(t(e),u=1)}),u&&(n=[],o=0,i.sortedTable=[],s.forEach(function(e){e.sortedTable=[],e.groupItemNo=0}),i.rows.forEach(function(e){var t;e.header?(t=e.header.owner,t.recordset.moveTo(e.recordNo),t.recordset.Edit(),t.beginNoField.Value=o,e.recordNo=t.groupItemNo):e.footer?(t=e.footer.owner,t.endNoField.Value=o,t.recordset.Post(),t.sortedTable.push(t.recordset._dataTable[e.recordNo]),e.recordNo=t.groupItemNo++):(i.sortedTable.push(l._dataTable[e]),e=o++),n.push(e)}),i.rows=n,l.attachDataTable(i.sortedTable),delete i.sortedTable,s.forEach(function(e){e.recordset.attachDataTable(e.sortedTable),delete e.sortedTable}))},syncTRData:function(e){function t(t){var r=e.parentNode.parentNode;r.hasAttribute("_grrelTblIndex")&&i.report.ownerSR.attachRelationTable2(r.getAttribute("_grrelTblIndex")),i.Recordset.moveTo(t)}var r,o,n,i=this,a=1,l={};return(o=e.getAttribute(grconst.ATTR_CONTENT_RECNO))?(t(o),l.content=i.ColumnContent):(o=e.getAttribute(grconst.ATTR_GROUP_RECNO))&&(n=e.getAttribute(grconst.ATTR_GROUPH_INDEX),n||(n=e.getAttribute(grconst.ATTR_GROUPF_INDEX),a=0),r=l.group=i.Groups.items[n],r.recordset.moveTo(o),t((a?r.beginNoField:r.endNoField).Value)),l},syncElementData:function(e,t){function r(e,t){var r,o=e.tagName.toUpperCase();if("TH"===o||"TABLE"===o)return 0;do{if(r&&(e=r.parentNode,o=e.tagName.toUpperCase(),"TH"===o))return 0;for(;"TD"!==o;){if(e=e.parentNode,!e)return 0;if(o=e.tagName.toUpperCase(),"TH"===o)return 0}if(r=e.parentNode.parentNode.parentNode,!t&&r.classList.contains(grconst.CSS_DG))break}while(t!==r);return e}var o=this,n=r(e,t);n&&o.syncTRData(n.parentNode)},onmousedown:function(e){function t(){var t,r,o,n=e.target;if("TABLE"===n.tagName.toUpperCase())return 0;for(;!o;){if(r&&(n=r.parentNode.parentNode.parentNode),t=n.tagName.toUpperCase(),"TH"===t)return 0;for(;"TD"!==t;)if(n=n.parentNode,t=n.tagName.toUpperCase(),"TH"===t)return 0;r=n.parentNode,o=r.hasAttribute(grconst.ATTR_CONTENT_RECNO)||r.hasAttribute(grconst.ATTR_GROUP_RECNO)}return n}function r(t){var r=o.curSelObj,n=o.report.viewer.options,i=t.parentNode,a=o.selectionCell?t:i;i.parentNode.parentNode===e.currentTarget&&n.selectionHighlight&&(r===a?a.classList.toggle(grconst.CSS_SH):(r&&r.classList.remove(grconst.CSS_SH),a.classList.add(grconst.CSS_SH),o.curSelObj=a)),o.clickedCell=t}var o=this,n=t();n&&r(n),o.syncElementData(e.target,e.currentTarget)},getClickedRow:function(){var e,t,r,o=this,n=o.clickedCell,i={};return n&&(e=n.parentNode,(r=e.getAttribute(grconst.ATTR_CONTENT_RECNO))?(i.type="content",i.recordNo=r):(r=e.getAttribute(grconst.ATTR_GROUP_RECNO))&&(t=e.hasAttribute(grconst.ATTR_GROUPH_INDEX),i.type=t?"groupheader":"groupfooter",i.groupIndex=+e.getAttribute(t?grconst.ATTR_GROUPH_INDEX:grconst.ATTR_GROUPF_INDEX))),i},clearColumns:function(){var e=this;e.ColumnContent.ContentCells.RemoveAll(),e.ColumnTitle.TitleCells.RemoveAll(),e.Columns.RemoveAll()},get width(){var e=this,t=e.Border;return e.columnsTotalWidth+t.getLeftWidth()+t.getRightWidth()},get selectionCell(){var e=this,t=e.report;return t.fixed&&(t.fixedColsLeft>0||t.fixedColsRight>0)?1:t.viewer.options.selectionCell},_ColumnMoveTo:function(e,t){var r=this,o=r.ColumnTitle.FindColumnTitlesOfTitleCell(e.TitleCell),n=t?t.SubTitles:r.ColumnTitle.TitleCells;r.MoveTitleTo(e.TitleCell,o,n,-1)},MoveTitleTo:function(e,t,r,o){t.items.splice(t.items.indexOf(e),1),0>o?r.items.push(e):r.items.splice(o,0,e)},get IsCrossTab(){return!!this.CrossTab},set IsCrossTab(e){var t=this;e?t.CrossTab||(t.CrossTab=new CrossTab(t)):delete t.CrossTab},AddColumn:function(e,t,r,o){var n=this.Columns.Add();return n.Name=e,n.Width=o,n.ContentCell.DataField=r,n.TitleCell.Text=t,n},ClearColumns:function(){this.Columns.RemoveAll()},FindGroupTitleCell:function(e){function t(r){var o,n=r.items.length,i=r.itemByName(e);if(!i)for(o=0;n>o;o++)if(i=r.items[o],i.GroupTitle&&(i=t(i.SubTitles,e)))return i;return i}return t(this.ColumnTitle.TitleCells,e)},AddGroupTitle:function(e,t){return this.ColumnTitle.TitleCells.AddGroup(e,t)},ClearGroupTitles:function(){var e,t,r=this,o=r.Columns.Count,n=r.ColumnTitle.TitleCells,i=[];for(e=1;o>=e;e++)ColumnMoveToEnd(e);for(o=n.Count,e=0;o>e;e++)t=n.items[e],!t.GroupTitle&&i.push(t);n.items=i},ColumnMoveToEnd:function(e){var t=this,r=t.Columns.Item(e);r&&sel._ColumnMoveTo(r,undefined)},ColumnMoveTo:function(e,t,r){var o,n=this,i=n.Columns.Item(e),a=i?i.TitleCell:n.FindGroupTitleCell(e),l=t?n.FindGroupTitleCell(t):undefined,s=t?l?l.SubTitles:undefined:n.ColumnTitle.TitleCells;a&&s&&(o=n.ColumnTitle.FindColumnTitlesOfTitleCell(a),
n.MoveTitleTo(a,o,s,r))},StartNewGroup:function(e){var t,r=this,o=r.Recordset,n=r.Groups.items,i=n.length,a=r.Groups.Item(e);if(a){for(o.Prior(),t=i-1;t>=a.index;t--)r.endGroupItem(n[t]);for(o.Next(),t=a.index;i>t;t++)r.beginGroupItem(n[t])}},ColumnByShowOrder:function(e){function t(e,r,o){var n,i,a=e.Count;for(n=0;a>n;n++)if(i=e.items[n],i.GroupTitle){if(i=t(i.SubTitles,r,o))return i}else{if(r==o)return i;r++}return undefined}var r=0;return t(this.ColumnTitle.TitleCells,r,e)}},prototypeCopyExtend(DetailGrid,Object);var Parameter=function(e){var t=this;Object.call(t,e),t.DataType=1,t.Name="",t.Format="",t.Value=undefined};Parameter.prototype={afterLoad:function(e){var t=this;enumMemberValid(t,"DataType",grenum.ParameterDataType),t.Value!==undefined&&t.setValue(t.Value)},prepare:function(){var e=this,t=e.DataType,r=e.Format;2===t||3===t?e.formater=new NumericFormatter(r):6===t?e.formater=new DateTimeFormatter(r):5===t&&(e.formater=new BooleanFormatter(r))},unprepare:function(){delete this.formater},setValue:function(e){var t=this;if(null!==e&&e!==undefined)switch(t.DataType){case 2:e=Math.floor(+e);break;case 3:e=+e;break;case 5:e=confirmBooleanValue(e);break;case 6:e=confirmDateValue(e);break;default:e+=""}else e=undefined;t.Value=e},get AsBoolean(){return!!this.Value},set AsBoolean(e){this.setValue(e)},get AsDateTime(){return confirmCloneDateValue(this.Value)},set AsDateTime(e){this.setValue(e)},get AsFloat(){var e=this,t=e.Value;if(6===e.DataType){var r=new DateTime;r.value=t,t=r.AsFloat}else t=+t;return isNaN(t)?0:t},set AsFloat(e){var t,r=this;6===r.DataType&&(t=new DateTime,t.AsFloat=e,e=t.value),r.setValue(e)},get AsInteger(){return Math.floor(this.AsFloat)},set AsInteger(e){this.AsFloat=Math.floor(+e)},get AsString(){var e=this.Value;return e===undefined?"":e+""},set AsString(e){this.setValue(e)},get DisplayText(){var e=this,t=e.Value;if(t===undefined)return"";switch(e.DataType){case 1:return t+"";default:return e.formater.format(t)}},get IsNull(){return this.Value===undefined},Clear:function(){this.Value=undefined}},prototypeCopyExtend(Parameter,Object);var Report=function(e,t){var r=this;e=e||{alpha:{background:1}},r.viewer=e,r.report=r,t&&(r.ownerSR=t),r.Font=new FontWrapper(undefined),r.Font.font=new Font,r.Parameters=new Parameters(r),r.ReportHeaders=new ReportHeaders(r),r.ReportFooters=new ReportFooters(r),r.XmlTableName="",r.Unit=1,r.CodePage=65001,r.BackColor=16777215,r.QuerySQL="",r.Title="",r.Author="",r.Description="",r.GlobalScript="",r.InitializeScript="",r.ProcessBeginScript="",r.ProcessEndScript="",r.BeforeSortScript="",r.Printer={DesignPaperWidth:21,DesignPaperLength:29.7,DesignPaperLeftMargin:2.5,DesignPaperRightMargin:2.5,DesignPaperOrientation:1}};Report.prototype={load:function(e){var t=this;"string"==typeof e&&(t.isWR="_WR"===e.substr(0,3),t.isWR&&(e=gr.wr.decodeWR(e)),e=JSON.parse(e)),t.loadFromJSON(e)},loadFromJSON:function(e){function t(e){return a[n?wrPropNameEncode(e):e]}var r,o=this,n=o.isWR,i=o.Printer,a=e.Printer;o.Clear(),assignJSONMembers(o,e),colorMemberValid(o,"BackColor",o.viewer.alpha.background),o.Font.loadFromJSON(e.Font,n),e.ImageList&&(o._imageList=new ImageList,o._imageList.loadFromJSON(e.ImageList,n)),o.Parameters.loadFromJSON(e.Parameter),o.ReportHeaders.loadFromJSON(e.ReportHeader),o.ReportFooters.loadFromJSON(e.ReportFooter),e.DetailGrid&&o.InsertDetailGrid().loadFromJSON(e.DetailGrid),a&&(r=t("Width"),r&&(i.DesignPaperWidth=r),r=t("Height"),r&&(i.DesignPaperLength=r),r=t("LeftMargin"),r!==undefined&&(i.DesignPaperLeftMargin=r),r=t("RightMargin"),r!==undefined&&(i.DesignPaperRightMargin=r),r=t("Oriention"),r&&(i.DesignPaperOrientation=2),o.Printer=i)},generateHtml:function(){function e(t,r){r&&(t.push(r.beginText()),r.children?(DEBUG&&t.push("\r\n"),r.children.forEach(function(r){e(t,r)})):t.push(r.innerText),t.push(r.endText()),DEBUG&&t.push("\r\n"))}var t=this,r=[],o={htmlElements:[],addChild:function(e){o.htmlElements.push(e)}};return t.generate(o),o.htmlElements.forEach(function(t){e(r,t)}),r.join("")},generate:function(e){function t(){function e(){function e(){function e(e){f=e?tagCSSChild(u):tagCSSChildR(u),p=[],p.push(grconst.CSS_DG_F+" th:"+f),f=C.hasMergedColumn?"#"+l.idMGC:grconst.CSS_DG_F+" td:"+f,p.push(f),n=new HtmlStyles,n.add("position","sticky"),n.add(e?"left":"right",pixelsToHtml(d)),e||u==y&&C.ShowColLine&&n.add("border-left",penStyleText(C.ColLinePen)),a.addCustomStyle(n,p),d+=l.pxWidth}for(d=0,r=0,u=1;T>=u;u++)l=v[u-1],e(1);for(d=0,u=1;y>=u;u++)l=v[S-u],e(0);for(p=[],u=1;T>=u;u++)p.push(grconst.CSS_DG_F+" th:"+tagCSSChild(u));for(u=1;y>=u;u++)p.push(grconst.CSS_DG_F+" th:"+tagCSSChildR(u));n=new HtmlStyles,n.add("z-index","3"),a.addCustomStyle(n,p)}function t(){function e(e,t){function r(o,n){var a,s,c,u=o.items,f=u.length,p=0;for(i.length<=n?(s=[],i.push(s)):s=i[n];e>l&&f>p;)a=u[t?p:f-1-p],++p,c={},c.pos=d,s.push(c),a.GroupTitle?r(a.SubTitles,n+1):(++l,d+=a.Column.pxWidth)}var i=[],l=0;d=0,r(o,0),i.forEach(function(e,r){var o=e.length,i=tagCSSChild(++r);e.forEach(function(e,r){var l;++r,l=t?tagCSSChild(r):tagCSSChildR(r),n=new HtmlStyles,n.add("position","sticky"),n.add(t?"left":"right",pixelsToHtml(e.pos)),n.add("z-index","3"),t||r==o&&C.ShowColLine&&n.add("border-left",penStyleText(C.ColLinePen)),a.addCustomStyle(n,grconst.CSS_DG_F+" thead tr:"+i+" th:"+l)})})}for(d=0,u=1;T>=u;u++)n=new HtmlStyles,n.add("position","sticky"),n.add("left",pixelsToHtml(d)),l=v[u-1],f=C.hasMergedColumn?"#"+l.idMGC:grconst.CSS_DG_F+" td:"+tagCSSChild(u),a.addCustomStyle(n,f),d+=v[u-1].pxWidth;for(d=0,u=1;y>=u;u++)n=new HtmlStyles,n.add("position","sticky"),n.add("right",pixelsToHtml(d)),u==y&&C.ShowColLine&&n.add("border-left",penStyleText(C.ColLinePen)),a.addCustomStyle(n,grconst.CSS_DG_F+" td:"+tagCSSChildR(u)),d+=v[S-u].pxWidth;e(T,1),e(y,0)}var r,o=b.TitleCells;for(u=0;T>u;u++)v[u].ContentCell.fixed=1;for(u=S-y;S>u;u++)v[u].ContentCell.fixed=1;x>1?t():e()}function t(){for(var e,t,r,o,i,s,c,u,f,p,h=C.Groups,g=h.Count,m=C.rows,b=m.length,x=S-1,F=x-y,w=v[x],D=w.pxLeft+w.pxWidth,P=1;g>=P;){if(e=h.Item(P++),!e.PageGroup&&(t=e.Footer,t.pxHeight&&t.Visible)){e.ByFields&&(t=0);break}t=0}if(t&&!t.tableCols&&(r=t.tableRows))for(m[b-1].tfoot=1,d=0,u=r.length,P=u-1;P>=0;){if(o=r[P--],f=P+2,n=new HtmlStyles,n.add("position","sticky"),n.add("bottom",pixelsToHtml(d)),1==f&&C.ShowRowLine&&n.add("border-top",penStyleText(C.RowLinePen)),f==u&&C.ShowRowLine&&n.add("border-bottom",penStyleText(C.RowLinePen)),a.addCustomStyle(n,grconst.CSS_DG_F+" tfoot tr"+(u>1?":"+tagCSSChild(f):"")+" td"),d+=o.pxHeight,i=o.cells,c=i.length,i.forEach(function(e){e.control&&(e=e.control),e.fixed=1}),T)for(p=0;c>p&&(s=i[p++],!(s.endCol>T));)l=v[s.beginCol],n=new HtmlStyles,n.add("position","sticky"),n.add("z-index","3"),n.add("left",pixelsToHtml(l.pxLeft)),a.addCustomStyle(n,grconst.CSS_DG_F+" tfoot tr"+(u>1?":"+tagCSSChild(f):"")+" td:"+tagCSSChild(p));if(y)for(p=0;y>p&&(s=i[c-1-p++],!(s.beginCol<F));)l=v[s.beginCol],n=new HtmlStyles,n.add("position","sticky"),n.add("z-index","3"),n.add("right",pixelsToHtml(D-l.pxRight)),a.addCustomStyle(n,grconst.CSS_DG_F+" tfoot tr"+(u>1?":"+tagCSSChild(f):"")+" td:"+tagCSSChildR(p))}}var n,l,u,d,f,p,h=a.holder,g=h.clientWidth,m=h.clientHeight,C=r,b=C.ColumnTitle,x=b.layerCount,v=C.showingColumns,S=v.length,T=Math.min(i.fixedColsLeft,S-1),y=Math.min(i.fixedColsRight,S-1-T);if(!g){for(f=h;!g&&(f=f.parentElement);)g=f.clientWidth;m||(g=document.body.clientWidth,f=window.offsetLeft,f>0&&window.innerWidth<=g+3*f&&(g-=2*f))}if(!m){for(f=h;!m&&(f=f.parentElement,f&&f.parentElement);)m=f.clientHeight;m||(m=window.innerHeight,m-=18)}for(m-=calcSectionsPixelTotalHeight(s),m-=calcSectionsPixelTotalHeight(c),n=new HtmlStyles,n.add("overflow","auto"),n.addBorder(C.Border),n.add("width",pixelsToHtml(g)),n.add("height",pixelsToHtml(m)),o=a.addCustomStyle(n),a.dgDivClass=o,d=0,u=1;x>=u;++u)n=new HtmlStyles,n.add("position","sticky"),n.add("top",pixelsToHtml(d)),a.addCustomStyle(n,grconst.CSS_DG_F+" thead tr"+(x>1?":"+tagCSSChild(u):"")+" th"),d+=b.pxHeight;(T>0||y>0)&&e(),a.options.fixedFooter&&t()}var r,o,n,i=this,a=i.viewer,l=i.fixed,s=i.ReportHeaders,c=i.ReportFooters;i.fireInitialize(),!i.ownerSR&&i.matchTables(),i.DetailGrid&&i.fireFetchRecord(),i.fireProcessBegin(),!i.ownerSR&&i.prepare(),i.singleChart?i.singleChart.generateContent(e):(r=i.RunningDetailGrid,i.reportFitHeight&&calcSectionsHeightPercent(s.items.concat(c.items)),r&&(r.index=a._detailgrids.length,r.buildRows(i)),l?(t(),s.Count&&(n=new HtmlElement("div",e),s.generate(n)),n=new HtmlElement("div",e),n.addClass(a._getCSSName(o)),r.generate(n),c.Count&&(n=new HtmlElement("div",e),c.generate(n))):(s.generate(e),r&&r.generate(e),c.generate(e))),!r&&i.fireProcessEnd()},matchTables:function(){function e(e,t){function r(e){function t(e,t){var r=this;r.isRecordset=e,r.tableName=t.XmlTableName,r.object=t}var o,n,i;if(e)for(v.push(new t(!1,e)),e.DetailGrid&&v.push(new t(!0,e.DetailGrid.Recordset)),n=e.FindFirstControl();n;)i=n.ControlType,11===i?(o=n.Recordset,o.Fields.Count>0&&v.push(new t(!0,o))):9===i&&r(n.Report),n=e.FindNextControl()}function o(e,t,r){function o(e,t){var r,o=e.length,n=0;for(r=0;o>r;r++)t.indexOf(e[r])>=0&&n++;return 100*n/o}var n=t.recordCount,i=t.fieldNames,a=0;if(e.length&&t.fieldNames.length){if(a=o(e,i),!a)return 0;100===a&&e.length===i.length?a=200:a+=o(i,e),a+=r&&n>1||!r&&1===n?5:-5}return a}function n(e){return e>=200}function i(e){var t,r,o,n=[];for(t=e.Parameters.items.length;t--;)n.push(e.Parameters.items[t].Name.toUpperCase());for(r=e.FindFirstControl();r;)o=r.ControlType,1===o||8===o||7===o||12===o?n.push(r.Name.toUpperCase()):13===o&&r.cells.forEach(function(e){e.forEach(function(e){e.DataName&&n.push(e.DataName.toUpperCase())})}),r=e.FindNextControl();return n}function a(e,t){for(var r,o,n=0,i=e.length;i>n;)o=e[n++],(!r||o.weight>r.weight)&&o.dataTableInfo.matchWeight<50&&(r=o);r&&l(r.weight,t,r.dataTableInfo)}function l(e,t,r){r.matchWeight<e&&(r.matchWeight=e,r.reportTableInfo=t)}var s,c,u,d,f,p,h,g,m,C,b,x,v=[];for(r(e),u=v.length,d=t.length,s=0;u>s;++s){if(f=v[s],h=f.tableName){for(c=0;d>c&&t[c].tableName!=h;)++c;if(d>c){t[c].turnToFullMatched(f);continue}f.tableName=""}if(f.isRecordset){for(b=f.object.Fields.items,x=[],c=0,d=b.length;d>c;)x.push(b[c++].RunningDBField.toUpperCase());for(m=[],d=t.length,c=0;d>c;)if(g=t[c++],!g.isFullMatched()){if(C=o(x,g,!0),n(C)){l(C,f,g),m=[];break}C>0&&m.push({dataTableInfo:g,weight:C})}m.length&&a(m,f)}}if(t.some(function(e){return!e.isMatched()}))for(u=v.length,s=0;u>s;++s)if(f=v[s],!f.isRecordset&&!f.tableName){for(x=i(f.object),m=[],d=t.length,c=0;d>c;)if(g=t[c++],!g.isFullMatched()){if(C=o(x,g,!1),n(C)){l(C,f,g),m=[];break}p=g.reportTableInfo,C>0&&(!p||p.isRecordset&&p.weight+50<C||!p.isRecordset&&p.weight<C)&&m.push({dataTableInfo:g,weight:C})}m.length&&a(m,f)}for(u=t.length,s=0;u>s;)g=t[s++],f=g.reportTableInfo,f&&f.object.attachDataTable(g.table)}var t=this,r=t.viewer.tables,o=[],n=function(e,t){var r,o=this,n=o.fieldNames=[],i=Math.min(t.length,50);for(o.tableName=e,o.table=t,o.matchWeight=0;i--;){r=t[i];for(var a in r)a=a.toUpperCase(),n.indexOf(a)<0&&n.push(a)}};n.prototype={isFullMatched:function(){return this.matchWeight>=200},turnToFullMatched:function(e){var t=this;t.matchWeight=200,t.reportTableInfo=e},isMatched:function(){return this.matchWeight>=40},get recordCount(){return this.table.length}};for(var i in r){var a=r[i];a&&a instanceof Array&&o.push(new n(i,a))}1===o.length&&o[0].recordCount>1&&t.DetailGrid?t.DetailGrid.Recordset.attachDataTable(o[0].table):e(t,o)},attachDataTable:function(e){var t,r,o=this,n=e[0];for(var i in n)t=n[i],r=o.ParameterByName(i),r?r.setValue(t):(r=o.ControlByName(i),r&&(r.hasOwnProperty("Text")||7===r.ControlType)&&(r.Text=t+""))},prepare:function(){var e=this,t=e.Printer,r=e.ReportHeaders,o=e.ReportFooters;e._scriptFailed=0,e.designWidth=e.size2Pixel((1===t.DesignPaperOrientation?t.DesignPaperWidth:t.DesignPaperLength)-t.DesignPaperLeftMargin-t.DesignPaperRightMargin),e.DetailGrid&&e.DetailGrid.attachData(),r.attachData(),o.attachData(),e.Parameters.prepare(),e.DetailGrid&&e.DetailGrid.prepare(),r.prepare(),o.prepare(),e._srChildren&&e._srChildren.forEach(function(e){e.Report.prepare()}),e.ownerSR||!e.viewer.options.singleChartFill||e.DetailGrid||r.Count+o.Count!==1||1!==(r.items[0]||o.items[0]).Controls.Count||(e.singleChart=(r.items[0]||o.items[0]).Controls.items[0],11!==e.singleChart.ControlType&&delete e.singleChart)},unprepare:function(){var e=this;e.Parameters.unprepare(),e.DetailGrid&&(e.DetailGrid.unprepare(),e.RunningDetailGrid=e.DetailGrid),e.ReportHeaders.unprepare(),e.ReportFooters.unprepare(),delete e._rsns,delete e._srChildren,delete e._has_cb,delete e.singleChart,delete e.canvasControls},allControls:function(e,t){function r(t){t.FreeCell?u=u.concat(t.Controls.items):e&&u.push(t)}function o(e){e.forEach(function(e){r(e),e.GroupTitle&&o(e.SubTitles)})}function n(){var e=[];return u.forEach(function(t){var r=t.AsFreeGrid;r&&r.cells.forEach(function(t){t&&t.forEach(function(t){t.FreeCell&&(e=e.concat(t.Controls.items))})})}),e}var i,a,l,s=this,c=s.DetailGrid,u=[];for(a=s.ReportHeaders.Count,i=0;a>i;i++)u=u.concat(s.ReportHeaders.items[i].Controls.items);for(a=s.ReportFooters.Count,i=0;a>i;i++)u=u.concat(s.ReportFooters.items[i].Controls.items);if(c){for(t&&s.RunningDetailGrid&&(c=s.RunningDetailGrid),a=c.Groups.Count,i=0;a>i;i++)l=c.Groups.items[i],u=u.concat(l.Header.Controls.items),u=u.concat(l.Footer.Controls.items);c.ColumnContent.ContentCells.forEach(function(e){r(e)}),o(c.ColumnTitle.TitleCells)}return u=u.concat(n())},getUsingFont:function(){return this.Font.font},getRunningColumn:function(e){var t,r,o=this.RunningDetailGrid;return e&&o&&(t=o.Columns,r=t.itemByName(e),r||("(GridLeft)"===e?r=t.Item(1):"(GridRight)"===e&&(r=t.Item(t.Count)))),r},getReportWidth:function(){var e=this,t=e.designWidth,r=this.RunningDetailGrid,o=r?r.width:0;return 2*o>t?o:t},get reportFitHeight(){var e=this;return!e.RunningDetailGrid&&e.viewer.options.reportFitHeight},get reportFitWidth(){var e=this.viewer.options;return e.reportFitWidth||e.fixed},get detailgridResize(){return this.viewer.options.detailgridResize},get fixed(){var e=this;return e.DetailGrid&&e.viewer.options.fixed},get fixedColsLeft(){var e=this,t=e.DetailGrid,r=e.viewer.options.fixedColsLeft;return t&&0==r?t.FixCols:r},get fixedColsRight(){var e=this,t=e.DetailGrid,r=t?t.CrossTab:undefined,o=e.viewer.options.fixedColsRight;return r&&0==o?r.TotalCols:o},get controlPosition(){var e=this;return e.fixed?gr.enum_.controlLayout.table:e.viewer.controlPosition},get toFillHolder(){var e=this;return e.reportFitHeight||e.singleChart},get isDynamicSize(){var e=this;return e.toFillHolder||e.reportFitWidth||e.detailgridResize},pixel2Size:function(e){return e/=96,1===this.Unit&&(e*=2.54),e},size2Pixel:function(e){return 1===this.Unit&&(e/=2.54),96*e},cm2Size:function(e){return 1===this.Unit?e:e/2.54},controlDynamicSize:function(e){return this.isDynamicSize&&e.AsChart},registerCanvas:function(e,t){var r=this,o=new HtmlElement("canvas",t),n=uidCanvas();o.addAttribute("id",n),r.controlDynamicSize(e)||!e.pxRect?(o.addStyle("width","100%"),o.addStyle("height","100%"),o.addStyle("display","block")):(o.addAttribute("width",Math.round(e.pxRect.Width())+""),o.addAttribute("height",Math.round(e.pxRect.Height())+"")),e.canvasID=n,r.canvasControls||(r.canvasControls=[]),r.canvasControls.push(e)},prepareCanvas:function(){for(var e,t=this,r=t.canvasControls,o=r.length;o-- >0;)e=r[o],e.canvas=document.getElementById(e.canvasID),e.prepareCanvas&&e.prepareCanvas()},resizeCanvas:function(){for(var e=this,t=e.canvasControls,r=t.length;r-- >0;)t[r].resizeCanvas()},renderCanvas:function(){for(var e=this,t=e.canvasControls,r=t.length;r-- >0;)t[r].drawCanvas(1)},startCanvas:function(){var e=this;e.canvasControls&&(e.prepareCanvas(),e.isDynamicSize?(addEvent(window,"resize",function(t){e.resizeCanvas()}),e.resizeCanvas()):e.renderCanvas()),e._srChildren&&e._srChildren.forEach(function(e){e.Report.startCanvas()})},executeEventScript:function(scriptText,scriptName,Sender){function prepareScript(){function addFun(e,t,r){var o;r&&(o="f"+no++,code+="_rsns."+o+"=function(Sender){\n"+r+"\n}\n",e[script.nameMember(t)]=o)}function addRecordset(e){addFun(e,script.names.BeforePostRecord,e.BeforePostRecordScript),addFun(e,script.names.FetchRecord,e.FetchRecordScript),addFun(e,script.names.PageProcessRecord,e.PageProcessRecordScript),addFun(e,script.names.ProcessRecord,e.ProcessRecordScript),e.Fields.items.forEach(function(e){addFun(e,script.names.FieldGetDisplayText,e.GetDisplayTextScript)})}function addSection(e){addFun(e,script.names.Format,e.FormatScript)}var detailGridRunning=self.RunningDetailGrid,detailGrid=detailGridRunning?detailGridRunning:self.DetailGrid,no=1,code="(function(Report) {\nvar _rsns=Report._rsns={};\n";code+=self.GlobalScript+"\n",addFun(self,script.names.Initialize,self.InitializeScript),addFun(self,script.names.ProcessBegin,self.ProcessBeginScript),addFun(self,script.names.ProcessEnd,self.ProcessEndScript),addFun(self,script.names.BeforeSort,self.BeforeSortScript),self.allControls(1,1).forEach(function(e){var t;addFun(e,script.names.CustomDraw,e.CustomDrawScript),e.AsTextBox?addFun(e,script.names.TextBoxGetDisplayText,e.GetDisplayTextScript):e.AsChart&&(addRecordset(e.Recordset),t=e._clones,t&&t.forEach(function(e){addRecordset(e.Recordset)}))}),self.ReportHeaders.items.concat(self.ReportFooters.items).forEach(function(e){addSection(e)}),detailGrid&&(addSection(detailGrid.ColumnTitle),addSection(detailGrid.ColumnContent),addRecordset(detailGrid.Recordset),detailGrid.Groups.forEach(function(e){addFun(e,script.names.GroupBegin,e.GroupBeginScript),addFun(e,script.names.GroupEnd,e.GroupEndScript),addSection(e.Header),addSection(e.Footer)})),code+="})(self);",eval(code)}var self=this,detailgrid=self.DetailGrid,x;!self._rsns&&prepareScript(),detailgrid&&detailgrid.IsCrossTab&&!self.rsRedo&&(x=Sender[script.nameMember(scriptName)],x||(delete self._rsns,prepareScript(),self.rsRedo=1)),script.execEvent(self,Sender,scriptName)},fireInitialize:function(){var e=this,t=e.InitializeScript;t&&e.executeEventScript(t,script.names.Initialize,e),e.OnInitialize&&e.OnInitialize()},fireFetchRecord:function(){var e=this,t=e.FetchRecordScript;t&&e.executeEventScript(t,script.names.FetchRecord,e.DetailGrid.Recordset),e.OnFetchRecord&&e.OnFetchRecord()},fireBeforePostRecord:function(){var e=this;e.OnBeforePostRecord&&e.OnBeforePostRecord()},fireBeforeSort:function(e,t){var r=this,o=r.BeforeSortScrip;o&&r.executeEventScript(o,script.names.BeforeSort,t),r.OnBeforeSort&&t.isDetailGridRecordset()&&r.OnBeforeSort()},fireProcessBegin:function(){var e=this,t=e.ProcessBeginScript;t&&e.executeEventScript(t,script.names.ProcessBegin,e),e.OnProcessBegin&&e.OnProcessBegin()},fireProcessEnd:function(){var e=this,t=e.ProcessEndScript;t&&e.executeEventScript(t,script.names.ProcessEnd,e),e.OnProcessEnd&&e.OnProcessEnd()},fireProcessRecord:function(e){var t=this,r=e.ProcessRecordScript;r&&t.executeEventScript(r,script.names.ProcessRecord,e),t.OnProcessRecord&&t.OnProcessRecord()},fireGroupBegin:function(e){var t=this,r=e.GroupBeginScript;r&&t.executeEventScript(r,script.names.GroupBegin,e),t.OnGroupBegin&&t.OnGroupBegin(e)},fireGroupEnd:function(e){var t=this,r=e.GroupEndScript;r&&t.executeEventScript(r,script.names.GroupEnd,e),t.OnGroupEnd&&t.OnGroupEnd(e)},fireSectionFormat:function(e){var t=this,r=e.FormatScript;r&&t.executeEventScript(r,script.names.Format,e),t.OnSectionFormat&&t.OnSectionFormat(e)},fireFieldGetDisplayText:function(e){var t=this,r=e.GetDisplayTextScript;r&&t.executeEventScript(r,script.names.FieldGetDisplayText,e),t.OnFieldGetDisplayText&&t.DetailGrid&&t.RunningDetailGrid.Recordset===e.owner&&t.OnFieldGetDisplayText(e)},fireTextBoxGetDisplayText:function(e){var t=this,r=e.GetDisplayTextScript;r&&t.executeEventScript(r,script.names.TextBoxGetDisplayText,e),t.OnTextBoxGetDisplayText&&t.OnTextBoxGetDisplayText(e)},fireControlCustomDraw:function(e){var t=this,r=e.CustomDrawScript;context=t.Graphics,fontWrapper=e.Font,font=fontWrapper?fontWrapper.UsingFont():0,context=new Context(e.canvas.getContext("2d")),!context&&(context=t.Graphics=new Graphics(t)),context.attach(context),font&&context.selectFont(font),r&&t.executeEventScript(r,script.names.CustomDraw,e),t.OnControlCustomDraw&&t.OnControlCustomDraw(e,context),font&&context.restoreFont()},fireChartRequestData:function(e){var t=this;t.OnChartRequestData&&t.OnChartRequestData(e)},onCheckBoxClick:function(e){var t,r,o,n,i,a,l,s,c,u,d=this,f=d.DetailGrid,p=f.Recordset,h=e.target,g=h.id,m=h.checked,C=m?-1:-2,b=h.parentNode.parentNode;if(f&&(t=f.syncTRData(b),i=h.getAttribute(grconst.ATTR_FIELD),i?(p.Edit(),p.FieldByName(i).AsInteger=C,p.Post()):(s=d.report.ControlByName(g),s&&(s.ImageIndex=C)),r=t.group))for(o=r.beginNoField.AsInteger,n=r.endNoField.AsInteger,l=document.querySelectorAll("."+grconst.CSS_CB),a=l.length;a-- >0;)s=l[a],g=s.id,c="CBC"===g.substr(0,3),c&&(u=+g.substr(3),u>=o&&n>=u&&(s.checked=m,i=s.getAttribute(grconst.ATTR_FIELD),i&&(p.moveTo(u),p.Edit(),p.FieldByName(i).AsInteger=C,p.Post())))},get root(){for(var e=this;e.ownerSR;)e=e.ownerSR.report;return e},get Version(){return grconst.VERSION},get FloatControls(){var e=this;return e._floatControls||(e._floatControls=new Controls(e)),e._floatControls},get ImageList(){var e=this;return e._imageList||(e._imageList=new ImageList),e._imageList},get ParentReport(){var e=this.ownerSR;return e?e.report:undefined},get Utility(){return gr.Utility},get Running(){return!!this.viewer.running},get DisplayMode(){return 1},get IsBlank(){var e=this;return e.DetailGrid&&e.PageHeader&&e.PageFooter&&!e.ReportHeaders.Count&&!e.ReportFooters.Count},ControlByName:function(e){function t(r){function o(r){function o(r){return r.FreeCell?t(r.Controls):r.DataName.toUpperCase()===e?r:undefined}for(var n,i,a,l,s=r.length;s--;)if(a=r[s])for(n=a.length;n--;)if(l=a[n],i=l?o(l):0)return i;return undefined}for(var n,i=r.items,a=i.length;a--;){if(n=i[a],n.Name.toUpperCase()===e)return n;if(13===n.ControlType&&(n=o(n.cells)))return n}return undefined}function r(e){return e.FreeCell?t(e.Controls):undefined}function o(e){for(var t,n,i=e.items.length;i--;)if(t=e.items[i],n=r(t),t.GroupTitle&&!n&&(n=o(t.SubTitles)),n)return n;return undefined}function n(e){for(var r=e.length;r--;)if(s=t(e[r].Controls))return s}var i,a,l,s,c=this;if(e=e.toUpperCase(),s=n(c.ReportHeaders.items)||n(c.ReportFooters.items))return s;if(c.DetailGrid){for(i=c.DetailGrid.Groups.items,a=i.length;a--;)if(l=i[a],s=t(l.Header.Controls)||t(l.Footer.Controls))return s;for(i=c.DetailGrid.ColumnContent.ContentCells.items,a=i.length;a--;)if(s=r(i[a]))return s;return o(c.DetailGrid.ColumnTitle.TitleCells)}return undefined},ColumnByName:function(e){var t=this;return t.DetailGrid?t.DetailGrid.Columns.itemByName(e):undefined},FieldByName:function(e){return this.RunningFieldByName(e)},FieldByDBName:function(e){var t=this.RunningDetailGrid;return t?t.Recordset.FieldByDBName(e):undefined},ParameterByName:function(e){return this.Parameters.itemByName(e)},FindFirstControl:function(){var e=this,t=e.allControls();return t.length>0&&(e.findControls=t,e.findControlIndex=-1),e.FindNextControl()},FindNextControl:function(){var e=this;return e.findControls&&(++e.findControlIndex,e.findControlIndex>=e.findControls.length&&(delete e.findControls,delete e.findControlIndex)),e.findControls?e.findControls[e.findControlIndex]:undefined},RunningFieldByName:function(e){var t=this.RunningDetailGrid;return t?t.Recordset.FieldByName(e):undefined},PixelsToUnit:function(e){return this.pixel2Size(e)},UnitToPixels:function(e){return this.size2Pixel(e)},SystemVarValue:function(e){return this.SystemVarValue2(e,0)},SystemVarValue2:function(e,t){var r,o,n,i=this,a=i.RunningDetailGrid;if(1===e)r=new Date;else if(a)switch(o=a.Recordset,e){case 4:r=o.RecordNo+1;break;case 19:r=o.RecordCount;break;case 8:r=a.generatingRowNo;break;default:n=a.Groups.items[t-1],n&&(21===e?r=n.recordset.RecordCount:(n.inphaseByDetail(o.RecordNo),r=20===e?n.recordset.isAppendingRecord()?n.recordset.RecordCount:n.recordset.RecordNo:22===e?o.RecordNo-n.beginNoField.Value:n.endNoField.Value-n.beginNoField.Value,r++))}return r},AddParameter:function(e,t){var r=this.Parameters.Add();return r.Name=e,r.DataType=t,r},Clear:function(){var e=this;Report.call(e,e.viewer,e.ownerSR),e.DeleteDetailGrid()},InsertDetailGrid:function(){var e=this;return e.DetailGrid||(e.DetailGrid=new DetailGrid(e),e.RunningDetailGrid=e.DetailGrid),e.DetailGrid},InsertPageHeader:function(){},InsertPageFooter:function(){},DeleteDetailGrid:function(){var e=this;e.DetailGrid=undefined,e.RunningDetailGrid=undefined},DeletePageHeader:function(){},DeletePageFooter:function(){},CancelLoadData:function(){},PrepareLoadData:function(){return 1}};var csz_HTotal_Suffix="",csz_HAverage_Suffix="_hta",csz_HAverageA_Suffix="_htaa",csz_HCount_Suffix="_htc",csz_HCountA_Suffix="_htca",csz_HMin_Suffix="_htn",csz_HMax_Suffix="_htx",csz_HPercent_Suffix="_hp",csz_VPercent_Suffix="_vp",csz_HTotalPercent_Suffix="_htp",csz_VTotalPercent_Suffix="_vtp",HSummaryFlag=function(){this.Flag=0};HSummaryFlag.prototype={get CalcHTotal(){return 1&this.Flag},set CalcHTotal(e){var t=this;e?t.Flag|=1:t.Flag&=-2},get CalcHAverage(){return 2&this.Flag},set CalcHAverage(e){var t=this;e?t.Flag|=2:t.Flag&=-3},get CalcHAverageA(){return 4&this.Flag},set CalcHAverageA(e){var t=this;e?t.Flag|=4:t.Flag&=-5},get CalcHCount(){return 8&this.Flag},set CalcHCount(e){var t=this;e?t.Flag|=8:t.Flag&=-9},get CalcHCountA(){return 16&this.Flag},set CalcHCountA(e){var t=this;e?t.Flag|=16:t.Flag&=-17},get CalcHMin(){return 32&this.Flag},set CalcHMin(e){var t=this;e?t.Flag|=32:t.Flag&=-33},get CalcHMax(){return 64&self.Flag},set CalcHMax(e){var t=this;e?t.Flag|=64:t.Flag&=-65},onBySummaryFun:function(e){var t=this;t.CalcHTotal=!0,2===e?t.CalcHAverage=!0:15===e?t.CalcHAverageA=!0:3===e?t.CalcHCount=!0:13===e?t.CalcHCountA=!0:4===e?t.CalcHMin=!0:5===e&&(t.CalcHMax=!0)}};var DataFieldInfo=function(e){var t=this;t.originObject=undefined,t.HTotalFlag=new HSummaryFlag,t.HSubtotalFlag=new HSummaryFlag,t.MiscFlag=0,t.DatafieldIndex=-1,t.TotalValue=0,t.EntireTotalValue=0,e&&assignObjectEx(t,e,0)};DataFieldInfo.prototype={CopyAddField:function(e,t){var r=this,o=e.Fields.Add();return r.originObject.FieldType?(o.assign(r.originObject),r.originObject.isNumeric()&&(o.FieldType=3)):r.NumericField&&(o.FieldType=3,o.Format=r.originObject.textBuilder.items[0].format),o.Name=t,o.DBFieldName="",o._tableMember=t,o},CombineCalcFlag:function(e){var t=this;t.HTotalFlag.Flag|=e.HTotalFlag.Flag,t.HSubtotalFlag.Flag|=e.HSubtotalFlag.Flag,t.MiscFlag|=e.MiscFlag},SetFlagBySummaryFun:function(e,t){var r=this;3===t?r.HSubtotalFlag.onBySummaryFun(e):r.HTotalFlag.onBySummaryFun(e)},get CalcHPercent(){return 1&this.MiscFlag},set CalcHPercent(e){var t=this;e?t.MiscFlag|=1:t.MiscFlag&=-2},get CalcVPercent(){return 2&this.MiscFlag},set CalcVPercent(e){var t=this;e?t.MiscFlag|=2:t.MiscFlag&=-3},get CalcTotalHPercent(){return 4&this.MiscFlag},set CalcTotalHPercent(e){var t=this;e?t.MiscFlag|=4:t.MiscFlag&=-5},get CalcTotalVPercent(){return 8&this.MiscFlag},set CalcTotalVPercent(e){var t=this;e?t.MiscFlag|=8:t.MiscFlag&=-9},get CalcHTotalExclude(){return 16&this.MiscFlag},set CalcHTotalExclude(e){var t=this;e?t.MiscFlag|=16:t.MiscFlag&=-17},get NumericField(){return 32&this.MiscFlag},set NumericField(e){var t=this;e?t.MiscFlag|=32:t.MiscFlag&=-33}};var HPercentSum=function(e,t){var r=this;r.Group=e,r.DataFieldInfo=t,r.DataSumBoxes=[]},DynamicTitleCellInfo=function(e){var t=this;t.PriorCrossTitleCell=undefined,t.OriginTextBox=e,t.PriorTitleText=""},CrossTab=function(e){var t=this;Object.call(t,e),t.HCrossFields="",t.VCrossFields="",t.ListCols=1,t.TotalCols=0,t.SubtotalCols=0,t.HResort=!0,t.HSortAsc=!0,t.VResort=!0,t.VSortAsc=!0,t.HTotalAtFirst=!1,t.HPercentColumns="",t.VPercentColumns="",t.TotalExcludeColumns="",t.TotalHPercentColumns="",t.TotalVPercentColumns="",t.DisabledSumFields="",t.PercentFormat="0.##%",t.HCrossPeriodType=0,t.BeginDateParameter="",t.EndDateParameter="",t.GroupAutoSum=!0};CrossTab.prototype={loadFromJSON:function(e){var t=this;e&&(Object.prototype.loadFromJSON.call(t,e),enumMemberValid(t,"HCrossPeriodType",grenum.PeriodType))},prepare:function(){function e(){var e=l.ParameterByName(a.BeginDateParameter),t=l.ParameterByName(a.EndDateParameter),r={};return e&&(r.begin=e.AsDateTime),t?(r.end=t.AsDateTime,e||(r.begin=cloneDate(r.end))):r.end=cloneDate(r.begin),r.end<r.begin&&(e=r.begin,r.begin=r.end,r.end=e),r}function t(){function t(){function e(e){var t=e.orderNo;return X>t?1:Z>t?2:q>t?3:4}function t(t,r){function o(e){se.indexOf(e.originObject)<0&&(S.some(function(t){return t.originObject!==e.originObject?!1:(t.CombineCalcFlag(e),!0)})||(e.NumericField=e.originObject.isNumeric(),S.push(e)))}function n(e,t){e?e.varItems.forEach(function(e){var r=e.varField;1===r.type&&(t.originObject=r.object,o(t))}):(t.originObject=S[0].originObject,o(t))}var i,a=new DataFieldInfo,l=e(r),s=1!==l,c=t.ControlType;4===l?(a.HTotalFlag.CalcHTotal=1,le.indexOf(r)>=0&&(a.CalcHTotalExclude=1),ie.indexOf(r)>=0&&(a.CalcTotalHPercent=1),ae.indexOf(r)>=0&&(a.CalcTotalVPercent=1)):3===l?a.HSubtotalFlag.CalcHTotal=1:2===l&&(oe.indexOf(r)>=0&&(a.CalcHPercent=1),ne.indexOf(r)>=0&&(a.CalcVPercent=1),a.CalcHPercent&&(a.HTotalFlag.CalcHTotal=1)),4===c||7===c?s&&(a.originObject=t.oDataField,a.originObject&&o(a)):5===c?(a.SetFlagBySummaryFun(t.SummaryFun,l),n(t.paramExp,a)):12===c?s&&(a.originObject=t,S.push(a)):8===c&&(i=!1,t.textBuilder.forEach(function(e){e.varItems&&e.varItems.forEach(function(e){var t,r=e.varField;4===r.type?(t=new DataFieldInfo(a),t.SetFlagBySummaryFun(r.SummaryFun,l),n(r.paramExp,t),i=!0):1===r.type&&s&&(t=new DataFieldInfo(a),t.originObject=r.object,o(t))}),!i&&s&&(a.originObject=t,a.NumericField=t.isPureNumericExpression(),S.push(a))}))}function r(e){e.forEach(function(e){e.GroupTitle?r(e.SubTitles.items):e.Column.ContentCell.getControls().forEach(function(r){t(r,e.Column)})})}function o(r){r.Controls.forEach(function(r){var o=g.itemByName(r.AlignColumn)||g.itemByName(r.AlignColumnEx);o&&1!==e(o)&&t(r,o)})}r(C),m.forEach(function(e){o(e.Footer),o(e.Header)}),i=0,S.forEach(function(e){e.DatafieldIndex=i,++i,e.CalcHPercent&&++i,e.CalcVPercent&&++i})}function r(){S.forEach(function(e){e.originObject.FieldType&&u.Fields.Remove(e.originObject.Name)})}function P(e){var t=u.Fields.Add();return t.Name=e,t.FieldType=3,t}function R(){function e(e){e.Controls.items=e.Controls.items.filter(function(e){var t=f.itemByName(e.AlignColumn)||f.itemByName(e.AlignColumnEx);return!t||t.orderNo<a.ListCols})}c.buildColumnsOrder(),n.forEach(function(t){e(t.Footer),e(t.Header)})}function A(e,t,r,o,i,h,g){function C(e,t){var r,o;e.FreeCell?(t.setFreeCell(!0),assignObjectAtom(t,e),e.Controls.forEach(function(e){function n(){return 2===a.HCrossPeriodType||3===a.HCrossPeriodType||4===a.HCrossPeriodType||6===a.HCrossPeriodType||7===a.HCrossPeriodType}function i(){function e(e){var t=new DateTime;return t.value=e,Math.floor(t.AsFloat)}var t,r=a.curPeriod.begin.getFullYear(),o=a.curPeriod.begin.getMonth()+1,n=a.curPeriod.begin.getDate();switch(a.HCrossPeriodType){case 2:t="第"+Math.floor((e(a.curPeriod.begin)-e(z.begin))/7+1)+"周";break;case 3:t=11>n?"上":21>n?"中":"下",t=o+"月"+t+"旬";break;case 4:t=16>n?"上":"下",t=o+"月"+t+"半月";break;case 6:t=intFixed(r,2)+"-"+(o+2)/3+"季度";break;case 7:t=7>o?"上":"下",t=intFixed(r,"00")+"-"+t+"半年"}return t}var s,c;r=e.ControlType,e.TextFormat?(o=t.Controls.Add(1),o.assign(e),s=n()&&4===r&&e.DataField===a.HCrossFields?i():e.getDisplayText(),o.Text=s):(o=t.Controls.Add(r),o.assign(e),7===r?e.DataField&&(o.DataField="",c=l.FieldByName(e.DataField),c&&(7===c.FieldType?o.Picture=c.Value:(s=c.DisplayText,o.ImageIndex=parseInt(s),isNaN(o.ImageIndex)&&(o.ImageIndex=0,o.ImageFile=s)))):12===r&&(o.Text=e.get_DisplayText()));
})):(t.assign(e),t.Text=e.getDisplayText())}function b(){var n,a,l,s=0;2===r?(n=ce[g-Q],a=n?n[i]:0,s=a&&a.PriorCrossTitleCell&&a.PriorTitleText===a.OriginTextBox.getDisplayText()&&!h):3===r?(s=K==$,a=ce[ce.length-1],a=i<a.length?a[i]:undefined,s?s=a&&!!a.PriorCrossTitleCell:0==i&&(l=e.Controls,s=l&&1===l.Count&&l.Item(1).getDisplayText&&l.Item(1).getDisplayText()===a.PriorTitleText)):4===r&&(a=ce[ce.length-1][i],s=ee==re,s&&(s=!!a.PriorCrossTitleCell)),s?t=a.PriorCrossTitleCell:(t=(t?t.SubTitles:d).AddGroup("",""),C(e,t),t.Name=y,a&&(a.PriorCrossTitleCell=t,a.PriorTitleText=a.OriginTextBox.getDisplayText())),e.SubTitles.forEach(function(e){A(e,t,r,o,i+1,!s,g)})}function x(){function o(e){var t;return S.some(function(r){return r.originObject.Name!==e?!1:(t=r,!0)}),t}function i(e,t){var r;return a.HPercentSums.some(function(o){return o.Group!==e||o.DataFieldInfo!==t?!1:(r=o,!0)}),r}function d(e,t){var o,n=CrossSummaryGetFieldSuffix(e);return 4===r||1===r?n?(t+=csz_HTotal_Suffix+n,o=t):G.CalcHPercent?(o=t+csz_HTotal_Suffix,t+=csz_HTotalPercent_Suffix):G.CalcVPercent?(t+=csz_VTotalPercent_Suffix,o=t):(t+=csz_HTotal_Suffix,o=t):3===r?(t+=T+n,o=t):(t+=T,o=t,G.CalcHPercent?t+=csz_HPercent_Suffix:G.CalcVPercent&&(t+=csz_VPercent_Suffix,o=t)),o=ensureNameText(o),{DataField:t,SummaryDataField:o}}function h(e,t){var r,o=0,n="";return e.varItems.forEach(function(i){o<i.beginIndex&&(n+=e.expText.substring(o,i.beginIndex)),1===i.varField.type?(r=d(t,i.varField.object.Name),n+=r.SummaryDataField):n+=i.varField.getExpText(),o=i.endIndex}),n+=e.expText.substr(o)}function g(e,t){return e="[#"+e,t&&(e+=":"+t),e+="#]"}function b(e,t){var r,o=0,n="";return e.varItems.forEach(function(i){var a=i.varField,l=a.type;o<i.beginIndex&&(n+=e.expText.substring(o,i.beginIndex)),4===l?(r=h(a.paramExp,a.SummaryFun),n+=t?enumValue2Name(grenum.SummaryFun,a.SummaryFun)+"("+r+(a.RankNo?","+a.RankNo:"")+")":r):n+=a.getExpText(),o=i.endIndex}),n+=e.expText.substr(o)}function x(){n.forEach(function(e,t){function r(e,t){t.isToGenerate()&&e.Controls.forEach(function(e){var r,o,n,i=e.ControlType,a=e.AlignColumn||e.AlignColumnEx;a===B.Name&&(r=t.Controls.Add(i),r.assign(e),r.AlignColumn=F.Name,r.AlignColumnEx="",5===i?e.DataField&&(r.DataField=h(e.paramExp,e.SummaryFun),r.Tag=e.DataField,s.push(r)):8===i?(o="",e.textBuilder.forEach(function(e){o+=e.varItems?g(b(e,!0),e.format):e.text}),r.Text=o):4===i&&(n=l.FieldByName(r.DataField),n&&(r.DataField=d(0,originFieldName).SummaryDataField)))})}var n,s=[];n=m[t],r(n.Footer,e.Footer),r(n.Header,e.Header),s.forEach(function(t){var r,n;G.CalcHPercent&&(t.Format=a.PercentFormat,r=o(t.Tag),n=i(e,r),n||(n=new HPercentSum(e,r),a.HPercentSums.push(n)),R?n.TotalSumBox=t:n.DataSumBoxes.push(t))})})}var F,w,D,P=1!==r,R=4===r,A=a.GroupAutoSum&&P,B=e.Column,E=B.orderNo,G=new DataFieldInfo;K===$&&(2==r&&E>=Z||3==r&&Z>E)||ee===re&&(3==r&&E>=q||4==r&&q>E)||(F=f.addTo(t?t.SubTitles:c.ColumnTitle.TitleCells),F.assign(B),F.Name=y,2!==r&&3!==r||(F._crossOrderNo=v),C(e,F.TitleCell),F.ContentCell.assign(B.ContentCell),w=F.ContentCell.getControls(),D=1===w.length,R?(ie.indexOf(B)>=0&&(G.CalcHPercent=1),ae.indexOf(B)>=0&&(G.CalcVPercent=1)):(oe.indexOf(B)>=0&&(G.CalcHPercent=1),ne.indexOf(B)>=0&&(G.CalcVPercent=1)),w.forEach(function(e,t){function l(t){n.forEach(function(r,n){function l(e,t){return e.isToGenerate()&&e.Controls.items.some(function(e){return e.AlignColumn===t.Name||e.AlignColumnEx===t.Name})}function s(r){var o,n,i,a;return r.isToGenerate()&&(o=r.Controls.Add(5),o.assign(e),o.Dock=0,o.TextAlign=e.TextAlign,o.AlignColumn=F.Name,o.DataField=t.summaryDataField,p.ShowColLine&&(n=o.Border,n.Styles|=4,i=p.ColLinePen.Width,a=e.Border,a&&4&a.Styles&&a.Pen.Width>0?i+=a.Pen.Width:n.Pen.Color=p.ColLinePen.Color,n.Pen.Width=i),D?(o.Top=0,o.Height=r.Height,16777215!==F.ContentCell.BackColor&&16777215===r.BackColor&&(o.BackStyle=1,o.BackColor=F.ContentCell.BackColor)):(o.Top=e.Top,o.Height=e.Height,1===e.BackStyle()&&(o.BackStyle=1,o.BackColor=e.BackColor))),o}var c,u,d,f=m[n];l(f.Footer,B)||l(f.Header,B)||(c=s(r.Footer),c||(c=s(r.Header)),c&&(c.Format=t.format,G.CalcHPercent&&(c.Format=a.PercentFormat,u=o(t.originDataField),d=i(r,u),d||(d=new HPercentSum(r,u),a.HPercentSums.push(d)),R?d.TotalSumBox=c:d.DataSumBoxes.push(c))))})}function c(){var r,o,n=e.DataField,i=e.SummaryFun;5===C&&(n||(n=S[0].originObject.Name),o=e.Format,F.ContentCell.Controls?(e=new FieldBox(F.ContentCell),e.assign(w[t]),F.ContentCell.Controls.items[t]=e):F.ContentCell.assign(w[t])),h=d(i,n),e.DataField=h.DataField,7!==C&&(o&&(r=u.Fields.Item(h.DataField),r&&(r.Format=o)),A&&l({summaryDataField:h.SummaryDataField,originDataField:n,format:""}))}function f(){var r,o,n,i,a=!1;a=s&&I(e,T),a||(o=B.ContentCell.getControls()[t],r=(n=o.textBuilder.items[0])&&n.varItems&&n.varItems.some(function(e){return 4===e.varField.type}),r?(i=b(n,!1),e.Text=g(i,n.format),A&&l({summaryDataField:ensureNameText(i),originDataField:"",format:n.format})):P&&(h=d(0,e.Name),e.Text="[#"+h.DataField+"#]",A&&l({summaryDataField:h.SummaryDataField,originDataField:e.Name,format:""})))}var h,C=e.ControlType;4===C||5===C||7===C?c():12===C?1!==r&&(h=d(e.Name,0),e.Text="[#"+h.DataField+"#]"):8===C&&f()}),P&&x())}var T=o?(2===r?"_":"_S")+o:"",y=e.Name+T;e.GroupTitle?b():e.Column.Visible&&x()}function B(){var e=h.Fields;u.Fields.forEach(function(t){T.push({crossField:t,originField:e.itemByName(t.Name)})})}function E(){S.forEach(function(e){function t(e,t,o){r=e.CopyAddField(u,t+o),r.GetDisplayTextScript="",y.push(r)}var r,o=e.HTotalFlag,n=e.originObject.Name;o.CalcHTotal&&t(e,n,csz_HTotal_Suffix),o.CalcHAverage&&t(e,n,csz_HAverage_Suffix),o.CalcHAverageA&&t(e,n,csz_HAverageA_Suffix),o.CalcHCount&&t(e,n,csz_HCount_Suffix),o.CalcHCountA&&t(e,n,csz_HCountA_Suffix),o.CalcHMin&&t(e,n,csz_HMin_Suffix),o.CalcHMax&&t(e,n,csz_HMax_Suffix),e.CalcTotalHPercent&&(r=P(n+csz_HTotalPercent_Suffix),r.Format=a.PercentFormat,y.push(r)),e.CalcTotalVPercent&&(r=P(n+csz_VTotalPercent_Suffix),r.Format=a.PercentFormat,y.push(r))})}function G(){var e=C.length;for(o=re;e>o;o++)A(C[o],undefined,4,undefined,0,!0,-1)}function L(e){var t,r=e.getControls();e.GroupTitle&&1===r.length&&(t=r[0],t.TextFormat&&(ce[ce.length-1].push(new DynamicTitleCellInfo(t)),e.SubTitles.items.length>=1&&L(e.SubTitles.items[0])))}function N(){var e=[];a.HResort&&b.forEach(function(t){e.push({field:t,asc:a.HSortAsc,"case":1})}),W=h.sortRecords(e,1)}function M(e){var t,r;for(t="_"+e,b.forEach(function(e){r=u.Fields.Add(),r.assign(e),r._tableMember="",r.DBFieldName="",r.Name+=t,r._hfval=e.Value,F.push(r)}),S.forEach(function(e){var o=e.originObject.Name+t;y.push(e.CopyAddField(u,o)),e.CalcHPercent&&(r=P(o+csz_HPercent_Suffix),r.Format=a.PercentFormat,y.push(r)),e.CalcVPercent&&(r=P(o+csz_VPercent_Suffix),r.Format=a.PercentFormat,y.push(r))}),o=Q;K>=o;o++)A(C[o],undefined,2,e,0,!1,o)}function O(){function e(){var e,t,r=!0,o=ce[ce.length-1],n=C[Q],i=0;if(ce.length>1)return!1;for(;n.GroupTitle&&!(i>=o.length)&&(e=o[i],r=!!e.PriorCrossTitleCell&&e.PriorTitleText==e.OriginTextBox.getDisplayText())&&(t=n.SubTitles,!(t.Count<=0))&&!(++i>=te);)n=t.Item(1);return!r}function t(){var e,t,r;for(w.push(v),e=w.length,t="_S"+e,S.forEach(function(e){r=e.originObject.Name+t,D.push(e.CopyAddField(u,r+csz_HTotal_Suffix)),e.HSubtotalFlag.CalcHAverage&&D.push(e.CopyAddField(u,r+csz_HAverage_Suffix)),e.HSubtotalFlag.CalcHAverageA&&D.push(e.CopyAddField(u,r+csz_HAverageA_Suffix)),e.HSubtotalFlag.CalcHCount&&D.push(e.CopyAddField(u,r+csz_HCount_Suffix)),e.HSubtotalFlag.CalcHCountA&&D.push(e.CopyAddField(u,r+csz_HCountA_Suffix)),e.HSubtotalFlag.CalcHMin&&D.push(e.CopyAddField(u,r+csz_HMin_Suffix)),e.HSubtotalFlag.IsCalcHMax&&D.push(e.CopyAddField(u,r+csz_HMax_Suffix))}),o=$;ee>=o;o++)A(C[o],undefined,3,e,0,!1,-1)}W.forEach(function(r,o){(r<a.VAddedItemRecordOffsetBegin||r>=a.VAddedItemRecordOffsetEnd)&&(h.MoveTo(r),o&&!h.fieldsKeepedValueChanged(b)||(a.SubtotalCols>0&&o&&e()&&(h.MoveTo(W[o-1]),t(),h.MoveTo(r)),h.keepValue(),M(++v)),h.curRecord._CrossNo_=v)}),a.SubtotalCols>0&&t()}function _(){function t(){return z?a.curPeriod=grhelper.periodRangeNext(a.curPeriod,a.HCrossPeriodType):(z=e(),strimDate(z.begin),strimDate(z.end),incDate(z.end),a.curPeriod=grhelper.periodRangeBy(z.begin,a.HCrossPeriodType)),a.curPeriod.begin<z.end}for(var r,o,n=W.length,i=0;t();)for(r=b[0].AsDateTime,b[0].AsDateTime=a.curPeriod.begin,M(++v),b[0].AsDateTime=r;n>i&&(h.MoveTo(W[i]),o=b[0].AsDateTime,!(o<a.curPeriod.begin||o>=a.curPeriod.end));)h.curRecord._CrossNo_=v,i++}function V(){a.HPercentSums.forEach(function(e){function t(e){e.isToGenerate()&&(r=e.Controls.Add(5),r.DataField=o)}var r,o;e.TotalSumBox||(o=e.DataFieldInfo.originObject.Name+csz_HTotal_Suffix,t(e.Group.Footer),!r&&t(e.Group.Header),r.Visible=!1,e.TotalSumBox=r)})}function H(){var e=y.splice(0,j);y=y.concat(e)}function I(e,t){var r,o=e.Text,n=o.indexOf(":");return n>0&&o.substring(2,n)===b[0].Name?(r="G"===t?"[#"+Y:o.substr(0,n)+t,r+=o.substr(n),e.Text=r,1):0}function k(){function e(){var e,t=b[0],r=new Date(2009,7,30),o=t.AsDateTime;for(e=0;7>e;++e)t&&(t.AsDateTime=r),M(++v),incDate(r);t.AsDateTime=o}function t(e){var t=b[0];e.Controls.forEach(function(e){4===e.ControlType?t.Name===e.DataField&&(e.DataField=Y):8===e.ControlType&&I(e,"G")})}var r,o,n=c.Groups.items[0];e(),n&&(r=u.Fields.Add(),r.FieldType=2,r.Name=J,x.push(r),n.ByFields=J,r=u.Fields.Add(),r.FieldType=6,r.Format=b[0].Format,r.Name=Y,x.push(r),t(n.Header),t(n.Footer)),g.Count>1&&(o=g.items[1].ContentCell.BackColor,f.Item(1).ContentCell.BackColor=o,f.Item(7).ContentCell.BackColor=o)}var j,W,U,z,J="_Month_",Y="_Date_",X=0,Z=1,q=1,Q=-1,K=-1,$=-1,ee=-1,te=0,re=-1,oe=[],ne=[],ie=[],ae=[],le=[],se=[],ce=[];if(s){if(a.GroupAutoSum=!1,h.Fields.forEach(function(e){6===e.FieldType&&b.push(e)}),!b.length)throw new Error("None date field!")}else{if(oe=g.decodeItems(a.HPercentColumns),ne=g.decodeItems(a.VPercentColumns),ie=g.decodeItems(a.TotalHPercentColumns),ae=g.decodeItems(a.TotalVPercentColumns),le=g.decodeItems(a.TotalExcludeColumns),b=h.decodeFields(a.HCrossFields),!b.length)throw new Error("生成交叉表不成功,没有定义'横向交叉数据字段'!");x=h.decodeFields(a.VCrossFields),se=h.decodeFields(a.DisabledSumFields),X=a.ListCols,q=g.Count-a.TotalCols,Z=q-a.SubtotalCols}if(C.forEach(function(e,t){var r,o=e.findLastColumn();o&&(r=o.orderNo,0>Q&&r>=X&&(Q=t),0>K&&r+1>=Z&&(K=t),0>$&&r>=Z&&($=t),0>ee&&r+1>=q&&(ee=t),0>re&&r>=q&&(re=t))}),0>$&&($=K+1),0>re&&(re=ee+1),q>Z&&K>=$)for(U=g.items[Z].TitleCell;U.SupCell;)++te,U=U.SupCell;if(t(),r(),R(),c.clearColumns(),s)k();else{if(!S.length)throw new Error("生成交叉表不成功,不存在交叉数据项!");if(0>=Q)throw new Error("生成交叉表不成功,不存在交叉数据列!");for(N(),o=0;Q>o;++o)A(C[o],undefined,1,undefined,0,!0,-1);for(B(),E(),j=y.length,a.HTotalAtFirst&&G(),o=Q;K>=o;o++)ce.push([]),L(C[o]);0===a.HCrossPeriodType?O():_(),!a.HTotalAtFirst&&G(),j>0&&H(),V()}}function r(){function t(){var e=[];a.VResort&&(x.forEach(function(t){e.push({field:t,asc:a.VSortAsc,"case":1})}),b.forEach(function(t){e.push({field:t,asc:a.HSortAsc,"case":1})})),d=h.sortRecords(e,1)}function r(e,t){S.forEach(function(r,o){var n,a=i*e+r.DatafieldIndex;r.NumericField?(n=r.originObject.AsFloat,y[a].AsFloat+=n,r.CalcHTotalExclude&&r.TotalValue||(r.TotalValue+=n,t&&(t[e*S.length+o]+=n))):y[a].IsNull&&(y[a].Value=r.originObject.Value)})}function o(){u.Append(),T.forEach(function(e){e.crossField.Value=e.originField.Value}),F.forEach(function(e){e.Value=e._hfval}),S.forEach(function(e){e.TotalValue=0})}function n(){function e(e,t,a,l,s){function c(){var s,c,u=Number.MAX_VALUE,d=-Number.MAX_VALUE;for(r=e;t>r;++r)s=y[i*r+a.DatafieldIndex],s.IsNull||(c=s.AsFloat,isNaN(c)||(u>c&&(u=c),c>d&&(d=c)));l.CalcHMin&&(u<Number.MAX_VALUE&&(n[o].AsFloat=u),o++),l.CalcHMax&&(d>-Number.MAX_VALUE&&(n[o].AsFloat=d),o++)}var u=t-e,d=u;if(l.CalcHAverageA||l.CalcHCountA)for(r=e;t>r;r++)y[i*r+a.DatafieldIndex].IsNull&&--d;n[o].AsFloat=s,o++,l.CalcHAverage&&(u>0&&(n[o].AsFloat=s/u),o++),l.CalcHAverageA&&(d>0&&(n[o].AsFloat=s/d),o++),l.CalcHCount&&(n[o].AsFloat=u,o++),l.CalcHCountA&&(n[o].AsFloat=d,o++),(l.CalcHMin||l.CalcHMax)&&c()}function t(){var t=D.length/w.length,a=0;w.forEach(function(l,s){var c=createArray(S.length,0);for(r=a;l>r;++r)S.forEach(function(e,t){c[t]+=y[i*r+e.DatafieldIndex].AsFloat});n=D,o=t*s,S.forEach(function(t,r){e(a,l,t,t.HSubtotalFlag,c[r])}),a=l})}var r,o=i*v,n=y;for(S.forEach(function(t){t.HTotalFlag.Flag&&(e(0,v,t,t.HTotalFlag,t.TotalValue,y),t.CalcTotalHPercent&&(n[o].AsFloat=1,o++),t.CalcTotalVPercent&&o++,t.EntireTotalValue+=t.TotalValue)}),r=0;v>r;++r)S.forEach(function(e){e.CalcHPercent&&(o=i*r+e.DatafieldIndex,0!=e.TotalValue?y[o+1].AsFloat=y[o].AsFloat/e.TotalValue:y[o+1].Clear())});w.length&&t(),u.Post()}function l(){var e,t,r,o,n,a,l;for(u.First();!u.Eof();){for(u.Edit(),e=0,t=0,r=0,o=0;v>o;++o)S.forEach(function(r,s){r.CalcVPercent&&(n=i*o+r.DatafieldIndex,a=y[n].AsFloat,l=f[o*S.length+s],r.CalcHPercent&&++n,++n,l&&(y[n].AsFloat=a/l),e+=a,t+=l)}),o===w[r]&&(S.forEach(function(o){o.CalcVPercent&&(n=i*r+o.DatafieldIndex+1+(o.CalcHPercent?1:0),t&&(D[n].AsFloat=e/t))}),r++);n=i*v,S.forEach(function(e){var t=e.HTotalFlag;n<y.length&&(a=y[n].AsFloat,t.CalcHTotal&&++n,t.CalcHAverage&&++n,t.CalcHAverageA&&++n,t.CalcHCount&&++n,t.CalcHCountA&&++n,t.CalcHMin&&++n,t.CalcHMax&&++n,e.CalcTotalHPercent&&++n,e.CalcTotalVPercent&&(e.EntireTotalValue&&(y[n].AsFloat=a/e.EntireTotalValue),++n))}),u.Post(),u.Next()}}function c(){var t,i,a,l,s=e(),c=[],u=0;for(c.push({field:b[0],asc:1,"case":1}),d=h.sortRecords(c,1),t=d.length;s.begin<=s.end;){for(;t>u&&(h.MoveTo(d[u]),!(b[0].AsDateTime>=s.begin));)u++;for(i=s.begin.getDay(),a=s.begin.getMonth(),o(),x.length&&(x[0].AsInteger=a+1,x[1].AsDateTime=s.begin),l=i;7>l;++l){for(F[l].AsDateTime=s.begin;t>u&&(h.MoveTo(d[u]),!(b[0].AsDateTime>s.begin));)r(l,undefined),u++;if(incDate(s.begin),s.begin>s.end||x.length&&a!==s.begin.getMonth())break}n()}}var d,f=createArray(v*S.length,0);s?c():(t(),d.forEach(function(e,t){(e<a.HAddedItemRecordOffsetBegin||e>=a.HAddedItemRecordOffsetEnd)&&(h.MoveTo(e),t&&!h.fieldsKeepedValueChanged(x)||(h.keepValue(),t&&n(),o())),h.curRecord._CrossNo_&&r(h.curRecord._CrossNo_-1,f)}),n(),S.some(function(e){return e.CalcVPercent||e.CalcTotalVPercent})&&l())}var o,n,i,a=this,l=a.report,s=9===a.HCrossPeriodType,c=new DetailGrid(l),u=c.Recordset,d=c.ColumnTitle.TitleCells,f=c.Columns,p=a.owner,h=p.Recordset,g=p.Columns,m=p.Groups.items,C=p.ColumnTitle.TitleCells.items,b=[],x=[],v=0,S=[],T=[],y=[],F=[],w=[],D=[];a.HAddedItemRecordOffsetBegin=-1,a.HAddedItemRecordOffsetEnd=-1,a.VAddedItemRecordOffsetBegin=-1,a.VAddedItemRecordOffsetEnd=-1,a.HPercentSums=[],c.assign(p),c.IsCrossTab=0,c.Recordset.BeforePostRecordScript="",n=c.Groups.items,t(),r(),l.RunningDetailGrid=c,c.attachData(),c.prepare()},unprepare:function(){},GroupEndProcess:function(e){var t=this;t.HPercentSums.forEach(function(t){var r;t.Group===e&&(r=t.TotalSumBox.Value,t.DataSumBoxes.forEach(function(e){r?e.Value/=r:e.Value=0}),t.TotalSumBox.Value=1)})},getClickedCellHCrossFieldValue:function(e){var t,r,o=this.report.RunningDetailGrid,n=o.clickedCell,i=n?n.getAttribute("_grcrossno"):0;return i&&(t=o.Recordset.Fields.Item(e+"_"+i),t&&(r=t.Value)),r},getClickedCellHCrossPeriod:function(){var e,t=this,r=t.report.RunningDetailGrid,o=r.clickedCell,n=o?"_"+o.getAttribute("_grcrossno"):0;return n&&(e=grhelper.periodRangeBy(r.Recordset.Fields.Item(t.HCrossFields+n).AsDateTime,t.HCrossPeriodType)),e},get Recordset(){var e=this.report,t=e.RunningDetailGrid;return t!=e.DetailGrid?t.Recordset:undefined},HBeginAddItem:function(){var e=this;e.HAddedItemRecordOffsetBegin=e.report.RunningDetailGrid.Recordset.RecordCount},HEndAddItem:function(){var e=this;e.HAddedItemRecordOffsetEnd=e.report.RunningDetailGrid.Recordset.RecordCount},VBeginAddItem:function(){var e=this;e.VAddedItemRecordOffsetBegin=e.report.RunningDetailGrid.Recordset.RecordCount},VEndAddItem:function(){var e=this;e.VAddedItemRecordOffsetEnd=e.report.RunningDetailGrid.Recordset.RecordCount},GetCurPeriodBeginDate:function(){return this.curPeriod.begin},GetCurPeriodEndDate:function(){return this.curPeriod.end}},prototypeCopyExtend(CrossTab,Object);var BubbleCircleCoverRatio=.25,PixelsPerCm=96/2.54,ChartSeriesColorArray=[3381606,39423,16737996,3394764,10079232,6737100,10040319,3407718,16737843,13421568,6723993,14535833,3342489,8965273,13369497,14535833,13395507,10092424,10066278,14522879],ChartSeriesColorCount=ChartSeriesColorArray.length,SCALELINE_WEIGHT=4,BIG_GAP=8,SMALL_GAP=4,CalcNearestAlignInt=function(e,t){var r,o,n=0;for(e>=1&&(t=0),r=0;t>r;r++)e*=10;for(o=e;o>1;)++n,o/=10;if(o=.15>o?.1:.3>o?.2:.75>o?.5:1,t>0&&(n-=t),n>0)for(r=0;n>r;r++)o*=10;else for(r=n;0>r;r++)o/=10;return o},ChartSeriesCollection=function(e){Collection.call(this,e)};prototypeLinkExtend(ChartSeriesCollection,Collection),ChartSeriesCollection.prototype._createItem=function(){return new ChartSeries(this.owner)};var ChartShape=function(e,t){var r=this;r.series=e,r.group=t},ChartRect=function(e,t,r){var o=this;ChartShape.call(o,e,t),o.rect=r};ChartRect.prototype={inRange:function(e,t){var r=this.rect,o=r.Width(),n=r.Height();return(4>o||4>n)&&(r=r.clone(),4>o&&(r.left-=2,r.right+=2),4>n&&(r.top-=2,r.bottom+=2)),r.PtInRect(e,t)},tooltipPos:function(){var e=this.rect;return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}}};var ChartPie=function(e,t,r,o,n,i,a){var l=this;ChartShape.call(l,e,t),l.x=r,l.y=o,l.r=n,l.beginAngle=i,l.endAngle=a};ChartPie.prototype={inRange:function(e,t){function r(){var r=e-o.x,n=t-o.y,i=Math.sqrt(r*r+n*n),a=Math.atan2(n,r);return 0>n&&(a+=2*Math.PI),{angle:360-toDegree(a),distance:i}}var o=this,n=r();return o.beginAngle<=n.angle&&n.angle<o.endAngle&&n.distance<o.r},tooltipPos:function(){var e=this,t=-toRadians(e.beginAngle+e.endAngle)/2,r=e.r/2;return{x:e.x+Math.cos(t)*r,y:e.y+Math.sin(t)*r}}};var ChartPoint=function(e,t,r,o,n){var i=this;ChartShape.call(i,e,t),i.x=r,i.y=o,i.r=n};ChartPoint.prototype={inRange:function(e,t){var r=this,o=e-r.x,n=t-r.y;return Math.sqrt(o*o+n*n)<=r.r},tooltipPos:function(){var e=this;return{x:e.x+4,y:e.y-4-Chart.prototype.options.tooltipFontSize}}};var ChartAxis=function(e){var t=this;Object.call(t,e),t.LinePen=new Pen,t.CoordLinePen=new Pen,t.Label="",t.Max=0,t.Min=0,t.Space=0,t.TextAngle=0,t.TextVisible=!0,t.TextFormat="0.##",t.LineVisible=!0,t.CoordLineVisible=!1,t.MarginBeginWeight=25,t.MarginEndWeight=25,t.Scales=[],t.CustomCoordLines=[]};ChartAxis.prototype={children:["LinePen","CoordLinePen"],afterLoad:function(e){var t=this,r=t.report.viewer.alpha.chartStroke,o=t.report.isWR;t.LinePen.loadFromJSON(e.LinePen,r,o),t.CoordLinePen.loadFromJSON(e.CoordLinePen,r,o)},CalcLabelHeight:function(){var e=this;return e.Used&&e.Label?e.owner.fontHeight+SMALL_GAP/2:0},CalcHorzAxisHeight:function(e){return this.DoCalcAxisSize(!0,e)},CalcVertAxisWidth:function(){return this.DoCalcAxisSize(!1,!1)},DoCalcAxisSize:function(e,t){var r,o=this,n=o.owner,i=[],a=o.owner.fontHeight,l=0;if(o.Used){if(o.TextVisible&&(!e||!n.IsDrawNegativeGraph())){if(t)i.push("1Agf");else if(o.IsValueAxis)if(o.Scales.length)o.Scales.forEach(function(e){i.push(e.Text)});else for(r=o.DrawMin;r<o.DrawMax+o.GetScaleTiny();r+=o.DrawSpace)i.push(o.ScaleFormatParser.format(r));else for(r=0;r<n.GroupCount;r++)i.push(n.GroupLabels[r]);-270===o.TextAngle?(i.forEach(function(e){l=Math.max(l,e.length)}),l*=a):(i.forEach(function(e){l=Math.max(l,n.context.measureTextWidth(e))}),e&&(l=Math.abs(Math.sin(toRadians(o.TextAngle))*l)+1+a))}n.Chart3DReal&&n.IsHorzGraph()&&n.YAxis===o&&(l+=n.yView3DDepth),o.LineVisible&&(l+=SCALELINE_WEIGHT),l&&(l+=SMALL_GAP)}return l},CalcGroupPos:function(e,t){var r=this,o=r.owner,n=o.IsHorzGraph()?o.CalcColumnBarCount():o.CalcBarCount(),i=r.MarginBeginWeight+r.MarginEndWeight+100*(o.GroupCount-1)+(n>0?o.BarWidthPercent:0),a=i?e*r.MarginBeginWeight/i:0,l=i?e*r.MarginEndWeight/i:0,s=e-a-l,c=n>0?o.BarWidthPercent:0,u=100*t,d=u+c,f={};return i-=r.MarginBeginWeight+r.MarginEndWeight,f.BeginPos=a,f.EndPos=a,i>0&&(f.BeginPos+=s*u/i,f.EndPos+=s*d/i),f.LabelMiddlePos=(f.BeginPos+f.EndPos)/2,f},DrawHorzAxisLabel:function(e){var t=this,r=t.owner.context;!e.IsRectEmpty()&&t.Label&&r.drawText(t.Label,(e.left+e.right-r.measureTextWidth(t.Label))/2,(e.top+e.bottom-t.owner.fontHeight)/2)},DrawVertAxisLabel:function(e){var t=this,r=t.owner.context;!e.IsRectEmpty()&&t.Label&&r.drawTextRotate(t.Label,(e.left+e.right-t.owner.fontHeight)/2,(e.top+e.bottom+r.measureTextWidth(t.Label))/2,90)},DrawAxisTextsPrepare:function(e){var t,r=this,o=r.owner,n=[];if(r.IsValueAxis)if(r.Scales.length)r.Scales.forEach(function(t){n.push({Text:t.Text,PosVal:r.CalcValuePos(t.PosVal,e)})});else for(t=r.DrawMin;t<r.DrawMax+r.GetScaleTiny();t+=r.DrawSpace)n.push({Text:r.ScaleFormatParser.format(t),PosVal:r.CalcValuePos(t,e)});else for(t=0;t<o.GroupCount;t++)n.push({Text:o.GroupLabels[t]||"",PosVal:r.CalcGroupPos(e,t).LabelMiddlePos});return n},DrawHorzAxis:function(e,t,r){function o(e,t,r,o,n){var i,a,l,s,c=f.owner.context,u=r.length,d=f.owner.fontHeight;if(o?(a=e.bottom-1,f.LineVisible&&(a-=SCALELINE_WEIGHT),p.Chart3DReal&&(a-=p.yView3DDepth),t+=p.xView3DDepth):(a=e.top+1,f.LineVisible&&(a+=SCALELINE_WEIGHT)),-270===f.TextAngle)for(s=c.measureTextWidth("A"),i=e.left+t-s,o&&(a-=d*u),l=0;u>l;l++)c.drawText(r.charAt(l),i,a),a+=d;else s=c.measureTextWidth(r),i=e.left+t-Math.abs(s/2*Math.cos(toRadians(f.TextAngle)))+Math.abs(d/2*Math.sin(toRadians(f.TextAngle))),o&&(a-=d),n||(a-=d+2*SCALELINE_WEIGHT-1),c.drawTextRotate(r,i,a,f.TextAngle)}var n,i,a,l,s,c,u,d,f=this,p=f.owner,h=p.context,g=e.Width()-p.xView3DDepth,m=p.IsDrawNegativeGraph(),C=f.IsValueAxis,b=f.LinePen,x=b.clone(),v=b.clone();f.Used&&!e.IsRectEmpty()&&(x.Width=.5,v.Width=.5,v.Color=colorGradientLight(b.Color),f.LineVisible&&(h.selectPen(b),i=e.left,a=i+p.xView3DDepth,l=i+g,s=l+p.xView3DDepth,c=r?e.bottom:e.top,u=c-p.yView3DDepth,d=r?t.bottom-2*p.yView3DDepth:t.top,h.DrawHorzLine(c,i,l),p.Chart3DReal&&(p.YAxis.Used||!p.Y2Axis.Used||p.IsHorzGraph()?(h.drawPolyLine([l,c,s,u,a,u],0),h.drawPolyLine([s,u,s,d,a,d],0)):(h.drawPolyLine([s,u,a,u,i,c],0),h.drawPolyLine([s,d,a,d,a,u],0))),h.restorePen()),n=f.DrawAxisTextsPrepare(g),h.selectPen(x),n.forEach(function(n,i){var a,l,s=p.IsScatterGraph()||!m||(f.IsValueAxis?n.PosVal>=0:p.Value(0,i)>=0),c=e.left+n.PosVal;f.LineVisible&&(r?(c+=p.xView3DDepth,l=e.bottom-p.yView3DDepth,a=l-SCALELINE_WEIGHT):(a=e.top+1,l=s?e.top+1+SCALELINE_WEIGHT:e.top+1-SCALELINE_WEIGHT),h.DrawVertLine(c,a,l),p.Chart3DReal&&!C&&(r&&(c-=p.xView3DDepth,a+=p.yView3DDepth+SCALELINE_WEIGHT),h.selectPen(v),h.drawLine(c,a,c+p.xView3DDepth,a-p.yView3DDepth),h.restorePen())),f.TextVisible&&o(e,n.PosVal,n.Text,r,s),f.CoordLineVisible&&!C&&f.IsValueAxis&&(h.selectPen(f.CoordLinePen),a=t.top+1,l=t.bottom-p.yView3DDepth,r&&(a-=p.yView3DDepth,l-=p.yView3DDepth),h.DrawVertLine(c+p.xView3DDepth,a,l),h.restorePen()),C=!1}),h.restorePen(),f.CustomCoordLines.forEach(function(n){var i=f.CalcValuePos(n.PosVal,g);n.Text&&o(e,i,n.Text,r,!0),h.selectPen(n.LinePen),h.DrawVertLine(e.left+i,t.top+1,t.bottom),h.restorePen()}))},DrawVertAxis:function(e,t,r,o){function n(e,t,r,o){var n=d.owner.context;n.drawText(r,o?e.left+(d.LineVisible?SCALELINE_WEIGHT:0):e.right-n.measureTextWidth(r)-(d.LineVisible?SCALELINE_WEIGHT:0),t-d.owner.fontHeight/2)}var i,a,l,s,c,u,d=this,f=d.owner,p=f.context,h=e.Height()-f.yView3DDepth,g=d.LinePen,m=g.clone(),C=g.clone();!e.IsRectEmpty()&&d.Used&&(m.Width=.5,C.Width=.5,C.Color=colorGradientLight(g.Color),d.LineVisible&&(p.selectPen(g),i=r?e.left-f.xView3DDepth:e.right,a=e.bottom,o&&(a-=f.yView3DDepth),l=a-h,p.DrawVertLine(i,l,a+1),f.Chart3DReal&&(s=i+f.xView3DDepth,c=a-f.yView3DDepth,p.drawPolyLine([i,a,s,c,s,c-h,i,l],0)),p.restorePen()),p.selectPen(m),u=d.DrawAxisTextsPrepare(h),u.forEach(function(i,a){var l,s,c=d.IsValueAxis?e.bottom-i.PosVal:e.top+i.PosVal+(o?0:f.yView3DDepth),u=c;d.LineVisible&&i.PosVal!=d.DrawMin&&(l=e.right-SCALELINE_WEIGHT,s=e.right,r&&(l=e.left,s=e.left+SCALELINE_WEIGHT),p.DrawHorzLine(u,l,s),f.Chart3DReal&&(p.selectPen(C),r?(l=e.left-f.xView3DDepth,u+=f.yView3DDepth):l=e.right,p.drawLine(l,u,l+f.xView3DDepth,u-f.yView3DDepth),p.restorePen())),d.TextVisible&&n(e,c,i.Text,r),d.CoordLineVisible&&d.IsValueAxis&&(p.selectPen(d.CoordLinePen),u-=f.yView3DDepth,p.DrawHorzLine(u,t.left+f.xView3DDepth+g.Width,t.right),p.restorePen())}),p.restorePen(),d.CustomCoordLines.forEach(function(o){var i=e.bottom-d.CalcValuePos(o.PosVal,h);o.Text&&n(e,i,o.Text,r),p.selectPen(o.LinePen),p.DrawHorzLine(i-f.yView3DDepth,t.left+f.xView3DDepth+g.Width,t.right),p.restorePen()}))},PrepareDraw:function(){var e=this;e.Used=!1,e.IsValueAxis=!1,e.DrawMax=-Number.MAX_VALUE,e.DrawMin=Number.MAX_VALUE,e.DrawSpace=0,e.ScaleFormatParser=new NumericFormatter(e.TextFormat)},PrepareDrawRange:function(){var e=this;e.Max?e.DrawMax=e.Max:e.Scales.forEach(function(t){e.DrawMax=Math.max(e.DrawMax,t.PosVal)}),e.Min?e.DrawMin=e.Min:e.DrawMin>0&&e.DrawMax>0?e.DrawMin=0:e.DrawMin<0&&e.DrawMax<0?e.DrawMax=0:e.owner.NegativeAsZero&&(e.DrawMin=0),e.DrawMax<=e.DrawMin&&(e.DrawMin=0,e.DrawMax=100)},PrepareDrawSpace:function(e,t,r){var o,n=this;n.Space?n.DrawSpace=n.Space:(o=n.owner.fontHeight*t,n.DrawSpace=(n.DrawMax-n.DrawMin)*o/e,n.DrawSpace=CalcNearestAlignInt(n.DrawSpace,n.ScaleFormatParser.positiveAnalyser.precision)),n.DrawMax<=n.DrawMin&&(n.DrawMax=n.DrawMin+1,n.DrawSpace=.2),n.DrawSpace<2*n.GetScaleTiny()&&(n.DrawSpace=2*n.GetScaleTiny()),n.Max||n.Min||r||(n.DrawMax>0&&(n.DrawMax=n.DrawSpace*Math.ceil(n.DrawMax/n.DrawSpace)),n.DrawMin<0&&(n.DrawMin=n.DrawSpace*Math.floor(n.DrawMin/n.DrawSpace)))},GetScaleTiny:function(){var e=this;return(e.DrawMax-e.DrawMin)/1e4},CalcValuePos:function(e,t){var r=this;return(e-r.DrawMin)*t/(r.DrawMax-r.DrawMin)},get ScaleCount(){return this.Scales.length},AddCustomScale:function(e,t){this.Scales.push({PosVal:e,Text:t})},EmptyCustomScale:function(){this.Scales=[]},GetScaleText:function(e){return this.Scales[e].Text},GetScaleValue:function(e){return this.Scales[e].PosVal},AddCustomCoordLine:function(e,t,r,o,n){var i=new Pen;i.Width=r,i.Style=n,i.Color=o,this.CustomCoordLines.push({PosVal:e,Text:t,LinePen:i})},EmptyCustomCoordLine:function(){this.CustomCoordLines=[]}},prototypeCopyExtend(ChartAxis,Object);var ChartSeries=function(e){var t=this;Object.call(t,e),t.ChartType=1,t.ByY2Axis=!1,t.SeriesName="",t.XValueField="",t.YValueField="",t.ZValueField="",t.FillColor=0,t.FillColorAuto=!0,t.LabelText="",t.LabelAsGroup=!1,t.LabelInBar=!1,t.LabelTextAngle=0,t.TooltipText="",t.ValueFormat="0.##",t.MarkerStyle=3,t.MarkerSize=4,t.MarkerColor=16777215,t.MarkerColorAuto=!0,t.MarkerLegendShow=!0,t.BorderPen=new Pen,t.MarkerPen=new Pen};ChartSeries.prototype={afterLoad:function(e){var t=this,r=t.report.viewer.alpha,o=r.chartGraph,n=r.chartStroke,i=t.report.isWR;"StepBarChart"===t.ChartType?t.ChartType=4:enumMemberValid(t,"ChartType",grenum.ChartType),enumMemberValid(t,"MarkerStyle",grenum.PointMarkerStyle),colorMemberValid(t,"FillColor",o),colorMemberValid(t,"MarkerColor",o),t.BorderPen.loadFromJSON(e.BorderPen,n,i),t.MarkerPen.loadFromJSON(e.MarkerPen,n,i)},PrepareDraw:function(){var e=this;e.ValueFormatParser=new NumericFormatter(e.ValueFormat)},IsHorzGraph:function(){var e=this;return 11===e.ChartType||12===e.ChartType||13===e.ChartType},IsPercent100Graph:function(){var e=this;return 2===e.ChartType||10===e.ChartType||13===e.ChartType},IsBarChart:function(){var e=this;return 1===e.ChartType||4===e.ChartType||10===e.ChartType||11===e.ChartType||12===e.ChartType||13===e.ChartType},IsScatterGraph:function(){var e=this;return 5===e.ChartType||6===e.ChartType||8===e.ChartType||9===e.ChartType},CanGroupLabelChart:function(){var e=this;return 1===e.ChartType||11===e.ChartType},HasPointMarker:function(){var e=this;return 3===e.ChartType||7===e.ChartType||5===e.ChartType||6===e.ChartType||8===e.ChartType||9===e.ChartType},Support3D:function(){var e=this;return 1===e.ChartType||4===e.ChartType||10===e.ChartType||11===e.ChartType||12===e.ChartType||13===e.ChartType||2===e.ChartType}},prototypeCopyExtend(ChartSeries,Object);var Chart=function(e){var t=this;CanvasBox.call(t,e),t.XAxis=new ChartAxis(t),t.YAxis=new ChartAxis(t),t.Y2Axis=new ChartAxis(t),t.Series=new ChartSeriesCollection(t),t.Recordset=new Recordset(t),t.TitleFont=new FontWrapper(t.Font),t.ValueFont=new FontWrapper(t.Font),t.Title="",t.Chart3D=!1,t.Chart3DViewAngle=35,t.LegendVisible=!0,t.LegendValueVisible=!1,t.LegendShowSum=!1,t.LegendAtBottom=!1,t.LegendColumnCount=0,t.LegendSumLabel="",t.SeriesField="",t.SeriesAuto=!0,t.GroupField="",t.GroupAuto=!0,t.GroupCount=5,t.SeriesCount=2,t.AbsNegativeValue=!1,t.NegativeBarColor=255,t.BarWidthPercent=70,t.NegativeAsZero=!1,t.SingleSeriesColored=!0,t.Bar3DAxisDepth=25,t.Pie3DHeightDepth=25,t.BubbleScalePerCm=0,t.SeriesLabels=[],t.GroupLabels=[],t.values=[]};Chart.prototype={ControlType:11,children:["Border","XAxis","YAxis","Y2Axis","Series"],options:{tooltipBoxColor:"rgba(0,0,0,.8)",tooltipBoxCorner:4,tooltipFontSize:14,tooltipFontStyle:"normal",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontColor:"#fff"},afterLoad:function(e){var t,r,o=this,n=o.report.viewer.alpha,i=n.chartGraph,a=n.chartStroke,l=o.report.isWR;if(CanvasBox.prototype.afterLoad.call(o,e),colorMemberValid(o,"NegativeBarColor",i),o.XAxis.loadFromJSON(e.XAxis,a),o.YAxis.loadFromJSON(e.YAxis,a),o.Y2Axis.loadFromJSON(e.Y2Axis,a),o.Series.loadFromJSON(e.ChartSeries),o.Recordset.loadFromJSON(e.Recordset),o.TitleFont.loadFromJSON(e.TitleFont,l),o.ValueFont.loadFromJSON(e.ValueFont,l),o.prepareValues(),t=e[o.getJsonMember("GroupLabel")],t&&(o.GroupLabels=t.split("\r")),t=e[o.getJsonMember("SeriesLabel")],t&&(o.SeriesLabels=t.split("\r")),t=e[o.getJsonMember("Value")]){for(t=t.split(","),r=t.length;r-- >0;)t[r]=+t[r];for(o.values=[],r=0;r<o.SeriesCount;)o.values.push(t.slice(r++*o.GroupCount,r*o.GroupCount))}},assign:function(e){var t=this;CanvasBox.prototype.assign.call(t,e),t.SeriesLabels=e.SeriesLabels.concat(),t.GroupLabels=e.GroupLabels.concat(),t.values=e.values.concat(),t.TitleFont.assign(e.TitleFont),t.ValueFont.assign(e.ValueFont),t.XAxis.assign(e.XAxis),t.YAxis.assign(e.YAxis),t.Y2Axis.assign(e.Y2Axis),t.Series.assign(e.Series),t.Recordset.assign(e.Recordset)},bindRecordset:function(){var e=this,t=e.Recordset;t.prepare(),e.oSeriesField=t.FieldByName(e.SeriesField),e.oGroupField=t.FieldByName(e.GroupField),e.Series.forEach(function(e){e.oYValueField=t.FieldByName(e.YValueField),e.IsScatterGraph()&&(e.oXValueField=t.FieldByName(e.XValueField),9===e.ChartType&&(e.oZValueField=t.FieldByName(e.ZValueField)))})},unprepare:function(){var e=this;CanvasBox.prototype.unprepare.call(e),e.Recordset.unprepare()},loadDrawingData:function(){function e(){return s.Series.items.every(function(e){return e.oYValueField&&(!e.IsScatterGraph()||e.oXValueField&&(9!==e.ChartType||e.oZValueField))})}function t(e,t,r){var o=0,n=e.RecordCount;for(t&&(t.recordset.MoveTo(r-1),o=t.beginNoField.AsInteger,n=t.endNoField.AsInteger+1);n>o;)e.MoveTo(o++),u.appendRefRecord(e.curRecord)}function r(e,t){var r,n=h.Groups.items,i=[],l="",s=[];for(e.recordset.MoveTo(t-1),a.MoveTo(e.beginNoField.AsInteger),r=e.index;r>=0;r--)l&&(l+=";"),l+=n[r].ByFields;for(o.decodeFields(l).forEach(function(e){i.indexOf(e)<0&&i.push(e)}),i.forEach(function(e){var t=a.Fields.itemByName(e.Name);t&&s.push({origin:e,detail:t})}),o.First();!o.Eof();)s.every(function(e){return!e.detail.valUeq(e.origin)})&&u.appendRefRecord(o.curRecord),o.Next()}var o,n,i,a,l,s=this,c=s.origin,u=s.Recordset,d=s.owner.owner,f=s.runningNo,p=s.report,h=p.DetailGrid;s.bindRecordset(),h&&(a=h.Recordset),e()?(u.RecordCount||(d.ByFields&&(l=d),f>=1e4&&(f=Math.floor(f/1e4),n=p.ownerSR,d=n.owner.owner,p=d.report,l||h?n._relations&&(--f,d.ByFields&&(d.recordset.MoveTo(f),f=d.beginNoField.AsInteger),p.DetailGrid.Recordset.MoveTo(f),i=1,n.attachRelationTable()):d.ByFields&&(l=d)),c&&(o=c.Recordset),o&&o.RecordCount?l?r(l,f):u._dataTable=c._dataTable:a&&t(a,l,f),
i&&n.detachRelationTable()),s.applyDataFromRecordset()):s.values||s.EmptyValues()},applyDataFromRecordset:function(){var e,t,r,o,n,i,a=this,l=a.Recordset,s=a.Series.items,c=s[0].IsScatterGraph();for(a.SeriesAuto&&a.oSeriesField&&(a.SeriesCount=0,a.SeriesLabels=[]),!c&&a.GroupAuto&&a.oGroupField&&(a.GroupCount=0,a.GroupLabels=[]),a.EmptyValues(),l.First();!l.Eof();)e=0,a.oSeriesField&&(t=a.oSeriesField.DisplayText,e=a.GetSeriesIndexByLabel(t,!1),0>e&&a.SeriesAuto&&(e=a.SeriesCount,a.SeriesLabels.push(t),++a.SeriesCount)),r=0,a.oGroupField&&!c&&(o=a.oGroupField.DisplayText,r=a.GetGroupIndexByLabel(o,!1),0>r&&a.GroupAuto&&(r=a.GroupCount,a.GroupLabels.push(o),++a.GroupCount)),s.forEach(function(t,o){o&&(e=o),c?a.AddXYZValue(e,t.oXValueField.AsFloat,t.oYValueField.AsFloat,t.oZValueField?t.oZValueField.AsFloat:undefined):(n=t.oYValueField.AsFloat,i=a.Value(e,r),i&&(n+=i),a.SetValue(e,r,n))}),l.Next()},showTooltip:function(e,t){var r=this,o=r.options,n=r.context;if(e||(e=undefined),r.activeShape!==e&&(r.activeShape=e,n.ctx.clearRect(0,0,r.canvas.width,r.canvas.height),r.draw(),e)){var i=r.graphSerieses[e.series];if(i.TooltipTextBuilder){var a,l=n.ctx.font,s=i.TooltipTextBuilder.generateChartDisplayText(e.series,e.group),c=e.tooltipPos(),u=o.tooltipFontSize+2,d=0;if(n.ctx.font=fontString(o.tooltipFontSize,o.tooltipFontStyle,o.tooltipTitleFontFamily),i.tooltipLines>1){a=[];for(var f,p,h=0;(f=s.indexOf("\n",h))>=0;)p=s.substring(h,f-("\r"===s.charAt(f-1)?1:0)),a.push(p),d=Math.max(d,n.measureTextWidth(p)),h=f+1;p=s.substr(h),a.push(p),d=Math.max(d,n.measureTextWidth(p))}else d=n.measureTextWidth(s);var g=new Rect(c.x,c.y,c.x+d,c.y+u*i.tooltipLines-2);if(g.InflateRect(o.tooltipBoxCorner,o.tooltipBoxCorner),g.OffsetRect(Math.min(r.canvas.width-g.right,0),Math.min(r.canvas.height-g.bottom,0)),n.selectFillStyle(o.tooltipBoxColor),n.roundRectangle(g.left,g.top,g.Width(),g.Height(),o.tooltipBoxCorner,o.tooltipBoxCorner,1),n.restoreFillStyle(),n.selectFillStyle(o.tooltipFontColor),a){var m=g.left+o.tooltipBoxCorner,C=g.top+o.tooltipBoxCorner;a.forEach(function(e){n.drawText(e,m,C),C+=u})}else n.drawTextCenter(s,(g.left+g.right)/2,(g.top+g.bottom-o.tooltipFontSize)/2);n.restoreFillStyle(),n.ctx.font=l}}},prepareCanvas:function(){function e(){var e,t,r=i.Series.items,o=r.length;for(e=0;o>e;e++)if(t=r[e],t.LabelText&&(t.LabelTextBuilder=new TextBuilder(i,t.LabelText)),t.TooltipText){t.TooltipTextBuilder=new TextBuilder(i,t.TooltipText),t.tooltipLines=1;for(var n=0;(n=t.TooltipText.indexOf("\n",n))>=0;)++n,++t.tooltipLines;u=1}}function t(){var e=toRadians(i.Chart3DViewAngle);i.xView3DDepth=Math.cos(e)*i.Bar3DAxisDepth,i.yView3DDepth=Math.sin(e)*i.Bar3DAxisDepth}function r(){var e,t,r=i.Series.items,o=i.graphs=[],n=i.graphSerieses=[];for(e=0;e<i.SeriesCount;e++){t=e<r.length?r[e]:r[0],n.push(t);for(var a=0;a<o.length;a++)if(t.ChartType===n[o[a][0]].ChartType){o[a].push(e);break}a===o.length&&o.push([e])}}function o(e){var t,r,o=i.shapes.length;if(i.graphs.length>1)for(t=0;o>t;t++)if(r=i.shapes[t],!r.rect&&r.inRange(e.x,e.y))return r;for(t=0;o>t;t++)if(r=i.shapes[t],r.inRange(e.x,e.y))return r;return 0}function n(e){for(var t,r=i.shapesL.length;r-- >0;)if(t=i.shapesL[r],t.inRange(e.x,e.y))return t;return 0}var i=this,a=i.onclickGraph,l=i.onclickLegend,s=i.ondblclickGraph,c=i.ondblclickLegend,u=0;i.Chart3DReal=i.Chart3D&&i.Support3D(),i.xView3DDepth=0,i.yView3DDepth=0,i.Chart3DReal&&t(),i.loadDrawingData(),e(),r(),u&&bindEvents(i,["mousemove","touchstart","touchmove","mouseout"],function(e){var t,r;"mouseout"!==e.type&&(t=getRelativePosition(e),r=o(t)),i.showTooltip(r,t)}),(a||l)&&addEvent(i.canvas,"click",function(e){var t,r=getRelativePosition(e);a&&(t=o(r),t&&a(e,i,t.series,t.group)),l&&(t=n(r),t&&l(e,i,t.series,t.group))}),(s||c)&&addEvent(i.canvas,"dblclick",function(e){var t,r=getRelativePosition(e);s&&(t=o(r),t&&s(e,i,t.series,t.group)),c&&(t=n(r),t&&c(e,i,t.series,t.group))})},draw:function(e){function t(){function e(){var e,o,n;c.DrawBubbleScalePerCm=c.BubbleScalePerCm,c.DrawBubbleScalePerCm<=0&&(e=r*t*BubbleCircleCoverRatio,o=e/(PixelsPerCm*PixelsPerCm),c.DrawBubbleScalePerCm=h/o),n=Math.sqrt(p/c.DrawBubbleScalePerCm)*PixelsPerCm,0===b.Max&&(b.DrawMax+=(b.DrawMax-b.DrawMin)*(n/2)/t),0==C.Max&&(C.DrawMax+=(C.DrawMax-C.DrawMin)*(n/2)/r)}var t,r,o=c.IsScatterGraph(),n=c.Series.items,i=n[0].ChartType,u=10===i||13===i,p=0,h=0;for(C.PrepareDraw(),b.PrepareDraw(),x.PrepareDraw(),l=n.length,a=0;l>a;a++)n[a].PrepareDraw(this);C.Used=!0,C.IsValueAxis=!1,b.IsValueAxis=!0,x.IsValueAxis=!0,c.Title&&(v=fontHeight(c.getUsingTitleFont())+BIG_GAP),o?(C.IsValueAxis=!0,g.forEach(function(e){e.forEach(function(e){var t,r=c.values[e],o=r?r.length:0,n=C,i=c.YAxisOfSeries(m[e]);for(i.Used=!0,a=0;o>a;a++)t=r[a],t.y<i.DrawMin&&(i.DrawMin=t.y),t.y>i.DrawMax&&(i.DrawMax=t.y),t.x<n.DrawMin&&(n.DrawMin=t.x),t.x>n.DrawMax&&(n.DrawMax=t.x),p<t.z&&(p=t.z),h+=t.z})}),C.PrepareDrawRange()):g.forEach(function(e){var t,r,o=m[e[0]].ChartType,n=4===o||10===o||12===o||13===o;for(t=0;t<c.GroupCount;t++)if(r=0,e.forEach(function(e){var o=c.Value(e,t),i=c.YAxisOfSeries(m[e]);n?r+=o:(i.Used=!0,c.AbsNegativeValue&&(o=Math.abs(o)),o<i.DrawMin&&(i.DrawMin=o),o>i.DrawMax&&(i.DrawMax=o))}),n){var i=m[e[0]],a=c.YAxisOfSeries(i);a.Used=!0,u?(a.DrawMin=0,a.DrawMax=100):(r<a.DrawMin&&(a.DrawMin=r),r>a.DrawMax&&(a.DrawMax=r))}}),b.Used||x.Used||(b.Used=!0),b.Used&&(s=b.DrawMax),x.Used&&s<x.DrawMax&&(s=x.DrawMax),b.PrepareDrawRange(),x.PrepareDrawRange(),t=f-v-C.CalcLabelHeight()-C.CalcHorzAxisHeight(!0),t=Math.max(t,1),b.PrepareDrawSpace(t,3,u),x.PrepareDrawSpace(t,3,u),o&&(r=d-b.CalcLabelHeight()-b.CalcVertAxisWidth()-x.CalcLabelHeight()-x.CalcVertAxisWidth(),r=Math.max(r,1),C.PrepareDrawSpace(r,6,!1),t=f-v-C.CalcLabelHeight()-C.CalcHorzAxisHeight(!1),t=Math.max(t,1),9===n[0].ChartType&&e())}function r(e){function t(){var t=e.Series.items[0].ChartType;return 1===e.SeriesCount&&e.SingleSeriesColored&&(1===t||3===t||7===t||11===t)}function r(){return e.LegendValueVisible&&(!e.IsScatterGraph()||9===e.Series.items[0].ChartType)}function o(){return e.LegendShowSum&&r()}function n(){return(t()?e.GroupCount:e.SeriesCount)+(o()?1:0)}function i(r){return t()?r===e.GroupCount:r===e.SeriesCount}function a(r){return i(r)?e.LegendSumLabel||"合计":t()?e.GroupLabels[r]:e.getSeriesShowLabel(r)}function l(r){var o,n=e.graphSerieses[0];return i(r)?o=e.GetTotalValue():t()?o=e.Value(0,r):(o=e.GetSeriesTotalValue(r),n=e.graphSerieses[r]),o===undefined?"":n.ValueFormatParser.format(o)}function s(e){var r={series:-1,group:-1};return i(e)||(t()?r.group=e:r.series=e),r}function c(r,o){var n,i,a=e.context,l=e.GetGraphFillColor(r);t()||(i=e.graphSerieses[r],n=i.HasPointMarker()&&i.MarkerLegendShow,n&&a.DrawPointMarker(o,i.MarkerStyle,i.MarkerPen,l)),n||(a.selectFillColor(l),a.rectangle2(o,1),a.restoreFillStyle())}function u(t){var o,u,d,f,p,h,g,m,C=e.context,b=r(),x=e.LegendColumnCount,v=x>0?x:999,S=t.Width(),T=2*e.fontHeight,y=3*T/4,F=n(),w=S,D=[],P={Count:0,Width:0};if(!F)return 0;for(u=0;F>u;++u)o=BIG_GAP+y+SMALL_GAP,o+=C.measureTextWidth(a(u)),b&&(o+=SMALL_GAP+C.measureTextWidth(l(u))),(o>w||P.Count>=v)&&P.Width>0&&(D.push(P),P={Count:0,Width:0},w=S),P.Count++,P.Width+=o,w-=o;for(P.Count>0&&D.push(P),f=SMALL_GAP+D.length*T,d=0,P=D[d],u=t.bottom-f+SMALL_GAP,p=new Rect((t.left+t.right-P.Width)/2,t.bottom-f+SMALL_GAP,0,u+T),u=0;F>u;++u)P.Count<=0&&(d++,P=D[d],p.left=(t.left+t.right-P.Width)/2,p.top=p.bottom,p.bottom+=T),P.Count--,p.left+=BIG_GAP,S=p.left,(F-1>u||!i(u))&&(o=(p.top+p.bottom-y)/2,h=new Rect(p.left,o,p.left+y,o+y),c(u,h)),p.left+=y,g=(p.top+p.bottom-e.fontHeight)/2,m=a(u),p.left+=SMALL_GAP,p.right=p.left+C.measureTextWidth(m),C.drawText(m,p.left,g),p.left=p.right,b&&(m=l(u),p.left+=SMALL_GAP,p.right=p.left+C.measureTextWidth(m),C.drawText(m,p.left,g),p.left=p.right),e.toUpdateShapes&&(v=s(u),e.shapesL.push(new ChartRect(v.series,v.group,new Rect(S,p.top,p.right,p.bottom))));return f}function d(t){var i,u,d,f,p,h,g,m,C,b,x,v,S,T,y=e.context,F=r(),w=o(),D=n(),P=e.LegendColumnCount,R=3*e.fontHeight/4*2,A=3*R/4,B=t.Height()-2*SMALL_GAP,E=0,G=0,L=2*SMALL_GAP,N=[],M=[];if(!D)return 0;for(f=0;D>f;++f)h=y.measureTextWidth(a(f)),h>E&&(E=h),g=R,L+=g,N.push(g),F&&(h=y.measureTextWidth(l(f)),h>G&&(G=h));if(i=E+SMALL_GAP,G>0&&(i+=G+SMALL_GAP),0>=P&&(P=1,L>t.Height()))for(h=0,f=0;D>f;++f)h>B&&(P++,h=N[f]);if(B<N[0])return 0;for(f=0,h=0;P>h;h++)for(g=B;D>f&&g>N[f];)g-=N[f++];for(u=D>f,u&&(h=D,w&&(f--,h--),N.splice(f,h-f)),h=N.length,g=P,m=Math.ceil(h/P),M=createArray(P,0),w&&(M[P-1]=m,h-=m,g--,g>0&&(m=Math.ceil(h/g))),f=0;g>f;f++)M[f]=Math.min(m,h),h-=M[f];for(g=0,f=0,h=0;P>h;h++){for(m=0,p=0;p<M[h];p++)m+=N[f++];m>g&&(g=m)}for(L=Math.min(t.Height(),g+2*SMALL_GAP),C=SMALL_GAP+A+SMALL_GAP+i,b=C*P+SMALL_GAP,b>2*t.Width()/3&&(b=2*t.Width()/3,g=C,C=(b-SMALL_GAP)/P,E-=g-C),h=t.right-b,g=(t.top+t.bottom-L)/2,x=new Rect(h,g,h+b,g+L),y.rectangle2(x),h=x.left+SMALL_GAP,g=C-SMALL_GAP,v=new Rect(h,0,h+A,0),h+=v.Width()+SMALL_GAP,g-=v.Width()+SMALL_GAP,S=new Rect(h,x.top+SMALL_GAP,h+Math.min(g,E+SMALL_GAP),0),h+=S.Width()+SMALL_GAP,g-=S.Width()+SMALL_GAP,T=new Rect(h,0,h+g,0),h=N.length-1,w&&h--,g=0,f=0;P>f;f++){for(S.top=x.top+SMALL_GAP,p=0;p<M[f];++p)S.bottom=S.top+N[g],m=(S.top+S.bottom-e.fontHeight)/2,u&&h===g?y.drawText("... ...",v.left,m):(v.top=(S.top+S.bottom-A)/2,v.bottom=v.top+A,d=w&&g===N.length-1,d?g=D-1:c(g,v),y.drawText(a(g),S.left,m),F&&y.drawTextAlign(l(g),T.left,m,T.Width(),e.fontHeight,20),d&&(y.selectPen(new Pen(.5,0,0)),y.DrawHorzLine(S.top,v.left,T.right),y.restorePen())),e.toUpdateShapes&&(E=s(g),e.shapesL.push(new ChartRect(E.series,E.group,new Rect(v.left,v.top,T.right,v.bottom)))),S.top+=N[g++];v.left+=C,v.right+=C,S.left+=C,S.right+=C,T.left+=C,T.right+=C}return b}var f;e.LegendAtBottom?(f=u(h),h.bottom-=f+BIG_GAP):(f=d(h),h.right-=f+BIG_GAP)}function o(){p.selectFont(c.getUsingTitleFont()),p.drawTextCenter(c.Title,(h.left+h.right)/2,h.top+BIG_GAP/2),p.restoreFont()}function n(e){var t,r,o,n,i,a,l,u,d=c.Series.items,f=C.CalcLabelHeight(),h=C.CalcHorzAxisHeight(!1),v=b.CalcLabelHeight(),S=b.CalcVertAxisWidth(),T=x.CalcLabelHeight(),y=x.CalcVertAxisWidth(),F=0,w=0,D=!1;for(r=d.length,t=0;r>t;t++)if(o=d[t],o.LabelTextBuilder&&!o.LabelInBar){D=!0;break}if(!D&&c.Title||(F=fontHeight(c.getUsingValueFont())/(o.LabelTextBuilder?1:2),c.IsDrawNegativeGraph()&&(w=F),o.LabelTextAngle&&(p.selectFont(c.getUsingValueFont()),F=Math.max(Math.abs(p.measureTextWidth(o.ValueFormatParser.format(s))*Math.sin(toRadians(o.LabelTextAngle))),F),p.restoreFont())),i=new Rect(e.left+v+S,e.top+F,e.right-T-y,e.bottom-f-h-w),l=new Rect(e.left,e.top+F,e.left+v,e.bottom-f-h-w),b.DrawVertAxisLabel(l),u=new Rect(e.right-T,l.top,e.right,l.bottom),x.DrawVertAxisLabel(u),l.left=l.right,l.right+=S,b.DrawVertAxis(l,i,!1),u.right=u.left,u.left-=y,x.DrawVertAxis(u,i,!0),a=new Rect(e.left+v+S,e.bottom-f,e.right-T-y,e.bottom),C.DrawHorzAxisLabel(a),c.IsDrawNegativeGraph()?(a.top=l.bottom-b.CalcValuePos(0,l.Height()),a.bottom=a.top+h):(a.top=i.bottom,a.bottom=a.top+h),c.Chart3D&&C.DrawHorzAxis(a,i,!1),!i.IsRectEmpty()&&(c.IsScatterGraph()||c.GroupCount)){for(p.selectFont(c.getUsingValueFont()),r=g.length,t=0;r>t;t++)switch(o=g[t],n=m[o[0]].ChartType){case 1:c.DrawBar(o,i);break;case 4:case 10:c.DrawStackedBar(o,n,i);break;case 3:case 7:c.DrawLine(o,n,i);break;case 9:c.DrawBubble(o,i);break;default:c.DrawXYScatterGraph(o,n,i)}p.restoreFont()}!c.Chart3D&&C.DrawHorzAxis(a,i,!1)}function i(e){var t,r,o,n,i,a,l,u,d=c.Series.items,f=C.CalcLabelHeight(),h=C.CalcVertAxisWidth(),v=b.CalcLabelHeight(),S=b.CalcHorzAxisHeight(!1),T=x.CalcLabelHeight(),y=x.CalcHorzAxisHeight(!1),F=0,w=0,D=!1;for(r=d.length,t=0;r>t;t++)if(o=d[t],o.LabelTextBuilder&&!o.LabelInBar){D=!0;break}if(D&&(p.selectFont(c.getUsingValueFont()),F=p.measureTextWidth(o.ValueFormatParser.format(s)),c.IsDrawNegativeGraph()&&(w=F),p.restoreFont()),i=new Rect(e.left+f+h+w,e.top+v+S,e.right-F,e.bottom-T-y),l=new Rect(i.left,e.top,i.right,e.top+v),b.DrawHorzAxisLabel(l),u=new Rect(l.left,e.bottom-T,l.right,e.bottom),x.DrawHorzAxisLabel(u),l.top=l.bottom,l.bottom+=S,b.DrawHorzAxis(l,i,!0),u.bottom=u.top,u.top-=y,x.DrawHorzAxis(u,i,!1),a=new Rect(e.left,i.top,e.left+f,i.bottom),C.DrawVertAxisLabel(a),a.left=a.right,a.right+=h,c.Chart3D&&C.DrawVertAxis(a,i,!1,b.Used),!i.IsRectEmpty()&&c.GroupCount){for(p.selectFont(c.getUsingValueFont()),r=g.length,t=0;r>t;t++)switch(o=g[t],n=m[o[0]].ChartType){case 11:c.DrawColumnBar(o,i);break;case 12:case 13:c.DrawStackedColumnBar(o,n,i)}p.restoreFont()}!c.Chart3D&&C.DrawVertAxis(a,i,!1)}var a,l,s,c=this,u=c.canvas,d=u.width,f=u.height,p=c.context=new Context(u.getContext("2d")),h=new Rect(0,0,d,f),g=c.graphs,m=c.graphSerieses,C=c.XAxis,b=c.YAxis,x=c.Y2Axis,v=0;c.fontHeight=fontHeight(c.getUsingFont()),c.valueFontHeight=fontHeight(c.getUsingValueFont()),p.selectFont(c.getUsingFont()),p.selectFillColor(c.ForeColor),c.report.singleChart&&(h.left+=c.PaddingLeft,h.top+=c.PaddingTop,h.right-=c.PaddingRight,h.bottom-=c.PaddingBottom),c.toUpdateShapes=e,e&&(c.shapes=[],c.shapesL=[]),t(),c.LegendVisible&&c.SeriesCount&&r(c),c.Title&&o(),h.top+=v,h.IsRectEmpty()||(2===c.Series.items[0].ChartType?c.DrawPie(h):c.IsHorzGraph()?i(h):n(h)),p.restoreFillStyle(),p.restoreFont()},DrawPie:function(e){var t,r,o,n,i=this,a=i.context,l=0,s=0,c=e.Height(),u=e.Width(),d=u*c,f=Number.MAX_VALUE,p=-1,h=-1;for(t=0;t<i.GroupCount;t++){for(r=0;r<i.SeriesCount;r++)a.selectFont(i.getUsingValueFont()),i.graphSerieses[r].LabelTextBuilder&&(l=Math.max(l,a.measureTextWidth(i.GetDrawValueText(r,t)))),a.restoreFont();s=Math.max(s,a.measureTextWidth(i.GroupLabel(t)))}for(t=1;t<=i.GroupCount;t++)r=Math.floor((i.GroupCount+t-1)/t),o=Math.min(u/r,c/t),o=d-o*o*i.GroupCount,f>o&&(f=o,p=r,h=t);for(a.selectFont(i.getUsingValueFont()),o=0;o<i.GroupCount;o++)t=Math.floor(o/p),r=o%p,n=new Rect(e.left+u*r/p,e.top+c*t/h,e.left+u*(r+1)/p,e.top+c*(t+1)/h),i.Chart3DReal?a.drawTextCenter("三维饼图暂不支持!!!",(n.left+n.right)/2,(n.top+n.bottom-16)/2):i.DrawOne2DPie(o,n,l,s);a.restoreFont()},DrawOne2DPie:function(e,t,r){function o(){var r,o,h,m,b,x,v=u.getUsingValueFont(),S=v.Italic?f(v):0,T=new Rect(0,0,0,0);for(c=0,n=0;g>n;n++)s=toRadians(C[n]),o=a+Math.cos(s)*i,h=l-Math.sin(s)*i,x=u.GetDrawValueText(n,e),b=d.measureTextWidth(x)+S,r=new Rect(o,h,o+b,h+p),s<Math.PI/2?(r.OffsetRect(2,-p),1===c&&r.top<T.bottom&&(m=T.right-r.left+2,r.right+m<t.right?r.OffsetRect(m,0):r.OffsetRect(0,T.bottom-r.top),d.drawLine(o,h,r.left,r.bottom-b.cy/3)),c=1):s<Math.PI?(r.OffsetRect(-b-2,-p),2===c&&r.top<T.bottom&&(m=r.right-T.left+2,r.left-m>t.left?r.OffsetRect(-m,0):r.OffsetRect(0,T.bottom-r.top),d.drawLine(o,h,r.right,r.bottom-b.cy/3)),c=2):s<1.5*Math.PI?(r.OffsetRect(-b-2,0),3===c&&r.bottom>T.top&&(m=r.right-T.left+2,r.left-m>t.left?r.OffsetRect(-m,0):r.OffsetRect(0,r.bottom-T.top),d.drawLine(o,h,r.right,r.top+b.cy/3)),c=3):(r.OffsetRect(2,0),4===c&&r.bottom>T.top&&(m=T.right-r.left+2,r.right-m<t.right?r.OffsetRect(m,0):r.OffsetRect(0,r.bottom-T.top),d.drawLine(o,h,r.left,r.top+b.cy/3)),c=4),u.DrawLabelText(x,(r.left+r.right)/2,r.top),T=r}var n,i,a,l,s,c,u=this,d=u.context,f=u.fontHeight,p=u.valueFontHeight,h=!1,g=u.SeriesCount,m=0,C=[];for(n=0;g>n;n++)m+=u.Value(n,e),u.graphSerieses[n].LabelTextBuilder&&(h=!0);if(!(0>=m||(a=t.Width()-2*r-2*SMALL_GAP,l=t.Height()-f-2*p-2*SMALL_GAP,0>=a||0>=l||(i=Math.min(a,l)/2,h?t.InflateRect(-SMALL_GAP,-SMALL_GAP):t.InflateRect(i-a/2,i-l/2),t.bottom-=f,t.IsRectEmpty())))){for(u.DrawLabelText(u.GroupLabel(e),(t.left+t.right)/2,t.bottom),a=(t.left+t.right)/2,l=(t.top+t.bottom)/2,s=0,n=0;g>n;n++)c=s+360*u.Value(n,e)/m,u.toUpdateShapes&&u.shapes.push(new ChartPie(n,e,a,l,i,s,c)),d.selectFillColor(u.GetGraphFillColor(n)),d.pie(a,l,i,s,c,1),d.restoreFillStyle(),h&&C.push((s+c)/2),s=c;h&&o()}},DrawColumnBar:function(e,t){var r,o,n,i,a,l,s,c,u,d,f,p,h,g=this,m=g.context,C=g.graphSerieses,b=g.CalcColumnBarCount(),x=g.CalcFirtColumnBarIndex(e),v=t.Width()-g.xView3DDepth,S=t.Height()-g.yView3DDepth,T=g.IsDrawNegativeGraph()?g.YAxis.CalcValuePos(0,v):t.left+1,y=e.length,F=g.IsDrawNegativeGraph(),w=[];for(i=0;i<g.GroupCount;i++)for(c=g.XAxis.CalcGroupPos(S,i),u=c.EndPos-c.BeginPos,r=t.top+c.BeginPos,g.Y2Axis.Used&&(r+=g.yView3DDepth),o=y;o-- >0;)a=e[o],l=C[a],n=g.Value(a,i),d=g.AbsNegativeValue&&0>n,d&&(n=-n),h=new Rect(0,r+u*(x+o)/b,0,r+u*(x+o+1)/b),p=g.YAxisOfSeries(l).CalcValuePos(n,v),F?(h.left=t.left+T,h.right=Math.min(t.left+p,t.right),T>p&&(p=h.left,h.left=h.right,h.right=p)):(h.left=t.left,h.right=Math.min(t.left+Math.max(0,p),t.right)),w.push(h),g.toUpdateShapes&&g.shapes.push(new ChartRect(a,i,h)),f=d?g.NegativeBarColor:g.GetGraphFillColor(g.IsColorSingleBar()?i:a),g.DrawRectBar(h,f,l.BorderPen,!0,!0,n>=0);for(i=0;i<g.GroupCount;i++)if(l=C[e[0]],l.LabelAsGroup){for(s=g.GetDrawValueText(e[0],i),p=-9999,o=0;y>o;o++)h=w[i*y+o],p<h.right&&(p=h.right);g.DrawValueText(l,s,p+SMALL_GAP+m.measureTextWidth(s)/2,(w[i*y].top+w[i*y+y-1].bottom+g.valueFontHeight)/2)}else for(o=0;y>o;o++)a=e[o],l=C[a],l.LabelTextBuilder&&(s=g.GetDrawValueText(a,i),h=w[i*y+o],l.LabelInBar?g.DrawHorzBarText(s,h):g.DrawValueText(l,s,h.right+SMALL_GAP+m.measureTextWidth(s)/2,(h.top+h.bottom+g.valueFontHeight)/2))},DrawStackedColumnBar:function(e,t,r){var o,n,i,a,l,s,c,u,d,f,p,h,g,m,C=this,b=C.context,x=C.graphSerieses,v=C.CalcColumnBarCount(),S=C.CalcFirtColumnBarIndex(e),T=r.Width()-C.xView3DDepth,y=r.Height()-C.yView3DDepth,F=e.length,w=[];for(i=0;i<C.GroupCount;i++){for(s=C.XAxis.CalcGroupPos(y,i),c=s.EndPos-s.BeginPos,d=r.top+s.BeginPos,C.Y2Axis.Used&&(d+=C.yView3DDepth),h=d+c*S/v,g=d+c*(S+1)/v,f=r.left,o=0;F>o;o++)a=e[o],l=x[a],n=C.Value(a,i),13===t&&(n*=100/C.CalcGroupTotalValue(e,i)),p=Math.max(0,C.YAxisOfSeries(l).CalcValuePos(n,T)),m=new Rect(f,h,Math.min(r.right,f+p),g),w.push(m),C.toUpdateShapes&&C.shapes.push(new ChartRect(a,i,m)),u=C.GetGraphFillColor(a),C.DrawRectBar(m,u,l.BorderPen,!0,o===F-1,!0),f+=p;if(l.LabelInBar)for(o=0;F>o;o++)a=e[o],l=x[a],l.LabelTextBuilder&&C.DrawHorzBarText(C.GetDrawValueText(a,i),w[i*F+o]);else a=e[0],l=x[a],n=C.GetDrawValueText(a,i),C.DrawValueText(l,n,f+SMALL_GAP+b.measureTextWidth(n)/2,(h+g+C.valueFontHeight)/2)}},DrawBar:function(e,t){var r,o,n,i,a,l,s,c,u,d,f,p,h,g=this,m=g.graphSerieses,C=g.CalcBarCount(),b=g.CalcFirtBarIndex(e),x=g.IsDrawNegativeGraph(),v=t.Height()-g.yView3DDepth,S=x?g.YAxis.CalcValuePos(0,v):t.bottom+1,T=e.length,y=[];for(i=0;i<g.GroupCount;i++)for(c=g.XAxis.CalcGroupPos(t.Width()-g.xView3DDepth,i),u=c.EndPos-c.BeginPos,n=b,r=0;T>r;r++)a=e[r],l=m[a],o=g.Value(a,i),d=g.AbsNegativeValue&&0>o,d&&(o=-o),h=new Rect(t.left+c.BeginPos+u*n/C,0,t.left+c.BeginPos+u*(n+1)/C,0),p=g.YAxisOfSeries(l).CalcValuePos(o,v),x?(h.top=Math.max(t.bottom-p,t.top),h.bottom=t.bottom-S,S>p&&(p=h.top,h.top=h.bottom,h.bottom=p)):(h.top=t.bottom-p,h.bottom=t.bottom),y.push(h),g.toUpdateShapes&&g.shapes.push(new ChartRect(a,i,h)),f=d?g.NegativeBarColor:g.GetGraphFillColor(g.IsColorSingleBar()?i:a),g.DrawRectBar(h,f,l.BorderPen,!1,!0,o>=0),++n;for(i=0;i<g.GroupCount;i++)if(a=e[0],l=m[a],l.LabelAsGroup){for(s=g.GetDrawValueText(a,i),p=9999,r=0;T>r;r++)h=y[i*T+r],p>h.top&&(p=h.top);g.DrawValueText(l,s,(y[i*T].left+y[i*T+T-1].right+g.xView3DDepth)/2,p-SMALL_GAP/2-g.yView3DDepth)}else for(r=0;T>r;r++)a=e[r],l=m[a],l.LabelTextBuilder&&(s=g.GetDrawValueText(a,i),h=y[i*T+r],l.LabelInBar?g.DrawVertBarText(s,h):(p=h.top-SMALL_GAP/2-g.yView3DDepth,g.IsDrawNegativeGraph()&&t.bottom-S<h.bottom&&(p=h.bottom+g.valueFontHeight),g.DrawValueText(l,s,(h.left+h.right+g.xView3DDepth)/2,p)))},DrawStackedBar:function(e,t,r){var o,n,i,a,l,s,c,u,d,f,p,h,g,m=this,C=m.graphSerieses,b=m.CalcBarCount(),x=m.CalcFirtBarIndex(e),v=r.Width()-m.xView3DDepth,S=r.Height()-m.yView3DDepth,T=e.length,y=[];for(i=0;i<m.GroupCount;i++){for(s=m.XAxis.CalcGroupPos(v,i),c=s.EndPos-s.BeginPos,f=r.left+s.BeginPos+c*x/b,p=r.left+s.BeginPos+c*(x+1)/b,h=r.bottom,o=0;T>o;o++)a=e[o],l=C[a],n=m.Value(a,i),10===t&&(n*=100/m.CalcGroupTotalValue(e,i)),d=m.YAxisOfSeries(l).CalcValuePos(n,S),g=new Rect(f,Math.min(Math.max(h-d,r.top),h),p,h),y.push(g),m.toUpdateShapes&&m.shapes.push(new ChartRect(a,i,g)),u=m.GetGraphFillColor(a),m.DrawRectBar(g,u,l.BorderPen,!1,o===T-1,!0),h-=d;if(l.LabelInBar)for(o=0;T>o;o++)a=e[o],l=C[a],l.LabelTextBuilder&&m.DrawVertBarText(m.GetDrawValueText(a,i),y[i*T+o]);else a=e[0],l=C[a],m.DrawValueText(l,m.GetDrawValueText(a,i),(f+p+m.xView3DDepth)/2,h-SMALL_GAP/2-m.yView3DDepth)}},DrawRectBar:function(e,t,r,o,n,i){function a(e,t){s.selectFillColor(e),s.selectPen(new Pen(1,e,1)),s.drawPolyLine(t,1,1),s.restorePen(),s.restoreFillStyle()}var l=this,s=l.context,c=colorGradientLight(t),u=colorGradientDark(t),d=[];l.Chart3DReal&&(d.length=8,d[0]=e.right-1,d[1]=e.top,d[2]=d[0]+l.xView3DDepth,d[3]=d[1]-l.yView3DDepth,(n||o)&&(d[4]=d[2]-e.Width(),d[5]=d[3],d[6]=e.left,d[7]=d[1],a(c,d)),!n&&o||(d[4]=d[2],d[5]=e.bottom-l.yView3DDepth,d[6]=e.right-1,d[7]=e.bottom,a(u,d))),l.Chart3DReal?(s.selectFillColor(t),s.rectangle2(e,1),s.restoreFillStyle()):s.drawBar(e,r,t,o?i?1:3:i?0:2)},DrawLine:function(e,t,r){var o,n,i,a,l,s,c,u,d=this,f=d.context,p=e.length,h=[];for(o=0;p>o;o++)h.push([]);for(n=0;n<d.GroupCount;n++)for(c=r.left+d.XAxis.CalcGroupPos(r.Width()-d.xView3DDepth,n).LabelMiddlePos,o=0;p>o;o++){i=e[o],a=d.graphSerieses[i];var g={x:c,y:r.bottom-d.YAxisOfSeries(a).CalcValuePos(d.Value(i,n),r.Height())};h[o].push(g),d.toUpdateShapes&&d.shapes.push(new ChartPoint(i,n,g.x,g.y,a.MarkerSize))}for(o=0;p>o;o++)(7===t?d.DrawCurveLine:d.DrawPolyLine).call(d,h[o],e[o]);for(o=0;p>o;o++)d.DrawPointsMarker(h[o],e[o]);for(n=0;n<d.GroupCount;n++)for(o=0;p>o;o++)i=e[o],a=d.graphSerieses[i],a.LabelTextBuilder&&(u=r.bottom-d.YAxisOfSeries(a).CalcValuePos(d.Value(i,n),r.Height()),-1!==a.MarkerStyle&&(u-=a.MarkerSize/2),l=d.GetDrawValueText(i,n),s=f.measureTextWidth(l),c=h[o][n].x+s/2,d.GroupCount>1&&(c-=s*n/(d.GroupCount-1)),d.DrawValueText(a,l,c,u))},DrawBubble:function(e,t){var r,o,n,i,a,l,s,c,u,d=this,f=e.length,p=[],h=[];for(r=0;f>r;r++)for(i=e[r],a=d.graphSerieses[i],c=[],u=[],p.push(c),h.push(u),s=d.ValueCount(i),n=0;s>n;n++){o=d.Value(i,n),l=Math.sqrt(o.z/d.DrawBubbleScalePerCm)*PixelsPerCm/2;var g={x:t.left+d.XAxis.CalcValuePos(o.x,t.Width()),y:t.bottom-d.YAxisOfSeries(a).CalcValuePos(o.y,t.Height())};c.push(g),u.push(l),d.toUpdateShapes&&d.shapes.push(new ChartPoint(i,n,g.x,g.y,l)),a.LabelTextBuilder&&d.DrawValueText(a,d.GetDrawValueText(i,n),g.x,g.y-l)}for(r=0;f>r;r++)i=e[r],d.DrawPointsMarker(p[i],i,h[i])},DrawXYScatterGraph:function(e,t,r){var o,n,i,a,l,s,c,u=this,d=e.length,f=[];for(o=0;d>o;o++)for(a=e[o],l=u.graphSerieses[a],c=[],f.push(c),s=u.ValueCount(a),i=0;s>i;i++){n=u.Value(a,i);var p={x:r.left+u.XAxis.CalcValuePos(n.x,r.Width()),y:r.bottom-u.YAxisOfSeries(l).CalcValuePos(n.y,r.Height())};c.push(p),u.toUpdateShapes&&u.shapes.push(new ChartPoint(a,i,p.x,p.y,l.MarkerSize)),l.LabelTextBuilder&&u.DrawValueText(l,u.GetDrawValueText(a,i),p.x,p.y-l.MarkerSize)}if(6===t||8===t)for(o=0;d>o;o++)a=e[o],l=u.graphSerieses[a],(8===t?u.DrawCurveLine:u.DrawPolyLine).call(u,f[a],a);for(o=0;d>o;o++)a=e[o],u.DrawPointsMarker(f[a],a)},DrawPolyLine:function(e,t){var r,o,n=this,i=n.context,a=e.length,l=[];for(r=0;a>r;r++)l.push(e[r].x,e[r].y);o=n.graphSerieses[t].BorderPen.clone(),o.Color=n.GetGraphFillColor(t),i.selectPen(o),i.drawPolyLine(l),i.restorePen()},DrawCurveLine:function(e,t){function r(e,t,r){var o=.4,n=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),i=Math.sqrt(Math.pow(r.x-t.x,2)+Math.pow(r.y-t.y,2)),a=n+i,l=a>0?o*n/a:1,s=a>0?o*i/a:1;return{inner:{x:t.x-l*(r.x-e.x),y:t.y-l*(r.y-e.y)},outer:{x:t.x+s*(r.x-e.x),y:t.y+s*(r.y-e.y)}}}var o,n,i,a,l=this,s=l.context,c=e.length,u=[];if(c>1){for(i=e[0],a=r(i,i,e[1]),u.push(i,a.outer),o=1;c-1>o;o++)i=e[o],a=r(e[o-1],i,e[o+1]),u.push(a.inner,i,a.outer);i=e[o],a=r(e[o-1],i,i),u.push(a.inner,i),n=l.graphSerieses[t].BorderPen.clone(),n.Color=l.GetGraphFillColor(t),s.selectPen(n),s.polyBezier(u),s.restorePen()}},DrawPointsMarker:function(e,t,r){var o,n=this,i=n.context,a=n.graphSerieses[t],l=e.length;if(-1!==a.MarkerStyle)for(o=0;l>o;o++)i.DrawPointMarker(CalcPointMarkerRect(e[o].x,e[o].y,r?r[o]:a.MarkerSize),a.MarkerStyle,a.MarkerPen,a.MarkerColorAuto?n.GetGraphFillColor(t):a.MarkerColor)},DrawValueText:function(e,t,r,o){var n,i=this,a=i.context,l=i.valueFontHeight;e.LabelTextAngle?(n=toRadians(e.LabelTextAngle),r-=(a.measureTextWidth(t)*Math.cos(n)+Math.abs(l*Math.sin(n)))/2,o-=Math.abs(l*Math.cos(n)),a.drawTextRotate(t,r,o,e.LabelTextAngle)):a.drawTextCenter(t,r,o-l)},DrawLabelText:function(e,t,r){var o=this.context;o.drawTextCenter(e,t,r)},DrawVertBarText:function(e,t){var r=this,o=r.context;o.drawTextRotate(e,(t.left+t.right-r.fontHeight)/2,(t.top+t.bottom+o.measureTextWidth(e))/2,90)},DrawHorzBarText:function(e,t){var r=this,o=r.context,n=o.measureTextWidth(e),i=r.fontHeight,a=(t.left+t.right-n)/2,l=(t.top+t.bottom-i)/2;o.drawText(e,a,l)},CalcBarCount:function(){var e,t,r,o=this,n=o.graphs.length,i=0;for(e=0;n>e;e++)t=o.graphs[e],r=o.graphSerieses[t[0]].ChartType,1===r?i+=t.length:4!==r&&10!==r||i++;return i},CalcColumnBarCount:function(){var e,t,r,o=this,n=o.graphs.length,i=0;for(e=0;n>e;e++)t=o.graphs[e],r=o.graphSerieses[t[0]].ChartType,11===r?i+=t.length:12!==r&&13!==r||i++;return i},CalcFirtBarIndex:function(e){var t,r,o,n=this,i=n.graphs,a=i.length,l=0;for(t=0;a>t&&(r=i[t],r!==e);t++)o=n.graphSerieses[r[0]].ChartType,1===o?l+=r.length:4!==o&&10!==o||++l;return l},CalcFirtColumnBarIndex:function(e){var t,r,o,n=this,i=n.graphs,a=i.length,l=0;for(t=0;a>t&&(r=i[t],r!==e);t++)o=n.graphSerieses[r[0]].ChartType,11===o?l+=r.length:12!==o&&13!==o||++l;return l},CalcGroupTotalValue:function(e,t){var r,o=this,n=e.length,i=0;for(r=0;n>r;r++)i+=o.Value(e[r],t);return i},IsScatterGraph:function(){return this.Series.items[0].IsScatterGraph()},IsHorzGraph:function(){return this.Series.items[0].IsHorzGraph()},IsColorSingleBar:function(){var e=this;return 1==e.SeriesCount&&e.SingleSeriesColored},IsDrawNegativeGraph:function(){var e=this;return!e.Series.items.some(function(e){return e.ByY2Axis})&&e.YAxis.DrawMax>=0&&e.YAxis.DrawMin<0&&!e.AbsNegativeValue},Support3D:function(){return this.Series.items.every(function(e){return e.Support3D()})},YAxisOfSeries:function(e){var t=this;return e.ByY2Axis?t.Y2Axis:t.YAxis},getSeriesShowLabel:function(e){var t=this;return t.SeriesLabels[e]||(t.graphSerieses[e]?t.graphSerieses[e].SeriesName:"")},getUsingTitleFont:function(){return this.TitleFont.UsingFont()},getUsingValueFont:function(){return this.ValueFont.UsingFont()},GetGraphFillColor:function(e){var t,r,o,n,i=this,a=i.graphSerieses[e],l=i.FillColors?i.FillColors.length:ChartSeriesColorCount;return i.IsColorSingleBar()||a.FillColorAuto?(t=Math.floor(e/l),r=e%l,o=i.FillColors?i.FillColors[r]:colorAlpha(ChartSeriesColorArray[r],i.report.viewer.alpha.chartGraph),t>0&&(n=color2rgba(o),o=rgba2color((n.r+73*r+196*t)%255,(n.g+197*r+120*t)%255,(n.b+117*r+90*t)%255,n.a)),o):a.FillColor},GetSeriesIndexByLabel:function(e,t){var r=this,o=r.SeriesLabels.indexOf(e);return 0>o&&t&&(o=+e,(!isNaN(o)||o>=r.SeriesCount)&&(o=-1)),o},GetGroupIndexByLabel:function(e,t){var r=this,o=r.GroupLabels.indexOf(e);return 0>o&&t&&(o=+e,(!isNaN(o)||o>=r.GroupCount)&&(o=-1)),o},GetDrawValueText:function(e,t){var r=this.graphSerieses[e];return r.LabelTextBuilder?r.LabelTextBuilder.generateChartDisplayText(e,t):""},GetGroupTotalValue:function(e,t){var r,o=this,n=e.length,i=0;if(!o.IsScatterGraph())for(r=0;n>r;r++)i+=o.Value(e[r],t);return i},GetSeriesTotalValue:function(e){var t,r,o=this,n=0;if(o.IsScatterGraph())for(r=o.ValueCount(e),t=0;r>t;t++)n+=o.Value(e,t).z;else for(t=0;t<o.GroupCount;t++)n+=o.Value(e,t);return n},GetTotalValue:function(){var e,t=this,r=0;for(e=0;e<t.SeriesCount;e++)r+=t.GetSeriesTotalValue(e);return r},prepareValues:function(){for(var e=this,t=e.values.length;t++<e.SeriesCount;)e.values.push([])},get AsChart(){return this},GroupLabel:function(e){return this.GroupLabels[e]},SetGroupLabel:function(e,t){this.GroupLabels[e]=t},SeriesLabel:function(e){return this.SeriesLabels[e]},SetSeriesLabel:function(e,t){this.SeriesLabels[e]=t},Value:function(e,t){var r,o=this;return o.prepareValues(),r=o.values[e][t],r===undefined&&(r=0),r},SetValue:function(e,t,r){var o=this;o.prepareValues(),o.values[e][t]=r},ValueCount:function(e){var t=this;return t.prepareValues(),t.values[e].length},get FillColorCount(){var e=this;return e.FillColors?e.FillColors.length:0},getFillColor:function(e){var t=this;return t.FillColors?t.FillColors[e]:undefined},AddFillColor:function(e){var t=this;t.FillColors||(t.FillColors=[]),t.FillColors.push(e)},EmptyFillColors:function(){delete self.FillColors},LoadDataFromXML:function(e,t,r,o){function n(){return l?a.text:a.textContent}var i,a,l,s,c,u,d=this,f=1,p=parseXML(e);if(!dom)return 0;for(o&&(d.GroupCount=0,d.GroupLabels=[]),r&&(d.SeriesCount=0,d.SeriesLabels=[]),d.values=[],i=p.childNodes[0].firstChild,nodeText=i.hasOwnProperty("text");i;){if(a=i.firstChild,t&&(s=n(),a=a.nextSibling,c=d.GetSeriesIndexByLabel(s,!r),0>c&&r&&(c=d.SeriesCount,d.SeriesCount++,d.SeriesLabels.push(s)),0>c))throw 0;if(s=n(),a=a.nextSibling,u=d.GetGroupIndexByLabel(s,!o),0>u&&o&&(u=d.GroupCount,d.GroupCount++,d.GroupLabels.push(s)),0>u)throw 0;if(t)d.SetValue(c,u,+n()+d.Value(c,u));else for(c=0;a;)d.SetValue(c,u,+n()+d.Value(c,u)),c++,a=a.nextSibling;i=i.nextSibling}return f},DoLoadXYZDataFromXML:function(e,t,r){function o(){return a?i.text:i.textContent}var n,i,a,l,s,c,u,d,f=this,p=1,h=parseXML(e);if(!dom)return 0;for(t&&(f.SeriesCount=0,f.SeriesLabels=[]),f.values=[],n=h.childNodes[0].firstChild,nodeText=n.hasOwnProperty("text");n;){if(i=n.firstChild,FirstSeries?(l=o(),d=f.GetSeriesIndexByLabel(l,!t),0>d&&t&&(d=m_SeriesCount,++m_SeriesCount,m_SeriesLabels[d]=l),i=i.nextSibling):d=0,0>d)throw 0;s=+o(),i=i.nextSibling,c=+o(),r||(i=i.nextSibling,u=+o()),f.AddXYZValue(d,s,c,u),n=n.nextSibling}return p},LoadXYDataFromXML:function(e,t){return this.DoLoadXYZDataFromXML(e,t,1)},LoadXYZDataFromXML:function(e,t){return DoLoadXYZDataFromXML(e,t,0)},AddXYZValue:function(e,t,r,o){var n=this;n.prepareValues(),n.values[e].push({x:t,y:r,z:o})},EmptyValues:function(){var e=this;e.values=[],e.prepareValues()}},prototypeCopyExtend(Chart,CanvasBox),gr.dom.Report=Report}(),function(e,t){"use strict";var r=gr.helper,o=gr.common,n=(gr.enum_,gr.const_),i=r.penStyleText,a=r.fontCSSText,l=r.pixelsToHtml,s=r.colorValue2Html,c=r.assignObject,u=r.compareObject,d=r.parseXML,f=r.xmlToReportDataJSON,p=r.addEvent,h=o.HtmlStyles,g=function(e,t){var r,o,n=this;n.obj=e,n.index=t,e.FreeCell?e.isSingleDockControl()&&(o=e.Controls.items[0],o.TextFormat&&(n.TextFormat={},n.TextFormat.ForeColor=o.ForeColor,c(n.TextFormat,o.TextFormat)),r=n.padding={},r.Left=o.PaddingLeft,r.Right=o.PaddingRight,r.Top=o.PaddingTop,r.Bottom=o.PaddingBottom):(n.TextFormat={},c(n.TextFormat,e.TextFormat),n.TextFormat.ForeColor=e.ForeColor,r=n.padding={},r.Left=e.PaddingLeft,r.Right=e.PaddingRight,r.Top=e.PaddingTop,r.Bottom=e.PaddingBottom),e.BorderCustom?(n.border={},c(n.border,e.Border)):n.ownerGrid=e.ownerGrid(),n.toFillBack=e.toFillBack(),n.toFillBack&&(n.BackColor=e.BackColor)};g.prototype={compare:function(e){var t=this,r=new g(e);return u(t.padding,r.padding)&&u(t.TextFormat,r.TextFormat)&&u(t.border,r.border)&&t.toFillBack===r.toFillBack&&t.BackColor===r.BackColor&&t.ownerGrid===r.ownerGrid},get className(){return"-grcell"+this.index},getStyles:function(){var e=this,t=e.TextFormat,r=new h;return t&&(r.addTextFormat(e,1),r.addObjectPadding(e)),e.border?r.addBorder(e.border):r.addCellBorder(e.ownerGrid),e.toFillBack&&r.addBackColor(e.BackColor),r}};var m=function(e,t){var r=this,o=r.padding={},n=e.getUsingFont();r.obj=e,r.index=t,r.asCell=!!e.cell,e.TextFormat&&(r.TextFormat={},r.TextFormat.ForeColor=e.ForeColor,c(r.TextFormat,e.TextFormat)),o.Left=e.PaddingLeft,o.Right=e.PaddingRight,o.Top=e.PaddingTop,o.Bottom=e.PaddingBottom,r.border={},c(r.border,e.Border),r.toFillBack=e.toFillBack(),
r.toFillBack&&(r.BackColor=e.BackColor2()),r.textdecoration={Underline:n.Underline,Strikethrough:n.Strikethrough}};m.prototype={compare:function(e){var t=this,r=new m(e);return u(t.padding,r.padding)&&u(t.TextFormat,r.TextFormat)&&u(t.border,r.border)&&u(t.textdecoration,r.textdecoration)&&t.toFillBack===r.toFillBack&&t.BackColor===r.BackColor&&t.asCell===r.asCell},get className(){return"-grctrl"+this.index},getStyles:function(){var e=this,t=e.textdecoration,r=new h;return!e.asCell&&r.add("position","absolute"),r.addObjectPadding(e),r.addBorder(e.border),e.TextFormat&&r.addTextFormat(e,e.asCell),e.toFillBack&&r.addBackColor(e.BackColor),(t.Underline||t.Strikethrough)&&r.add("text-decoration",(t.Underline?"underline":"")+(t.Underline&&t.Strikethrough?" ":"")+(t.Strikethrough?"line-through":"")),r}};var C=function(e,t){var r=this;r.index=t,r.Left=e.pxRect.left,r.Top=e.pxRect.top,r.Width=e.getContentWidth(),r.Height=e.getContentHeight()};C.prototype={compare:function(e){var t=this;return t.Left===e.pxRect.left&&t.Top===e.pxRect.top&&t.Width===e.getContentWidth()&&t.Height===e.getContentHeight()},get className(){return"-grpos"+this.index},getStyles:function(){var e=this,t=new h;return t.add("left",l(e.Left)),t.add("top",l(e.Top)),t.add("width",l(e.Width)),t.add("height",l(e.Height)),t}};var b=function(e,t){function r(){var e,t=o.report.viewer;o.ShowColLine&&(e=new h,e.add("border-right",i(o.ColLinePen)),t.addCustomStyle(e,w(n)+" td:last-child")),o.ShowRowLine&&n.isLastRow&&(e=new h,e.add("border-bottom",i(o.RowLinePen)),t.addCustomStyle(e,w(n)+" td"))}var o,n=this,a=e.cells?e:0;n.index=t,n.section=e,n.isLastRow=1,n.Height=e.CanShrink?0:e.pxHeight,a&&(e=a.section,n.isLastRow=e.tableRows[e.tableRows.length-1]===a),e.Font.font&&(n.Font={},c(n.Font,e.Font.font)),e.owner.Header&&(o=e.owner.owner,n.detailgrid=o),!e.toFillBack()||a&&!o||(n.BackColor=e.BackColor),o&&o.report.fixed&&r()};b.prototype={compare:function(e){var t,r,o=this,n=e.cells?e:0,i=e.CanShrink?0:e.pxHeight,a=1;return n&&(e=e.section,a=e.tableRows[e.tableRows.length-1]===n),t=e.toFillBack()&&(!n||e.owner.Header),r=e.Font.font,o.Height===i&&(r&&o.Font&&u(r,o.Font)||!r&&!o.Font)&&(t&&o.BackColor&&o.BackColor===e.BackColor||!t&&!o.BackColor)&&(e.owner.Header&&e.owner.owner===o.detailgrid||!e.owner.Header&&!o.detailgrid)&&o.isLastRow===a},get className(){return"_grsec"+this.index},getStyles:function(){var e=this,t=e.section,r=t.pctHeight,o=e.Height,n=e.detailgrid,a=new h;return(r||o)&&a.add("height",r?r+"%":l(o)),(r||!t.cells&&t.report.viewer.options.reportFitWidth)&&a.add("width","100%"),e.Font&&(a.items=a.items.concat(x.prototype.getStyles.call(e.Font).items)),e.BackColor&&a.addBackColor(e.BackColor),e.isLastRow&&n&&n.ShowRowLine&&!n.report.fixed&&a.add("border-bottom",i(n.RowLinePen)),a}};var x=function(e,t){var r=this;r.index=t,r.Point=e.Point,r.Bold=e.Bold,r.Italic=e.Italic,r.Name=e.Name};x.prototype={compare:function(e){var t=this;return t.Point===e.Point&&t.Bold===e.Bold&&t.Italic===e.Italic&&t.Name===e.Name},get className(){return"-grfs"+this.index},getStyles:function(){var e=new h;return e.add("font",a(this)),e}};var v=function(e,t,r){var o=this;o.htmlStyles=e,t&&(o.cssName=t),r&&(o.index=r)};v.prototype={get className(){function e(){var e=t.cssName,r=e;return e instanceof Array&&(r="",e.forEach(function(e){r&&(r+=","),r+=e})),r}var t=this,r=t.index;return r>=0?"-grcs"+r:e()},getStyles:function(){return this.htmlStyles}};var S=function(e,t){var r=this;r.items=[],r.viewer=e,r.classStyle=t};S.prototype={toString:function(){for(var e,t,r=this,o=r.items,n=o.length,i=0,a="";n>i;)e=o[i++],t=(e.cssName?"":".")+r.viewer._getCSSName(e),a+=t+"{"+e.getStyles().getText()+"}",DEBUG&&(a+="\r\n");return a},select:function(e,t){var r=this;return r.viewer._getCSSName(r.selectItem(e,t))},selectItem:function(e,t){var r,o,n=this,i=n.items.length;if(t&&t.compare(e))return t;for(r=0;i>r;r++)if(o=n.items[r],o.compare(e))return o;return o=new n.classStyle(e,i),n.items.push(o),o}};var T=function(){var e=this;e.controlPosition=gr.enum_.controlLayout.auto,e.reportFitWidth=!1,e.reportFitHeight=!1,e.detailgridResize=gr.enum_.detailgridResize.asDesign,e.singleChartFill=!0,e.updateOnSize=!1,e.fixed=!1,e.fixedColsLeft=0,e.fixedColsRight=0,e.fixedFooter=1,e.selectionHighlight=!0,e.selectionCell=!1,e.selectionTextColor="rgba(255,255,255,1)",e.selectionBackColor="rgba(20,20,127,1)",e.hoverEnabled=!0,e.hoverBackColor="#eee",e.hoverTextColor="#000"};T.prototype={get fixedHeaderFooter(){return this.fixed},set fixedHeaderFooter(e){his.fixed=e}};var y=function(e){var t,r=0,o=e.length;if("string"!=typeof e)return 0;for(;o>r&&(t=e[r],/\s/g.test(t));)r++;return o>r&&"{"!==t&&"<"!==t},F=function(e){return"string"==typeof e&&"_WR_"==e.substr(0,4)?0:y(e)},w=function(e){return(e.cssName?"":".")+e.className},D=function(e,t,r,o,n){var i=this,a=0,l=34;i.running=!1,i.generated=!1,i.events={},i.viewerNo=e,i.viewerHolderID=t,i.reportSource=r,i.dataSource=o,i.alpha={background:a,border:l,stroke:l,pen:l,text:l,chartGraph:a,chartStroke:0},i.options=new T,i.attachOptions(n),i.report=new gr.dom.Report(i)};D.prototype={attachOptions:function(e){var t=this;t.stop(),e&&c(t.options,e)},loadReport:function(e,r,o){var n,i=this,a=i.report,l=e;if(r=r||r===t,o=o||o===t){try{l.responseText!==t&&(l=l.responseText),i._rawReport=l,a.load(l),i.events.onReportLoaded&&i.events.onReportLoaded(i)}catch(s){o=0,n="解析报表模板"}o&&(i.reportPrepared=!0,r&&!i.waitData&&i.generate())}else n="获取报表模板";!o&&i.displayError(n,e,1)},loadData:function(e,r,o){var n,i=this,a=e;if(r=r||r===t,o=o||o===t){try{if(a.responseText!==t&&(a=a.responseText),i._rawData=a,"string"==typeof a)if(""===a)a={};else if("{"===a.charAt(0))a=JSON.parse(a);else{if(a=a.replace(/\r\n/g,""),a=d(a),!a)throw 0;a=f(a)}i.tables=a}catch(l){o=0,n="解析报表数据"}o&&(i.dataPrepared=!0,r&&i.generate())}else n="获取报表数据";!o&&i.displayError(n,e,0)},start:function(){var t=this;t.waitData&&(t.waitData=0),t.generated||t.running||(t.running=!0,t.events.onGenerateBegin&&t.events.onGenerateBegin(t),t.reportPrepared=t.reportPrepared||!t._rs,t.dataPrepared=t.dataPrepared||!t._ds,t.reportPrepared&&t.dataPrepared?(t.events.onReportLoaded&&t.events.onReportLoaded(t),!t.waitData&&t.generate()):(t.reportPrepared||(t._rs.url?e.rubylong.ajax(t._rs,function(e,r){t.loadReport(e,1,r)},t):t.loadReport(t._rs)),t.dataPrepared||(t._ds.url?e.rubylong.ajax(t._ds,function(e,r){t.loadData(e,1,r)},t):t.loadData(t._ds))))},stop:function(e,r){var o=this,n=o.report,i=o.holder;return o.running?!1:(o.generated&&(e||(n.Clear(),o.reportPrepared=!1,o._rawReport=t),r||(o.tables=t,o.dataPrepared=!1,o._rawData=t),i&&(i.innerHTML="",DEBUG&&(document.getElementById("htmlText")&&(document.getElementById("htmlText").innerText="htmlText"),document.getElementById("stylesText")&&(document.getElementById("stylesText").innerText="stylesText"))),n.unprepare(),o.generated=!1),!0)},update:function(){var e=this;e.stop(1,1),e.generate()},generate:function(){function t(){i.fontStyles=new S(i,x),i.controlStyles=new S(i,m),i.cellStyles=new S(i,g),i.sectionStyles=new S(i,b),i.positionStyles=new S(i,C),i.customStyles=new S(i,v)}var r,o,i=this,a=i.report,l=i.options,c=document.getElementById(i.viewerHolderID);if(c||(c=document.body),i.holder=c,i.stop(1,1),i.reportPrepared&&i.dataPrepared){try{if(c.innerHTML="",DEBUG&&(i.stylesText=""),i._detailgrids=[],i._domevents=[],i.html="",t(),c.classList.add(i.selectFont2(a.Font.font)),16777215!==a.BackColor&&(c.style.backgroundColor=s(a.BackColor)),i.html=a.generateHtml(),i.generateStyles(),c.innerHTML=i.html,a.toFillHolder&&(c.style.height="100%"),a.singleChart&&(c.style.backgroundColor=s(a.singleChart.BackColor)),a.startCanvas(),i._detailgrids.forEach(function(e,t){var r=document.getElementById(i._getDetailGridID(t));p(r,"mousedown",function(t){e.onmousedown(t)})}),a._has_cb)for(r=document.querySelectorAll("."+n.CSS_CB),o=r.length;o-- >0;)p(r[o],"click",function(e){a.onCheckBoxClick(e)});i._domevents.forEach(function(e,t){for(r=document.querySelectorAll("."+i._getEventCSSName(t+1)),t=r.length;t-- >0;)switch(e.type){case 1:p(r[t],"click",function(t){e.fun(t,e.obj)});break;default:p(r[t],"dblclick",function(t){e.fun(t,e.obj)})}}),DEBUG&&(document.getElementById("htmlText")&&(document.getElementById("htmlText").innerText=i.html),document.getElementById("stylesText")&&(document.getElementById("stylesText").innerText=i.stylesText))}catch(u){c.innerHTML="生成报表时发生异常错误!<br />Error Code: "+u.number+"<br />Error Name: "+u.name+"<br />Error Message: "+u.message}i.running=!1,i.generated=!0,i.events.onGenerateEnd&&i.events.onGenerateEnd(i),l.updateOnSize&&!e.onresize&&(i._gen_w=0,i._gen_h=0,e.onresize=function(){var t=e.innerWidth,r=e.innerHeight;i.generated&&(i._gen_w==t&&i._gen_h==r||(i._gen_w=t,i._gen_h=r,i.update()))})}},generateStyles:function(){function e(e){var t=">tbody>tr";e&&(t+=">td"),t+=":hover",s+=n.CSS_DG_F+t+(i?":not(."+n.CSS_SH+")":"")+" {background-color:"+o.hoverBackColor+";color:"+o.hoverTextColor+";}\n"}var t=this,r=t.report,o=t.options,i=o.selectionHighlight,a=n.ID_REPORT_STYLE+t.viewerNo,l=document.getElementById(a),s=r.toFillHolder?"html,body{height:100%;}\n*{margin:0;padding:0;}":"";l||(l=document.createElement("STYLE"),l.id=a,document.head.appendChild(l)),r._has_cb&&(s+="."+n.CSS_CB+"{}\n"),s+=n.CSS_DG_F+"{table-layout:fixed;}\n",o.hoverEnabled&&(e(0),e(1)),i&&(s+="."+n.CSS_SH+"{ background-color:"+o.selectionBackColor+";color:"+o.selectionTextColor+";}\n"),l.innerHTML=[s,t.fontStyles,t.positionStyles,t.sectionStyles,t.cellStyles,t.controlStyles,t.customStyles,t.getDomEventStyles()].join(""),DEBUG&&(t.stylesText=l.innerHTML)},getDomEventStyles:function(){for(var e=this,t=e._domevents.length,r="";t>0;)r+="."+e._getEventCSSName(t--)+"{}\n";return r},addCustomStyle:function(e,t){var r=this.customStyles.items,o=new v(e,t);return r.push(o),!t&&(o.index=r.length),o},selectCell:function(e){return this.cellStyles.select(e,e.defaultStyle)},selectCellItem:function(e){return this.cellStyles.selectItem(e)},selectControl:function(e){return this.controlStyles.select(e,e.defaultStyle)},selectControlItem:function(e){return this.controlStyles.selectItem(e)},selectSection:function(e){return this.sectionStyles.select(e,e.defaultStyle)},selectSectionItem:function(e){return this.sectionStyles.selectItem(e)},selectPosition:function(e){return this.positionStyles.select(e,e.defaultPositionStyle)},selectPositionItem:function(e){return this.positionStyles.selectItem(e)},selectFont:function(e,t){return this.fontStyles.select(e,t)},selectFont2:function(e){var t=this;return t._getCSSName(t.selectFontItem(e))},selectFontItem:function(e){return this.fontStyles.selectItem(e)},displayError:function(e,r,o){var i,a=this,l=r.responseText!==t,s=l?o?a._rs:a._ds:t;i='<div style="background-color:#bbffbb"><h3>'+e+"失败,锐浪HTML5报表("+n.VERSION+")</h3>",s&&(i+='<div>URL: <a href="'+s.url+'">'+s.url+"</a></div>"),l?(i+="<div>HTTP Status: "+r.status+"</div><div>HTTP Status Text: "+r.statusText+"</div>",r.responseText&&(i+="<div>HTTP Response Text: <pre>"+r.responseText+"</pre></div>")):i+="string"==typeof r?"<div>Loaded Text: <pre>"+r+"</pre></div>":"<div>Loaded Json Object: <pre>"+JSON.stringify(r)+"</pre></div>",i+="</div>",a.holder.innerHTML=i},_getEventCSSName:function(e){var t=this.viewerNo,r="_grec"+e;return t&&(r+="-"+t),r},_getCSSName:function(e){var t=this.viewerNo,r=e.className;return t&&(r="_"+t+r),r},_getDetailGridID:function(e){var t=this.viewerNo,r=n.ID_DETAILGRID+e;return t&&(r+="-"+t),r},get reportURL(){var e=this._rs;return e?e.url:""},set reportURL(e){var t=this;t._rs={},t._rs.url=e},get dataURL(){var e=this._ds;return e?e.url:""},set dataURL(e){var t=this;t._ds={},t._ds.url=e},get reportSource(){return this._rs},set reportSource(e){var t=this;e&&(t._rs={},F(e)?t._rs.url=e:e.url?c(t._rs,e):t._rs=e)},get dataSource(){return this._ds},set dataSource(e){var t=this;e&&(t._ds={},y(e)?t._ds.url=e:e.url?c(t._ds,e):t._ds=e)},get reportText(){var e=this._rawReport;return"string"!=typeof e&&(e=JSON.stringify(e)),e},get dataText(){var e=this._rawData;return"string"!=typeof e&&(e=JSON.stringify(e)),e}},e.rubylong={grhtml5:{controlLayout:gr.enum_.controlLayout,detailgridResize:gr.enum_.detailgridResize,barcodeURL:"/html5/General/Barcode.ashx",Viewer:D,helper:r,utility:gr.Utility,holderIDs:[],insertReportViewer:function(t,r,o,n){var i=e.rubylong.grhtml5.holderIDs,a=i.indexOf(t);return 0>a&&(a=i.length,i.push(t)),new D(a,t,r,o,n)},createReport:function(){return new gr.dom.Report}},ajax:function(e,t,r,o){function n(e,t){return t?t:/.grf|.txt|.xml|.json/.test(e)?"GET":"POST"}var i,a=new XMLHttpRequest;if(a.onreadystatechange=function(){4==a.readyState&&a.status>0&&t.call(r,a,200==a.status)},a.onerror=function(){t.call(r,a,0)},"string"==typeof e&&(e={url:e}),e.method||(e.method=n(e.url,o)),a.open(e.method,e.url,!0),i=e.headers,i&&"object"==typeof i)for(var l in i)a.setRequestHeader(l,i[l]);a.send(e.data)}},"classList"in document.documentElement||Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){function e(e){return function(r){var o=t.className.split(/\s+/g),n=o.indexOf(r);e(o,n,r),t.className=o.join(" ")}}var t=this;return{add:e(function(e,t,r){~t||e.push(r)}),remove:e(function(e,t){~t&&e.splice(t,1)}),toggle:e(function(e,t,r){~t?e.splice(t,1):e.push(r)}),contains:function(e){return!!~t.className.split(/\s+/g).indexOf(e)},item:function(e){return t.className.split(/\s+/g)[e]||null}}}})}(window);