Email Footers At Checkout

Hello everyone,

I am using version 2.1.3 and I am trying to get a relatively simple email footer to work when we check patients out. Usually at this point the system is attaching the invoice for the services.

I have tried many different ways but can't seem to get it to merge fields correclty. What I have tried so far is;

A Libre Office .odt document written in DejaVu Sans font that reads;

Dear [openvpms:get(party:getPatientOwner(.),'firstName')],

 

Thank your for entrusting us with the care of patient.entity.name. Please find attached a copy your receipt.

Warm Regards,

I then have tried adding this in Administration, Templates, System Email Template. Changing the content type to Document and uploading the file.

I have then gone into:

Administration, Template, Document Template, Invoice and set the email template as the above made system email template.

When I check patients out, the text comes through correclty but the details (owners name and patient name) have not merged correctly into the email.

Sorry this a bit long winded.

TIA.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Email Footers At Checkout

Have a look at the Sample Customer Letter.odt file located in the reports/Sample/A4/ directory of the OpenVPMS installation.

As a test, you should be able to set this as your email template's Content. When attached to your Invoice template, it should merge the fields associated with the customer on the invoice.

 

Re: Email Footers At Checkout

Thank you, thank you and thank you - that has put me on the right path!!

I hope this helps someone else.

Re: Email Footers At Checkout

The only thing I can't get to import now is the patients name. This isn't referred to in the reports/Sample/A4/Sample Customer Letter.odt file. I tried the same approach attaching the sample patient file but that didn't merge the patient name either, any other suggestions?

 

Re: Email Footers At Checkout

An invoice can contain multiple patients, so you need to navigate to the invoice items to extract the patient name(s).

To find unique patients on an invoice, the expression is:

list:distinct(., 'items.target.patient.entity')

You then need to extract the names. If you wrap the above in a list:names() call, it just returns a comma separated list.

E.g., if your invoice contains charges for Fido, Spot and Sooty, it will return "Fido, Spot, Sooty".

To display "Fido, Spot and Sooty" use:

list:names(list:distinct(., 'items.target.patient.entity'), ', ', ' and ')

 

Finally, you need to wrap the whole expression in [] when using it in a .odt or .doc i.e.:

[list:names(list:distinct(., 'items.target.patient.entity'), ', ', ' and ')]

 

Re: Email Footers At Checkout

Thank you very much. I will give this a shot.

That certainly did the trick. The only difficulty I am now having is to have this footer automatically come up at the point of - checkout - mail. I have tried going into Administrator - Templates Document Template - Invoices.

In the email Template I have tried setting both a system email template and a standard email template (containing the same thing). But neither of them come up automatically at the point above (check out - then mail off the schedule).

If I drop down template and pick the one I have made it populates successfully but if we an eliminate that last step, it would help at front end?

 

Re: Email Footers At Checkout

Have you attached your email template to Email Template field in the Document Template for the invoice?

Syndicate content