diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index 4323620af..726c85552 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -2158,6 +2158,49 @@ Public Class ClsVentas
#End Region
#Region "V E N T A S - P R E C I O L I S T A S" 'Hecho por Charlie 1/9/2016
+
+ Public Function GetPreciosListasSubProyecto(CvePrecioLista As Integer, CveEmpresa As Integer) As Boolean
+ Dim Retorno As Boolean = False
+
+ DataAdapter("PA_Vta_PrecioListaSubProyectosGet")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el Catálogo de Listas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+
+ Public Function UpdatePreciosListasSubProyecto(CvePrecioLista As Integer, CveSubProyecto As Integer, Permitir As Boolean, CveEmpresa As Integer) As Boolean
+ Dim Retorno As Boolean = False
+
+ DataAdapter("PA_Vta_PrecioListaSubProyectosUpdate")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
+ .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
+ .Add("@Permitir", SqlDbType.Bit).Value = Permitir
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el Catálogo de Listas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+
Public Function GetPrecioListas(Optional CveEmpresa As Integer = -1) As Boolean
Dim Retorno As Boolean = False
@@ -2177,7 +2220,7 @@ Public Class ClsVentas
Return Retorno
End Function
- Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1, Optional UpdateFranquicia As Boolean = False) As Integer
+ Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Restringida As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1, Optional UpdateFranquicia As Boolean = False) As Integer
Dim Retorno As Integer = -1
DataAdapter("PA_Vta_PrecioListaAdd")
@@ -2188,6 +2231,7 @@ Public Class ClsVentas
.Add("@PrecioLista", SqlDbType.VarChar).Value = PrecioLista
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
+ .Add("@Restringida", SqlDbType.Bit).Value = Restringida
.Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
@@ -2210,7 +2254,7 @@ Public Class ClsVentas
End Function
Public Function UpdatePrecioLista(PrecioLista As String, Estatus As Boolean, CveUsuario As Integer, Porcentaje As Double,
- Predeterminada As Boolean, CvePrecioLista As Integer, Optional UpdateFranquicia As Boolean = False) As Boolean
+ Predeterminada As Boolean, Restringida As Boolean, CvePrecioLista As Integer, Optional UpdateFranquicia As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PrecioListaUpdate")
@@ -2221,6 +2265,7 @@ Public Class ClsVentas
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
+ .Add("@Restringida", SqlDbType.Bit).Value = Restringida
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
End With
diff --git a/Ventas/CatPreciosLista.aspx b/Ventas/CatPreciosLista.aspx
index d694e50f9..2c33a6998 100644
--- a/Ventas/CatPreciosLista.aspx
+++ b/Ventas/CatPreciosLista.aspx
@@ -1,108 +1,125 @@
-<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatPreciosLista.aspx.vb" Inherits="Ventas_CatPreciosLista" %>
-
-
-
-
-
-
- Catálogo de Precios de Lista
-
-
-
-
-
+
+
+
+
diff --git a/Ventas/CatPreciosLista.aspx.vb b/Ventas/CatPreciosLista.aspx.vb
index 70a637066..79368fa16 100644
--- a/Ventas/CatPreciosLista.aspx.vb
+++ b/Ventas/CatPreciosLista.aspx.vb
@@ -31,6 +31,9 @@ Partial Class Ventas_CatPreciosLista
If Not Page.IsPostBack Then
CvePrecioLista = -1
EsEditar = 0
+ If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
+ divPermiso.Visible = True
+ End If
dvEstatus.Visible = False
CargaDatos()
End If
@@ -56,9 +59,19 @@ Partial Class Ventas_CatPreciosLista
TxtPrecioLista.Text = GvRow.DataKey("PrecioLista").ToString
ChkPredeterminada.Checked = GvRow.DataKey("Predeterminada") = "True"
chkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
+ ChkRestringida.Checked = CBool(GvRow.DataKey("Restringuida"))
+
EsEditar = 1
BtnAgregarCatalogo.Text = "Actualizar"
dvEstatus.Visible = True
+
+ Using ObjVenta As New ClsVentas
+ If ObjVenta.GetPreciosListasSubProyecto(CvePrecioLista, UsuarioActual.CveEmpresa) Then
+ GvSubProyectos.DataSource = ObjVenta.DtResultados.Copy()
+ End If
+ End Using
+ GvSubProyectos.DataBind()
+
UpBodyCo.Update()
UpFooter.Update()
RegistraScript("$('#divAgregar').modal()")
@@ -76,19 +89,46 @@ Partial Class Ventas_CatPreciosLista
Dim TieneError As Boolean = False
Try
If EsEditar = 0 Then
- If ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, 0, UpdateFranquicia:=ActualizarFranquicias) > 0 Then
- Alert("El Precio de Lista se agregó correctamente", TipoMensaje.MsgInformacion)
- Else
- Alert("Ocurrió un error al agregar el Precio de Lista", TipoMensaje.MsgError)
+ Dim CvePrecioLista As Integer = ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, ChkRestringida.Checked, 0, UpdateFranquicia:=ActualizarFranquicias)
+ If Not CvePrecioLista > 0 Then
TieneError = True
End If
+
+ If Not TieneError Then
+ If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
+ For Each GvRow As GridViewRow In GvSubProyectos.Rows
+ If GvRow.RowType = DataControlRowType.DataRow Then
+ Dim Permitir As Boolean = GvRow.FCCheckBox("ChkPermitir").Checked
+ Dim CveSubProyecto As Integer = GvRow.DataKey("CveSubProyecto").ToEntero()
+ If Not ObjVta.UpdatePreciosListasSubProyecto(CvePrecioLista, CveSubProyecto, Permitir, UsuarioActual.CveEmpresa) Then
+ TieneError = False
+ Exit For
+ End If
+ End If
+ Next
+ End If
+ End If
+
ElseIf EsEditar = 1 Then
- If ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, CvePrecioLista, UpdateFranquicia:=ActualizarFranquicias) Then
- Alert("El Precio de Lista se editó correctamente", TipoMensaje.MsgInformacion)
- Else
- Alert("Ocurrió un error al editar al Precio de Lista", TipoMensaje.MsgError)
+ If Not ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, ChkRestringida.Checked, CvePrecioLista, UpdateFranquicia:=ActualizarFranquicias) Then
TieneError = True
End If
+
+ If Not TieneError Then
+ If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
+ For Each GvRow As GridViewRow In GvSubProyectos.Rows
+ If GvRow.RowType = DataControlRowType.DataRow Then
+ Dim Permitir As Boolean = GvRow.FCCheckBox("ChkPermitir").Checked
+ Dim CveSubProyecto As Integer = GvRow.DataKey("CveSubProyecto").ToEntero()
+ If Not ObjVta.UpdatePreciosListasSubProyecto(Me.CvePrecioLista, CveSubProyecto, Permitir, UsuarioActual.CveEmpresa) Then
+ TieneError = False
+ Exit For
+ End If
+ End If
+ Next
+ End If
+ End If
+
EsEditar = 0
dvEstatus.Visible = False
BtnAgregarCatalogo.Text = "Agregar"
@@ -100,8 +140,10 @@ Partial Class Ventas_CatPreciosLista
If TieneError Then
ObjVta.RollBack()
+ Alert("Ocurrió un error al guardar el precio de lista", TipoMensaje.MsgError)
Else
ObjVta.Commit()
+ Alert("El precio de lista se guardo correctamente", TipoMensaje.MsgInformacion)
End If
RegistraScript("$('#divAgregar').modal('hide')")