public double EvaluateDouble(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return double.NaN;

			Row startrow=null;
			foreach (Row r in re)
			{
				startrow = r;			// We just want the first row
				break;
			}
			double currentValue = _Expr.EvaluateDouble(rpt, row);
			WorkClass wc = GetValue(rpt);
			if (row == startrow)
			{
				// must be the start of a new group
				wc.Value = currentValue;
				wc.Count = 1;
			}
			else
			{
				wc.Value = ((double) wc.Value + currentValue);
				wc.Count++;
			}

			return (double) wc.Value / wc.Count;
		}
		public object Evaluate(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return null;

			object v = GetValue(rpt);
			if (v == null)
			{
				object min_value=null;
				object current_value;

				foreach (Row r in re)
				{
					current_value = _Expr.Evaluate(rpt, r);
					if (current_value == null)
						continue;
					else if (min_value == null)
						min_value = current_value;
					else if (Filter.ApplyCompare(_tc, min_value, current_value) > 0)
						min_value = current_value;
				}
				v = min_value;
				if (bSave)
					SetValue(rpt, v);
			}
			return v;
		}
		public object Evaluate(Report rpt, Row row)
		{
			object v = null;
			if (row == null)
				return null;
			bool bSave=true;
			RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return null;

			Row crow=null;
			bool bNext=false;
			foreach (Row r in re)
			{
				if (bNext)
				{
					crow = r;
					break;
				}
				if (r == row)
					bNext = true;
			}
			if (crow != null)
				v = _Expr.Evaluate(rpt, crow);
			return v;
		}
		public object Evaluate(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return null;

			Row startrow=null;
			foreach (Row r in re)
			{
				startrow = r;			// We just want the first row
				break;
			}

			object current_value = _Expr.Evaluate(rpt, row);
			if (row == startrow)
			{}
			else
			{
				object v = GetValue(rpt);
				if (current_value == null)
					return v;
				else if (v == null)
				{}	// use the current_value
				else if (Filter.ApplyCompare(_tc, v, current_value) < 0)
				{}	// use the current_value
				else
					return v;
			}
			SetValue(rpt, current_value);
			return current_value;
		}
		public string EvaluateString(Report rpt, Row row)
		{
			if (rpt == null || rpt.ClientLanguage == null)
				return CultureInfo.CurrentCulture.ThreeLetterISOLanguageName;
			else
				return rpt.ClientLanguage;
		}
Пример #6
0
		public RenderXml(Report rep, IStreamGen sg)
		{
			r = rep;
			tw = sg.GetTextWriter();
			stkReportItem = new Stack();
			stkContainers = new Stack();
		}
		public string EvaluateString(Report rpt, Row row)
		{
			if (rpt == null || rpt.UserID == null)
				return Environment.UserName;
			else
				return rpt.UserID;
		}
		public void CleanUp(Report rpt)		// closes any connections
		{
			foreach (DataSourceDefn ds in _Items.Values)
			{
				ds.CleanUp(rpt);
			}
		}
		// Evaluate is for interpretation  (and is relatively slow)
		public object Evaluate(Report rpt, Row row)
		{
			double d = EvaluateDouble(rpt, row);
			if (d.CompareTo(double.NaN) == 0)
				return null;
			return (object) d;
		}
Пример #10
0
        private void bRefreshParms_Click(object sender, System.EventArgs e)
        {
            // Obtain the source
            string filename = "";

            if (tbReportFile.Text.Length > 0)
            {
                filename = tbReportFile.Text + ".rdlc";
            }

            string source = this.GetSource(filename);

            if (source == null)
            {
                return;                                                         // error: message already displayed
            }
            // Compile the report
            Oranikle.Report.Engine.Report report = this.GetReport(source, filename);
            if (report == null)
            {
                return;                                                 // error: message already displayed
            }
            ICollection rps = report.UserReportParameters;

            string[] rowValues = new string[2];
            _DataTable.Rows.Clear();
            foreach (UserReportParameter rp in rps)
            {
                rowValues[0] = rp.Name;
                rowValues[1] = "";

                _DataTable.Rows.Add(rowValues);
            }
            this.dgParms.Refresh();
        }
Пример #11
0
		public float GetX2(Report rpt)
		{
			float x2=GetOffsetCalc(rpt)+LeftCalc(rpt);
			if (Width != null)
				x2 += Width.Points;
			return x2;
		}		
		public void SupplyValues(Report rpt, out string[] displayValues, out object[] dataValues)
		{
			displayValues = new string[_Items.Count];
			dataValues = new object[_Items.Count];
			int index=0;
			// go thru the parameters extracting the data values
			foreach (ParameterValue pv in _Items)
			{
				if (pv.Value == null)
					dataValues[index] = null;
				else
					dataValues[index] = pv.Value.Evaluate(rpt, null);
				if (pv.Label == null)
				{	// if label is null use the data value; if not provided use ""
					if (dataValues[index] == null)
						displayValues[index] = "";
					else
						displayValues[index] = dataValues[index].ToString();
				}
				else
				{
					displayValues[index] = pv.Label.EvaluateString(rpt, null);
					if (displayValues[index] == null)
						displayValues[index] = "";
				}
				index++;
			}
			return;
		}
		public int EvaluateInt32(Report rpt, Row row)
		{
			bool bSave=true;
			RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return 0;

			int v = GetValue(rpt);
			if (v < 0)
			{
				object temp;
				int count = Math.Max(2, re.LastRow - re.FirstRow);
				Hashtable ht = new Hashtable(count);
				foreach (Row r in re)
				{
					temp = _Expr.Evaluate(rpt, r);
					if (temp != null)
					{
						object o = ht[temp];	// search for it
						if (o == null)			// if not found; add it to the hash table
						{
							ht.Add(temp, temp);
						}
					}
				}
				v = ht.Count;
				if (bSave)
					SetValue(rpt, v);
			}
			return  v;
		}
		public DynamicExpression(Report rpt, ReportLink p, string expr, Row row)
		{
			_Source=expr;
			_Expr = null;
            _rl = p;
            _Type = DoParse(rpt);
		}
		public double EvaluateDouble(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return double.NaN;

			ODouble v = GetValueDouble(rpt);
			if (v != null)
				return v.d;

			double sum=0;
			int count=0;
			double temp;
			foreach (Row r in re)
			{
				temp = _Expr.EvaluateDouble(rpt, r);
				if (temp.CompareTo(double.NaN) != 0)
				{
					sum += temp;
					count++;
				}
			}
			double result;
			if (count > 0)
				result = (sum/count);
			else
				result = double.NaN;

			if (bSave)
				SetValue(rpt, result);

			return result;
		}
		// 
		public virtual object Evaluate(Report rpt, Row row)
		{
			if (row == null)
				return null;
			Field f;
			string field = _ArgExpr.EvaluateString(rpt, row);
			if (field == null)
				return null;
			f = _Fields[field] as Field;
			if (f == null)
				return null;

			object o;
			if (f.Value != null)
				o = f.Value.Evaluate(rpt, row);
			else
				o = row.Data[f.ColumnNumber];

			if (o == DBNull.Value)
				return null;

			if (f.RunType == TypeCode.String && o is char)	// work around; mono odbc driver confuses string and char
				o = Convert.ChangeType(o, TypeCode.String);
			
			return o;
		}
Пример #17
0
		public void Save(Report rpt, System.IO.Stream stream, ImageFormat im)
		{
			if (_bm == null)
				Draw(rpt);
            _mf.Save(stream, im);
	//		_bm.Save(stream, im);
		}
		public int EvaluateInt32(Report rpt, Row row)
		{
			bool bSave=true;
			IEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return int.MinValue;

			Row startrow=null;
			foreach (Row r in re)
			{
				startrow = r;			// We just want the first row
				break;
			}

			int count;

			object currentValue = _Expr.Evaluate(rpt, row);
			int incr = currentValue == null? 0: 1;
			if (row == startrow)
			{
				// must be the start of a new group
				count = incr;
			}
			else
			{
				count = GetValue(rpt) + incr;
			}

			SetValue(rpt, count);
			return count;
		}
        string _TableSyntax;        //  syntax for the table position; table contains {x} items holding a
                                    //   spot for each _ris;
        public TablePositioner(Report rpt, ReportItems ris)
        {
            _rpt = rpt;
            _ris = ris;
            _values = new string[ris.Items.Count];

            _TableSyntax = BuildTable();
        }
Пример #20
0
        string SheetName;                   // current sheetname

		public RenderExcel(Report rep, IStreamGen sg)
		{
			r = rep;
			_sg = sg;					// We need this in future

            _Excel = new ExcelValet();

        }
		public ProcessReport(Report rep)
		{
			if (rep.rl.MaxSeverity > 4)
				throw new Exception("Report has errors.  Cannot be processed.");

			r = rep;
			_sg = null;
		}
		public ProcessReport(Report rep, IStreamGen sg)
		{
			if (rep.rl.MaxSeverity > 4)
				throw new Exception("Report has errors.  Cannot be processed.");

			r = rep;
			_sg = sg;
		}
Пример #23
0
		public void Load(Report rpt)
		{
			foreach (ReportClass rc in _Items)
			{
				rc.Load(rpt);
			}
			return;
		}
Пример #24
0
		float _PageWidth;				// default width for all pages
	
		public Pages(Report r)
		{
			_report = r;
            _pages = new List<Page>();	// array of Page objects

			_bm = new Bitmap(10, 10);	// create a small bitmap to base our graphics
			_g = Graphics.FromImage(_bm);
		}
		int _SkipMatrixCols=0;		// # of matrix columns to skip

		public RenderHtmlTable(Report rep, IStreamGen sg)
		{
			r = rep;
			_sg = sg;					// We need this in future

			tw = new StringWriter();	// will hold the bulk of the HTML until we generate
			// final file
			_styles = new Hashtable();
		}
		// 
		public object Evaluate(Report rpt, Row row)
		{
			double di = _expr[0].EvaluateDouble(rpt, row);
			int i = (int) di;		// force it to integer; we'll accept truncation
			if (i >= _expr.Length || i <= 0)
				return null;
			
			return _expr[i].Evaluate(rpt, row);
		}
		public bool EvaluateBoolean(Report rpt, Row row)
		{
			object left = _lhs.Evaluate(rpt, row);
			object right = _rhs.Evaluate(rpt, row);
			if (Filter.ApplyCompare(_lhs.GetTypeCode(), left, right) <= 0)
				return true;
			else
				return false;
		}
		public bool GetData(Report rpt)
		{
            bool haveRows = false;
			foreach (DataSetDefn ds in _Items.Values)
			{
				haveRows |= ds.GetData(rpt);
			}

			return haveRows;
		}
Пример #29
0
		override public void Draw(Report rpt)
		{
			CreateSizedBitmap();

            using (Graphics g1 = Graphics.FromImage(_bm))
            {
                _aStream = new System.IO.MemoryStream();
                IntPtr HDC = g1.GetHdc();
                _mf = new System.Drawing.Imaging.Metafile(_aStream, HDC, new RectangleF(0, 0, _bm.Width, _bm.Height), System.Drawing.Imaging.MetafileFrameUnit.Pixel);
                g1.ReleaseHdc(HDC);
            }

            using (Graphics g = Graphics.FromImage(_mf))
			{
                // 06122007AJM Used to Force Higher Quality
                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
                g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
			
				// Adjust the top margin to depend on the title height
				Size titleSize = DrawTitleMeasure(rpt, g, ChartDefn.Title);
				Layout.TopMargin = titleSize.Height;

				DrawChartStyle(rpt, g);
				
				// Draw title; routine determines if necessary
				DrawTitle(rpt, g, ChartDefn.Title, new System.Drawing.Rectangle(0, 0, _bm.Width, Layout.TopMargin));

				// Draw legend
				System.Drawing.Rectangle lRect = DrawLegend(rpt, g, false, true);

				// Adjust the bottom margin to depend on the Category Axis
				Size caSize = CategoryAxisSize(rpt, g);
				Layout.BottomMargin = caSize.Height;

				// 20022008 AJM GJL - Added required info
				AdjustMargins(lRect,rpt,g);		// Adjust margins based on legend.

				// Draw Plot area
				DrawPlotAreaStyle(rpt, g, lRect);

				// Draw Category Axis
				if (caSize.Height > 0)
					DrawCategoryAxis(rpt, g,  
						new System.Drawing.Rectangle(Layout.LeftMargin, _bm.Height-Layout.BottomMargin, _bm.Width - Layout.LeftMargin - Layout.RightMargin, caSize.Height));

				if (ChartDefn.Type == ChartTypeEnum.Doughnut)
					DrawPlotAreaDoughnut(rpt, g);
				else 
					DrawPlotAreaPie(rpt, g);

				DrawLegend(rpt, g, false, false);
			}
		}
		public int EvaluateInt32(Report rpt, Row row)
		{
			bool bSave=true;
			RowEnumerable re = this.GetDataScope(rpt, row, out bSave);
			if (re == null)
				return 0;

			int count = re.LastRow - re.FirstRow + 1;

			return count;
		}
Пример #31
0
		public bool Apply(Report rpt, Row datarow)
		{
			foreach (Filter f in _Items)
			{
				if (!f.FilterOperatorSingleRow)		// have to handle Top/Bottom in ApplyFinalFilters
					return true;
				if (!f.Apply(rpt, datarow))
					return false;
			}
			return true;
		}
        private void bRefreshParms_Click(object sender, System.EventArgs e)
        {
            // Obtain the source
            Cursor savec = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;                // this can take some time
            try
            {
                string filename = "";
                if (tbReportFile.Text.Length > 0)
                {
                    filename = tbReportFile.Text + ".rdl";
                }

                filename = GetFileNameWithPath(filename);

                string source = this.GetSource(filename);
                if (source == null)
                {
                    return;                                                             // error: message already displayed
                }
                // Compile the report
                Oranikle.Report.Engine.Report report = this.GetReport(source, filename);
                if (report == null)
                {
                    return;                                                     // error: message already displayed
                }
                ICollection rps       = report.UserReportParameters;
                string[]    rowValues = new string[3];
                _DataTable.Rows.Clear();
                foreach (UserReportParameter rp in rps)
                {
                    rowValues[0] = rp.Name;
                    rowValues[1] = "";
                    rowValues[2] = "false";

                    _DataTable.Rows.Add(rowValues);
                }
                this.dgParms.Refresh();
                this.dgParms.Focus();
            }
            finally
            {
                Cursor.Current = savec;
            }
        }
Пример #33
0
        public MatrixEntry GetME(Report rpt)
        {
            WorkClass wc = GetWC(rpt);

            return(wc.ME);
        }
Пример #34
0
        public void SetME(Report rpt, MatrixEntry me)
        {
            WorkClass wc = GetWC(rpt);

            wc.ME = me;
        }
Пример #35
0
 // Evaluate is for interpretation  (and is relatively slow)
 public object Evaluate(Report rpt, Row row)
 {
     return(EvaluateDouble(rpt, row));
 }
Пример #36
0
        public bool EvaluateBoolean(Report rpt, Row row)
        {
            double result = EvaluateDouble(rpt, row);

            return(Convert.ToBoolean(result));
        }
Пример #37
0
        public string EvaluateString(Report rpt, Row row)
        {
            double result = EvaluateDouble(rpt, row);

            return(result.ToString());
        }
 private void SetValue(Report rpt, object o)
 {
     rpt.Cache.AddReplace(_key, o);
 }
Пример #39
0
        public string EvaluateString(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(result.ToString());
        }
Пример #40
0
        public bool EvaluateBoolean(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(Convert.ToBoolean(result));
        }
Пример #41
0
 private void RemoveWC(Report rpt)
 {
     rpt.Cache.Remove(this, "wc");
 }
        public DateTime EvaluateDateTime(Report rpt, Row row)
        {
            object result = Evaluate(rpt, row);

            return(Convert.ToDateTime(result));
        }
 private void SetValue(Report rpt, double d)
 {
     rpt.Cache.AddReplace(_key, new ODouble(d));
 }
Пример #44
0
        public int EvaluateInt32(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(Convert.ToInt32(result));
        }
 public int EvaluateInt32(Report rpt, Row row)
 {
     return(int.MinValue);
 }
 public decimal EvaluateDecimal(Report rpt, Row row)
 {
     return(decimal.MinValue);
 }
 public double EvaluateDouble(Report rpt, Row row)
 {
     return(double.MinValue);
 }
Пример #48
0
 // Evaluate is for interpretation  (and is relatively slow)
 public object Evaluate(Report rpt, Row row)
 {
     return(EvaluateDecimal(rpt, row));
 }
Пример #49
0
        public decimal EvaluateDecimal(Report rpt, Row row)
        {
            double result = EvaluateDouble(rpt, row);

            return(Convert.ToDecimal(result));
        }
Пример #50
0
        public DateTime EvaluateDateTime(Report rpt, Row row)
        {
            decimal result = EvaluateDecimal(rpt, row);

            return(Convert.ToDateTime(result));
        }
Пример #51
0
        public int EvaluateInt32(Report rpt, Row row)
        {
            double result = EvaluateDouble(rpt, row);

            return(Convert.ToInt32(result));
        }
Пример #52
0
        public float GetXOffset(Report rpt)
        {
            OFloat of = rpt.Cache.Get(this, "xoffset") as OFloat;

            return(of == null? 0: of.f);
        }
        private object GetValue(Report rpt)
        {
            object oi = rpt.Cache.Get(_key);

            return(oi);
        }
 private ODouble GetValue(Report rpt)
 {
     return(rpt.Cache.Get(_key) as ODouble);
 }
 public string EvaluateString(Report rpt, Row row)
 {
     return(null);
 }
 public void ClearCache(Report rpt)
 {
     rpt.Cache.Remove(_key);
 }
 public DateTime EvaluateDateTime(Report rpt, Row row)
 {
     return(DateTime.MinValue);
 }