public async Task <IActionResult> Create(EstadoComprobante estadoComprobante) { if (!ModelState.IsValid) { return(BadRequest()); } await _estadoComprobanteServicio.Create(estadoComprobante); return(Ok(estadoComprobante)); }
private void RenderFactura() { try { fac = null; using (db_FacturaDigital db = new db_FacturaDigital()) { fac = db.Factura.AsNoTracking().Include("Factura_Detalle").FirstOrDefault(q => q.Id_Factura == IdFactura); } if (fac == null) { MessageBox.Show("Factura no encontrada", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } EstadoComprobante estado = (EstadoComprobante)fac.Estado; txt_CCorreo.Text = fac.Receptor_CorreoElectronico; txt_CIdentificacion.Text = fac.Receptor_Identificacion_Numero; txt_Ctelefono.Text = fac.Receptor_Telefono_Numero.ToString(); txt_CNombre.Text = fac.Receptor_Nombre; Txt_Estado.Text = estado.GetAttribute <DescriptionAttribute>().Description; txt_Consecutivo.Text = fac.NumeroConsecutivo.ToString(); txt_Fecha.Text = fac.Fecha_Emision_Documento.ToString(); tb_Clave.Text = fac.Clave; dg_detalleFactura.ItemsSource = fac.Factura_Detalle; txt_SubTotal.Text = fac.TotalVentaNeta.ToString(); txt_Descuento.Text = fac.TotalDescuentos.ToString(); txt_Impuesto.Text = fac.TotalImpuesto.ToString(); txt_Total.Text = fac.TotalComprobante.ToString(); List <XmlHacienda> XmlHacienda = new List <XmlHacienda>(); if (!string.IsNullOrEmpty(fac.XML_Enviado)) { XmlHacienda.Add(new XmlHacienda() { Tipo = "Enviado", XmlUrl = fac.XML_Enviado }); } if (!string.IsNullOrEmpty(fac.XML_Respuesta)) { XmlHacienda.Add(new XmlHacienda() { Tipo = "Respuesta", XmlUrl = fac.XML_Respuesta }); } lb_xmls.ItemsSource = XmlHacienda; if (estado == EstadoComprobante.Anulando || estado == EstadoComprobante.ErrorAnulando) { using (db_FacturaDigital db = new db_FacturaDigital()) { Factura Anulada = db.Factura.AsNoTracking().FirstOrDefault(q => q.InformacionReferencia_IdFactura == fac.Id_Factura); if (Anulada != null) { txt_MotivoAnulacion.Text = Anulada.InformacionReferencia_Razon; btn_Anular.IsEnabled = false; txt_MotivoAnulacion.IsReadOnly = true; if (!string.IsNullOrEmpty(Anulada.XML_Enviado)) { XmlHacienda.Add(new XmlHacienda() { Tipo = "Anulacion Enviada", XmlUrl = Anulada.XML_Enviado }); } if (!string.IsNullOrEmpty(Anulada.XML_Respuesta)) { XmlHacienda.Add(new XmlHacienda() { Tipo = "Anulacion Respuesta", XmlUrl = Anulada.XML_Respuesta }); } txt_ConsecutivoNotaCredito.Text = Anulada.Clave; txt_FechaNotaCredito.Text = Anulada.Fecha_Emision_Documento.ToString(); DetalleNomtaCreditoPanel.Visibility = Visibility.Visible; } } } } catch (Exception ex) { MessageBox.Show("Error al cargar los datos de factura", "Error", MessageBoxButton.OK, MessageBoxImage.Error); this.LogError(ex); } }