Configure Calculated Order Quantity

Description

As an implementer, I want the option to include and configure the "Calculated Order Quantity" (I) so that storeroom managers don't need to calculate the order quantity (reduce human arithmetic error) when filling out the requisition.

This is an API ticket to allow this field to be configured on a requisition template for a program and, when configured, that it is included on new requisitions that are initiated for that program. There is also a UI ticket for making sure this field works properly on the Requisition Form in the UI.

Definition: calculated quantity which should be reordered. Deducts stock in hand quantity and is based on defined max stock amounts. This is quantified in dispensing units.
Calculation: (H) Maximum Stock Quantity - (E) Stock on Hand
Dependencies: H and E need to be configured on the template for I to be calculated (NOT SURE ABOUT THIS) H and E doesn't need to be displayed and this should still work (verify with v2).
Review: Please review 2.0 to confirm validations and logic and https://openlmis.atlassian.net/wiki/x/UQAOBg

Looking forward: if the facility is using OpenLMIS for inventory management and have an electronic stock card, stock on hand would be generated from the stock card and not entered in by the user.

Acceptance Criteria
Verify that:

  • calculated order quantity is an available field that an administrator can configure into their requisition template for a program

  • appropriate requisition templates endpoints support that (no UI exists yet for configuring the requisition template—that admin UI would be a future ticket)

  • to use "I", H and E must be configured for the same template (E may be dependent on A, B, C, D if there isn't an electronic stock card)

    • there should be validation that H and E are also in use if using "I"

  • the field is calculated by H - E

  • If there is an electronic stock card for the item/product, E is populated by the electronic stock card and not by A, B, C, D

  • If there isn't an electronic stock card for the item/product, E is populated by user input of A, B, C, D

  • the attribute (I) is displayed in the defined order on the requisition template

  • the calculated amount of "I" cannot be modified in the UI, it is generated per the definitions above

  • appropriate user permissions are enforced

  • data entry validations should match the current 2.0 functionality (please check)

Definitions
An implementor defines max months of stock for a product, in a program, for a facility type. It’s part of a Facility Type Approved Product aka Facility Approved Product. The idea is this: for a full-supply product at a regional hospital (facility type), you might want to approve them to be supplied with bottles of 500 pills of Ibuprofen 500mg (product’s pack) and that they can have up to 3 months of stock (using either consumption or target population as the basis for calculating per month needs). It’s per facility type as a district hospital may not be allowed to be supplied with the 500 pill bottles, but rather the 50 pill bottles, and they should only have 2 months of stock.

Additional note: please view the configuration requisition template attached to the epic to see the interconnection with other requisition attributes.

Please ask questions if there is confusion on this story. Please work with the team lead to ensure appropriate implementation.

100% Done
Type
Key
Summary
Priority
Story Points
Assignee
Status

QAlity Plus - Test Management

Checklists

Activity

Paweł GesekJanuary 30, 2017 at 5:53 PM

I verified the quantity does not update through API

Paweł GesekJanuary 30, 2017 at 5:52 PM

The issue with decimal numbers and the field not calculating were fixed

Paweł GesekJanuary 30, 2017 at 3:19 PM
Edited

one more issue. When I add one digit to beginning balance (a zero at the end for example) it can make the calculation for order quantity negative. When this happens, it is calculated to zero.

HOWEVER

When I have stock on hand calculated and not displayed, this does not happen - when I add this zero that makes the calculation go negative, the calculcated order quantity does not update at all.

Paweł GesekJanuary 30, 2017 at 3:17 PM


Essential meds first requisition, first line:

Beginning balance: 30
Total Received quantity : 2211
Total consumed quantity 1121
Stock on hand (CALCULATED): 1120

Maximum stock quantity gets calculated to: 6165.5
and calculated order quantity to: 5045.5

Nikodem GraczewskiJanuary 30, 2017 at 2:56 PM

I've added rounding to the maximumStockQuantity calculation, but would like to test it before pushing. What was the data that caused this?

Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Original estimate

Time tracking

2d 4h 30m logged3h 30m remaining

Components

Sprint

Fix versions

Priority

Time Assistant

Created July 13, 2016 at 5:29 PM
Updated January 31, 2017 at 10:59 AM
Resolved January 30, 2017 at 5:55 PM

Flag notifications