Combras bitacora inventario al eliminar compra con inventario, clientes cambiar vendedor.

This commit is contained in:
Oscar Irigoyen
2023-01-28 15:20:08 -07:00
parent 28a6e5e284
commit 79b7ed7f5a
5 changed files with 150 additions and 6 deletions

View File

@@ -5720,6 +5720,27 @@ Public Class ClsVentas
End Function 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" #Region "IDisposable Support"

View File

@@ -1289,7 +1289,8 @@
<div class="Widthall" style="overflow-x: auto;"> <div class="Widthall" style="overflow-x: auto;">
<asp:GridView ID="GvInvMov" runat="server" AutoGenerateColumns="false" DataKeyNames="Origen" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%" HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover" GridLines="None" Visible="false"> <asp:GridView ID="GvInvMov" runat="server" AutoGenerateColumns="false" DataKeyNames="Origen" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%"
HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover" GridLines="None" Visible="false">
<Columns> <Columns>
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>

View File

@@ -8537,7 +8537,8 @@ Partial Class Compras_Compras
Dim Comp As New ClsCompras() Dim Comp As New ClsCompras()
Dim ObjEventos As New ClsOIEventos(Comp.IniciaTransacSQL()) Dim ObjEventos As New ClsOIEventos(Comp.IniciaTransacSQL())
Dim ObjConta As New ClsContabilidad(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 Dim ErrorCompra = False
@@ -8564,6 +8565,64 @@ Partial Class Compras_Compras
End If End If
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:<br/>",
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}<br/>", 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 ErrorCompra Then
If Not Comp.DeleteCompra(CveCompra, False) Then If Not Comp.DeleteCompra(CveCompra, False) Then
ErrorCompra = True ErrorCompra = True

View File

@@ -668,13 +668,18 @@
<label for="<%= DdlClasificacion.ClientID.ToString()%>">Giro:</label> <label for="<%= DdlClasificacion.ClientID.ToString()%>">Giro:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright col-md-6" id="Div1" runat="server"> <div class="form-group form-md-line-input input-iconright col-md-4" id="Div1" runat="server">
<asp:DropDownList ID="DdlVendedor" runat="server" CssClass="form-control select2me" Width="200px" DataTextField="Vendedor" DataValueField="CveVendedor"></asp:DropDownList> <asp:DropDownList ID="DdlVendedor" runat="server" CssClass="form-control select2me" Width="200px" DataTextField="Vendedor" DataValueField="CveVendedor"></asp:DropDownList>
<asp:LinkButton ID="LnkAgregarVendedorSucursal" Visible="false" runat="server" data-toggle="tooltip" data-placement="right" title="Agregar vendedor por sucursal." CssClass="btn btn-circle btn-default" Text="<i class='fa fa-plus'></i> Agregar por Sucursal"></asp:LinkButton> <asp:LinkButton ID="LnkAgregarVendedorSucursal" Visible="false" runat="server" data-toggle="tooltip" data-placement="right" title="Agregar vendedor por sucursal." CssClass="btn btn-circle btn-default" Text="<i class='fa fa-plus'></i> Agregar por Sucursal"></asp:LinkButton>
<label for="<%= DdlVendedor.ClientID.ToString()%>">Vendedor:</label> <label for="<%= DdlVendedor.ClientID.ToString()%>">Vendedor:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright col-md-2" id="DVLnkCambiarVendedor" runat="server" visible="false">
<asp:LinkButton runat="server" ID="LnkCambiarVendedor" CssClass="Texto" Text="Actualziar" OnClick="LnkCambiarVendedor_Click">Actualziar</asp:LinkButton>
</div>
</div> </div>
<div class="form-group form-md-line-input input-iconright" id="Div2" runat="server"> <div class="form-group form-md-line-input input-iconright" id="Div2" runat="server">
<asp:DropDownList ID="DdlCorporativo" runat="server" CssClass="form-control select2me" Width="200px" DataTextField="Descripcion" DataValueField="CveClienteCorporativo"></asp:DropDownList> <asp:DropDownList ID="DdlCorporativo" runat="server" CssClass="form-control select2me" Width="200px" DataTextField="Descripcion" DataValueField="CveClienteCorporativo"></asp:DropDownList>

View File

@@ -644,6 +644,23 @@ Partial Class Clientes
ViewState("AdjuntoDocumentacion") = value ViewState("AdjuntoDocumentacion") = value
End Set End Set
End Property 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 'Private ReadOnly Property CvePersonal As Integer
' Get ' Get
' If ViewState("CvePersonal") Is Nothing Then ' If ViewState("CvePersonal") Is Nothing Then
@@ -857,9 +874,15 @@ Partial Class Clientes
Tab.ActiveTabIndex = Request("ATI").ToEntero() Tab.ActiveTabIndex = Request("ATI").ToEntero()
End If End If
'CargaCuentasyConceptos() 'CargaCuentasyConceptos()
Else
'Configuración de Modalidad Insert If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
CargaEstados() DVLnkCambiarVendedor.Visible = True
End If
Else
'Configuración de Modalidad Insert
CargaEstados()
BtnGuardar.Visible = PermiteGuardar() BtnGuardar.Visible = PermiteGuardar()
If UsuarioActual.Empresa.Funcionalidad(525) = "1" Then If UsuarioActual.Empresa.Funcionalidad(525) = "1" Then
@@ -1591,6 +1614,7 @@ Partial Class Clientes
Else Else
DdlVendedor.SelectedValueExist(CveVendedor) DdlVendedor.SelectedValueExist(CveVendedor)
End If End If
CveVendedorOriginal = CveVendedor
'TxtVendedor.Text = ObjClientes.Vendedor 'TxtVendedor.Text = ObjClientes.Vendedor
TxtPlazoCobranza.Text = ObjClientes.PlazoCobranza.ToString() TxtPlazoCobranza.Text = ObjClientes.PlazoCobranza.ToString()
@@ -10569,5 +10593,39 @@ Partial Class Clientes
End Sub 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 End Class