--Subproyectos en catalogo de precios de lista
This commit is contained in:
@@ -2158,6 +2158,49 @@ Public Class ClsVentas
|
|||||||
#End Region
|
#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
|
#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
|
Public Function GetPrecioListas(Optional CveEmpresa As Integer = -1) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
@@ -2177,7 +2220,7 @@ Public Class ClsVentas
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
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
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
DataAdapter("PA_Vta_PrecioListaAdd")
|
DataAdapter("PA_Vta_PrecioListaAdd")
|
||||||
@@ -2188,6 +2231,7 @@ Public Class ClsVentas
|
|||||||
.Add("@PrecioLista", SqlDbType.VarChar).Value = PrecioLista
|
.Add("@PrecioLista", SqlDbType.VarChar).Value = PrecioLista
|
||||||
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
||||||
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
||||||
|
.Add("@Restringida", SqlDbType.Bit).Value = Restringida
|
||||||
.Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar
|
.Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar
|
||||||
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
|
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
|
||||||
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
|
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
@@ -2210,7 +2254,7 @@ Public Class ClsVentas
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function UpdatePrecioLista(PrecioLista As String, Estatus As Boolean, CveUsuario As Integer, Porcentaje As Double,
|
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
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
DataAdapter("PA_Vta_PrecioListaUpdate")
|
DataAdapter("PA_Vta_PrecioListaUpdate")
|
||||||
@@ -2221,6 +2265,7 @@ Public Class ClsVentas
|
|||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
||||||
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
||||||
|
.Add("@Restringida", SqlDbType.Bit).Value = Restringida
|
||||||
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
|
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
|
||||||
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
|
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
|
||||||
End With
|
End With
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:UpdatePanel runat="server" UpdateMode="conditional">
|
<asp:UpdatePanel runat="server" UpdateMode="conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:LinkButton runat="server" id="BtnOpenDiv"><i class="fa fa-plus"></i>Agregar Precio de Lista</asp:LinkButton>
|
<asp:LinkButton runat="server" ID="BtnOpenDiv"><i class="fa fa-plus"></i>Agregar Precio de Lista</asp:LinkButton>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</li>
|
</li>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:GridView ID="GvDatos" runat="server" GridLines="None" DataKeyNames="CvePrecioLista, PrecioLista, Estatus,Predeterminada" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
|
<asp:GridView ID="GvDatos" runat="server" GridLines="None" DataKeyNames="CvePrecioLista, PrecioLista, Estatus,Predeterminada,Restringuida" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField DataField="PrecioLista" ItemStyle-Width="50%" HeaderText="Precio de lista" ItemStyle-HorizontalAlign="Left" />
|
<asp:BoundField DataField="PrecioLista" ItemStyle-Width="50%" HeaderText="Precio de lista" ItemStyle-HorizontalAlign="Left" />
|
||||||
<asp:TemplateField HeaderText="Predeterminada" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
|
<asp:TemplateField HeaderText="Predeterminada" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
|
||||||
@@ -84,8 +84,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="dvEstatus" runat="server" class="form-group form-md-line-input input-iconright">
|
<div id="dvEstatus" runat="server" class="form-group form-md-line-input input-iconright">
|
||||||
<label>Activo: </label>
|
<label>Activo: </label>
|
||||||
<asp:Checkbox ID="chkEstatus" Text=" " runat="server" CssClass="chksino" Width="250px">
|
<asp:CheckBox ID="chkEstatus" Text=" " runat="server" CssClass="chksino" Width="250px"></asp:CheckBox>
|
||||||
</asp:Checkbox>
|
</div>
|
||||||
|
<div id="divPermiso" runat="server" visible="false" class="form-group form-md-line-input input-iconright">
|
||||||
|
<label>Restringida a permiso: </label>
|
||||||
|
<asp:CheckBox ID="ChkRestringida" Text=" " runat="server" CssClass="chksino" Width="250px"></asp:CheckBox>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<asp:GridView ID="GvSubProyectos" runat="server" GridLines="None" DataKeyNames="CveSubProyecto,SubProyecto,Permitir" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
|
||||||
|
<Columns>
|
||||||
|
<asp:BoundField DataField="SubProyecto" ItemStyle-Width="80%" HeaderText="Sucursal" ItemStyle-HorizontalAlign="Left" />
|
||||||
|
<asp:TemplateField HeaderText="Permitir" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:CheckBox ID="ChkPermitir" runat="server" Checked='<%# Eval("Permitir") %>' />
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
</Columns>
|
||||||
|
</asp:GridView>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
If Not Page.IsPostBack Then
|
If Not Page.IsPostBack Then
|
||||||
CvePrecioLista = -1
|
CvePrecioLista = -1
|
||||||
EsEditar = 0
|
EsEditar = 0
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||||
|
divPermiso.Visible = True
|
||||||
|
End If
|
||||||
dvEstatus.Visible = False
|
dvEstatus.Visible = False
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
End If
|
End If
|
||||||
@@ -56,9 +59,19 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
TxtPrecioLista.Text = GvRow.DataKey("PrecioLista").ToString
|
TxtPrecioLista.Text = GvRow.DataKey("PrecioLista").ToString
|
||||||
ChkPredeterminada.Checked = GvRow.DataKey("Predeterminada") = "True"
|
ChkPredeterminada.Checked = GvRow.DataKey("Predeterminada") = "True"
|
||||||
chkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
chkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
||||||
|
ChkRestringida.Checked = CBool(GvRow.DataKey("Restringuida"))
|
||||||
|
|
||||||
EsEditar = 1
|
EsEditar = 1
|
||||||
BtnAgregarCatalogo.Text = "Actualizar"
|
BtnAgregarCatalogo.Text = "Actualizar"
|
||||||
dvEstatus.Visible = True
|
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()
|
UpBodyCo.Update()
|
||||||
UpFooter.Update()
|
UpFooter.Update()
|
||||||
RegistraScript("$('#divAgregar').modal()")
|
RegistraScript("$('#divAgregar').modal()")
|
||||||
@@ -76,19 +89,46 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
Dim TieneError As Boolean = False
|
Dim TieneError As Boolean = False
|
||||||
Try
|
Try
|
||||||
If EsEditar = 0 Then
|
If EsEditar = 0 Then
|
||||||
If ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, 0, UpdateFranquicia:=ActualizarFranquicias) > 0 Then
|
Dim CvePrecioLista As Integer = ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, ChkRestringida.Checked, 0, UpdateFranquicia:=ActualizarFranquicias)
|
||||||
Alert("El Precio de Lista se agregó correctamente", TipoMensaje.MsgInformacion)
|
If Not CvePrecioLista > 0 Then
|
||||||
Else
|
|
||||||
Alert("Ocurrió un error al agregar el Precio de Lista", TipoMensaje.MsgError)
|
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
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
|
ElseIf EsEditar = 1 Then
|
||||||
If ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, CvePrecioLista, UpdateFranquicia:=ActualizarFranquicias) Then
|
If Not ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, ChkRestringida.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)
|
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
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
|
EsEditar = 0
|
||||||
dvEstatus.Visible = False
|
dvEstatus.Visible = False
|
||||||
BtnAgregarCatalogo.Text = "Agregar"
|
BtnAgregarCatalogo.Text = "Agregar"
|
||||||
@@ -100,8 +140,10 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
|
|
||||||
If TieneError Then
|
If TieneError Then
|
||||||
ObjVta.RollBack()
|
ObjVta.RollBack()
|
||||||
|
Alert("Ocurrió un error al guardar el precio de lista", TipoMensaje.MsgError)
|
||||||
Else
|
Else
|
||||||
ObjVta.Commit()
|
ObjVta.Commit()
|
||||||
|
Alert("El precio de lista se guardo correctamente", TipoMensaje.MsgInformacion)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
RegistraScript("$('#divAgregar').modal('hide')")
|
RegistraScript("$('#divAgregar').modal('hide')")
|
||||||
|
|||||||
Reference in New Issue
Block a user