diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb
index 5c3ef1f46..6d292dd55 100644
--- a/App_Code/ClsGenerales.vb
+++ b/App_Code/ClsGenerales.vb
@@ -309,8 +309,60 @@ Public Class ClsGenerales
OnError("Ocurrió un error al agregar los motivos de cancelacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return retorno
- End Function
-
+ End Function
+ Public Function AddMotivoCancelacionEmpresa(CveSATMotivoCancelacion As Integer, MotivoCancelacion As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_Gral_MotivosCancelacionAdd")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveSATMotivoCancelacion", SqlDbType.Int).Value = CveSATMotivoCancelacion
+ .Add("@MotivoCancelacion", SqlDbType.VarChar).Value = MotivoCancelacion
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al agregar el motivo de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+
+ Public Function UpdateMotivoCancelacionEmpresa(CveMotivoCancelacion As Integer, CveSATMotivoCancelacion As Integer, MotivoCancelacion As String, Estatus As Boolean, CveEmpresa As Integer) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_Gral_MotivosCancelacionUpdate")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion
+ .Add("@CveSATMotivoCancelacion", SqlDbType.Int).Value = CveSATMotivoCancelacion
+ .Add("@MotivoCancelacion", SqlDbType.VarChar).Value = MotivoCancelacion
+ .Add("@Estatus", SqlDbType.Bit).Value = Estatus
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al actualizar el motivo de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+
+ Public Function RemoveMotivoCancelacionEmpresa(CveMotivoCancelacion As Integer, CveEmpresa As Integer) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_Gral_MotivosCancelacionRemove")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al eliminar el motivo de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+
#Region " I N D I C A D O R E S Y G R A F I C A S"
Public Function GetIndicadores(CveEmpresa As Integer) As DataSet
'Dim Retorno As Boolean = False
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index c67828485..aecba94a2 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -10824,6 +10824,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146)
PaginaDict.Add("/Ventas/CatMotivosDevoluciones.aspx".ToUpper(), 786)
PaginaDict.Add("/Ventas/CatPSSubProyectosVendedores.aspx".ToUpper(), 787)
+ PaginaDict.Add("/Ventas/CatMotivosCancelacion.aspx".ToUpper(), 788)
#End Region
#Region "VIA"
diff --git a/Ventas/CatMotivosCancelacion.aspx b/Ventas/CatMotivosCancelacion.aspx
new file mode 100644
index 000000000..3beb5f346
--- /dev/null
+++ b/Ventas/CatMotivosCancelacion.aspx
@@ -0,0 +1,98 @@
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatMotivosCancelacion.aspx.vb" Inherits="Ventas_CatMotivosCancelacion" %>
+
+
+
+
+
+
+ Catálogo de motivos de cancelación
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ventas/CatMotivosCancelacion.aspx.vb b/Ventas/CatMotivosCancelacion.aspx.vb
new file mode 100644
index 000000000..bf91326fe
--- /dev/null
+++ b/Ventas/CatMotivosCancelacion.aspx.vb
@@ -0,0 +1,103 @@
+
+Option Explicit On
+Option Strict On
+
+Imports Extensiones
+
+
+Partial Class Ventas_CatMotivosCancelacion
+ Inherits ClsPaginas
+
+ Private Property CveMotivoCancelacion As Integer
+ Get
+ Return (IfNull(ViewState("CveMotivoCancelacion"), "-1", ViewState("CveMotivoCancelacion"))).ToString().ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveMotivoCancelacion") = value
+ End Set
+ End Property
+
+ Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
+ If Not Page.IsPostBack Then
+ CargaCombos()
+ CargaDatos()
+ End If
+ End Sub
+
+ Private Sub CargaCombos()
+ DdlMotivoSAT.DataSource = GlobalDTSATMotivosCancelacion()
+ DdlMotivoSAT.DataBind()
+
+ UpModal.Update()
+ End Sub
+
+ Private Sub CargaDatos()
+ LimpiaDatos()
+
+ Dim ObjGral As New ClsGenerales()
+ If ObjGral.GetMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa) Then
+ GvDatos.DataSource = ObjGral.DtResultados.Copy()
+ End If
+ ObjGral.Dispose()
+ GvDatos.DataBind()
+
+ UpDatos.Update()
+ End Sub
+
+ Protected Sub GvDatos_RowDeleting(sender As Object, e As GridViewDeleteEventArgs)
+ Dim GvRow As GridViewRow = GvDatos.Rows(e.RowIndex)
+
+ CveMotivoCancelacion = GvRow.DataKey("CveMotivoCancelacion").ToEntero()
+
+ Using ObjVentas As New ClsGenerales
+ If ObjVentas.RemoveMotivoCancelacionEmpresa(CveMotivoCancelacion, 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)
+
+ CveMotivoCancelacion = GvRow.DataKey("CveMotivoCancelacion").ToEntero()
+ TxtMotivo.Text = GvRow.DataKey("MotivoCancelacion")
+ DdlMotivoSAT.SelectedValueExist(GvRow.DataKey("CveSATMotivoCancelacion"))
+ ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
+
+ UpModal.Update()
+
+ RegistraScript("$('#DivMotivo').modal('show');")
+ End Sub
+
+ Private Sub LimpiaDatos()
+ CveMotivoCancelacion = -1
+ TxtMotivo.Text = ""
+ ChkEstatus.Checked = True
+ End Sub
+ Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
+ Dim Motivo As String = TxtMotivo.Text
+
+ Dim ObjVentas As New ClsGenerales
+ If CveMotivoCancelacion = -1 Then
+ If ObjVentas.AddMotivoCancelacionEmpresa(DdlMotivoSAT.SelectedValue.ToEntero(), Motivo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
+ Alert("El motivo se agrego correctamente")
+ End If
+ Else
+ If ObjVentas.UpdateMotivoCancelacionEmpresa(CveMotivoCancelacion, DdlMotivoSAT.SelectedValue.ToEntero(), 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