Bulk add discount group to all clients
Submitted by sorrentovet on Tue, 15/09/2020 - 16:25
Hi everyone,
I would like to add a discount group (already existing in my OpenVPMS) to all clients in the database.
Is there any way to accomplish this?
I was thinking a MySql Insert statement might be the only way but then I'm lost as to the update of id's, linkId's etc etc.
As a bit of background: I'm running a competition on Advocate sales and I need discount to be applied to any client buying any Advocate product up to a certain date.
Thanks,
Anton
Re: Bulk add discount group to all clients
The SQL below can be used to add relationships between active customers and a discount group in OpenVPMS 2.x.
I recommend testing on a backup before deploying to a production environment.
Note that it won't add a discount relationship if one already exists, even if it has expired.
The following SQL shows which customers will be updated. Replace XXDiscount with the actual discount group name.
The following SQL performs the actual update.
Replace the text in bold with the real values. E.g, it assumes the discount starts on 20/09 and ends on the 27/9.
Re: Bulk add discount group to all clients
This is awesome, thank you Tim!