Example #1
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;
 }
Example #2
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();
 }
Example #3
0
        ///<summary>Used by FormUpdate to check whether codes starting with T exist and are in a visible category.  If so, it moves them to the Obsolete category.</summary>
        public static void TcodesMove()
        {
            string    command = @"SELECT DISTINCT ProcCat FROM procedurecode,definition 
				WHERE procedurecode.ADACode LIKE 'T%'
				AND definition.IsHidden=0
				AND procedurecode.ProcCat=definition.DefNum"                ;
            DataTable table   = General.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return;
            }
            int catNum = DefB.GetByExactName(DefCat.ProcCodeCats, "Obsolete");         //check to make sure an Obsolete category exists.

            if (catNum == 0)
            {
                Def def = new Def();
                def.Category  = DefCat.ProcCodeCats;
                def.ItemName  = "Obsolete";
                def.ItemOrder = DefB.Long[(int)DefCat.ProcCodeCats].Length;
                Defs.Insert(def);
                catNum = def.DefNum;
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                command = "UPDATE procedurecode SET ProcCat=" + POut.PInt(catNum)
                          + " WHERE ProcCat=" + table.Rows[i][0].ToString();
                General.NonQ(command);
            }
        }
Example #4
0
        private void butNew_Click(object sender, System.EventArgs e)
        {
            //won't be visible if no permission
            FormProcCodeNew FormPCN = new FormProcCodeNew();

            FormPCN.ShowDialog();
            if (FormPCN.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (FormPCN.textNewCode.Text == "")
            {
                return;
            }
            ProcedureCode procCode;

            if (ProcedureCodes.HList.ContainsKey(FormPCN.textNewCode.Text))
            {
                procCode = (ProcedureCode)ProcedureCodes.HList[FormPCN.textNewCode.Text];
                textAbbreviation.Text = "";
                textDescription.Text  = "";
                textCode.Text         = FormPCN.textNewCode.Text;
                if (DefB.GetHidden(DefCat.ProcCodeCats, procCode.ProcCat))
                {
                    checkShowHidden.Checked = true;
                    FillCats();
                }
                for (int i = 0; i < CatList.Length; i++)
                {
                    if (CatList[i].DefNum == procCode.ProcCat)
                    {
                        listCategories.SetSelected(i, true);
                    }
                    else
                    {
                        listCategories.SetSelected(i, false);
                    }
                }
                FillGrid();
                MessageBox.Show(Lan.g(this, "That code already exists."));
                return;
            }
            procCode         = new ProcedureCode();
            procCode.ADACode = FormPCN.textNewCode.Text;
            //procCode.ProcTime="/X/";//moved to contructor.
            procCode.ProcCat = DefB.Short[(int)DefCat.ProcCodeCats][0].DefNum;
            //procCode.GraphicColor=Color.FromArgb(0);//moved to contructor.
            ProcedureCodes.Insert(procCode);
            FormProcCodeEdit FormP = new FormProcCodeEdit(procCode);

            FormP.IsNew = true;
            FormP.ShowDialog();
            if (FormP.DialogResult == DialogResult.OK)
            {
                changed = true;
                FillGrid();
            }
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Added Procedure Code: " + procCode.ADACode);
        }
        ///<summary>Can be called externally as part of the update sequence.  Surround with try catch.  Returns number of codes inserted.  Supply path to file to import or a list of procedure codes, or an xml string.  Make sure to set the other two values blank or empty(not null).</summary>
        public static int ImportProcCodes(string path, List <ProcedureCode> listCodes, string xmlData)
        {
            //xmlData should already be tested ahead of time to make sure it's not blank.
            XmlSerializer serializer = new XmlSerializer(typeof(List <ProcedureCode>));

            if (path != "")
            {
                if (!File.Exists(path))
                {
                    throw new ApplicationException(Lan.g("FormProcCodes", "File does not exist."));
                }
                try {
                    using (TextReader reader = new StreamReader(path)) {
                        listCodes = (List <ProcedureCode>)serializer.Deserialize(reader);
                    }
                }
                catch {
                    throw new ApplicationException(Lan.g("FormProcCodes", "Invalid file format"));
                }
            }
            else if (xmlData != "")
            {
                try {
                    using (TextReader reader = new StringReader(xmlData)) {
                        listCodes = (List <ProcedureCode>)serializer.Deserialize(reader);
                    }
                }
                catch {
                    throw new ApplicationException(Lan.g("FormProcCodes", "xml format"));
                }
            }
            int retVal = 0;

            for (int i = 0; i < listCodes.Count; i++)
            {
                if (ProcedureCodes.HList.ContainsKey(listCodes[i].ProcCode))
                {
                    continue;                    //don't import duplicates.
                }
                listCodes[i].ProcCat = DefB.GetByExactName(DefCat.ProcCodeCats, listCodes[i].ProcCatDescript);
                if (listCodes[i].ProcCat == 0)               //no category exists with that name
                {
                    Def def = new Def();
                    def.Category  = DefCat.ProcCodeCats;
                    def.ItemName  = listCodes[i].ProcCatDescript;
                    def.ItemOrder = DefB.Long[(int)DefCat.ProcCodeCats].Length;
                    Defs.Insert(def);
                    Defs.Refresh();
                    listCodes[i].ProcCat = def.DefNum;
                }
                ProcedureCodes.Insert(listCodes[i]);
                retVal++;
            }
            return(retVal);
            //don't forget to refresh procedurecodes
        }
        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();
        }
Example #7
0
        ///<summary>DataSet cannot be null.</summary>
        public static DataSet ProcessQuery(DtoQueryBase dto)
        {
            if (dto.GetType() == typeof(DtoGeneralGetTable))
            {
                return(GeneralB.GetTable(((DtoGeneralGetTable)dto).Command));
            }
            else if (dto.GetType() == typeof(DtoGeneralGetTableLow))
            {
                return(GeneralB.GetTableLow(((DtoGeneralGetTableLow)dto).Command));
            }
            else if (dto.GetType() == typeof(DtoGeneralGetDataSet))
            {
                return(GeneralB.GetDataSet(((DtoGeneralGetDataSet)dto).Commands));
            }
            else if (dto.GetType() == typeof(DtoAccountModuleGetAll))
            {
                return(AccountModuleB.GetAll(((DtoAccountModuleGetAll)dto).PatNum));
            }
            else if (dto.GetType() == typeof(DtoChartModuleGetAll))
            {
                return(ChartModuleB.GetAll(((DtoChartModuleGetAll)dto).PatNum, ((DtoChartModuleGetAll)dto).IsAuditMode));
            }
            else if (dto.GetType() == typeof(DtoCovCatRefresh))
            {
                return(CovCatB.Refresh());
            }
            else if (dto.GetType() == typeof(DtoDefRefresh))
            {
                return(DefB.Refresh());
            }
            else if (dto.GetType() == typeof(DtoPrefRefresh))
            {
                return(PrefB.Refresh());
            }
            else if (dto.GetType() == typeof(DtoProcedureRefresh))
            {
                return(ProcedureB.Refresh(((DtoProcedureRefresh)dto).PatNum));
            }
            else if (dto.GetType() == typeof(DtoUserodRefresh))
            {
                return(UserodB.Refresh());
            }


            else
            {
                throw new Exception("OpenDentServer.BusinessLayer.ProcessObject(dto) is missing a case for "
                                    + dto.GetType().ToString());
            }
        }
Example #8
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, true, "If you want a clean slate, the current fee schedule should be cleared first.  When imported, any fees that are found in the text file will overwrite values of the current fee schedule showing in the main window.  Are you sure you want to continue?"))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            OpenFileDialog Dlg = new OpenFileDialog();

            if (Directory.Exists(PrefB.GetString("ExportPath")))
            {
                Dlg.InitialDirectory = PrefB.GetString("ExportPath");
            }
            else if (Directory.Exists("C:\\"))
            {
                Dlg.InitialDirectory = "C:\\";
            }
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            if (!File.Exists(Dlg.FileName))
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "File not found");
                return;
            }
            string[] fields;
            double   fee;
            int      schedI = DefB.GetOrder(DefCat.FeeSchedNames, SchedNum);

            using (StreamReader sr = new StreamReader(Dlg.FileName)){
                string line = sr.ReadLine();
                while (line != null)
                {
                    fields = line.Split(new string[1] {
                        "\t"
                    }, StringSplitOptions.None);
                    if (fields.Length > 1 && fields[1] != "")                //skips blank fees
                    {
                        fee = PIn.PDouble(fields[1]);
                        Fees.Import(fields[0], fee, schedI);
                    }
                    line = sr.ReadLine();
                }
            }
            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
        }
Example #9
0
        ///<summary>If the named fee schedule does not exist, then it will be created.  It always returns the defnum for the feesched used, regardless of whether it already existed.  procCode must have already been tested for valid code, and feeSchedName must not be blank.</summary>
        public static int ImportTrojan(string procCode, double amt, string feeSchedName)
        {
            Def def;
            int feeSched = DefB.GetByExactName(DefCat.FeeSchedNames, feeSchedName);

            //if isManaged, then this should be done differently from here on out.
            if (feeSched == 0)
            {
                //add the new fee schedule
                def           = new Def();
                def.Category  = DefCat.FeeSchedNames;
                def.ItemName  = feeSchedName;
                def.ItemOrder = DefB.Long[(int)DefCat.FeeSchedNames].Length;
                Defs.Insert(def);
                feeSched = def.DefNum;
                Defs.Refresh();
                Fees.Refresh();
                DataValid.SetInvalid(InvalidTypes.Defs | InvalidTypes.Fees);
            }
            else
            {
                def = DefB.GetDef(DefCat.FeeSchedNames, feeSched);
            }
            if (def.IsHidden)            //if the fee schedule is hidden
            {
                def.IsHidden = false;    //unhide it
                Defs.Update(def);
                Defs.Refresh();
                DataValid.SetInvalid(InvalidTypes.Defs);
            }
            Fee fee = GetFeeByOrder(ProcedureCodes.GetCodeNum(procCode), DefB.GetOrder(DefCat.FeeSchedNames, def.DefNum));

            if (fee == null)
            {
                fee          = new Fee();
                fee.Amount   = amt;
                fee.FeeSched = def.DefNum;
                fee.CodeNum  = ProcedureCodes.GetCodeNum(procCode);
                Insert(fee);
            }
            else
            {
                fee.Amount = amt;
                Update(fee);
            }
            return(def.DefNum);
        }
Example #10
0
 private void FormFeesForIns_Load(object sender, EventArgs e)
 {
     comboFeeSchedWithout.Items.Add(Lan.g(this, "none"));
     comboFeeSchedWith.Items.Add(Lan.g(this, "none"));
     comboFeeSchedNew.Items.Add(Lan.g(this, "none"));
     comboFeeSchedWithout.SelectedIndex = 0;
     comboFeeSchedWith.SelectedIndex    = 0;
     comboFeeSchedNew.SelectedIndex     = 0;
     FeeSchedsStandard = DefB.GetFeeSchedList("");
     for (int i = 0; i < FeeSchedsStandard.Length; i++)
     {
         comboFeeSchedWithout.Items.Add(FeeSchedsStandard[i].ItemName);
         comboFeeSchedWith.Items.Add(FeeSchedsStandard[i].ItemName);
         comboFeeSchedNew.Items.Add(FeeSchedsStandard[i].ItemName);
     }
     FillGrid();
 }
Example #11
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;
        }
Example #12
0
 ///<summary></summary>
 public static void Update(Def def)
 {
     try {
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             DefB.Update(def);
         }
         else
         {
             DtoDefUpdate dto = new DtoDefUpdate();
             dto.DefCur = def;
             RemotingClient.ProcessCommand(dto);
         }
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
         return;
     }
 }
Example #13
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;
        }
Example #14
0
        ///<Summary>Can be called externally as part of the update sequence.  Surround with try catch.  Returns number of codes inserted.</Summary>
        public static int ImportProcCodes(string path, bool askBeforeReplace)
        {
            if (!File.Exists(path))
            {
                throw new ApplicationException(Lan.g("FormProcCodes", "File does not exist."));
            }
            XmlSerializer        serializer = new XmlSerializer(typeof(List <ProcedureCode>));
            List <ProcedureCode> listCodes  = new List <ProcedureCode>();

            //ClaimForm tempClaimForm=new ClaimForm();
            try {
                using (TextReader reader = new StreamReader(path)){
                    listCodes = (List <ProcedureCode>)serializer.Deserialize(reader);
                }
            }
            catch {
                throw new ApplicationException(Lan.g("FormProcCodes", "Invalid file format"));
            }
            int retVal = 0;

            for (int i = 0; i < listCodes.Count; i++)
            {
                if (ProcedureCodes.HList.ContainsKey(listCodes[i].ADACode))
                {
                    continue;                    //don't import duplicates.
                }
                listCodes[i].ProcCat = DefB.GetByExactName(DefCat.ProcCodeCats, listCodes[i].ProcCatDescript);
                if (listCodes[i].ProcCat == 0)              //no category exists with that name
                {
                    Def def = new Def();
                    def.Category  = DefCat.ProcCodeCats;
                    def.ItemName  = listCodes[i].ProcCatDescript;
                    def.ItemOrder = DefB.Long[(int)DefCat.ProcCodeCats].Length;
                    Defs.Insert(def);
                    listCodes[i].ProcCat = def.DefNum;
                }
                ProcedureCodes.Insert(listCodes[i]);
                retVal++;
            }
            return(retVal);
        }
Example #15
0
        ///<summary></summary>
        public static void Refresh()
        {
            DataSet ds = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    ds = DefB.Refresh();
                }
                else
                {
                    DtoDefRefresh dto = new DtoDefRefresh();
                    ds = RemotingClient.ProcessQuery(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
                return;
            }
            DefB.FillArrays(ds.Tables[0]);            //now, we have an arrays on both the client and the server.
        }
        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();
        }
Example #17
0
        ///<summary>Returns an amount if a fee has been entered.  Otherwise returns -1.  Not usually used directly.</summary>
        public static double GetAmount(string adacode, int feeSched)
        {
            if (adacode == null)
            {
                return(-1);
            }
            if (feeSched == 0)
            {
                return(-1);
            }
            int i = DefB.GetOrder(DefCat.FeeSchedNames, feeSched);

            if (i == -1)
            {
                return(-1);               //you cannot obtain fees for hidden fee schedules
            }
            if (HList[i].Contains(adacode))
            {
                return(((Fee)HList[i][adacode]).Amount);
            }
            return(-1);           //code not found
        }
Example #18
0
        ///<summary></summary>
        public static void Insert(Def def)
        {
            int defNum;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    defNum = DefB.Insert(def);
                }
                else
                {
                    DtoDefInsert dto = new DtoDefInsert();
                    dto.DefCur = def;
                    defNum     = RemotingClient.ProcessCommand(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
                return;
            }
            def.DefNum = defNum;
        }
Example #19
0
        ///<summary>Returns an amount if a fee has been entered.  Otherwise returns -1.  Not usually used directly.</summary>
        public static double GetAmount(int codeNum, int feeSched)
        {
            if (codeNum == 0)
            {
                return(-1);
            }
            if (feeSched == 0)
            {
                return(-1);
            }
            int i = DefB.GetOrder(DefCat.FeeSchedNames, feeSched);

            if (i == -1)
            {
                return(-1);               //you cannot obtain fees for hidden fee schedules
            }
            if (HList[i].Contains(codeNum))
            {
                return(((Fee)HList[i][codeNum]).Amount);
            }
            return(-1);           //code not found
        }
Example #20
0
        private void butIncrease_Click(object sender, System.EventArgs e)
        {
            int percent = 0;

            if (textPercent.Text == "")
            {
                MsgBox.Show(this, "Please enter a percent first.");
                return;
            }
            try{
                percent = System.Convert.ToInt32(textPercent.Text);
            }
            catch {
                MsgBox.Show(this, "Percent is not a valid number.");
                return;
            }
            if (percent < -99 || percent > 99)
            {
                MsgBox.Show(this, "Percent must be between -99 and 99.");
                return;
            }
            if (!MsgBox.Show(this, true, "This will overwrite all values of the current fee schedule showing in the main window.  For this reason, you should be working on a copy.  Are you sure you want to continue?"))
            {
                return;
            }

            int round = 0;

            if (radioDime.Checked)
            {
                round = 1;
            }
            if (radioPenny.Checked)
            {
                round = 2;
            }
            Fees.Increase(DefB.GetOrder(DefCat.FeeSchedNames, SchedNum), percent, round);
            DialogResult = DialogResult.OK;
        }
Example #21
0
        ///<summary>Refreshes all fees and loads them into HList array.  </summary>
        public static void Refresh()
        {
            HList = new Hashtable[DefB.Short[(int)DefCat.FeeSchedNames].Length];
            for (int i = 0; i < HList.Length; i++)
            {
                HList[i] = new Hashtable();
            }
            Fee       fee;
            string    command = "SELECT * FROM fee";
            DataTable table   = General.GetTable(command);

            for (int i = 0; i < table.Rows.Count; i++)
            {
                fee        = new Fee();
                fee.FeeNum = PIn.PInt(table.Rows[i][0].ToString());
                fee.Amount = PIn.PDouble(table.Rows[i][1].ToString());
                //fee.OldCode      =PIn.PString(table.Rows[i][2].ToString());
                fee.FeeSched = PIn.PInt(table.Rows[i][3].ToString());
                //fee.UseDefaultFee=PIn.PBool(table.Rows[i][4].ToString());
                //fee.UseDefaultCov=PIn.PBool(table.Rows[i][5].ToString());
                fee.CodeNum = PIn.PInt(table.Rows[i][6].ToString());
                if (DefB.GetOrder(DefCat.FeeSchedNames, fee.FeeSched) != -1)              //if fee sched is visible
                {
                    if (HList[DefB.GetOrder(DefCat.FeeSchedNames, fee.FeeSched)].ContainsKey(fee.CodeNum))
                    {
                        //if fee was already loaded for this code, delete this duplicate.
                        command = "DELETE FROM fee WHERE feenum = '" + fee.FeeNum + "'";
                        General.NonQ(command);
                    }
                    else
                    {
                        HList[DefB.GetOrder(DefCat.FeeSchedNames, fee.FeeSched)].Add(fee.CodeNum, fee);
                    }
                }
            }
        }
        ///<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;
            }
        }
Example #24
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textAdjDate.errorProvider1.GetError(textAdjDate) != "" ||
         textProcDate.errorProvider1.GetError(textProcDate) != "" ||
         textAmount.errorProvider1.GetError(textAmount) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textAmount.Text == "")
     {
         MessageBox.Show(Lan.g(this, "Please enter an amount."));
         return;
     }
     if (listTypeNeg.SelectedIndex == -1 && listTypePos.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select a type first.");
         return;
     }
     //DateEntry not allowed to change
     AdjustmentCur.AdjDate  = PIn.PDate(textAdjDate.Text);
     AdjustmentCur.ProcDate = PIn.PDate(textProcDate.Text);
     if (listProvider.SelectedIndex == -1)
     {
         AdjustmentCur.ProvNum = PatCur.PriProv;
     }
     else
     {
         AdjustmentCur.ProvNum = Providers.List[this.listProvider.SelectedIndex].ProvNum;
     }
     if (listTypePos.SelectedIndex != -1)
     {
         AdjustmentCur.AdjType
             = DefB.Short[(int)DefCat.AdjTypes][(int)PosIndex[listTypePos.SelectedIndex]].DefNum;
     }
     if (listTypeNeg.SelectedIndex != -1)
     {
         AdjustmentCur.AdjType
             = DefB.Short[(int)DefCat.AdjTypes][(int)NegIndex[listTypeNeg.SelectedIndex]].DefNum;
     }
     if (DefB.GetValue(DefCat.AdjTypes, AdjustmentCur.AdjType) == "+")         //pos
     {
         AdjustmentCur.AdjAmt = PIn.PDouble(textAmount.Text);
     }
     else             //neg
     {
         AdjustmentCur.AdjAmt = -PIn.PDouble(textAmount.Text);
     }
     AdjustmentCur.AdjNote = textNote.Text;
     try{
         Adjustments.InsertOrUpdate(AdjustmentCur, IsNew);
     }
     catch (Exception ex) {          //even though it doesn't currently throw any exceptions
         MessageBox.Show(ex.Message);
         return;
     }
     if (IsNew)
     {
         SecurityLogs.MakeLogEntry(Permissions.AdjustmentCreate, AdjustmentCur.PatNum,
                                   Patients.GetLim(AdjustmentCur.PatNum).GetNameLF() + ", "
                                   + AdjustmentCur.AdjAmt.ToString("c"));
     }
     else
     {
         SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, AdjustmentCur.PatNum,
                                   Patients.GetLim(AdjustmentCur.PatNum).GetNameLF() + ", "
                                   + AdjustmentCur.AdjAmt.ToString("c"));
     }
     DialogResult = DialogResult.OK;
 }
Example #25
0
        ///<summary>Used to check whether codes starting with T exist and are in a visible category.  If so, it moves them to the Obsolete category.  If the T code has never been used, then it deletes it.</summary>
        public static void TcodesClear()
        {
            //first delete any unused T codes
            string    command = @"SELECT CodeNum,ProcCode FROM procedurecode
				WHERE NOT EXISTS(SELECT * FROM procedurelog WHERE procedurelog.CodeNum=procedurecode.CodeNum)
				AND ProcCode LIKE 'T%'"                ;
            DataTable table   = General.GetTable(command);
            int       codenum;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                codenum = PIn.PInt(table.Rows[i]["CodeNum"].ToString());
                command = "DELETE FROM fee WHERE CodeNum=" + POut.PInt(codenum);
                General.NonQ(command);
                command = "DELETE FROM procedurecode WHERE CodeNum=" + POut.PInt(codenum);
                General.NonQ(command);
            }
            //then, move any other T codes to obsolete category
            command = @"SELECT DISTINCT ProcCat FROM procedurecode,definition 
				WHERE procedurecode.ProcCode LIKE 'T%'
				AND definition.IsHidden=0
				AND procedurecode.ProcCat=definition.DefNum"                ;
            table   = General.GetTable(command);
            int catNum = DefB.GetByExactName(DefCat.ProcCodeCats, "Obsolete");         //check to make sure an Obsolete category exists.
            Def def;

            if (catNum != 0)           //if a category exists with that name
            {
                def = DefB.GetDef(DefCat.ProcCodeCats, catNum);
                if (!def.IsHidden)
                {
                    def.IsHidden = true;
                    Defs.Update(def);
                    Defs.Refresh();
                }
            }
            if (catNum == 0)
            {
                def           = new Def();
                def.Category  = DefCat.ProcCodeCats;
                def.ItemName  = "Obsolete";
                def.ItemOrder = DefB.Long[(int)DefCat.ProcCodeCats].Length;
                def.IsHidden  = true;
                Defs.Insert(def);
                Defs.Refresh();
                catNum = def.DefNum;
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                command = "UPDATE procedurecode SET ProcCat=" + POut.PInt(catNum)
                          + " WHERE ProcCat=" + table.Rows[i][0].ToString();
                General.NonQ(command);
            }
            //finally, set Never Used category to be hidden.  This isn't really part of clearing Tcodes, but is required
            //because many customers won't have that category hidden
            catNum = DefB.GetByExactName(DefCat.ProcCodeCats, "Never Used");
            if (catNum != 0)           //if a category exists with that name
            {
                def = DefB.GetDef(DefCat.ProcCodeCats, catNum);
                if (!def.IsHidden)
                {
                    def.IsHidden = true;
                    Defs.Update(def);
                    Defs.Refresh();
                }
            }
        }
        private void FormBillingOptions_Load(object sender, System.EventArgs e)
        {
            if (PIn.PDate(PrefB.GetString("DateLastAging")) < DateTime.Today)
            {
                if (MessageBox.Show(Lan.g(this, "Update aging first?"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    FormAging FormA = new FormAging();
                    FormA.ShowDialog();
                }
            }
            for (int i = 0; i < DefB.Short[(int)DefCat.BillingTypes].Length; i++)
            {
                listBillType.Items.Add(DefB.Short[(int)DefCat.BillingTypes][i].ItemName);
            }
            textLastStatement.Text      = DateTime.Today.AddMonths(-1).ToShortDateString();
            checkIncludeChanged.Checked = PrefB.GetBool("BillingIncludeChanged");
            string[] selectedBillTypes = ((Pref)PrefB.HList["BillingSelectBillingTypes"]).ValueString.Split(',');
            for (int i = 0; i < selectedBillTypes.Length; i++)
            {
                try{
                    int order = DefB.GetOrder(DefCat.BillingTypes, Convert.ToInt32(selectedBillTypes[i]));
                    if (order != -1)
                    {
                        listBillType.SetSelected(order, true);
                    }
                }
                catch {}
            }
            if (listBillType.SelectedIndices.Count == 0)
            {
                listBillType.SelectedIndex = 0;
            }
            switch (((Pref)PrefB.HList["BillingAgeOfAccount"]).ValueString)
            {
            default:
                radioAny.Checked = true;
                break;

            case "30":
                radio30.Checked = true;
                break;

            case "60":
                radio60.Checked = true;
                break;

            case "90":
                radio90.Checked = true;
                break;
            }
            if (((Pref)PrefB.HList["BillingExcludeBadAddresses"]).ValueString == "1")
            {
                checkBadAddress.Checked = true;
            }
            if (((Pref)PrefB.HList["BillingExcludeInactive"]).ValueString == "1")
            {
                checkExcludeInactive.Checked = true;
            }
            if (((Pref)PrefB.HList["BillingExcludeNegative"]).ValueString == "1")
            {
                checkExcludeNegative.Checked = true;
            }
            textExcludeLessThan.Text = ((Pref)PrefB.HList["BillingExcludeLessThan"]).ValueString;
            //blank is allowed
            FillDunning();
        }
Example #27
0
        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;
                    }
                }
            }
        }
Example #28
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);
        }
Example #29
0
        ///<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;
            }
        }
Example #30
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();
        }