Skip to content

Add documentation for most sold stock items query#95

Open
sonzsara wants to merge 1 commit into
mainfrom
ENG-230
Open

Add documentation for most sold stock items query#95
sonzsara wants to merge 1 commit into
mainfrom
ENG-230

Conversation

@sonzsara
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation for an Operations query that reports the most sold stock items, including dispensed quantity, revenue, purchase cost, and margin.

Changes:

  • Adds a new mostsold_ssmm.md query documentation page.
  • Defines parameters for stock name and date filtering.
  • Documents the SQL and operational assumptions for included dispense/charge statuses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Care/Operations/mostsold_ssmm.md
SUM(ci.total_price - (p.purchase_price * md.quantity)) AS total_margin
FROM emr_medicationdispense md
JOIN emr_chargeitem ci ON md.charge_item_id = ci.id
JOIN emr_inventoryitem ii ON md.item_id = ii.id
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inventory_item is unnecessary here since we can go from chargeitem to product (product table has charge item).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants