コード例 #1
0
        public void FeeSchedTools_CopyFeeSched_Clinics()
        {
            //Make sure there are no duplicate fees already present within the database.
            string dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);

            if (dbmResult.Trim() != _feeDeleteDuplicatesExpectedResult)
            {
                DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Fix);
            }
            //Make sure that there are more than six clinics
            ClinicT.ClearClinicTable();
            for (int i = 0; i < 10; i++)
            {
                ClinicT.CreateClinic(MethodBase.GetCurrentMethod().Name + "_" + i);
            }
            //Create two fee schedules; from and to
            FeeSched feeSchedNumFrom = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM");
            FeeSched feeSchedNumTo   = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO");

            //Create a fee for every single procedure code in the database and associate it to the "from" fee schedule.
            foreach (ProcedureCode code in _listProcCodes)
            {
                FeeT.CreateFee(feeSchedNumFrom.FeeSchedNum, code.CodeNum, _rand.Next(5000));
            }
            //Copy the "from" fee schedule into the "to" fee schedule and do it for at least seven clinics.
            FeeScheds.CopyFeeSchedule(feeSchedNumFrom, 0, 0, feeSchedNumTo, Clinics.GetDeepCopy(true).Select(x => x.ClinicNum).ToList(), 0);
            //Make sure that there was NOT a duplicate fee inserted into the database.
            dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);
            Assert.AreEqual(dbmResult.Trim(), _feeDeleteDuplicatesExpectedResult, "Duplicate fees detected due to concurrent copying.");
        }
コード例 #2
0
ファイル: FeeSchedCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Returns true if Update(FeeSched,FeeSched) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(FeeSched feeSched, FeeSched oldFeeSched)
 {
     if (feeSched.Description != oldFeeSched.Description)
     {
         return(true);
     }
     if (feeSched.FeeSchedType != oldFeeSched.FeeSchedType)
     {
         return(true);
     }
     if (feeSched.ItemOrder != oldFeeSched.ItemOrder)
     {
         return(true);
     }
     if (feeSched.IsHidden != oldFeeSched.IsHidden)
     {
         return(true);
     }
     if (feeSched.IsGlobal != oldFeeSched.IsGlobal)
     {
         return(true);
     }
     //SecUserNumEntry excluded from update
     //SecDateEntry not allowed to change
     //SecDateTEdit can only be set by MySQL
     return(false);
 }
コード例 #3
0
ファイル: FeeSchedCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one FeeSched into the database.  Returns the new priKey.</summary>
 internal static long Insert(FeeSched feeSched)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         feeSched.FeeSchedNum=DbHelper.GetNextOracleKey("feesched","FeeSchedNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(feeSched,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     feeSched.FeeSchedNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(feeSched,false);
     }
 }
コード例 #4
0
ファイル: FeeL.cs プロジェクト: ChemBrain/OpenDental
 ///<summary>Returns true if current user can edit the given feeSched, otherwise false.
 ///Shows a MessageBox if user is not allowed to edit.</summary>
 public static bool CanEditFee(FeeSched feeSched, long provNum, long clinicNum)
 {
     //User doesn't have permission
     if (!Security.IsAuthorized(Permissions.FeeSchedEdit))
     {
         return(false);
     }
     //Check if a provider fee schedule is selected and if the current user has permissions to edit provider fees.
     if (provNum != 0 && !Security.IsAuthorized(Permissions.ProviderFeeEdit))
     {
         return(false);
     }
     //Make sure the user has permission to edit the clinic of the fee schedule being edited.
     if (Security.CurUser.ClinicIsRestricted && clinicNum != Clinics.ClinicNum)
     {
         if (clinicNum == 0 && feeSched != null && feeSched.IsGlobal)
         {
             //Allow restricted users to edit the default Fee when the FeeSched is global.
             //Intentionally blank so logic in more readable, will return true below.
         }
         else
         {
             MessageBox.Show(Lans.g("Fee", "User is clinic restricted and") + " " + feeSched.Description + " " + Lans.g("Fee", "is not global."));
             return(false);
         }
     }
     return(true);
 }
コード例 #5
0
        ///<summary>Inserts one FeeSched into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(FeeSched feeSched, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                feeSched.FeeSchedNum = ReplicationServers.GetKey("feesched", "FeeSchedNum");
            }
            string command = "INSERT INTO feesched (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "FeeSchedNum,";
            }
            command += "Description,FeeSchedType,ItemOrder,IsHidden) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(feeSched.FeeSchedNum) + ",";
            }
            command +=
                "'" + POut.String(feeSched.Description) + "',"
                + POut.Int((int)feeSched.FeeSchedType) + ","
                + POut.Int(feeSched.ItemOrder) + ","
                + POut.Bool(feeSched.IsHidden) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                feeSched.FeeSchedNum = Db.NonQ(command, true);
            }
            return(feeSched.FeeSchedNum);
        }
コード例 #6
0
        public void FeeSchedTools_CopyFeeSched_Concurrency()
        {
            //Make sure there are no duplicate fees already present within the database.
            string dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);

            if (dbmResult.Trim() != _feeDeleteDuplicatesExpectedResult)
            {
                DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Fix);
            }
            //Create two fee schedules; from and to
            FeeSched feeSchedFrom = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM");
            FeeSched feeSchedTo   = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO");

            //Create a single fee and associate it to the "from" fee schedule.
            FeeT.CreateFee(feeSchedFrom.FeeSchedNum, _listProcCodes[_rand.Next(_listProcCodes.Count - 1)].CodeNum, _defaultFeeAmt);
            //Create a helper action that will simply copy the "from" schedule into the "to" schedule for the given fee cache passed in.
            Action actionCopyFromTo = new Action(() => {
                FeeScheds.CopyFeeSchedule(feeSchedFrom, 0, 0, feeSchedTo, null, 0);
            });

            //Mimic each user clicking the "Copy" button from within the Fee Tools window one right after the other (before they click OK).
            actionCopyFromTo();
            actionCopyFromTo();
            //Make sure that there was NOT a duplicate fee inserted into the database.
            dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);
            Assert.AreEqual(dbmResult.Trim(), _feeDeleteDuplicatesExpectedResult, "Duplicate fees detected due to concurrent copying.");
        }
コード例 #7
0
ファイル: FeeSchedCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one FeeSched into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(FeeSched feeSched,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         feeSched.FeeSchedNum=ReplicationServers.GetKey("feesched","FeeSchedNum");
     }
     string command="INSERT INTO feesched (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="FeeSchedNum,";
     }
     command+="Description,FeeSchedType,ItemOrder,IsHidden) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(feeSched.FeeSchedNum)+",";
     }
     command+=
          "'"+POut.String(feeSched.Description)+"',"
         +    POut.Int   ((int)feeSched.FeeSchedType)+","
         +    POut.Int   (feeSched.ItemOrder)+","
         +    POut.Bool  (feeSched.IsHidden)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         feeSched.FeeSchedNum=Db.NonQ(command,true);
     }
     return feeSched.FeeSchedNum;
 }
コード例 #8
0
ファイル: FeeSchedT.cs プロジェクト: royedwards/DRDNet
        ///<summary>Returns feeSchedNum</summary>
        public static long CreateFeeSched(FeeScheduleType feeSchedType, string suffix, bool isGlobal = true)
        {
            FeeSched feeSched = GetNewFeeSched(feeSchedType, suffix, isGlobal);

            FeeScheds.RefreshCache();
            return(feeSched.FeeSchedNum);
        }
コード例 #9
0
        public void FeeSchedTools_ImportCanada()
        {
            string canadianCodes = Properties.Resources.canadianprocedurecodes;

            //If we need to import these procedures codes, do so
            foreach (string line in canadianCodes.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
            {
                string[] properties = line.Split('\t');
                if (properties.Count() != 10)
                {
                    continue;
                }
                if (ProcedureCodes.GetCodeNum(properties[0]) != 0)
                {
                    continue;
                }
                ProcedureCode procCode = new ProcedureCode()
                {
                    ProcCode = properties[0],
                    Descript = properties[1],
                    ProcTime = properties[8],
                    AbbrDesc = properties[9],
                };
                ProcedureCodes.Insert(procCode);
            }
            //Now import the fees
            string     feeData     = Properties.Resources.BC_BCDA_2018_GPOOC;
            FeeSched   feeSched    = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name, isGlobal: false);
            List <Fee> listNewFees = FeeScheds.ImportCanadaFeeSchedule2(feeSched, feeData, 0, 0, out int numImported, out int numSkipped);

            Assert.IsTrue(DoAmountsMatch(listNewFees, feeSched.FeeSchedNum, 0, 0));
        }
コード例 #10
0
 ///<summary>Inserts one FeeSched into the database.  Returns the new priKey.</summary>
 public static long Insert(FeeSched feeSched)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         feeSched.FeeSchedNum = DbHelper.GetNextOracleKey("feesched", "FeeSchedNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(feeSched, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     feeSched.FeeSchedNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(feeSched, false));
     }
 }
コード例 #11
0
		private void butFeeSched_Click(object sender,EventArgs e) {
			//No need to check security because we are launching the form in selection mode.
			FormFeeScheds FormFS=new FormFeeScheds(true);
			FormFS.SelectedFeeSchedNum=(_feeSchedCur==null ? 0 : _feeSchedCur.FeeSchedNum);
			if(FormFS.ShowDialog()==DialogResult.OK) {
				_feeSchedCur=FeeScheds.GetFirst(x => x.FeeSchedNum==FormFS.SelectedFeeSchedNum);
				textFeeSched.Text=_feeSchedCur.Description;
			}
		}
コード例 #12
0
ファイル: FeeSchedCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Updates one FeeSched in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(FeeSched feeSched, FeeSched oldFeeSched)
        {
            string command = "";

            if (feeSched.Description != oldFeeSched.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(feeSched.Description) + "'";
            }
            if (feeSched.FeeSchedType != oldFeeSched.FeeSchedType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSchedType = " + POut.Int((int)feeSched.FeeSchedType) + "";
            }
            if (feeSched.ItemOrder != oldFeeSched.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(feeSched.ItemOrder) + "";
            }
            if (feeSched.IsHidden != oldFeeSched.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(feeSched.IsHidden) + "";
            }
            if (feeSched.IsGlobal != oldFeeSched.IsGlobal)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsGlobal = " + POut.Bool(feeSched.IsGlobal) + "";
            }
            //SecUserNumEntry excluded from update
            //SecDateEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE feesched SET " + command
                      + " WHERE FeeSchedNum = " + POut.Long(feeSched.FeeSchedNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #13
0
ファイル: FeeSchedT.cs プロジェクト: royedwards/DRDNet
        public static FeeSched GetNewFeeSched(FeeScheduleType feeSchedType, string suffix, bool isGlobal = true)
        {
            FeeSched feeSched = new FeeSched();

            feeSched.FeeSchedType = feeSchedType;
            feeSched.Description  = "FeeSched" + suffix;
            feeSched.IsGlobal     = isGlobal;
            FeeScheds.Insert(feeSched);
            return(feeSched);
        }
コード例 #14
0
ファイル: FeeSchedT.cs プロジェクト: nampn/ODental
        ///<summary>Returns feeSchedNum</summary>
        public static long CreateFeeSched(FeeScheduleType feeSchedType, string suffix)
        {
            FeeSched feeSched = new FeeSched();

            feeSched.FeeSchedType = feeSchedType;
            feeSched.Description  = "FeeSched" + suffix;
            FeeScheds.Insert(feeSched);
            FeeScheds.RefreshCache();
            return(feeSched.FeeSchedNum);
        }
コード例 #15
0
        ///<summary>Updates one FeeSched in the database.</summary>
        public static void Update(FeeSched feeSched)
        {
            string command = "UPDATE feesched SET "
                             + "Description = '" + POut.String(feeSched.Description) + "', "
                             + "FeeSchedType=  " + POut.Int((int)feeSched.FeeSchedType) + ", "
                             + "ItemOrder   =  " + POut.Int(feeSched.ItemOrder) + ", "
                             + "IsHidden    =  " + POut.Bool(feeSched.IsHidden) + " "
                             + "WHERE FeeSchedNum = " + POut.Long(feeSched.FeeSchedNum);

            Db.NonQ(command);
        }
コード例 #16
0
        private void FormDiscountPlanEdit_Load(object sender, EventArgs e)
        {
            textDescript.Text = DiscountPlanCur.Description;
            _listPatNames     = DiscountPlans.GetPatsForPlan(DiscountPlanCur.DiscountPlanNum)
                                .Select(x => x.LName + ", " + x.FName)
                                .Distinct()
                                .OrderBy(x => x)
                                .ToList();
            _feeSchedCur      = FeeScheds.GetFirstOrDefault(x => x.FeeSchedNum == DiscountPlanCur.FeeSchedNum, true);
            textFeeSched.Text = _feeSchedCur != null ? _feeSchedCur.Description : "";
            _listAdjTypeDefs  = Defs.GetDiscountPlanAdjTypes().ToList();
            for (int i = 0; i < _listAdjTypeDefs.Count; i++)
            {
                comboBoxAdjType.Items.Add(_listAdjTypeDefs[i].ItemName);
                if (_listAdjTypeDefs[i].DefNum == DiscountPlanCur.DefNum)
                {
                    comboBoxAdjType.SelectedIndex = i;
                }
            }
            //populate patient information
            int countPats = _listPatNames.Count;

            textNumPatients.Text = countPats.ToString();
            if (countPats > 10000)           //10,000 per Nathan. copied from FormInsPlan.cs
            {
                comboPatient.Visible     = false;
                butListPatients.Visible  = true;
                butListPatients.Location = comboPatient.Location;
            }
            else
            {
                comboPatient.Visible    = true;
                butListPatients.Visible = false;
                comboPatient.Items.Clear();
                comboPatient.Items.AddRange(_listPatNames.ToArray());
                if (_listPatNames.Count > 0)
                {
                    comboPatient.SelectedIndex = 0;
                }
            }
            checkHidden.Checked = DiscountPlanCur.IsHidden;
            if (!Security.IsAuthorized(Permissions.InsPlanEdit, true))            //User may be able to get here if FormDiscountPlans is not in selection mode.
            {
                textDescript.ReadOnly   = true;
                comboBoxAdjType.Enabled = false;
                butFeeSched.Enabled     = false;
                butOK.Enabled           = false;
                checkHidden.Enabled     = false;
            }
            if (IsSelectionMode)
            {
                butDrop.Visible = true;
            }
        }
コード例 #17
0
        private void butFeeSched_Click(object sender, EventArgs e)
        {
            //No need to check security because we are launching the form in selection mode.
            FormFeeScheds FormFS = new FormFeeScheds(true);

            FormFS.SelectedFeeSchedNum = (_feeSchedCur == null ? 0 : _feeSchedCur.FeeSchedNum);
            if (FormFS.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            _feeSchedCur      = FeeScheds.GetFirstOrDefault(x => x.FeeSchedNum == FormFS.SelectedFeeSchedNum, true); //Hidden FeeSched are invalid selections.
            textFeeSched.Text = (_feeSchedCur?.Description ?? "");                                                   //Null check on OK click will force the user to make a FeeSched selection if null.
        }
コード例 #18
0
ファイル: FormFeeEdit.cs プロジェクト: ChemBrain/OpenDental
        private void FormFeeEdit_Load(object sender, System.EventArgs e)
        {
            FeeSched feeSched = FeeScheds.GetFirstOrDefault(x => x.FeeSchedNum == FeeCur.FeeSched);

            if (!FeeL.CanEditFee(feeSched, FeeCur.ProvNum, FeeCur.ClinicNum))
            {
                DialogResult = DialogResult.Cancel;
                Close();
                return;
            }
            Location     = new Point(Location.X - 190, Location.Y - 20);
            textFee.Text = FeeCur.Amount.ToString("F");
        }
コード例 #19
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            ReportComplex report    = new ReportComplex(true, true);
            FeeSched      feeSched  = _listFeeScheds[listBoxFeeSched.SelectedIndex];
            long          clinicNum = 0;

            if (listBoxClinics.SelectedIndex > 0)
            {
                clinicNum = _listClinics[listBoxClinics.SelectedIndex - 1].ClinicNum;
            }
            long provNum = 0;

            if (listBoxProviders.SelectedIndex > 0)
            {
                provNum = _listProviders[listBoxProviders.SelectedIndex - 1].ProvNum;
            }
            DataTable dataTable = RpProcCodes.GetData(feeSched.FeeSchedNum, clinicNum, provNum, radioCategories.Checked, checkShowBlankFees.Checked);

            report.ReportName = "Procedure Codes - Fee Schedules";
            report.AddTitle("Title", Lan.g(this, "Procedure Codes - Fee Schedules"));
            report.AddSubTitle("Fee Schedule", feeSched.Description);
            report.AddSubTitle("Clinic", listBoxClinics.Items[listBoxClinics.SelectedIndex].ToString());
            report.AddSubTitle("Provider", listBoxProviders.Items[listBoxProviders.SelectedIndex].ToString());
            report.AddSubTitle("Date", DateTime.Now.ToShortDateString());
            QueryObject queryObject = new QueryObject();

            queryObject = report.AddQuery(dataTable, "", "", SplitByKind.None, 1, true);
            if (radioCategories.Checked)
            {
                queryObject.AddColumn("Category", 100, FieldValueType.String);
                queryObject.GetColumnDetail("Category").SuppressIfDuplicate = true;
            }
            queryObject.AddColumn("Code", 100, FieldValueType.String);
            queryObject.AddColumn("Desc", 600, FieldValueType.String);
            queryObject.AddColumn("Abbr", 100, FieldValueType.String);
            queryObject.AddColumn("Fee", 100, FieldValueType.String);
            queryObject.GetColumnDetail("Fee").ContentAlignment = ContentAlignment.MiddleRight;
            queryObject.GetColumnDetail("Fee").StringFormat     = "C";       //This isn't working...
            report.AddPageNum();
            // execute query
            if (!report.SubmitQueries())
            {
                return;
            }
            // display report
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
コード例 #20
0
ファイル: EcwSegmentPID.cs プロジェクト: steev90/opendental
        /// <summary>Will return 0 if string cannot be parsed to a number.  Will return 0 if the fee schedule passed in does not exactly match the description of a regular fee schedule.</summary>
        public static long FeeScheduleParse(string str)
        {
            if (str == "")
            {
                return(0);
            }
            FeeSched feeSched = FeeScheds.GetByExactName(str, FeeScheduleType.Normal);

            if (feeSched == null)
            {
                return(0);
            }
            return(feeSched.FeeSchedNum);
        }
コード例 #21
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<FeeSched> TableToList(DataTable table){
			List<FeeSched> retVal=new List<FeeSched>();
			FeeSched feeSched;
			for(int i=0;i<table.Rows.Count;i++) {
				feeSched=new FeeSched();
				feeSched.FeeSchedNum = PIn.Long  (table.Rows[i]["FeeSchedNum"].ToString());
				feeSched.Description = PIn.String(table.Rows[i]["Description"].ToString());
				feeSched.FeeSchedType= (FeeScheduleType)PIn.Int(table.Rows[i]["FeeSchedType"].ToString());
				feeSched.ItemOrder   = PIn.Int   (table.Rows[i]["ItemOrder"].ToString());
				feeSched.IsHidden    = PIn.Bool  (table.Rows[i]["IsHidden"].ToString());
				retVal.Add(feeSched);
			}
			return retVal;
		}
コード例 #22
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedGridRows.Count == 0)
            {
                MsgBox.Show(this, "Please select a fee schedule to import fees into.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "If you want a clean slate, the current fee schedule should be cleared first.  "
                             + "When imported, any fees found in the text file will overwrite values of the selected fee schedule.  Are you sure you want to continue?"))
            {
                return;
            }
            // Set up general base fee schedules with no provider or clinic
            long provNum   = 0;
            long clinicNum = 0;

            Cursor = Cursors.WaitCursor;
            OpenFileDialog Dlg = new OpenFileDialog();

            if (Directory.Exists(PrefC.GetString(PrefName.ExportPath)))
            {
                Dlg.InitialDirectory = PrefC.GetString(PrefName.ExportPath);
            }
            else if (Directory.Exists("C:\\"))
            {
                Dlg.InitialDirectory = "C:\\";
            }
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            if (!File.Exists(Dlg.FileName))
            {
                MsgBox.Show(this, "File not found");
                Cursor = Cursors.Default;
                return;
            }
            FeeSched feeSched = ((FeeSched)gridMain.SelectedGridRows[0].Tag);          //get selected fee sched from grid.

            try {
                FeeL.ImportFees(Dlg.FileName, feeSched.FeeSchedNum, clinicNum, provNum);
                _isChanged = true;
            }
            catch (Exception ex) {
                FriendlyException.Show("Error importing fees.", ex);
            }
            Cursor = Cursors.Default;
        }
コード例 #23
0
ファイル: FeeSchedCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Inserts one FeeSched into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(FeeSched feeSched)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(feeSched, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             feeSched.FeeSchedNum = DbHelper.GetNextOracleKey("feesched", "FeeSchedNum");                  //Cacheless method
         }
         return(InsertNoCache(feeSched, true));
     }
 }
コード例 #24
0
ファイル: FeeSchedCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Updates one FeeSched in the database.</summary>
        public static void Update(FeeSched feeSched)
        {
            string command = "UPDATE feesched SET "
                             + "Description    = '" + POut.String(feeSched.Description) + "', "
                             + "FeeSchedType   =  " + POut.Int((int)feeSched.FeeSchedType) + ", "
                             + "ItemOrder      =  " + POut.Int(feeSched.ItemOrder) + ", "
                             + "IsHidden       =  " + POut.Bool(feeSched.IsHidden) + ", "
                             + "IsGlobal       =  " + POut.Bool(feeSched.IsGlobal) + " "
                             //SecUserNumEntry excluded from update
                             //SecDateEntry not allowed to change
                             //SecDateTEdit can only be set by MySQL
                             + "WHERE FeeSchedNum = " + POut.Long(feeSched.FeeSchedNum);

            Db.NonQ(command);
        }
コード例 #25
0
        public void FeeSchedTools_CopyFeeSched()
        {
            //Create two fee schedules; from and to
            FeeSched fromFeeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM");
            FeeSched toFeeSched   = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO");
            //Create a single fee and associate it to the "from" fee schedule.
            long feeCodeNum = _listProcCodes[_rand.Next(_listProcCodes.Count - 1)].CodeNum;

            FeeT.CreateFee(fromFeeSched.FeeSchedNum, feeCodeNum, _defaultFeeAmt * _rand.NextDouble());
            FeeScheds.CopyFeeSchedule(fromFeeSched, 0, 0, toFeeSched, null, 0);
            //Get the two fees and check that they are the same.
            Fee fromFee = Fees.GetFee(feeCodeNum, fromFeeSched.FeeSchedNum, 0, 0);
            Fee toFee   = Fees.GetFee(feeCodeNum, toFeeSched.FeeSchedNum, 0, 0);

            Assert.AreEqual(fromFee.Amount, toFee.Amount);
        }
コード例 #26
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <FeeSched> TableToList(DataTable table)
        {
            List <FeeSched> retVal = new List <FeeSched>();
            FeeSched        feeSched;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                feeSched              = new FeeSched();
                feeSched.FeeSchedNum  = PIn.Long(table.Rows[i]["FeeSchedNum"].ToString());
                feeSched.Description  = PIn.String(table.Rows[i]["Description"].ToString());
                feeSched.FeeSchedType = (FeeScheduleType)PIn.Int(table.Rows[i]["FeeSchedType"].ToString());
                feeSched.ItemOrder    = PIn.Int(table.Rows[i]["ItemOrder"].ToString());
                feeSched.IsHidden     = PIn.Bool(table.Rows[i]["IsHidden"].ToString());
                retVal.Add(feeSched);
            }
            return(retVal);
        }
コード例 #27
0
        ///<summary>Updates one FeeSched in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        public static void Update(FeeSched feeSched, FeeSched oldFeeSched)
        {
            string command = "";

            if (feeSched.Description != oldFeeSched.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(feeSched.Description) + "'";
            }
            if (feeSched.FeeSchedType != oldFeeSched.FeeSchedType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSchedType = " + POut.Int((int)feeSched.FeeSchedType) + "";
            }
            if (feeSched.ItemOrder != oldFeeSched.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(feeSched.ItemOrder) + "";
            }
            if (feeSched.IsHidden != oldFeeSched.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(feeSched.IsHidden) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE feesched SET " + command
                      + " WHERE FeeSchedNum = " + POut.Long(feeSched.FeeSchedNum);
            Db.NonQ(command);
        }
コード例 #28
0
        public void Fees_GetByFeeSchedNumsClinicNums_MiddleTier()
        {
            List <long> listFeeSchedNums = new List <long>();
            long        codeNum1         = ProcedureCodes.GetCodeNum("D1110");
            long        codeNum2         = ProcedureCodes.GetCodeNum("D1206");

            for (int i = 0; i < 300; i++)
            {
                FeeSched feeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, "FS" + i);
                FeeT.GetNewFee(feeSched.FeeSchedNum, codeNum1, 11);
                FeeT.GetNewFee(feeSched.FeeSchedNum, codeNum2, 13);
                listFeeSchedNums.Add(feeSched.FeeSchedNum);
            }
            DataAction.RunMiddleTierMock(() => {
                List <FeeLim> listFees = Fees.GetByFeeSchedNumsClinicNums(listFeeSchedNums, new List <long> {
                    0
                });
                Assert.AreEqual(600, listFees.Count);
            });
        }
コード例 #29
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 long ImportTrojan(string procCode, double amt, string feeSchedName)
        {
            FeeSched feeSched = FeeScheds.GetByExactName(feeSchedName);

            //if isManaged, then this should be done differently from here on out.
            if (feeSched == null)
            {
                //add the new fee schedule
                feeSched              = new FeeSched();
                feeSched.ItemOrder    = FeeSchedC.ListLong.Count;
                feeSched.Description  = feeSchedName;
                feeSched.FeeSchedType = FeeScheduleType.Normal;
                //feeSched.IsNew=true;
                FeeScheds.Insert(feeSched);
                //Cache.Refresh(InvalidType.FeeScheds);
                //Fees.Refresh();
                DataValid.SetInvalid(InvalidType.FeeScheds, InvalidType.Fees);
            }
            if (feeSched.IsHidden)
            {
                feeSched.IsHidden = false;              //unhide it
                FeeScheds.Update(feeSched);
                DataValid.SetInvalid(InvalidType.FeeScheds);
            }
            Fee fee = Fees.GetFee(ProcedureCodes.GetCodeNum(procCode), feeSched.FeeSchedNum);

            if (fee == null)
            {
                fee          = new Fee();
                fee.Amount   = amt;
                fee.FeeSched = feeSched.FeeSchedNum;
                fee.CodeNum  = ProcedureCodes.GetCodeNum(procCode);
                Fees.Insert(fee);
            }
            else
            {
                fee.Amount = amt;
                Fees.Update(fee);
            }
            return(feeSched.FeeSchedNum);
        }
コード例 #30
0
ファイル: FeeSchedCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <FeeSched> TableToList(DataTable table)
        {
            List <FeeSched> retVal = new List <FeeSched>();
            FeeSched        feeSched;

            foreach (DataRow row in table.Rows)
            {
                feeSched                 = new FeeSched();
                feeSched.FeeSchedNum     = PIn.Long(row["FeeSchedNum"].ToString());
                feeSched.Description     = PIn.String(row["Description"].ToString());
                feeSched.FeeSchedType    = (OpenDentBusiness.FeeScheduleType)PIn.Int(row["FeeSchedType"].ToString());
                feeSched.ItemOrder       = PIn.Int(row["ItemOrder"].ToString());
                feeSched.IsHidden        = PIn.Bool(row["IsHidden"].ToString());
                feeSched.IsGlobal        = PIn.Bool(row["IsGlobal"].ToString());
                feeSched.SecUserNumEntry = PIn.Long(row["SecUserNumEntry"].ToString());
                feeSched.SecDateEntry    = PIn.Date(row["SecDateEntry"].ToString());
                feeSched.SecDateTEdit    = PIn.DateT(row["SecDateTEdit"].ToString());
                retVal.Add(feeSched);
            }
            return(retVal);
        }
コード例 #31
0
ファイル: FormFeeScheds.cs プロジェクト: steev90/opendental
 ///<summary>This sorts feescheds by type and alphabetically.</summary>
 private static int CompareFeeScheds(FeeSched feeSched1, FeeSched feeSched2)
 {
     if (feeSched1 == null)
     {
         if (feeSched2 == null)
         {
             return(0);                   //both null, so equal
         }
         else
         {
             return(-1);
         }
     }
     if (feeSched2 == null)
     {
         return(1);
     }
     if (feeSched1.FeeSchedType != feeSched2.FeeSchedType)
     {
         return(feeSched1.FeeSchedType.CompareTo(feeSched2.FeeSchedType));
     }
     return(feeSched1.Description.CompareTo(feeSched2.Description));
 }
コード例 #32
0
ファイル: FeeSchedCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Inserts one FeeSched into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(FeeSched feeSched, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO feesched (";

            if (!useExistingPK && isRandomKeys)
            {
                feeSched.FeeSchedNum = ReplicationServers.GetKeyNoCache("feesched", "FeeSchedNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "FeeSchedNum,";
            }
            command += "Description,FeeSchedType,ItemOrder,IsHidden,IsGlobal,SecUserNumEntry,SecDateEntry) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(feeSched.FeeSchedNum) + ",";
            }
            command +=
                "'" + POut.String(feeSched.Description) + "',"
                + POut.Int((int)feeSched.FeeSchedType) + ","
                + POut.Int(feeSched.ItemOrder) + ","
                + POut.Bool(feeSched.IsHidden) + ","
                + POut.Bool(feeSched.IsGlobal) + ","
                + POut.Long(feeSched.SecUserNumEntry) + ","
                + DbHelper.Now() + ")";
            //SecDateTEdit can only be set by MySQL
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                feeSched.FeeSchedNum = Db.NonQ(command, true, "FeeSchedNum", "feeSched");
            }
            return(feeSched.FeeSchedNum);
        }
コード例 #33
0
ファイル: FormFeeScheds.cs プロジェクト: ChemBrain/OpenDental
 ///<summary>This sorts feescheds by their item order.</summary>
 private static int CompareItemOrder(FeeSched feeSched1, FeeSched feeSched2)
 {
     return(feeSched1.ItemOrder.CompareTo(feeSched2.ItemOrder));
 }
コード例 #34
0
ファイル: FeeSchedCrud.cs プロジェクト: nampn/ODental
 ///<summary>Updates one FeeSched in the database.</summary>
 internal static void Update(FeeSched feeSched)
 {
     string command="UPDATE feesched SET "
         +"Description = '"+POut.String(feeSched.Description)+"', "
         +"FeeSchedType=  "+POut.Int   ((int)feeSched.FeeSchedType)+", "
         +"ItemOrder   =  "+POut.Int   (feeSched.ItemOrder)+", "
         +"IsHidden    =  "+POut.Bool  (feeSched.IsHidden)+" "
         +"WHERE FeeSchedNum = "+POut.Long(feeSched.FeeSchedNum);
     Db.NonQ(command);
 }
コード例 #35
0
ファイル: FeeSchedCrud.cs プロジェクト: nampn/ODental
 ///<summary>Updates one FeeSched in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(FeeSched feeSched,FeeSched oldFeeSched)
 {
     string command="";
     if(feeSched.Description != oldFeeSched.Description) {
         if(command!=""){ command+=",";}
         command+="Description = '"+POut.String(feeSched.Description)+"'";
     }
     if(feeSched.FeeSchedType != oldFeeSched.FeeSchedType) {
         if(command!=""){ command+=",";}
         command+="FeeSchedType = "+POut.Int   ((int)feeSched.FeeSchedType)+"";
     }
     if(feeSched.ItemOrder != oldFeeSched.ItemOrder) {
         if(command!=""){ command+=",";}
         command+="ItemOrder = "+POut.Int(feeSched.ItemOrder)+"";
     }
     if(feeSched.IsHidden != oldFeeSched.IsHidden) {
         if(command!=""){ command+=",";}
         command+="IsHidden = "+POut.Bool(feeSched.IsHidden)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE feesched SET "+command
         +" WHERE FeeSchedNum = "+POut.Long(feeSched.FeeSchedNum);
     Db.NonQ(command);
 }