///<summary>Used to copy a report object when creating new QueryObjects.</summary> public ReportObject DeepCopyReportObject() { ReportObject reportObj = new ReportObject(); reportObj._sectionType = this._sectionType; reportObj._location = new Point(this._location.X, this._location.Y); reportObj._size = new Size(this._size.Width, this._size.Height); reportObj._name = this._name; reportObj._reportObjectType = this._reportObjectType; reportObj._font = (Font)this._font.Clone(); reportObj._contentAlignment = this._contentAlignment; reportObj._foreColor = this._foreColor; reportObj._staticText = this._staticText; reportObj._stringFormat = this._stringFormat; reportObj._suppressIfDuplicate = this._suppressIfDuplicate; reportObj._floatLineThickness = this._floatLineThickness; reportObj._fieldDefKind = this._fieldDefKind; reportObj._fieldValueType = this._fieldValueType; reportObj._specialFieldType = this._specialFieldType; reportObj._summaryOperation = this._summaryOperation; reportObj._lineOrientation = this._lineOrientation; reportObj._linePosition = this._linePosition; reportObj._intLinePercent = this._intLinePercent; reportObj._offSetX = this._offSetX; reportObj._offSetY = this._offSetY; reportObj._isUnderlined = this._isUnderlined; reportObj._summarizedFieldName = this._summarizedFieldName; reportObj._dataFieldName = this._dataFieldName; reportObj._summaryOrientation = this._summaryOrientation; List <int> summaryGroupsNew = new List <int>(); if (this._summaryGroupValues != null) { for (int i = 0; i < this._summaryGroupValues.Count; i++) { summaryGroupsNew.Add(this._summaryGroupValues[i]); } } reportObj._summaryGroupValues = summaryGroupsNew; return(reportObj); }
private List<string> GetDisplayString(string rawText,string prevDisplayText,ReportObject reportObject,int i) { string displayText=""; List<string> retVals=new List<string>(); if(reportObject.FieldValueType==FieldValueType.Age) { displayText=Patients.AgeToString(Patients.DateToAge(PIn.Date(rawText)));//(fieldObject.FormatString); } else if(reportObject.FieldValueType==FieldValueType.Boolean) { displayText=PIn.Bool(_reportTable.Rows[i][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString();//(fieldObject.FormatString); if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.Bool(_reportTable.Rows[i-1][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(); } } else if(reportObject.FieldValueType==FieldValueType.Date) { displayText=PIn.DateT(_reportTable.Rows[i][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.DateT(_reportTable.Rows[i-1][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); } } else if(reportObject.FieldValueType==FieldValueType.Integer) { displayText=PIn.Long(_reportTable.Rows[i][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.Long(_reportTable.Rows[i-1][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); } } else if(reportObject.FieldValueType==FieldValueType.Number) { displayText=PIn.Double(_reportTable.Rows[i][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.Double(_reportTable.Rows[i-1][_arrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); } } else if(reportObject.FieldValueType==FieldValueType.String) { displayText=rawText; if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=_reportTable.Rows[i-1][_arrDataFields.IndexOf(reportObject.DataField)].ToString(); } } retVals.Add(displayText); retVals.Add(prevDisplayText); return retVals; }
///<summary>Add a label to a summaryfield based on the orientation given.</summary> public void AddSummaryLabel(string dataFieldName,string summaryText,SummaryOrientation summaryOrientation,bool hasWordWrap,Font font) { Graphics grfx=Graphics.FromImage(new Bitmap(1,1)); ReportObject summaryField=GetObjectByName(dataFieldName+"Footer"); Size size; if(hasWordWrap) { size=new Size(summaryField.Size.Width,(int)(grfx.MeasureString(summaryText,font,summaryField.Size.Width).Height/grfx.DpiY*100+2)); } else { size=new Size((int)(grfx.MeasureString(summaryText,font).Width/grfx.DpiX*100+2),(int)(grfx.MeasureString(summaryText,font).Height/grfx.DpiY*100+2)); } if(summaryOrientation==SummaryOrientation.North) { ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer" ,summaryField.Location ,size ,summaryText ,font ,summaryField.ContentAlignment); summaryLabel.DataField=dataFieldName; summaryLabel.SummaryOrientation=summaryOrientation; _reportObjects.Insert(_reportObjects.IndexOf(summaryField),summaryLabel); } else if(summaryOrientation==SummaryOrientation.South) { ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer" ,summaryField.Location ,size ,summaryText ,font ,summaryField.ContentAlignment); summaryLabel.DataField=dataFieldName; summaryLabel.SummaryOrientation=summaryOrientation; _reportObjects.Add(summaryLabel); } else if(summaryOrientation==SummaryOrientation.West) { ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer" ,new Point(summaryField.Location.X-size.Width) ,size ,summaryText ,font ,summaryField.ContentAlignment); summaryLabel.DataField=dataFieldName; summaryLabel.SummaryOrientation=summaryOrientation; _reportObjects.Insert(_reportObjects.IndexOf(summaryField),summaryLabel); } else { ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer" ,new Point(summaryField.Location.X+size.Width+summaryField.Size.Width) ,size ,summaryText ,font ,summaryField.ContentAlignment); summaryLabel.DataField=dataFieldName; summaryLabel.SummaryOrientation=summaryOrientation; _reportObjects.Insert(_reportObjects.IndexOf(summaryField)+1,summaryLabel); } grfx.Dispose(); }
///<summary>Used to copy a report object when creating new QueryObjects.</summary> public ReportObject DeepCopyReportObject() { ReportObject reportObj=new ReportObject(); reportObj._sectionName=this._sectionName; reportObj._location=new Point(this._location.X,this._location.Y); reportObj._size=new Size(this._size.Width,this._size.Height); reportObj._name=this._name; reportObj._reportObjectKind=this._reportObjectKind; reportObj._font=(Font)this._font.Clone(); reportObj._contentAlignment=this._contentAlignment; reportObj._foreColor=this._foreColor; reportObj._staticText=this._staticText; reportObj._stringFormat=this._stringFormat; reportObj._suppressIfDuplicate=this._suppressIfDuplicate; reportObj._floatLineThickness=this._floatLineThickness; reportObj._fieldDefKind=this._fieldDefKind; reportObj._fieldValueType=this._fieldValueType; reportObj._specialFieldType=this._specialFieldType; reportObj._summaryOperation=this._summaryOperation; reportObj._lineOrientation=this._lineOrientation; reportObj._linePosition=this._linePosition; reportObj._intLinePercent=this._intLinePercent; reportObj._offSetX=this._offSetX; reportObj._offSetY=this._offSetY; reportObj._isUnderlined=this._isUnderlined; reportObj._summarizedFieldName=this._summarizedFieldName; reportObj._dataFieldName=this._dataFieldName; reportObj._summaryOrientation=this._summaryOrientation; List<int> summaryGroupsNew=new List<int>(); if(this._summaryGroupValues!=null) { for(int i=0;i<this._summaryGroupValues.Count;i++) { summaryGroupsNew.Add(this._summaryGroupValues[i]); } } reportObj._summaryGroupValues=summaryGroupsNew; return reportObj; }
///<summary></summary> public void Insert(int index,ReportObject value){ List.Insert(index,value); }
///<summary></summary> public int IndexOf(ReportObject value){ return(List.IndexOf(value)); }
///<summary></summary> public int Add(ReportObject value){ return(List.Add(value)); }
///<summary></summary> public void Insert(int index, ReportObject value) { List.Insert(index, value); }
///<summary></summary> public int IndexOf(ReportObject value) { return(List.IndexOf(value)); }
///<summary></summary> public int Add(ReportObject value) { return(List.Add(value)); }
private List<string> GetDisplayString(string rawText,string prevDisplayText,ReportObject reportObject,int i,QueryObject queryObj,bool isExport) { string displayText=""; List<string> retVals=new List<string>(); DataTable dt=queryObj.ReportTable; //For exporting, we need to use the ExportTable which is the data that is visible to the user. Using ReportTable would show raw query data (potentially different than what the user sees). if(isExport) { dt=queryObj.ExportTable; } if(reportObject.FieldValueType==FieldValueType.Age) { displayText=Patients.AgeToString(Patients.DateToAge(PIn.Date(rawText)));//(fieldObject.FormatString); } else if(reportObject.FieldValueType==FieldValueType.Boolean) { if(PIn.Bool(dt.Rows[i][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString())) { displayText="X"; } else { displayText=""; } if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.Bool(dt.Rows[i-1][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(); } } else if(reportObject.FieldValueType==FieldValueType.Date) { displayText=PIn.DateT(dt.Rows[i][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.DateT(dt.Rows[i-1][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); } } else if(reportObject.FieldValueType==FieldValueType.Integer) { displayText=PIn.Long(dt.Rows[i][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.Long(dt.Rows[i-1][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); } } else if(reportObject.FieldValueType==FieldValueType.Number) { displayText=PIn.Double(dt.Rows[i][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=PIn.Double(dt.Rows[i-1][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString()).ToString(reportObject.StringFormat); } } else if(reportObject.FieldValueType==FieldValueType.String) { displayText=rawText; if(i>0 && reportObject.SuppressIfDuplicate) { prevDisplayText=dt.Rows[i-1][queryObj.ArrDataFields.IndexOf(reportObject.DataField)].ToString(); } } retVals.Add(displayText); retVals.Add(prevDisplayText); return retVals; }
private List<string> GetDisplayString(string rawText,string prevDisplayText,ReportObject reportObject,int i,QueryObject queryObj) { return GetDisplayString(rawText,prevDisplayText,reportObject,i,queryObj,false); }