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 | ||
|
enviarfactura [2026/06/05 03:09] 104.23.197.88 se ha restaurado la vieja versión (2026/05/27 18:44) |
enviarfactura [2026/07/31 20:08] (actual) 172.70.108.196 se ha restaurado la vieja versión (2026/03/29 03:23) |
||
|---|---|---|---|
| Línea 15: | Línea 15: | ||
| == OBJETO EJEMPLO == | == OBJETO EJEMPLO == | ||
| + | |||
| + | (Solo rellenar los nodos que consideren necesarios y que apliquen para su modelo de Factura) | ||
| <code xml> | <code xml> | ||
| Línea 40: | Línea 42: | ||
| < | < | ||
| </ | </ | ||
| + | < | ||
| </ | </ | ||
| < | < | ||
| Línea 376: | Línea 379: | ||
| ---- | ---- | ||
| + | === Proceso para consumo EnviarFactura === | ||
| + | |||
| + | * Se inicializa un objeto ServiceClient o Servicio | ||
| + | * Se inicializa un objeto PeticionFactura donde se ingresan el RUC, el usuario de Integración ,clave de Integración y Documento | ||
| + | * Se hace consumo del método EnviarFactura contenido en el objeto serviceClient y se coloca como parámetro la petición anterior, la respuesta estará contenida en un objeto llamado RepuestaPeticion, | ||
| + | |||
| + | <code csharp Codigo Ejemplo .NET> | ||
| + | try | ||
| + | { | ||
| + | | ||
| + | PeticionFactura pet = new PeticionFactura(); | ||
| + | Factura fact = new Factura(); | ||
| + | |||
| + | | ||
| + | // | ||
| + | InfoTributaria infotrib = new InfoTributaria(); | ||
| + | fact.InfoTributaria = InformacionTrib(); | ||
| + | pet.Documento = fact; | ||
| + | fact.Version = textBox20.Text; | ||
| + | fact.CorreoNotificar = textBox76.Text; | ||
| + | fact.Notificar = " | ||
| + | fact.DirCliente = " | ||
| + | |||
| + | // | ||
| + | InfoFactura infoFactura = new InfoFactura(); | ||
| + | fact.InfoFactura = infoFactura; | ||
| + | infoFactura.FechaEmision = textBox1.Text; | ||
| + | infoFactura.DirEstablecimiento = textBox2.Text; | ||
| + | infoFactura.ContribuyenteEspecial = textBox3.Text; | ||
| + | infoFactura.ObligadoContabilidad = textBox4.Text; | ||
| + | infoFactura.TipoIdentificacionComprador = textBox5.Text; | ||
| + | infoFactura.RazonSocialComprador = textBox6.Text; | ||
| + | infoFactura.IdentificacionComprador = textBox7.Text; | ||
| + | infoFactura.DireccionComprador = textBox8.Text; | ||
| + | infoFactura.TotalSinImpuestos = textBox9.Text; | ||
| + | infoFactura.ImporteTotal = textBox10.Text; | ||
| + | infoFactura.TotalImpuestoReembolso = textBox34.Text; | ||
| + | infoFactura.TotalConImpuestos = new List< | ||
| + | infoFactura.TotalConImpuestos.Add(TotImp()); | ||
| + | infoFactura.TotalDescuento = " | ||
| + | infoFactura.Moneda = " | ||
| + | infoFactura.TotalSubsidio = " | ||
| + | | ||
| + | | ||
| + | // | ||
| + | |||
| + | fact.Detalles = new List< | ||
| + | DetalleFactura det = new DetalleFactura() | ||
| + | { | ||
| + | |||
| + | CodigoPrincipal = textBox67.Text, | ||
| + | CodigoAuxiliar = textBox68.Text, | ||
| + | Descripcion = textBox69.Text, | ||
| + | Cantidad = textBox70.Text, | ||
| + | PrecioUnitario = textBox71.Text, | ||
| + | UnidadMedida = textBox72.Text, | ||
| + | Descuento = textBox73.Text, | ||
| + | PrecioSinSubsidio = textBox74.Text, | ||
| + | PrecioTotalSinImpuesto = textBox75.Text | ||
| + | |||
| + | |||
| + | }; | ||
| + | |||
| + | det.Impuestos = new List< | ||
| + | det.Impuestos.Add(ImpuestDet()); | ||
| + | | ||
| + | det.DetAdicional = new List< | ||
| + | DetAdicional detAd = new DetAdicional | ||
| + | { | ||
| + | Nombre = " | ||
| + | Valor = " | ||
| + | }; | ||
| + | det.DetAdicional.Add(detAd); | ||
| + | |||
| + | fact.Detalles.Add(det); | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | // | ||
| + | Pago pago = new Pago | ||
| + | { | ||
| + | FormaPago = textBox63.Text, | ||
| + | Total = textBox64.Text, | ||
| + | Plazo = textBox65.Text, | ||
| + | UnidadTiempo = textBox66.Text | ||
| + | |||
| + | }; | ||
| + | |||
| + | fact.InfoFactura.Pagos = new List< | ||
| + | fact.InfoFactura.Pagos.Add(pago); | ||
| + | fact.InfoFactura.TotalConImpuestos = new List< | ||
| + | fact.InfoFactura.TotalConImpuestos.Add(TotImp()); | ||
| + | | ||
| + | | ||
| + | | ||
| + | // | ||
| + | |||
| + | pet.Clave = " | ||
| + | pet.RUC = " | ||
| + | pet.Usuario = " | ||
| + | RepuestaPeticion resp = servicio.EnviarFactura(pet); | ||
| + | servicio.Close(); | ||
| + | |||
| + | | ||
| + | |||
| + | richTextBox1.Text = resp.Mensaje + " | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | } | ||
| + | catch (Exception ex) | ||
| + | { | ||
| + | |||
| + | MessageBox.Show(" | ||
| + | } | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | <code php Codigo Ejemplo PHP> | ||
| + | |||
| + | try { | ||
| + | include (" | ||
| + | $wsdl_url = ' | ||
| + | $client = new SOAPClient($wsdl_url); | ||
| + | $objeto=new PeticionFactura(); | ||
| + | $doc=new Documento(); | ||
| + | $objeto-> | ||
| + | | ||
| + | // *****************DATOS INFOTRIBUTARIA*************** | ||
| + | $infofact=new InfoFactura(); | ||
| + | $objeto-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $pag=new Pago(); | ||
| + | $pag-> | ||
| + | $pag-> | ||
| + | $pag-> | ||
| + | $pag-> | ||
| + | $infofact-> | ||
| + | | ||
| + | |||
| + | |||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $totimp=new TotalConImpuesto(); | ||
| + | $totimp-> | ||
| + | $totimp-> | ||
| + | $totimp-> | ||
| + | $totimp-> | ||
| + | $totimp-> | ||
| + | $totimp-> | ||
| + | $totimp-> | ||
| + | | ||
| + | | ||
| + | $infofact-> | ||
| + | | ||
| + | |||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | $infofact-> | ||
| + | | ||
| + | | ||
| + | // *********************DATOS INFOFACTURA*************** | ||
| + | | ||
| + | $infotrib = new InfoTributaria(); | ||
| + | $infotrib-> | ||
| + | $infotrib-> | ||
| + | $infotrib-> | ||
| + | $infotrib-> | ||
| + | $infotrib-> | ||
| + | $infotrib-> | ||
| + | $infotrib-> | ||
| + | $objeto-> | ||
| + | $objeto-> | ||
| + | $objeto-> | ||
| + | $objeto-> | ||
| + | | ||
| + | |||
| + | // ********************DETALLES********************* | ||
| + | | ||
| + | $det=new DetalleFactura(); | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $impDet=new ImpuestoDetalle(); | ||
| + | $impDet-> | ||
| + | $impDet-> | ||
| + | $impDet-> | ||
| + | $impDet-> | ||
| + | $impDet-> | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $det-> | ||
| + | $doc-> | ||
| + | | ||
| + | $pet = [array(" | ||
| + | $return = $client-> | ||
| + | | ||
| + | |||
| + | } catch (Exception $e) { | ||
| + | echo " | ||
| + | } | ||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | Donde el archivo Formas.php es el siguiente: | ||
| + | |||
| + | <code class Clases PHP> | ||
| + | <?php | ||
| + | |||
| + | class PeticionEstatusDocumento { | ||
| + | | ||
| + | public $Usuario = ' | ||
| + | public $RUC = ' | ||
| + | public $Clave = ' | ||
| + | public $Documento = ' | ||
| + | |||
| + | | ||
| + | } | ||
| + | | ||
| + | class PeticionFactura { | ||
| + | | ||
| + | public $Usuario = ' | ||
| + | public $RUC = ' | ||
| + | public $Clave = ' | ||
| + | public $Documento =[]; | ||
| + | |||
| + | | ||
| + | } | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | class PeticionFolios{ | ||
| + | |||
| + | public $Usuario = ' | ||
| + | public $RUC = ' | ||
| + | public $Clave = ' | ||
| + | |||
| + | } | ||
| + | | ||
| + | | ||
| + | class Documento{ | ||
| + | | ||
| + | public $Version=" | ||
| + | public $CPCliente=null; | ||
| + | public $CampoAdicional=null; | ||
| + | public $CorreoNegociable=null; | ||
| + | public $CorreoNotificar=null; | ||
| + | public $Detalles=[]; | ||
| + | public $DirCliente=null; | ||
| + | public $InfoFactura=null; | ||
| + | public $InfoSustitutivaGuiaRemision=null; | ||
| + | public $InfoTributaria=null; | ||
| + | public $MaquinaFiscal=null; | ||
| + | public $negociable=null; | ||
| + | public $Notificar=null; | ||
| + | public $OtrosRubrosTerceros=null; | ||
| + | public $Reembolsos=null; | ||
| + | public $Retenciones=null; | ||
| + | public $TelefonoCliente=null; | ||
| + | | ||
| + | |||
| + | } | ||
| + | |||
| + | |||
| + | class InfoTributaria{ | ||
| + | | ||
| + | public $AgenteRetencion=null; | ||
| + | public $CodigoNumerico=" | ||
| + | public $DirMatriz=null; | ||
| + | public $Estab=" | ||
| + | public $Nombrecomercial=null; | ||
| + | public $PtoEmi=" | ||
| + | public $RazonSocial=null; | ||
| + | public $RegimenMicroempresas=null; | ||
| + | public $Secuencial=null; | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | class InfoFactura{ | ||
| + | | ||
| + | public $CodDocReembolso=null; | ||
| + | public $ComercioExterior=null; | ||
| + | public $Compensaciones=null; | ||
| + | public $ContribuyenteEspecial=" | ||
| + | public $DirEstablecimiento=null; | ||
| + | public $DireccionComprador=null; | ||
| + | public $FechaEmision=null; | ||
| + | public $FleteInternacional=null; | ||
| + | public $GastosAduaneros=null; | ||
| + | public $GastosTrasporteOtros=null; | ||
| + | public $GuiaRemision=null; | ||
| + | public $IdentificacionComprador=null; | ||
| + | public $ImporteTotal=null; | ||
| + | public $IncoTermFactura=null; | ||
| + | public $IncoTermTotalSinImpuestos=null; | ||
| + | public $LugarIncoTerm=null; | ||
| + | public $Moneda=null; | ||
| + | public $ObligadoContabilidad=null; | ||
| + | public $Pagos=[]; | ||
| + | public $PaisAdquisicion=null; | ||
| + | public $PaisDestino=null; | ||
| + | public $PaisOrigen=null; | ||
| + | public $Placa=null; | ||
| + | public $Propina=null; | ||
| + | public $PuertoDestino=null; | ||
| + | public $PuertoEmbarque=null; | ||
| + | public $RazonSocialComprador=null; | ||
| + | public $SeguroInternacional=null; | ||
| + | public $TipoIdentificacionComprador=null; | ||
| + | public $TotalBaseImponibleReembolso=null; | ||
| + | public $TotalComprobantesReembolso=null; | ||
| + | public $TotalConImpuestos=[]; | ||
| + | public $TotalDescuento=null; | ||
| + | public $TotalImpuestoReembolso=null; | ||
| + | public $TotalSinImpuestos=null; | ||
| + | public $TotalSubsidio=null; | ||
| + | public $ValorRetIva=null; | ||
| + | public $ValorRetRenta=null; | ||
| + | |||
| + | } | ||
| + | |||
| + | class DetalleFactura{ | ||
| + | | ||
| + | public $Cantidad=null; | ||
| + | public $Descripcion=null; | ||
| + | public $Descuento=null; | ||
| + | public $Impuestos=[]; | ||
| + | public $PrecioTotalSinImpuesto=null; | ||
| + | public $PrecioUnitario=null; | ||
| + | public $CodigoAuxiliar=null; | ||
| + | public $CodigoPrincipal=null; | ||
| + | public $DetAdicional=[]; | ||
| + | public $PrecioSinSubsidio=null; | ||
| + | public $unidadMedida=null; | ||
| + | | ||
| + | | ||
| + | } | ||
| + | | ||
| + | class ImpuestoDetalle{ | ||
| + | | ||
| + | public $BaseImponible=null; | ||
| + | public $Codigo=null; | ||
| + | public $CodigoPorRet=null; | ||
| + | public $Valor=null; | ||
| + | public $Tarifa=null; | ||
| + | | ||
| + | } | ||
| + | |||
| + | |||
| + | class TotalConImpuesto{ | ||
| + | | ||
| + | public $BaseImponible=null; | ||
| + | public $Codigo=null; | ||
| + | public $CodigoPorcentaje=null; | ||
| + | public $Descuentoadicional=null; | ||
| + | public $Valor=null; | ||
| + | public $Tarifa=null; | ||
| + | public $ValorDevolucionIva=null; | ||
| + | | ||
| + | } | ||
| + | |||
| + | class Pago{ | ||
| + | public $FormaPago=null; | ||
| + | public $Plazo=null; | ||
| + | public $Total=null; | ||
| + | public $UnidadTiempo=null; | ||
| + | |||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| == ARCHIVOS FACTURA XML/XSD == | == ARCHIVOS FACTURA XML/XSD == | ||