/// <summary>
        /// Function to generate bill again the current pateint.
        /// Also saves the selected medicines against this bill.
        /// </summary>
        /// <param name="Curent Patient ID"></param>
        /// <param name="Array of Medicines IDs"></param>
        private void generateBill(int savedPatientID, int[] medIDs)
        {
            var bill = new Bill();

            bill.BillAmount = this.billAmount;
            bill.BillDate   = datePickerAppointment.Value;
            bill.PatientID  = savedPatientID;

            var billform = new BillForm(txtPatName.Text, billAmount, datePickerAppointment.Value.ToString());

            if (billform.ShowDialog() == DialogResult.Yes)
            {
                bill.BillStatus = true;
            }
            else
            {
                bill.BillStatus = false;
            }

            int savedBillID = processPatient.SaveBill(bill);

            //Save bill-medicines data.
            BillMedicine billMedicine;

            foreach (var item in medIDs)
            {
                billMedicine = new BillMedicine()
                {
                    BilIID = savedBillID, MedicineID = item
                };
                processPatient.BillToMedicines(billMedicine);
            }
        }
Exemplo n.º 2
0
        public static BillForm Instance(string Name, decimal BillAmount, string time)
        {
            if (_Instance == null)
            {
                _Instance = new BillForm(Name, BillAmount, time);
            }

            return(_Instance);
        }
        private void gridViewMedicines_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            lblStatus.Text = "Please Wait.....";
            int MedID = Convert.ToInt32(gridViewMedicines[0, e.RowIndex].Value);
            var model = medicineProcess.getMedicineByID(MedID);

            //context.Medicines.Where(m => m.ID == MedID).First();


            medicineProcess.UpdateMedicine(model, false);

            this.Close();
            BillForm.Instance("", model.MedSellPrice.Value, DateTime.Now.ToString()).ShowDialog();


            lblStatus.Text = "Deducted Successfully";
        }