Practice Location Details
Submitted by Ben_Charlton on Fri, 19/06/2015 - 11:14
I am looking to return some details on reports like invoices based on practice location
For example
[openvpms.get(OpenVPMS.location,'abn')
- I created a /detail/abn node on practice location
However I would like to return EFT details
my options are to create another couple of detail nodes and then return them OR a
access the details stored in deposit accounts.
However this brings a slight issue that of multiple deposit accounts and which one to return.
[openvpms.get(openvpms.get(OpenVPMS.location,'depositAccounts')[1],'bank')]
I wasnt sure if I need to use a list: function or get would return a set quite happily.
Thoughts.
Ben
Re: Practice Location Details
It may be possible to come up with an xpath expression to do this, but it will be convoluted. The main issue is that the collections aren't sorted, so [1] will give different results. You'd need to select the appropriate one based on its id or name.
I think the easiest approach is to define a practice location-deposit account relationship with maxCardinality=1 which is solely used for reporting purposes.
Re: Practice Location Details
I agree. with regard to name I would assume a name like EFTAccount as the node name would be appropriate.
Given that i cant think of any other reporting purpse aside from Electronic deposits.
Re: Practice Location Details
I will go ahead and define this locally...unless its felt that its worthwhile adding it back to the Core distro?
Re: Practice Location Details
Oddly enought
doesnt work despite
being present in the location archetype.
Re: Practice Location Details
When used within xpath, you need to refer to OpenVPMS.location as a variable:
You should also be able to do:
Re: Practice Location Details
OpenVPMS.location.abn does work however.
Re: Practice Location Details
The $ is not required in JRXML files I am not sure if thats intended or not
Re: Practice Location Details
Sorry to be more clear when using
OpenVPMS.location.abn the $ is not required
$F{OpenVPMS.location.abn} works fine
Re: Practice Location Details
My point was that you can't use JasperReports fields within xpath expressions, but the OpenVPMS fields are also declared as variables and these can be used.
Re: Practice Location Details
I have just added a sentence to http://www.openvpms.org/documentation/csh/1.8/reference/jxpath to reference Application Fields. Regards, Tim G
Re: Practice Location Details
Actually Tim I dont think these parameters are available to ANY subreports. You specify they are not available to SQL sub reports on the Application Variables help page. but I think thats technically not correct. No OPENVPMS functions are available in that context. You can also access the context provided and cant use reflection to get higher in the data tree.
IE you cant access the practice details from a subreport unless they are explicity provided in the dataExpression from the parent report.
I think.
Re: Practice Location Details
You are correct Ben. I will see if I can clarify the documentation. Regards, Tim G
Re: Practice Location Details
Ben - after a query from Tim A, I had a play. Application fields work quite happily in non-sql subreports. I had a hack at our invoice items so it shows the current location name - ie
and you get:
Regards, Tim G
PS - I am running Build 6595 and Jasper Studio 6.1.0
Re: Practice Location Details
have you ever tried using party functions in sub reports?
Re: Practice Location Details
No - but just tried - $F{[party:getTelephone($OpenVPMS.practice)]} worked OK.
$F{[party:getTelephone(.)]} gave 'expression error'
$F{[party:getTelephone($OpenVPMS.customer)]} worked OK
$F{[party:getPatientWeight($OpenVPMS.patient)]} gave 'expression error'
Remember that I am playing with the invoice items subreport. Hence the code handling the party functions knows the practice location and the customer (or more strictly we have a current customer and practice location - because we are doing Preview from the Customers|Charges screen). However, I do not have a current patient set.
If I go and select the patient ZZ-Cat then the getPatientWeight expression works and I get:
However, this is ZZ-Cat's weight, not ZZ-Dog's.
Conclusion: party functions work, and Application Fields work - but you have to understand what is currently selected. In the above case I should have used:
$F{[party:getPatientWeight(openvpms:get(.,"target.patient.entity"))]} which works as expected.
Regards, Tim G