Clientes, Sunproyectos Precios de Lista Funcionalidad 404
This commit is contained in:
@@ -1976,7 +1976,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) As Integer
|
Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1) As Integer
|
||||||
Dim Retorno As Integer = -1
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
DataAdapter("PA_Vta_PrecioListaAdd")
|
DataAdapter("PA_Vta_PrecioListaAdd")
|
||||||
@@ -1987,6 +1987,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("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar
|
||||||
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
|
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
End With
|
End With
|
||||||
|
|
||||||
|
|||||||
@@ -402,8 +402,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-md-line-input input-iconright" runat="server">
|
<div class="form-group form-md-line-input input-iconright" runat="server" id="DVModalPrecioLista" visible="false">
|
||||||
<asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" DataTextField="PrecioLista" DataValueField="CvePrecioLista" CssClass="form-control select2me" Width="100%"></asp:DropDownList>
|
<asp:DropDownList ID="DdlPrecioLista" runat="server" CausesValidation="true" AppendDataBoundItems="true" DataTextField="PrecioLista" DataValueField="CvePrecioLista" CssClass="form-control select2me" Width="100%"></asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RfvDdlPrecioLista" InitialValue="-1" runat="server" CssClass="help-block errorimput" ControlToValidate="DdlPrecioLista"
|
||||||
|
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Lista de Precio''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
|
||||||
<label for="<%= DdlPrecioLista.ClientID.ToString()%>">Lista de Precio:</label>
|
<label for="<%= DdlPrecioLista.ClientID.ToString()%>">Lista de Precio:</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -449,7 +452,7 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:LinkButton ID="BtnGuardar" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='material-icons'>done_all</i> Guardar</asp:LinkButton>
|
<asp:LinkButton ID="BtnGuardar" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio" CausesValidation="true"> <i class='material-icons'>done_all</i> Guardar</asp:LinkButton>
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ Partial Class CatSubProyectos
|
|||||||
DivSegmentoNegocio.Visible = True
|
DivSegmentoNegocio.Visible = True
|
||||||
End If
|
End If
|
||||||
BtnGuardar.OnClientClick = $"ValidaGuardar();"
|
BtnGuardar.OnClientClick = $"ValidaGuardar();"
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(404) = "20" Then
|
||||||
|
DVModalPrecioLista.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -285,6 +290,9 @@ Partial Class CatSubProyectos
|
|||||||
End Sub
|
End Sub
|
||||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
|
||||||
|
Tab.ActiveTabIndex = 0
|
||||||
|
|
||||||
CveCentroCosto = (GvRow.DataKey("CveSubProyecto")).ToEntero
|
CveCentroCosto = (GvRow.DataKey("CveSubProyecto")).ToEntero
|
||||||
HdnModalidad.Value = "U"
|
HdnModalidad.Value = "U"
|
||||||
TxtCentroCosto.Text = (GvRow.DataKey("SubProyecto"))
|
TxtCentroCosto.Text = (GvRow.DataKey("SubProyecto"))
|
||||||
|
|||||||
@@ -735,6 +735,9 @@
|
|||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<div runat="server" class="form-group form-md-line-input input-iconright">
|
<div runat="server" class="form-group form-md-line-input input-iconright">
|
||||||
<asp:DropDownList ID="DdlPrecioLista" runat="server" CssClass="form-control select2me" Width="100%" DataTextField="PrecioLista" DataValueField="CvePrecioLista"></asp:DropDownList>
|
<asp:DropDownList ID="DdlPrecioLista" runat="server" CssClass="form-control select2me" Width="100%" DataTextField="PrecioLista" DataValueField="CvePrecioLista"></asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RfvDdlPrecioLista" InitialValue="-1" runat="server" CssClass="help-block errorimput" ControlToValidate="DdlPrecioLista"
|
||||||
|
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Lista de Precio''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
<label for="<%= DdlPrecioLista.ClientID.ToString()%>">Precio Lista:</label>
|
<label for="<%= DdlPrecioLista.ClientID.ToString()%>">Precio Lista:</label>
|
||||||
<i></i>
|
<i></i>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
Option Strict On
|
Option Strict On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
|
Imports System.Data.SqlClient
|
||||||
Imports System.Globalization
|
Imports System.Globalization
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Net
|
Imports System.Net
|
||||||
@@ -646,6 +647,19 @@ Partial Class Clientes
|
|||||||
End Property
|
End Property
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
Property CvePrecioListaOriginal As Integer
|
||||||
|
Get
|
||||||
|
If ViewState("CvePrecioListaOriginal") Is Nothing Then
|
||||||
|
Return 0
|
||||||
|
Else
|
||||||
|
Return ViewState("CvePrecioListaOriginal").ToString().ToEntero()
|
||||||
|
End If
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
ViewState("CvePrecioListaOriginal") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
@@ -1231,7 +1245,7 @@ Partial Class Clientes
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
UpDatos.Update()
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -1452,7 +1466,8 @@ Partial Class Clientes
|
|||||||
TxtNotificar.Text = ObjClientes.NotificarA
|
TxtNotificar.Text = ObjClientes.NotificarA
|
||||||
TxtPagina.Text = ObjClientes.Pagina
|
TxtPagina.Text = ObjClientes.Pagina
|
||||||
'TxtGiro.Text = ObjClientes.Giro
|
'TxtGiro.Text = ObjClientes.Giro
|
||||||
DdlPrecioLista.SelectedValue = ObjClientes.CvePrecioLista.ToString()
|
DdlPrecioLista.SelectedValueExist(ObjClientes.CvePrecioLista.ToString())
|
||||||
|
CvePrecioListaOriginal = ObjClientes.CvePrecioLista
|
||||||
|
|
||||||
TxtCC.Text = ObjClientes.NotificarA
|
TxtCC.Text = ObjClientes.NotificarA
|
||||||
ChkMail.Checked = ObjClientes.EnviarFactura
|
ChkMail.Checked = ObjClientes.EnviarFactura
|
||||||
@@ -2483,7 +2498,7 @@ Partial Class Clientes
|
|||||||
Dim FechaLimiteCredito As Date = If(TxtFechaLimiteCredito.Text.Trim.Length > 0, TxtFechaLimiteCredito.Text.ToDate, New Date(1900, 1, 1))
|
Dim FechaLimiteCredito As Date = If(TxtFechaLimiteCredito.Text.Trim.Length > 0, TxtFechaLimiteCredito.Text.ToDate, New Date(1900, 1, 1))
|
||||||
Dim GeneroCliente As Boolean = If(DdlGeneroCliente.SelectedValue.ToEntero = 1 Or DdlGeneroCliente.SelectedValue.ToEntero = -1, True, False)
|
Dim GeneroCliente As Boolean = If(DdlGeneroCliente.SelectedValue.ToEntero = 1 Or DdlGeneroCliente.SelectedValue.ToEntero = -1, True, False)
|
||||||
|
|
||||||
Dim CvePrecioLista As Integer = DdlPrecioLista.SelectedValue.ToEntero()
|
|
||||||
|
|
||||||
'If DivCrearPrecioLista.Visible AndAlso ChkCrearPrecioLista.Checked Then
|
'If DivCrearPrecioLista.Visible AndAlso ChkCrearPrecioLista.Checked Then
|
||||||
' CvePrecioListaNuevo = ObjVentas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, 0)
|
' CvePrecioListaNuevo = ObjVentas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, 0)
|
||||||
@@ -2494,6 +2509,17 @@ Partial Class Clientes
|
|||||||
' End If
|
' End If
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
|
If Not ErrorProceso AndAlso UsuarioActual.Empresa.Funcionalidad(404).Contiene("10", "30") Then
|
||||||
|
If DdlPrecioLista.SelectedValue.ToEntero.Contiene(-2, -3) Then
|
||||||
|
If Not AsignaLista(ObjClientes.IniciaTransacSQL) Then
|
||||||
|
ErrorProceso = True
|
||||||
|
Alert("Error al generar lista de precios.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim CvePrecioLista As Integer = DdlPrecioLista.SelectedValue.ToEntero()
|
||||||
|
|
||||||
If Not ErrorProceso Then
|
If Not ErrorProceso Then
|
||||||
'VERIFICA SI ES CLIENTE NUEVO O ACTUALIZACION
|
'VERIFICA SI ES CLIENTE NUEVO O ACTUALIZACION
|
||||||
If Me.CveCliente = -1 Then
|
If Me.CveCliente = -1 Then
|
||||||
@@ -2614,6 +2640,7 @@ Partial Class Clientes
|
|||||||
|
|
||||||
If ErrorProceso Then
|
If ErrorProceso Then
|
||||||
ObjClientes.RollBack()
|
ObjClientes.RollBack()
|
||||||
|
CargaPrecioLista()
|
||||||
Alert("Ocurrió un error al guardar.", TipoMensaje.MsgError)
|
Alert("Ocurrió un error al guardar.", TipoMensaje.MsgError)
|
||||||
Else
|
Else
|
||||||
ObjClientes.Commit()
|
ObjClientes.Commit()
|
||||||
@@ -6177,7 +6204,7 @@ Partial Class Clientes
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "IMPRIMIR GVHistorial"
|
#Region "IMPRIMIR GVHistorial"
|
||||||
Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs)
|
||||||
Dim retorno As Byte() = Nothing
|
Dim retorno As Byte() = Nothing
|
||||||
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
||||||
Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||||
@@ -10300,25 +10327,75 @@ Partial Class Clientes
|
|||||||
RegistraScript("$('#DivAgregarPrecioLista').modal('show');")
|
RegistraScript("$('#DivAgregarPrecioLista').modal('show');")
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub BtnGuardarPL_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnGuardarPL_Click(sender As Object, e As EventArgs)
|
||||||
Dim ObjVentas As New ClsVentas()
|
|
||||||
Dim CvePrecioListaNuevo As Integer = ObjVentas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, False, 0)
|
LimpiaItemsListaPrecion()
|
||||||
If CvePrecioListaNuevo > 0 Then
|
|
||||||
Alert("La lista de precio se guardo correctamente")
|
If DdlPrecioListaClonar.SelectedValue.ToEntero > 0 Then
|
||||||
RegistraScript("$('#DivAgregarPrecioLista').modal('hide');")
|
DdlPrecioLista.Items.Add(New ListItem(TxtPrecioLista.Text, "-3"))
|
||||||
|
DdlPrecioLista.SelectedValueExist("-3")
|
||||||
Else
|
Else
|
||||||
Alert("Ocurrió un error al guardar la lista de precio", TipoMensaje.MsgError)
|
DdlPrecioLista.Items.Add(New ListItem(TxtPrecioLista.Text, "-2"))
|
||||||
|
DdlPrecioLista.SelectedValueExist("-2")
|
||||||
|
End If
|
||||||
|
|
||||||
|
'Alert("La lista de precio se guardo correctamente")
|
||||||
|
|
||||||
|
UpDatos.Update()
|
||||||
|
|
||||||
|
RegistraScript("$('#DivAgregarPrecioLista').modal('hide');")
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub LimpiaItemsListaPrecion()
|
||||||
|
|
||||||
|
DdlPrecioLista.SelectedValue = Nothing
|
||||||
|
DdlPrecioLista.ClearSelection()
|
||||||
|
|
||||||
|
For i As Integer = DdlPrecioLista.Items.Count - 1 To 0 Step -1
|
||||||
|
If DdlPrecioLista.Items(i).Value.Contiene("-2", "-3") Then
|
||||||
|
DdlPrecioLista.Items.RemoveAt(i)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function AsignaLista(ByRef transaccionSQL As SqlTransaction) As Boolean
|
||||||
|
|
||||||
|
Dim respuesta As Boolean = True
|
||||||
|
Dim CvePrecioListaClonar As Integer = -1
|
||||||
|
|
||||||
|
If DdlPrecioLista.SelectedValue.ToEntero = -3 Then 'Clñonar
|
||||||
|
CvePrecioListaClonar = DdlPrecioListaClonar.SelectedValue.ToEntero
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim ObjVentas As New ClsVentas(transaccionSQL)
|
||||||
|
Dim CvePrecioListaNuevo As Integer = ObjVentas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, False, 0, CvePrecioListaClonar:=CvePrecioListaClonar)
|
||||||
|
|
||||||
|
If Not CvePrecioListaNuevo > 0 Then
|
||||||
|
respuesta = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'RECARGA GLOBAL DE LISTA DE PRECIOS SI SE GENERO UNO NUEVO
|
'RECARGA GLOBAL DE LISTA DE PRECIOS SI SE GENERO UNO NUEVO
|
||||||
If CvePrecioListaNuevo > 0 Then
|
If CvePrecioListaNuevo > 0 Then
|
||||||
|
|
||||||
|
|
||||||
GlobalDTPrecioListas(UsuarioActual.CveEmpresa) = Nothing
|
GlobalDTPrecioListas(UsuarioActual.CveEmpresa) = Nothing
|
||||||
|
If ObjVentas.GetPrecioListas(UsuarioActual.CveEmpresa) Then
|
||||||
|
DdlPrecioLista.DataSource = ObjVentas.DtResultados
|
||||||
|
Else
|
||||||
|
DdlPrecioLista.DataSource = Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
CargaPrecioLista()
|
DdlPrecioLista.DataBind()
|
||||||
|
DdlPrecioLista.Items.Insert(0, New ListItem(" - ", "-1"))
|
||||||
|
'CargaPrecioLista()
|
||||||
DdlPrecioLista.SelectedValueExist(CvePrecioListaNuevo)
|
DdlPrecioLista.SelectedValueExist(CvePrecioListaNuevo)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UpDatos.Update()
|
UpDatos.Update()
|
||||||
End Sub
|
|
||||||
|
Return respuesta
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user