Пример #1
0
		///<summary></summary>
		public static void Update(RepeatCharge charge){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),charge);
				return;
			}
			Crud.RepeatChargeCrud.Update(charge);
		}
Пример #2
0
		///<summary></summary>
		public static long Insert(RepeatCharge charge) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				charge.RepeatChargeNum=Meth.GetLong(MethodBase.GetCurrentMethod(),charge);
				return charge.RepeatChargeNum;
			}
			return Crud.RepeatChargeCrud.Insert(charge);
		}
Пример #3
0
 ///<summary></summary>
 public FormRepeatChargeEdit(RepeatCharge repeatCur)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     Lan.F(this);
     RepeatCur=repeatCur;
 }
Пример #4
0
 ///<summary>Called from FormRepeatCharge.</summary>
 public static void Delete(RepeatCharge charge)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
         Meth.GetVoid(MethodBase.GetCurrentMethod(),charge);
         return;
     }
     string command="DELETE FROM repeatcharge WHERE RepeatChargeNum ="+POut.Long(charge.RepeatChargeNum);
     Db.NonQ(command);
 }
Пример #5
0
 ///<summary></summary>
 public RepeatCharge Copy()
 {
     RepeatCharge r=new RepeatCharge();
     r.RepeatChargeNum=RepeatChargeNum;
     r.PatNum=PatNum;
     r.ProcCode=ProcCode;
     r.ChargeAmt=ChargeAmt;
     r.DateStart=DateStart;
     r.DateStop=DateStop;
     r.Note=Note;
     return r;
 }
Пример #6
0
        private static Procedure AddRepeatingChargeHelper(RepeatCharge repeatCharge, DateTime billingDate, DateTime dateNow)
        {
            //No remoting role check; no call to db
            Procedure     procedure = new Procedure();
            ProcedureCode procCode  = ProcedureCodes.GetProcCode(repeatCharge.ProcCode);
            Patient       pat       = Patients.GetPat(repeatCharge.PatNum);

            procedure.CodeNum    = procCode.CodeNum;
            procedure.ClinicNum  = pat.ClinicNum;
            procedure.DateEntryC = dateNow;
            procedure.PatNum     = repeatCharge.PatNum;
            procedure.ProcDate   = billingDate;
            procedure.DateTP     = billingDate;
            procedure.ProcFee    = repeatCharge.ChargeAmt;
            procedure.ProcStatus = ProcStat.C;
            if (procCode.ProvNumDefault == 0)
            {
                procedure.ProvNum = pat.PriProv;
            }
            else
            {
                procedure.ProvNum = procCode.ProvNumDefault;
            }
            procedure.MedicalCode     = ProcedureCodes.GetProcCode(procedure.CodeNum).MedicalCode;
            procedure.BaseUnits       = ProcedureCodes.GetProcCode(procedure.CodeNum).BaseUnits;
            procedure.DiagnosticCode  = PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
            procedure.RepeatChargeNum = repeatCharge.RepeatChargeNum;
            procedure.PlaceService    = (PlaceOfService)PrefC.GetInt(PrefName.DefaultProcedurePlaceService);       //Default Proc Place of Service for the Practice is used.
            //Check if the repeating charge has been flagged to copy it's note into the billing note of the procedure.
            if (repeatCharge.CopyNoteToProc)
            {
                procedure.BillingNote = repeatCharge.Note;
                if (repeatCharge.ErxAccountId != "")
                {
                    procedure.BillingNote =
                        "NPI=" + repeatCharge.Npi + "  " + "ErxAccountId=" + repeatCharge.ErxAccountId;
                    if (!string.IsNullOrEmpty(repeatCharge.ProviderName))                     //Provider name would be empty if older and no longer updated from eRx.
                    {
                        procedure.BillingNote += "\r\nProviderName=" + repeatCharge.ProviderName;
                    }
                    if (!string.IsNullOrEmpty(repeatCharge.Note))
                    {
                        procedure.BillingNote += "\r\n" + repeatCharge.Note;
                    }
                }
            }
            if (!PrefC.GetBool(PrefName.EasyHidePublicHealth))
            {
                procedure.SiteNum = pat.SiteNum;
            }
            Procedures.Insert(procedure);             //no recall synch needed because dental offices don't use this feature
            //Using Prepayments for this Procedure
            if (repeatCharge.UsePrepay)
            {
                //NOTE: ProvNum=0 on these splits, so I'm pretty sure they aren't allocated to anything.
                List <PaySplit> prePaySplits             = PaySplits.GetPrepayForFam(Patients.GetFamily(repeatCharge.PatNum));
                List <PaySplit> paySplitsForPrePaySplits = PaySplits.GetSplitsForPrepay(prePaySplits);
                Payment         payCur = new Payment();
                payCur.ClinicNum = procedure.ClinicNum;
                payCur.DateEntry = billingDate;
                payCur.IsSplit   = true;
                payCur.PatNum    = repeatCharge.PatNum;
                payCur.PayDate   = billingDate;
                payCur.PayType   = 0;           //Income transfer (will always be income transfer)
                payCur.PayAmt    = 0;           //Income transfer payment
                payCur.PayNum    = Payments.Insert(payCur);
                decimal payAmt   = 0;
                string  noteText = "";
                foreach (PaySplit prePaySplit in prePaySplits)
                {
                    prePaySplit.SplitAmt += paySplitsForPrePaySplits.Where(x => x.FSplitNum == prePaySplit.SplitNum).Sum(y => y.SplitAmt);                //Reduce prepay split amount.
                    PaySplit split  = new PaySplit();
                    PaySplit split2 = new PaySplit();
                    if (prePaySplit.SplitAmt > procedure.ProcFee - (double)payAmt)
                    {
                        //Split amount is more than the remainder of the procfee requires, use partial from split
                        split.SplitAmt  = procedure.ProcFee - (double)payAmt;
                        split2.SplitAmt = 0 - (procedure.ProcFee - (double)payAmt);
                        payAmt          = (decimal)procedure.ProcFee;
                    }
                    else
                    {
                        //Split amount is less than or equal to the remainder of the procfee
                        split.SplitAmt  = prePaySplit.SplitAmt;
                        split2.SplitAmt = 0 - prePaySplit.SplitAmt;
                        payAmt         += (decimal)prePaySplit.SplitAmt;
                    }
                    if (split.SplitAmt == 0)
                    {
                        continue;                        //Don't make splits for 0 amount.
                    }
                    //Positive split, attached to proc and for proc's prov and clinic
                    split.DateEntry = billingDate;
                    split.DatePay   = billingDate;
                    split.PatNum    = procedure.PatNum;
                    split.PayNum    = payCur.PayNum;
                    split.ProcNum   = procedure.ProcNum;
                    split.ProvNum   = procedure.ProvNum;
                    split.ClinicNum = procedure.ClinicNum;
                    if (noteText != "")
                    {
                        noteText += ", ";
                    }
                    noteText += split.SplitAmt.ToString("c");
                    PaySplits.Insert(split);
                    //Negative split, attached to prepay's prov and clinic, but not proc
                    split2.DateEntry = billingDate;
                    split2.DatePay   = billingDate;
                    split2.PatNum    = procedure.PatNum;
                    split2.PayNum    = payCur.PayNum;
                    split2.FSplitNum = prePaySplit.SplitNum;
                    split2.ProvNum   = prePaySplit.ProvNum;
                    split2.ClinicNum = prePaySplit.ClinicNum;
                    PaySplits.Insert(split2);
                    if (payAmt >= (decimal)procedure.ProcFee)
                    {
                        //Break out of loop
                        break;
                    }
                }
                payCur.PayNote = "Allocated " + noteText + " prepayments to repeating charge.";
                Payments.Update(payCur, false);
            }
            return(procedure);
        }
Пример #7
0
		private void menuItemRepeatCanada_Click(object sender,EventArgs e) {
			if(!ProcedureCodeC.HList.ContainsKey("001")) {
				return;
			}
			RepeatCharge repeat=new RepeatCharge();
			repeat.PatNum=PatCur.PatNum;
			repeat.ProcCode="001";
			repeat.ChargeAmt=129;
			repeat.DateStart=DateTimeOD.Today;
			repeat.DateStop=DateTimeOD.Today.AddMonths(11);
			repeat.IsEnabled=true;
			RepeatCharges.Insert(repeat);
			repeat=new RepeatCharge();
			repeat.PatNum=PatCur.PatNum;
			repeat.ProcCode="001";
			repeat.ChargeAmt=99;
			repeat.DateStart=DateTimeOD.Today.AddYears(1);
			repeat.IsEnabled=true;
			RepeatCharges.Insert(repeat);
			ModuleSelected(PatCur.PatNum);
		}
Пример #8
0
		private void menuItemRepeatMobile_Click(object sender,EventArgs e) {
			if(!ProcedureCodeC.HList.ContainsKey("027")) {
				return;
			}
			RepeatCharge repeat=new RepeatCharge();
			repeat.PatNum=PatCur.PatNum;
			repeat.ProcCode="027";
			repeat.ChargeAmt=10;
			repeat.DateStart=DateTimeOD.Today;
			repeat.IsEnabled=true;
			RepeatCharges.Insert(repeat);
			ModuleSelected(PatCur.PatNum);
		}
Пример #9
0
		private void toolBarButRepeatCharge_Click(){
			RepeatCharge repeat=new RepeatCharge();
			repeat.PatNum=PatCur.PatNum;
			repeat.DateStart=DateTime.Today;
			FormRepeatChargeEdit FormR=new FormRepeatChargeEdit(repeat);
			FormR.IsNew=true;
			FormR.ShowDialog();
			ModuleSelected(PatCur.PatNum);
		}
Пример #10
0
		private void butProcess_Click(object sender,EventArgs e) {
			if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"This will add a new repeating charge for each provider in the list above"
				+" who is new (does not already have a repeating charge), based on PatNum and NPI.  Continue?")) {
				return;
			}
			Cursor=Cursors.WaitCursor;
			int numChargesAdded=0;
			int numSkipped=0;
			for(int i=0;i<gridBillingList.Rows.Count;i++) {
				long patNum=PIn.Long(gridBillingList.Rows[i].Cells[0].Text);
				string npi=PIn.String(gridBillingList.Rows[i].Cells[1].Text);
				string billingType=gridBillingList.Rows[i].Cells[3].Text;
				List<RepeatCharge> repeatChargesNewCrop=RepeatCharges.GetForNewCrop(patNum);
				RepeatCharge repeatCur=GetRepeatChargeForNPI(repeatChargesNewCrop,npi);
				if(repeatCur==null) {//No such repeating charge exists yet for the given npi.
					//We consider the provider a new provider and create a new repeating charge.
					string yearMonth=gridBillingList.Rows[i].Cells[2].Text;
					int yearBilling=PIn.Int(yearMonth.Substring(0,4));//The year chosen by the OD employee when running the NewCrop Billing report.
					int monthBilling=PIn.Int(yearMonth.Substring(4));//The month chosen by the OD employee when running the NewCrop Billing report.
					int dayOtherCharges=GetChargeDayOfMonth(patNum);//The day of the month that the customer already has other repeating charges. Keeps their billing simple (one bill per month for all charges).
					DateTime dateNewCropCharge=new DateTime(yearBilling,monthBilling,dayOtherCharges);
					if(dateNewCropCharge<DateTime.Today.AddMonths(-3)) {//Just in case the user runs an older report.
						numSkipped++;
						continue;
					}
					repeatCur=new RepeatCharge();
					repeatCur.IsNew=true;
					repeatCur.PatNum=patNum;
					repeatCur.ProcCode=GetProcCodeForNewCharge(repeatChargesNewCrop);
					repeatCur.ChargeAmt=15;//15$/month
					repeatCur.DateStart=dateNewCropCharge;
					repeatCur.Note="NPI="+npi;
					repeatCur.IsEnabled=true;
					RepeatCharges.Insert(repeatCur);
					numChargesAdded++;
				}
				else { //The repeating charge for NewCrop billing already exists for the given npi.
					DateTime dateEndLastMonth=(new DateTime(DateTime.Today.Year,DateTime.Today.Month,1)).AddDays(-1);
					if(billingType=="B" || billingType=="N") {//The provider sent eRx last month.
						if(repeatCur.DateStop.Year>2010) {//NewCrop support for this provider was disabled at one point, but has been used since.
							if(repeatCur.DateStop<dateEndLastMonth) {//If the stop date is in the future or already at the end of the month, then we cannot presume that there will be a charge next month.
								repeatCur.DateStop=dateEndLastMonth;//Make sure the recent use is reflected in the end date.
								RepeatCharges.Update(repeatCur);
							}
						}
					}
					else if(billingType=="U") {//The provider did not send eRx last month, but did send eRx two months ago.
						//Customers must call in to disable repeating charges, they are not disabled automatically.
					}
					else {
						throw new Exception("Unknown NewCrop Billing type "+billingType);
					}
				}
			}
			FillGrid();
			Cursor=Cursors.Default;
			string msg="Done. Number of provider charges added: "+numChargesAdded;
			if(numSkipped>0) {
				msg+=Environment.NewLine+"Number skipped due to old DateBilling (over 3 months ago): "+numSkipped;
			}
			MessageBox.Show(msg);
		}
Пример #11
0
		private void butProcess_Click(object sender,EventArgs e) {
			if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"This will add a new repeating charge for each provider in the list above"
				+" who is new (does not already have a repeating charge), based on PatNum and NPI.  Continue?")) {
				return;
			}
			Cursor=Cursors.WaitCursor;
			int numChargesAdded=0;
			int numSkipped=0;
			for(int i=0;i<gridBillingList.Rows.Count;i++) {
				long patNum=PIn.Long(gridBillingList.Rows[i].Cells[0].Text);
				string npi=PIn.String(gridBillingList.Rows[i].Cells[1].Text);
				string billingType=gridBillingList.Rows[i].Cells[3].Text;
				List<RepeatCharge> listErxRepeatCharges=RepeatCharges.GetForErx(patNum);
				RepeatCharge repeatCur=GetRepeatChargeForNPI(listErxRepeatCharges,npi);
				if(repeatCur==null) {//No such repeating charge exists yet for the given npi.
					if(gridBillingList.Rows[i].Cells[4].Text!="X") {
						continue;//Only create a charge for rows marked new.
					}
					//We consider the provider a new provider and create a new repeating charge.
					string yearMonth=gridBillingList.Rows[i].Cells[2].Text;
					int yearBilling=PIn.Int(yearMonth.Substring(0,4));//The year chosen by the OD employee when running the eRx Billing report.
					int monthBilling=PIn.Int(yearMonth.Substring(4));//The month chosen by the OD employee when running the eRx Billing report.
					int dayOtherCharges=GetChargeDayOfMonth(patNum);//The day of the month that the customer already has other repeating charges. Keeps their billing simple (one bill per month for all charges).
					int daysInMonth=DateTime.DaysInMonth(yearBilling,monthBilling);
					if(dayOtherCharges>daysInMonth) {
						//The day that the user used eRx (signed up) was in a month that does not have the day of the other monthly charges in it.
						//E.g.  dayOtherCharges = 31 and the user started a new eRx account in a month without 31 days.
						//Therefore, we have to use the last day of the month that they started.
						//This can introduce multiple statements being sent out which can potentially delay us (HQ) from getting paid in a timely fashion.
						//A workaround for this would be to train our techs to never run billing after the 28th of every month that way incomplete statements are not sent.
						dayOtherCharges=daysInMonth;
					}
					DateTime dateErxCharge=new DateTime(yearBilling,monthBilling,dayOtherCharges);
					if(dateErxCharge<DateTime.Today.AddMonths(-3)) {//Just in case the user runs an older report.
						numSkipped++;
						continue;
					}
					repeatCur=new RepeatCharge();
					repeatCur.IsNew=true;
					repeatCur.PatNum=patNum;
					repeatCur.ProcCode=GetProcCodeForNewCharge(listErxRepeatCharges);
					repeatCur.ChargeAmt=15;//15$/month
					repeatCur.DateStart=dateErxCharge;
					repeatCur.Note="NPI="+npi;
					repeatCur.IsEnabled=true;
					repeatCur.CopyNoteToProc=true;//Copy the billing note to the procedure note by default so that the customer can see the NPI the charge corresponds to. Can be unchecked by user if a private note is added later (rare).
					RepeatCharges.Insert(repeatCur);
					numChargesAdded++;
				}
				else { //The repeating charge for eRx billing already exists for the given npi.
					DateTime dateEndLastMonth=(new DateTime(DateTime.Today.Year,DateTime.Today.Month,1)).AddDays(-1);
					if(billingType=="B" || billingType=="N") {//The provider sent eRx last month.
						if(repeatCur.DateStop.Year>2010) {//eRx support for this provider was disabled at one point, but has been used since.
							if(repeatCur.DateStop<dateEndLastMonth) {//If the stop date is in the future or already at the end of the month, then we cannot presume that there will be a charge next month.
								repeatCur.DateStop=dateEndLastMonth;//Make sure the recent use is reflected in the end date.
								RepeatCharges.Update(repeatCur);
							}
						}
					}
					else if(billingType=="U") {//The provider did not send eRx last month, but did send eRx two months ago.
						//Customers must call in to disable repeating charges, they are not disabled automatically.
					}
					else {
						throw new Exception("Unknown eRx Billing type "+billingType);
					}
				}
			}
			FillGrid();
			Cursor=Cursors.Default;
			string msg="Done. Number of provider charges added: "+numChargesAdded;
			if(numSkipped>0) {
				msg+=Environment.NewLine+"Number skipped due to old DateBilling (over 3 months ago): "+numSkipped;
			}
			MessageBox.Show(msg);
		}
Пример #12
0
 private void MenuItemRepeatEmail_Click(object sender,System.EventArgs e)
 {
     if(!ProcedureCodeC.HList.ContainsKey("008")) {
         return;
     }
     RepeatCharge repeat=new RepeatCharge();
     repeat.PatNum=PatCur.PatNum;
     repeat.ProcCode="008";
     repeat.ChargeAmt=89;
     repeat.DateStart=DateTime.Today;
     RepeatCharges.Insert(repeat);
     ModuleSelected(PatCur.PatNum);
 }