Esempio n. 1
0
 private void FillGrid()
 {
     int scrollVal=gridMain.ScrollValue;
     gridMain.BeginUpdate();
     gridMain.Columns.Clear();
     ODGridColumn col;
     col=new ODGridColumn(Lan.g(this,"FieldName"),140);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Current Value"),175);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Entered Value"),175);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Import Value"),175);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Do Import"),60,HorizontalAlignment.Center);
     gridMain.Columns.Add(col);
     gridMain.Rows.Clear();
     ODGridRow row;
     ODGridCell cell;
     for(int i=0;i<rows.Count;i++) {
         row=new ODGridRow();
         if(rows[i].IsSeparator) {
             row.Cells.Add(rows[i].FieldName);
             row.Cells.Add("");
             row.Cells.Add("");
             row.Cells.Add("");
             row.Cells.Add("");
             row.ColorBackG=Color.DarkSlateGray;
             row.ColorText=Color.White;
         }
         else {
             if(rows[i].FieldDisplay!=null) {
                 row.Cells.Add(rows[i].FieldDisplay);
             }
             else {
                 row.Cells.Add(rows[i].FieldName);
             }
             row.Cells.Add(rows[i].OldValDisplay);
             cell=new ODGridCell(rows[i].NewValDisplay);
             if(rows[i].IsFlagged) {
                 cell.ColorText=Color.Firebrick;
                 cell.Bold=YN.Yes;
             }
             row.Cells.Add(cell);
             cell=new ODGridCell(rows[i].ImpValDisplay);
             if(rows[i].IsFlaggedImp) {
                 cell.ColorText=Color.Firebrick;
                 cell.Bold=YN.Yes;
             }
             row.Cells.Add(cell);
             if(rows[i].DoImport) {
                 row.Cells.Add("X");
                 row.ColorBackG=Color.FromArgb(225,225,225);
             }
             else {
                 row.Cells.Add("");
             }
         }
         gridMain.Rows.Add(row);
     }
     gridMain.EndUpdate();
     gridMain.ScrollValue=scrollVal;
 }
Esempio n. 2
0
		///<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("");
					}
					else{
						oneSpan=clock.TimeDisplayed2-clock.TimeDisplayed1;
						row.Cells.Add(ClockEvents.Format(oneSpan));
						daySpan+=oneSpan;
						weekSpan+=oneSpan;
						periodSpan+=oneSpan;
					}
					//Adjust---------------------------------
					oneAdj=TimeSpan.Zero;
					if(clock.AdjustIsOverridden) {
						oneAdj+=clock.Adjust;
					}
					else {
						oneAdj+=clock.AdjustAuto;//typically zero
					}
					daySpan+=oneAdj;
					weekSpan+=oneAdj;
					periodSpan+=oneAdj;
					row.Cells.Add(ClockEvents.Format(oneAdj));
					if(clock.AdjustIsOverridden) {
						row.Cells[row.Cells.Count-1].ColorText = Color.Red;
					}
					//Rate2---------------------------------
					if(clock.Rate2Hours!=TimeSpan.FromHours(-1)) {
						rate2span+=clock.Rate2Hours;
						row.Cells.Add(ClockEvents.Format(clock.Rate2Hours));
						row.Cells[row.Cells.Count-1].ColorText = Color.Red;
					}
					else {
						rate2span+=clock.Rate2Auto;
						row.Cells.Add(ClockEvents.Format(clock.Rate2Auto));
					}
					//Overtime------------------------------
					oneOT=TimeSpan.Zero;
					if(clock.OTimeHours!=TimeSpan.FromHours(-1)) {//overridden
						oneOT=clock.OTimeHours;
					}
					else {
						oneOT=clock.OTimeAuto;//typically zero
					}
					otspan+=oneOT;
					daySpan-=oneOT;
					weekSpan-=oneOT;
					periodSpan-=oneOT;
					row.Cells.Add(ClockEvents.Format(oneOT));
					if(clock.OTimeHours!=TimeSpan.FromHours(-1)) {//overridden
						row.Cells[row.Cells.Count-1].ColorText = Color.Red;
					}
					//Daily-----------------------------------
					//if this is the last entry for a given date
					if(i==mergedAL.Count-1//if this is the last row
						|| GetDateForRow(i+1,mergedAL) != curDate)//or the next row is a different date
					{
						row.Cells.Add(ClockEvents.Format(daySpan));
						daySpan=new TimeSpan(0);
					}
					else{//not the last entry for the day
						row.Cells.Add("");
					}
					//Weekly-------------------------------------
					weeklyTotals[i]=weekSpan;
					//if this is the last entry for a given week
					if(i==mergedAL.Count-1//if this is the last row 
						|| cal.GetWeekOfYear(GetDateForRow(i+1,mergedAL),rule,(DayOfWeek)PrefC.GetInt(PrefName.TimeCardOvertimeFirstDayOfWeek))//or the next row has a
						!= cal.GetWeekOfYear(clock.TimeDisplayed1.Date,rule,(DayOfWeek)PrefC.GetInt(PrefName.TimeCardOvertimeFirstDayOfWeek)))//different week of year
					{
						row.Cells.Add(ClockEvents.Format(weekSpan));
						weekSpan=new TimeSpan(0);
					}
					else {
						//row.Cells.Add(ClockEvents.Format(weekSpan));
						row.Cells.Add("");
					}
					//Note-----------------------------------------
					row.Cells.Add(clock.Note);
				}
				//adjustment row--------------------------------------------------------------------------------------
				else if(type==typeof(TimeAdjust)){
					adjust=(TimeAdjust)mergedAL[i];
					curDate=adjust.TimeEntry.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("");//3
					//in/out------------------------------------------
					row.Cells.Add("");//4
					//time-----------------------------
					row.Cells.Add(adjust.TimeEntry.ToShortTimeString());//5
					//total-------------------------------
					row.Cells.Add("");//
					//Adjust------------------------------
					daySpan+=adjust.RegHours;//might be negative
					weekSpan+=adjust.RegHours;
					periodSpan+=adjust.RegHours;
					row.Cells.Add(ClockEvents.Format(adjust.RegHours));//6
					//Rate2-------------------------------
					row.Cells.Add("");//
					//Overtime------------------------------
					otspan+=adjust.OTimeHours;
					row.Cells.Add(ClockEvents.Format(adjust.OTimeHours));//7
					//Daily-----------------------------------
					//if this is the last entry for a given date
					if(i==mergedAL.Count-1//if this is the last row
						|| GetDateForRow(i+1,mergedAL) != curDate)//or the next row is a different date
					{
						row.Cells.Add(ClockEvents.Format(daySpan));//
						daySpan=new TimeSpan(0);
					}
					else{
						row.Cells.Add("");
					}
					//Weekly-------------------------------------
					weeklyTotals[i]=weekSpan;
					//if this is the last entry for a given week
					if(i==mergedAL.Count-1//if this is the last row 
						|| cal.GetWeekOfYear(GetDateForRow(i+1,mergedAL),rule,(DayOfWeek)PrefC.GetInt(PrefName.TimeCardOvertimeFirstDayOfWeek))//or the next row has a
						!= cal.GetWeekOfYear(adjust.TimeEntry.Date,rule,(DayOfWeek)PrefC.GetInt(PrefName.TimeCardOvertimeFirstDayOfWeek)))//different week of year
					{
						ODGridCell cell=new ODGridCell(ClockEvents.Format(weekSpan));
						cell.ColorText=Color.Black;
						row.Cells.Add(cell);
						weekSpan=new TimeSpan(0);
					}
					else {
						row.Cells.Add("");
					}
					//Note-----------------------------------------
					row.Cells.Add("(Adjust)"+adjust.Note);//used to indicate adjust rows.
					row.Cells[row.Cells.Count-1].ColorText=Color.Red;
				}
				gridTimeCard.Rows.Add(row);
			}
			gridTimeCard.EndUpdate();
			totalTime=periodSpan.ToStringHmm();
			overTime=otspan.ToStringHmm();
			rate2Time=rate2span.ToStringHmm();
			totalTime2=periodSpan.TotalHours.ToString("n");
			overTime2=otspan.TotalHours.ToString("n");
			rate2Time2=rate2span.TotalHours.ToString("n");
			return gridTimeCard;
		}
Esempio n. 3
0
 ///<summary>fromDB is set to false when it is refreshing every second so that there will be no extra network traffic.</summary>
 private void FillMain(bool fromDB)
 {
     if(fromDB){
         ClockEventList=ClockEvents.Refresh(EmployeeCur.EmployeeNum,PIn.Date(textDateStart.Text),
             PIn.Date(textDateStop.Text),IsBreaks);
         if(IsBreaks){
             TimeAdjustList=new List<TimeAdjust>();
         }
         else{
             TimeAdjustList=TimeAdjusts.Refresh(EmployeeCur.EmployeeNum,PIn.Date(textDateStart.Text),
                 PIn.Date(textDateStop.Text));
         }
     }
     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);
     gridMain.BeginUpdate();
     gridMain.Columns.Clear();
     ODGridColumn col=new ODGridColumn(Lan.g(this,"Date"),70);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Weekday"),70);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Altered"),50,HorizontalAlignment.Center);
     gridMain.Columns.Add(col);
     if(IsBreaks){
         col=new ODGridColumn(Lan.g(this,"Out"),60,HorizontalAlignment.Right);
         gridMain.Columns.Add(col);
         col=new ODGridColumn(Lan.g(this,"In"),60,HorizontalAlignment.Right);
         gridMain.Columns.Add(col);
     }
     else{
         col=new ODGridColumn(Lan.g(this,"In"),60,HorizontalAlignment.Right);
         gridMain.Columns.Add(col);
         col=new ODGridColumn(Lan.g(this,"Out"),60,HorizontalAlignment.Right);
         gridMain.Columns.Add(col);
     }
     col=new ODGridColumn(Lan.g(this,"Total"),50,HorizontalAlignment.Right);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Adjust"),55,HorizontalAlignment.Right);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Overtime"),55,HorizontalAlignment.Right);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Daily"),50,HorizontalAlignment.Right);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Weekly"),50,HorizontalAlignment.Right);
     gridMain.Columns.Add(col);
     col=new ODGridColumn(Lan.g(this,"Note"),5);
     gridMain.Columns.Add(col);
     gridMain.Rows.Clear();
     ODGridRow row;
     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(EmployeeCur.EmployeeNum,GetDateForRow(0));
     }
     TimeSpan periodSpan=new TimeSpan(0);//used to add up totals for entire page.
     TimeSpan otspan=new TimeSpan(0);//overtime for the entire period
       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--------------------------------------
             string str="";
             if(clock.TimeEntered1!=clock.TimeDisplayed1){
                 if(IsBreaks){
                     str=Lan.g(this,"out");
                 }
                 else{
                     str=Lan.g(this,"in");
                 }
             }
             if(clock.TimeEntered2!=clock.TimeDisplayed2){
                 if(str!="") {
                     str+="/";
                 }
                 if(IsBreaks){
                     str+=Lan.g(this,"in");
                 }
                 else{
                     str+=Lan.g(this,"out");
                 }
             }
             row.Cells.Add(str);
             //status--------------------------------------
             //row.Cells.Add(clock.ClockStatus.ToString());
             //in------------------------------------------
             row.Cells.Add(clock.TimeDisplayed1.ToShortTimeString());
             //out-----------------------------
             if(clock.TimeDisplayed2.Year<1880){
                 row.Cells.Add("");//not clocked out yet
             }
             else{
                 row.Cells.Add(clock.TimeDisplayed2.ToShortTimeString());
             }
             //total-------------------------------
             if(IsBreaks){ //breaks
                 if(clock.TimeDisplayed2.Year<1880){
                     row.Cells.Add("");
                 }
                 else{
                     oneSpan=clock.TimeDisplayed2-clock.TimeDisplayed1;
                     row.Cells.Add(ClockEvents.Format(oneSpan));
                     daySpan+=oneSpan;
                     periodSpan+=oneSpan;
                 }
             }
             else{//regular hours
                 if(clock.TimeDisplayed2.Year<1880){
                     row.Cells.Add("");
                 }
                 else{
                     oneSpan=clock.TimeDisplayed2-clock.TimeDisplayed1;
                     row.Cells.Add(ClockEvents.Format(oneSpan));
                     daySpan+=oneSpan;
                     weekSpan+=oneSpan;
                     periodSpan+=oneSpan;
                 }
             }
             //Adjust---------------------------------
             oneAdj=TimeSpan.Zero;
             if(clock.AdjustIsOverridden) {
                 oneAdj+=clock.Adjust;
             }
             else {
                 oneAdj+=clock.AdjustAuto;//typically zero
             }
             daySpan+=oneAdj;
             weekSpan+=oneAdj;
             periodSpan+=oneAdj;
             row.Cells.Add(ClockEvents.Format(oneAdj));
             //Overtime------------------------------
             oneOT=TimeSpan.Zero;
             if(clock.OTimeHours!=TimeSpan.FromHours(-1)) {//overridden
                 oneOT=clock.OTimeHours;
             }
             else {
                 oneOT=clock.OTimeAuto;//typically zero
             }
             otspan+=oneOT;
             daySpan-=oneOT;
             weekSpan-=oneOT;
             periodSpan-=oneOT;
             row.Cells.Add(ClockEvents.Format(oneOT));
             //Daily-----------------------------------
             //if this is the last entry for a given date
             if(i==mergedAL.Count-1//if this is the last row
                 || GetDateForRow(i+1) != curDate)//or the next row is a different date
             {
                 if(IsBreaks){
                     if(clock.TimeDisplayed2.Year<1880){//if they have not clocked back in yet from break
                         //display the timespan of oneSpan using current time as the other number.
                         oneSpan=DateTime.Now-clock.TimeDisplayed1+TimeDelta;
                         row.Cells.Add(oneSpan.ToStringHmmss());
                         daySpan+=oneSpan;
                     }
                     else{
                         row.Cells.Add(ClockEvents.Format(daySpan));
                     }
                 }
                 else{
                     row.Cells.Add(ClockEvents.Format(daySpan));
                 }
                 daySpan=new TimeSpan(0);
             }
             else{//not the last entry for the day
                 row.Cells.Add("");
             }
             //Weekly-------------------------------------
             WeeklyTotals[i]=weekSpan;
             if(IsBreaks){
                 row.Cells.Add("");
             }
             //if this is the last entry for a given week
             else if(i==mergedAL.Count-1//if this is the last row
                 || cal.GetWeekOfYear(GetDateForRow(i+1),rule,DayOfWeek.Sunday)//or the next row has a
                 != cal.GetWeekOfYear(clock.TimeDisplayed1.Date,rule,DayOfWeek.Sunday))//different week of year
             {
                 row.Cells.Add(ClockEvents.Format(weekSpan));
                 weekSpan=new TimeSpan(0);
             }
             else {
                 //row.Cells.Add(ClockEvents.Format(weekSpan));
                 row.Cells.Add("");
             }
             //Note-----------------------------------------
             row.Cells.Add(clock.Note);
         }
         //adjustment row--------------------------------------------------------------------------------------
         else if(type==typeof(TimeAdjust)){
             adjust=(TimeAdjust)mergedAL[i];
             curDate=adjust.TimeEntry.Date;
             if(curDate==previousDate){
                 row.Cells.Add("");
                 row.Cells.Add("");
             }
             else{
                 row.Cells.Add(curDate.ToShortDateString());
                 row.Cells.Add(curDate.DayOfWeek.ToString());
             }
             //altered--------------------------------------
             row.Cells.Add(Lan.g(this,"Adjust"));//2
             row.ColorText=Color.Red;
             //status--------------------------------------
             //row.Cells.Add("");//3
             //in/out------------------------------------------
             row.Cells.Add("");//4
             //time-----------------------------
             row.Cells.Add(adjust.TimeEntry.ToShortTimeString());//5
             //total-------------------------------
             row.Cells.Add("");//
             //Adjust------------------------------
             daySpan+=adjust.RegHours;//might be negative
             weekSpan+=adjust.RegHours;
             periodSpan+=adjust.RegHours;
             row.Cells.Add(ClockEvents.Format(adjust.RegHours));//6
             //Overtime------------------------------
             otspan+=adjust.OTimeHours;
             row.Cells.Add(ClockEvents.Format(adjust.OTimeHours));//7
             //Daily-----------------------------------
             //if this is the last entry for a given date
             if(i==mergedAL.Count-1//if this is the last row
                 || GetDateForRow(i+1) != curDate)//or the next row is a different date
             {
                 row.Cells.Add(ClockEvents.Format(daySpan));//
                 daySpan=new TimeSpan(0);
             }
             else{
                 row.Cells.Add("");
             }
             //Weekly-------------------------------------
             WeeklyTotals[i]=weekSpan;
             if(IsBreaks){
                 row.Cells.Add("");
             }
             //if this is the last entry for a given week
             else if(i==mergedAL.Count-1//if this is the last row
                 || cal.GetWeekOfYear(GetDateForRow(i+1),rule,DayOfWeek.Sunday)//or the next row has a
                 != cal.GetWeekOfYear(adjust.TimeEntry.Date,rule,DayOfWeek.Sunday))//different week of year
             {
                 ODGridCell cell=new ODGridCell(ClockEvents.Format(weekSpan));
                 cell.ColorText=Color.Black;
                 row.Cells.Add(cell);
                 weekSpan=new TimeSpan(0);
             }
             else {
                 row.Cells.Add("");
             }
             //Note-----------------------------------------
             row.Cells.Add(adjust.Note);
         }
         gridMain.Rows.Add(row);
     }
     gridMain.EndUpdate();
     if(IsBreaks){
         textTotal.Text="";
     }
     else{
         textTotal.Text=periodSpan.ToStringHmm();
         textOvertime.Text=otspan.ToStringHmm();
         textTotal2.Text=periodSpan.TotalHours.ToString("n");
         textOvertime2.Text=otspan.TotalHours.ToString("n");
     }
 }
Esempio n. 4
0
		public void FillPtInfo() {
			if(Plugins.HookMethod(this,"ContrChart.FillPtInfo",PatCur)) {
				return;
			}
			ChartLayoutHelper.GridPtInfoSetSize(gridPtInfo,tabControlImages);
			textTreatmentNotes.Text="";
			if(PatCur==null) {
				gridPtInfo.BeginUpdate();
				gridPtInfo.Rows.Clear();
				gridPtInfo.Columns.Clear();
				gridPtInfo.EndUpdate();
				return;
			}
			else {
				textTreatmentNotes.Text=PatientNoteCur.Treatment;
				textTreatmentNotes.Enabled=true;
				textTreatmentNotes.Select(textTreatmentNotes.Text.Length+2,1);
				textTreatmentNotes.ScrollToCaret();
				TreatmentNoteChanged=false;
			}
			gridPtInfo.BeginUpdate();
			gridPtInfo.Columns.Clear();
			ODGridColumn col=new ODGridColumn("",100);//Lan.g("TableChartPtInfo",""),);
			gridPtInfo.Columns.Add(col);
			col=new ODGridColumn("",300);
			gridPtInfo.Columns.Add(col);
			gridPtInfo.Rows.Clear();
			ODGridCell cell;
			ODGridRow row;
			List<DisplayField> fields=DisplayFields.GetForCategory(DisplayFieldCategory.ChartPatientInformation);
			for(int f=0;f<fields.Count;f++) {
				row=new ODGridRow();
				//within a case statement, the row may be re-instantiated if needed, effectively removing the first cell added here:
				if(fields[f].Description=="") {
					row.Cells.Add(fields[f].InternalName);
				}
				else {
					row.Cells.Add(fields[f].Description);
				}
				int ordinal=0;
				switch(fields[f].InternalName) {
					case "Age":
						row.Cells.Add(PatientLogic.DateToAgeString(PatCur.Birthdate,PatCur.DateTimeDeceased));
						break;
					case "ABC0":
						row.Cells.Add(PatCur.CreditType);
						break;
					case "Billing Type":
						row.Cells.Add(DefC.GetName(DefCat.BillingTypes,PatCur.BillingType));
						break;
					case "Referred From":
						List<RefAttach> RefAttachList=RefAttaches.Refresh(PatCur.PatNum);
						string referral="";
						for(int i=0;i<RefAttachList.Count;i++) {
							if(RefAttachList[i].IsFrom) {
								referral=Referrals.GetNameLF(RefAttachList[i].ReferralNum);
								break;
							}
						}
						if(referral=="") {
							referral="??";
						}
						row.Cells.Add(referral);
						row.Tag=null;
						break;
					case "Date First Visit":
						if(PatCur.DateFirstVisit.Year<1880) {
							row.Cells.Add("??");
						}
						else if(PatCur.DateFirstVisit==DateTime.Today) {
							row.Cells.Add(Lan.g("TableChartPtInfo","NEW PAT"));
						}
						else {
							row.Cells.Add(PatCur.DateFirstVisit.ToShortDateString());
						}
						row.Tag=null;
						break;
					case "Prov. (Pri, Sec)":
						if(PatCur.SecProv != 0) {
							row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + Providers.GetAbbr(PatCur.SecProv));
						}
						else {
							row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + Lan.g("TableChartPtInfo","None"));
						}
						row.Tag = null;
						break;
					case "Pri Ins":
						string name;
						ordinal=PatPlans.GetOrdinal(PriSecMed.Primary,PatPlanList,PlanList,SubList);
						if(ordinal>0) {
							InsSub sub=InsSubs.GetSub(PatPlans.GetInsSubNum(PatPlanList,ordinal),SubList);
							name=InsPlans.GetCarrierName(sub.PlanNum,PlanList);
							if(PatPlanList[0].IsPending) {
								name+=Lan.g("TableChartPtInfo"," (pending)");
							}
							row.Cells.Add(name);
						}
						else {
							row.Cells.Add("");
						}
						row.Tag=null;
						break;
					case "Sec Ins":
						ordinal=PatPlans.GetOrdinal(PriSecMed.Secondary,PatPlanList,PlanList,SubList);
						if(ordinal>0) {
							InsSub sub=InsSubs.GetSub(PatPlans.GetInsSubNum(PatPlanList,ordinal),SubList);
							name=InsPlans.GetCarrierName(sub.PlanNum,PlanList);
							if(PatPlanList[1].IsPending) {
								name+=Lan.g("TableChartPtInfo"," (pending)");
							}
							row.Cells.Add(name);
						}
						else {
							row.Cells.Add("");
						}
						row.Tag=null;
						break;
					case "Payor Types":
						row.Tag="Payor Types";
						row.Cells.Add(PayorTypes.GetCurrentDescription(PatCur.PatNum));
						break;
					case "Registration Keys":
						//Not even available to most users.
						RegistrationKey[] keys=RegistrationKeys.GetForPatient(PatCur.PatNum);
						for(int i=0;i<keys.Length;i++) {
							row=new ODGridRow();
							row.Cells.Add(Lan.g("TableChartPtInfo","Registration Key"));
							string str=keys[i].RegKey.Substring(0,4)+"-"+keys[i].RegKey.Substring(4,4)+"-"
								+keys[i].RegKey.Substring(8,4)+"-"+keys[i].RegKey.Substring(12,4);
							if(keys[i].IsForeign) {
								str+="\r\nForeign";
							}
							else {
								str+="\r\nUSA";
							}
							str+="\r\nStarted: "+keys[i].DateStarted.ToShortDateString();
							if(keys[i].DateDisabled.Year>1880) {
								str+="\r\nDisabled: "+keys[i].DateDisabled.ToShortDateString();
							}
							if(keys[i].DateEnded.Year>1880) {
								str+="\r\nEnded: "+keys[i].DateEnded.ToShortDateString();
							}
							if(keys[i].Note!="") {
								str+=keys[i].Note;
							}
							row.Cells.Add(str);
							row.Tag=keys[i].Copy();
							gridPtInfo.Rows.Add(row);
						}
						break;
					case "Ehr Provider Keys":
						//Not even available to most users.
						List<EhrProvKey> listProvKeys=EhrProvKeys.RefreshForFam(PatCur.Guarantor);
						string desc="";
						for(int i=0;i<listProvKeys.Count;i++) {
							if(i>0) {
								desc+="\r\n";
							}
							desc+=listProvKeys[i].LName+", "+listProvKeys[i].FName+", "
								+(listProvKeys[i].HasReportAccess?"reports, ":"no reports, ")
								+listProvKeys[i].ProvKey;
						}
						row.Cells.Add(desc);
						row.ColorBackG=Color.PowderBlue;
						row.Tag="EhrProvKeys";
						break;
					case "Premedicate":
						if(PatCur.Premed) {
							row=new ODGridRow();
							row.Cells.Add("");
							cell=new ODGridCell();
							if(fields[f].Description=="") {
								cell.Text=fields[f].InternalName;
							}
							else {
								cell.Text=fields[f].Description;
							}
							cell.ColorText=Color.Red;
							cell.Bold=YN.Yes;
							row.Cells.Add(cell);
							row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
							row.Tag="med";
							gridPtInfo.Rows.Add(row);
						}
						break;
					case "Problems":
						List<Disease> DiseaseList=Diseases.Refresh(PatCur.PatNum,true);
						row=new ODGridRow();
						cell=new ODGridCell();
						if(fields[f].Description=="") {
							cell.Text=fields[f].InternalName;
						}
						else {
							cell.Text=fields[f].Description;
						}
						cell.Bold=YN.Yes;
						row.Cells.Add(cell);
						row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
						row.Tag="med";
						if(DiseaseList.Count>0) {
							row.Cells.Add("");
							gridPtInfo.Rows.Add(row);
						}
						else {
							row.Cells.Add(Lan.g("TableChartPtInfo","none"));
						}
						//Add a new row for each med.
						for(int i=0;i<DiseaseList.Count;i++) {
							row=new ODGridRow(); 
							if(DiseaseList[i].DiseaseDefNum!=0) {
								cell=new ODGridCell(DiseaseDefs.GetName(DiseaseList[i].DiseaseDefNum));
								cell.ColorText=Color.Red;
								cell.Bold=YN.Yes;
								row.Cells.Add(cell);
								row.Cells.Add(DiseaseList[i].PatNote);
							}
							else {
								row.Cells.Add("");
								cell=new ODGridCell(DiseaseDefs.GetItem(DiseaseList[i].DiseaseDefNum).DiseaseName);
								cell.ColorText=Color.Red;
								cell.Bold=YN.Yes;
								row.Cells.Add(cell);
								//row.Cells.Add(DiseaseList[i].PatNote);//no place to show a pat note
							}
							row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
							row.Tag="med";
							if(i!=DiseaseList.Count-1) {
								gridPtInfo.Rows.Add(row);
							}
						}
						break;
					case "Med Urgent":
						cell=new ODGridCell();
						cell.Text=PatCur.MedUrgNote;
						cell.ColorText=Color.Red;
						cell.Bold=YN.Yes;
						row.Cells.Add(cell);
						row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
						row.Tag="med";
						break;
					case "Medical Summary":
						row.Cells.Add(PatientNoteCur.Medical);
						row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
						row.Tag="med";
						break;
					case "Service Notes":
						row.Cells.Add(PatientNoteCur.Service);
						row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
						row.Tag="med";
						break;
					case "Medications":
						Medications.Refresh();
						List<MedicationPat> medList=MedicationPats.Refresh(PatCur.PatNum,false);
						row=new ODGridRow();
						cell=new ODGridCell();
						if(fields[f].Description=="") {
							cell.Text=fields[f].InternalName;
						}
						else {
							cell.Text=fields[f].Description;
						}
						cell.Bold=YN.Yes;
						row.Cells.Add(cell);
						row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
						row.Tag="med";
						if(medList.Count>0) {
							row.Cells.Add("");
							gridPtInfo.Rows.Add(row);
						}
						else {
							row.Cells.Add(Lan.g("TableChartPtInfo","none"));
						}
						string text;
						Medication med;
						for(int i=0;i<medList.Count;i++) {
							row=new ODGridRow();
							if(medList[i].MedicationNum==0) {//NewCrop medication order.
								row.Cells.Add(medList[i].MedDescript);
							}
							else {
								med=Medications.GetMedication(medList[i].MedicationNum);
								text=med.MedName;
								if(med.MedicationNum != med.GenericNum) {
									text+="("+Medications.GetMedication(med.GenericNum).MedName+")";
								}
								row.Cells.Add(text);
							}
							text=medList[i].PatNote;
							string noteMedGeneric="";
							if(medList[i].MedicationNum!=0) {
								noteMedGeneric=Medications.GetGeneric(medList[i].MedicationNum).Notes;
							}
							if(noteMedGeneric!="") {
								text+="("+noteMedGeneric+")";
							}
							row.Cells.Add(text);
							row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
							row.Tag="med";
							if(i!=medList.Count-1) {
								gridPtInfo.Rows.Add(row);
							}
						}
						break;
					case "Allergies":
						List<Allergy> allergyList=Allergies.GetAll(PatCur.PatNum,false);
						row=new ODGridRow();
						cell=new ODGridCell();
						if(fields[f].Description=="") {
							cell.Text=fields[f].InternalName;
						}
						else {
							cell.Text=fields[f].Description;
						}
						cell.Bold=YN.Yes;
						row.Cells.Add(cell);
						row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
						row.Tag="med";
						if(allergyList.Count>0) {
							row.Cells.Add("");
							gridPtInfo.Rows.Add(row);
						}
						else {
							row.Cells.Add(Lan.g("TableChartPtInfo","none"));
						}
						for(int i=0;allergyList.Count>i;i++) {
							row=new ODGridRow();
							cell=new ODGridCell(AllergyDefs.GetOne(allergyList[i].AllergyDefNum).Description);
							cell.Bold=YN.Yes;
							cell.ColorText=Color.Red;
							row.Cells.Add(cell);
							row.Cells.Add(allergyList[i].Reaction);
							row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
							row.Tag="med";
							if(i!=allergyList.Count-1) {
								gridPtInfo.Rows.Add(row);
							}
						}
						break;
					case "PatFields":
						PatField field;
						for(int i=0;i<PatFieldDefs.List.Length;i++) {
							row=new ODGridRow();
							row.Cells.Add(PatFieldDefs.List[i].FieldName);
							field=PatFields.GetByName(PatFieldDefs.List[i].FieldName,PatFieldList);
							if(field==null) {
								row.Cells.Add("");
							}
							else {
								if(PatFieldDefs.List[i].FieldType==PatFieldType.Checkbox) {
									row.Cells.Add("X");
								}
								else {
									row.Cells.Add(field.FieldValue);
								}
							}
							row.Tag="PatField"+i.ToString();
							gridPtInfo.Rows.Add(row);
						}
						break;
					case "Birthdate":
						if(PatCur.Birthdate.Year<1880) {
							row.Cells.Add("");
						}
						else {
							row.Cells.Add(PatCur.Birthdate.ToShortDateString());
						}
						break;
					case "City":
						row.Cells.Add(PatCur.City);
						break;
					case "AskToArriveEarly":
						if(PatCur.AskToArriveEarly==0) {
							row.Cells.Add("");
						}
						else {
							row.Cells.Add(PatCur.AskToArriveEarly.ToString()+" minute(s)");
						}
						break;
					case "Super Head":
						if(PatCur.SuperFamily!=0) {
							Patient tempSuper = Patients.GetPat(PatCur.SuperFamily);
							row.Cells.Add(tempSuper.GetNameLF()+" ("+tempSuper.PatNum+")");
						}
						else {
							continue;//do not allow this row to be added if there is no data to in the row.
						}
						break;
					case "Patient Portal":
						row.Tag="Patient Portal";
						if(PatCur.OnlinePassword=="") {
							row.Cells.Add(Lan.g(this,"No access"));
						}
						else {
							row.Cells.Add(Lan.g(this,"Online"));
						}
						break;
					case "References":
						List<CustRefEntry> custREList=CustRefEntries.GetEntryListForCustomer(PatCur.PatNum);
						if(custREList.Count==0) {
							row.Cells.Add(Lan.g("TablePatient","None"));
							row.Tag="References";
							row.ColorBackG=DefC.Short[(int)DefCat.MiscColors][8].ItemColor;
						}
						else {
							row.Cells.Add(Lan.g("TablePatient",""));
							row.Tag="References";
							row.ColorBackG=DefC.Short[(int)DefCat.MiscColors][8].ItemColor;
							gridPtInfo.Rows.Add(row);
						}
						for(int i=0;i<custREList.Count;i++) {
							row=new ODGridRow();
							row.Cells.Add(custREList[i].DateEntry.ToShortDateString());
							row.Cells.Add(CustReferences.GetCustNameFL(custREList[i].PatNumRef));
							row.Tag=custREList[i];
							row.ColorBackG=DefC.Short[(int)DefCat.MiscColors][8].ItemColor;
							if(i<custREList.Count-1) {
								gridPtInfo.Rows.Add(row);
							}
						}
						break;
				}
				if(fields[f].InternalName=="PatFields"
					|| fields[f].InternalName=="Premedicate"
					|| fields[f].InternalName=="Registration Keys") {
					//For fields that might have zero rows, we can't add the row here.  Adding rows is instead done in the case clause.
					//But some fields that are based on lists will always have one row, even if there are no items in the list.
					//Do not add those kinds here.
				}
				else {
					gridPtInfo.Rows.Add(row);
				}
			}
			gridPtInfo.EndUpdate();
		}
		///<summary>Supply pd so that we know the paper size and margins.</summary>
		private MigraDoc.DocumentObjectModel.Document CreateDocument(PrintDocument pd,Family fam,Patient pat,DataSet dataSet){
			MigraDoc.DocumentObjectModel.Document doc= new MigraDoc.DocumentObjectModel.Document();
			if(Plugins.HookMethod(this,"FormRpStatement.CreateDocument",doc,pd,fam,pat,dataSet,Stmt)) {
				return doc;
			}
			doc.DefaultPageSetup.PageWidth=Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width/100);
			doc.DefaultPageSetup.PageHeight=Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height/100);
			doc.DefaultPageSetup.TopMargin=Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top/100);
			doc.DefaultPageSetup.LeftMargin=Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left/100);
			doc.DefaultPageSetup.RightMargin=Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right/100);
			doc.DefaultPageSetup.BottomMargin=Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom/100);
			MigraDoc.DocumentObjectModel.Section section=doc.AddSection();//so that Swiss will have different footer for each patient.
			string text;
			MigraDoc.DocumentObjectModel.Font font;
			//GetPatGuar(PatNums[famIndex][0]);
			//Family fam=Patients.GetFamily(Stmt.PatNum);
			Patient PatGuar=fam.ListPats[0];//.Clone();
			//Patient pat=fam.GetPatient(Stmt.PatNum);
			DataTable tableMisc=dataSet.Tables["misc"];
			//HEADING------------------------------------------------------------------------------
			#region Heading
			Paragraph par=section.AddParagraph();
			ParagraphFormat parformat=new ParagraphFormat();
			parformat.Alignment=ParagraphAlignment.Center;
			par.Format=parformat;
			font=MigraDocHelper.CreateFont(14,true);
			if(Stmt.IsInvoice) {
				if(CultureInfo.CurrentCulture.Name=="en-NZ" || CultureInfo.CurrentCulture.Name=="en-AU") {//New Zealand and Australia
					text=Lan.g(this,"TAX INVOICE");
				}
				else {
					text=Lan.g(this,"INVOICE");
					text+=" #"+Stmt.StatementNum.ToString();//Some larger customers of OD need this to show in order to properly pay.
				}
			}
			else if(Stmt.IsReceipt) {
				text=Lan.g(this,"RECEIPT");
				if(CultureInfo.CurrentCulture.Name.EndsWith("SG")) {//SG=Singapore
					text+=" #"+Stmt.StatementNum.ToString();
				}
			}
			else {
				text=Lan.g(this,"STATEMENT");
			}
			par.AddFormattedText(text,font);
			text=DateTime.Today.ToShortDateString();
			font=MigraDocHelper.CreateFont(10);
			par.AddLineBreak();
			par.AddFormattedText(text,font);
			text=Lan.g(this,"Account Number")+" ";
			if(PrefC.GetBool(PrefName.StatementAccountsUseChartNumber)) {
				text+=PatGuar.ChartNumber;
			}
			else {
				text+=PatGuar.PatNum;
			}
			par.AddLineBreak();
			par.AddFormattedText(text,font);
			TextFrame frame;
			#endregion Heading
			//"COPY" for foreign countries' TAX INVOICES----------------------------------------------
			#region Tax Invoice Copy
			if(Stmt.IsInvoiceCopy && CultureInfo.CurrentCulture.Name!="en-US") {//We don't show this for US.
				font=MigraDocHelper.CreateFont(28,true,System.Drawing.Color.Red);
				frame=section.AddTextFrame();
				frame.RelativeVertical=RelativeVertical.Page;
				frame.RelativeHorizontal=RelativeHorizontal.Page;
				frame.MarginLeft=Unit.Zero;
				frame.MarginTop=Unit.Zero;
				frame.Top=TopPosition.Parse("0.35 in");
				frame.Left=LeftPosition.Parse("5.4 in");
				frame.Width=Unit.FromInch(3);
				par=frame.AddParagraph();
				par.Format.Font=font;
				par.AddText("COPY");
			}
			#endregion Tax Invoice Copy
			//Practice Address----------------------------------------------------------------------
			#region Practice Address
			if(PrefC.GetBool(PrefName.StatementShowReturnAddress)) {
				font=MigraDocHelper.CreateFont(10);
				frame=section.AddTextFrame();
				frame.RelativeVertical=RelativeVertical.Page;
				frame.RelativeHorizontal=RelativeHorizontal.Page;
				frame.MarginLeft=Unit.Zero;
				frame.MarginTop=Unit.Zero;
				frame.Top=TopPosition.Parse("0.5 in");
				frame.Left=LeftPosition.Parse("0.3 in");
				frame.Width=Unit.FromInch(3);
				if(!PrefC.GetBool(PrefName.EasyNoClinics) && Clinics.List.Length>0 //if using clinics
						&& Clinics.GetClinic(PatGuar.ClinicNum)!=null)//and this patient assigned to a clinic
					{
					Clinic clinic=Clinics.GetClinic(PatGuar.ClinicNum);
					par=frame.AddParagraph();
					par.Format.Font=font;
					par.AddText(clinic.Description);
					par.AddLineBreak();
					if(CultureInfo.CurrentCulture.Name=="en-AU") {//Australia
						Provider defaultProv=Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
						par.AddText("ABN: "+defaultProv.NationalProvID);
						par.AddLineBreak();
					}
					if(CultureInfo.CurrentCulture.Name=="en-NZ") {//New Zealand
						Provider defaultProv=Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
						par.AddText("GST: "+defaultProv.SSN);
						par.AddLineBreak();
					}
					par.AddText(clinic.Address);
					par.AddLineBreak();
					if(clinic.Address2!="") {
						par.AddText(clinic.Address2);
						par.AddLineBreak();
					}
					if(CultureInfo.CurrentCulture.Name.EndsWith("CH")) {//CH is for switzerland. eg de-CH
						par.AddText(clinic.Zip+" "+clinic.City);
					}
					else if(CultureInfo.CurrentCulture.Name.EndsWith("SG")) {//SG=Singapore
						par.AddText(clinic.City+" "+clinic.Zip);
					}
					else {
						par.AddText(clinic.City+", "+clinic.State+" "+clinic.Zip);
					}
					par.AddLineBreak();
					text=clinic.Phone;
					if(text.Length==10){
						text="("+text.Substring(0,3)+")"+text.Substring(3,3)+"-"+text.Substring(6);
					}
					par.AddText(text);
					par.AddLineBreak();
				}
				else {
					par=frame.AddParagraph();
					par.Format.Font=font;
					par.AddText(PrefC.GetString(PrefName.PracticeTitle));
					par.AddLineBreak();
					if(CultureInfo.CurrentCulture.Name=="en-AU"){//Australia
						Provider defaultProv=Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
						par.AddText("ABN: "+defaultProv.NationalProvID);
						par.AddLineBreak();
					}
					if(CultureInfo.CurrentCulture.Name=="en-NZ") {//New Zealand
						Provider defaultProv=Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
						par.AddText("GST: "+defaultProv.SSN);
						par.AddLineBreak();
					}
					par.AddText(PrefC.GetString(PrefName.PracticeAddress));
					par.AddLineBreak();
					if(PrefC.GetString(PrefName.PracticeAddress2)!="") {
						par.AddText(PrefC.GetString(PrefName.PracticeAddress2));
						par.AddLineBreak();
					}
					if(CultureInfo.CurrentCulture.Name.EndsWith("CH")) {//CH is for switzerland. eg de-CH
						par.AddText(PrefC.GetString(PrefName.PracticeZip)+" "+PrefC.GetString(PrefName.PracticeCity));
					}
					else if(CultureInfo.CurrentCulture.Name.EndsWith("SG")) {//SG=Singapore
						par.AddText(PrefC.GetString(PrefName.PracticeCity)+" "+PrefC.GetString(PrefName.PracticeZip));
					}
					else {
						par.AddText(PrefC.GetString(PrefName.PracticeCity)+", "+PrefC.GetString(PrefName.PracticeST)+" "+PrefC.GetString(PrefName.PracticeZip));
					}
					par.AddLineBreak();
					text=PrefC.GetString(PrefName.PracticePhone);
					if(text.Length==10){
						text="("+text.Substring(0,3)+")"+text.Substring(3,3)+"-"+text.Substring(6);
					}
					par.AddText(text);
					par.AddLineBreak();
				}
			}
			#endregion
			//AMOUNT ENCLOSED------------------------------------------------------------------------------------------------------
			#region Amount Enclosed
			Table table;
			Column col;
			Row row;
			Cell cell;
			frame=MigraDocHelper.CreateContainer(section,450,110,330,29);
			if(!Stmt.HidePayment) {
				table=MigraDocHelper.DrawTable(frame,0,0,29);
				col=table.AddColumn(Unit.FromInch(1.1));
				col=table.AddColumn(Unit.FromInch(1.1));
				col=table.AddColumn(Unit.FromInch(1.1));				
				row=table.AddRow();
				row.Format.Alignment=ParagraphAlignment.Center;
				row.Borders.Color=Colors.Black;
				row.Shading.Color=Colors.LightGray;
				row.TopPadding=Unit.FromInch(0);
				row.BottomPadding=Unit.FromInch(0);
				font=MigraDocHelper.CreateFont(8,true);
				cell=row.Cells[0];
				par=cell.AddParagraph();
				par.AddFormattedText(Lan.g(this,"Amount Due"),font);
				cell=row.Cells[1];
				par=cell.AddParagraph();
				par.AddFormattedText(Lan.g(this,"Date Due"),font);
				cell=row.Cells[2];
				par=cell.AddParagraph();
				par.AddFormattedText(Lan.g(this,"Amount Enclosed"),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);
				double balTotal=PatGuar.BalTotal;
				if(!PrefC.GetBool(PrefName.BalancesDontSubtractIns)) {//this is typical
					balTotal-=PatGuar.InsEst;
				}
				for(int m=0;m<tableMisc.Rows.Count;m++){
					if(tableMisc.Rows[m]["descript"].ToString()=="payPlanDue"){
						balTotal+=PIn.Double(tableMisc.Rows[m]["value"].ToString());
						//payPlanDue;//PatGuar.PayPlanDue;
					}
				}
				InstallmentPlan installPlan=InstallmentPlans.GetOneForFam(PatGuar.PatNum);
				if(installPlan!=null){
					//show lesser of normal total balance or the monthly payment amount.
					if(installPlan.MonthlyPayment < balTotal) {
						text=installPlan.MonthlyPayment.ToString("F");
					}
					else {
						text=balTotal.ToString("F");
					}
				}
				else {//no installmentplan
					text=balTotal.ToString("F");
				}
				cell=row.Cells[0];
				par=cell.AddParagraph();
				par.AddFormattedText(text,font);
				if(PrefC.GetLong(PrefName.StatementsCalcDueDate)==-1) {
					text=Lan.g(this,"Upon Receipt");
				}
				else {
					text=DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate)).ToShortDateString();
				}
				cell=row.Cells[1];
				par=cell.AddParagraph();
				par.AddFormattedText(text,font);
			}
			#endregion
			//Credit Card Info--------------------------------------------------------------------------------------------------------
			#region Credit Card Info
			if(!Stmt.HidePayment) {
				if(PrefC.GetBool(PrefName.StatementShowCreditCard)) {
					float yPos=60;
					font=MigraDocHelper.CreateFont(7,true);
					text=Lan.g(this,"CREDIT CARD TYPE");
					MigraDocHelper.DrawString(frame,text,font,0,yPos);
					float rowHeight=26;
					System.Drawing.Font wfont=new System.Drawing.Font("Arial",7,FontStyle.Bold);
					Graphics g=this.CreateGraphics();//just to measure strings
					MigraDocHelper.DrawLine(frame,System.Drawing.Color.Black,g.MeasureString(text,wfont).Width,
						yPos+wfont.GetHeight(g),326,yPos+wfont.GetHeight(g));
					yPos+=rowHeight;
					text=Lan.g(this,"#");
					MigraDocHelper.DrawString(frame,text,font,0,yPos);
					MigraDocHelper.DrawLine(frame,System.Drawing.Color.Black,g.MeasureString(text,wfont).Width,
						yPos+wfont.GetHeight(g),326,yPos+wfont.GetHeight(g));
					yPos+=rowHeight;
					text=Lan.g(this,"3 DIGIT CSV");
					MigraDocHelper.DrawString(frame,text,font,0,yPos);
					MigraDocHelper.DrawLine(frame,System.Drawing.Color.Black,g.MeasureString(text,wfont).Width,
						yPos+wfont.GetHeight(g),326,yPos+wfont.GetHeight(g));
					yPos+=rowHeight;
					text=Lan.g(this,"EXPIRES");
					MigraDocHelper.DrawString(frame,text,font,0,yPos);
					MigraDocHelper.DrawLine(frame,System.Drawing.Color.Black,g.MeasureString(text,wfont).Width,
						yPos+wfont.GetHeight(g),326,yPos+wfont.GetHeight(g));
					yPos+=rowHeight;
					text=Lan.g(this,"AMOUNT APPROVED");
					MigraDocHelper.DrawString(frame,text,font,0,yPos);
					MigraDocHelper.DrawLine(frame,System.Drawing.Color.Black,g.MeasureString(text,wfont).Width,
						yPos+wfont.GetHeight(g),326,yPos+wfont.GetHeight(g));
					yPos+=rowHeight;
					text=Lan.g(this,"NAME");
					MigraDocHelper.DrawString(frame,text,font,0,yPos);
					MigraDocHelper.DrawLine(frame,System.Drawing.Color.Black,g.MeasureString(text,wfont).Width,
						yPos+wfont.GetHeight(g),326,yPos+wfont.GetHeight(g));
					yPos+=rowHeight;
					text=Lan.g(this,"SIGNATURE");
					MigraDocHelper.DrawString(frame,text,font,0,yPos);
					MigraDocHelper.DrawLine(frame,System.Drawing.Color.Black,g.MeasureString(text,wfont).Width,
						yPos+wfont.GetHeight(g),326,yPos+wfont.GetHeight(g));
					yPos-=rowHeight;
					text=Lan.g(this,"(As it appears on card)");
					wfont=new System.Drawing.Font("Arial",5);
					font=MigraDocHelper.CreateFont(5);
					MigraDocHelper.DrawString(frame,text,font,625-g.MeasureString(text,wfont).Width/2+5,yPos+13);
				}
			}
			#endregion
			//Patient's Billing Address---------------------------------------------------------------------------------------------
			#region Patient Billing Address
			font=MigraDocHelper.CreateFont(11);
			frame=MigraDocHelper.CreateContainer(section,62.5f+12.5f,225+1,300,200);
			par=frame.AddParagraph();
			par.Format.Font=font;
			if(Stmt.SinglePatient){
				par.AddText(fam.GetNameInFamFLnoPref(Stmt.PatNum));
			}
			else{
				par.AddText(PatGuar.GetNameFLFormal());
			}
			par.AddLineBreak();
			par.AddText(PatGuar.Address);
			par.AddLineBreak();
			if(PatGuar.Address2!="") {
				par.AddText(PatGuar.Address2);
				par.AddLineBreak();
			}
			if(CultureInfo.CurrentCulture.Name.EndsWith("CH")) {//CH is for switzerland. eg de-CH
				par.AddText(PatGuar.Zip+" "+PatGuar.City);
			}
			else if(CultureInfo.CurrentCulture.Name.EndsWith("SG")) {//SG=Singapore
				par.AddText(PatGuar.City+" "+PatGuar.Zip);
			}
			else {
				par.AddText(PatGuar.City+", "+PatGuar.State+" "+PatGuar.Zip);
			}
			if(PatGuar.Country!="") {
				par.AddLineBreak();
				par.AddText(PatGuar.Country);
			}
			//perforated line------------------------------------------------------------------------------------------------------
			//yPos=350;//3.62 inches from top, 1/3 page down
			frame=MigraDocHelper.CreateContainer(section,0,350,850,30);
			if(!Stmt.HidePayment) {
				MigraDocHelper.DrawLine(frame,System.Drawing.Color.LightGray,0,0,850,0);
				text=Lan.g(this,"PLEASE DETACH AND RETURN THE UPPER PORTION WITH YOUR PAYMENT");
				font=MigraDocHelper.CreateFont(6,true,System.Drawing.Color.Gray);
				par=frame.AddParagraph();
				par.Format.Alignment=ParagraphAlignment.Center;
				par.Format.Font=font;
				par.AddText(text);
			}
			#endregion
			//Australian Provider Legend
			#region Australian Provider Legend
			int legendOffset=0;
			if(CultureInfo.CurrentCulture.Name=="en-AU") {//English (Australia)
				Providers.RefreshCache();
				legendOffset=25+15*(1+ProviderC.ListShort.Count);
				MigraDocHelper.InsertSpacer(section,legendOffset);
				frame=MigraDocHelper.CreateContainer(section,45,390,250,legendOffset);
				par=frame.AddParagraph();
				par.Format.Font=MigraDocHelper.CreateFont(8,true);
				par.AddLineBreak();
				par.AddText("PROVIDERS:");
				par=frame.AddParagraph();
				par.Format.Font=MigraDocHelper.CreateFont(8,false);
				for(int i=0;i<ProviderC.ListShort.Count;i++) {//All non-hidden providers are added to the legend.
					Provider prov=ProviderC.ListShort[i];
					string suffix="";
					if(prov.Suffix.Trim()!=""){
						suffix=", "+prov.Suffix.Trim();
					}
					par.AddText(prov.Abbr+" - "+prov.FName+" "+prov.LName+suffix+" - "+prov.MedicaidID);
					par.AddLineBreak();
				}
				par.AddLineBreak();
			}
			#endregion
			//Aging-----------------------------------------------------------------------------------
			#region Aging
			MigraDocHelper.InsertSpacer(section,275);
			frame=MigraDocHelper.CreateContainer(section,55,390+legendOffset,250,29);
			if (!Stmt.HidePayment)
			{
				table = MigraDocHelper.DrawTable(frame, 0, 0, 29);
				col = table.AddColumn(Unit.FromInch(1.1));
				col = table.AddColumn(Unit.FromInch(1.1));
				col = table.AddColumn(Unit.FromInch(1.1));
				col = table.AddColumn(Unit.FromInch(1.1));
				row = table.AddRow();
				row.Format.Alignment = ParagraphAlignment.Center;
				row.Borders.Color = Colors.Black;
				row.Shading.Color = Colors.LightGray;
				row.TopPadding = Unit.FromInch(0);
				row.BottomPadding = Unit.FromInch(0);
				font = MigraDocHelper.CreateFont(8, true);
				cell = row.Cells[0];
				par = cell.AddParagraph();
				par.AddFormattedText(Lan.g(this, "0-30"), font);
				cell = row.Cells[1];
				par = cell.AddParagraph();
				par.AddFormattedText(Lan.g(this, "31-60"), font);
				cell = row.Cells[2];
				par = cell.AddParagraph();
				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"));
				grow.Cells.Add(PatGuar.BalTotal.ToString("F"));
				grow.Cells.Add(PatGuar.InsEst.ToString("F"));
				grow.Cells.Add((PatGuar.BalTotal-PatGuar.InsEst).ToString("F"));
				gridAging.Rows.Add(grow);
				gridAging.EndUpdate();
				MigraDocHelper.DrawGrid(section,gridAging);
				gridAging.Dispose();
			*/
			#endregion
			//Floating Balance, Ins info-------------------------------------------------------------------
			#region FloatingBalance
			frame=MigraDocHelper.CreateContainer(section,460,380+legendOffset,250,200);
			//table=MigraDocHelper.DrawTable(frame,0,0,90);
			par = frame.AddParagraph();
			parformat = new ParagraphFormat();
			parformat.Alignment = ParagraphAlignment.Right;
			par.Format = parformat;
			font = MigraDocHelper.CreateFont(10,false);
			MigraDoc.DocumentObjectModel.Font fontBold=MigraDocHelper.CreateFont(10, true);
			if(Stmt.IsInvoice) {
				text=Lan.g(this,"Procedures:");
				par.AddFormattedText(text,font);
				par.AddLineBreak();
				text=Lan.g(this,"Adjustments:");
				par.AddFormattedText(text,font);
				par.AddLineBreak();
				text=Lan.g(this,"Total:");
				par.AddFormattedText(text,font);
				par.AddLineBreak();
			}
			else if(PrefC.GetBool(PrefName.BalancesDontSubtractIns)){
				text = Lan.g(this, "Balance:");
				par.AddFormattedText(text, fontBold);
				//par.AddLineBreak();
				//text = Lan.g(this, "Ins Pending:");
				//par.AddFormattedText(text, font);
				//par.AddLineBreak();
				//text = Lan.g(this, "After Ins:");
				//par.AddFormattedText(text, font);
				//par.AddLineBreak();
			}
			else{//this is more common
				if (PrefC.GetBool(PrefName.FuchsOptionsOn)) {
					text = Lan.g(this, "Balance:");
					par.AddFormattedText(text, font);
					par.AddLineBreak();
					text = Lan.g(this, "-Ins Estimate:");
					par.AddFormattedText(text, font);
					par.AddLineBreak();
					text = Lan.g(this, "=Owed Now:");
					par.AddFormattedText(text, fontBold);
					par.AddLineBreak();
				}
				else {
					text = Lan.g(this, "Total:");
					par.AddFormattedText(text, font);
					par.AddLineBreak();
					text = Lan.g(this, "-Ins Estimate:");
					par.AddFormattedText(text, font);
					par.AddLineBreak();
					text = Lan.g(this, "=Balance:");
					par.AddFormattedText(text, fontBold);
					par.AddLineBreak();
				}
			}
			frame=MigraDocHelper.CreateContainer(section,730,380+legendOffset,100,200);
			//table=MigraDocHelper.DrawTable(frame,0,0,90);
			par = frame.AddParagraph();
			parformat = new ParagraphFormat();
			parformat.Alignment = ParagraphAlignment.Left;
			par.Format = parformat;
			font = MigraDocHelper.CreateFont(10,false);
			//numbers:
			if(Stmt.IsInvoice) {
				double adjAmt=0;
				double procAmt=0;
				DataTable tableAcct;
				string tableName;
				for(int i=0;i<dataSet.Tables.Count;i++) {
					tableAcct=dataSet.Tables[i];
					tableName=tableAcct.TableName;
					if(!tableName.StartsWith("account")) {
						continue;
					}
					for(int p=0;p<tableAcct.Rows.Count;p++) {
						if(tableAcct.Rows[p]["AdjNum"].ToString()!="0") {
							adjAmt-=PIn.Double(tableAcct.Rows[p]["creditsDouble"].ToString());
							adjAmt+=PIn.Double(tableAcct.Rows[p]["chargesDouble"].ToString());
						}
						else {//must be a procedure
							procAmt+=PIn.Double(tableAcct.Rows[p]["chargesDouble"].ToString());
						}
					}
				}
				text=procAmt.ToString("c");
				par.AddFormattedText(text,font);
				par.AddLineBreak();
				text=adjAmt.ToString("c");
				par.AddFormattedText(text,font);
				par.AddLineBreak();
				text=(procAmt+adjAmt).ToString("c");
				par.AddFormattedText(text,fontBold);
			}
			else if(PrefC.GetBool(PrefName.BalancesDontSubtractIns)) {
				if(Stmt.SinglePatient) {
					//Show the current patient's balance without subtracting insurance estimates.
					text = pat.EstBalance.ToString("c");
					par.AddFormattedText(text,font);
				}
				else {
					//Show the current family's balance without subtracting insurance estimates.
					text = PatGuar.BalTotal.ToString("c");
					par.AddFormattedText(text,fontBold);
				}
			}
			else {//more common
				if(Stmt.SinglePatient) {
					double patInsEst=0;
					for(int m=0;m<tableMisc.Rows.Count;m++) {
						if(tableMisc.Rows[m]["descript"].ToString()=="patInsEst") {
							patInsEst=PIn.Double(tableMisc.Rows[m]["value"].ToString());
						}
					}
					double patBal=pat.EstBalance-patInsEst;
					text = pat.EstBalance.ToString("c");
					par.AddFormattedText(text,font);
					par.AddLineBreak();
					text = patInsEst.ToString("c");
					par.AddFormattedText(text,font);
					par.AddLineBreak();
					text = patBal.ToString("c");
					par.AddFormattedText(text,fontBold);
				}
				else {
					text = PatGuar.BalTotal.ToString("c");
					par.AddFormattedText(text,font);
					par.AddLineBreak();
					text = PatGuar.InsEst.ToString("c");
					par.AddFormattedText(text,font);
					par.AddLineBreak();
					text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c");
					par.AddFormattedText(text,fontBold);
					par.AddLineBreak();
				}
			}
			MigraDocHelper.InsertSpacer(section, 80);
			#endregion FloatingBalance
			//Bold note-------------------------------------------------------------------------------
			#region Bold note
			if(Stmt.NoteBold!=""){
				MigraDocHelper.InsertSpacer(section,7);
				font=MigraDocHelper.CreateFont(10,true,System.Drawing.Color.DarkRed);
				par=section.AddParagraph();
				par.Format.Font=font;
				par.AddText(Stmt.NoteBold);
				MigraDocHelper.InsertSpacer(section,8);
			}
			#endregion Bold note
			//Payment plan grid definition---------------------------------------------------------------------------------
			#region PayPlan grid definition
			ODGridColumn gcol;
			ODGridRow grow;
			ODGrid gridPP = new ODGrid();
			this.Controls.Add(gridPP);
			gridPP.BeginUpdate();
			gridPP.Columns.Clear();
			gcol=new ODGridColumn(Lan.g(this,"Date"),73);
			gridPP.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Description"),270);
			gridPP.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Charges"),60,HorizontalAlignment.Right);
			gridPP.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Credits"),60,HorizontalAlignment.Right);
			gridPP.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Balance"),60,HorizontalAlignment.Right);
			gridPP.Columns.Add(gcol);
			gridPP.Width=gridPP.WidthAllColumns+20;
			gridPP.EndUpdate();
			#endregion PayPlan grid definition
			//Payment plan grid.  There will be only one, if any-----------------------------------------------------------------
			#region PayPlan grid
			DataTable tablePP=dataSet.Tables["payplan"];
			ODGridCell gcell;
			if(tablePP.Rows.Count>0){
				//MigraDocHelper.InsertSpacer(section,5);
				par=section.AddParagraph();
				par.Format.Font=MigraDocHelper.CreateFont(10,true);
				par.Format.Alignment=ParagraphAlignment.Center;
				//par.Format.SpaceBefore=Unit.FromInch(.05);
				//par.Format.SpaceAfter=Unit.FromInch(.05);
				par.AddText(Lan.g(this,"Payment Plans"));
				MigraDocHelper.InsertSpacer(section,2);
				gridPP.BeginUpdate();
				gridPP.Rows.Clear();
				for(int p=0;p<tablePP.Rows.Count;p++){
					grow=new ODGridRow();
					grow.Cells.Add(tablePP.Rows[p]["date"].ToString());
					grow.Cells.Add(tablePP.Rows[p]["description"].ToString());
					grow.Cells.Add(tablePP.Rows[p]["charges"].ToString());
					grow.Cells.Add(tablePP.Rows[p]["credits"].ToString());
					gcell=new ODGridCell(tablePP.Rows[p]["balance"].ToString());
					if(p==tablePP.Rows.Count-1){
						gcell.Bold=YN.Yes;
					}
					else if(tablePP.Rows[p+1]["balance"].ToString()==""){//if next row balance is blank.
						gcell.Bold=YN.Yes;
					}
					grow.Cells.Add(gcell);
					gridPP.Rows.Add(grow);
				}
				gridPP.EndUpdate();
				MigraDocHelper.DrawGrid(section,gridPP);
				MigraDocHelper.InsertSpacer(section,2);
				par=section.AddParagraph();
				par.Format.Font=MigraDocHelper.CreateFont(10,true);
				par.Format.Alignment=ParagraphAlignment.Right;
				par.Format.RightIndent=Unit.FromInch(0.25);
				double payPlanDue=0;
				for(int m=0;m<tableMisc.Rows.Count;m++){
					if(tableMisc.Rows[m]["descript"].ToString()=="payPlanDue"){
						payPlanDue=PIn.Double(tableMisc.Rows[m]["value"].ToString());
					}
				}
				par.AddText(Lan.g(this,"Payment Plan Amount Due: ")+payPlanDue.ToString("c"));//PatGuar.PayPlanDue.ToString("c"));
				MigraDocHelper.InsertSpacer(section,10);
			}
			#endregion PayPlan grid
			//Body Table definition--------------------------------------------------------------------------------------------------------
			#region Body Table definition
			ODGrid gridPat = new ODGrid();
			this.Controls.Add(gridPat);
			gridPat.BeginUpdate();
			gridPat.Columns.Clear();
			gcol=new ODGridColumn(Lan.g(this,"Date"),73);
			gridPat.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Patient"),100);
			gridPat.Columns.Add(gcol);
			//prov
			gcol=new ODGridColumn(Lan.g(this,"Code"),45);
			gridPat.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Tooth"),42);
			gridPat.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Description"),270);
			gridPat.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Charges"),60,HorizontalAlignment.Right);
			gridPat.Columns.Add(gcol);
			gcol=new ODGridColumn(Lan.g(this,"Credits"),60,HorizontalAlignment.Right);
			gridPat.Columns.Add(gcol);
			if(Stmt.IsInvoice) {
				gcol=new ODGridColumn(Lan.g(this,"Total"),60,HorizontalAlignment.Right);
				gridPat.Columns.Add(gcol);
			}
			else {
				gcol=new ODGridColumn(Lan.g(this,"Balance"),60,HorizontalAlignment.Right);
				gridPat.Columns.Add(gcol);
			}
			gridPat.Width=gridPat.WidthAllColumns+20;
			gridPat.EndUpdate();
			#endregion Body Table definition
			//Loop through each table.  Could be one intermingled, or one for each patient-----------------------------------------
			DataTable tableAccount;
			string tablename;
			long patnum;
			for(int i=0;i<dataSet.Tables.Count;i++){
				tableAccount=dataSet.Tables[i];
				tablename=tableAccount.TableName;
				if(!tablename.StartsWith("account")){
					continue;
				}
				par=section.AddParagraph();
				par.Format.Font=MigraDocHelper.CreateFont(10,true);
				par.Format.SpaceBefore=Unit.FromInch(.05);
				par.Format.SpaceAfter=Unit.FromInch(.05);
				patnum=0;
				if(tablename!="account"){//account123 etc.
					patnum=PIn.Long(tablename.Substring(7));
				}
				if(patnum!=0){
					par.AddText(fam.GetNameInFamFLnoPref(patnum));
				}
				//if(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript!=""){
				//	par=section.AddParagraph();
				//	par.Format.Font=MigraDocHelper.CreateFont(9);//same as body font
				//	par.AddText(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript);
				//}
				gridPat.BeginUpdate();
				gridPat.Rows.Clear();
				//lineData=FamilyStatementDataList[famIndex].PatDataList[i].PatData;
				for(int p=0;p<tableAccount.Rows.Count;p++) {
					if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
						if(Stmt.IsReceipt) {
							if(tableAccount.Rows[p]["StatementNum"].ToString()!="0") {//Hide statement rows for Canadian receipts.
								continue;
							}
							if(tableAccount.Rows[p]["ClaimNum"].ToString()!="0") {//Hide claim rows and claim payment rows for Canadian receipts.
								continue;
							}
						}
					}
					if(CultureInfo.CurrentCulture.Name=="en-US") {
						if(Stmt.IsReceipt) {
							if(tableAccount.Rows[p]["PayNum"].ToString()=="0") {//Hide everything except patient payments
								continue;
							}
						}
						//js Some additional features would be nice for receipts, such as hiding the bal column, the aging, and the amount due sections.
					}
					grow=new ODGridRow();
					grow.Cells.Add(tableAccount.Rows[p]["date"].ToString());
					grow.Cells.Add(tableAccount.Rows[p]["patient"].ToString());
					if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
						if(Stmt.IsReceipt) {
							grow.Cells.Add("");//Code: blank in Canada normally because this information is used on taxes and is considered a security concern.
							grow.Cells.Add("");//Tooth: blank in Canada normally because this information is used on taxes and is considered a security concern.
						}
						else {
							grow.Cells.Add(tableAccount.Rows[p]["ProcCode"].ToString());
							grow.Cells.Add(tableAccount.Rows[p]["tth"].ToString());
						}
					}
					else {
						grow.Cells.Add(tableAccount.Rows[p]["ProcCode"].ToString());
						grow.Cells.Add(tableAccount.Rows[p]["tth"].ToString());
					}
					if(CultureInfo.CurrentCulture.Name=="en-AU") {//English (Australia)
						if(tableAccount.Rows[p]["prov"].ToString().Trim()!="") {
							grow.Cells.Add(tableAccount.Rows[p]["prov"].ToString()+" - "+tableAccount.Rows[p]["description"].ToString());
						}
						else {//No provider on this account row item, so don't put the extra leading characters.
							grow.Cells.Add(tableAccount.Rows[p]["description"].ToString());
						}
					}
					else if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
						if(Stmt.IsReceipt) {
							if(PIn.Long(tableAccount.Rows[p]["ProcNum"].ToString())==0) {
								grow.Cells.Add(tableAccount.Rows[p]["description"].ToString());
							}
							else {//Only clear description for procedures.
								grow.Cells.Add("");//Description: blank in Canada normally because this information is used on taxes and is considered a security concern.
							}
						}
						else {
							grow.Cells.Add(tableAccount.Rows[p]["description"].ToString());
						}
					}
					else {//Assume English (United States)
						grow.Cells.Add(tableAccount.Rows[p]["description"].ToString());
					}
					grow.Cells.Add(tableAccount.Rows[p]["charges"].ToString());
					grow.Cells.Add(tableAccount.Rows[p]["credits"].ToString());
					grow.Cells.Add(tableAccount.Rows[p]["balance"].ToString());
					gridPat.Rows.Add(grow);
				}
				gridPat.EndUpdate();
				MigraDocHelper.DrawGrid(section,gridPat);
				//Total
				frame=MigraDocHelper.CreateContainer(section);
				font=MigraDocHelper.CreateFont(9,true);
				float totalPos=((float)(doc.DefaultPageSetup.PageWidth.Inch//-doc.DefaultPageSetup.LeftMargin.Inch
					//-doc.DefaultPageSetup.RightMargin.Inch)
					)*100f)/2f+(float)gridPat.WidthAllColumns/2f+7;
				RectangleF rectF=new RectangleF(0,0,totalPos,16);
				if(patnum!=0){
					MigraDocHelper.DrawString(frame," ",
						//I decided this was unnecessary:
						//dataSet.Tables["patient"].Rows[fam.GetIndex(patnum)]["balance"].ToString(),
						font,rectF,ParagraphAlignment.Right);
					//MigraDocHelper.DrawString(frame,FamilyStatementDataList[famIndex].PatAboutList[i].Balance.ToString("F"),font,rectF,
					//	ParagraphAlignment.Right);
				}
			}
			gridPat.Dispose();
			//Future appointments---------------------------------------------------------------------------------------------
			#region Future appointments
			if(!Stmt.IsReceipt && !Stmt.IsInvoice) {
				font=MigraDocHelper.CreateFont(9);
				DataTable tableAppt=dataSet.Tables["appts"];
				if(tableAppt.Rows.Count>0) {
					par=section.AddParagraph();
					par.Format.Font=font;
					par.AddText(Lan.g(this,"Scheduled Appointments:"));
				}
				for(int i=0;i<tableAppt.Rows.Count;i++) {
					par.AddLineBreak();
					par.AddText(tableAppt.Rows[i]["descript"].ToString());
				}
				if(tableAppt.Rows.Count>0) {
					MigraDocHelper.InsertSpacer(section,10);
				}
			}
			#endregion Future appointments
			//Region specific static notes------------------------------------------------------------------------------------
			if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
				if(Stmt.IsReceipt) {
					font=MigraDocHelper.CreateFont(9);
					par=section.AddParagraph();
					par.Format.Font=font;
					par.AddText("KEEP THIS RECEIPT FOR INCOME TAX PURPOSES");
					MigraDocHelper.InsertSpacer(section,10);
				}
			}
			//Note------------------------------------------------------------------------------------------------------------
			font=MigraDocHelper.CreateFont(9);
			par=section.AddParagraph();
			par.Format.Font=font;
			par.AddText(Stmt.Note);
			//bold note
			if(Stmt.NoteBold!=""){
				MigraDocHelper.InsertSpacer(section,10);
				font=MigraDocHelper.CreateFont(10,true,System.Drawing.Color.DarkRed);
				par=section.AddParagraph();
				par.Format.Font=font;
				par.AddText(Stmt.NoteBold);
			}
			#region SwissBanking
			if(CultureInfo.CurrentCulture.Name.EndsWith("CH")){//CH is for switzerland. eg de-CH
				//&& pagesPrinted==0)//only on the first page
			//{
				//float yred=744;//768;//660 for testing
				//Red line (just temp)
				//g.DrawLine(Pens.Red,0,yred,826,yred);
				MigraDoc.DocumentObjectModel.Font swfont=MigraDocHelper.CreateFont(10);
					//new Font(FontFamily.GenericSansSerif,10);
				//Bank Address---------------------------------------------------------
				HeaderFooter footer=section.Footers.Primary;
				footer.Format.Borders.Color=Colors.Black;
				//footer.AddParagraph(PrefC.GetString(PrefName.BankAddress"));
				frame=footer.AddTextFrame();
				frame.RelativeVertical=RelativeVertical.Line;
				frame.RelativeHorizontal=RelativeHorizontal.Page;
				frame.MarginLeft=Unit.Zero;
				frame.MarginTop=Unit.Zero;
				frame.Top=TopPosition.Parse("0 in");
				frame.Left=LeftPosition.Parse("0 in");
				frame.Width=Unit.FromInch(8.3);
				frame.Height=300;
				//RectangleF=new RectangleF(0,0,
				MigraDocHelper.DrawString(frame,PrefC.GetString(PrefName.BankAddress),swfont,30,30);
				MigraDocHelper.DrawString(frame,PrefC.GetString(PrefName.BankAddress),swfont,246,30);
				//Office Name and Address----------------------------------------------
				text=PrefC.GetString(PrefName.PracticeTitle)+"\r\n"
					+PrefC.GetString(PrefName.PracticeAddress)+"\r\n";
				if(PrefC.GetString(PrefName.PracticeAddress2)!="") {
					text+=PrefC.GetString(PrefName.PracticeAddress2)+"\r\n";
				}
				text+=PrefC.GetString(PrefName.PracticeZip)+" "+PrefC.GetString(PrefName.PracticeCity);
				MigraDocHelper.DrawString(frame,text,swfont,30,89);
				MigraDocHelper.DrawString(frame,text,swfont,246,89);
				//Bank account number--------------------------------------------------
				string origBankNum=PrefC.GetString(PrefName.PracticeBankNumber);//must be exactly 9 digits. 2+6+1.
				//the 6 digit portion might have 2 leading 0's which would not go into the dashed bank num.
				string dashedBankNum="?";
				//examples: 01-200027-2
				//          01-4587-1  (from 010045871)
				if(origBankNum.Length==9) {
					dashedBankNum=origBankNum.Substring(0,2)+"-"
						+origBankNum.Substring(2,6).TrimStart(new char[] { '0' })+"-"
						+origBankNum.Substring(8,1);
				}
				swfont=MigraDocHelper.CreateFont(9,true);
					//new Font(FontFamily.GenericSansSerif,9,FontStyle.Bold);
				MigraDocHelper.DrawString(frame,dashedBankNum,swfont,95,169);
				MigraDocHelper.DrawString(frame,dashedBankNum,swfont,340,169);
				//Amount------------------------------------------------------------
				double amountdue=PatGuar.BalTotal-PatGuar.InsEst;
				text=amountdue.ToString("F2");
				text=text.Substring(0,text.Length-3);
				swfont=MigraDocHelper.CreateFont(10);
				MigraDocHelper.DrawString(frame,text,swfont,new RectangleF(50,205,100,25),ParagraphAlignment.Right);
				MigraDocHelper.DrawString(frame,text,swfont,new RectangleF(290,205,100,25),ParagraphAlignment.Right);
				text=amountdue.ToString("F2");//eg 92.00
				text=text.Substring(text.Length-2,2);//eg 00
				MigraDocHelper.DrawString(frame,text,swfont,185,205);
				MigraDocHelper.DrawString(frame,text,swfont,425,205);
				//Patient Address-----------------------------------------------------
				string patAddress=PatGuar.FName+" "+PatGuar.LName+"\r\n"
					+PatGuar.Address+"\r\n";
				if(PatGuar.Address2!="") {
					patAddress+=PatGuar.Address2+"\r\n";
				}
				patAddress+=PatGuar.Zip+" "+PatGuar.City;
				patAddress+=((PatGuar.Country=="")?"":"\r\n"+PatGuar.Country);
				MigraDocHelper.DrawString(frame,text,swfont,495,218);//middle left
				MigraDocHelper.DrawString(frame,text,swfont,30,263);//Lower left
				//Compute Reference#------------------------------------------------------
				//Reference# has exactly 27 digits
				//First 6 numbers are what we are calling the BankRouting number.
				//Next 20 numbers represent the invoice #.
				//27th number is the checksum
				string referenceNum=PrefC.GetString(PrefName.BankRouting);//6 digits
				if(referenceNum.Length!=6) {
					referenceNum="000000";
				}
				referenceNum+=PatGuar.PatNum.ToString().PadLeft(12,'0')
					//"000000000000"//12 0's
					+DateTime.Today.ToString("yyyyMMdd");//+8=20
				//for testing:
				//referenceNum+="09090271100000067534";
				//"00000000000000037112";
				referenceNum+=Modulo10(referenceNum).ToString();
				//at this point, the referenceNum will always be exactly 27 digits long.
				string spacedRefNum=referenceNum.Substring(0,2)+" "+referenceNum.Substring(2,5)+" "+referenceNum.Substring(7,5)
					+" "+referenceNum.Substring(12,5)+" "+referenceNum.Substring(17,5)+" "+referenceNum.Substring(22,5);
				//text=spacedRefNum.Substring(0,15)+"\r\n"+spacedRefNum.Substring(16)+"\r\n";
				//reference# at lower left above address.  Small
				swfont=MigraDocHelper.CreateFont(7);
				MigraDocHelper.DrawString(frame,spacedRefNum,swfont,30,243);
				//Reference# at upper right---------------------------------------------------------------
				swfont=MigraDocHelper.CreateFont(10);
				MigraDocHelper.DrawString(frame,spacedRefNum,swfont,490,140);
				//Big long number at the lower right--------------------------------------------------
				/*The very long number on the bottom has this format:
				>13 numbers > 27 numbers + 9 numbers >
				>Example: 0100000254306>904483000000000000000371126+ 010045871>
				>
				>The first group of 13 numbers would begin with either 01 or only have 
				>042 without any other following numbers.  01 would be used if there is 
				>a specific amount, and 042 would be used if there is not a specific 
				>amount billed. So in the example, the billed amount is 254.30.  It has 
				>01 followed by leading zeros to fill in the balance of the digits 
				>required.  The last digit is a checksum done by the program.  If the 
				>amount would be 1,254.30 then the example should read 0100001254306.
				>
				>There is a > separator, then the reference number made up previously.
				>
				>Then a + separator, followed by the bank account number.  Previously, 
				>the number printed without the zeros, but in this case it has the zeros 
				>and not the dashes.*/
				swfont=new MigraDoc.DocumentObjectModel.Font("OCR-B 10 BT",12);
				text="01"+amountdue.ToString("F2").Replace(".","").PadLeft(10,'0');
				text+=Modulo10(text).ToString()+">"
					+referenceNum+"+ "+origBankNum+">";
				MigraDocHelper.DrawString(frame,text,swfont,255,345);
			}
			#endregion SwissBanking
			return doc;
		}
 ///<summary></summary>
 public int IndexOf(ODGridCell value)
 {
     return(List.IndexOf(value));
 }
Esempio n. 7
0
		private void FillFamilyData(){
			gridFamily.BeginUpdate();
			gridFamily.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TablePatient","Name"),140);
			gridFamily.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePatient","Position"),65);
			gridFamily.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePatient","Gender"),55);
			gridFamily.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePatient","Status"),65);
			gridFamily.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePatient","Age"),45);
			gridFamily.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePatient","Recall Due"),80);
			gridFamily.Columns.Add(col);
			gridFamily.Rows.Clear();
			if(PatCur==null){
				gridFamily.EndUpdate();
				return;
			}
			ODGridRow row;
			DateTime recallDate;
			ODGridCell cell;
			for(int i=0;i<FamCur.ListPats.Length;i++){
				row=new ODGridRow();
				row.Cells.Add(FamCur.GetNameInFamLFI(i));
				row.Cells.Add(Lan.g("enumPatientPosition",FamCur.ListPats[i].Position.ToString()));
				row.Cells.Add(Lan.g("enumPatientGender",FamCur.ListPats[i].Gender.ToString()));
				row.Cells.Add(Lan.g("enumPatientStatus",FamCur.ListPats[i].PatStatus.ToString()));
				row.Cells.Add(Patients.AgeToString(FamCur.ListPats[i].Age));
				recallDate=DateTime.MinValue;
				for(int j=0;j<RecallList.Count;j++){
					if(RecallList[j].PatNum==FamCur.ListPats[i].PatNum
						&& (RecallList[j].RecallTypeNum==PrefC.GetLong(PrefName.RecallTypeSpecialProphy)
						|| RecallList[j].RecallTypeNum==PrefC.GetLong(PrefName.RecallTypeSpecialPerio)))
					{
						recallDate=RecallList[j].DateDue;
					}
				}
				cell=new ODGridCell();
				if(recallDate.Year>1880){
					cell.Text=recallDate.ToShortDateString();
					if(recallDate<DateTime.Today){
						cell.Bold=YN.Yes;
						cell.ColorText=Color.Firebrick;
					}
				}
				row.Cells.Add(cell);
				if(i==0){//guarantor
					row.Bold=true;
				}
				gridFamily.Rows.Add(row);
			}
			gridFamily.EndUpdate();
			gridFamily.SetSelected(FamCur.GetIndex(PatCur.PatNum),true);
		}
Esempio n. 8
0
		private void FillMain(){
			DateTime dateFrom=PIn.Date(textDateFrom.Text);
			DateTime dateTo=PIn.Date(textDateTo.Text);
			long provNum=0;
			if(comboProv.SelectedIndex!=0) {
				provNum=ProviderC.ListShort[comboProv.SelectedIndex-1].ProvNum;
			}
			long clinicNum=0;
			//if clinics are not enabled, comboClinic.SelectedIndex will be -1, so clinicNum will be 0 and list will not be filtered by clinic
			if(Security.CurUser.ClinicIsRestricted && comboClinic.SelectedIndex>-1) {
				clinicNum=_listUserClinics[comboClinic.SelectedIndex].ClinicNum;
			}
			else if(comboClinic.SelectedIndex > 0) {//if user is not restricted, clinicNum will be 0 and the query will get all clinic data
				clinicNum=_listUserClinics[comboClinic.SelectedIndex-1].ClinicNum;//if user is not restricted, comboClinic will contain "All" so minus 1
			}
			bool showRecalls=false;
			bool showNonRecalls=false;
			bool showHygienePrescheduled=false;
			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==1) {//All or Recall Only
				showRecalls=true;
			}
			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==2) {//All or Exclude Recalls
				showNonRecalls=true;
			}
			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==3) {//All or Hygiene Prescheduled
				showHygienePrescheduled=true;
			}
			Table=Appointments.GetConfirmList(dateFrom,dateTo,provNum,clinicNum,showRecalls,showNonRecalls,showHygienePrescheduled);
			int scrollVal=gridMain.ScrollValue;
			gridMain.BeginUpdate();
			gridMain.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TableConfirmList","Date Time"),70);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","DateSched"),80);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Patient"),80);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Age"),30);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Contact"),150);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Addr/Ph Note"),100);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Status"),80);//confirmed
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Procs"),110);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Medical"),80);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Appt Note"),124);
			gridMain.Columns.Add(col);
			gridMain.Rows.Clear();
			ODGridRow row;
			ODGridCell cell;
			for(int i=0;i<Table.Rows.Count;i++){
				row=new ODGridRow();
				//aptDateTime=PIn.PDateT(table.Rows[i][4].ToString());
				row.Cells.Add(Table.Rows[i]["aptDateTime"].ToString());
				row.Cells.Add(Table.Rows[i]["dateSched"].ToString());
				//aptDateTime.ToShortDateString()+"\r\n"+aptDateTime.ToShortTimeString());
				row.Cells.Add(Table.Rows[i]["patientName"].ToString());
				row.Cells.Add(Table.Rows[i]["age"].ToString());
				row.Cells.Add(Table.Rows[i]["contactMethod"].ToString());
				row.Cells.Add(Table.Rows[i]["AddrNote"].ToString());
				row.Cells.Add(Table.Rows[i]["confirmed"].ToString());
				row.Cells.Add(Table.Rows[i]["ProcDescript"].ToString());
				cell=new ODGridCell(Table.Rows[i]["medNotes"].ToString());
				cell.ColorText=Color.Red;
				row.Cells.Add(cell);
				row.Cells.Add(Table.Rows[i]["Note"].ToString());
				gridMain.Rows.Add(row);
			}
			gridMain.EndUpdate();
			gridMain.ScrollValue=scrollVal;
		}
Esempio n. 9
0
		private void FillGridRecall(){
			gridRecall.BeginUpdate();
			//standard width is 354.  Nice to grow it to 525 if space allows.
			int maxWidth=Width-gridRecall.Left;
			if(maxWidth>525){
				maxWidth=525;
			}
			if(maxWidth>354) {
				gridRecall.Width=maxWidth;
			}
			else {
				gridRecall.Width=354;
			}
			gridRecall.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TableRecall","Type"),90);
			gridRecall.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecall","Due Date"),80);
			gridRecall.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecall","Sched Date"),80);
			gridRecall.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecall","Notes"),80);
			gridRecall.Columns.Add(col);
			gridRecall.Rows.Clear();
			if(PatCur==null){
				gridRecall.EndUpdate();
				return;
			}
			//we just want the recall for the current patient
			List<Recall> recallListPat=new List<Recall>();
			for(int i=0;i<RecallList.Count;i++){
				if(RecallList[i].PatNum==PatCur.PatNum){
					recallListPat.Add(RecallList[i]);
				}
			}
			ODGridRow row;
			ODGridCell cell;
			for(int i=0;i<recallListPat.Count;i++){
				row=new ODGridRow();
				//Type
				string cellStr=RecallTypes.GetDescription(recallListPat[i].RecallTypeNum);
				row.Cells.Add(cellStr);
				//Due date
				if(recallListPat[i].DateDue.Year<1880){
					row.Cells.Add("");
				}
				else{
					cell=new ODGridCell(recallListPat[i].DateDue.ToShortDateString());
					if(recallListPat[i].DateDue<DateTime.Today){
						cell.Bold=YN.Yes;
						cell.ColorText=Color.Firebrick;
					}
					row.Cells.Add(cell);
				}
				//Sched Date
				if(recallListPat[i].DateScheduled.Year>1880){
					row.Cells.Add(recallListPat[i].DateScheduled.ToShortDateString());
				}
				else{
					row.Cells.Add("");
				}
				//Notes
				cellStr="";
				if(recallListPat[i].IsDisabled) {
					cellStr+=Lan.g(this,"Disabled");
					if(recallListPat[i].DatePrevious.Year>1800){
						cellStr+=Lan.g(this,". Previous: ")+recallListPat[i].DatePrevious.ToShortDateString();
						if(recallListPat[i].RecallInterval!=new Interval(0,0,0,0)){
							DateTime duedate=recallListPat[i].DatePrevious+recallListPat[i].RecallInterval;
							cellStr+=Lan.g(this,". (Due): ")+duedate.ToShortDateString();
						}
					}
				}
				if(recallListPat[i].DisableUntilDate.Year>1880) {
					if(cellStr!="") {
						cellStr+=", ";
					}
					cellStr+=Lan.g(this,"Disabled until ")+recallListPat[i].DisableUntilDate.ToShortDateString();
				}
				if(recallListPat[i].DisableUntilBalance>0) {
					if(cellStr!="") {
						cellStr+=", ";
					}
					cellStr+=Lan.g(this,"Disabled until balance ")+recallListPat[i].DisableUntilBalance.ToString("c");
				}
				if(recallListPat[i].RecallStatus!=0) {
					if(cellStr!="") {
						cellStr+=", ";
					}
					cellStr+=DefC.GetName(DefCat.RecallUnschedStatus,recallListPat[i].RecallStatus);
				}
				if(recallListPat[i].Note!="") {
					if(cellStr!="") {
						cellStr+=", ";
					}
					cellStr+=recallListPat[i].Note;
				}
				row.Cells.Add(cellStr);
				gridRecall.Rows.Add(row);
			}
			gridRecall.EndUpdate();
		}
Esempio n. 10
0
		private void FillPaymentPlans(){
			PPBalanceTotal=0;
			if(PatCur==null) {
				gridPayPlan.Visible=false;
				return;
			}
			DataTable table=DataSetMain.Tables["payplan"];
			if (table.Rows.Count == 0) {
				gridPayPlan.Visible=false;
				return;
			}
			if(gridRepeat.Visible){
				gridPayPlan.Location=new Point(0,gridRepeat.Bottom+3);
			}
			else{
				gridPayPlan.Location=gridRepeat.Location;
			}
			gridPayPlan.Visible = true;
			gridPayPlan.Height=100;
			gridPayPlan.BeginUpdate();
			gridPayPlan.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TablePaymentPlans","Date"),65);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Guarantor"),100);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Patient"),100);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Type"),30,HorizontalAlignment.Center);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Principal"),70,HorizontalAlignment.Right);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Total Cost"),70,HorizontalAlignment.Right);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Paid"),70,HorizontalAlignment.Right);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","PrincPaid"),70,HorizontalAlignment.Right);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Balance"),70,HorizontalAlignment.Right);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TablePaymentPlans","Due Now"),70,HorizontalAlignment.Right);
			gridPayPlan.Columns.Add(col);
			col=new ODGridColumn("",70);//filler
			gridPayPlan.Columns.Add(col);
			gridPayPlan.Rows.Clear();
			UI.ODGridRow row;
			UI.ODGridCell cell;
			for(int i=0;i<table.Rows.Count;i++) {
				row=new ODGridRow();
				row.Cells.Add(table.Rows[i]["date"].ToString());
				if(table.Rows[i]["InstallmentPlanNum"].ToString()!="0" && table.Rows[i]["PatNum"].ToString()!=PatCur.Guarantor.ToString()) {//Installment plan and not on guar
					cell=new ODGridCell(((string)"Invalid Guarantor"));
					cell.Bold=YN.Yes;
					cell.ColorText=Color.Red;
				}
				else {
					cell=new ODGridCell(table.Rows[i]["guarantor"].ToString());
				}
				row.Cells.Add(cell);
				row.Cells.Add(table.Rows[i]["patient"].ToString());
				row.Cells.Add(table.Rows[i]["type"].ToString());
				row.Cells.Add(table.Rows[i]["principal"].ToString());
				row.Cells.Add(table.Rows[i]["totalCost"].ToString());
				row.Cells.Add(table.Rows[i]["paid"].ToString());
				row.Cells.Add(table.Rows[i]["princPaid"].ToString());
				row.Cells.Add(table.Rows[i]["balance"].ToString());
				cell=new ODGridCell(table.Rows[i]["due"].ToString());
				if(table.Rows[i]["type"].ToString()!="Ins"){
					cell.Bold=YN.Yes;
					cell.ColorText=Color.Red;
				}
				row.Cells.Add(cell);
				row.Cells.Add("");
				gridPayPlan.Rows.Add(row);
				PPBalanceTotal += (Convert.ToDecimal(PIn.Double(table.Rows[i]["balance"].ToString())));
			}
			gridPayPlan.EndUpdate();
			if(PrefC.GetBool(PrefName.FuchsOptionsOn)) {
				panelTotalOwes.Top=1;
				labelTotalPtOwes.Text=(PPBalanceTotal + (decimal)FamCur.ListPats[0].BalTotal - (decimal)FamCur.ListPats[0].InsEst).ToString("F");
			}
		}
Esempio n. 11
0
		private void FillDunning(){
			dunningList=Dunnings.Refresh();
			gridDun.BeginUpdate();
			gridDun.Columns.Clear();
			ODGridColumn col=new ODGridColumn("Billing Type",80);
			gridDun.Columns.Add(col);
			col=new ODGridColumn("Aging",70);
			gridDun.Columns.Add(col);
			col=new ODGridColumn("Ins",40);
			gridDun.Columns.Add(col);
			col=new ODGridColumn("Message",150);
			gridDun.Columns.Add(col);
			col=new ODGridColumn("Bold Message",150);
			gridDun.Columns.Add(col);
			col=new ODGridColumn("Email",30, HorizontalAlignment.Center);
			gridDun.Columns.Add(col);
			gridDun.Rows.Clear();
			OpenDental.UI.ODGridRow row;
			//string text;
			OpenDental.UI.ODGridCell cell;
			for(int i=0;i<dunningList.Length;i++){
				row=new OpenDental.UI.ODGridRow();
				if(dunningList[i].BillingType==0){
					row.Cells.Add(Lan.g(this,"all"));
				}
				else{
					row.Cells.Add(DefC.GetName(DefCat.BillingTypes,dunningList[i].BillingType));
				}
				if(dunningList[i].AgeAccount==0){
					row.Cells.Add(Lan.g(this,"any"));
				}
				else{
					row.Cells.Add(Lan.g(this,"Over ")+dunningList[i].AgeAccount.ToString());
				}
				if(dunningList[i].InsIsPending==YN.Unknown){
					row.Cells.Add(Lan.g(this,"any"));
				}
				else if(dunningList[i].InsIsPending==YN.Yes){
					row.Cells.Add(Lan.g(this,"Y"));
				}
				else if(dunningList[i].InsIsPending==YN.No){
					row.Cells.Add(Lan.g(this,"N"));
				}
				row.Cells.Add(dunningList[i].DunMessage);
				cell=new ODGridCell(dunningList[i].MessageBold);
				cell.Bold=YN.Yes;
				cell.ColorText=Color.DarkRed;
				row.Cells.Add(cell);
				if(dunningList[i].EmailBody!="" || dunningList[i].EmailSubject!="") {
					row.Cells.Add("X");
				}
				else {
					row.Cells.Add("");
				}
				gridDun.Rows.Add(row);
			}
			gridDun.EndUpdate();
		}
 ///<summary></summary>
 public bool Contains(ODGridCell value)
 {
     //If value is not of type ODGridCell, this will return false.
     return(List.Contains(value));
 }
 ///<summary></summary>
 public void Remove(ODGridCell value)
 {
     List.Remove(value);
 }
 ///<summary></summary>
 public void Insert(int index, ODGridCell value)
 {
     List.Insert(index, value);
 }
Esempio n. 15
0
		private void FillGrid(){
			Recalls.Synch(PatNum);
			Recalls.SynchScheduledApptFull(PatNum);
			RecallList=Recalls.GetList(PatNum);
			gridMain.BeginUpdate();
			gridMain.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TableRecallsPat","Type"),90);
			gridMain.Columns.Add(col);
			//col=new ODGridColumn(Lan.g("TableRecallsPat","Disabled"),60,HorizontalAlignment.Center);
			//gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecallsPat","PreviousDate"),80);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecallsPat","Due Date"),80);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecallsPat","Sched Date"),80);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecallsPat","Interval"),70);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecallsPat","Status"),80);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRecallsPat","Note"),100);
			gridMain.Columns.Add(col);
			gridMain.Rows.Clear();
			ODGridRow row;
			ODGridCell cell;
			IsPerio=false;
			butPerio.Text=Lan.g(this,"Set Perio");
			string cellStr;
			for(int i=0;i<RecallList.Count;i++){
				if(PrefC.GetLong(PrefName.RecallTypeSpecialPerio)==RecallList[i].RecallTypeNum){
					IsPerio=true;
					butPerio.Text=Lan.g(this,"Set Prophy");
				}
				row=new ODGridRow();
				row.Cells.Add(RecallTypes.GetDescription(RecallList[i].RecallTypeNum));
				//if(RecallList[i].IsDisabled){
				//	row.Cells.Add("X");
				//}
				//else{
				//	row.Cells.Add("");
				//}
				if(RecallList[i].DatePrevious.Year<1880){
					row.Cells.Add("");
				}
				else{
					row.Cells.Add(RecallList[i].DatePrevious.ToShortDateString());
				}
				if(RecallList[i].DateDue.Year<1880){
					row.Cells.Add("");
				}
				else{
					cell=new ODGridCell(RecallList[i].DateDue.ToShortDateString());
					if(RecallList[i].DateDue<DateTime.Today){
						cell.Bold=YN.Yes;
						cell.ColorText=Color.Firebrick;
					}
					row.Cells.Add(cell);
				}
				if(RecallList[i].DateScheduled.Year<1880) {
					row.Cells.Add("");
				}
				else {
					row.Cells.Add(RecallList[i].DateScheduled.ToShortDateString());
				}
				row.Cells.Add(RecallList[i].RecallInterval.ToString());
				row.Cells.Add(DefC.GetValue(DefCat.RecallUnschedStatus,RecallList[i].RecallStatus));
				cellStr="";
				if(RecallList[i].IsDisabled) {
					cellStr+=Lan.g(this,"Disabled");
				}
				if(RecallList[i].DisableUntilDate.Year>1880) {
					if(cellStr!="") {
						cellStr+=", ";
					}
					cellStr+=Lan.g(this,"Disabled until ")+RecallList[i].DisableUntilDate.ToShortDateString();
				}
				if(RecallList[i].DisableUntilBalance>0) {
					if(cellStr!="") {
						cellStr+=", ";
					}
					cellStr+=Lan.g(this,"Disabled until balance ")+RecallList[i].DisableUntilBalance.ToString("c");
				}
				if(RecallList[i].Note!="") {
					if(cellStr!="") {
						cellStr+=", ";
					}
					cellStr+=RecallList[i].Note;
				}
				row.Cells.Add(cellStr);
				gridMain.Rows.Add(row);
			}
			gridMain.EndUpdate();
		}
Esempio n. 16
0
		private void FillInsData(){
			if(PatPlanList.Count==0){
				gridIns.BeginUpdate();
				gridIns.Columns.Clear();
				gridIns.Rows.Clear();
				gridIns.EndUpdate();
				return;
			}
			List<InsSub> subArray=new List<InsSub>();//prevents repeated calls to db.
			List<InsPlan> planArray=new List<InsPlan>();
			InsSub sub;
			for(int i=0;i<PatPlanList.Count;i++){
				sub=InsSubs.GetSub(PatPlanList[i].InsSubNum,SubList);
				subArray.Add(sub);
				planArray.Add(InsPlans.GetPlan(sub.PlanNum,PlanList));
			}
			gridIns.BeginUpdate();
			gridIns.Columns.Clear();
			gridIns.Rows.Clear();
			OpenDental.UI.ODGridColumn col;
			col=new ODGridColumn("",150);
			gridIns.Columns.Add(col);
			int dentalOrdinal=1;
			for(int i=0;i<PatPlanList.Count;i++) {
				if(planArray[i].IsMedical) {
					col=new ODGridColumn(Lan.g("TableCoverage","Medical"),170);
					gridIns.Columns.Add(col);
				}
				else { //dental
					if(dentalOrdinal==1) {
						col=new ODGridColumn(Lan.g("TableCoverage","Primary"),170);
						gridIns.Columns.Add(col);
					}
					else if(dentalOrdinal==2) {
						col=new ODGridColumn(Lan.g("TableCoverage","Secondary"),170);
						gridIns.Columns.Add(col);
					}
					else {
						col=new ODGridColumn(Lan.g("TableCoverage","Other"),170);
						gridIns.Columns.Add(col);
					}
					dentalOrdinal++;
				}
			}
			OpenDental.UI.ODGridRow row=new ODGridRow();
			//subscriber
			row.Cells.Add(Lan.g("TableCoverage","Subscriber"));
			for(int i=0;i<PatPlanList.Count;i++){
				row.Cells.Add(FamCur.GetNameInFamFL(subArray[i].Subscriber));
			}
			row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][0].ItemColor;
			gridIns.Rows.Add(row);
			//subscriber ID
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Subscriber ID"));
			for(int i=0;i<PatPlanList.Count;i++) {
				row.Cells.Add(subArray[i].SubscriberID);
			}
			row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][0].ItemColor;
			gridIns.Rows.Add(row);
			//relationship
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Rel'ship to Sub"));
			for(int i=0;i<PatPlanList.Count;i++){
				row.Cells.Add(Lan.g("enumRelat",PatPlanList[i].Relationship.ToString()));
			}
			row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][0].ItemColor;
			gridIns.Rows.Add(row);
			//patient ID
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Patient ID"));
			for(int i=0;i<PatPlanList.Count;i++){
				row.Cells.Add(PatPlanList[i].PatID);
			}
			row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][0].ItemColor;
			gridIns.Rows.Add(row);
			//pending
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Pending"));
			for(int i=0;i<PatPlanList.Count;i++){
				if(PatPlanList[i].IsPending){
					row.Cells.Add("X");
				}
				else{
					row.Cells.Add("");
				}
			}
			row.ColorBackG=DefC.Long[(int)DefCat.MiscColors][0].ItemColor;
			row.ColorLborder=Color.Black;
			gridIns.Rows.Add(row);
			//employer
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Employer"));
			for(int i=0;i<PatPlanList.Count;i++) {
				row.Cells.Add(Employers.GetName(planArray[i].EmployerNum));
			}
			gridIns.Rows.Add(row);
			//carrier
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Carrier"));
			for(int i=0;i<PatPlanList.Count;i++) {
				row.Cells.Add(InsPlans.GetCarrierName(planArray[i].PlanNum,planArray));
			}
			gridIns.Rows.Add(row);
			//group name
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Group Name"));
			for(int i=0;i<PatPlanList.Count;i++) {
				row.Cells.Add(planArray[i].GroupName);
			}
			gridIns.Rows.Add(row);
			//group number
			row=new ODGridRow();
			if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
				row.Cells.Add(Lan.g("TableCoverage","Plan Number"));
			}
			else {
				row.Cells.Add(Lan.g("TableCoverage","Group Number"));
			}
			for(int i=0;i<PatPlanList.Count;i++) {
				row.Cells.Add(planArray[i].GroupNum);
			}
			gridIns.Rows.Add(row);
			//plan type
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Type"));
			for(int i=0;i<planArray.Count;i++) {
				switch(planArray[i].PlanType){
					default://malfunction
						row.Cells.Add("");
						break;
					case "":
						row.Cells.Add(Lan.g(this,"Category Percentage"));
						break;
					case "p":
						row.Cells.Add(Lan.g(this,"PPO Percentage"));
						break;
					case "f":
						row.Cells.Add(Lan.g(this,"Medicaid or Flat Co-pay"));
						break;
					case "c":
						row.Cells.Add(Lan.g(this,"Capitation"));
						break;
				}
			}
			gridIns.Rows.Add(row);
			//fee schedule
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Fee Schedule"));
			for(int i=0;i<planArray.Count;i++) {
				row.Cells.Add(FeeScheds.GetDescription(planArray[i].FeeSched));
			}
			row.ColorLborder=Color.Black;
			gridIns.Rows.Add(row);
			//Calendar vs service year------------------------------------------------------------------------------------
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Benefit Period"));
			for(int i=0;i<planArray.Count;i++) {
				if(planArray[i].MonthRenew==0) {
					row.Cells.Add(Lan.g("TableCoverage","Calendar Year"));
				}
				else {
					DateTime dateservice=new DateTime(2000,planArray[i].MonthRenew,1);
					row.Cells.Add(Lan.g("TableCoverage","Service year begins:")+" "+dateservice.ToString("MMMM"));
				}
			}
			gridIns.Rows.Add(row);
			//Benefits-----------------------------------------------------------------------------------------------------
			List <Benefit> bensForPat=Benefits.Refresh(PatPlanList,SubList);
			Benefit[,] benMatrix=Benefits.GetDisplayMatrix(bensForPat,PatPlanList,SubList);
			string desc;
			string val;
			ProcedureCode proccode=null;
			for(int y=0;y<benMatrix.GetLength(1);y++){//rows
				row=new ODGridRow();
				desc="";
				//some of the columns might be null, but at least one will not be.  Find it.
				for(int x=0;x<benMatrix.GetLength(0);x++){//columns
					if(benMatrix[x,y]==null){
						continue;
					}
					//create a description for the benefit
					if(benMatrix[x,y].PatPlanNum!=0) {
						desc+=Lan.g(this,"(pat)")+" ";
					}
					if(benMatrix[x,y].CoverageLevel==BenefitCoverageLevel.Family) {
						desc+=Lan.g(this,"Fam")+" ";
					}
					if(benMatrix[x,y].CodeNum!=0) {
						proccode=ProcedureCodes.GetProcCode(benMatrix[x,y].CodeNum);
					}
					if(benMatrix[x,y].BenefitType==InsBenefitType.CoInsurance && benMatrix[x,y].Percent != -1) {
						if(benMatrix[x,y].CodeNum==0) {
							desc+=CovCats.GetDesc(benMatrix[x,y].CovCatNum)+" % ";
						}
						else {
							desc+=proccode.ProcCode+"-"+proccode.AbbrDesc+" % ";
						}
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Deductible) {
						desc+=Lan.g(this,"Deductible")+" "+CovCats.GetDesc(benMatrix[x,y].CovCatNum)+" ";
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Limitations
						&& benMatrix[x,y].QuantityQualifier==BenefitQuantity.None
						&& (benMatrix[x,y].TimePeriod==BenefitTimePeriod.ServiceYear
						|| benMatrix[x,y].TimePeriod==BenefitTimePeriod.CalendarYear))
					{//annual max
						desc+=Lan.g(this,"Annual Max")+" ";
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Limitations
						&& CovCats.GetForEbenCat(EbenefitCategory.Orthodontics)!=null
						&& benMatrix[x,y].CovCatNum==CovCats.GetForEbenCat(EbenefitCategory.Orthodontics).CovCatNum
						&& benMatrix[x,y].QuantityQualifier==BenefitQuantity.None
						&& benMatrix[x,y].TimePeriod==BenefitTimePeriod.Lifetime)
					{
						desc+=Lan.g(this,"Ortho Max")+" ";
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Limitations
						&& CovCats.GetForEbenCat(EbenefitCategory.RoutinePreventive)!=null
						&& benMatrix[x,y].CovCatNum==CovCats.GetForEbenCat(EbenefitCategory.RoutinePreventive).CovCatNum
						&& benMatrix[x,y].Quantity !=0)
					{
						desc+="Exam frequency ";
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Limitations
						&& benMatrix[x,y].CodeNum==ProcedureCodes.GetCodeNum("D0274")//4BW
						&& benMatrix[x,y].Quantity !=0)
					{
						desc+="BW frequency ";
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Limitations
						&& benMatrix[x,y].CodeNum==ProcedureCodes.GetCodeNum("D0330")//Pano
						&& benMatrix[x,y].Quantity !=0)
					{
						desc+="Pano/FMX frequency ";
					}
					else if(benMatrix[x,y].CodeNum==0){//e.g. flo
						desc+=ProcedureCodes.GetProcCode(benMatrix[x,y].CodeNum).AbbrDesc+" ";
					}
					else{
						desc+=Lan.g("enumInsBenefitType",benMatrix[x,y].BenefitType.ToString())+" ";
					}
					row.Cells.Add(desc);
					break;
				}
				//remember that matrix does not include the description column
				for(int x=0;x<benMatrix.GetLength(0);x++){//columns
					val="";
					//this matrix cell might be null
					if(benMatrix[x,y]==null){
						row.Cells.Add("");
						continue;
					}
					if(benMatrix[x,y].Percent != -1) {
						val+=benMatrix[x,y].Percent.ToString()+"% ";
					}
					if(benMatrix[x,y].MonetaryAmt != -1) {
						val+=benMatrix[x,y].MonetaryAmt.ToString("c0")+" ";
					}
					/*
					if(benMatrix[x,y].BenefitType==InsBenefitType.CoInsurance) {
						val+=benMatrix[x,y].Percent.ToString()+" ";
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Deductible
						&& benMatrix[x,y].MonetaryAmt==0)
					{//deductible 0
						val+=benMatrix[x,y].MonetaryAmt.ToString("c0")+" ";
					}
					else if(benMatrix[x,y].BenefitType==InsBenefitType.Limitations
						&& benMatrix[x,y].QuantityQualifier==BenefitQuantity.None
						&& (benMatrix[x,y].TimePeriod==BenefitTimePeriod.ServiceYear
						|| benMatrix[x,y].TimePeriod==BenefitTimePeriod.CalendarYear)
						&& benMatrix[x,y].MonetaryAmt==0)
					{//annual max 0
						val+=benMatrix[x,y].MonetaryAmt.ToString("c0")+" ";
					}*/
					if(benMatrix[x,y].BenefitType==InsBenefitType.Exclusions
						|| benMatrix[x,y].BenefitType==InsBenefitType.Limitations) 
					{
						if(benMatrix[x,y].CodeNum != 0) {
							proccode=ProcedureCodes.GetProcCode(benMatrix[x,y].CodeNum);
							val+=proccode.ProcCode+"-"+proccode.AbbrDesc+" ";
						}
						else if(benMatrix[x,y].CovCatNum != 0){
							val+=CovCats.GetDesc(benMatrix[x,y].CovCatNum)+" ";
						}
					}
					if(benMatrix[x,y].QuantityQualifier==BenefitQuantity.NumberOfServices){//eg 2 times per CalendarYear
						val+=benMatrix[x,y].Quantity.ToString()+" "+Lan.g(this,"times per")+" "
							+Lan.g("enumBenefitQuantity",benMatrix[x,y].TimePeriod.ToString())+" ";
					}
					else if(benMatrix[x,y].QuantityQualifier==BenefitQuantity.Months) {//eg Every 2 months
						val+=Lan.g(this,"Every ")+benMatrix[x,y].Quantity.ToString()+" month";
						if(benMatrix[x,y].Quantity>1){
							val+="s";
						}
					}
					else if(benMatrix[x,y].QuantityQualifier==BenefitQuantity.Years) {//eg Every 2 years
						val+="Every "+benMatrix[x,y].Quantity.ToString()+" year";
						if(benMatrix[x,y].Quantity>1) {
							val+="s";
						}
					}
					else{
						if(benMatrix[x,y].QuantityQualifier!=BenefitQuantity.None){//e.g. flo
							val+=Lan.g("enumBenefitQuantity",benMatrix[x,y].QuantityQualifier.ToString())+" ";
						}
						if(benMatrix[x,y].Quantity!=0){
							val+=benMatrix[x,y].Quantity.ToString()+" ";
						}
					}
					//if(benMatrix[x,y].MonetaryAmt!=0){
					//	val+=benMatrix[x,y].MonetaryAmt.ToString("c0")+" ";
					//}
					//if(val==""){
					//	val="val";
					//}
					row.Cells.Add(val);
				}
				gridIns.Rows.Add(row);
			}
			//Plan note
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Ins Plan Note"));
			OpenDental.UI.ODGridCell cell;
			for(int i=0;i<PatPlanList.Count;i++){
				cell=new ODGridCell();
				cell.Text=planArray[i].PlanNote;
				cell.ColorText=Color.Red;
				cell.Bold=YN.Yes;
				row.Cells.Add(cell);
			}
			gridIns.Rows.Add(row);
			//Subscriber Note
			row=new ODGridRow();
			row.Cells.Add(Lan.g("TableCoverage","Subscriber Note"));
			for(int i=0;i<PatPlanList.Count;i++) {
				cell=new ODGridCell();
				cell.Text=subArray[i].SubscNote;
				cell.ColorText=Color.Red;
				cell.Bold=YN.Yes;
				row.Cells.Add(cell);
			}
			gridIns.Rows.Add(row);
			gridIns.EndUpdate();
		}
Esempio n. 17
0
		private void FillMain(){
			DateTime dateFrom=PIn.Date(textDateFrom.Text);
			DateTime dateTo=PIn.Date(textDateTo.Text);
			long provNum=0;
			if(comboProv.SelectedIndex!=0) {
				provNum=ProviderC.ListShort[comboProv.SelectedIndex-1].ProvNum;
			}
			long clinicNum=0;
			if(comboClinic.SelectedIndex > 0) {
				clinicNum=Clinics.List[comboClinic.SelectedIndex-1].ClinicNum;
			}
			bool showRecalls=false;
			bool showNonRecalls=false;
			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==1) {//All or Recall Only
				showRecalls=true;
			}
			if(comboShowRecall.SelectedIndex==0 || comboShowRecall.SelectedIndex==2) {//All or Exclude Recalls
				showNonRecalls=true;
			}
			Table=Appointments.GetConfirmList(dateFrom,dateTo,provNum,clinicNum,showRecalls,showNonRecalls);
			int scrollVal=grid.ScrollValue;
			grid.BeginUpdate();
			grid.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TableConfirmList","Date Time"),70);
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Patient"),80);
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Age"),30);
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Contact"),150);
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Addr/Ph Note"),100);
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Status"),80);//confirmed
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Procs"),110);
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Medical"),80);
			grid.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableConfirmList","Appt Note"),204);
			grid.Columns.Add(col);
			grid.Rows.Clear();
			ODGridRow row;
			ODGridCell cell;
			for(int i=0;i<Table.Rows.Count;i++){
				row=new ODGridRow();
				//aptDateTime=PIn.PDateT(table.Rows[i][4].ToString());
				row.Cells.Add(Table.Rows[i]["aptDateTime"].ToString());
				//aptDateTime.ToShortDateString()+"\r\n"+aptDateTime.ToShortTimeString());
				row.Cells.Add(Table.Rows[i]["patientName"].ToString());
				row.Cells.Add(Table.Rows[i]["age"].ToString());
				row.Cells.Add(Table.Rows[i]["contactMethod"].ToString());
				row.Cells.Add(Table.Rows[i]["AddrNote"].ToString());
				row.Cells.Add(Table.Rows[i]["confirmed"].ToString());
				row.Cells.Add(Table.Rows[i]["ProcDescript"].ToString());
				cell=new ODGridCell(Table.Rows[i]["medNotes"].ToString());
				cell.ColorText=Color.Red;
				row.Cells.Add(cell);
				row.Cells.Add(Table.Rows[i]["Note"].ToString());
				grid.Rows.Add(row);
			}
			grid.EndUpdate();
			grid.ScrollValue=scrollVal;
		}
 ///<summary></summary>
 public int Add(ODGridCell value)
 {
     return(List.Add(value));
 }