///<summary>If the statement does not have a short guid or URL, a call will be made to HQ to assign it one. The statement will be updated ///to the database.</summary> public static void AssignURLsIfNecessary(Statement stmt, Patient pat) { if (string.IsNullOrEmpty(stmt.ShortGUID) || string.IsNullOrEmpty(stmt.StatementURL)) { List <WebServiceMainHQProxy.ShortGuidResult> listShortGuidUrls = WebServiceMainHQProxy.GetShortGUIDs(1, 1, pat.ClinicNum, eServiceCode.PatientPortalViewStatement); Statement stmtOld = stmt.Copy(); stmt.ShortGUID = listShortGuidUrls[0].ShortGuid; stmt.StatementURL = listShortGuidUrls[0].MediumURL; stmt.StatementShortURL = listShortGuidUrls[0].ShortURL; Statements.Update(stmt, stmtOld); } }
public static EmailMessage GetEmailMessageForPortalStatement(Statement stmt, Patient pat) { //No need to check RemotingRole; no call to db. if (stmt.PatNum != pat.PatNum) { string logMsg = Lans.g("Statements", "Mismatched PatNums detected between current patient and current statement:") + "\r\n" + Lans.g("Statements", "Statement PatNum:") + " " + stmt.PatNum + " " + Lans.g("Statements", "(assumed correct)") + "\r\n" + Lans.g("Statements", "Patient PatNum:") + " " + pat.PatNum + " " + Lans.g("Statements", "(possibly incorrect)"); SecurityLogs.MakeLogEntry(Permissions.StatementPatNumMismatch, stmt.PatNum, logMsg, LogSources.Diagnostic); } EmailMessage message = new EmailMessage(); message.PatNum = pat.PatNum; message.ToAddress = pat.Email; message.FromAddress = EmailAddresses.GetByClinic(pat.ClinicNum).GetFrom(); string emailBody; if (stmt.EmailSubject != null && stmt.EmailSubject != "") { message.Subject = stmt.EmailSubject; } else //Subject was not preset, set a default subject. { message.Subject = Lans.g("Statements", "New Statement Available"); } if (stmt.EmailBody != null && stmt.EmailBody != "") { emailBody = stmt.EmailBody; } else //Body was not preset, set a body text. { emailBody = Lans.g("Statements", "Dear") + " [nameFLnoPref],\r\n\r\n" + Lans.g("Statements", "A new account statement is available.") + "\r\n\r\n" + Lans.g("Statements", "To view your account statement, log on to our portal by following these steps:") + "\r\n\r\n" + Lans.g("Statements", "1. Visit the following URL in a web browser:") + " " + PrefC.GetString(PrefName.PatientPortalURL) + ".\r\n" + Lans.g("Statements", "2. Enter your credentials to gain access to your account.") + "\r\n" + Lans.g("Statements", "3. Click the Account icon on the left and select the Statements tab."); } message.BodyText = Statements.ReplaceVarsForEmail(emailBody, pat, stmt); return(message); }
///<summary>Returns an email message for the patient based on the statement passed in.</summary> public static EmailMessage GetEmailMessageForStatement(Statement stmt, Patient pat) { if (stmt.PatNum != pat.PatNum) { string logMsg = Lans.g("Statements", "Mismatched PatNums detected between current patient and current statement:") + "\r\n" + Lans.g("Statements", "Statement PatNum:") + " " + stmt.PatNum + " " + Lans.g("Statements", "(assumed correct)") + "\r\n" + Lans.g("Statements", "Patient PatNum:") + " " + pat.PatNum + " " + Lans.g("Statements", "(possibly incorrect)"); SecurityLogs.MakeLogEntry(Permissions.StatementPatNumMismatch, stmt.PatNum, logMsg, LogSources.Diagnostic); } //No need to check RemotingRole; no call to db. EmailMessage message = new EmailMessage(); message.PatNum = pat.PatNum; message.ToAddress = pat.Email; message.FromAddress = EmailAddresses.GetByClinic(pat.ClinicNum).GetFrom(); string str; if (stmt.EmailSubject != null && stmt.EmailSubject != "") { str = stmt.EmailSubject; //Set str to the email subject if one was already set. } else //Subject was not set. Set str to the default billing email subject. { str = PrefC.GetString(PrefName.BillingEmailSubject); } message.Subject = Statements.ReplaceVarsForEmail(str, pat, stmt); if (stmt.EmailBody != null && stmt.EmailBody != "") { str = stmt.EmailBody; //Set str to the email body if one was already set. } else //Body was not set. Set str to the default billing email body text. { str = PrefC.GetString(PrefName.BillingEmailBodyText); } message.BodyText = Statements.ReplaceVarsForEmail(str, pat, stmt); return(message); }
public static Statement CreateLimitedStatement(List <long> listPatNumsSelected, long patNum, List <long> listPayClaimNums, List <long> listAdjustments, List <long> listPayNums, List <long> listProcedures) { Statement stmt = new Statement(); if (listPatNumsSelected.Count == 1) { stmt.PatNum = listPatNumsSelected[0]; } else { stmt.PatNum = patNum; } stmt.DateSent = DateTimeOD.Today; stmt.IsSent = false; stmt.Mode_ = StatementMode.InPerson; stmt.HidePayment = false; stmt.SinglePatient = listPatNumsSelected.Count == 1; //SinglePatient determined by the selected transactions stmt.Intermingled = listPatNumsSelected.Count > 1 && PrefC.GetBool(PrefName.IntermingleFamilyDefault); stmt.IsReceipt = false; stmt.IsInvoice = false; stmt.StatementType = StmtType.LimitedStatement; stmt.DateRangeFrom = DateTime.MinValue; stmt.DateRangeTo = DateTimeOD.Today; stmt.Note = ""; stmt.NoteBold = ""; stmt.IsBalValid = true; stmt.BalTotal = 0; stmt.InsEst = 0; Statements.Insert(stmt); //we need stmt.StatementNum for attaching procs, adjustments, and paysplits to the statement foreach (long adjNum in listAdjustments) { StmtLinks.Insert(new StmtLink() { FKey = adjNum, StatementNum = stmt.StatementNum, StmtLinkType = StmtLinkTypes.Adj }); } foreach (long payNum in listPayNums) { Payment payment = Payments.GetPayment(payNum); PaySplits.GetForPayment(payNum) .FindAll(x => x.PatNum == payment.PatNum && x.ClinicNum == payment.ClinicNum) .ForEach(x => StmtLinks.Insert(new StmtLink() { FKey = x.SplitNum, StatementNum = stmt.StatementNum, StmtLinkType = StmtLinkTypes.PaySplit })); } foreach (long procNum in listProcedures) { StmtLinks.Insert(new StmtLink() { FKey = procNum, StatementNum = stmt.StatementNum, StmtLinkType = StmtLinkTypes.Proc }); } foreach (long claimNum in listPayClaimNums) { StmtLinks.Insert(new StmtLink() { FKey = claimNum, StatementNum = stmt.StatementNum, StmtLinkType = StmtLinkTypes.ClaimPay }); } //foreach(PayPlanCharge payPlanCharge in listPayPlanCharges) { // StmtLinks.Insert(new OpenDentBusiness.StmtLink() {FKey=payPlanCharge.PayPlanChargeNum,StatementNum=stmt.StatementNum,StmtLinkType=StmtLinkTypes.PayPlanCharge}); //} //set statement lists to null in order to force refresh the lists now that we've inserted all of the StmtAttaches stmt.ListAdjNums = null; stmt.ListPaySplitNums = null; stmt.ListProcNums = null; stmt.ListInsPayClaimNums = null; if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { //Currently when using MiddleTier null lists inside an object like above causes the deserialized statement to incorrectly set the null lists //to empty lists. //In the case of a Statement, the public property associated to list in question does not run queries to populate the list as expected because //it checks for a null list, but instead sees an empty list. //We may fix the underlying MiddleTier bug later, but this is an immediate patch to address this symptom. stmt.ListAdjNums = StmtLinks.GetForStatementAndType(stmt.StatementNum, StmtLinkTypes.Adj); stmt.ListPaySplitNums = StmtLinks.GetForStatementAndType(stmt.StatementNum, StmtLinkTypes.PaySplit); if (stmt.IsInvoice) { stmt.ListProcNums = Procedures.GetForInvoice(stmt.StatementNum); } else { stmt.ListProcNums = StmtLinks.GetForStatementAndType(stmt.StatementNum, StmtLinkTypes.Proc); } stmt.ListInsPayClaimNums = StmtLinks.GetForStatementAndType(stmt.StatementNum, StmtLinkTypes.ClaimPay); } return(stmt); }