///<summary>Surround by try catch, because it will throw an exception if trying to delete a claimpayment attached to a deposit or if there are eobs attached.</summary> public static void Delete(ClaimPayment cp) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),cp); return; } //validate deposits string command="SELECT DepositNum FROM claimpayment " +"WHERE ClaimPaymentNum="+POut.Long(cp.ClaimPaymentNum); DataTable table=Db.GetTable(command); if(table.Rows.Count==0){ return; } if(table.Rows[0][0].ToString()!="0"){//if claimpayment is already attached to a deposit #if !DEBUG throw new ApplicationException(Lans.g("ClaimPayments","Not allowed to delete a payment attached to a deposit.")); #endif } //validate eobs command="SELECT COUNT(*) FROM eobattach WHERE ClaimPaymentNum="+POut.Long(cp.ClaimPaymentNum); if(Db.GetScalar(command)!="0") { throw new ApplicationException(Lans.g("ClaimPayments","Not allowed to delete this payment because EOBs are attached.")); } command= "UPDATE claimproc SET " +"ClaimPaymentNum=0 " +"WHERE claimpaymentNum="+POut.Long(cp.ClaimPaymentNum); //MessageBox.Show(string command); Db.NonQ(command); command= "DELETE FROM claimpayment " +"WHERE ClaimPaymentnum ="+POut.Long(cp.ClaimPaymentNum); //MessageBox.Show(string command); Db.NonQ(command); }
private void butRun_Click(object sender,EventArgs e) { List<ClaimPaySplit> splits=Claims.GetInsPayNotAttachedForFixTool(); if(splits.Count==0) { MsgBox.Show(this,"There are currently no insurance payments that are not attached to an insurance check."); return; } Cursor=Cursors.WaitCursor; for(int i=0;i<splits.Count;i++) { Claim claim=Claims.GetClaim(splits[i].ClaimNum); ClaimPayment cp=new ClaimPayment(); cp.CheckDate=claim.DateService; cp.CheckAmt=splits[i].InsPayAmt; cp.ClinicNum=claim.ClinicNum; cp.CarrierName=splits[i].Carrier; ClaimPayments.Insert(cp); List<ClaimProc> claimP=ClaimProcs.RefreshForClaim(splits[i].ClaimNum); for(int j=0;j<claimP.Count;j++) { claimP[j].DateCP=claim.DateService; claimP[j].ClaimPaymentNum=cp.ClaimPaymentNum; ClaimProcs.Update(claimP[j]); } } Cursor=Cursors.Default; MessageBox.Show(Lan.g(this,"Insurance checks created: ")+splits.Count); }
private void butAdd_Click(object sender,EventArgs e) { if(!Security.IsAuthorized(Permissions.InsPayCreate)) {//date not checked here, but it will be checked when saving the check to prevent backdating return; } ClaimPayment claimPayment=new ClaimPayment(); claimPayment.CheckDate=DateTime.Now; claimPayment.IsPartial=true; FormClaimPayEdit FormCPE=new FormClaimPayEdit(claimPayment); FormCPE.IsNew=true; FormCPE.ShowDialog(); if(FormCPE.DialogResult!=DialogResult.OK) { return; } FormClaimPayBatch FormCPB=new FormClaimPayBatch(claimPayment); //FormCPB.IsFromClaim=IsFromClaim; FormCPB.ShowDialog(); if(FormCPB.GotoClaimNum!=0) { GotoClaimNum=FormCPB.GotoClaimNum; GotoPatNum=FormCPB.GotoPatNum; Close(); } else { FillGrid(); } }
private void butRun_Click(object sender,EventArgs e) { List<ClaimPaySplit> splits=Claims.GetInsPayNotAttachedForFixTool(); if(splits.Count==0) { MsgBox.Show(this,"There are currently no insurance payments that are not attached to an insurance check."); DialogResult=DialogResult.OK;//Close the window because there is nothing else to do return; } Cursor=Cursors.WaitCursor; for(int i=0;i<splits.Count;i++) { Claim claim=Claims.GetClaim(splits[i].ClaimNum); if(claim==null) { continue; } ClaimPayment cp=new ClaimPayment(); cp.CheckDate=claim.DateReceived; cp.CheckAmt=splits[i].InsPayAmt; cp.ClinicNum=claim.ClinicNum; cp.CarrierName=splits[i].Carrier; cp.PayType=DefC.GetList(DefCat.InsurancePaymentType)[0].DefNum; ClaimPayments.Insert(cp); List<ClaimProc> claimP=ClaimProcs.RefreshForClaim(splits[i].ClaimNum); for(int j=0;j<claimP.Count;j++) { if(claimP[j].ClaimPaymentNum!=0 || claimP[j].InsPayAmt==0) { //If claimpayment already attached to claimproc or ins didn't pay. continue; //Do not change } claimP[j].DateCP=claim.DateReceived; claimP[j].ClaimPaymentNum=cp.ClaimPaymentNum; ClaimProcs.Update(claimP[j]); } } Cursor=Cursors.Default; MessageBox.Show(Lan.g(this,"Insurance checks created: ")+splits.Count); DialogResult=DialogResult.OK;//Close the window because there is nothing else to do }
public UnfinalizedInsPay(string type, Patient patCur, long clinicNumCur, string carrierCur, DateTime date, DateTime dateOfService, double amt, ClaimPayment claimPay, Claim claim, int countPats) { //assign passed-in values Type = (UnfinalizedPaymentType)Enum.Parse(typeof(UnfinalizedPaymentType), type); if (patCur == null) { PatientCur = new Patient { FName = "", LName = "", MiddleI = "" }; } else { PatientCur = patCur; } ClinicCur = Clinics.GetClinic(clinicNumCur) ?? new Clinic { //creating new clinic with Unassigned as description. The clinic will not get inserted into the db. ClinicNum = 0, Description = "Unassigned" }; //find CarrierCur. GetCarrier uses the H List if possible. CarrierCur = Carriers.GetCarrierByName(carrierCur) ?? new Carrier(); ClaimPaymentCur = claimPay; ClaimCur = claim; Date = date; DateOfService = dateOfService; Amount = amt; CountPats = countPats; }
///<summary></summary> public static long Insert(ClaimPayment cp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { cp.ClaimPaymentNum = Meth.GetLong(MethodBase.GetCurrentMethod(), cp); return(cp.ClaimPaymentNum); } return(Crud.ClaimPaymentCrud.Insert(cp)); }
///<summary></summary> public static long Insert(ClaimPayment cp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { cp.ClaimPaymentNum = Meth.GetLong(MethodBase.GetCurrentMethod(), cp); return(cp.ClaimPaymentNum); } //Security.CurUser.UserNum gets set on MT by the DtoProcessor so it matches the user from the client WS. cp.SecUserNumEntry = Security.CurUser.UserNum; return(Crud.ClaimPaymentCrud.Insert(cp)); }
///<summary></summary> public static long Insert(ClaimPayment cp) { if (RemotingClient.RemotingRole != RemotingRole.ServerWeb) { cp.SecUserNumEntry = Security.CurUser.UserNum; //must be before normal remoting role check to get user at workstation } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { cp.ClaimPaymentNum = Meth.GetLong(MethodBase.GetCurrentMethod(), cp); return(cp.ClaimPaymentNum); } return(Crud.ClaimPaymentCrud.Insert(cp)); }
///<summary>Surround by try catch, because it will throw an exception if trying to delete a claimpayment attached to a deposit or if there are eobs attached.</summary> public static void Delete(ClaimPayment cp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), cp); return; } //validate deposits string command = "SELECT DepositNum FROM claimpayment " + "WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum); DataTable table = Db.GetTable(command); if (table.Rows.Count == 0) { return; } if (table.Rows[0][0].ToString() != "0" && !HasAutoDeposit(cp)) //if claimpayment is already attached to a deposit and was not created automatically { #if !DEBUG throw new ApplicationException(Lans.g("ClaimPayments", "Not allowed to delete a payment attached to a deposit.")); #endif } //validate eobs command = "SELECT COUNT(*) FROM eobattach WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum); if (Db.GetScalar(command) != "0") { throw new ApplicationException(Lans.g("ClaimPayments", "Not allowed to delete this payment because EOBs are attached.")); } if (table.Rows[0][0].ToString() != "0") //deposit was created automatically. Delete deposit. { Deposit deposit = Deposits.GetOne(cp.DepositNum); if (deposit != null) { Deposits.Delete(deposit); } } command = "UPDATE claimproc SET " + "DateInsFinalized='0001-01-01' " + "WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum) + " " + "AND (SELECT SecDateEntry FROM claimpayment WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum) + ")=CURDATE()"; Db.NonQ(command); command = "UPDATE claimproc SET " + "ClaimPaymentNum=0 " + "WHERE claimpaymentNum=" + POut.Long(cp.ClaimPaymentNum); //MessageBox.Show(string command); Db.NonQ(command); command = "DELETE FROM claimpayment " + "WHERE ClaimPaymentnum =" + POut.Long(cp.ClaimPaymentNum); //MessageBox.Show(string command); Db.NonQ(command); }
///<summary>Returns a copy of this ClaimPayment.</summary> public ClaimPayment Copy() { ClaimPayment cp = new ClaimPayment(); cp.ClaimPaymentNum = ClaimPaymentNum; cp.CheckDate = CheckDate; cp.CheckAmt = CheckAmt; cp.CheckNum = CheckNum; cp.BankBranch = BankBranch; cp.Note = Note; cp.ClinicNum = ClinicNum; cp.DepositNum = DepositNum; cp.CarrierName = CarrierName; return(cp); }
public static bool HasAutoDeposit(ClaimPayment cp) { if (cp == null || cp.DepositNum == 0 || !PrefC.GetBool(PrefName.ShowAutoDeposit)) { return(false); } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetBool(MethodBase.GetCurrentMethod(), cp); } //Per Mark on 07/16/2018 //A deposit is consided an "Auto Deposit" if the ShowAutoDeposit preference is turned on //and only one claimpayment is attached to the deposit passed in. string command = "SELECT COUNT(*) FROM claimpayment where DepositNum=" + POut.Long(cp.DepositNum); return(PIn.Int(Db.GetCount(command)) == 1); }
///<summary>If trying to change the amount and attached to a deposit, it will throw an error, so surround with try catch.</summary> public static void Update(ClaimPayment cp, bool isDepNew = false) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), cp, isDepNew); return; } if (!isDepNew && cp.DepositNum != 0 && PrefC.GetBool(PrefName.ShowAutoDeposit)) { string cmd = "SELECT deposit.Amount,SUM(COALESCE(claimpayment.CheckAmt,0))+SUM(COALESCE(payment.PayAmt,0)) depAmtOthers " + "FROM deposit " + "LEFT JOIN payment ON payment.DepositNum=deposit.DepositNum " + "LEFT JOIN claimpayment ON claimpayment.DepositNum=deposit.DepositNum AND claimpayment.ClaimPaymentNum!=" + POut.Long(cp.ClaimPaymentNum) + " " + "WHERE deposit.DepositNum=" + POut.Long(cp.DepositNum); DataTable tble = Db.GetTable(cmd); if (tble.Rows.Count == 0) { cp.DepositNum = 0; } else if (PIn.Double(tble.Rows[0]["depAmtOthers"].ToString()) + cp.CheckAmt != PIn.Double(tble.Rows[0]["Amount"].ToString())) { throw new ApplicationException(Lans.g("ClaimPayments", "Not allowed to change the amount on checks attached to deposits.")); } } else { string command = "SELECT DepositNum,CheckAmt FROM claimpayment " + "WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum); DataTable table = Db.GetTable(command); if (table.Rows.Count == 0) { return; } if (table.Rows[0][0].ToString() != "0" && //if claimpayment is already attached to a deposit PIn.Double(table.Rows[0][1].ToString()) != cp.CheckAmt) //and checkAmt changes { throw new ApplicationException(Lans.g("ClaimPayments", "Not allowed to change the amount on checks attached to deposits.")); } } Crud.ClaimPaymentCrud.Update(cp); }
///<summary>If trying to change the amount and attached to a deposit, it will throw an error, so surround with try catch.</summary> public static void Update(ClaimPayment cp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), cp); return; } string command = "SELECT DepositNum,CheckAmt FROM claimpayment " + "WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum); DataTable table = Db.GetTable(command); if (table.Rows.Count == 0) { return; } if (table.Rows[0][0].ToString() != "0" && //if claimpayment is already attached to a deposit PIn.Double(table.Rows[0][1].ToString()) != cp.CheckAmt) //and checkAmt changes { throw new ApplicationException(Lans.g("ClaimPayments", "Not allowed to change the amount on checks attached to deposits.")); } Crud.ClaimPaymentCrud.Update(cp); }
///<summary>Surround by try catch, because it will throw an exception if trying to delete a claimpayment attached to a deposit or if there are eobs attached.</summary> public static void Delete(ClaimPayment cp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), cp); return; } //validate deposits string command = "SELECT DepositNum FROM claimpayment " + "WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum); DataTable table = Db.GetTable(command); if (table.Rows.Count == 0) { return; } if (table.Rows[0][0].ToString() != "0") //if claimpayment is already attached to a deposit { #if !DEBUG throw new ApplicationException(Lans.g("ClaimPayments", "Not allowed to delete a payment attached to a deposit.")); #endif } //validate eobs command = "SELECT COUNT(*) FROM eobattach WHERE ClaimPaymentNum=" + POut.Long(cp.ClaimPaymentNum); if (Db.GetScalar(command) != "0") { throw new ApplicationException(Lans.g("ClaimPayments", "Not allowed to delete this payment because EOBs are attached.")); } command = "UPDATE claimproc SET " + "ClaimPaymentNum=0 " + "WHERE claimpaymentNum=" + POut.Long(cp.ClaimPaymentNum); //MessageBox.Show(string command); Db.NonQ(command); command = "DELETE FROM claimpayment " + "WHERE ClaimPaymentnum =" + POut.Long(cp.ClaimPaymentNum); //MessageBox.Show(string command); Db.NonQ(command); }
///<summary></summary> public FormClaimPayEdit(ClaimPayment claimPaymentCur) { InitializeComponent();// Required for Windows Form Designer support ClaimPaymentCur=claimPaymentCur; Lan.F(this); }
private void butAdd_Click(object sender,EventArgs e) { if(!Security.IsAuthorized(Permissions.InsPayCreate)) {//date not checked here, but it will be checked when saving the check to prevent backdating return; } ClaimPayment claimPayment=new ClaimPayment(); claimPayment.CheckDate=DateTime.Now; claimPayment.IsPartial=true; FormClaimPayEdit FormCPE=new FormClaimPayEdit(claimPayment); FormCPE.IsNew=true; FormCPE.ShowDialog(); if(FormCPE.DialogResult!=DialogResult.OK) { return; } FormClaimPayBatch FormCPB=new FormClaimPayBatch(claimPayment); //FormCPB.IsFromClaim=IsFromClaim; FormCPB.ShowDialog(); if(IsDisposed) {//Auto-Logoff was causing an unhandled exception below. Can't use dialogue result check here because we want to referesh the grid below even if user clicked cancel. return; //Don't refresh the grid, as the form is already disposed. } if(FormCPB.GotoClaimNum!=0) { GotoClaimNum=FormCPB.GotoClaimNum; GotoPatNum=FormCPB.GotoPatNum; Close(); } else { FillGrid(); } }
///<summary>If trying to change the amount and attached to a deposit, it will throw an error, so surround with try catch.</summary> public static void Update(ClaimPayment cp){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),cp); return; } string command="SELECT DepositNum,CheckAmt FROM claimpayment " +"WHERE ClaimPaymentNum="+POut.Long(cp.ClaimPaymentNum); DataTable table=Db.GetTable(command); if(table.Rows.Count==0){ return; } if(table.Rows[0][0].ToString()!="0"//if claimpayment is already attached to a deposit && PIn.Double(table.Rows[0][1].ToString())!=cp.CheckAmt)//and checkAmt changes { throw new ApplicationException(Lans.g("ClaimPayments","Not allowed to change the amount on checks attached to deposits.")); } Crud.ClaimPaymentCrud.Update(cp); }
///<summary></summary> public static long Insert(ClaimPayment cp) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { cp.ClaimPaymentNum=Meth.GetLong(MethodBase.GetCurrentMethod(),cp); return cp.ClaimPaymentNum; } return Crud.ClaimPaymentCrud.Insert(cp); }
///<summary></summary> public FormClaimPayEditOld(ClaimPayment claimPaymentCur) { InitializeComponent();// Required for Windows Form Designer support ClaimPaymentCur=claimPaymentCur; splits=new List<ClaimPaySplit>(); Lan.F(this); }
/* ///<summary>Creates insurance check</summary> private void butCheckAdd_Click(object sender, System.EventArgs e) { if(!Security.IsAuthorized(Permissions.InsPayCreate)){//date not checked here, but it will be checked when saving the check to prevent backdating return; } bool existsReceived=false; for(int i=0;i<ClaimProcsForClaim.Count;i++){ if((ClaimProcsForClaim[i].Status==ClaimProcStatus.Received || ClaimProcsForClaim[i].Status==ClaimProcStatus.Supplemental) && ClaimProcsForClaim[i].InsPayAmt!=0) { existsReceived=true; } } if(!existsReceived){ MessageBox.Show(Lan.g(this,"There are no valid received payments for this claim.")); return; } long tempClaimNum=ClaimCur.ClaimNum; ClaimPayment ClaimPaymentCur=new ClaimPayment(); ClaimPaymentCur.CheckDate=DateTime.Today; ClaimPaymentCur.ClinicNum=PatCur.ClinicNum; ClaimPaymentCur.CarrierName=Carriers.GetName(InsPlans.GetPlan(ClaimCur.PlanNum,PlanList).CarrierNum); ClaimPayments.Insert(ClaimPaymentCur); FormClaimPayEditOld FormCPE=new FormClaimPayEditOld(ClaimPaymentCur); FormCPE.OriginatingClaimNum=ClaimCur.ClaimNum; FormCPE.IsNew=true; FormCPE.ShowDialog(); //ClaimPaymentCur gets deleted within that form if user clicks cancel. ClaimList=Claims.Refresh(PatCur.PatNum); ClaimProcList=ClaimProcs.Refresh(PatCur.PatNum); FillGrids(); }*/ private void butBatch_Click(object sender,EventArgs e) { if(!Security.IsAuthorized(Permissions.InsPayCreate)) {//date not checked here, but it will be checked when saving the check to prevent backdating return; } if(!ClaimIsValid()) { return; } UpdateClaim(); bool existsReceived=false; for(int i=0;i<ClaimProcsForClaim.Count;i++) { if((ClaimProcsForClaim[i].Status==ClaimProcStatus.Received || ClaimProcsForClaim[i].Status==ClaimProcStatus.Supplemental) && ClaimProcsForClaim[i].InsPayAmt!=0) { existsReceived=true; } } if(!existsReceived) { MessageBox.Show(Lan.g(this,"There are no valid received payments for this claim.")); return; } ClaimPayment claimPayment=new ClaimPayment(); claimPayment.CheckDate=DateTime.Now; claimPayment.IsPartial=true; claimPayment.ClinicNum=PatCur.ClinicNum; claimPayment.CarrierName=Carriers.GetName(InsPlans.GetPlan(ClaimCur.PlanNum,PlanList).CarrierNum); ClaimPayments.Insert(claimPayment); double amt=ClaimProcs.AttachAllOutstandingToPayment(claimPayment.ClaimPaymentNum); claimPayment.CheckAmt=amt; ClaimPayments.Update(claimPayment); FormClaimPayEdit FormCPE=new FormClaimPayEdit(claimPayment); //FormCPE.IsNew=true;//not new. Already added. FormCPE.ShowDialog(); if(FormCPE.DialogResult!=DialogResult.OK) { ClaimPayments.Delete(claimPayment); return; } FormClaimPayBatch FormCPB=new FormClaimPayBatch(claimPayment); FormCPB.IsFromClaim=true; FormCPB.IsNew=true; FormCPB.ShowDialog(); if(FormCPB.DialogResult!=DialogResult.OK) { //The user attached EOBs to the new claim payment and then clicked cancel. Then the user was asked if they wanted to delete the payment and they chose yes. //Since we are deleting the claim payment we must remove the attached EOBs or else ClaimPayments.Delete() will throw an exception. List<EobAttach> eobsAttached=EobAttaches.Refresh(claimPayment.ClaimPaymentNum); for(int i=0;i<eobsAttached.Count;i++) { EobAttaches.Delete(eobsAttached[i].EobAttachNum); } ClaimPayments.Delete(claimPayment); return; } //ClaimList=Claims.Refresh(PatCur.PatNum); //ClaimProcList=ClaimProcs.Refresh(PatCur.PatNum); //FillGrids(); DialogResult=DialogResult.OK; }
/* ///<summary>Creates insurance check</summary> private void butCheckAdd_Click(object sender, System.EventArgs e) { if(!Security.IsAuthorized(Permissions.InsPayCreate)){//date not checked here, but it will be checked when saving the check to prevent backdating return; } bool existsReceived=false; for(int i=0;i<ClaimProcsForClaim.Count;i++){ if((ClaimProcsForClaim[i].Status==ClaimProcStatus.Received || ClaimProcsForClaim[i].Status==ClaimProcStatus.Supplemental) && ClaimProcsForClaim[i].InsPayAmt!=0) { existsReceived=true; } } if(!existsReceived){ MessageBox.Show(Lan.g(this,"There are no valid received payments for this claim.")); return; } long tempClaimNum=ClaimCur.ClaimNum; ClaimPayment ClaimPaymentCur=new ClaimPayment(); ClaimPaymentCur.CheckDate=DateTime.Today; ClaimPaymentCur.ClinicNum=PatCur.ClinicNum; ClaimPaymentCur.CarrierName=Carriers.GetName(InsPlans.GetPlan(ClaimCur.PlanNum,PlanList).CarrierNum); ClaimPayments.Insert(ClaimPaymentCur); FormClaimPayEditOld FormCPE=new FormClaimPayEditOld(ClaimPaymentCur); FormCPE.OriginatingClaimNum=ClaimCur.ClaimNum; FormCPE.IsNew=true; FormCPE.ShowDialog(); //ClaimPaymentCur gets deleted within that form if user clicks cancel. ClaimList=Claims.Refresh(PatCur.PatNum); ClaimProcList=ClaimProcs.Refresh(PatCur.PatNum); FillGrids(); }*/ private void butBatch_Click(object sender,EventArgs e) { if(!Security.IsAuthorized(Permissions.InsPayCreate)) {//date not checked here, but it will be checked when saving the check to prevent backdating return; } if(!ClaimIsValid()) { return; } UpdateClaim(); bool existsReceived=false; bool isSupplemental=false; for(int i=0;i<ClaimProcsForClaim.Count;i++) { if((ClaimProcsForClaim[i].Status==ClaimProcStatus.Received || ClaimProcsForClaim[i].Status==ClaimProcStatus.Supplemental) && ClaimProcsForClaim[i].InsPayAmt!=0) { existsReceived=true; } //Supplemental, has an insurance payment amount entered, and is not attached to a check yet, therefore it will be attached to the check below. if(ClaimProcsForClaim[i].Status==ClaimProcStatus.Supplemental && ClaimProcsForClaim[i].InsPayAmt!=0 && ClaimProcsForClaim[i].ClaimPaymentNum==0) { isSupplemental=true; } } if(!existsReceived) { MessageBox.Show(Lan.g(this,"There are no valid received payments for this claim.")); return; } ClaimPayment claimPayment=new ClaimPayment(); if(isSupplemental) { claimPayment.CheckDate=DateTimeOD.Today;//We cannot use the date the claim was received, because the claim received date corresponds to the first check. } else { claimPayment.CheckDate=ClaimCur.DateReceived;//This date is validated and parsed from the UI when UpdateClaim() is called above. } claimPayment.IsPartial=true; claimPayment.ClinicNum=PatCur.ClinicNum; claimPayment.CarrierName=Carriers.GetName(InsPlans.GetPlan(ClaimCur.PlanNum,PlanList).CarrierNum); ClaimPayments.Insert(claimPayment); double amt=ClaimProcs.AttachAllOutstandingToPayment(claimPayment.ClaimPaymentNum); claimPayment.CheckAmt=amt; ClaimPayments.Update(claimPayment); FormClaimPayEdit FormCPE=new FormClaimPayEdit(claimPayment); //FormCPE.IsNew=true;//not new. Already added. FormCPE.ShowDialog(); if(FormCPE.DialogResult!=DialogResult.OK) { ClaimPayments.Delete(claimPayment); return; } FormClaimPayBatch FormCPB=new FormClaimPayBatch(claimPayment); FormCPB.IsFromClaim=true; FormCPB.IsNew=true; FormCPB.ShowDialog(); if(FormCPB.DialogResult!=DialogResult.OK) { //The user attached EOBs to the new claim payment and then clicked cancel. Then the user was asked if they wanted to delete the payment and they chose yes. //Since we are deleting the claim payment we must remove the attached EOBs or else ClaimPayments.Delete() will throw an exception. List<EobAttach> eobsAttached=EobAttaches.Refresh(claimPayment.ClaimPaymentNum); for(int i=0;i<eobsAttached.Count;i++) { EobAttaches.Delete(eobsAttached[i].EobAttachNum); } ClaimPayments.Delete(claimPayment); return; } //ClaimList=Claims.Refresh(PatCur.PatNum); //ClaimProcList=ClaimProcs.Refresh(PatCur.PatNum); //FillGrids(); //At this point we know the user just added an insurance payment. Check to see if they want the provider transfer window to show. ShowProviderTransferWindow(); DialogResult=DialogResult.OK; }