--Subproyectos en catalogo de precios de lista
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<li>
|
||||
<asp:UpdatePanel runat="server" UpdateMode="conditional">
|
||||
<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>
|
||||
</asp:UpdatePanel>
|
||||
</li>
|
||||
@@ -21,13 +21,13 @@
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
<div class="row" style="margin-left:0px;margin-top:5px;margin-bottom:5px;text-align: right;margin-right: 5px;" align="left">
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right; margin-right: 5px;" align="left">
|
||||
<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>
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<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>
|
||||
<asp:BoundField DataField="PrecioLista" ItemStyle-Width="50%" HeaderText="Precio de lista" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:TemplateField HeaderText="Predeterminada" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
|
||||
@@ -84,8 +84,25 @@
|
||||
</div>
|
||||
<div id="dvEstatus" runat="server" class="form-group form-md-line-input input-iconright">
|
||||
<label>Activo: </label>
|
||||
<asp:Checkbox ID="chkEstatus" Text=" " runat="server" CssClass="chksino" Width="250px">
|
||||
</asp:Checkbox>
|
||||
<asp:CheckBox ID="chkEstatus" Text=" " runat="server" CssClass="chksino" Width="250px"></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>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
@@ -93,7 +110,7 @@
|
||||
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:LinkButton ID="BtnAgregarCatalogo" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"></asp:LinkButton>
|
||||
<button id="btnCancelar" data-dismiss="modal" class="btn btn-default" >Cancelar</button>
|
||||
<button id="btnCancelar" data-dismiss="modal" class="btn btn-default">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
@@ -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')")
|
||||
|
||||
Reference in New Issue
Block a user