diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index 4b7dd81fb..25f5e0936 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -5720,6 +5720,27 @@ Public Class ClsVentas
End Function
+ Public Function CambioClientesVendedor(CveCliente As Integer, CveVendedor As Integer, CveEmpresa As Integer) As Boolean
+
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Vta_ClientesVendedorCambio")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCliente", SqlDbType.VarChar).Value = CveCliente
+ .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al cambiar al vendedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return Retorno
+
+
+ End Function
+
+
#Region "IDisposable Support"
diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx
index c84d79087..b42713ae4 100644
--- a/Compras/Compras.aspx
+++ b/Compras/Compras.aspx
@@ -1289,7 +1289,8 @@
-
+
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 6e0bcca33..dcb19cede 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -8537,7 +8537,8 @@ Partial Class Compras_Compras
Dim Comp As New ClsCompras()
Dim ObjEventos As New ClsOIEventos(Comp.IniciaTransacSQL())
Dim ObjConta As New ClsContabilidad(Comp.IniciaTransacSQL())
-
+ Dim ObjInventarios As New ClsInventarios(Comp.IniciaTransacSQL())
+ Dim ObjGral As New ClsGenerales(Comp.IniciaTransacSQL())
Dim ErrorCompra = False
@@ -8564,6 +8565,64 @@ Partial Class Compras_Compras
End If
End If
+
+
+ Try
+ If ObjInventarios.GetInv_ComprasMov(CveCompra, UsuarioActual.CveEmpresa) Then
+ Dim DTInventarios As DataTable = ObjInventarios.DtResultados
+ If DTInventarios.Rows.Count > 0 Then
+
+ Dim DTMovimientos As DataTable = DTInventarios.FiltraParametros("", "", {"CVeMovimiento"})
+
+ For Each diRow As DataRow In DTMovimientos.Rows
+
+ Dim CveMovimientoActual As Integer = diRow("CveMovimiento").ToString.ToEntero
+
+ Dim DTMovimientoActual As DataTable = DTInventarios.FiltraParametros($"CveMovimiento = {CveMovimientoActual} ")
+
+ Dim detalleDescripcion As String = ""
+ Dim Description As String = ""
+
+ Dim FolioMovimiento As String = ""
+ Dim ConceptoMovimiento As String = ""
+
+ For Each dRowMovActual As DataRow In DTMovimientoActual.Rows
+
+ If dRowMovActual("UM").ToString = "" Then
+ FolioMovimiento = dRowMovActual("Folio").ToString
+ ConceptoMovimiento = dRowMovActual("Concepto").ToString
+
+ Description = String.Format("Eliminación Compra {6},Movimiento con Concepto: {0}, Almacen: {1}, Fecha: {2}, Folio: {3}, Usuario: {4}, Observaciones adicionales: {5}, Productos Información: ",
+ ConceptoMovimiento,
+ dRowMovActual("Almacen").ToString,
+ dRowMovActual("FechaMovto").ToString.ToDate.ToString("dd/MM/yyyy"),
+ FolioMovimiento,
+ dRowMovActual("Usuario").ToString,
+ dRowMovActual("Observaciones").ToString,
+ $"{TxtSerie.Text}-{TxtFolio.Text}")
+ Else
+ detalleDescripcion = String.Format("- Cant: {0}, PS: {1}, PU: {2}, UM: {3} ", dRowMovActual("Cantidad").ToString.ToEntero, dRowMovActual("CodigoPS"), dRowMovActual("PU"), dRowMovActual("UM"))
+ End If
+
+ Next
+
+ If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1,
+ String.Format("{0}, Informacion = {1}", Description, detalleDescripcion),
+ "Inventarios", FolioMovimiento + " / " + ConceptoMovimiento) Then
+ ErrorCompra = True
+ Exit For
+ End If
+ Next
+
+ End If
+ End If
+ Catch ex As Exception
+ ErrorCompra = True
+ End Try
+
+
+
+
If Not ErrorCompra Then
If Not Comp.DeleteCompra(CveCompra, False) Then
ErrorCompra = True
diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx
index f74b628bb..198088ed9 100644
--- a/Ventas/Clientes.aspx
+++ b/Ventas/Clientes.aspx
@@ -668,13 +668,18 @@
-
+
+
+
+ Actualziar
+
+
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb
index 1a853f53b..c3e1a8dfe 100644
--- a/Ventas/Clientes.aspx.vb
+++ b/Ventas/Clientes.aspx.vb
@@ -644,6 +644,23 @@ Partial Class Clientes
ViewState("AdjuntoDocumentacion") = value
End Set
End Property
+
+ Property CveVendedorOriginal As Integer
+ Get
+ If ViewState("CveVendedorOriginal") Is Nothing Then
+ ViewState("CveVendedorOriginal") = -1
+ End If
+
+ Return DirectCast(ViewState("CveVendedorOriginal"), Integer)
+
+ End Get
+ Set(value As Integer)
+ ViewState("CveVendedorOriginal") = value
+ End Set
+ End Property
+
+
+
'Private ReadOnly Property CvePersonal As Integer
' Get
' If ViewState("CvePersonal") Is Nothing Then
@@ -857,9 +874,15 @@ Partial Class Clientes
Tab.ActiveTabIndex = Request("ATI").ToEntero()
End If
'CargaCuentasyConceptos()
- Else
- 'Configuración de Modalidad Insert
- CargaEstados()
+
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ DVLnkCambiarVendedor.Visible = True
+ End If
+
+
+ Else
+ 'Configuración de Modalidad Insert
+ CargaEstados()
BtnGuardar.Visible = PermiteGuardar()
If UsuarioActual.Empresa.Funcionalidad(525) = "1" Then
@@ -1591,6 +1614,7 @@ Partial Class Clientes
Else
DdlVendedor.SelectedValueExist(CveVendedor)
End If
+ CveVendedorOriginal = CveVendedor
'TxtVendedor.Text = ObjClientes.Vendedor
TxtPlazoCobranza.Text = ObjClientes.PlazoCobranza.ToString()
@@ -10569,5 +10593,39 @@ Partial Class Clientes
End Sub
+
+ Protected Sub LnkCambiarVendedor_Click(sender As Object, e As EventArgs)
+
+ If Not DdlVendedor.SelectedValue.ToEntero > 0 Then
+ Alert("Debe de seleccionar un Vendedor.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+
+ If CveVendedorOriginal = DdlVendedor.SelectedValue.ToEntero Then
+ Alert("Debe de seleccionar un vendedor distinto para actualizar.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ Dim ObjVentas As New ClsVentas
+ Dim ErrorCambio As Boolean = False
+
+ If ObjVentas.CambioClientesVendedor(CveCliente, DdlVendedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
+ CveVendedorOriginal = DdlVendedor.SelectedValue.ToEntero
+ Else
+ ErrorCambio = True
+ End If
+
+ ObjVentas.Dispose()
+
+ If Not ErrorCambio Then
+ Alert("Vendedor Cambiado Correctamente.", TipoMensaje.MsgInformacion, $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}""")
+ End If
+
+
+
+
+ End Sub
+
End Class