///<summary></summary> private void FillGrid() { if (!checkWebSchedNewPat.Checked && !checkWebSchedRecall.Checked) { gridMain.BeginUpdate(); gridMain.Rows.Clear(); gridMain.EndUpdate(); return; } DataTable table = GetAppointments(); gridMain.BeginUpdate(); //Columns gridMain.Columns.Clear(); ODGridColumn col; if (PrefC.HasClinicsEnabled) { col = new ODGridColumn(Lan.g(this, "Clinic"), 100); gridMain.Columns.Add(col); } col = new ODGridColumn(Lan.g(this, "Date Time Created"), 150); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Appt Date Time"), 150); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Patient Name"), 150); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Patient DOB"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Confirmation Status"), 150); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Appt Note"), 300); gridMain.Columns.Add(col); //Rows gridMain.Rows.Clear(); DataColumnCollection columns = table.Columns; foreach (DataRow row in table.Rows) { ODGridCell[] cellsArray = new ODGridCell[gridMain.Columns.Count]; ODGridRow newRow = new ODGridRow(); if (PrefC.HasClinicsEnabled) { newRow.Cells.Add(row["ClinicDesc"].ToString()); } newRow.Cells.Add(PIn.Date(row["DateTimeCreated"].ToString()).ToString("d")); newRow.Cells.Add(row["AptDateTime"].ToString()); newRow.Cells.Add(row["PatName"].ToString()); newRow.Cells.Add(PIn.Date(row["Birthdate"].ToString()).ToString("d")); newRow.Cells.Add(Defs.GetDef(DefCat.ApptConfirmed, PIn.Long(row["Confirmed"].ToString())).ItemName); newRow.Cells.Add(row["Note"].ToString()); newRow.Tag = row["AptNum"].ToString(); gridMain.Rows.Add(newRow); } gridMain.EndUpdate(); }
private void gridMain_CellClick(object sender, ODGridClickEventArgs e) { ODGridCell gridCellCur = gridMain.Rows[e.Row].Cells[e.Col]; //Only grid cells with phone numbers are blue and underlined. if (gridCellCur.ColorText == System.Drawing.Color.Blue && gridCellCur.Underline == YN.Yes && Programs.GetCur(ProgramName.DentalTekSmartOfficePhone).Enabled) { DentalTek.PlaceCall(gridCellCur.Text); } }
private void FillMain() { DateTime dateFrom = PIn.PDate(textDateFrom.Text); DateTime dateTo = PIn.PDate(textDateTo.Text); table = Appointments.GetConfirmList(dateFrom, dateTo); 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; }
private void FillList() { Programs.RefreshCache(); _listPrograms = Programs.GetListDeep(); gridProgram.BeginUpdate(); gridProgram.Columns.Clear(); gridProgram.Columns.Add(new ODGridColumn("Enabled", 55, HorizontalAlignment.Center)); gridProgram.Columns.Add(new ODGridColumn("Program Name", -1)); gridProgram.Rows.Clear(); foreach (Program prog in _listPrograms) { ODGridRow row = new ODGridRow() { Tag = prog }; Color color = Color.FromArgb(230, 255, 238); row.ColorBackG = prog.Enabled ? color : row.ColorBackG; ODGridCell cell = new ODGridCell(prog.Enabled ? "X" : ""); row.Cells.Add(cell); row.Cells.Add(prog.ProgDesc); gridProgram.Rows.Add(row); } gridProgram.EndUpdate(); }
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>Supply pd so that we know the paper size and margins.</summary> public static void CreateDocument(FormRpStatement sender, MigraDoc.DocumentObjectModel.Document doc, PrintDocument pd, Family fam, Patient pat, DataSet dataSet, Statement Stmt) { //doc= new MigraDoc.DocumentObjectModel.Document();//don't do this or the reference to the original doc will be lost. 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]; //.Copy(); //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); text = "This statement was generated from the plug-in"; par.AddFormattedText(text, font); text = DateTime.Today.ToShortDateString(); font = MigraDocHelper.CreateFont(10); par.AddLineBreak(); par.AddFormattedText(text, font); text = Lan.g("FormRpStatement", "Account Number") + " "; if (PrefC.GetBool(PrefName.StatementAccountsUseChartNumber)) { text += PatGuar.ChartNumber; } else { text += PatGuar.PatNum; } par.AddLineBreak(); par.AddFormattedText(text, font); TextFrame frame; #endregion //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(); 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 { 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") //English (Australia) { Provider defaultProv = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv)); par.AddText("ABN: " + defaultProv.NationalProvID); 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 { 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("FormRpStatement", "Amount Due"), font); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "Date Due"), font); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "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; } } text = balTotal.ToString("F"); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(text, font); if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1) { text = Lan.g("FormRpStatement", "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("FormRpStatement", "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); System.Drawing.Image img = new Bitmap(500, 30); Graphics g = Graphics.FromImage(img); //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("FormRpStatement", "#"); 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("FormRpStatement", "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("FormRpStatement", "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("FormRpStatement", "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("FormRpStatement", "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("FormRpStatement", "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("FormRpStatement", "(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); g.Dispose(); img = null; } } #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.GetNameInFamFL(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 { par.AddText(PatGuar.City + ", " + PatGuar.State + " " + PatGuar.Zip); } //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("FormRpStatement", "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.List.Length); 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.List.Length; i++) //All non-hidden providers are added to the legend. { Provider prov = ProviderC.List[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("FormRpStatement", "0-30"), font); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "31-60"), font); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "61-90"), font); cell = row.Cells[3]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "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); } #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 (PrefC.GetBool(PrefName.BalancesDontSubtractIns)) { text = Lan.g("FormRpStatement", "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("FormRpStatement", "Balance:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "-Ins Estimate:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "=Owed Now:"); par.AddFormattedText(text, fontBold); par.AddLineBreak(); } else { text = Lan.g("FormRpStatement", "Total:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "-Ins Estimate:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "=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 (PrefC.GetBool(PrefName.BalancesDontSubtractIns)) { text = PatGuar.BalTotal.ToString("c"); par.AddFormattedText(text, fontBold); //par.AddLineBreak(); //text = PatGuar.InsEst.ToString("c"); //par.AddFormattedText(text, font); //par.AddLineBreak(); //text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c"); //par.AddFormattedText(text, font); //par.AddLineBreak(); } 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("FormRpStatement", "Date"), 73); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "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("FormRpStatement", "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("FormRpStatement", "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("FormRpStatement", "Date"), 73); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Patient"), 100); gridPat.Columns.Add(gcol); //prov gcol = new ODGridColumn(Lan.g("FormRpStatement", "Code"), 45); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Tooth"), 42); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "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++) { grow = new ODGridRow(); grow.Cells.Add(tableAccount.Rows[p]["date"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["patient"].ToString()); 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 //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 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("FormRpStatement", "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 //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); } //return doc; }
private void FillGrid() { Recalls.Synch(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); } //row.Cells.Add("");//sched 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(); }
///<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.PDate(textDateStart.Text), PIn.PDate(textDateStop.Text), false, IsBreaks); if (IsBreaks) { TimeAdjustList = new TimeAdjust[0]; } else { TimeAdjustList = TimeAdjusts.Refresh(EmployeeCur.EmployeeNum, PIn.PDate(textDateStart.Text), PIn.PDate(textDateStop.Text)); } } mergedAL = new ArrayList(); for (int i = 0; i < ClockEventList.Length; i++) { mergedAL.Add(ClockEventList[i]); } for (int i = 0; i < TimeAdjustList.Length; 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.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Status"), 50); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "In/Out"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Time"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); if (IsBreaks) { col = new ODGridColumn(Lan.g(this, "Minutes"), 50, HorizontalAlignment.Right); } else { col = new ODGridColumn(Lan.g(this, "Hours"), 50, 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; //TimeSpan weeklyTotalPrevious= WeeklyTotals = new TimeSpan[mergedAL.Count]; TimeSpan alteredSpan = new TimeSpan(0); //used to display altered times TimeSpan pairSpan = new TimeSpan(0); //used to sum one pair of clockevents ClockEvent pairFirst = null; //the first of a pair of clockevents 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)); } //MessageBox.Show(weekSpan.TotalHours.ToString()); 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.TimeDisplayed.Date; if (curDate == previousDate) { row.Cells.Add(""); row.Cells.Add(""); } else { row.Cells.Add(curDate.ToShortDateString()); row.Cells.Add(curDate.DayOfWeek.ToString()); } //altered-------------------------------------- if (clock.TimeEntered != clock.TimeDisplayed) { alteredSpan = clock.TimeDisplayed - clock.TimeEntered; if (IsBreaks) { row.Cells.Add(alteredSpan.TotalMinutes.ToString("n")); } else { row.Cells.Add(alteredSpan.TotalHours.ToString("n")); } } else { row.Cells.Add(""); } //status-------------------------------------- row.Cells.Add(clock.ClockStatus.ToString()); //in/out------------------------------------------ if (clock.ClockIn) { row.Cells.Add(Lan.g(this, "In")); } else { row.Cells.Add(Lan.g(this, "Out")); } //time----------------------------- row.Cells.Add(clock.TimeDisplayed.ToShortTimeString()); //minutes or hours------------------------------- if (IsBreaks) //breaks { if (!clock.ClockIn) //clocking out { pairFirst = clock.Copy(); row.Cells.Add(""); } else //clocking in { if (pairFirst == null) { row.Cells.Add(""); } else { pairSpan = clock.TimeDisplayed - pairFirst.TimeDisplayed; row.Cells.Add(pairSpan.TotalMinutes.ToString("n")); daySpan += pairSpan; //weekSpan+=pairSpan; periodSpan += pairSpan; } } } else //regular hours { if (clock.ClockIn) //clocking in { pairFirst = clock.Copy(); row.Cells.Add(""); } else //clocking out { if (pairFirst == null) { row.Cells.Add(""); } else { pairSpan = clock.TimeDisplayed - pairFirst.TimeDisplayed; row.Cells.Add(pairSpan.TotalHours.ToString("n")); daySpan += pairSpan; weekSpan += pairSpan; periodSpan += pairSpan; } } } //Overtime------------------------------ row.Cells.Add(""); //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.ClockIn) //if they have not clocked back in yet from break //display the timespan of pairSpan using current time as the other number. { pairSpan = DateTime.Now - clock.TimeDisplayed + TimeDelta; row.Cells.Add(pairSpan.TotalMinutes.ToString("n")); daySpan += pairSpan; } else { row.Cells.Add(daySpan.TotalMinutes.ToString("n")); } } else { row.Cells.Add(daySpan.TotalHours.ToString("n")); } 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.TimeDisplayed.Date, rule, DayOfWeek.Sunday)) //different week of year { row.Cells.Add(weekSpan.TotalHours.ToString("n")); weekSpan = new TimeSpan(0); } else { 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(""); //2 //status-------------------------------------- row.Cells.Add(Lan.g(this, "Adjust")); //3 row.ColorText = Color.Red; //in/out------------------------------------------ row.Cells.Add(""); //4 //time----------------------------- row.Cells.Add(adjust.TimeEntry.ToShortTimeString()); //5 //minutes or hours------------------------------- if (adjust.RegHours.TotalHours == 0) { row.Cells.Add(""); //6 } else { daySpan += adjust.RegHours; //might be negative weekSpan += adjust.RegHours; periodSpan += adjust.RegHours; row.Cells.Add(adjust.RegHours.TotalHours.ToString("n")); //6 } //Overtime------------------------------ if (adjust.OTimeHours.TotalHours != 0) { otspan += adjust.OTimeHours; row.Cells.Add(adjust.OTimeHours.TotalHours.ToString("n")); //7 } else { row.Cells.Add(""); //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(daySpan.TotalHours.ToString("n")); //8 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(weekSpan.TotalHours.ToString("n")); 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.TotalHours.ToString("n"); textOvertime.Text = otspan.TotalHours.ToString("n"); } }
public ODGridRow ToGridRow() { ODGridRow row = new ODGridRow(); ODGridCell cell; if (Proc != null && Adj == null) //A procedure row //Date { cell = new ODGridCell(Proc.ProcDate.ToShortDateString()); row.Cells.Add(cell); //Provider cell = new ODGridCell(Providers.GetAbbr(Proc.ProvNum)); row.Cells.Add(cell); //Clinic if (PrefC.HasClinicsEnabled) { cell = new ODGridCell(Clinics.GetAbbr(Proc.ClinicNum)); row.Cells.Add(cell); } //Code cell = new ODGridCell(ProcedureCodes.GetStringProcCode(Proc.CodeNum)); row.Cells.Add(cell); //Fee; cell = new ODGridCell(Proc.ProcFee.ToString("c")); cell.CellColor = Color.LightYellow; row.Cells.Add(cell); //Rem Before cell = new ODGridCell(RemBefore.ToString("c")); cell.CellColor = Color.LightYellow; row.Cells.Add(cell); //Adj Amt cell = new ODGridCell(""); cell.CellColor = Color.White; row.Cells.Add(cell); //Rem After cell = new ODGridCell(""); cell.CellColor = Color.White; row.Cells.Add(cell); } else if (IsUnattachedRowHeader()) //The row header for unattached adjustments { row.ColorBackG = Color.LightYellow; //Date cell = new ODGridCell("Unassigned"); row.Cells.Add(cell); //Provider cell = new ODGridCell(""); row.Cells.Add(cell); //Clinic if (PrefC.HasClinicsEnabled) { cell = new ODGridCell(""); row.Cells.Add(cell); } //Code cell = new ODGridCell(""); row.Cells.Add(cell); //Fee; cell = new ODGridCell(""); row.Cells.Add(cell); //Rem Before cell = new ODGridCell(""); row.Cells.Add(cell); //Adj Amt cell = new ODGridCell(""); row.Cells.Add(cell); //Rem After cell = new ODGridCell(""); row.Cells.Add(cell); } else //An adjustment row //Adj Date { cell = new ODGridCell(Adj.AdjDate.ToShortDateString()); row.Cells.Add(cell); //Provider cell = new ODGridCell(Providers.GetAbbr(Adj.ProvNum)); row.Cells.Add(cell); //Clinic if (PrefC.HasClinicsEnabled) { cell = new ODGridCell(Clinics.GetAbbr(Adj.ClinicNum)); row.Cells.Add(cell); } //Adj Type cell = new ODGridCell(GetAdjustmentType(Adj)); row.Cells.Add(cell); //Fee cell = new ODGridCell(); row.Cells.Add(cell); //Rem Before cell = new ODGridCell(); row.Cells.Add(cell); //Adj Amt cell = new ODGridCell(Math.Round(Adj.AdjAmt, 2).ToString()); cell.CellColor = Color.LightCyan; row.Cells.Add(cell); //Rem After cell = new ODGridCell(Math.Round(RemAfter, 2).ToString()); if (Proc == null) //Unassigned adj { cell = new ODGridCell(); } cell.CellColor = Color.LightCyan; row.Cells.Add(cell); } return(row); }
public static void FillPtInfo(OpenDental.ContrChart sender, Patient PatCur) { //first, get all the objects we need. Because they are by ref, the original gets altered. ODGrid gridPtInfo = (ODGrid)sender.Controls.Find("gridPtInfo", true)[0]; TabControl tabControlImages = (TabControl)sender.Controls.Find("tabControlImages", true)[0]; TextBox textTreatmentNotes = (TextBox)sender.Controls.Find("textTreatmentNotes", true)[0]; //bool TreatmentNoteChanged=sender.TreatmentNoteChanged;//might have to do a by ref here? //Then get some data that we need Family fam = null; PatientNote PatientNoteCur = null; List <PatPlan> PatPlanList = null; List <InsSub> SubList = null; List <InsPlan> PlanList = null; if (PatCur != null) { fam = Patients.GetFamily(PatCur.PatNum); PatientNoteCur = PatientNotes.Refresh(PatCur.PatNum, PatCur.Guarantor); PatPlanList = PatPlans.Refresh(PatCur.PatNum); SubList = InsSubs.RefreshForFam(fam); PlanList = InsPlans.RefreshForSubList(SubList); } //Then, continue with the slightly altered original method. gridPtInfo.Height = tabControlImages.Top - gridPtInfo.Top; textTreatmentNotes.Text = ""; if (PatCur != null) { textTreatmentNotes.Text = PatientNoteCur.Treatment; textTreatmentNotes.Enabled = true; textTreatmentNotes.Select(textTreatmentNotes.Text.Length + 2, 1); textTreatmentNotes.ScrollToCaret(); sender.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(); if (PatCur == null) { gridPtInfo.EndUpdate(); return; } ODGridRow row; //Age row = new ODGridRow(); row.Cells.Add("Age"); row.Cells.Add(PatientLogic.DateToAgeString(PatCur.Birthdate)); row.Tag = null; gridPtInfo.Rows.Add(row); //Credit type row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "ABC0")); row.Cells.Add(PatCur.CreditType); row.Tag = null; gridPtInfo.Rows.Add(row); //Billing type row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Billing Type")); row.Cells.Add(DefC.GetName(DefCat.BillingTypes, PatCur.BillingType)); row.Tag = null; gridPtInfo.Rows.Add(row); //Referrals RefAttach[] RefAttachList = RefAttaches.Refresh(PatCur.PatNum); for (int i = 0; i < RefAttachList.Length; i++) { row = new ODGridRow(); row.ColorBackG = Color.Aquamarine; if (RefAttachList[i].IsFrom) { row.Cells.Add("Referred From"); } else { row.Cells.Add("Referred To"); } row.Cells.Add(Referrals.GetNameLF(RefAttachList[i].ReferralNum)); row.Tag = null; gridPtInfo.Rows.Add(row); } //Date First Visit row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "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; gridPtInfo.Rows.Add(row); //Prov - Pri & Sec row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "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) + ", " + "None"); } row.Tag = null; gridPtInfo.Rows.Add(row); //PriIns row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Pri Ins")); string name; if (PatPlanList.Count > 0) { name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 1), PlanList); if (PatPlanList[0].IsPending) { name += Lan.g("TableChartPtInfo", " (pending)"); } row.Cells.Add(name); } else { row.Cells.Add(""); } row.Tag = null; gridPtInfo.Rows.Add(row); //SecIns row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Sec Ins")); if (PatPlanList.Count > 1) { name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 2), PlanList); if (PatPlanList[1].IsPending) { name += Lan.g("TableChartPtInfo", " (pending)"); } row.Cells.Add(name); } else { row.Cells.Add(""); } row.Tag = null; gridPtInfo.Rows.Add(row); //Registration keys------------------------------------------------------------------------------------------- if (PrefC.GetBool(PrefName.DistributorKey)) { 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); } } ODGridCell cell; //medical fields----------------------------------------------------------------- bool showMed = true; if (Programs.IsEnabled(ProgramName.eClinicalWorks) && ProgramProperties.GetPropVal(ProgramName.eClinicalWorks, "IsStandalone") == "0") { showMed = false; } if (showMed) { //premed flag. if (PatCur.Premed) { row = new ODGridRow(); row.Cells.Add(""); cell = new ODGridCell(); cell.Text = Lan.g("TableChartPtInfo", "Premedicate"); 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); } //diseases Disease[] DiseaseList = Diseases.Refresh(PatCur.PatNum); row = new ODGridRow(); cell = new ODGridCell(Lan.g("TableChartPtInfo", "Diseases")); cell.Bold = YN.Yes; row.Cells.Add(cell); if (DiseaseList.Length > 0) { row.Cells.Add(""); } else { row.Cells.Add(Lan.g("TableChartPtInfo", "none")); } row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); for (int i = 0; i < DiseaseList.Length; i++) { row = new ODGridRow(); 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); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); } //MedUrgNote row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "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"; gridPtInfo.Rows.Add(row); //Medical row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Medical Summary")); row.Cells.Add(PatientNoteCur.Medical); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); //Service row = new ODGridRow(); row.Cells.Add(Lan.g("TableChartPtInfo", "Service Notes")); row.Cells.Add(PatientNoteCur.Service); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); //medications Medications.Refresh(); MedicationPats.Refresh(PatCur.PatNum); row = new ODGridRow(); cell = new ODGridCell(Lan.g("TableChartPtInfo", "Medications")); cell.Bold = YN.Yes; row.Cells.Add(cell); if (MedicationPats.List.Length > 0) { row.Cells.Add(""); } else { row.Cells.Add(Lan.g("TableChartPtInfo", "none")); } row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); string text; Medication med; for (int i = 0; i < MedicationPats.List.Length; i++) { row = new ODGridRow(); med = Medications.GetMedication(MedicationPats.List[i].MedicationNum); text = med.MedName; if (med.MedicationNum != med.GenericNum) { text += "(" + Medications.GetMedication(med.GenericNum).MedName + ")"; } row.Cells.Add(text); text = MedicationPats.List[i].PatNote + "(" + Medications.GetGeneric(MedicationPats.List[i].MedicationNum).Notes + ")"; row.Cells.Add(text); row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor; row.Tag = "med"; gridPtInfo.Rows.Add(row); } } //if !eCW.enabled gridPtInfo.EndUpdate(); }
private void FillGrid() { if (checkShowImplicit.Checked) { CreatePayPlanEntries(true); } else { CreatePayPlanEntries(); } gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Date"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Stat"), 30); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Code"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Fee"), 55, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Rem Before"), 70, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Credit Date"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Amount"), 55, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Rem After"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Note"), 0); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; double totalAttached = 0; foreach (PayPlanEntry entryCur in _listPayPlanEntries) //for all account charges { if (checkHideUnattached.Checked && !ListPayPlanCreditsCur.Exists(x => x.ProcNum == entryCur.ProcNumOrd)) { continue; } row = new ODGridRow(); //we color the relevant cells to make the table easier to read. //the colors have been looked-at and approved by colourblind Josh. //In the future, we will probably make these customizable definitions. ODGridCell cell = new ODGridCell(entryCur.DateStr); //for procedure rows, cell color should be LightYellow for all relevant fields. cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow; row.Cells.Add(cell); cell = new ODGridCell(entryCur.StatStr); cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow; row.Cells.Add(cell); cell = new ODGridCell(entryCur.ProcStr); cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow; row.Cells.Add(cell); cell = new ODGridCell(entryCur.FeeStr); cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow; row.Cells.Add(cell); cell = new ODGridCell(entryCur.RemBefStr); cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow; row.Cells.Add(cell); cell = new ODGridCell(entryCur.CredDateStr); //for charge rows, cell color should be LightCyan for all relevant fields. cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White; row.Cells.Add(cell); cell = new ODGridCell(entryCur.AmtStr); cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White; row.Cells.Add(cell); totalAttached += PIn.Double(entryCur.AmtStr); cell = new ODGridCell(entryCur.RemAftStr); cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White; row.Cells.Add(cell); cell = new ODGridCell(entryCur.NoteStr); cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White; row.Cells.Add(cell); row.Tag = entryCur; if (!entryCur.IsChargeOrd) { row.ColorLborder = Color.Black; } gridMain.Rows.Add(row); } gridMain.EndUpdate(); textTotal.Text = totalAttached.ToString("f"); }