Beispiel #1
0
        public InvoiceViewModel(int AppointmentId)
        {
            InvoiceDetails invoiceDetails = new InvoiceDetails();

            Diagnosis = invoiceDetails.GetDiagnosis(AppointmentId);
            Invoice   = invoiceDetails.GetInvoiceDetails(AppointmentId);
            if (Invoice == null)
            {
                invoiceDetails.GenerateInvoice(AppointmentId);
                Invoice = invoiceDetails.GetInvoiceDetails(AppointmentId);
            }
            Medicines = invoiceDetails.GetMedicineListForInvoice(Diagnosis.Id);
            Tests     = invoiceDetails.GetTestListForInvoice(Diagnosis.Id);

            this.DoctorFee = Invoice.TotalCost - (Medicines.Sum(t => t.Medicines.Cost * t.Quantity) + Tests.Sum(t => t.Tests.Cost));

            Age = invoiceDetails.GetAge(Invoice.Appointment.Patient.DateOfBirth);
        }