(Microsoft Word - 118-128\323\343\307) Al-Khwarizmi Engineering Journal,Vol. 13, No. 1, P.P. Design and Implementation of a Database Department of Computer Email: (Received 15 https://doi.org/10.22153/kej.2017.08.008 Abstract The main aim of this paper are the design and implementation of a pharmaceutical inventory database management system. The system was implemented by creating a database containing information about the stored medicines in the inventory, customers making transactions with the pharmaceutical trading company (which owns the inventory), medical suppliers, employees, payments, etc. The database was connected to the main application using C sharp. The proposed system should help in manag inginventory operations w preparing sale and purchase invoices, generating reports, adding/updating customers and suppliers, tracking customer payments and checking expired medicines in order to be disposed. The system can be use workflow of sale and purchase operations and bring the advantages of having the most efficient control with minimal efforts. Keywords: Inventory Database Management System, Invoicemedicine, , Pharmaceutical. 1. Introduction Inventory management is one of the essential problems in almost every company. Before computer age and integration, solutions were used as inventory management tools. If there is no automated system available, these solutions may cause a lot of paperwork usually lead to mistakes as the workload increases since it deals with more than hundreds of medications. The company needs to use a new technology to keep track of all its transactions and day-to-day operations to achieve its business goals by introducing a computer-based Designing and Implementing such a system is possible but there is preliminary work studying the operational environment and needs of the company, identifying the requirements, determining software tools, designing database and developing the user interface application (Taner Arsan, 2013). Khwarizmi Engineering Journal,Vol. 13, No. 1, P.P. 118- 128 (2017) mplementation of a Pharmaceutical Inventory atabase Management System Sama Salam Samaan Computer Engineering / University of Technology Email:samasamaan@yahoo.com 15 September 2015; accepted 4 August 2016) https://doi.org/10.22153/kej.2017.08.008 The main aim of this paper are the design and implementation of a pharmaceutical inventory database management system. The system was implemented by creating a database containing information about the stored medicines in the ansactions with the pharmaceutical trading company (which owns the inventory), medical suppliers, employees, payments, etc. The database was connected to the main application using C sharp. The proposed system should help in manag inginventory operations which include adding/updating employees’ information, preparing sale and purchase invoices, generating reports, adding/updating customers and suppliers, tracking customer payments and checking expired medicines in order to be disposed. The system can be used to facilitate smooth workflow of sale and purchase operations and bring the advantages of having the most efficient control with minimal : Inventory Database Management System, Invoicemedicine, , Pharmaceutical. anagement is one of the problems in almost every company. computer age and integration, paper used as inventory management If there is no automated system available, may cause a lot of paperwork and usually lead to mistakes as the workload increases than hundreds of company needs to use a new technology to keep track of all its transactions and to achieve its business based system. Implementing such a system is preliminary work such as studying the operational environment and needs requirements, ing system the user interface For the company, it is important to ensure that there is sufficient quantity of medications the needs of the customers. In addition, careful inventory management can increase the earnings. A badly managed inventory m more loss through medications expiring, accounting and inappropriately than a well-managed inventory (Katie Ingersoll, 2015). In order to provide an overview of previous work, some researchers presented by various authors are reviewed: • (Toshio Awaya et al., 2005) control system application named Artima which allows inventory tasks to be faster and more efficient in real world. The medicines used in the hospital (where the system automatically fixed and arranged in sold and ordered from each wholesaler every day. system can search the quantities available expiration date of each drug in the purch delivery records. They find that the system Al-Khwarizmi Engineering Journal nventory The main aim of this paper are the design and implementation of a pharmaceutical inventory database management system. The system was implemented by creating a database containing information about the stored medicines in the ansactions with the pharmaceutical trading company (which owns the inventory), medical suppliers, employees, payments, etc. The database was connected to the main application using C sharp. The hich include adding/updating employees’ information, preparing sale and purchase invoices, generating reports, adding/updating customers and suppliers, tracking customer d to facilitate smooth workflow of sale and purchase operations and bring the advantages of having the most efficient control with minimal important to ensure that of medications to serve the needs of the customers. In addition, careful increase the company managed inventory may have more loss through medications expiring, incorrect ly recorded returns managed inventory (Katie Ingersoll, In order to provide an overview of previous presented by various , 2005), developed a system application named Artima which to be faster and more rld. The medicines used in the is applied) were and arranged in sold-packages from each wholesaler every day. This quantities available and drug in the purchase and delivery records. They find that the system Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 119 functions are robust and useful in patient’s safety and cost containment. • (Libby Levison and Hamish S F Fraser, 2008) worked in a system that served as a case study of how to select and design a medical information system for use in a developing country. They found that all health care programs require a robust and reliable drug supply system. 2. Objectives The proposed system should achieve the following goals: • Add/update customers and medicine suppliers with their full information. • Add/update system users and inventory employees. • Add/update medicines with their scientific names, manufacturing company, manufacturing and expiry dates, batch numbers and the available quantities from each batch. • Prepare sale and purchase invoices. • Generate reports. • Track customer payments. • Detect expired medicines in order to be disposed. • Manage returned medicines from customers in case of damage or overstock. 3. Phases of Database Design and Implementation for the Pharmaceutical Inventory Database According to (Ramez Elmasri, 2015), the overall database design and implementation process is identified in six main phases: 1. Requirements collection and analysis 2. Conceptual database design 3. Choice of a DBMS 4. Logical database design 5. Physical database design 6. Database System implementation and tuning. 3.1 Requirement Collection and Analysis During this phase, the database designers meet potential system users to understand and document their data requirements. The result of this step is a briefly written set of users’ requirements (Ramez Elmasri, 2015). Knowing the requirements and needs of the system is vital to its success. Important inventory documents are collected and analyzed, including sale and purchase invoices, customers and suppliers’ records, employees' records, medicines’ records and customer payments. The collected requirements associated with this system include: 1. Drugs have expiration dates after which they may no longer be used. After a specific amount of time, the chemical structures of medications may change to reduce their strength or change it into a completely different product. Medications must be dragged off the shelf when this date approaches, because it is unsafe to distribute drugs after the expiration date has passed. It is important to consider expiration dates when ordering medications. 2. When preparing a sell invoice, it is important to use older medications before newer medications to ensure that products with shorter expiration dates are used before those that will last longer and minimize the number of expiring products. 3. Outdated products should be pulled off of the shelves at steady intervals to reduce the chance of expired medications getting to a patient. 4. Pharmacies can return medications that has been ordered in surplus or is moving slowly off of the shelves. In general, if a package has been unlocked or damaged and does not expire for at least 12 months, a company can accept the medication for return. 5. If any medications are received damaged or expired, or if the pharmacy accidentally ordered a product it does not need, it may be desirable for return to the company. 6. After the order is received and put away, bills must be paid according to the accounting steps of the company. They often need to be entered into the computer system on the same day they are received or as soon as possible after receipt. 7. The manufacturer’s recommendations should be followed when storing medications. Many medications are able to be stored at room temperature 20-22 °C. Drugs should not be stored above or below this temperature range unless authorized by the manufacturer. 8. Some drugs require refrigeration to preserve the stability of the medication. In general, refrigerated medications need to be stored between 2 - 8 °C. 9. Because frozen drugs are especially vulnerable to damage, care must be taken when handling these products. Frozen medications should be stored below -15 °C. There are very few medications that require storage in the freezer; those that do include the chickenpox and some premixed IV medications in the hospital setting that may be dissolved prior to use. Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 120 10. Chemotherapy medications are considered hazardous substances. All employees who could reach these products be aware of the risks to which they could be exposed (Katie Ingersoll, 2015). 3.2 Conceptual Database Design The next phase is to create a conceptual schema for the database, using a high-level conceptual data model. The conceptual schema is a description of the data requirements of the users. Because these concepts do not include implementation details, they are usually easier to understand and can be used to communicate with nontechnical users. The conceptual schema can also be used as a reference to ensure that all requirements are met and do not conflict. The Entity-Relationship (ER) model was proposed by Peter Chen in 1976 for conceptual design. In some ways, class diagrams can be considered as an alternative notation to ER diagrams (Ramez Elmasri, 2015). In this project, the conceptual modeling is performed using UML (Unified Modeling Language) class diagram notation. Fig (1) shows the conceptual schema diagram that is created for the pharmaceutical inventory database. Fig .1. The designed Pharmaceutical Inventory conceptual schema in UML class diagram notation. Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 3.3 Choice of a DBMS In this project, relational database management system is chosen. Many of the databases in widespread use are based on the database model. RDBMS is a common choice for the storage of information in new databases used for financial records, manufacturing and logistical information, personnel data, and other applications (Thomas M. Connolly, 2014 commercial RDBMS that is chosen is Microsoft SQL server. Fig. 2. Result of mapping the Pharmaceutical schema. 3.5 Physical Design In this phase the internal storage structures, file organizations, indexes, access paths, and physical design parameters for the database files are Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118 121 ase management any of the databases in widespread use are based on the relational a common choice for the storage of information in new databases used for financial records, manufacturing and logistical personnel data, and other Thomas M. Connolly, 2014). The commercial RDBMS that is chosen is Microsoft 3.4 Logical Database Design During this phase, the conceptual schema (resulted from phase 2) is mapped from the high level data model into the data model of the chosen DBMS. The resulted logical data model is validated to check structural correctness and support for the required transactions. steps of an algorithm described in ( Elmasri, 2015) are followed for ER mapping. The resulted pharmaceutical inventory relational database schema is shown harmaceutical Inventory UML schema into a relational the internal storage structures, file organizations, indexes, access paths, and physical design parameters for the database files are specified. In parallel with these activities, application programs are designed and implemented as database transactions corresponding to the high level transaction specifications (Thomas M. Connolly, 2014 118- 128(2017) Logical Database Design During this phase, the conceptual schema is mapped from the high- level data model into the data model of the chosen logical data model is validated to check structural correctness and support for the required transactions. A number of of an algorithm described in (Ramez followed for ER-to-relational pharmaceutical inventory relational database schema is shown in fig (2). relational (logical) database specified. In parallel with these activities, application programs are designed and implemented as database transactions corresponding to the high level transaction Thomas M. Connolly, 2014). Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 122 3.6 Database System Implementation and Tuning During this phase, the database and application programs are implemented, tested, and finally deployed for service. Various transactions and applications are tested separately and then in conjunction with each other. This typically reveals opportunities for physical design changes and reorganization, an activity referred to as database tuning which continues for the life cycle of a database as long as the database and applications keep evolving and performance problems are detected [V] Every system user (who is eligible to use and access the proposed system) has his/her workstation. Each workstation is connected to a switch. The database server is connected to that switch. Each user can access the system from the application installed in his/her local workstation. The system can only be accessed from the local network. The front end of the system is designed using C sharp. The backend is developed using MS SQL server. The system will be applied in a LAN as in fig (3). In a Client-Server scenario, we have the SQL Server installed on a server machine. Clients will be the computers accessing that server using the implemented software. Each client will provide a way of making a connection to the server instance running on the server. We will need the IP address or the server name along with SQL server instance name. They both combined to form the host name: Data Source = ServerName\ InstanceName For each computer that will run our application, we should install the executable version on each computer. The system will be password-protected. Each user will be assigned system access privileges appropriate to its role. The system will be disconnected from World Wide Web to prevent all possible hacking and cracking from the Internet. The system will have the following roles: 1. Normal user role The normal user can do a number of tasks like preparing sale and/or purchase invoices, print reports, search for a drug and its quantity available in the inventory, add new customer and/or supplier, check payment records and check drugs that are expired in order to dispose it or drugs that will be expired after three, six or nine months in order to be sold before it became out of date. 2. Administrator role The admin can add new user to the system and give him/her a user name and password to access the system, edit employees’ salaries, in addition to all the activities that the normal user can do as described above. Fig. 3. The LAN where the proposed system is applied. • Once the user runs the application for the first time, the login form shown in fig (4) is displayed so that the user should enter his/her credentials (the username and password), if the entered information is correct; the user will login to the system and the main form shown in fig (5) is showed. There are two types of users, normal or (regular) user and admin user. • When the user selects Sale Invoice tile, the window shown in fig (6) is presented. • Using this form, the user can prepare a new sale invoice. Notice the following: • The Invoice number is generated automatically. • The pharmacy names and product or drug names are loaded from the database. • When the user selects a particular drug and its manufacturer (since different manufacturers, in different countries can produce the same drug), the unit price, the storage location and the available quantity in the inventory are displayed. The user should enter the required quantity and press “Add to Invoice”. • There are two types of payments, cash and deposit. As shown in the above figure, an invoice (no. 4) prepared in 5/8/2016, with 3 items: Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 123 1. Betazinc 100 ml susp., required quantity 50, unit price 11 $. 2. Fixef 400 mg 5 tab., required quantity 30, unit price 4.125 $. 3. Amoklavin 457 mg susp. 70 ml., required quantity 60, unit price 4 $. 4. And so on. As example, if the inventory has 350 item from (Amoklavin 457 mg susp. 70 ml.), but in two different batches, the 1 st batch with expiry date 1/2017 (quantity = 50) and the second batch with expiry date 1/2018 (quantity = 300). The application will first select the first batch; if the required quantity is larger than the available quantity in the first batch, it should select the remaining quantity from the second batch. When the user clicks Print Invoice button, a report is generated which can be viewed and saved as a pdf file or excel sheet as shown in fig (7). When the user clicks Purchase Invoice tile, the form shown in fig (8) is displayed. Here the user should enter the drug’s batch number, unit price, purchased quantity and manufacturing and expiry dates for each drug purchased from any supplier. When the user selects Products tile, a form shown in fig (9) is displayed. As example, drug named “Amoklavin 1000 mg 10 tab.”, manufactured by Deva Company, is stored in the inventory as two batches, the 1 st batch with quantity equals 200 and the 2 nd batch with quantity equals 90. There are two batches because there have different manufacturing and expiry dates. When the user clicks “Add Product”, a form as shown in fig (10) is displayed. When the user selects Employee tile, a form as shown in fig (11) is displayed. When the user selects Expired Products tile, a form as shown in fig (12) is displayed. There are a number of options, first show already expired drugs, the second one show drugs expired after one month, the third one show drugs expired after two months and so one. When the user clicks Customer Payment tile, a form as shown in fig (13) is displayed. When the user selects Restored Drugs tile, a form as shown in fig (14) is displayed. A pharmacy can restore drugs purchased from the inventory in two cases. First, when the drug is received with damages and second when the drug is no longer in use (over stock) but not expired. The inventory makes a discount for each returned batch. Fig. 4. User Login form. Fig. 5. The main form. Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 124 Fig.6. Sale invoice. Fig. 7. Sale invoice Report. Fig.8. Purchase Invoice Form. Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 125 Fig.9. Show Products Form. Fig. 10. Add New Product Form. Fig. 11. Add New Employee Form. Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 126 Fig. 12. Expired Drugs Form. Fig. 13. Customer Payment Form. Fig. 14. Restore Drugs Form. Sama Salam Samaan Al-Khwarizmi Engineering Journal, Vol. 13, No. 1, P.P. 118- 128(2017) 127 5. Conclusions In this paper, a number of necessities for an inventory management system for pharmaceutical industries are achieved: 1. Provide full information about each stored drug, its quantity, manufacturing company, batch number, manufacturing and expiry dates, storage location, storing temperature and dangerous level. 2. Older drugs are used before newer drugs when preparing a sell invoice, to ensure that products with shorter expiration dates are used before those that will last longer and minimize the number of expiring products. 3. Medications are pulled off the shelf when their expiry date approaches. The system provides information about drugs that are expired or will be expired after a certain period of time. 4. Track customer payments. 5. Restore drugs from customers that are received damaged or over stocked. 6. In addition to all the capabilities that the system user has, the administrator can: 7. Add new employees (working in the inventory) and system users (who have the necessary credentials to access the system). 8. Update employees’ information (e.g. salary, password). 6. Future Work 1. Many medications have barcodes on their packaging to allow for easy identification of the product in a computer system. Using barcode reader, medications’ barcodes can be stored for easy identification. 2. Statistical Reports can be developed to display the purchasing history of the most sold medications to appropriately manage the stored levels of these products. 3. The system can be developed to work on portable devices. 7. References [1] Taner Arsan, Emrah Baskan, Emrah Ar, Zeki Bozkus, “A Software Architecture for Inventory Management System”, 2013. [2] Katie Ingersoll,” Inventory Management for the Pharmacy Technician”, 2015. [3] Toshio Awaya, Ko-ichi Ohtaki, Takehiro Yamada, Kuniko Yamamoto, Toshiyuki Miyoshi, Yu-ichi Itagaki, Yoshikazu Tasaki, Nobumasa Hayase, Kazuo Matsubara, “Automation in Drug Inventory Management Saves Personnel Time and Budget”, Yakugaku Zasshi 125 (5) 427-432 (2005), the pharmaceutical Society of Japan. [4] Libby Levison, Hamish S F Fraser, “Requirements for an Open-Source Pharmacy Dispensing and Stores Management Softw/are Application for Developing Countries”, 2008. [5] Ramez Elmasri and Shamkant B. Navathe, "Fundamentals of Database Systems", 7th edition, book, Pearson, 2015. [6] Thomas M. Connolly and Carolyn E. Begg, “Database Systems a Practical Approach to Design, Implementation, and Management”, 6th edition, book, Pearson, 2014. ���� 1، ا���د�13� � ا���ارزم� ا������� ا��� م ��� ����ن ��م ،2017( 128-118( 128 م$,+ ادو*� (دارة%)��' و%���$ �#�م "�!�ة �����ت ��� ��م ����ن ا����� ا��������� /�� ھ� � ا�����ب ا�����و����� samasamaan@yahoo.com: ا� �� ا��� � *��0 ھ ا ا��'�م .و*��0 ه ا�, ف ا���س �, ا ا��)+ ھ� *()� �'�م ��% ة $����ت �دارة � �� ادو*1� ة $����ت *�5)3 �����4ت %3 ط�%�� 14� *���>ت �; ا�) ��، ا�)�,:�3، ا�)�ظ3�0، ا� �7%�ت و��6ھ�,� � 3� ة ا������ت * ر$A . *?@ ا�دو� ا�)���7ة �7 ا�)?:ن، �����4ت ا�:$�=3 ا� %�� B�=ا�� C�������$ D� ام ?���$C sharp .���G �����4ت ا�)�,:�3 ان ا��'�م ا�)��Fح �7 ادارة %)��4ت ا�)?:ن وا��� *�5)3 ا7�H او *�%���I ان . �M ��Dض ا*>7,�وا�)�ظ3�0 وا�:$�=3 وا�دو� ، ا% اد �7ا*�� ا���; وا��Kاء وط��% ا���Fر��، ���$� د�7%�ت ا�:$�=3 وا���1F �3 ا�دو� ���,� ا�(> +(% N�$ ��7��� م ?���� و��� ��)��4ت ا���; وا��Kاء وادارة ا��)+ $��0ءة $��+ �, �)�3ھ ا ا��'�م ����.