Bug 799

Summary: Pharmacist cannot dispense medicine when the dispense cause medicine stock become 0
Product: 2023 CS3343 Group 20 System Reporter: mhlee64-c
Component: MedRecordAssignee: chlam368-c
Status: RESOLVED FIXED    
Severity: major CC: hfwong56-c
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Windows   
Attachments: Error when dispense will empty stock

Description mhlee64-c 2023-11-29 23:04:56 HKT
Created attachment 157 [details]
Error when dispense will empty stock

When Pharmacist dispense medicine to patient, they should be able to do it even if the medicine stock will be empty after dispensing, but the system do not allow them to.
----------------------------------------------------------------------------------
Welcome to CMS!
============================================== Login ===============================================
Please enter your staff ID: d
Please enter your password: d
============================================ Main Menu =============================================
Login as [Doctor] Dr. dummer dr one | d | 
0.	Patient Mangement
1.	Appointment Management
2.	MedRecord Management
3.	Medicine Management
4.	Admin
5.	Logoff
Please select a function: 2
======================================= MedRecord Management =======================================
0.	Diagnose & Prescribe
1.	Dispense
2.	Edit Prescription
Please select a function: 0
========================================== Select Patient ==========================================
Please input patient's HKID: a123456
[Patient] Dummy patient | M | a123456 | 2020-06-29 | 
============================================= Diagnose =============================================
Diagnosis content: 
flu
New diagnosis added successfully.
Prescribe? (Y/N): Y
======================================= Patient's Allergies ========================================
None
Enter any key to continue. 
========================================== Medicine List ===========================================
-1.	Enter -1 to finish.
0.	[Medicine] m1 | $:100.0/tab | Stock: 2
1.	[Medicine] m2 | $:100.0/10mg | Stock: 2
Please select the drugs: 0
Please select the drugs: -1
Enter quantity for m1(tab): 2
New prescription added successfully.
============================================ Main Menu =============================================
Login as [Doctor] Dr. dummer dr one | d | 
0.	Patient Mangement
1.	Appointment Management
2.	MedRecord Management
3.	Medicine Management
4.	Admin
5.	Logoff
Please select a function: 5
Successfully logoff.
============================================== Login ===============================================
Please enter your staff ID: p
Please enter your password: p
============================================ Main Menu =============================================
Login as [Pharmacist] dummy Ph | p | 
0.	Patient Mangement
1.	Appointment Management
2.	MedRecord Management
3.	Medicine Management
4.	Admin
5.	Logoff
Please select a function: 3
======================================= Medicine Management ========================================
0.	View Medicine
1.	Create Medicine
2.	Edit Medicine
Please select a function: 0
========================================== View Medicine ===========================================
0.	[Medicine] m1 | $:100.0/tab | Stock: 2
1.	[Medicine] m2 | $:100.0/10mg | Stock: 2
Enter any key to continue. 
============================================ Main Menu =============================================
Login as [Pharmacist] dummy Ph | p | 
0.	Patient Mangement
1.	Appointment Management
2.	MedRecord Management
3.	Medicine Management
4.	Admin
5.	Logoff
Please select a function: 2
======================================= MedRecord Management =======================================
0.	Diagnose & Prescribe
1.	Dispense
2.	Edit Prescription
Please select a function: 1
========================================== Select Patient ==========================================
Please input patient's HKID: a123456
[Patient] Dummy patient | M | a123456 | 2020-06-29 | 
======================================= Select Prescription ========================================
0.	[Prescription] Dr. dummer dr one | Dummy patient | 2023-11-29T22:40:05.703471500
Please select the prescripion: 0
======================================= Patient's Allergies ========================================
None
=========================================== Prescription ===========================================
m1	2tab
Confirm to dispense and charge $200.0? (Y/N) : Y
============================================== ERROR ===============================================
exceptions.DispenseOutOfStockMedException: There is(are) medicine cannot be dispensed due to out of stock!