Exemple #1
0
 private void FormRecallListEdit_Load(object sender, System.EventArgs e)
 {
     contrAccount3.ViewingInRecall = true;
     contrAccount3.InstantClasses();
     contrAccount3.ModuleSelected(RecallCur.PatNum);
     //also refreshes these internal classes:family,patients,procedures,insplans
     //and these global classes:claims,adjustments
     //paysplits,covpats and patientnotes.
     FamCur               = Patients.GetFamily(RecallCur.PatNum);
     PatCur               = FamCur.GetPatient(RecallCur.PatNum);
     PlanList             = InsPlans.Refresh(FamCur);
     ProcList             = Procedures.Refresh(PatCur.PatNum);
     Text                 = "Recall for " + PatCur.GetNameLF();
     textCreditType.Text  = PatCur.CreditType;
     textBillingType.Text = DefB.GetName(DefCat.BillingTypes, PatCur.BillingType);
     //textPriIns.Text=InsPlans.GetDescript(PatCur.PriPlanNum,FamCur,PlanList);
     textHmPhone.Text       = PatCur.HmPhone;
     textWkPhone.Text       = PatCur.WkPhone;
     textWirelessPhone.Text = PatCur.WirelessPhone;
     textEmail.Text         = PatCur.Email;
     textAddrNotes.Text     = PatCur.AddrNote;
     for (int i = 0; i < Enum.GetNames(typeof(ContactMethod)).Length; i++)
     {
         comboRecallMethod.Items.Add(Lan.g("enumContactMethod", Enum.GetNames(typeof(ContactMethod))[i]));
     }
     comboRecallMethod.SelectedIndex = (int)PatCur.PreferRecallMethod;
     FillRecall();
 }
Exemple #2
0
 private void FillAppointments()
 {
     this.Cursor = Cursors.WaitCursor;
     ListUn      = Appointments.RefreshUnsched(true);
     tbApts.ResetRows(ListUn.Length);
     tbApts.SetGridColor(Color.DarkGray);
     for (int i = 0; i < ListUn.Length; i++)
     {
         tbApts.Cell[0, i] = (string)Patients.HList[ListUn[i].PatNum];
         if (ListUn[i].AptDateTime.Year < 1880)
         {
             tbApts.Cell[1, i] = "";
         }
         else
         {
             tbApts.Cell[1, i] = ListUn[i].AptDateTime.ToShortDateString();
         }
         tbApts.Cell[2, i] = DefB.GetName(DefCat.RecallUnschedStatus, ListUn[i].UnschedStatus);
         tbApts.Cell[3, i] = Providers.GetAbbr(ListUn[i].ProvNum);
         tbApts.Cell[4, i] = ListUn[i].ProcDescript;
         tbApts.Cell[5, i] = ListUn[i].Note;
     }
     tbApts.LayoutTables();
     Cursor = Cursors.Default;
 }
        private void FillDunning()
        {
            dunningList = Dunnings.Refresh();
            gridDun.BeginUpdate();
            gridDun.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Billing Type", 100);

            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", 356);
            gridDun.Columns.Add(col);
            gridDun.Rows.Clear();
            OpenDental.UI.ODGridRow row;
            //string text;
            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(DefB.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);
                gridDun.Rows.Add(row);
            }
            gridDun.EndUpdate();
        }
Exemple #4
0
        private void FillGrid()
        {
            this.Cursor = Cursors.WaitCursor;
            ListUn      = Appointments.RefreshUnsched(false);
            int scrollVal = grid.ScrollValue;

            grid.BeginUpdate();
            grid.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableUnsched", "Patient"), 140);

            grid.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableUnsched", "Date"), 65);
            grid.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableUnsched", "Status"), 110);
            grid.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableUnsched", "Prov"), 50);
            grid.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableUnsched", "Procedures"), 150);
            grid.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableUnsched", "Notes"), 200);
            grid.Columns.Add(col);
            grid.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < ListUn.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add((string)Patients.HList[ListUn[i].PatNum]);
                if (ListUn[i].AptDateTime.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(ListUn[i].AptDateTime.ToShortDateString());
                }
                row.Cells.Add(DefB.GetName(DefCat.RecallUnschedStatus, ListUn[i].UnschedStatus));
                row.Cells.Add(Providers.GetAbbr(ListUn[i].ProvNum));
                row.Cells.Add(ListUn[i].ProcDescript);
                row.Cells.Add(ListUn[i].Note);
                grid.Rows.Add(row);
            }
            grid.EndUpdate();
            grid.ScrollValue = scrollVal;
            Cursor           = Cursors.Default;
        }
Exemple #5
0
        private void butExport_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            SaveFileDialog Dlg = new SaveFileDialog();

            if (Directory.Exists(PrefB.GetString("ExportPath")))
            {
                Dlg.InitialDirectory = PrefB.GetString("ExportPath");
            }
            else if (Directory.Exists("C:\\"))
            {
                Dlg.InitialDirectory = "C:\\";
            }
            Dlg.FileName = "Fees" + DefB.GetName(DefCat.FeeSchedNames, SchedNum) + ".txt";
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            //MessageBox.Show(Dlg.FileName);//includes full path
            //OverwritePrompt is already set to true
            DataTable table = ProcedureCodes.GetProcTable("", "", "", new int[0], SchedNum, 0, 0);
            double    fee;

            using (StreamWriter sr = File.CreateText(Dlg.FileName)){
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    sr.Write(PIn.PString(table.Rows[i]["ADACode"].ToString()) + "\t");
                    fee = PIn.PDouble(table.Rows[i]["FeeAmt1"].ToString());
                    if (fee != -1)
                    {
                        sr.Write(fee.ToString("n"));
                    }
                    sr.Write("\t");
                    sr.Write(PIn.PString(table.Rows[i]["AbbrDesc"].ToString()) + "\t");
                    sr.WriteLine(PIn.PString(table.Rows[i]["Descript"].ToString()));
                }
            }
            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
        }
        private void FillPayGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableAccountingAutoPay", "Payment Type"), 200);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAccountingAutoPay", "Pick List"), 250);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < payAL.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(DefB.GetName(DefCat.PaymentTypes, ((AccountingAutoPay)payAL[i]).PayType));
                row.Cells.Add(AccountingAutoPays.GetPickListDesc((AccountingAutoPay)payAL[i]));
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        ///<summary>raised for each page to be printed.  One page per appointment.</summary>
        private void pd_PrintPage(object sender, PrintPageEventArgs ev)
        {
            if (ApptNum != 0)           //just for one appointment
            {
                date = Appointments.DateSelected;
            }
            Graphics   g = ev.Graphics;
            float      y = 50;
            float      x = 0;
            string     str;
            float      sizeW;       //used when measuring text for placement
            Font       fontTitle   = new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold);
            Font       fontHeading = new Font(FontFamily.GenericSansSerif, 9, FontStyle.Bold);
            Font       font        = new Font(FontFamily.GenericSansSerif, 8);
            SolidBrush brush       = new SolidBrush(Color.Black);

            //Title----------------------------------------------------------------------------------------------------------
            str   = Lan.g(this, "Routing Slip");
            sizeW = g.MeasureString(str, fontTitle).Width;
            x     = 425 - sizeW / 2;
            g.DrawString(str, fontTitle, brush, x, y);
            y += 35;
            x  = 75;
            //Today's appointment, including procedures-----------------------------------------------------------------------
            Family  fam = Patients.GetFamily(Appts[pagesPrinted].PatNum);
            Patient pat = fam.GetPatient(Appts[pagesPrinted].PatNum);

            str = pat.GetNameFL();
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = Appts[pagesPrinted].AptDateTime.ToShortTimeString() + "  " + Appts[pagesPrinted].AptDateTime.ToShortDateString();
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = (Appts[pagesPrinted].Pattern.Length * 5).ToString() + " " + Lan.g(this, "minutes");
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Providers.GetAbbr(Appts[pagesPrinted].ProvNum);
            g.DrawString(str, font, brush, x, y);
            y += 15;
            if (Appts[pagesPrinted].ProvHyg != 0)
            {
                str = Providers.GetAbbr(Appts[pagesPrinted].ProvHyg);
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            str = Lan.g(this, "Procedures:");
            g.DrawString(str, font, brush, x, y);
            y += 15;
            Procedure[] procsAll = Procedures.Refresh(pat.PatNum);
            Procedure[] procsApt = Procedures.GetProcsOneApt(Appts[pagesPrinted].AptNum, procsAll);
            for (int i = 0; i < procsApt.Length; i++)
            {
                str = "   " + Procedures.GetDescription(procsApt[i]);
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            str = Lan.g(this, "Note:") + " " + Appts[pagesPrinted].Note;
            g.DrawString(str, font, brush, x, y);
            y += 25;
            //Patient/Family Info---------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Patient Info");
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = Lan.g(this, "PatNum:") + " " + pat.PatNum.ToString();
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Age:") + " ";
            if (pat.Age > 0)
            {
                str += pat.Age.ToString();
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Date of First Visit:") + " ";
            if (pat.DateFirstVisit.Year < 1880)
            {
                str += "?";
            }
            else if (pat.DateFirstVisit == Appts[pagesPrinted].AptDateTime.Date)
            {
                str += Lan.g(this, "New Patient");
            }
            else
            {
                str += pat.DateFirstVisit.ToShortDateString();
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Billing Type:") + " " + DefB.GetName(DefCat.BillingTypes, pat.BillingType);
            g.DrawString(str, font, brush, x, y);
            y += 15;
            Recall[] recallList = Recalls.GetList(new int[] { pat.PatNum });
            str = Lan.g(this, "Recall Due Date:") + " ";
            if (recallList.Length > 0)
            {
                str += recallList[0].DateDue.ToShortDateString();
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Medical notes:") + " " + pat.MedUrgNote;
            g.DrawString(str, font, brush, x, y);
            y += 25;
            //Other Family Members
            str = Lan.g(this, "Other Family Members");
            g.DrawString(str, fontHeading, brush, x, y);
            y += 18;
            for (int i = 0; i < fam.List.Length; i++)
            {
                if (fam.List[i].PatNum == pat.PatNum)
                {
                    continue;
                }
                str = fam.List[i].GetNameFL();
                if (fam.List[i].Age > 0)
                {
                    str += ",   " + fam.List[i].Age.ToString();
                }
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            y += 10;
            //Insurance Info--------------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Insurance");
            g.DrawString(str, fontHeading, brush, x, y);
            y += 18;
            PatPlan[]   patPlanList   = PatPlans.Refresh(pat.PatNum);
            InsPlan[]   plans         = InsPlans.Refresh(fam);
            ClaimProc[] claimProcList = ClaimProcs.Refresh(pat.PatNum);
            Benefit[]   benefits      = Benefits.Refresh(patPlanList);
            InsPlan     plan;
            Carrier     carrier;
            string      subscriber;
            double      max;
            double      deduct;

            if (patPlanList.Length == 0)
            {
                str = Lan.g(this, "none");
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            for (int i = 0; i < patPlanList.Length; i++)
            {
                plan    = InsPlans.GetPlan(patPlanList[i].PlanNum, plans);
                carrier = Carriers.GetCarrier(plan.CarrierNum);
                str     = carrier.CarrierName;
                g.DrawString(str, fontHeading, brush, x, y);
                y         += 18;
                subscriber = fam.GetNameInFamFL(plan.Subscriber);
                if (subscriber == "")               //subscriber from another family
                {
                    subscriber = Patients.GetLim(plan.Subscriber).GetNameLF();
                }
                str = Lan.g(this, "Subscriber:") + " " + subscriber;
                g.DrawString(str, font, brush, x, y);
                y += 15;
                bool isFamMax = Benefits.GetIsFamMax(benefits, plan.PlanNum);
                str = "";
                if (isFamMax)
                {
                    str += Lan.g(this, "Family ");
                }
                str += Lan.g(this, "Annual Max:") + " ";
                max  = Benefits.GetAnnualMax(benefits, plan.PlanNum, patPlanList[i].PatPlanNum);
                if (max != -1)
                {
                    str += max.ToString("n0") + " ";
                }
                str += "   ";
                bool isFamDed = Benefits.GetIsFamDed(benefits, plan.PlanNum);
                if (isFamDed)
                {
                    str += Lan.g(this, "Family ");
                }
                str   += Lan.g(this, "Deductible:") + " ";
                deduct = Benefits.GetDeductible(benefits, plan.PlanNum, patPlanList[i].PatPlanNum);
                if (deduct != -1)
                {
                    str += deduct.ToString("n0");
                }
                g.DrawString(str, font, brush, x, y);
                y  += 15;
                str = "";
                for (int j = 0; j < benefits.Length; j++)
                {
                    if (benefits[j].PlanNum != plan.PlanNum)
                    {
                        continue;
                    }
                    if (benefits[j].BenefitType != InsBenefitType.Percentage)
                    {
                        continue;
                    }
                    if (str != "")
                    {
                        str += ",  ";
                    }
                    str += CovCats.GetDesc(benefits[j].CovCatNum) + " " + benefits[j].Percent.ToString() + "%";
                }
                if (str != "")
                {
                    g.DrawString(str, font, brush, x, y);
                    y += 15;
                }
                double pend = 0;
                double used = 0;
                if (isFamMax || isFamDed)
                {
                    ClaimProc[] claimProcsFam = ClaimProcs.RefreshFam(plan.PlanNum);
                    used = InsPlans.GetInsUsed(claimProcsFam, date, plan.PlanNum, patPlanList[i].PatPlanNum, -1, plans, benefits);
                    pend = InsPlans.GetPending(claimProcsFam, date, plan, patPlanList[i].PatPlanNum, -1, benefits);
                }
                else
                {
                    used = InsPlans.GetInsUsed(claimProcList, date, plan.PlanNum, patPlanList[i].PatPlanNum, -1, plans, benefits);
                    pend = InsPlans.GetPending(claimProcList, date, plan, patPlanList[i].PatPlanNum, -1, benefits);
                }
                str = Lan.g(this, "Ins Used:") + " " + used.ToString("n");
                g.DrawString(str, font, brush, x, y);
                y  += 15;
                str = Lan.g(this, "Ins Pending:") + " " + pend.ToString("n");
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            y += 10;
            //Account Info---------------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Account Info");
            g.DrawString(str, fontHeading, brush, x, y);
            y  += 18;
            str = Lan.g(this, "Guarantor:") + " " + fam.List[0].GetNameFL();
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Balance:") + (fam.List[0].BalTotal - fam.List[0].InsEst).ToString("c");
            if (fam.List[0].InsEst > .01)
            {
                str += "  (" + fam.List[0].BalTotal.ToString("c") + " - "
                       + fam.List[0].InsEst.ToString("c") + " " + Lan.g(this, "InsEst") + ")";
            }
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Aging:")
                  + "  0-30:" + fam.List[0].Bal_0_30.ToString("c")
                  + "  31-60:" + fam.List[0].Bal_31_60.ToString("c")
                  + "  61-90:" + fam.List[0].Bal_61_90.ToString("c")
                  + "  90+:" + fam.List[0].BalOver90.ToString("c");
            g.DrawString(str, font, brush, x, y);
            y  += 15;
            str = Lan.g(this, "Fam Urgent Fin Note:")
                  + fam.List[0].FamFinUrgNote;
            g.DrawString(str, font, brush, x, y);
            y += 15;
            y += 10;
            //Treatment Plan--------------------------------------------------------------------------------------------------
            g.DrawLine(Pens.Black, 75, y, 775, y);
            str = Lan.g(this, "Treatment Plan");
            g.DrawString(str, fontHeading, brush, x, y);
            y += 18;
            for (int i = 0; i < procsAll.Length; i++)
            {
                if (procsAll[i].ProcStatus != ProcStat.TP)
                {
                    continue;
                }
                str = Procedures.GetDescription(procsAll[i]);
                g.DrawString(str, font, brush, x, y);
                y += 15;
            }
            pagesPrinted++;
            if (pagesPrinted == Appts.Length)
            {
                ev.HasMorePages = false;
                pagesPrinted    = 0;
            }
            else
            {
                ev.HasMorePages = true;
            }
        }
Exemple #8
0
        ///<summary>Only used in FormRecallList to get a list of patients with recall.  Supply a date range, using min(-1 day) and max values if user left blank.</summary>
        public static DataTable GetRecallList(DateTime fromDate, DateTime toDate, bool groupByFamilies)
        {
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("age");
            table.Columns.Add("contactMethod");
            table.Columns.Add("dueDate");
            table.Columns.Add("Guarantor");
            table.Columns.Add("Note");
            table.Columns.Add("patientName");
            table.Columns.Add("PatNum");
            table.Columns.Add("PreferRecallMethod");
            table.Columns.Add("recallInterval");
            table.Columns.Add("RecallNum");
            table.Columns.Add("status");
            List <DataRow> rows    = new List <DataRow>();
            string         command =
                "SELECT recall.RecallNum,recall.PatNum,recall.DateDue,"
                + "recall.RecallInterval,recall.RecallStatus,recall.Note,"
                + "patient.LName,patient.FName,patient.Preferred,patient.Birthdate, "
                + "patient.HmPhone,patient.WkPhone,patient.WirelessPhone,patient.Email, "
                + "patient.Guarantor, patient.PreferRecallMethod "
                + "FROM recall,patient "
                + "WHERE recall.PatNum=patient.PatNum "
                + "AND NOT EXISTS("               //test for future appt.
                + "SELECT * FROM appointment,procedurelog,procedurecode "
                + "WHERE procedurelog.PatNum = recall.PatNum "
                + "AND appointment.PatNum = recall.PatNum "
                + "AND procedurelog.CodeNum = procedurecode.CodeNum "
                + "AND procedurelog.AptNum = appointment.AptNum "
                + "AND appointment.AptDateTime >= ";               //'"+DateTime.Today.ToString("yyyy-MM-dd")+"' "

            if (FormChooseDatabase.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDate(MiscData.GetNowDateTime());
            }
            else                      //Assume MySQL
            {
                command += "CURDATE()";
            }
            command += " AND procedurecode.SetRecall = '1') "                  //end of NOT EXISTS
                       + "AND recall.DateDue >= " + POut.PDate(fromDate) + " "
                       + "AND recall.DateDue <= " + POut.PDate(toDate) + " "
                       + "AND patient.patstatus=0 "
                       + "ORDER BY ";
            if (groupByFamilies)
            {
                command += "patient.Guarantor, ";
            }
            command += "recall.DateDue";
            DataTable     rawtable = General.GetTable(command);
            DateTime      date;
            Interval      interv;
            Patient       pat;
            ContactMethod contmeth;

            for (int i = 0; i < rawtable.Rows.Count; i++)
            {
                row        = table.NewRow();
                row["age"] = Shared.DateToAge(PIn.PDate(rawtable.Rows[i]["Birthdate"].ToString())).ToString();              //we don't care about m/y.
                contmeth   = (ContactMethod)PIn.PInt(rawtable.Rows[i]["PreferRecallMethod"].ToString());
                if (contmeth == ContactMethod.None || contmeth == ContactMethod.HmPhone)
                {
                    row["contactMethod"] = Lan.g("FormRecallList", "Hm:") + rawtable.Rows[i]["HmPhone"].ToString();
                }
                if (contmeth == ContactMethod.WkPhone)
                {
                    row["contactMethod"] = Lan.g("FormRecallList", "Wk:") + rawtable.Rows[i]["WkPhone"].ToString();
                }
                if (contmeth == ContactMethod.WirelessPh)
                {
                    row["contactMethod"] = Lan.g("FormRecallList", "Cell:") + rawtable.Rows[i]["WirelessPhone"].ToString();
                }
                if (contmeth == ContactMethod.Email)
                {
                    row["contactMethod"] = rawtable.Rows[i]["Email"].ToString();
                }
                if (contmeth == ContactMethod.DoNotCall || contmeth == ContactMethod.SeeNotes)
                {
                    row["contactMethod"] = Lan.g("enumContactMethod", contmeth.ToString());
                }
                date             = PIn.PDate(rawtable.Rows[i]["DateDue"].ToString());
                row["dueDate"]   = date.ToShortDateString();
                row["Guarantor"] = rawtable.Rows[i]["Guarantor"].ToString();
                row["Note"]      = rawtable.Rows[i]["Note"].ToString();
                pat                       = new Patient();
                pat.LName                 = rawtable.Rows[i]["LName"].ToString();
                pat.FName                 = rawtable.Rows[i]["FName"].ToString();
                pat.Preferred             = rawtable.Rows[i]["Preferred"].ToString();
                row["patientName"]        = pat.GetNameLF();
                row["PatNum"]             = rawtable.Rows[i]["PatNum"].ToString();
                row["PreferRecallMethod"] = rawtable.Rows[i]["PreferRecallMethod"].ToString();              //not used yet, but might be.
                interv                    = new Interval(PIn.PInt(rawtable.Rows[i]["RecallInterval"].ToString()));
                row["recallInterval"]     = interv.ToString();
                row["RecallNum"]          = rawtable.Rows[i]["RecallNum"].ToString();
                row["status"]             = DefB.GetName(DefCat.RecallUnschedStatus, PIn.PInt(rawtable.Rows[i]["RecallStatus"].ToString()));
                rows.Add(row);
            }
            //Array.Sort(orderDate,RecallList);
            //return RecallList;
            for (int i = 0; i < rows.Count; i++)
            {
                table.Rows.Add(rows[i]);
            }
            return(table);
        }
        ///<summary>Draws all the blockouts for the entire period.</summary>
        private void DrawBlockouts(Graphics g)
        {
            Schedule[] schedForType;
            schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Blockout, 0);
            SolidBrush blockBrush;
            Pen        blockOutlinePen = new Pen(Color.Black, 1);
            Pen        penOutline;
            Font       blockFont = new Font("Arial", 8);
            string     blockText;
            RectangleF rect;

            //g.TextRenderingHint=TextRenderingHint.SingleBitPerPixelGridFit;//to make printing clearer
            for (int i = 0; i < schedForType.Length; i++)
            {
                blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType));
                penOutline = new Pen(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType), 2);
                blockText  = DefB.GetName(DefCat.BlockoutTypes, schedForType[i].BlockoutType) + "\r\n" + schedForType[i].Note;
                if (IsWeeklyView)
                {
                    if (schedForType[i].Op == 0)                   //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColDayWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                      //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            + ColAptWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColAptWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                else
                {
                    if (schedForType[i].Op == 0)                  //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColWidth * ColCount - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                     //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount
                            + ColWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                //paint either solid block or outline
                if (PrefB.GetBool("SolidBlockouts"))
                {
                    g.FillRectangle(blockBrush, rect);
                    g.DrawLine(blockOutlinePen, rect.X, rect.Y + 1, rect.Right - 1, rect.Y + 1);
                }
                else
                {
                    g.DrawRectangle(penOutline, rect.X + 1, rect.Y + 2, rect.Width - 2, rect.Height - 3);
                }
                g.DrawString(blockText, blockFont, new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
            }
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            int    feeSched = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum;
            string catName  = ""; //string to hold current category name
            Fees   fee      = new Fees();

            Queries.CurReport = new ReportOld();

            Queries.CurReport.Query = "SELECT procedurecode.ProcCode,fee.Amount,'     ',procedurecode.Descript,"
                                      + "procedurecode.AbbrDesc FROM procedurecode,fee "
                                      + "WHERE procedurecode.CodeNum=fee.CodeNum AND fee.FeeSched='" + feeSched.ToString()
                                      + "' ORDER BY procedurecode.ProcCode";
            FormQuery2          = new FormQuery();
            FormQuery2.IsReport = true;
            if (radioCode.Checked == true)
            {
                FormQuery2.SubmitReportQuery();
                Queries.CurReport.Title         = "Procedure Codes";
                Queries.CurReport.SubTitle      = new string[2];
                Queries.CurReport.SubTitle[0]   = ((Pref)PrefB.HList["PracticeTitle"]).ValueString;
                Queries.CurReport.SubTitle[1]   = DefB.GetName(DefCat.FeeSchedNames, feeSched);
                Queries.CurReport.ColPos        = new int[6];
                Queries.CurReport.ColCaption    = new string[5];
                Queries.CurReport.ColAlign      = new HorizontalAlignment[5];
                Queries.CurReport.ColPos[0]     = 60;
                Queries.CurReport.ColPos[1]     = 130;
                Queries.CurReport.ColPos[2]     = 200;
                Queries.CurReport.ColPos[3]     = 220;
                Queries.CurReport.ColPos[4]     = 420;
                Queries.CurReport.ColPos[5]     = 620;
                Queries.CurReport.ColCaption[0] = "Code";
                Queries.CurReport.ColCaption[1] = "Fee Amount";
                Queries.CurReport.ColCaption[2] = " ";              //otherwise, the amount gets bunched up next to the description.
                Queries.CurReport.ColCaption[3] = "Description";
                Queries.CurReport.ColCaption[4] = "Abbr Description";
                //Queries.CurReport.ColCaption[3]="Fee Amount";
                Queries.CurReport.ColAlign[1] = HorizontalAlignment.Right;
                Queries.CurReport.Summary     = new string[0];
                FormQuery2.ShowDialog();
                DialogResult = DialogResult.OK;
            }
            else                      //categories
            {
                Queries.SubmitTemp(); //create TableTemp which is not actually used
                ProcedureCode[] ProcList = ProcedureCodes.GetProcList();
                Queries.TableQ = new DataTable(null);
                for (int i = 0; i < 5; i++)                                   //add columns
                {
                    Queries.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns
                }
                Queries.CurReport.ColTotal = new double[Queries.TableQ.Columns.Count];
                DataRow row = Queries.TableQ.NewRow();//add first row by hand to get value for temp
                row[0]  = DefB.GetName(DefCat.ProcCodeCats, ProcList[0].ProcCat);
                catName = row[0].ToString();
                row[1]  = ProcList[0].ProcCode;
                row[2]  = ProcList[0].Descript;
                row[3]  = ProcList[0].AbbrDesc;
                row[4]  = ((double)Fees.GetAmount0(ProcList[0].CodeNum, feeSched)).ToString("F");
                Queries.CurReport.ColTotal[4] += PIn.PDouble(row[4].ToString());
                Queries.TableQ.Rows.Add(row);
                for (int i = 1; i < ProcList.Length; i++)          //loop through data rows
                {
                    row    = Queries.TableQ.NewRow();              //create new row called 'row' based on structure of TableQ
                    row[0] = DefB.GetName(DefCat.ProcCodeCats, ProcList[i].ProcCat);
                    if (catName == row[0].ToString())
                    {
                        row[0] = "";
                    }
                    else
                    {
                        catName = row[0].ToString();
                    }
                    row[1] = ProcList[i].ProcCode.ToString();
                    row[2] = ProcList[i].Descript;
                    row[3] = ProcList[i].AbbrDesc.ToString();
                    row[4] = ((double)Fees.GetAmount0(ProcList[i].CodeNum, feeSched)).ToString("F");
                    //Queries.CurReport.ColTotal[4]+=PIn.PDouble(row[4].ToString());
                    Queries.TableQ.Rows.Add(row);
                }
                Queries.CurReport.ColWidth   = new int[Queries.TableQ.Columns.Count];
                Queries.CurReport.ColPos     = new int[Queries.TableQ.Columns.Count + 1];
                Queries.CurReport.ColPos[0]  = 0;
                Queries.CurReport.ColCaption = new string[Queries.TableQ.Columns.Count];
                Queries.CurReport.ColAlign   = new HorizontalAlignment[Queries.TableQ.Columns.Count];
                FormQuery2.ResetGrid();                //this is a method in FormQuery2;

                Queries.CurReport.Title         = "Procedure Codes";
                Queries.CurReport.SubTitle      = new string[5];
                Queries.CurReport.SubTitle[0]   = ((Pref)PrefB.HList["PracticeTitle"]).ValueString;
                Queries.CurReport.SubTitle[1]   = DefB.GetName(DefCat.FeeSchedNames, feeSched);
                Queries.CurReport.ColPos[0]     = 20;
                Queries.CurReport.ColPos[1]     = 120;
                Queries.CurReport.ColPos[2]     = 270;
                Queries.CurReport.ColPos[3]     = 470;
                Queries.CurReport.ColPos[4]     = 620;
                Queries.CurReport.ColPos[5]     = 770;
                Queries.CurReport.ColCaption[0] = "Category";
                Queries.CurReport.ColCaption[1] = "Code";
                Queries.CurReport.ColCaption[2] = "Description";
                Queries.CurReport.ColCaption[3] = "Abbr Description";
                Queries.CurReport.ColCaption[4] = "Fee Amount";
                Queries.CurReport.ColAlign[4]   = HorizontalAlignment.Right;
                Queries.CurReport.Summary       = new string[5];
                FormQuery2.ShowDialog();
                DialogResult = DialogResult.OK;
            }
        }
Exemple #11
0
        ///<summary></summary>
        private void FillGrids()
        {
            if (IsNew)
            {
                DateTime dateStart = PIn.PDate(textDateStart.Text);
                int      clinicNum = 0;
                if (comboClinic.SelectedIndex != 0)
                {
                    clinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum;
                }
                int[] payTypes = new int[listPayType.SelectedIndices.Count];
                for (int i = 0; i < payTypes.Length; i++)
                {
                    payTypes[i] = DefB.Short[(int)DefCat.PaymentTypes][listPayType.SelectedIndices[i]].DefNum;
                }
                PatPayList   = Payments.GetForDeposit(dateStart, clinicNum, payTypes);
                ClaimPayList = ClaimPayments.GetForDeposit(dateStart, clinicNum);
            }
            else
            {
                PatPayList   = Payments.GetForDeposit(DepositCur.DepositNum);
                ClaimPayList = ClaimPayments.GetForDeposit(DepositCur.DepositNum);
            }
            //Fill Patient Payment Grid---------------------------------------
            ArrayList patNumAL = new ArrayList();

            for (int i = 0; i < PatPayList.Length; i++)
            {
                patNumAL.Add(PatPayList[i].PatNum);
            }
            int[] patNums = new int[patNumAL.Count];
            patNumAL.CopyTo(patNums);
            Patient[] pats = Patients.GetMultPats(patNums);
            gridPat.BeginUpdate();
            gridPat.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Date"), 80);

            gridPat.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Patient"), 130);
            gridPat.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Type"), 90);
            gridPat.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Check Number"), 95);
            gridPat.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Bank-Branch"), 80);
            gridPat.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Amount"), 80);
            gridPat.Columns.Add(col);
            gridPat.Rows.Clear();
            OpenDental.UI.ODGridRow row;
            for (int i = 0; i < PatPayList.Length; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(PatPayList[i].PayDate.ToShortDateString());
                row.Cells.Add(Patients.GetOnePat(pats, PatPayList[i].PatNum).GetNameLF());
                row.Cells.Add(DefB.GetName(DefCat.PaymentTypes, PatPayList[i].PayType));
                row.Cells.Add(PatPayList[i].CheckNum);
                row.Cells.Add(PatPayList[i].BankBranch);
                row.Cells.Add(PatPayList[i].PayAmt.ToString("F"));
                gridPat.Rows.Add(row);
            }
            gridPat.EndUpdate();
            //Fill Insurance Payment Grid-------------------------------------
            gridIns.BeginUpdate();
            gridIns.Columns.Clear();
            col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Date"), 80);
            gridIns.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Carrier"), 220);
            gridIns.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Check Number"), 95);
            gridIns.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Bank-Branch"), 80);
            gridIns.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Amount"), 90);
            gridIns.Columns.Add(col);
            gridIns.Rows.Clear();
            for (int i = 0; i < ClaimPayList.Length; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(ClaimPayList[i].CheckDate.ToShortDateString());
                row.Cells.Add(ClaimPayList[i].CarrierName);
                row.Cells.Add(ClaimPayList[i].CheckNum);
                row.Cells.Add(ClaimPayList[i].BankBranch);
                row.Cells.Add(ClaimPayList[i].CheckAmt.ToString("F"));
                gridIns.Rows.Add(row);
            }
            gridIns.EndUpdate();
        }
        private void FillGrid()
        {
            if (listFeeSched.Items.Count == 0)
            {
                gridMain.BeginUpdate();
                gridMain.Rows.Clear();
                gridMain.EndUpdate();
                MsgBox.Show(this, "You must have at least one fee schedule created.");
                return;
            }
            string selected = "";

            if (gridMain.GetSelectedIndex() != -1)
            {
                selected = ProcTable.Rows[gridMain.GetSelectedIndex()][3].ToString();
            }
            int scroll = gridMain.ScrollValue;

            int[] cats = new int[listCategories.SelectedIndices.Count];
            for (int i = 0; i < listCategories.SelectedIndices.Count; i++)
            {
                cats[i] = CatList[listCategories.SelectedIndices[i]].DefNum;
            }
            int feeSched      = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum;
            int feeSchedComp1 = 0;

            if (comboCompare1.SelectedIndex != 0)
            {
                feeSchedComp1 = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].DefNum;
            }
            int feeSchedComp2 = 0;

            if (comboCompare2.SelectedIndex != 0)
            {
                feeSchedComp2 = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].DefNum;
            }
            ProcTable = ProcedureCodes.GetProcTable(textAbbreviation.Text, textDescription.Text, textCode.Text, cats, feeSched,
                                                    feeSchedComp1, feeSchedComp2);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableProcedures", "Category"), 90);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProcedures", "Description"), 150);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProcedures", "Abbr"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProcedures", "Code"), 50);
            gridMain.Columns.Add(col);
            string heading = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].ItemName;

            if (heading.Length > 8)
            {
                heading = heading.Substring(0, 8);
            }
            col = new ODGridColumn(heading, 50, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            heading = "";
            if (comboCompare1.SelectedIndex != 0)
            {
                heading = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].ItemName;
            }
            if (heading.Length > 8)
            {
                heading = heading.Substring(0, 8);
            }
            col = new ODGridColumn(heading, 50, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            heading = "";
            if (comboCompare2.SelectedIndex != 0)
            {
                heading = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].ItemName;
            }
            if (heading.Length > 8)
            {
                heading = heading.Substring(0, 8);
            }
            col = new ODGridColumn(heading, 50, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < ProcTable.Rows.Count; i++)
            {
                row = new ODGridRow();
                if (i == 0 || ProcTable.Rows[i - 1]["ProcCat"].ToString() != ProcTable.Rows[i]["ProcCat"].ToString())
                {
                    row.Cells.Add(DefB.GetName(DefCat.ProcCodeCats, PIn.PInt(ProcTable.Rows[i]["ProcCat"].ToString())));
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(ProcTable.Rows[i]["Descript"].ToString());
                row.Cells.Add(ProcTable.Rows[i]["AbbrDesc"].ToString());
                row.Cells.Add(ProcTable.Rows[i]["ADACode"].ToString());
                if (ProcTable.Rows[i]["FeeAmt1"].ToString() == "-1")
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(PIn.PDouble(ProcTable.Rows[i]["FeeAmt1"].ToString()).ToString("n"));
                }

                if (ProcTable.Rows[i]["FeeAmt2"].ToString() == "-1")
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(PIn.PDouble(ProcTable.Rows[i]["FeeAmt2"].ToString()).ToString("n"));
                }
                if (ProcTable.Rows[i]["FeeAmt3"].ToString() == "-1")
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(PIn.PDouble(ProcTable.Rows[i]["FeeAmt3"].ToString()).ToString("n"));
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            gridMain.ScrollValue = scroll;
            if (selected != "")          //if a row was previously selected
            {
                for (int i = 0; i < ProcTable.Rows.Count; i++)
                {
                    if (ProcTable.Rows[i][3].ToString() == selected)
                    {
                        gridMain.SetSelected(i, true);
                        break;
                    }
                }
            }
        }
Exemple #13
0
        ///<summary>Called from Pin_Click and OK_Click.</summary>
        private void SaveRecall()
        {
            int newStatus;

            if (comboStatus.SelectedIndex == 0)
            {
                newStatus = 0;
            }
            else
            {
                newStatus = DefB.Short[(int)DefCat.RecallUnschedStatus][comboStatus.SelectedIndex - 1].DefNum;
            }
            if (newStatus != RecallCur.RecallStatus ||      //if the status has changed
                (RecallCur.Note == "" && textNote.Text != ""))               //or a note was added
            {
                //make a commlog entry
                //unless there is an existing recall commlog entry for today
                bool      recallEntryToday = false;
                Commlog[] CommlogList      = Commlogs.Refresh(PatCur.PatNum);
                for (int i = 0; i < CommlogList.Length; i++)
                {
                    if (CommlogList[i].CommDateTime.Date == DateTime.Today &&
                        CommlogList[i].CommType == CommItemType.Recall)
                    {
                        recallEntryToday = true;
                    }
                }
                if (!recallEntryToday)
                {
                    Commlog CommlogCur = new Commlog();
                    CommlogCur.CommDateTime = DateTime.Now;
                    CommlogCur.CommType     = CommItemType.Recall;
                    CommlogCur.PatNum       = PatCur.PatNum;
                    if (newStatus != RecallCur.RecallStatus)
                    {
                        //Commlogs.Cur.Note+=Lan.g(this,"Status changed to")+" ";
                        if (newStatus == 0)
                        {
                            CommlogCur.Note += Lan.g(this, "Status None");
                        }
                        else
                        {
                            CommlogCur.Note += DefB.GetName(DefCat.RecallUnschedStatus, newStatus);
                        }
                        if (RecallCur.Note == "" && textNote.Text != "")
                        {
                            CommlogCur.Note += ", ";
                        }
                    }
                    if (RecallCur.Note == "" && textNote.Text != "")
                    {
                        CommlogCur.Note += textNote.Text;
                    }
                    CommlogCur.Note += ".  ";
                    FormCommItem FormCI = new FormCommItem(CommlogCur);
                    FormCI.IsNew = true;
                    //forces user to at least consider a commlog entry
                    FormCI.ShowDialog();                    //typically saved in this window.
                }
            }
            RecallCur.RecallStatus = newStatus;
            RecallCur.Note         = textNote.Text;
            Recalls.Update(RecallCur);
            Patient PatOld = PatCur.Copy();

            PatCur.WkPhone            = textWkPhone.Text;
            PatCur.WirelessPhone      = textWirelessPhone.Text;
            PatCur.Email              = textEmail.Text;
            PatCur.PreferRecallMethod = (ContactMethod)comboRecallMethod.SelectedIndex;
            Patients.Update(PatCur, PatOld);
            Patients.UpdatePhoneAndNoteIfNeeded(textHmPhone.Text, textAddrNotes.Text, PatCur.PatNum);
        }
        ///<summary>Draws all the blockouts for the entire day.</summary>
        private void DrawBlockouts(Graphics g)
        {
            SchedDefault[] schedDefs;            //for one type at a time
            Schedule[]     schedForType;
            schedForType = Schedules.GetForType(SchedListDay, ScheduleType.Blockout, 0);
            SolidBrush blockBrush;
            Pen        blockOutlinePen = new Pen(Color.Black, 1);
            Font       blockFont       = new Font("Arial", 8);
            string     blockText;
            RectangleF rect;

            g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit; //to make printing clearer
            if (schedForType.Length == 0)                                     //use default sched
            {
                schedDefs = SchedDefaults.GetForType(ScheduleType.Blockout, 0);
                for (int i = 0; i < schedDefs.Length; i++)
                {
                    if (schedDefs[i].DayOfWeek == (int)Appointments.DateSelected.DayOfWeek)
                    {
                        blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedDefs[i].BlockoutType));
                        blockText  = DefB.GetName(DefCat.BlockoutTypes, schedDefs[i].BlockoutType);
                        if (schedDefs[i].Op == 0)                      //all ops
                        {
                            rect = new RectangleF(
                                TimeWidth + ProvWidth * ProvCount + 1
                                , schedDefs[i].StartTime.Hour * Lh * RowsPerHr
                                + schedDefs[i].StartTime.Minute * Lh / MinPerRow
                                , ColWidth * ColCount - 1
                                , (schedDefs[i].StopTime - schedDefs[i].StartTime).Hours * Lh * RowsPerHr
                                + (schedDefs[i].StopTime - schedDefs[i].StartTime).Minutes * Lh / MinPerRow);
                        }
                        else                         //just one op
                        {
                            if (ApptViewItems.GetIndexOp(schedDefs[i].Op) == -1)
                            {
                                continue;                                //don't display if op not visible
                            }
                            rect = new RectangleF(
                                TimeWidth + ProvWidth * ProvCount
                                + ColWidth * ApptViewItems.GetIndexOp(schedDefs[i].Op) + 1
                                , schedDefs[i].StartTime.Hour * Lh * RowsPerHr
                                + schedDefs[i].StartTime.Minute * Lh / MinPerRow
                                , ColWidth - 1
                                , (schedDefs[i].StopTime
                                   - schedDefs[i].StartTime).Hours * Lh * RowsPerHr
                                + (schedDefs[i].StopTime
                                   - schedDefs[i].StartTime).Minutes * Lh / MinPerRow);
                        }
                        g.FillRectangle(blockBrush, rect);
                        g.DrawRectangle(blockOutlinePen, rect.X + 1, rect.Y + 2, rect.Width - 2, rect.Height - 4);
                        g.DrawString(blockText, blockFont
                                     , new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
                    }
                }
            }
            else             //use schedForType
            {
                for (int i = 0; i < schedForType.Length; i++)
                {
                    blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType));
                    blockText  = DefB.GetName(DefCat.BlockoutTypes, schedForType[i].BlockoutType) + "\r\n"
                                 + schedForType[i].Note;
                    if (schedForType[i].Op == 0)                  //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColWidth * ColCount - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                     //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount
                            + ColWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    g.FillRectangle(blockBrush, rect);
                    //g.DrawRectangle(blockOutlinePen,rect.X,rect.Y+1,rect.Width-1,rect.Height-3);
                    g.DrawLine(blockOutlinePen, rect.X, rect.Y + 1, rect.Right - 1, rect.Y + 1);
                    g.DrawString(blockText, blockFont
                                 , new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
                }
            }
        }
Exemple #15
0
        ///<summary>Used in FormConfirmList</summary>
        public static DataTable GetConfirmList(DateTime dateFrom, DateTime dateTo)
        {
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("AddrNote");
            table.Columns.Add("AptNum");
            table.Columns.Add("age");
            table.Columns.Add("aptDateTime");
            table.Columns.Add("confirmed");
            table.Columns.Add("contactMethod");
            table.Columns.Add("Guarantor");
            table.Columns.Add("medNotes");
            table.Columns.Add("Note");
            table.Columns.Add("patientName");
            table.Columns.Add("PatNum");
            table.Columns.Add("ProcDescript");
            List <DataRow> rows    = new List <DataRow>();
            string         command = "SELECT patient.PatNum,"                                         //0
                                     + "patient.LName,"                                               //1-LName
                                     + "patient.FName,patient.Preferred,patient.LName, "              //2-patientName
                                     + "Guarantor,AptDateTime,Birthdate,HmPhone,"                     //3-6
                                     + "WkPhone,WirelessPhone,ProcDescript,Confirmed,Note,"           //7-11
                                     + "AddrNote,AptNum,MedUrgNote,PreferConfirmMethod,Email,Premed " //12-14
                                     + "FROM patient,appointment "
                                     + "WHERE patient.PatNum=appointment.PatNum "
                                     + "AND AptDateTime > " + POut.PDate(dateFrom) + " "
                                     + "AND AptDateTime < " + POut.PDate(dateTo.AddDays(1)) + " "
                                     + "AND (AptStatus=1 " //scheduled
                                     + "OR AptStatus=4) "  //ASAP
                                     + "ORDER BY AptDateTime";
            DataTable     rawtable = General.GetTable(command);
            DateTime      dateT;
            Patient       pat;
            ContactMethod contmeth;

            for (int i = 0; i < rawtable.Rows.Count; i++)
            {
                row                = table.NewRow();
                row["AddrNote"]    = rawtable.Rows[i]["AddrNote"].ToString();
                row["AptNum"]      = rawtable.Rows[i]["AptNum"].ToString();
                row["age"]         = Shared.DateToAge(PIn.PDate(rawtable.Rows[i]["Birthdate"].ToString())).ToString();      //we don't care about m/y.
                dateT              = PIn.PDateT(rawtable.Rows[i]["AptDateTime"].ToString());
                row["aptDateTime"] = dateT.ToShortDateString() + "\r\n" + dateT.ToShortTimeString();
                row["confirmed"]   = DefB.GetName(DefCat.ApptConfirmed, PIn.PInt(rawtable.Rows[i]["Confirmed"].ToString()));
                contmeth           = (ContactMethod)PIn.PInt(rawtable.Rows[i]["PreferConfirmMethod"].ToString());
                if (contmeth == ContactMethod.None || contmeth == ContactMethod.HmPhone)
                {
                    row["contactMethod"] = Lan.g("FormConfirmList", "Hm:") + rawtable.Rows[i]["HmPhone"].ToString();
                }
                if (contmeth == ContactMethod.WkPhone)
                {
                    row["contactMethod"] = Lan.g("FormConfirmList", "Wk:") + rawtable.Rows[i]["WkPhone"].ToString();
                }
                if (contmeth == ContactMethod.WirelessPh)
                {
                    row["contactMethod"] = Lan.g("FormConfirmList", "Cell:") + rawtable.Rows[i]["WirelessPhone"].ToString();
                }
                if (contmeth == ContactMethod.Email)
                {
                    row["contactMethod"] = rawtable.Rows[i]["Email"].ToString();
                }
                if (contmeth == ContactMethod.DoNotCall || contmeth == ContactMethod.SeeNotes)
                {
                    row["contactMethod"] = Lan.g("enumContactMethod", contmeth.ToString());
                }
                row["Guarantor"] = rawtable.Rows[i]["Guarantor"].ToString();
                row["medNotes"]  = "";
                if (rawtable.Rows[i]["Premed"].ToString() == "1")
                {
                    row["medNotes"] = Lan.g("FormConfirmList", "Premedicate");
                }
                if (rawtable.Rows[i]["MedUrgNote"].ToString() != "")
                {
                    if (row["medNotes"].ToString() != "")
                    {
                        row["medNotes"] += "\r\n";
                    }
                    row["medNotes"] += rawtable.Rows[i]["MedUrgNote"].ToString();
                }
                row["Note"]        = rawtable.Rows[i]["Note"].ToString();
                pat                = new Patient();
                pat.LName          = rawtable.Rows[i]["LName"].ToString();
                pat.FName          = rawtable.Rows[i]["FName"].ToString();
                pat.Preferred      = rawtable.Rows[i]["Preferred"].ToString();
                row["patientName"] = pat.LName + "\r\n";
                if (pat.Preferred != "")
                {
                    row["patientName"] += "'" + pat.Preferred + "'";
                }
                else
                {
                    row["patientName"] += pat.FName;
                }
                //pat.GetNameLF();
                row["PatNum"]       = rawtable.Rows[i]["PatNum"].ToString();
                row["ProcDescript"] = rawtable.Rows[i]["ProcDescript"].ToString();
                rows.Add(row);
            }
            //Array.Sort(orderDate,RecallList);
            //return RecallList;
            for (int i = 0; i < rows.Count; i++)
            {
                table.Rows.Add(rows[i]);
            }
            return(table);
        }
        private void ContrSchedGrid_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            SolidBrush blockBrush = new SolidBrush(Color.White);
            float      blockW     = ColW; //set in each loop
            float      opOffset   = 0;

            if (SchedDefaults.List != null)
            {
                for (int i = 0; i < SchedDefaults.List.Length; i++)
                {
                    if (SchedType == ScheduleType.Practice)                  //for practice
                    {
                        if (SchedDefaults.List[i].SchedType != ScheduleType.Practice)
                        {
                            continue;                            //only show practice blocks
                        }
                    }
                    if (SchedType == ScheduleType.Provider)                  //for providers
                    {
                        if (SchedDefaults.List[i].SchedType != ScheduleType.Provider)
                        {
                            continue;                            //only show prov blocks
                        }
                        if (SchedDefaults.List[i].ProvNum != ProvNum)
                        {
                            continue;                            //only show blocks for this prov
                        }
                    }
                    if (SchedType == ScheduleType.Blockout)                  //for blockouts
                    //only show practice blocks and blockout blocks
                    {
                        if (SchedDefaults.List[i].SchedType == ScheduleType.Provider)
                        {
                            continue;
                        }
                    }
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Practice)                  //open block color
                    {
                        blockBrush = new SolidBrush(DefB.Long[(int)DefCat.AppointmentColors][0].ItemColor);
                        blockW     = ColW;
                        opOffset   = 0;
                    }
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Provider)                  //open block color
                    {
                        blockBrush = new SolidBrush(DefB.Long[(int)DefCat.AppointmentColors][0].ItemColor);
                        blockW     = ColW;
                        opOffset   = 0;
                    }
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Blockout)
                    {
                        blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes
                                                                  , SchedDefaults.List[i].BlockoutType));
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            blockW = ColW;
                        }
                        else
                        {
                            blockW = opW;
                        }
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            opOffset = 0;
                        }
                        else
                        {
                            opOffset = Operatories.GetOrder(SchedDefaults.List[i].Op);
                            if (opOffset == -1)                          //op not visible
                            {
                                continue;
                            }
                            opOffset = opOffset * opW;
                        }
                    }
                    e.Graphics.FillRectangle(blockBrush
                                             , NumW + SchedDefaults.List[i].DayOfWeek * ColW
                                             + opOffset  //usually 0
                                             , SchedDefaults.List[i].StartTime.Hour * 6 * RowH
                                             + (int)SchedDefaults.List[i].StartTime.Minute / 10 * RowH
                                             , blockW
                                             , ((SchedDefaults.List[i].StopTime
                                                 - SchedDefaults.List[i].StartTime).Hours * 6
                                                + (SchedDefaults.List[i].StopTime - SchedDefaults.List[i].StartTime).Minutes / 10) * RowH);
                }
            }
            Pen bPen = new Pen(Color.Black);
            Pen gPen = new Pen(Color.LightGray);

            for (int y = 0; y < 24 * 6; y++)
            {
                e.Graphics.DrawLine(gPen, NumW, y * RowH, NumW + ColW * 7, y * RowH);
            }
            for (int y = 0; y < 25; y++)
            {
                e.Graphics.DrawLine(bPen, NumW, y * RowH * 6, NumW + ColW * 7, y * RowH * 6);
            }
            for (int x = 0; x < 8; x++)
            {
                e.Graphics.DrawLine(bPen, NumW + x * ColW, 0, NumW + x * ColW, RowH * 6 * 24);
            }
            if (SchedDefaults.List != null &&
                SchedType == ScheduleType.Blockout)
            {
                for (int i = 0; i < SchedDefaults.List.Length; i++)
                {
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Blockout)
                    {
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            blockW = ColW;
                        }
                        else
                        {
                            blockW = opW;
                        }
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            opOffset = 0;
                        }
                        else
                        {
                            opOffset = Operatories.GetOrder(SchedDefaults.List[i].Op);
                            if (opOffset == -1)                          //op not visible
                            {
                                continue;
                            }
                            opOffset = opOffset * opW;
                        }
                        e.Graphics.DrawString(
                            DefB.GetName(DefCat.BlockoutTypes, SchedDefaults.List[i].BlockoutType)
                            , blockFont, Brushes.Black
                            , new RectangleF(
                                NumW + SchedDefaults.List[i].DayOfWeek * ColW
                                + opOffset                       //usually 0
                                , SchedDefaults.List[i].StartTime.Hour * 6 * RowH
                                + (int)SchedDefaults.List[i].StartTime.Minute / 10 * RowH
                                , blockW
                                , 15));
                    }
                }
            }
            CultureInfo ci      = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            string      hFormat = Lan.GetShortTimeFormat(ci);

            for (int y = 0; y < 24; y++)
            {
                e.Graphics.DrawString((new DateTime(2000, 1, 1, y, 0, 0)).ToString(hFormat, ci)
                                      , timeFont, new SolidBrush(Color.Black), 0, y * RowH * 6 - 3);
                e.Graphics.DrawString((new DateTime(2000, 1, 1, y, 0, 0)).ToString(hFormat, ci)
                                      , timeFont, new SolidBrush(Color.Black), NumW + ColW * 7, y * RowH * 6 - 3);
            }
            Width  = NumW * 2 + ColW * 7;
            Height = RowH * 24 * 6 + 1;
        }