public AddEditTreatmentPaymentModal(Model.TreatmentPayment treatment, TreatmentPriceControl treatmentControl)
		{
			this.InitializeComponent();

            cbDiscount.SelectedIndex = 0;
            _treatmentControl = treatmentControl;
            _treatment = treatment;
            _isUpdateTreatment = _treatment != null;
            
            if (_isUpdateTreatment)
            {
                PrepareWindowForUpdates();
                UpdateTotalFieldChanged();
            }
		}
        private void FillTreatments()
        {
            List<Model.TreatmentPayment> treatments = _statement.TreatmentPayments
                                                .OrderByDescending(p => p.TreatmentDate)
                                                .ToList();

            foreach (var treatment in treatments)
            {
                TreatmentPriceControl treatmentControl = new TreatmentPriceControl(treatment)
                {
                    Width = Double.NaN
                };

                spTreatments.Children.Add(treatmentControl);
            }
        }
        private void btnAddTreatment_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (_selectedPatient == null)
            {
                MessageBox.Show("Seleccione un paciente", "Información", MessageBoxButton.OK, MessageBoxImage.Information);    
            }
            else if (_statement != null && _statement.ExpirationDate < DateTime.Now.Date)
            {
                MessageBox.Show("No puede agregar tratamientos a un estado de cuenta vencido", "Información", MessageBoxButton.OK, MessageBoxImage.Information);    
            }
            else
            {
                TreatmentPriceControl treatmentControl = new TreatmentPriceControl();
                treatmentControl.OnTreatmentDeleted += treatmentControl_OnTreatmentDeleted;
                treatmentControl.OnTreatmentEdited += treatmentControl_OnTreatmentEdited;

                new AddEditTreatmentPaymentModal(null, treatmentControl).ShowDialog();

                if (treatmentControl.TreatmentPayment != null)
                {
                    spTreatments.Children.Insert(0, treatmentControl);
                    UpdateTotals();

                    CheckIfTransactionCanBeFinished();
                }
            }            
        }