This commit is contained in:
2025-04-02 09:36:57 -07:00
11 changed files with 1043 additions and 41 deletions

View File

@@ -1156,18 +1156,13 @@ Partial Class Ventas_PVCobranza
If CveVenta > 0 OrElse CveIE > 0 Then
Dim Actualizo As Boolean = False
If Tipo.Contiene("NC", "Ant") Then
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then
Actualizo = True
End If
ElseIf Tipo.Contiene("IxC") Then
If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then
Actualizo = True
End If
If ObjVentas.UpdateAnticipoAutorizado(CveVenta, CveIE, Tipo.Trim(), False) Then
Actualizo = True
End If
If Actualizo Then
Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: <b>{Folio}</b>", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta)
Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se aplicó correctamente. Folio: <b>{Folio}</b>", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta)
End If
End If
@@ -2279,7 +2274,7 @@ Partial Class Ventas_PVCobranza
Dim CveIE As Integer = gvr.DataKey("CveIE").ToEntero()
Dim ObjVta As New ClsVentas
If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, Saldo, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then
If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, Saldo, CveEstatus:=0, CveUsuario:=UsuarioActual.CveUsuario, TipoAutorizacion:=1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then
Dim msgAlert = "La autorización se agregó correctamente."
If EnvioMsg Then
msgAlert = $"{msgAlert} Se envió una notificación de autorización a los usuarios"
@@ -2381,9 +2376,9 @@ Partial Class Ventas_PVCobranza
Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado"))
If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then
AnticipoAutorizado = True
End If
'If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then
' AnticipoAutorizado = True
'End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then
If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then

View File

@@ -10505,7 +10505,7 @@ Partial Class Ventas
End Sub
Private Sub VerificaAutorizacionEgs(Optional VerificarImportes As Boolean = True)
Private Sub VerificaAutorizacionEgs(Optional VerificarImportes As Boolean = True, Optional MostrarAlertas As Boolean = True)
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
@@ -10535,7 +10535,10 @@ Partial Class Ventas
CveAutorizacion = -1
If BloquearCredito Then
Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
If MostrarAlertas Then
Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
End If
Exit Sub
End If
End If
@@ -10543,7 +10546,10 @@ Partial Class Ventas
Else
CveAutorizacion = -1
Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia)
If MostrarAlertas Then
Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia)
End If
Exit Sub
End If
End Sub
@@ -31508,6 +31514,23 @@ Partial Class Ventas
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False, Optional TipoDoctoNC As String = "Egs")
Try
'VALIDACION DE AUTORIZACION PARA NC, POR AHORA SOLO BDH
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso AplicoNCFacturaActual AndAlso TipoDoctoNC = "Egs" Then
Dim PermiteAutorizacion = False
'SI NO ES GENERADA CON REMISIONES DE NC, UTILIZAR LA AUTORIZACION
If (ListaRemisionesNC Is Nothing OrElse ListaRemisionesNC.Count = 0) Then
PermiteAutorizacion = True
End If
If PermiteAutorizacion Then
VerificaAutorizacionEgs(VerificarImportes:=True, MostrarAlertas:=True)
If Me.CveAutorizacion <= 0 Then
Exit Sub
End If
End If
End If
Me.AplicaDocumentoNuevoNC = AplicaNuevoDocumento
Dim DrPS As DataRow = Nothing
@@ -39669,8 +39692,25 @@ Partial Class Ventas
End If
End If
Dim OrdenCompra As String = "-1"
If UsuarioActual.CveEmpresa = 119 Then
Dim arrayStr As String() = DdlLineaAdicional.SelectedItem.Text.Split(":"c)
If arrayStr.Length > 0 Then
Dim OrdenCompraTmp As String = arrayStr(0).Replace("IMP", "").Trim
If TxtOrdenCompra.Text.Trim.Length > 0 Then
If OrdenCompraTmp.ToUpper <> TxtOrdenCompra.Text.Trim.ToUpper Then
OrdenCompra = $"{TxtOrdenCompra.Text}, {OrdenCompraTmp}"
End If
Else
OrdenCompra = $"{OrdenCompraTmp}"
End If
End If
End If
Using ObjVentas As New ClsVentas
If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), CveVenta, "", 1, UsuarioActual.CveEmpresa) Then
If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), CveVenta, "", 1, UsuarioActual.CveEmpresa, OrdenCompra:=OrdenCompra) Then
Alert("Se actualizó la linea adicional de crédito de la venta")
End If
End Using
@@ -40565,10 +40605,13 @@ Partial Class Ventas
RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
VerificaAutorizacionEgs(VerificarImportes:=True)
If Me.CveAutorizacion <= 0 Then
Exit Sub
Else
TxtImportesRemisionesNC.Text = "0.00"
TxtNCImporte.Text = "0.00"
VerificaAutorizacionEgs(VerificarImportes:=True, MostrarAlertas:=False)
If Me.CveAutorizacion > 0 Then
Using ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacion(Me.CveAutorizacion, UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados.FiltroPrimeroValor("CveTipoVenta").ToEntero() > 0 Then
@@ -40578,7 +40621,12 @@ Partial Class Ventas
End If
End If
End Using
Else
DivTipoVentaAsingado.Visible = True
LblTipoVentaAsignado.Text = "Sin definir"
DdlNCPS.Enabled = True
End If
End If
RegistraScript("$('#ModalAplicarNC').modal('show');", "ModalNC")