/// <summary>
        /// Metodo de carga de registros en la grilla
        /// </summary>
        private void cs_pxCargarDgvComprobanteselectronicos()
        {
            dgDocumentos.ItemsSource = null;
            dgDocumentos.Items.Clear();
            //Obtener los comprobantes de factura.
            registros     = new clsEntidadDocument(localDB).cs_pxObtenerActivosValidado(Ruc);
            lista_reporte = new List <DocumentoValidar>();
            //lista_reporte = new ObservableCollection<Reporte>();
            if (registros != null)
            {
                //Recorrer los registros para llenar la grilla.
                foreach (var item in registros)
                {
                    itemRow                    = new DocumentoValidar();
                    itemRow.Id                 = item.Cs_pr_Document_Id;
                    itemRow.Tipo               = item.Cs_tag_InvoiceTypeCode;
                    itemRow.SerieNumero        = item.Cs_tag_ID;
                    itemRow.FechaEmision       = item.Cs_tag_IssueDate;
                    itemRow.Ruc                = item.Cs_tag_AccountingCustomerParty_CustomerAssignedAccountID;
                    itemRow.RucEmisor          = item.Cs_tag_AccountingSupplierParty_CustomerAssignedAccountID;
                    itemRow.RazonSocial        = item.Cs_tag_AccountingSupplierParty_Party_PartyLegalEntity_RegistrationName;
                    itemRow.Comentario         = item.Cs_pr_ComentarioSUNAT;
                    itemRow.TipoTexto          = clsBaseUtil.cs_fxComprobantesElectronicos_descripcion(item.Cs_tag_InvoiceTypeCode);
                    itemRow.EstadoValidarTexto = clsBaseUtil.cs_fxComprobantesEstadosValidar_Descripcion(Convert.ToInt16(item.Cs_pr_EstadoValidar)).ToUpper();
                    itemRow.EstadoValidar      = item.Cs_pr_EstadoValidar;
                    itemRow.Monto              = item.Cs_tag_LegalMonetaryTotal_PayableAmount_currencyID;
                    itemRow.NumeroRelacionado  = item.Cs_tag_BillingReference_ID;
                    itemRow.TipoRelacionado    = item.Cs_tag_BillingReference_DocumentTypeCode;
                    lista_reporte.Add(itemRow);
                }
            }

            dgDocumentos.ItemsSource    = lista_reporte;
            lblNumeroDocumentos.Content = "Existen " + lista_reporte.Count + " documentos listados.";
        }
        /// <summary>
        /// Evento al culminar la edicion de una celda en la grilla
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgDocumentos_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            DataGridRow        item        = e.Row;
            DocumentoValidar   comprobante = (DocumentoValidar)item.DataContext;
            clsEntidadDocument doc         = new clsEntidadDocument(localDB).cs_fxObtenerUnoPorId(comprobante.Id);

            doc.Cs_pr_ComentarioSUNAT = comprobante.Comentario;
            doc.cs_pxActualizar(false, false);
            // System.Windows.Forms.MessageBox.Show(comprobante.SerieNumero + " s " + comprobante.Comentario);
        }
        private void chkDiscontinue_Unchecked(object sender, RoutedEventArgs e)
        {
            //Obtener el elemento seleccionado.
            System.Windows.Controls.CheckBox checkBox = (System.Windows.Controls.CheckBox)e.OriginalSource;
            //Obtener la fila seleccionada y objeto asociado.
            DataGridRow      dataGridRow = VisualTreeHelpers.FindAncestor <DataGridRow>(checkBox);
            DocumentoValidar comprobante = (DocumentoValidar)dataGridRow.DataContext;

            if ((bool)checkBox.IsChecked == false)
            {
                comprobante.Check = false;
            }
            e.Handled = true;
        }