diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb
index f6d0d68aa..95c54e78b 100644
--- a/Inventarios/RecepcionUsados.aspx.vb
+++ b/Inventarios/RecepcionUsados.aspx.vb
@@ -2616,11 +2616,71 @@ Partial Class Inventarios_RecepcionUsados
If ObjAcumuladores.GetNuevoConsecutivoFolio(DdlFolioGarantia.SelectedValue.ToEntero) Then
Dim resultado As String = ObjAcumuladores.DtResultados.FiltroPrimeroValor("NuevoConsecutivo")
TxtConsecutivoAjuste.Text = (resultado.ToEntero + 1).ToString
- UpAjuste.Update()
End If
ObjAcumuladores.Dispose()
+
+ Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero())
+
+ If Not FolioGarantia.Valido Then
+ Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia)
+ End If
+
End Sub
+ Private Function ValidaFolioGarantia(CvePS As Integer, CveFolioGarantia As Integer) As MFolioGarantiaMensaje
+ Dim Retorno As New MFolioGarantiaMensaje
+
+ Dim Valido As Boolean = False
+ Dim TipoFolio As String = ""
+ Dim ListaClasificacionesPermitidas As New List(Of Integer)
+
+ Dim ObjAcumuladores As New ClsAcumuladores
+ If ObjAcumuladores.FoliosGarantiaGet(CveFolioGarantia, UsuarioActual.CveEmpresa, Area:=-1) AndAlso ObjAcumuladores.DtResultados.Rows.Count > 0 Then
+ Dim Row As DataRow = ObjAcumuladores.DtResultados.Rows(0)
+ TipoFolio = Row("tipoFolio").ToString().ToUpper()
+ End If
+ ObjAcumuladores.Dispose()
+
+ Dim CveClasificacionPS As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveClasificacion").ToEntero()
+ Dim ClasificacionPS As String = GlobalDTClasificaciones(CveEmpresa:=UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionPS).FiltroPrimeroValor("Clasificacion").ToString()
+ Select Case TipoFolio
+ Case "GENERAL"
+ '20520 ACUM. AUTOMOTRIZ
+ '20522 ACUM. ESPECIALES
+ '20513 ACUM. ESTANDAR
+ '20521 ACUM. PESADO
+ '20512 ACUM. PREMIUM
+ '20514 ACUM. VALUE
+ '20229 Acumulador
+ ListaClasificacionesPermitidas.Add(20520) 'ACUM. AUTOMOTRIZ
+ ListaClasificacionesPermitidas.Add(20522) 'ACUM. ESPECIALES
+ ListaClasificacionesPermitidas.Add(20513) 'ACUM. ESTANDAR
+ ListaClasificacionesPermitidas.Add(20521) 'ACUM. PESADO
+ ListaClasificacionesPermitidas.Add(20512) 'ACUM. PREMIUM
+ ListaClasificacionesPermitidas.Add(20514) 'ACUM. VALUE
+ ListaClasificacionesPermitidas.Add(20229) 'Acumulador
+ Case "OPTIMA"
+ '20511 ACUM. OPTIMA
+ ListaClasificacionesPermitidas.Add(20511) 'ACUM. OPTIMA
+ Case "MOTOBATERIA"
+ '20517 MOTOBATERIAS
+ ListaClasificacionesPermitidas.Add(20517) 'MOTOBATERIAS
+ End Select
+
+ If ListaClasificacionesPermitidas.Contains(CveClasificacionPS) Then
+ Valido = True
+ End If
+
+ Retorno.CvePS = CvePS
+ Retorno.CveFolioGarantia = CveFolioGarantia
+ Retorno.CveClasificacionPS = CveClasificacionPS
+ Retorno.ClasificacionPS = ClasificacionPS
+ Retorno.TipoFolio = TipoFolio
+ Retorno.Valido = Valido
+
+ Return Retorno
+ End Function
+
Protected Sub CargaTipoDeUso()
DdlTipoUso.Items.Clear()
DdlTipoUso.DataSource = GlobalDTAcumTiposUso.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
@@ -2767,6 +2827,14 @@ Partial Class Inventarios_RecepcionUsados
Protected Sub BtnAgregarProductoAjuste_Click(sender As Object, e As EventArgs)
Dim CvePS As Integer = DdlPSAjuste.SelectedValue.ToEntero
+
+ Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(CvePS, DdlFolioGarantia.SelectedValue.ToEntero())
+
+ If Not FolioGarantia.Valido Then
+ Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
Dim ObjPS As New ClsProductosServicios
Dim CveTamaño As Integer = -1
If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then
@@ -2809,4 +2877,14 @@ Partial Class Inventarios_RecepcionUsados
InicializaClientes(ChkClientesTodos.Checked)
End Sub
+ Partial Class MFolioGarantiaMensaje
+ Public Property CvePS As Integer
+ Public Property CveClasificacionPS As Integer
+ Public Property ClasificacionPS As String
+ Public Property CveFolioGarantia As Integer
+ Public Property TipoFolio As String
+
+ Public Property Valido As Boolean
+ End Class
+
End Class
diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb
index ec3ef198f..d16917935 100644
--- a/Ventas/PV.aspx.vb
+++ b/Ventas/PV.aspx.vb
@@ -4671,6 +4671,15 @@ Partial Class PV
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta")
End Sub
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
+ If ChkAjuste.Checked Then
+ Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero())
+
+ If Not FolioGarantia.Valido Then
+ Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+
If AgregarPS() Then
If ChkAjuste.Checked Then GuardaAjuste()
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
@@ -6511,6 +6520,12 @@ Partial Class PV
UpAjuste.Update()
End If
ObjAcumuladores.Dispose()
+
+ Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero())
+
+ If Not FolioGarantia.Valido Then
+ Alert($"El folio de garantía no es valido.
Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.
Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia)
+ End If
End Sub
#End Region
@@ -6991,4 +7006,68 @@ Partial Class PV
ImprimirPDF("Empresas/Grales/Formatos/Ajuste.rdlc", DtDatos, params, "Reporte de Ajuste", "PDF")
End Sub
+
+ Private Function ValidaFolioGarantia(CvePS As Integer, CveFolioGarantia As Integer) As MFolioGarantiaMensaje
+ Dim Retorno As New MFolioGarantiaMensaje
+
+ Dim Valido As Boolean = False
+ Dim TipoFolio As String = ""
+ Dim ListaClasificacionesPermitidas As New List(Of Integer)
+
+ Dim ObjAcumuladores As New ClsAcumuladores
+ If ObjAcumuladores.FoliosGarantiaGet(CveFolioGarantia, UsuarioActual.CveEmpresa, Area:=-1) AndAlso ObjAcumuladores.DtResultados.Rows.Count > 0 Then
+ Dim Row As DataRow = ObjAcumuladores.DtResultados.Rows(0)
+ TipoFolio = Row("tipoFolio").ToString().ToUpper()
+ End If
+ ObjAcumuladores.Dispose()
+
+ Dim CveClasificacionPS As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("CveClasificacion").ToEntero()
+ Dim ClasificacionPS As String = GlobalDTClasificaciones(CveEmpresa:=UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionPS).FiltroPrimeroValor("Clasificacion").ToString()
+ Select Case TipoFolio
+ Case "GENERAL"
+ '20520 ACUM. AUTOMOTRIZ
+ '20522 ACUM. ESPECIALES
+ '20513 ACUM. ESTANDAR
+ '20521 ACUM. PESADO
+ '20512 ACUM. PREMIUM
+ '20514 ACUM. VALUE
+ '20229 Acumulador
+ ListaClasificacionesPermitidas.Add(20520) 'ACUM. AUTOMOTRIZ
+ ListaClasificacionesPermitidas.Add(20522) 'ACUM. ESPECIALES
+ ListaClasificacionesPermitidas.Add(20513) 'ACUM. ESTANDAR
+ ListaClasificacionesPermitidas.Add(20521) 'ACUM. PESADO
+ ListaClasificacionesPermitidas.Add(20512) 'ACUM. PREMIUM
+ ListaClasificacionesPermitidas.Add(20514) 'ACUM. VALUE
+ ListaClasificacionesPermitidas.Add(20229) 'Acumulador
+ Case "OPTIMA"
+ '20511 ACUM. OPTIMA
+ ListaClasificacionesPermitidas.Add(20511) 'ACUM. OPTIMA
+ Case "MOTOBATERIA"
+ '20517 MOTOBATERIAS
+ ListaClasificacionesPermitidas.Add(20517) 'MOTOBATERIAS
+ End Select
+
+ If ListaClasificacionesPermitidas.Contains(CveClasificacionPS) Then
+ Valido = True
+ End If
+
+ Retorno.CvePS = CvePS
+ Retorno.CveFolioGarantia = CveFolioGarantia
+ Retorno.CveClasificacionPS = CveClasificacionPS
+ Retorno.ClasificacionPS = ClasificacionPS
+ Retorno.TipoFolio = TipoFolio
+ Retorno.Valido = Valido
+
+ Return Retorno
+ End Function
+
+ Partial Class MFolioGarantiaMensaje
+ Public Property CvePS As Integer
+ Public Property CveClasificacionPS As Integer
+ Public Property ClasificacionPS As String
+ Public Property CveFolioGarantia As Integer
+ Public Property TipoFolio As String
+
+ Public Property Valido As Boolean
+ End Class
End Class