Product Code or Barcode on a report

Anyone know if its possible to return a product code or barcode on a report...

 

ie Product.entity.identity[0] or

openvpms.get(Product.entity, 'code')

 

Looking for a way to return a code/barcode on a report 

 

 

Comment viewing options

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

Re: Product Code or Barcode on a report

Ben - if you are building a SQL data-source'd report then should be relatively simple to code the necessary SQL. If you need it in a OpenVPMS data-source'd document or an OO document, then I suspect you are out of luck - there is a party:getIdentities(party) - but that wants a party as the argument, not a product.

If you need some SQL generated, please yell.

Regards, Tim G

Re: Product Code or Barcode on a report

Nah unfortunately its using an object datasource...ie act so it needs to be a jxpath query. there is no jxpath functions for products as yet...probably need one..

I was trying to use a openvpms.get on the act to retrieve an identity but looks like it needs to be coded.

Wider applications?  do we want this in the core?

I was thinking adding

getCodes

getBarcodes

getIdentities to the productRules and then adding a jxpath function list to return them.

Additionally and this is more dev based but I couldnt see how we are returning batch numbers from a sale in a report.  Say for example I want to return the batch number and expiry of a vaccination certificate.  The batch would be recorded against the ChargeItem, but we need a method to bring that data across to reporting.

 

 

 

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Product Code or Barcode on a report

You might be able to access barcodes using xpath expressions, although I think you can define a hidden node that does the filtering for you e.g.:

<node name="barcodes" path="/identities" type="java.util.HashSet" baseName="Identity" 
      minCardinality="0" maxCardinality="*" filter="entityIdentity.barcode" hidden="true/>

If you just want the first barcode, try:

openvpms:get(., "barcodes")[0]

For the first identity of any type:

/identities[0]

See http://commons.apache.org/proper/commons-jxpath/users-guide.html for expression syntax.

 

For batches, given a charge item you can get the:

  • batch number using "batch.entity.name"
  • expiry date using "batch.entity.product.activeEndTime"

The "batch.entity" part resolves to an entity.productBatch.

The "batch.entity.product" resolves to an entityLink.batchProduct.

The expiry date is on the product relationship for implementation reasons; an indexed field was required to be able to sort batches on expiry.

 

Re: Product Code or Barcode on a report

Yeah thats good but we need to reference the batch numbers referencing from an Patient Letter.

which drills down to a act.PatientDocument* which was linked to a product....

Sounds like we need to create a jxpath function to bring in the batch number source it from the chargeitem  the issue being that there may well be No charge item for a specific document....

Just to be clear why this is required...

Almost all veterinary boards in Australia at least recommend the inclusion of batch and expiry dates on vaccination certificates.  

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Product Code or Barcode on a report

I haven't tried this so YMMV.

If the letter was generated from a invoice item, then there should be a link to it that you can access by adding a node on act.patientDocumentLetter:

<node name="invoiceItem" path="/targetActRelationships" type="java.util.HashSet" baseName="TargetActRelationship"
      minCardinality="0" maxCardinality="1" hidden="true" filter="actRelationship.invoiceItemDocument"/>

Given the letter, you can then do:

  • openvpms:get(., "invoiceItem.source.batch.entity.name")
  • openvpms:get(., "invoiceItem.source.batch.entity.product.activeEndTime")

The same should apply to act.patientDocumentForms.

 

Re: Product Code or Barcode on a report

I think I am going to try and generate a 

1 patient document - or 1 letter and 1 form

1 customer doc (1 letter 1 form)

that simplely list out all the functions we can use to access data in an example form.

Provide that as a reference document.  

 

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Product Code or Barcode on a report

 I should have mentioned Tim's solution works as expected .

I will Jira the archetype change Tim - as I think this is a required change to support batch reporting in  forms.

 

I would generally argue against hiding the node.

 

 

AttachmentSize
invoiceitem.JPG 52.62 KB
Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Product Code or Barcode on a report

The default layout is a bit ordinary as the invoice item is rendered inline. If you display it, the node should also be read-only.

You can force it onto a separate tab using:

<node name="invoiceItem" path="/targetActRelationships" type="java.util.HashSet" baseName="TargetActRelationship"
      minCardinality="0" maxCardinality="1" hidden="false" readOnly="true" filter="actRelationship.invoiceItemDocument">
    <assertion name="archetypeRange">
        <propertyList name="archetypes">
            <propertyMap name="archetype">
                <property name="shortName" value="actRelationship.invoiceItemDocument"/>
            </propertyMap>
        </propertyList>
    </assertion>
</node>

This will be displayed even if a letter has no invoice item linked to it. To avoid this:

1. subclass DocumentActLayoutStategy and DocumentActViewLayoutStrategy and provide an implementation of getArchetypeNodes() that excludes the invoice item node if it is empty (see ArchetypeNodes.excludeIfEmpty())

2. change PatientDocumentActEditor for patient documents, to create the appropriate patient document layout strategy. i.e. override createLayoutStrategy()

3. register the new view layout strategy in DefaultLayoutStrategyFactory.properties. This will replace the existing one for act.patientDocument*

 

Re: Product Code or Barcode on a report

I will put it on my projects todo list :) Do you want it in core?

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Product Code or Barcode on a report

Sure - sounds like a useful addition.

Re: Product Code or Barcode on a report

https://openvpms.atlassian.net/browse/OVPMS-1539

Further discussion can be found on the Developer forum.

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au
Syndicate content