/// <summary>
 /// Constructor Method
 /// </summary>
 /// <param name="listhold"></param>
 public Pharmacist(ListHolder listhold, ListHolder.Usertype value)
 {
     InitializeComponent();
     ParentListHolder = listhold;
     ParentListHolder.Initialise(); //Loads Stock Control Method
     usertype = value;
 }
Exemple #2
0
        ListHolder.Usertype usertype;                                        //Users Type

        public AddPrescription(ListHolder holder, ListHolder.Usertype value) //Constructor Method
        {
            InitializeComponent();
            parentlistholder = holder;                  //Loads in ListHolder
            parentlistholder.Initialise();              // Loads in Dodgy Bobs Stock Control System
            adddoc   = new AddDoctor(parentlistholder); //Create a Instance of the AddDoctor Form
            usertype = value;
        }
        /// <summary>
        /// Form Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManagementReport_Load(object sender, EventArgs e)
        {
            ReadPrescriptionsFile(); //Read in the prescription into the list
            ReadDoctorFile();        //Read Doctors

            #region Total sold by each doctor
            for (int i = 0; i < DoctorSoldView.Items.Count; i++)                                  //For Every Doctor
            {
                foreach (Prescription node in PrescriptionsList)                                  //For Each Prescription
                {
                    string doctorname          = node.GetDoctorName();                            //Get Prescriptions Doctor Name
                    string doctortocomparewith = DoctorSoldView.Items[i].Text;                    //Get Doctor in the Lists Name
                    if (doctorname.Equals(doctortocomparewith))                                   //See If they are the same
                    {
                        double addprice = double.Parse(DoctorSoldView.Items[i].SubItems[1].Text); //Get Doctor in the lists total
                        addprice += double.Parse(node.GetPrice());                                //Add Prescription Total to It
                        DoctorSoldView.Items[i].SubItems[1].Text = addprice.ToString();           //Write it back
                    }
                }
            }
            #endregion


            #region Add Items to Listview
            prescriptions.Initialise();                                       //Loads in Items from stock control
            string[] Items   = DodgyBobStockControl.StockControl.GET_ITEMS(); //Makes an string array containing the items
            int      Counter = 0;                                             //Counter variable
            foreach (string name in Items)                                    //For Every item in the list
            {
                ItemQuantitySold.Items.Add(name);                             //Add Item Name to the List
                ItemQuantitySold.Items[Counter].SubItems.Add("0");            //Set Quantity Sold as 0
                Counter++;                                                    //Move to Next Item
            }
            #endregion

            #region Total Items Sold
            foreach (Prescription node in PrescriptionsList)                                                      //Go through each prescription
            {
                Counter = 0;                                                                                      //Resuing variable
                foreach (string itemname in node.ItemName)                                                        //Go Throught each item in the prescription
                {
                    string PrescriptionItemName = node.ItemName[Counter];                                         //Sets as the Prescription Item Name
                    for (int ListViewPos = 0; ListViewPos < ItemQuantitySold.Items.Count; ListViewPos++)          //Each Item in the list view
                    {
                        string ItemInTheTableName = ItemQuantitySold.Items[ListViewPos].Text;                     //Sets as Item In The Tables Name

                        if (ItemInTheTableName.Equals(PrescriptionItemName))                                      //If the current Item in the list view is the same as the current item in the prescription
                        {
                            double Quantity = double.Parse(ItemQuantitySold.Items[ListViewPos].SubItems[1].Text); //Get Quantity Sold from the list
                            Quantity += int.Parse(node.Quantity[Counter]);                                        //Adds Amount Sold to Total
                            ItemQuantitySold.Items[ListViewPos].SubItems[1].Text = Quantity.ToString();           //write it back
                        }
                    }
                    Counter++;
                }
            }
            #endregion
        }
 /// <summary>
 /// Form Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void StockControl_Load(object sender, EventArgs e)
 {
     parentlistholder.Initialise();                                                                       //Load Stock Control
     string[] itemnames = DodgyBobStockControl.StockControl.GET_ITEMS();                                  //Get List of Items
     for (int i = 0; i < itemnames.Length; i++)                                                           //For Every Item
     {
         ItemsListView.Items.Add(itemnames[i].ToString());                                                //Add Item Name to the List
         string quan = DodgyBobStockControl.StockControl.ASK("'" + itemnames[i] + "' stockcheck please"); //Check the amount of that item in stock
         //in format: we have 100 in stock
         quan = quan.Substring(8);                                                                        // Gets rid of "We Have "
         string[] tempvalues = quan.Split(' ');                                                           //Splits the string at " "'s
         quan = tempvalues[0];                                                                            //Gets the values before the space
         ItemsListView.Items[i].SubItems.Add(quan);                                                       //Adds Quantity to List
         string price = DodgyBobStockControl.StockControl.ASK("'" + itemnames[i] + "' cost please");      //Gets the price of the item
         ItemsListView.Items[i].SubItems.Add(price);                                                      //Adds Price to List
         string expiry = DodgyBobStockControl.StockControl.ASK("'" + itemnames[i] + "' expiry please");   //Gets Expiry Date
         //In Format: it will expire on ##/##/####
         expiry = expiry.Substring(14);                                                                   //Shorted to just ##/##/####
         ItemsListView.Items[i].SubItems.Add(expiry);                                                     //Shortens Expiry Date
     }
     UpdateColumnSize();                                                                                  //Update Column Size
 }