本文整理汇总了C#中OpenDental.UI.ODGrid.BeginUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# ODGrid.BeginUpdate方法的具体用法?C# ODGrid.BeginUpdate怎么用?C# ODGrid.BeginUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenDental.UI.ODGrid
的用法示例。
在下文中一共展示了ODGrid.BeginUpdate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGridHelper
private void DrawGridHelper(Graphics g,int i) {
if(listFields.SelectedIndices.Contains(i)) {
_argsDF.pen=_argsDF.penRed;
_argsDF.brush=_argsDF.brushRed;
}
else {
_argsDF.pen=_argsDF.penBlack;
_argsDF.brush=_argsDF.brushBlue;
}
List<DisplayField> Columns=SheetUtil.GetGridColumnsAvailable(SheetDefCur.SheetFieldDefs[i].FieldName);
//fGrid.Columns=SheetGridDefs.GetColumnsAvailable(fGrid.GridType);
ODGrid odGrid=new ODGrid();
odGrid.Width=0;
for(int c=0;c<Columns.Count;c++){
odGrid.Width+=Columns[c].ColumnWidth;
}
odGrid.HideScrollBars=true;
#region Fill Grid
odGrid.BeginUpdate();
odGrid.Columns.Clear();
ODGridColumn col;
for(int c=0;c<Columns.Count;c++) {
col=new ODGridColumn(Columns[c].Description,Columns[c].ColumnWidth);
odGrid.Columns.Add(col);
}
ODGridRow row=new ODGridRow();//Add dummy row
for(int c=0;c<Columns.Count;c++) {
row.Cells.Add(" ");//add dummy row.
}
odGrid.Rows.Add(row);
odGrid.EndUpdate();//Calls ComputeRows and ComputeColumns, meaning the RowHeights int[] has been filled.
#endregion
int yPosGrid=SheetDefCur.SheetFieldDefs[i].YPos;
if(SheetDefCur.SheetFieldDefs[i].FieldName=="StatementPayPlan") {
SizeF sSize=g.MeasureString("Payment Plans",new Font(FontFamily.GenericSansSerif,10,FontStyle.Bold));
g.FillRectangle(Brushes.White,SheetDefCur.SheetFieldDefs[i].XPos,yPosGrid,odGrid.Width,odGrid.TitleHeight);
g.DrawString("Payment Plans",new Font(FontFamily.GenericSansSerif,10,FontStyle.Bold),new SolidBrush(Color.Black),SheetDefCur.SheetFieldDefs[i].XPos+(SheetDefCur.SheetFieldDefs[i].Width-sSize.Width)/2,yPosGrid);
yPosGrid+=odGrid.TitleHeight;
}
odGrid.PrintHeader(g,SheetDefCur.SheetFieldDefs[i].XPos,yPosGrid);
yPosGrid+=odGrid.HeaderHeight;
odGrid.PrintRow(0,g,SheetDefCur.SheetFieldDefs[i].XPos,yPosGrid,false,true);//a single dummy row.
yPosGrid+=odGrid.RowHeights[0]+2;
#region drawFooter
if(SheetDefCur.SheetFieldDefs[i].FieldName=="StatementPayPlan") {
RectangleF rf=new RectangleF(SheetDefCur.Width-SheetDefCur.SheetFieldDefs[i].Width-60,yPosGrid,SheetDefCur.SheetFieldDefs[i].Width,odGrid.TitleHeight);
g.FillRectangle(Brushes.White,rf);
StringFormat sf=new StringFormat();
sf.Alignment=StringAlignment.Far;
g.DrawString("Payment Plan Amount Due: "+"0.00",new Font(FontFamily.GenericSansSerif,10,FontStyle.Bold),new SolidBrush(Color.Black),rf,sf);
}
#endregion
if(listFields.SelectedIndices.Contains(i)) {
g.DrawRectangle(_argsDF.penRedThick,
SheetDefCur.SheetFieldDefs[i].XPos,
SheetDefCur.SheetFieldDefs[i].YPos,
SheetDefCur.SheetFieldDefs[i].Width,
SheetDefCur.SheetFieldDefs[i].Height);
}
//g.DrawRectangle(_argsDF.pen,SheetDefCur.SheetFieldDefs[i].XPos,SheetDefCur.SheetFieldDefs[i].YPos,
// SheetDefCur.SheetFieldDefs[i].Width,SheetDefCur.SheetFieldDefs[i].Height);
//g.DrawString("Grid:"+SheetGridDefs.GetName(SheetDefCur.SheetFieldDefs[i].GridDef),Font,_argsDF.brush,SheetDefCur.SheetFieldDefs[i].XPos,SheetDefCur.SheetFieldDefs[i].YPos);
}
示例2: GenerateProceduresIntoPdf
///<summary>Creates a new .pdf file containing all of the procedures attached to this appointment and
///returns the contents of the .pdf file as a base64 encoded string.</summary>
private string GenerateProceduresIntoPdf(){
MigraDoc.DocumentObjectModel.Document doc=new MigraDoc.DocumentObjectModel.Document();
doc.DefaultPageSetup.PageWidth=Unit.FromInch(8.5);
doc.DefaultPageSetup.PageHeight=Unit.FromInch(11);
doc.DefaultPageSetup.TopMargin=Unit.FromInch(.5);
doc.DefaultPageSetup.LeftMargin=Unit.FromInch(.5);
doc.DefaultPageSetup.RightMargin=Unit.FromInch(.5);
MigraDoc.DocumentObjectModel.Section section=doc.AddSection();
MigraDoc.DocumentObjectModel.Font headingFont=MigraDocHelper.CreateFont(13,true);
MigraDoc.DocumentObjectModel.Font bodyFontx=MigraDocHelper.CreateFont(9,false);
string text;
//Heading---------------------------------------------------------------------------------------------------------------
#region printHeading
Paragraph par=section.AddParagraph();
ParagraphFormat parformat=new ParagraphFormat();
parformat.Alignment=ParagraphAlignment.Center;
parformat.Font=MigraDocHelper.CreateFont(10,true);
par.Format=parformat;
text=Lan.g(this,"procedures").ToUpper();
par.AddFormattedText(text,headingFont);
par.AddLineBreak();
text=pat.GetNameFLFormal();
par.AddFormattedText(text,headingFont);
par.AddLineBreak();
text=DateTime.Now.ToShortDateString();
par.AddFormattedText(text,headingFont);
par.AddLineBreak();
par.AddLineBreak();
#endregion
//Procedure List--------------------------------------------------------------------------------------------------------
#region Procedure List
ODGrid gridProg=new ODGrid();
this.Controls.Add(gridProg);//Only added temporarily so that printing will work. Removed at end with Dispose().
gridProg.BeginUpdate();
gridProg.Columns.Clear();
ODGridColumn col;
List<DisplayField> fields=DisplayFields.GetDefaultList(DisplayFieldCategory.None);
for(int i=0;i<fields.Count;i++){
if(fields[i].InternalName=="User" || fields[i].InternalName=="Signed"){
continue;
}
if(fields[i].Description==""){
col=new ODGridColumn(fields[i].InternalName,fields[i].ColumnWidth);
}
else{
col=new ODGridColumn(fields[i].Description,fields[i].ColumnWidth);
}
if(fields[i].InternalName=="Amount"){
col.TextAlign=HorizontalAlignment.Right;
}
if(fields[i].InternalName=="ADA Code")
{
col.TextAlign=HorizontalAlignment.Center;
}
gridProg.Columns.Add(col);
}
gridProg.NoteSpanStart=2;
gridProg.NoteSpanStop=7;
gridProg.Rows.Clear();
List <Procedure> procsForDay=Procedures.GetProcsForPatByDate(AptCur.PatNum,AptCur.AptDateTime);
for(int i=0;i<procsForDay.Count;i++){
Procedure proc=procsForDay[i];
ProcedureCode procCode=ProcedureCodes.GetProcCodeFromDb(proc.CodeNum);
Provider prov=Providers.GetProv(proc.ProvNum);
Userod usr=Userods.GetUser(proc.UserNum);
ODGridRow row=new ODGridRow();
row.ColorLborder=System.Drawing.Color.Black;
for(int f=0;f<fields.Count;f++) {
switch(fields[f].InternalName){
case "Date":
row.Cells.Add(proc.ProcDate.Date.ToShortDateString());
break;
case "Time":
row.Cells.Add(proc.ProcDate.ToString("h:mm")+proc.ProcDate.ToString("%t").ToLower());
break;
case "Th":
row.Cells.Add(proc.ToothNum);
break;
case "Surf":
row.Cells.Add(proc.Surf);
break;
case "Dx":
row.Cells.Add(proc.Dx.ToString());
break;
case "Description":
row.Cells.Add((procCode.LaymanTerm!="")?procCode.LaymanTerm:procCode.Descript);
break;
case "Stat":
row.Cells.Add(Lans.g("enumProcStat",proc.ProcStatus.ToString()));
break;
case "Prov":
if(prov.Abbr.Length>5){
row.Cells.Add(prov.Abbr.Substring(0,5));
}
else{
row.Cells.Add(prov.Abbr);
}
break;
//.........这里部分代码省略.........
示例3: GetGridForPrinting
///<summary>This is a modified version of FormTimeCard.FillMain(). It fills one time card per employee.</summary>
private ODGrid GetGridForPrinting(Employee emp) {
ODGrid gridTimeCard=new ODGrid();
List<ClockEvent> clockEventList=ClockEvents.Refresh(emp.EmployeeNum,PIn.Date(textDateStart.Text),PIn.Date(textDateStop.Text),false);
List<TimeAdjust> timeAdjustList=TimeAdjusts.Refresh(emp.EmployeeNum,PIn.Date(textDateStart.Text),PIn.Date(textDateStop.Text));
ArrayList mergedAL=new ArrayList();
for(int i=0;i<clockEventList.Count;i++) {
mergedAL.Add(clockEventList[i]);
}
for(int i=0;i<timeAdjustList.Count;i++) {
mergedAL.Add(timeAdjustList[i]);
}
IComparer myComparer=new ObjectDateComparer();
mergedAL.Sort(myComparer);
gridTimeCard.BeginUpdate();
gridTimeCard.Columns.Clear();
ODGridColumn col=new ODGridColumn(Lan.g(this,"Date"),70);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Weekday"),70);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"In"),60,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Out"),60,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Total"),50,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Adjust"),55,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Rate2"),55,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Overtime"),55,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Daily"),50,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Weekly"),50,HorizontalAlignment.Right);
gridTimeCard.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Note"),5);
gridTimeCard.Columns.Add(col);
gridTimeCard.Rows.Clear();
ODGridRow row;
TimeSpan[] weeklyTotals=new TimeSpan[mergedAL.Count];
TimeSpan alteredSpan=new TimeSpan(0);//used to display altered times
TimeSpan oneSpan=new TimeSpan(0);//used to sum one pair of clock-in/clock-out
TimeSpan oneAdj;
TimeSpan oneOT;
TimeSpan daySpan=new TimeSpan(0);//used for daily totals.
TimeSpan weekSpan=new TimeSpan(0);//used for weekly totals.
if(mergedAL.Count>0){
weekSpan=ClockEvents.GetWeekTotal(emp.EmployeeNum,GetDateForRow(0,mergedAL));
}
TimeSpan periodSpan=new TimeSpan(0);//used to add up totals for entire page.
TimeSpan otspan=new TimeSpan(0);//overtime for the entire period
TimeSpan rate2span=new TimeSpan(0);//rate2 hours total
Calendar cal=CultureInfo.CurrentCulture.Calendar;
CalendarWeekRule rule=CultureInfo.CurrentCulture.DateTimeFormat.CalendarWeekRule;
DateTime curDate=DateTime.MinValue;
DateTime previousDate=DateTime.MinValue;
Type type;
ClockEvent clock;
TimeAdjust adjust;
for(int i=0;i<mergedAL.Count;i++){
row=new ODGridRow();
type=mergedAL[i].GetType();
row.Tag=mergedAL[i];
previousDate=curDate;
//clock event row---------------------------------------------------------------------------------------------
if(type==typeof(ClockEvent)){
clock=(ClockEvent)mergedAL[i];
curDate=clock.TimeDisplayed1.Date;
if(curDate==previousDate){
row.Cells.Add("");
row.Cells.Add("");
}
else{
row.Cells.Add(curDate.ToShortDateString());
row.Cells.Add(curDate.DayOfWeek.ToString());
}
//altered--------------------------------------
//deprecated
//status--------------------------------------
//row.Cells.Add(clock.ClockStatus.ToString());
//in------------------------------------------
row.Cells.Add(clock.TimeDisplayed1.ToShortTimeString());
if(clock.TimeEntered1!=clock.TimeDisplayed1){
row.Cells[row.Cells.Count-1].ColorText = Color.Red;
}
//out-----------------------------
if(clock.TimeDisplayed2.Year<1880){
row.Cells.Add("");//not clocked out yet
}
else{
row.Cells.Add(clock.TimeDisplayed2.ToShortTimeString());
if (clock.TimeEntered2!=clock.TimeDisplayed2)
{
row.Cells[row.Cells.Count-1].ColorText = Color.Red;
}
}
//total-------------------------------
if(clock.TimeDisplayed2.Year<1880){
row.Cells.Add("");
//.........这里部分代码省略.........
示例4: CreateDocument
//.........这里部分代码省略.........
par.AddFormattedText(Lan.g(this, "61-90"), font);
cell = row.Cells[3];
par = cell.AddParagraph();
par.AddFormattedText(Lan.g(this, "over 90"), font);
row = table.AddRow();
row.Format.Alignment = ParagraphAlignment.Center;
row.Borders.Left.Color = Colors.Gray;
row.Borders.Bottom.Color = Colors.Gray;
row.Borders.Right.Color = Colors.Gray;
font = MigraDocHelper.CreateFont(9);
text= PatGuar.Bal_0_30.ToString("F");
cell = row.Cells[0];
par = cell.AddParagraph();
par.AddFormattedText(text, font);
text = PatGuar.Bal_31_60.ToString("F");
cell = row.Cells[1];
par = cell.AddParagraph();
par.AddFormattedText(text, font);
text = PatGuar.Bal_61_90.ToString("F");
cell = row.Cells[2];
par = cell.AddParagraph();
par.AddFormattedText(text, font);
text = PatGuar.BalOver90.ToString("F");
cell = row.Cells[3];
par = cell.AddParagraph();
par.AddFormattedText(text, font);
}
/*
ODGridColumn gcol;
ODGridRow grow;
if(!Stmt.HidePayment) {
ODGrid gridAging=new ODGrid();
this.Controls.Add(gridAging);
gridAging.BeginUpdate();
gridAging.Columns.Clear();
gcol=new ODGridColumn(Lan.g(this,"0-30"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
gcol=new ODGridColumn(Lan.g(this,"31-60"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
gcol=new ODGridColumn(Lan.g(this,"61-90"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
gcol=new ODGridColumn(Lan.g(this,"over 90"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
if(PrefC.GetBool(PrefName.BalancesDontSubtractIns")) {//less common
gcol=new ODGridColumn(Lan.g(this,"Balance"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
gcol=new ODGridColumn(Lan.g(this,"InsPending"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
gcol=new ODGridColumn(Lan.g(this,"AfterIns"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
}
else{//more common
gcol=new ODGridColumn(Lan.g(this,"Total"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
gcol=new ODGridColumn(Lan.g(this,"- InsEst"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
gcol=new ODGridColumn(Lan.g(this,"= Balance"),70,HorizontalAlignment.Center);
gridAging.Columns.Add(gcol);
}
gridAging.Rows.Clear();
//Annual max--------------------------
grow=new ODGridRow();
grow.Cells.Add(PatGuar.Bal_0_30.ToString("F"));
grow.Cells.Add(PatGuar.Bal_31_60.ToString("F"));
grow.Cells.Add(PatGuar.Bal_61_90.ToString("F"));
grow.Cells.Add(PatGuar.BalOver90.ToString("F"));
示例5: CreateDocument
//.........这里部分代码省略.........
float yPos=toothChart.Height+15;
float xPos=225;
MigraDocHelper.FillRectangle(frame,DefC.Short[(int)DefCat.ChartGraphicColors][3].ItemColor,xPos,yPos,14,14);
xPos+=16;
MigraDocHelper.DrawString(frame,Lan.g(this,"Existing"),bodyFontx,xPos,yPos);
Graphics g=this.CreateGraphics();//for measuring strings.
xPos+=(int)g.MeasureString(Lan.g(this,"Existing"),bodyFont).Width+23;
//The Complete work is actually a combination of EC and C. Usually same color.
//But just in case they are different, this will show it.
MigraDocHelper.FillRectangle(frame,DefC.Short[(int)DefCat.ChartGraphicColors][2].ItemColor,xPos,yPos,7,14);
xPos+=7;
MigraDocHelper.FillRectangle(frame,DefC.Short[(int)DefCat.ChartGraphicColors][1].ItemColor,xPos,yPos,7,14);
xPos+=9;
MigraDocHelper.DrawString(frame,Lan.g(this,"Complete"),bodyFontx,xPos,yPos);
xPos+=(int)g.MeasureString(Lan.g(this,"Complete"),bodyFont).Width+23;
MigraDocHelper.FillRectangle(frame,DefC.Short[(int)DefCat.ChartGraphicColors][4].ItemColor,xPos,yPos,14,14);
xPos+=16;
MigraDocHelper.DrawString(frame,Lan.g(this,"Referred Out"),bodyFontx,xPos,yPos);
xPos+=(int)g.MeasureString(Lan.g(this,"Referred Out"),bodyFont).Width+23;
MigraDocHelper.FillRectangle(frame,DefC.Short[(int)DefCat.ChartGraphicColors][0].ItemColor,xPos,yPos,14,14);
xPos+=16;
MigraDocHelper.DrawString(frame,Lan.g(this,"Treatment Planned"),bodyFontx,xPos,yPos);
g.Dispose();
}
}
#endregion
MigraDocHelper.InsertSpacer(section,10);
MigraDocHelper.DrawGrid(section,gridMain);
//Print benefits----------------------------------------------------------------------------------------------------
#region printBenefits
if(checkShowIns.Checked) {
ODGrid gridFamIns=new ODGrid();
this.Controls.Add(gridFamIns);
gridFamIns.BeginUpdate();
gridFamIns.Columns.Clear();
ODGridColumn col=new ODGridColumn("",140);
gridFamIns.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Primary"),70,HorizontalAlignment.Right);
gridFamIns.Columns.Add(col);
col=new ODGridColumn(Lan.g(this,"Secondary"),70,HorizontalAlignment.Right);
gridFamIns.Columns.Add(col);
gridFamIns.Rows.Clear();
ODGridRow row;
//Annual Family Max--------------------------
row=new ODGridRow();
row.Cells.Add(Lan.g(this,"Family Maximum"));
row.Cells.Add(textFamPriMax.Text);
row.Cells.Add(textFamSecMax.Text);
gridFamIns.Rows.Add(row);
//Family Deductible--------------------------
row=new ODGridRow();
row.Cells.Add(Lan.g(this,"Family Deductible"));
row.Cells.Add(textFamPriDed.Text);
row.Cells.Add(textFamSecDed.Text);
gridFamIns.Rows.Add(row);
//Print Family Insurance-----------------------
MigraDocHelper.InsertSpacer(section,15);
par=section.AddParagraph();
par.Format.Alignment=ParagraphAlignment.Center;
par.AddFormattedText(Lan.g(this,"Family Dental Insurance Benefits"),totalFontx);
MigraDocHelper.InsertSpacer(section,2);
MigraDocHelper.DrawGrid(section,gridFamIns);
gridFamIns.Dispose();
//Individual Insurance---------------------
ODGrid gridIns=new ODGrid();
this.Controls.Add(gridIns);
示例6: CalculateGridHeightHelper
///<summary>Calculates height of grid taking into account page breaks, word wrapping, cell width, font size, and actual data to be used to fill this grid.</summary>
private static int CalculateGridHeightHelper(SheetField field,Sheet sheet,Graphics g,Statement stmt,int topMargin,int bottomMargin,MedLab medLab) {
UI.ODGrid odGrid=new UI.ODGrid();
odGrid.FontForSheets=new Font(field.FontName,field.FontSize,field.FontIsBold?FontStyle.Bold:FontStyle.Regular);
odGrid.Width=field.Width;
odGrid.HideScrollBars=true;
odGrid.YPosField=field.YPos;
odGrid.TopMargin=topMargin;
odGrid.BottomMargin=bottomMargin;
odGrid.PageHeight=sheet.HeightPage;
odGrid.Title=field.FieldName;
if(stmt!=null) {
odGrid.Title+=(stmt.Intermingled?".Intermingled":".NotIntermingled");//Important for calculating heights.
}
DataTable Table=SheetUtil.GetDataTableForGridType(field.FieldName,stmt,medLab);
List<DisplayField> Columns=SheetUtil.GetGridColumnsAvailable(field.FieldName);
#region Fill Grid
odGrid.BeginUpdate();
odGrid.Columns.Clear();
ODGridColumn col;
for(int i=0;i<Columns.Count;i++) {
col=new ODGridColumn(Columns[i].InternalName,Columns[i].ColumnWidth);
odGrid.Columns.Add(col);
}
ODGridRow row;
for(int i=0;i<Table.Rows.Count;i++) {
row=new ODGridRow();
for(int c=0;c<Columns.Count;c++) {//Selectively fill columns from the dataTable into the odGrid.
row.Cells.Add(Table.Rows[i][Columns[c].InternalName].ToString());
}
if(Table.Columns.Contains("PatNum")) {//Used for statments to determine account splitting.
row.Tag=Table.Rows[i]["PatNum"].ToString();
}
odGrid.Rows.Add(row);
}
odGrid.EndUpdate(true);//Calls ComputeRows and ComputeColumns, meaning the RowHeights int[] has been filled.
#endregion
return odGrid.PrintHeight;
}
示例7: drawFieldGrid
public static void drawFieldGrid(SheetField field,Sheet sheet,Graphics g,XGraphics gx,Statement stmt=null,MedLab medLab=null) {
_printMargin.Top=40;
if(sheet.SheetType==SheetTypeEnum.MedLabResults) {
_printMargin.Top=120;
}
UI.ODGrid odGrid=new UI.ODGrid();//Only used for measurements, also contains printing/drawing logic.
odGrid.FontForSheets=new Font(field.FontName,field.FontSize,field.FontIsBold?FontStyle.Bold:FontStyle.Regular);
int _yAdjCurRow=0;//used to adjust for Titles, Headers, Rows, and footers (all considered part of the same row).
odGrid.Width=0;
List<DisplayField> Columns=SheetUtil.GetGridColumnsAvailable(field.FieldName);
foreach(DisplayField Col in Columns) {
odGrid.Width+=Col.ColumnWidth;
}
odGrid.Height=field.Height;
odGrid.HideScrollBars=true;
odGrid.YPosField=field.YPos;
odGrid.Title=field.FieldName;
if(stmt!=null) {
odGrid.Title+=(stmt.Intermingled?".Intermingled":".NotIntermingled");//Important for calculating heights.
}
odGrid.TopMargin=_printMargin.Top;
odGrid.BottomMargin=_printMargin.Bottom;
odGrid.PageHeight=sheet.HeightPage;
DataTable Table=SheetUtil.GetDataTableForGridType(field.FieldName,stmt,medLab);
#region Fill Grid, Set Text Alignment
odGrid.BeginUpdate();
odGrid.Columns.Clear();
ODGridColumn col;
for(int i=0;i<Columns.Count;i++) {
col=new ODGridColumn(Columns[i].Description,Columns[i].ColumnWidth);
switch(field.FieldName+"."+Columns[i].InternalName) {//Unusual switch statement to differentiate similar column names in different grids.
case "StatementMain.charges":
case "StatementMain.credits":
case "StatementMain.balance":
case "StatementPayPlan.charges":
case "StatementPayPlan.credits":
case "StatementPayPlan.balance":
col.TextAlign=HorizontalAlignment.Right;
break;
case "StatementAging.Age00to30":
case "StatementAging.Age31to60":
case "StatementAging.Age61to90":
case "StatementAging.Age90plus":
case "StatementEnclosed.AmountDue":
case "StatementEnclosed.DateDue":
col.TextAlign=HorizontalAlignment.Center;
break;
default:
col.TextAlign=HorizontalAlignment.Left;
break;
}
odGrid.Columns.Add(col);
}
ODGridRow row;
for(int i=0;i<Table.Rows.Count;i++) {
row=new ODGridRow();
for(int c=0;c<Columns.Count;c++) {//Selectively fill columns from the dataTable into the odGrid.
row.Cells.Add(Table.Rows[i][Columns[c].InternalName].ToString());
}
if(Table.Columns.Contains("PatNum")) {//Used for statments to determine account splitting.
row.Tag=Table.Rows[i]["PatNum"].ToString();
}
odGrid.Rows.Add(row);
}
odGrid.EndUpdate(true);//Calls ComputeRows and ComputeColumns, meaning the RowHeights int[] has been filled.
#endregion
for(int i=0;i<odGrid.RowHeights.Length;i++) {
if(_isPrinting
&& (odGrid.PrintRows[i].YPos-_printMargin.Top<_yPosPrint //rows at the end of previous page
|| odGrid.PrintRows[i].YPos-sheet.HeightPage+_printMargin.Bottom>_yPosPrint))
{
continue;//continue because we do not want to draw rows from other pages.
}
_yAdjCurRow=0;
//if(odGrid.PrintRows[i].YPos<_yPosPrint
// || odGrid.PrintRows[i].YPos-_yPosPrint>sheet.HeightPage) {
// continue;//skip rows on previous page and rows on next page.
//}
#region Draw Title
if(odGrid.PrintRows[i].IsTitleRow) {
switch(field.FieldName) {//Draw titles differently for different grids.
case "StatementMain":
Patient pat=Patients.GetPat(PIn.Long(Table.Rows[i]["PatNum"].ToString()));
string patName="";
if(pat!=null) {//should always be true
patName=pat.GetNameFLnoPref();
}
if(gx==null) {
g.FillRectangle(Brushes.White,field.XPos-10,odGrid.PrintRows[i].YPos-_yPosPrint,odGrid.Width,odGrid.TitleHeight);
g.DrawString(patName,new Font("Arial",10,FontStyle.Bold),new SolidBrush(Color.Black),field.XPos-10,odGrid.PrintRows[i].YPos-_yPosPrint);
}
else {
gx.DrawRectangle(Brushes.White,p(field.XPos-10),p(odGrid.PrintRows[i].YPos-_yPosPrint-1),p(odGrid.Width),p(odGrid.TitleHeight));
using(Font _font=new Font("Arial",10,FontStyle.Bold)) {
GraphicsHelper.DrawStringX(gx,Graphics.FromImage(new Bitmap(100,100)),(double)((1d)/p(1)),patName,new XFont(_font.FontFamily.ToString(),_font.Size,XFontStyle.Bold),XBrushes.Black,new XRect(p(field.XPos-10),p(odGrid.PrintRows[i].YPos-_yPosPrint-1),p(300),p(100)),XStringAlignment.Near);
//gx.DrawString(patName,new XFont(_font.FontFamily.ToString(),_font.Size,XFontStyle.Bold),new SolidBrush(Color.Black),field.XPos-10,yPosGrid);
}
}
break;
case "StatementPayPlan":
//.........这里部分代码省略.........