meta data de esta página
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
| 
                    ejemploenviarfactura [2022/03/29 19:52] scastillo  | 
                
                    ejemploenviarfactura [2024/03/30 08:56] (actual) 47.128.21.134 se ha restaurado la vieja versión (2022/03/29 19:44)  | 
            ||
|---|---|---|---|
| Línea 4: | Línea 4: | ||
| <code csharp Enviar> | <code csharp Enviar> | ||
| - | try | + | var url = " | 
| - | { | + | |
| - |                 Cuerpo cuerpo  | + | |
| - | { | + | |
| - | token = textBox161.Text, | + | |
| - | documentoElectronico = new DocumentoElectronico() | + | |
| - | }; | ||
| - |                 cuerpo.documentoElectronico.encabezado  | + |             Autent autenticacion  | 
| - | { | + | |
| - | identificacionDocumento = new IdentificacionDocumento() | + | |
| - | { | + | |
| - |                         tipoDocumento = textBox4.Text, | + | |
| - |                         ncf = textBox5.Text, | + | |
| - |                         fechaVencimientoSecuencia = textBox6.Text, | + | |
| - |                         indicadorEnvioDiferido = textBox7.Text, | + | |
| - |                         indicadorMontoGravado = textBox8.Text, | + | |
| - |                         tipoIngresos = textBox10.Text, | + | |
| - |                         tipoPago = textBox11.Text, | + | |
| - |                         tablaFormasPago = new List< | + | |
| - | + | ||
| - | + | ||
| - | }, | + | |
| - | emisor = new Emisor() | + | |
| - | { | + | |
| - |                         rnc = textBox19.Text, | + | |
| - |                         razonSocial = textBox20.Text, | + | |
| - |                         nombreComercial = textBox21.Text, | + | |
| - |                         sucursal = textBox22.Text, | + | |
| - |                         direccion = textBox23.Text, | + | |
| - |                         municipio = textBox24.Text, | + | |
| - |                         provincia = textBox25.Text, | + | |
| - |                         tablaTelefono = new List< | + | |
| - |                         correo = textBox26.Text, | + | |
| - |                         webSite = textBox27.Text, | + | |
| - |                         codigoVendedor = textBox29.Text, | + | |
| - |                         numeroFacturaInterna = textBox30.Text, | + | |
| - |                         numeroPedidoInterno = textBox31.Text, | + | |
| - |                         zonaVenta = textBox32.Text, | + | |
| - |                         // | + | |
| - |                         fechaEmision = dateTimePicker1.Value.ToShortDateString().Replace("/"," | + | |
| - | }, | + | |
| - | + | ||
| - | + | ||
| - | comprador = new Comprador() | + | |
| - | { | + | |
| - |                         rnc = textBox39.Text, | + | |
| - |                         razonSocial = textBox41.Text, | + | |
| - |                         contacto = textBox42.Text, | + | |
| - |                         correo = textBox43.Text, | + | |
| - |                         direccion = textBox44.Text, | + | |
| - |                         municipio = textBox45.Text, | + | |
| - |                         provincia = textBox46.Text, | + | |
| - |                         pais = textBox47.Text, | + | |
| - |                         fechaEntrega = textBox48.Text, | + | |
| - |                         fechaOrden = textBox52.Text, | + | |
| - |                         numeroOrden = textBox53.Text, | + | |
| - |                         codigoInterno = textBox54.Text, | + | |
| - | + | ||
| - | }, | + | |
| - | informacionesAdicionales = new InformacionesAdicionales() | + | |
| - | { | + | |
| - |                         numeroContenedor = textBox59.Text, | + | |
| - |                         numeroReferencia = textBox60.Text, | + | |
| - | }, | + | |
| - | + | ||
| - | totales = new Totales() | + | |
| - | { | + | |
| - |                         montoGravadoTotal = textBox94.Text, | + | |
| - |                         montoGravadoI1 = textBox95.Text, | + | |
| - |                         itbiS1 = textBox99.Text, | + | |
| - |                         totalITBIS = textBox102.Text, | + | |
| - |                         totalITBIS1 = textBox103.Text, | + | |
| - |                         montoTotal = textBox107.Text, | + | |
| - | }, | + | |
| - | + | ||
| - | }; | + | |
| - | TablaFormasPago item = new TablaFormasPago() | + | |
| - | { | + | |
| - |                     forma = " | + | |
| - | monto = textBox107.Text | + | |
| - | }; | + | |
| - | + | ||
| - | + | ||
| - |                 cuerpo.documentoElectronico.encabezado.identificacionDocumento.tablaFormasPago.Add(item); | + | |
| - | + | ||
| - | + | ||
| - |                 cuerpo.documentoElectronico.encabezado.emisor.tablaTelefono.Add(" | + | |
| - |                 cuerpo.documentoElectronico.encabezado.emisor.tablaTelefono.Add(" | + | |
| - | + | ||
| - | DetallesItem detalles = new DetallesItem() | + | |
| - | { | + | |
| - |                     numeroLinea = " | + | |
| - |                     indicadorFacturacion = " | + | |
| - |                     nombre = "ASW DTU", | + | |
| - |                     indicadorBienoServicio = " | + | |
| - |                     cantidad = " | + | |
| - |                     unidadMedida = " | + | |
| - |                     precioUnitario = " | + | |
| - |                     monto = " | + | |
| - |                     descripcion=" | + | |
| - | + | ||
| - | }; | + | |
| - | + | ||
| - |                 | + | |
| - | edit.Visible = true; | + | |
| - |                 edit.Name = " | + | |
| - |                 edit.Text = " | + | |
| - | edit.UseColumnTextForButtonValue = true; | + | |
| - | + | ||
| - |                 dataGridView1.Columns.Add(edit); | + | |
| - | + | ||
| - | detallesItemBindingSource.DataSource = detalles; | + | |
| - |                 cuerpo.documentoElectronico.detallesItems = new List< | + | |
| - |                 cuerpo.documentoElectronico.detallesItems.Add(detalles); | + | |
| - |                 HttpClient cliente = new HttpClient(); | + | |
| - |                 cliente.BaseAddress = new Uri(" | + | |
| - |                 cliente.DefaultRequestHeaders.Add(" | + | |
| - |                 string jsonObject = JsonSerializer.Serialize(cuerpo); | + | |
| - |                 var content = new StringContent(jsonObject.ToString(), | + | |
| - |                 var resp = cliente.PostAsync(" | + | |
| - |                 var resultado = resp.Content.ReadAsStringAsync();  | + | |
| - |                 string dame = resultado.Result; | + | |
| - |                 var Respuesta = JsonSerializer.Deserialize< | + | |
| - | if (Respuesta.procesado == true) | + | |
| - | { | + | |
| - |                     richTextBox1.Text = Respuesta.codigo.ToString() + " | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - |                     richTextBox1.Text = Respuesta.codigo.ToString() + " | + | |
| - | + | ||
| - | } | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | } | + | |
| - | + | ||
| - | catch (Exception b) | + | |
| { | { | ||
| - |                  | + |                  | 
| - |                  | + |                 clave = " | 
| - | } | + |                 usuario  | 
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | Donde se encuentran las siguientes clases: | + | |
| - | + | ||
| - | <code csharp Clases > | + | |
| - |   | + | |
| - | { | + | |
| - | public string rnc { get; set; } | + | |
| - |         public string  | + | |
| - |          | + | |
| - |      | + |              | 
| + |             var resultado = Post(autenticacion, | ||
| - |   | + |              | 
| - | { | + |              | 
| - | public string token { get; set; } | + | |
| - |          | + | |
| - | public double codigo { get; set; } | ||
| - | public string mensaje { get; set; } | ||
| - | } | + |             textBox161.Text = Respuesta.token; | 
| </ | </ | ||