///<summary>raised for each page to be printed.</summary> private void pdCards_PrintPage(object sender, PrintPageEventArgs ev){ int totalPages=(int)Math.Ceiling((double)AddrTable.Rows.Count/(double)PrefC.GetLong(PrefName.RecallPostcardsPerSheet)); Graphics g=ev.Graphics; int yAdj=(int)(PrefC.GetDouble(PrefName.RecallAdjustDown)*100); int xAdj=(int)(PrefC.GetDouble(PrefName.RecallAdjustRight)*100); float yPos=0+yAdj;//these refer to the upper left origin of each postcard float xPos=0+xAdj; string str; while(yPos<ev.PageBounds.Height-100 && patientsPrinted<AddrTable.Rows.Count){ //Return Address-------------------------------------------------------------------------- if(PrefC.GetBool(PrefName.RecallCardsShowReturnAdd)){ if(PrefC.GetBool(PrefName.EasyNoClinics) || PIn.Long(AddrTable.Rows[patientsPrinted]["ClinicNum"].ToString())==0) {//No clinics or no clinic selected for this appt str=PrefC.GetString(PrefName.PracticeTitle)+"\r\n"; g.DrawString(str,new Font(FontFamily.GenericSansSerif,9,FontStyle.Bold),Brushes.Black,xPos+45,yPos+60); str=PrefC.GetString(PrefName.PracticeAddress)+"\r\n"; if(PrefC.GetString(PrefName.PracticeAddress2)!="") { str+=PrefC.GetString(PrefName.PracticeAddress2)+"\r\n"; } str+=PrefC.GetString(PrefName.PracticeCity)+", "+PrefC.GetString(PrefName.PracticeST)+" "+PrefC.GetString(PrefName.PracticeZip)+"\r\n"; string phone=PrefC.GetString(PrefName.PracticePhone); if(CultureInfo.CurrentCulture.Name=="en-US"&& phone.Length==10) { str+="("+phone.Substring(0,3)+")"+phone.Substring(3,3)+"-"+phone.Substring(6); } else {//any other phone format str+=phone; } } else {//Clinics enabled and clinic selected Clinic clinic=Clinics.GetClinic(PIn.Long(AddrTable.Rows[patientsPrinted]["ClinicNum"].ToString())); str=clinic.Description+"\r\n"; g.DrawString(str,new Font(FontFamily.GenericSansSerif,9,FontStyle.Bold),Brushes.Black,xPos+45,yPos+60); str=clinic.Address+"\r\n"; if(clinic.Address2!="") { str+=clinic.Address2+"\r\n"; } str+=clinic.City+", "+clinic.State+" "+clinic.Zip+"\r\n"; string phone=clinic.Phone; if(CultureInfo.CurrentCulture.Name=="en-US"&& phone.Length==10) { str+="("+phone.Substring(0,3)+")"+phone.Substring(3,3)+"-"+phone.Substring(6); } else {//any other phone format str+=phone; } } g.DrawString(str,new Font(FontFamily.GenericSansSerif,8),Brushes.Black,xPos+45,yPos+75); } //Body text------------------------------------------------------------------------------- str=PrefC.GetString(PrefName.ConfirmPostcardMessage); //textPostcardMessage.Text; str=str.Replace("[date]",PIn.Date(AddrTable.Rows[patientsPrinted]["AptDateTime"].ToString()).ToShortDateString()); str=str.Replace("[time]",PIn.Date(AddrTable.Rows[patientsPrinted]["AptDateTime"].ToString()).ToShortTimeString()); g.DrawString(str,new Font(FontFamily.GenericSansSerif,10),Brushes.Black,new RectangleF(xPos+45,yPos+180,250,190)); //Patient's Address----------------------------------------------------------------------- str=AddrTable.Rows[patientsPrinted]["FName"].ToString()+" " +AddrTable.Rows[patientsPrinted]["MiddleI"].ToString()+" " +AddrTable.Rows[patientsPrinted]["LName"].ToString()+"\r\n" +AddrTable.Rows[patientsPrinted]["Address"].ToString()+"\r\n"; if(AddrTable.Rows[patientsPrinted]["Address2"].ToString()!=""){ str+=AddrTable.Rows[patientsPrinted]["Address2"].ToString()+"\r\n"; } str+=AddrTable.Rows[patientsPrinted]["City"].ToString()+", " +AddrTable.Rows[patientsPrinted]["State"].ToString()+" " +AddrTable.Rows[patientsPrinted]["Zip"].ToString()+"\r\n"; g.DrawString(str,new Font(FontFamily.GenericSansSerif,11),Brushes.Black,xPos+320,yPos+240); if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==1){ yPos+=400; } else if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==3){ yPos+=366; } else{//4 xPos+=550; if(xPos>1000){ xPos=0+xAdj; yPos+=425; } } patientsPrinted++; }//while pagesPrinted++; if(pagesPrinted==totalPages){ ev.HasMorePages=false; pagesPrinted=0; patientsPrinted=0; } else{ ev.HasMorePages=true; } }
private void FormRecallSetup_Load(object sender, System.EventArgs e) { checkGroupFamilies.Checked = PrefC.GetBool(PrefName.RecallGroupByFamily); textPostcardsPerSheet.Text = PrefC.GetLong(PrefName.RecallPostcardsPerSheet).ToString(); checkReturnAdd.Checked = PrefC.GetBool(PrefName.RecallCardsShowReturnAdd); checkGroupFamilies.Checked = PrefC.GetBool(PrefName.RecallGroupByFamily); if (PrefC.GetLong(PrefName.RecallDaysPast) == -1) { textDaysPast.Text = ""; } else { textDaysPast.Text = PrefC.GetLong(PrefName.RecallDaysPast).ToString(); } if (PrefC.GetLong(PrefName.RecallDaysFuture) == -1) { textDaysFuture.Text = ""; } else { textDaysFuture.Text = PrefC.GetLong(PrefName.RecallDaysFuture).ToString(); } textRight.Text = PrefC.GetDouble(PrefName.RecallAdjustRight).ToString(); textDown.Text = PrefC.GetDouble(PrefName.RecallAdjustDown).ToString(); //comboStatusMailedRecall.Items.Clear(); for (int i = 0; i < DefC.Short[(int)DefCat.RecallUnschedStatus].Length; i++) { comboStatusMailedRecall.Items.Add(DefC.Short[(int)DefCat.RecallUnschedStatus][i].ItemName); comboStatusEmailedRecall.Items.Add(DefC.Short[(int)DefCat.RecallUnschedStatus][i].ItemName); if (DefC.Short[(int)DefCat.RecallUnschedStatus][i].DefNum == PrefC.GetLong(PrefName.RecallStatusMailed)) { comboStatusMailedRecall.SelectedIndex = i; } if (DefC.Short[(int)DefCat.RecallUnschedStatus][i].DefNum == PrefC.GetLong(PrefName.RecallStatusEmailed)) { comboStatusEmailedRecall.SelectedIndex = i; } } for (int i = 0; i < DefC.Short[(int)DefCat.ApptConfirmed].Length; i++) { comboStatusEmailedConfirm.Items.Add(DefC.Short[(int)DefCat.ApptConfirmed][i].ItemName); if (DefC.Short[(int)DefCat.ApptConfirmed][i].DefNum == PrefC.GetLong(PrefName.ConfirmStatusEmailed)) { comboStatusEmailedConfirm.SelectedIndex = i; } } List <long> recalltypes = new List <long>(); string[] typearray = PrefC.GetString(PrefName.RecallTypesShowingInList).Split(','); if (typearray.Length > 0) { for (int i = 0; i < typearray.Length; i++) { recalltypes.Add(PIn.Long(typearray[i])); } } for (int i = 0; i < RecallTypeC.Listt.Count; i++) { listTypes.Items.Add(RecallTypeC.Listt[i].Description); if (recalltypes.Contains(RecallTypeC.Listt[i].RecallTypeNum)) { listTypes.SetSelected(i, true); } } if (PrefC.GetLong(PrefName.RecallShowIfDaysFirstReminder) == -1) { textDaysFirstReminder.Text = ""; } else { textDaysFirstReminder.Text = PrefC.GetLong(PrefName.RecallShowIfDaysFirstReminder).ToString(); } if (PrefC.GetLong(PrefName.RecallShowIfDaysSecondReminder) == -1) { textDaysSecondReminder.Text = ""; } else { textDaysSecondReminder.Text = PrefC.GetLong(PrefName.RecallShowIfDaysSecondReminder).ToString(); } if (PrefC.GetLong(PrefName.RecallMaxNumberReminders) == -1) { textMaxReminders.Text = ""; } else { textMaxReminders.Text = PrefC.GetLong(PrefName.RecallMaxNumberReminders).ToString(); } if (PrefC.GetBool(PrefName.RecallUseEmailIfHasEmailAddress)) { radioUseEmailTrue.Checked = true; } else { radioUseEmailFalse.Checked = true; } FillGrid(); }