Though various ways including manual creation of billing entry at the end of the day, have been suggested to sync registration fee with ERP to meet the requirement of displaying registration fee in the billing automatically code changes are required.
A quick implementation ((that’s the subject: Interim Implementation) to meet this requirement, Java and Python code level changes have been done as explained below. Requires further discussions on this so that final code can be released on the community.
Here is Screen capture for registration fee syncing
Assumption -
- Once registration fee is charged, it will not get reversed though it is set to “No” on the second page of Patient Registration in Bahmni.
Pending -
- Like drug and radiology orders this code does not add any entries in openmrs (mysql) orders table. Requires further discussions on this as well.
- Order type “Registration Fee” has been hard coded in MapERPOrders class. To overcome this it can be set in order_type table and attached to the concept class “RegFee” (order_type_class_map) as mentioned here.
OpenMRS Settings -
- Create a new concept class name “RegFee”.
- Create concept name “Charge Registration” (or any name) of datatype Boolean, class “Radiology” and attach to “Fee Information”. Saving this should sync it with ERP. Once synced with ERP change the class to “RegFee”.
OpenERP Settings
- Order Type “Registration Fee” should be created in ERP and mapped to shop as mentioned here.
- Create a suitable product category for “Charge Registration”.
- Set the price and newly created product category for “Charge Registration”.
Following Code changes have been done -
openerp-atomfeed-service
- In org.bahmni.feed.openerp.domain.encounter added OpenMRSObservationGroupMember and OpenMRSObservationGroupMemberConcept classes to hold the respective data for the encounter event getting registered in event_records table.
- OpenMRSObservationGroupMember contains private OpenMRSObservationGroupMemberConcept concept;
- OpenMRSObservation contains a list of OpenMRSObservationGroupMember
- OpenMRSEncounter contains encounterType as string data member.
- MapERPOrders.getParameters checks if the encounter type is “Reg” then sets category parameter to “create.sale.regfeeorder” so that Python code can consume the same.
- MapERPOrders.mapOpenERPOrders checks if the encounter type is “Reg” and if the observation consists of a concept group member of class “RegFee” then adds OpenERPOrder with appropriate parameters same as radiology and drug order but with a new event type as “create.sale.regfeeorder”
- OpenMRSEncounter.shouldERPConsumeEvent checks if encounter type is “Reg” then returns true.
operp-modules\bahmni_atom_feed
- Added “event handler” for “create.sale.regfeeorder” to call self.pool.get(‘order.save.service’).create_orders(cr,uid,vals,context) in process_event in atom_feed_client.py