From 5520556dc9ff2877eb268d50e3488443b50177cb Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 9 Jan 2025 16:12:22 -0700 Subject: [PATCH] --FIX. Cambios en mensaje de timbrado, cobro por caja --- Ventas/PVCobranza.aspx.vb | 55 ++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 85557279f..6f7ec4a57 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -796,19 +796,22 @@ Partial Class Ventas_PVCobranza Dim DebeTimbrar As Boolean = True + Dim SeTimbro As Boolean = False + Dim SeTimbroNC As Boolean = False + 'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO If DebeTimbrar AndAlso respFactura IsNot Nothing Then 'VERIFICA SI SE GENERO NC If respNC IsNot Nothing Then AjustarTimbre(respFactura.Factura, respNC.Factura) - MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura) + MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura, SeTimbro, SeTimbroNC) Else AjustarTimbre(respFactura.Factura, Nothing) - MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing) + MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing, SeTimbro, SeTimbroNC) End If If Not String.IsNullOrEmpty(MsgTimbrado) Then - Dim StrEr As String = $"
Comprobante no emitido : {MsgTimbrado}
Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.
" + Dim StrEr As String = $"
Comprobante no emitido :
{MsgTimbrado}
Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.
" MsgTimbrado = StrEr End If @@ -816,27 +819,41 @@ Partial Class Ventas_PVCobranza If respFactura IsNot Nothing Then If RegistrarPago Then - msBuild.Append($"Pago Registrado correctamente.") + msBuild.Append("Pago Registrado correctamente.

") End If - For Each m In respFactura.Mensajes - msBuild.AppendFormat("
{0}", m) - Next + msBuild.AppendFormat(" La factura {1} se genero correctamente.
", respFactura.CveVenta, respFactura.SerieFolio) + + If SeTimbro Then + Dim xml = String.Format("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respFactura.CveVenta, "XML", respFactura.SerieFolio, respFactura.Factura.TipoDocto))) + msBuild.AppendFormat("{0}", xml) + End If + + Dim pdf = String.Format("", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respFactura.CveVenta))) + msBuild.AppendFormat("{0}", pdf) + + If respFactura.Factura.Inv_CveMovimiento > 0 Then + msBuild.AppendFormat("Movimiento de Almacén
", respFactura.Factura.Inv_CveMovimiento) + End If If respNC IsNot Nothing Then - For Each m In respNC.Mensajes - msBuild.AppendFormat("
{0}", m) - Next + msBuild.AppendFormat(" La nota de crédito {1} se genero correctamente.
", respNC.CveVenta, respNC.SerieFolio) + If SeTimbroNC Then + Dim xml = String.Format("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respNC.CveVenta, "XML", respNC.SerieFolio, respNC.Factura.TipoDocto))) + msBuild.AppendFormat("{0}", xml) + End If + + Dim pdfNC = String.Format("", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respNC.CveVenta))) + msBuild.AppendFormat("{0}", pdfNC) End If + If Not String.IsNullOrEmpty(MsgTimbrado) Then + msBuild.AppendFormat("
{0}
", MsgTimbrado) + End If Else msBuild.Append($"Pago Registrado correctamente.

Imprimir ticket") End If - If Not String.IsNullOrEmpty(MsgTimbrado) Then - msBuild.AppendFormat("
{0}", MsgTimbrado) - End If - Alert(msBuild.ToString(), TipoMensaje.MsgInformacion) Else ObjVentas2.RollBack() @@ -1256,9 +1273,11 @@ Partial Class Ventas_PVCobranza End Sub - Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura) As String + Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura, ByRef SeTimbro As Boolean, ByRef SeTimbroNC As Boolean) As String Dim MsgErrorTimbrado As String = "" - Dim SeTimbro As Boolean = False + 'Dim SeTimbro As Boolean = False + 'Dim TimbroNC As Boolean = False + Dim ObjTimbrado As New Timbrado Try SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) @@ -1272,9 +1291,9 @@ Partial Class Ventas_PVCobranza ObjNC.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura) Dim ObjTimbradoNC As New Timbrado - Dim TimbroNC As Boolean = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC) + SeTimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC) - If Not TimbroNC Then + If Not SeTimbroNC Then MsgErrorTimbrado = $"{MsgErrorTimbrado} {ObjTimbradoNC.MensajeErrorCFDI}" End If ObjTimbradoNC = Nothing