--Actualizar el TC de una venta no timbrada
This commit is contained in:
@@ -616,6 +616,24 @@ Public Class ClsVentas
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Function UpdateVentaTC(CveVenta As Integer, CveEmpresa As Integer, TipoCambio As Decimal) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Vta_VentasTipoCambioUpdate")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
.Add("@TipoCambio", SqlDbType.Decimal).Value = TipoCambio
|
||||||
|
End With
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al actualizar el TC de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean
|
Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Vta_VentasFechaVencimientoUpdate")
|
DataAdapter("PA_Vta_VentasFechaVencimientoUpdate")
|
||||||
|
|||||||
@@ -33193,7 +33193,7 @@ Partial Class Ventas
|
|||||||
ErrorTrans = True
|
ErrorTrans = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ObjEventos.AddEventoBitacora($"Se actualizo la fecha de pago. Anterior:{FechaVencimientoAnterior} Actual:{TxtFechaPago.Text}.", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
If Not ObjEventos.AddEventoBitacora($"Se actualizó la fecha de pago. Anterior:{FechaVencimientoAnterior} Actual:{TxtFechaPago.Text}.", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
||||||
ErrorTrans = True
|
ErrorTrans = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -34425,15 +34425,15 @@ Partial Class Ventas
|
|||||||
TFuenteRecaudacion.Visible = False
|
TFuenteRecaudacion.Visible = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If UsuarioActual.CveRol = 1 Then
|
'If UsuarioActual.CveRol = 1 Then
|
||||||
If ChkEmitirComercioExterior.Checked Then
|
' If ChkEmitirComercioExterior.Checked Then
|
||||||
TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate.AddDays(-1)).ToString()
|
' TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate.AddDays(-1)).ToString()
|
||||||
Else
|
' Else
|
||||||
TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString()
|
' TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString()
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
UpPS.Update()
|
' UpPS.Update()
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -34574,6 +34574,13 @@ Partial Class Ventas
|
|||||||
DdlUsoCFDI.Enabled = True
|
DdlUsoCFDI.Enabled = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If LblSeTimbro.Text = "No" AndAlso DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso ChkEmitirComercioExterior.Checked AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||||
|
TxtTipoCambio.Enabled = True
|
||||||
|
TxtTipoCambio.ReadOnly = False
|
||||||
|
|
||||||
|
UpPS.Update()
|
||||||
|
End If
|
||||||
|
|
||||||
UpParametros.Update()
|
UpParametros.Update()
|
||||||
UPObservaciones.Update()
|
UPObservaciones.Update()
|
||||||
UpFacturar.Update()
|
UpFacturar.Update()
|
||||||
@@ -34581,18 +34588,42 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub GuardarValoresEditados()
|
Private Sub GuardarValoresEditados()
|
||||||
|
Dim TieneError As Boolean = False
|
||||||
|
Dim AplicaUpdateTC As Boolean = False
|
||||||
|
|
||||||
|
If LblSeTimbro.Text = "No" AndAlso DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso ChkEmitirComercioExterior.Checked AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||||
|
AplicaUpdateTC = True
|
||||||
|
End If
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas()
|
Dim ObjVentas As New ClsVentas()
|
||||||
If ObjVentas.UpdateObservacionesVenta(CveVenta, UsuarioActual.CveEmpresa, DdlVendedor.SelectedValue.ToEntero(), TxtObsFact.Text, RblPaqueteria.SelectedValue.ToEntero(), TxtCorreoNotificaciones.Text,
|
ObjVentas.IniciaTransacSQL()
|
||||||
|
|
||||||
|
If Not ObjVentas.UpdateObservacionesVenta(Me.CveVenta, UsuarioActual.CveEmpresa, DdlVendedor.SelectedValue.ToEntero(), TxtObsFact.Text, RblPaqueteria.SelectedValue.ToEntero(), TxtCorreoNotificaciones.Text,
|
||||||
TxtObsAlmacen.Text, TxtPedidoContrato.Text, TxtOrdenCompra.Text, TxtFechaPago.Text) Then
|
TxtObsAlmacen.Text, TxtPedidoContrato.Text, TxtOrdenCompra.Text, TxtFechaPago.Text) Then
|
||||||
CargaVenta()
|
TieneError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not TieneError AndAlso AplicaUpdateTC Then
|
||||||
|
If Not ObjVentas.UpdateVentaTC(Me.CveVenta, UsuarioActual.CveEmpresa, TxtTipoCambio.Text.ToDecimal()) Then
|
||||||
|
TieneError = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not TieneError Then
|
||||||
|
ObjVentas.Commit()
|
||||||
BtnEditar.Text = "Editar"
|
BtnEditar.Text = "Editar"
|
||||||
Alert("Actualizado correctamente")
|
|
||||||
|
Dim Liga = $"document.location.href=""/Ventas/Ventas.aspx?CveVenta={Me.CveVenta}"";"
|
||||||
|
Alert("La venta se actualizó correctamente", TipoMensaje.MsgInformacion, Liga, TextoConfirmacion:="Aceptar", TextoSegundoBoton:=Nothing, JSBtn2:=Nothing, ShowCloseButton:=False)
|
||||||
|
|
||||||
UpParametros.Update()
|
UpParametros.Update()
|
||||||
UPObservaciones.Update()
|
UPObservaciones.Update()
|
||||||
UpFacturar.Update()
|
UpFacturar.Update()
|
||||||
|
Else
|
||||||
|
ObjVentas.RollBack()
|
||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
|
||||||
|
|
||||||
|
ObjVentas.Dispose()
|
||||||
'REGENERAR EL PDF
|
'REGENERAR EL PDF
|
||||||
Try
|
Try
|
||||||
Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
||||||
@@ -34600,8 +34631,6 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||||
RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
||||||
'Dim Hilo As New System.Threading.Thread(Sub() )
|
|
||||||
'Hilo.Start()
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error al regenerar el PDF", ex)
|
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
Reference in New Issue
Block a user