private void XMLRecepcion_Click(object sender, RoutedEventArgs e) { try { ReporteRetention item = (ReporteRetention)dgComprobantesFactura.SelectedItem; if (item != null) { clsEntityRetention cabecera = new clsEntityRetention(localDB).cs_fxObtenerUnoPorId(item.Id); SaveFileDialog sfdDescargar = new SaveFileDialog(); DialogResult result = sfdDescargar.ShowDialog(); if (result == DialogResult.OK) { string file = sfdDescargar.FileName; if (file.Substring(file.Length - 4) != ".xml") { file = file + ".xml"; } try { StreamWriter sw0 = new StreamWriter(file); sw0.Write(cabecera.Cs_pr_CDR); sw0.Close(); } catch (IOException) { } } } } catch (Exception ex) { clsBaseLog.cs_pxRegistarAdd("xml recep gen" + ex.ToString()); } }
//Cristhian|30/10/2017|FEI2-410 /*Se obtine la lista de los comprobantes de retención*/ /*NUEVO INICIO*/ private void cs_pxCargarDgvComprobanteselectronicos(string estadocomprobantescc, string estadocomprobantesunat, string fechainicio, string fechafin) { dgComprobantesFactura.ItemsSource = null; dgComprobantesFactura.Items.Clear(); //Obtener los comprobantes de factura. registros = new clsEntityRetention(localDB).cs_pxObtenerFiltroPrincipal(estadocomprobantesunat, estadocomprobantescc, fechainicio, fechafin); lista_reporte = new List <ReporteRetention>(); if (registros != null) { //Recorrer los registros para llenar la grilla. foreach (var item in registros) { itemRow = new ReporteRetention(); itemRow.Id = item.Cs_pr_Retention_id; itemRow.SerieNumero = item.Cs_tag_Id; itemRow.FechaEmision = item.Cs_tag_IssueDate; itemRow.FechaEnvio = item.Cs_pr_FechaEnvio; itemRow.Ruc = item.Cs_tag_ReceiveParty_PartyIdentification_Id; itemRow.RazonSocial = item.Cs_tag_ReceiveParty_PartyLegalEntity_RegistrationName; itemRow.Comentario = item.Cs_pr_ComentarioSUNAT; itemRow.Reversion = item.Cs_pr_Reversion; itemRow.ReversionAnterior = item.Cs_pr_Reversion_Anterior; itemRow.MontoRetencion = item.Cs_tag_TotalInvoiceAmount; itemRow.MontoTotal = item.Cs_tag_TotalPaid; itemRow.EstadoSCC = clsBaseUtil.cs_fxComprobantesEstadosSCC_descripcion(Convert.ToInt16(item.Cs_pr_EstadoSCC)).ToUpper(); itemRow.EstadoSunat = clsBaseUtil.cs_fxComprobantesEstadosSUNAT_descripcion(Convert.ToInt16(item.Cs_pr_EstadoSUNAT)).ToUpper(); lista_reporte.Add(itemRow); } } dgComprobantesFactura.ItemsSource = lista_reporte; }
//Evento Uncheck de los items en la grilla. private void chkDiscontinue_Unchecked(object sender, RoutedEventArgs e) { //Obtener elemento seleccionado. System.Windows.Controls.CheckBox checkBox = (System.Windows.Controls.CheckBox)e.OriginalSource; //Obtener objeto asociado a elemento seleccinado DataGridRow dataGridRow = VisualTreeHelpers.FindAncestor <DataGridRow>(checkBox); ReporteRetention doc = (ReporteRetention)dataGridRow.DataContext; if ((bool)checkBox.IsChecked == false) { doc.Check = false; } e.Handled = true; }
//Evento para agregar motivos de baja en los comprobantes. private void MenuItem_Click(object sender, RoutedEventArgs e) { try { ReporteRetention item = (ReporteRetention)dgComprobantes.SelectedItem; if (item != null) { List <string> motivo = new clsEntityVoidedDocuments_VoidedDocumentsLine(localDB).cs_fxObtenerUnoPorDocumentoPrincipalYDocumentoRelacionado(item.Id, item.Reversion); BajaMotivo bajaMotivo = new BajaMotivo(motivo[0], localDB); bajaMotivo.ShowDialog(); refrescarGrillaDocumentos(item.Reversion); } } catch (Exception ex) { clsBaseLog.cs_pxRegistarAdd("motivo baja " + ex.ToString()); } // DataGridRow filaseleccionada =(DataGridRow) dgComprobantes.SelectedItem; }
private void DetalleItem_Click(object sender, RoutedEventArgs e) { try { ReporteRetention item = (ReporteRetention)dgComprobantesFactura.SelectedItem; if (item != null) { //frmDetalleComprobante Formulario = new frmDetalleComprobante(item.Id); // Formulario.ShowDialog(); // if (Formulario.DialogResult.HasValue && Formulario.DialogResult.Value) // { //cargarDataGrid(); // } // refrescarGrillaDocumentos(item.ComunicacionBaja); } } catch (Exception ex) { clsBaseLog.cs_pxRegistarAdd("detalle item " + ex.ToString()); } }
//Evento para cargar documentos segun comunicacion de baja. private void cs_pxCargarDgvComprobanteselectronicosPorBaja(string IdBaja) { //Limpiar lista de comprobantes de la grilla. dgComprobantes.ItemsSource = null; dgComprobantes.Items.Clear(); //Obtener los documentos asociados a la comunicacion de baja. documentos = new clsEntityRetention(localDB).cs_pxObtenerDocumentosPorComunicacionBaja_n(IdBaja); lista_documentos = new List <ReporteRetention>(); if (documentos != null) { //Recorrer los registros obtenidos para rellenar la grilla. foreach (var item in documentos) { itemComprobante = new ReporteRetention(); itemComprobante.Id = item.Cs_pr_Retention_id; itemComprobante.SerieNumero = item.Cs_tag_Id; itemComprobante.FechaEmision = item.Cs_tag_IssueDate; itemComprobante.FechaEnvio = item.Cs_pr_FechaEnvio; itemComprobante.Ruc = item.Cs_tag_ReceiveParty_PartyIdentification_Id; itemComprobante.RazonSocial = item.Cs_tag_ReceiveParty_PartyLegalEntity_RegistrationName; itemComprobante.Comentario = item.Cs_pr_ComentarioSUNAT; itemComprobante.Reversion = IdBaja; itemComprobante.EstadoSCC = clsBaseUtil.cs_fxComprobantesEstadosSCC_descripcion(Convert.ToInt16(item.Cs_pr_EstadoSCC)).ToUpper(); itemComprobante.EstadoSunat = clsBaseUtil.cs_fxComprobantesEstadosSUNAT_descripcion(Convert.ToInt16(item.Cs_pr_EstadoSUNAT)).ToUpper(); List <string> voided = new clsEntityVoidedDocuments_VoidedDocumentsLine(localDB).cs_fxObtenerUnoPorDocumentoPrincipalYDocumentoRelacionado(item.Cs_pr_Retention_id, itemComprobante.Reversion); if (voided != null) { itemComprobante.MotivoReversion = voided[1];//Motivo de baja de comprobantes } else { itemComprobante.MotivoReversion = "";//Motivo de baja de comprobantes } lista_documentos.Add(itemComprobante); } } dgComprobantes.ItemsSource = lista_documentos; }
//Metodo para cargar la grilla del listado de comprobantes. private void cs_pxCargarDgvComprobanteselectronicos(string fechainicio, string fechafin) { dgComprobantesFactura.ItemsSource = null; dgComprobantesFactura.Items.Clear(); //Obtener los registros para facturas. registros = new clsEntityRetention(localDB).cs_pxObtenerFiltroPrincipal("2", "0", fechainicio, fechafin); lista_reporte = new List <ReporteRetention>(); //Recorrer los registros para rellenar el grid. if (registros != null) { foreach (var item in registros) { clsEntityRetention_RetentionLine RetentionLine = new clsEntityRetention_RetentionLine(localDB).cs_fxObtenerUnoPorCabeceraId(item.Cs_pr_Retention_id); itemRow = new ReporteRetention(); itemRow.Id = item.Cs_pr_Retention_id; itemRow.SerieNumero = item.Cs_tag_Id; itemRow.FechaEmision = item.Cs_tag_IssueDate; itemRow.FechaEnvio = item.Cs_pr_FechaEnvio; itemRow.Ruc = item.Cs_tag_ReceiveParty_PartyIdentification_Id; itemRow.RazonSocial = item.Cs_tag_ReceiveParty_PartyLegalEntity_RegistrationName; itemRow.Comentario = item.Cs_pr_ComentarioSUNAT; itemRow.Reversion = item.Cs_pr_Reversion; itemRow.ReversionAnterior = item.Cs_pr_Reversion_Anterior; itemRow.SerieNumeroRelacionado = RetentionLine.Cs_tag_Id; itemRow.TipoRelacionado = RetentionLine.Cs_tag_Id_SchemeId; itemRow.MontoPago = RetentionLine.Cs_tag_Payment_PaidAmount; itemRow.MontoRetencion = RetentionLine.Cs_tag_SUNATRetentionInformation_SUNATRetentionAmount; itemRow.MontoTotal = RetentionLine.Cs_tag_SUNATRetentionInformation_SUNATNetTotalPaid; itemRow.TipoTextoRelacionado = clsBaseUtil.cs_fxComprobantesElectronicos_descripcion(RetentionLine.Cs_tag_Id_SchemeId); itemRow.EstadoSCC = clsBaseUtil.cs_fxComprobantesEstadosSCC_descripcion(Convert.ToInt16(item.Cs_pr_EstadoSCC)).ToUpper(); itemRow.EstadoSunat = clsBaseUtil.cs_fxComprobantesEstadosSUNAT_descripcion(Convert.ToInt16(item.Cs_pr_EstadoSUNAT)).ToUpper(); lista_reporte.Add(itemRow); } } dgComprobantesFactura.ItemsSource = lista_reporte; }
private void XMLEnvio_Click(object sender, RoutedEventArgs e) { try { ReporteRetention item = (ReporteRetention)dgComprobantesFactura.SelectedItem; if (item != null) { SaveFileDialog sfdDescargar = new SaveFileDialog(); DialogResult result = sfdDescargar.ShowDialog(); if (result == DialogResult.OK) { string file = sfdDescargar.FileName; if (file.Substring(file.Length - 4) != ".xml") { file = file + ".xml"; } try { string xml = string.Empty; xml = new clsNegocioCERetention(localDB).cs_pxGenerarXMLAString(item.Id); StreamWriter sw0 = new StreamWriter(file); sw0.Write(xml); sw0.Close(); } catch (Exception ex) { clsBaseLog.cs_pxRegistarAdd("generar xml envio " + ex.ToString()); } } } } catch (Exception ex) { clsBaseLog.cs_pxRegistarAdd("xml envio gen " + ex.ToString()); } }