As you work with Meditech BAR 6.15, you may find yourself needing to identify the GL Account that a payment or adjustment posts to. And then… you find that the appropriate field in the non-charge procedure dictionary has a dynamic string definition stored in it, instead of a specific GL Account number.
What you will see is something like this:
You might also see a specific account, like:
In each case this directs Meditech to construct the string by Q-ing (concatenating) the three components together. The AT, notice it is not quoted, is a placeholder that is replaced by the BAR Account Type when the string is processed.
For the single component example, we get: 01.5000.5017 as the output.
For the three component example, however, we get a dynamically generated string like: 01.5000.0121
This tells us that the last part of the account string (0121) is composed of the AT placeholder (component 2) and the third component.
If we are working in the DR, we have to identify what the value in AT needs to be, on a payment/adjustment transaction level. As it happens, this is stored at the facility level in the BAR Account Type dictionary:
If we pull in that dictionary, based on the BAR account type, then we can get our missing piece, and then – if we break up the dynamic string appropriately – we can reassemble it all into the proper output:
Note that we have to check for overrides at the facility level of the BAR non-charge procedure dictionary, and then we break out the dynamic string into its pieces using IatricPieceFn() [ Source code attached! ]
Also note that you need to search/replace the fdb. references with the name of your M/AT database in the DR before you try out this code.
Got Magic or C/S? You will find roughly the same data elements in the NPR-based BAR dictionaries.
You could also take this logic and make a scalar function of it, to package it all up and take parameters for: the dynamic string and the BAR account type. Just remember that calling this logic via a function will incur overhead in your query!
As ever, if you need help with MEDITECH DR optimization, reporting, extracting, index creation or analysis please feel free to give your iatricSystems Account Executive a call or email email@example.com to discuss how we can help support your team!