--Catalogo de motivos de devolucion

This commit is contained in:
2024-07-17 19:36:25 -07:00
parent 64c2b55975
commit 1ba2988430
3 changed files with 188 additions and 2 deletions

View File

@@ -2803,13 +2803,13 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function GetMotivoDevolucion(CveMotivoDevolucion As Integer, Estatus As Boolean, CveEmpresa As Integer) As Boolean
Public Function GetMotivoDevolucion(CveMotivoDevolucion As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasMotivosDevolucionGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveMotivoDevolucion", SqlDbType.Int).Value = CveMotivoDevolucion
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
.Add("@Estatus", SqlDbType.Int).Value = Estatus
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With

View File

@@ -0,0 +1,93 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatMotivosDevoluciones.aspx.vb" Inherits="Ventas_CatMotivosDevoluciones" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Catálogo de motivos de devolución
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server" ID="UpAgregar">
<ContentTemplate>
<li>
<asp:LinkButton runat="server" ID="LnkAgregar" data-toggle="tooltip" data-placement="left" title="Agregar un motivo" Text="<i class='fa fa-plus'></i>Agregar motivo" OnClick="LnkAgregar_Click"></asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel runat="server" ID="UpDatos" UpdateMode="Conditional">
<ContentTemplate>
<%--Seccion lista resultados--%>
<div class="row">
<div class="col-md-9">
<div class="portlet light ">
<div class="portlet-body">
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right">
<div style="margin-right: 15px">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<asp:GridView ID="GvDatos" runat="server" GridLines="None" Width="100%" DataKeyNames="CveMotivoDevolucion,MotivoDevolucion,Estatus" CssClass=" table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" OnRowDeleting="GvDatos_RowDeleting">
<Columns>
<asp:BoundField DataField="MotivoDevolucion" HeaderText="Motivo" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="50%" />
<asp:BoundField DataField="EstatusTexto" HeaderText="Estatus" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
<asp:BoundField DataField="FechaIng" DataFormatString="{0:d}" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" />
<asp:TemplateField HeaderText="Acciones" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%">
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" OnClick="imgE_Click" AlternateText="Editar" CommandArgument='<%# Eval("CveMotivoDevolucion")%>' CausesValidation="False" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Desea eliminar este registro?" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivMotivo" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModal" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
<asp:Literal runat="server">Motivo de devolución</asp:Literal></h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtMotivo" CssClass="form-control " runat="server" MaxLength="50" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVMotivo" runat="server" ControlToValidate="TxtMotivo" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<label for="TxtMotivo">Motivo:</label>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<label for="ChkEstatus">Activo:</label>&nbsp;
<asp:CheckBox ID="ChkEstatus" runat="server" CssClass="make-switchsd" data-size="small" Text=" " Checked="true" />
<i></i>
</div>
</div>
<br />
<div class="modal-footer">
<asp:Button ID="BtnGuardar" runat="server" class="btn btn-success" Text="Guardar" ValidationGroup="GrpGuardar" OnClick="BtnGuardar_Click" />
<button id="Button3" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -0,0 +1,93 @@

Option Explicit On
Option Strict On
Imports Extensiones
Partial Class Ventas_CatMotivosDevoluciones
Inherits ClsPaginas
Private Property CveMotivoDevolucion As Integer
Get
Return (IfNull(ViewState("CveMotivoDevolucion"), "-1", ViewState("CveMotivoDevolucion"))).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveMotivoDevolucion") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaDatos()
End If
End Sub
Private Sub CargaDatos()
LimpiaDatos()
Using ObjVentas As New ClsVentas
If ObjVentas.GetMotivoDevolucion(-1, -1, UsuarioActual.CveEmpresa) Then
GvDatos.DataSource = ObjVentas.DtResultados.Copy()
End If
End Using
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As GridViewDeleteEventArgs)
Dim GvRow As GridViewRow = GvDatos.Rows(e.RowIndex)
CveMotivoDevolucion = GvRow.DataKey("CveMotivoDevolucion").ToEntero()
Using ObjVentas As New ClsVentas
If ObjVentas.RemoveMotivoDevolucion(CveMotivoDevolucion, UsuarioActual.CveEmpresa) Then
Alert("Se eliminó correctamente")
End If
End Using
CargaDatos()
End Sub
Protected Sub imgE_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CveMotivoDevolucion = GvRow.DataKey("CveMotivoDevolucion").ToEntero()
TxtMotivo.Text = GvRow.DataKey("MotivoDevolucion")
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
UpModal.Update()
RegistraScript("$('#DivMotivo').modal('show');")
End Sub
Private Sub LimpiaDatos()
CveMotivoDevolucion = -1
TxtMotivo.Text = ""
ChkEstatus.Checked = True
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
Dim Motivo As String = TxtMotivo.Text
'AGREGAR
Dim ObjVentas As New ClsVentas
If CveMotivoDevolucion = -1 Then
If ObjVentas.AddMotivoDevolucion(Motivo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("El motivo se agrego correctamente")
End If
Else
If ObjVentas.UpdateMotivoDevolucion(CveMotivoDevolucion, Motivo, ChkEstatus.Checked, UsuarioActual.CveEmpresa) Then
Alert("El motivo se actualizó correctamente")
End If
End If
ObjVentas.Dispose()
RegistraScript("$('#DivMotivo').modal('hide');")
CargaDatos()
End Sub
Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
LimpiaDatos()
RegistraScript("$('#DivMotivo').modal('show');")
End Sub
End Class