-
This commit is contained in:
@@ -14,8 +14,7 @@ Public Class ClsTransportes
|
||||
Private Data As DataTable
|
||||
Private DSet As New DataSet
|
||||
|
||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||
'REGISTRAR CONEXIÓN
|
||||
Private disposedValue As Boolean = False
|
||||
Private CveConexion As Integer = 0
|
||||
Public ReadOnly Property DtResultados() As DataTable
|
||||
Get
|
||||
@@ -164,7 +163,6 @@ Public Class ClsTransportes
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetViajes(CveViaje As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
@@ -194,34 +192,6 @@ Public Class ClsTransportes
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
'Public Function AddViajePasajero(CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime, CvePartida As Integer, CveDestino As Integer, Optional IsMasivo As Boolean = False, Optional CveMasivo As Integer = -1) As Integer
|
||||
' Dim Retorno As Integer = -1
|
||||
|
||||
' DataAdapter("PA_Trans_ViajesAdd")
|
||||
|
||||
' With SqlAdapter.SelectCommand.Parameters
|
||||
' .Add("@CveViaje", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||
' .Add("@CveRuta", SqlDbType.Int).Value = CveRuta
|
||||
' .Add("@CveAF", SqlDbType.Int).Value = CveAF
|
||||
' .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
|
||||
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
' .Add("@Fecha", SqlDbType.DateTime).Value = Fecha
|
||||
' .Add("@CvePartida", SqlDbType.Int).Value = CvePartida
|
||||
' .Add("@CveDestino", SqlDbType.Int).Value = CveDestino
|
||||
' .Add("@IsMasivo", SqlDbType.Bit).Value = IsMasivo
|
||||
' .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
|
||||
' End With
|
||||
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViaje").Value.ToString)
|
||||
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
'End Function
|
||||
|
||||
Public Function RemoveViaje(Optional CveViaje As Integer = -1, Optional CveMasivo As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
@@ -271,42 +241,45 @@ Public Class ClsTransportes
|
||||
#End Region
|
||||
|
||||
#Region "Boletos"
|
||||
Public Function AddViajePasajeros(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer) As Integer
|
||||
Public Function AddViajesPasajeros(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer) As Integer
|
||||
Dim Retorno As Integer = -1
|
||||
|
||||
DataAdapter("PA_Trans_ViajesPasajerosAdd")
|
||||
DataAdapter("PA_Trans_ViajesAdd")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveViajePasajero", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||
.Add("@CveDestinoOrigen", SqlDbType.Int).Value = CveDestinoOrigen
|
||||
.Add("@CveDestinoFinal", SqlDbType.Int).Value = CveDestinoFinal
|
||||
.Add("@Importe", SqlDbType.SmallMoney).Value = Importe
|
||||
.Add("@Asiento", SqlDbType.TinyInt).Value = Asiento
|
||||
.Add("@Importe", SqlDbType.Money).Value = Importe
|
||||
.Add("@Asiento", SqlDbType.Int).Value = Asiento
|
||||
.Add("@Nombre", SqlDbType.VarChar).Value = Nombre
|
||||
.Add("@Visa", SqlDbType.VarChar).Value = Visa
|
||||
.Add("@Celular", SqlDbType.VarChar).Value = Celular
|
||||
.Add("@Sexo", SqlDbType.Bit).Value = Sexo
|
||||
.Add("@Observacion", SqlDbType.VarChar).Value = Observacion
|
||||
.Add("@Estatus", SqlDbType.Bit).Value = 1
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViajePasajero").Value.ToString)
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guardar el nuevo boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function GetViajesPasajeros(CveViaje As Integer, Optional CveViajePasajero As Integer = 0) As Boolean
|
||||
Public Function GetViajesPasajeros(CveViaje As Integer, Optional CveViajePasajero As Integer = 0, Optional Estatus As Boolean = False) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("[PA_Trans_ViajesPasajerosGet]")
|
||||
If CveViajePasajero <> 0 Then
|
||||
DataAdapter("PA_Trans_ViajesPasajerosGet")
|
||||
If Estatus = True Then
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
|
||||
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
|
||||
End With
|
||||
Else
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -318,11 +291,31 @@ Public Class ClsTransportes
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el catálogo de viajes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
OnError("Ocurrió un error al obtener el catálogo de boletos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UpdateViajesPasajeros(CveViajePasajero As Integer, Optional Estatus As Boolean = True, Optional Activar As Boolean = False) As Boolean
|
||||
|
||||
If Activar Then
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Trans_ViajesPasajerosUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
|
||||
.Add("@Estatus", SqlDbType.Int).Value = Estatus
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar el boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End If
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Tarifas"
|
||||
|
||||
@@ -1976,7 +1976,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) 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
|
||||
|
||||
DataAdapter("PA_Vta_PrecioListaAdd")
|
||||
@@ -1987,6 +1987,7 @@ Public Class ClsVentas
|
||||
.Add("@PrecioLista", SqlDbType.VarChar).Value = PrecioLista
|
||||
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
||||
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
||||
.Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar
|
||||
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||
End With
|
||||
|
||||
|
||||
@@ -402,8 +402,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright" runat="server">
|
||||
<asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" DataTextField="PrecioLista" DataValueField="CvePrecioLista" CssClass="form-control select2me" Width="100%"></asp:DropDownList>
|
||||
<div class="form-group form-md-line-input input-iconright" runat="server" id="DVModalPrecioLista" visible="false">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -449,7 +452,7 @@
|
||||
<div class="modal-footer">
|
||||
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
|
||||
<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>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
@@ -92,6 +92,11 @@ Partial Class CatSubProyectos
|
||||
DivSegmentoNegocio.Visible = True
|
||||
End If
|
||||
BtnGuardar.OnClientClick = $"ValidaGuardar();"
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(404) = "20" Then
|
||||
DVModalPrecioLista.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -285,6 +290,9 @@ Partial Class CatSubProyectos
|
||||
End Sub
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
Tab.ActiveTabIndex = 0
|
||||
|
||||
CveCentroCosto = (GvRow.DataKey("CveSubProyecto")).ToEntero
|
||||
HdnModalidad.Value = "U"
|
||||
TxtCentroCosto.Text = (GvRow.DataKey("SubProyecto"))
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.disponible:hover {
|
||||
.disponible:hover,.disponible.activo {
|
||||
background-color: #45b6af;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.disponible.activo {
|
||||
{
|
||||
background-color: #45b6af;
|
||||
color: #fff;
|
||||
}
|
||||
@@ -49,16 +49,20 @@
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.chofer {
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
background-color: #BFBFBF;
|
||||
.btnChofer {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
border-radius: 10px !important;
|
||||
margin: 5px;
|
||||
cursor: pointer;
|
||||
color: black;
|
||||
border: 1px solid black;
|
||||
text-align: center;
|
||||
color: black
|
||||
}
|
||||
.btnChofer a{
|
||||
color:#2C3E50;
|
||||
}
|
||||
|
||||
|
||||
.btnChofer:hover {
|
||||
background-color: #E1E5EC;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
@@ -218,8 +222,8 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5" class="chofer my-1">
|
||||
<asp:LinkButton ID="chofer" runat="server" class="chofer"
|
||||
<td colspan="2" class="btnChofer my-1">
|
||||
<asp:LinkButton ID="chofer" runat="server"
|
||||
Text="<i class='fa fa-user'><br/>Chofer</i>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -65,7 +65,7 @@ Partial Class Boletos
|
||||
TxtFecha.Text = ObjViaje.Fecha.ToShortDateString
|
||||
'Boletos Vendidos
|
||||
Dim dt As DataTable
|
||||
If ObjViaje.GetViajesPasajeros(CveViaje) Then
|
||||
If ObjViaje.GetViajesPasajeros(CveViaje, Estatus:=True) Then 'Poner párametro para estatus y cancelado de viajes
|
||||
dt = ObjViaje.DtResultados
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
For Each dr As DataRow In dt.Rows
|
||||
@@ -138,7 +138,6 @@ Partial Class Boletos
|
||||
linkButton.CssClass += " activo"
|
||||
AsientoSeleccionado = buttonID
|
||||
End Sub
|
||||
|
||||
Protected Sub AddBoleto(sender As Object, e As EventArgs)
|
||||
|
||||
If AsientoSeleccionado = "" Then
|
||||
@@ -151,7 +150,7 @@ Partial Class Boletos
|
||||
|
||||
Try
|
||||
AsientoSeleccionado = AsientoSeleccionado.Replace("A", "")
|
||||
Dim retorno As Integer = ObjTransporte.AddViajePasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario)
|
||||
Dim retorno As Integer = ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario)
|
||||
|
||||
If retorno > 1 Then
|
||||
ObjTransporte.Commit()
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
.my-1 {
|
||||
margin-block: 1rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
</asp:Content>
|
||||
|
||||
@@ -76,10 +75,10 @@
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
|
||||
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
|
||||
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
|
||||
<asp:LinkButton ID="BtnToggle" runat="server" AlternateText="Activar/Desactivar"
|
||||
CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-cancel'></i>"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
|
||||
data-btn-ok-label="si" />
|
||||
data-toggle="confirmation" data-popout="true" data-original-title='<%# If(Eval("Estatus").ToString = "True", "Cancelar Boleto", "Reactivar") %>'
|
||||
data-btn-ok-label="si" OnClick="ToggleViajesPasajeros" />
|
||||
<asp:LinkButton ID="BtnViaje" runat="server" AlternateText="Viaje"
|
||||
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-print'></i>" />
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
Imports ADSNetLibrary.Helpers
|
||||
Imports ADSNetLibrary.SIGAPI.Helpers
|
||||
Imports Extensiones.ModExtensiones
|
||||
|
||||
@@ -40,4 +41,28 @@ Partial Class ListadoBoletos
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub ToggleViajesPasajeros(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim CveViajePasajero As String = GvRow.DataKey("CveViajePasajero")
|
||||
Dim Estatus As String = GvRow.DataKey("Estatus")
|
||||
Dim cambiarEstatus As Boolean = Not Estatus.ToBool
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
Try
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero.ToEntero, Activar:=True, Estatus:=cambiarEstatus) Then
|
||||
Alert("El boleto ha sido cancelado correctamente.")
|
||||
End If
|
||||
ObjTransportes.Commit()
|
||||
|
||||
Catch ex As Exception
|
||||
ObjTransportes.RollBack()
|
||||
Alert($"No se pudo cambiar el estatus del boleto {ex}", TipoMensaje.MsgError)
|
||||
Finally
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -6,6 +6,16 @@ Imports Extensiones.ModExtensiones
|
||||
Partial Class ListadoViajes
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "Propiedades"
|
||||
Private Property CveViaje As String
|
||||
Get
|
||||
Return ViewState("CveViaje").ToString()
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("CveViaje") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
If Not IsPostBack Then
|
||||
@@ -155,11 +165,11 @@ Partial Class ListadoViajes
|
||||
DdlDestino.SelectedValue = ""
|
||||
End If
|
||||
Else
|
||||
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
|
||||
|
||||
If ObjTransportes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
||||
If ObjTransportes.UpdateViajes(CveViaje.ToEntero, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
||||
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
|
||||
ObjTransportes.Commit()
|
||||
CargaDatos()
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -181,6 +191,8 @@ Partial Class ListadoViajes
|
||||
DdlDestino.SelectedValue = GvRow.DataKey("CveDestino")
|
||||
DdlPartida.SelectedValue = GvRow.DataKey("CvePartida")
|
||||
DdlChofer.SelectedValue = GvRow.DataKey("CvePersonal")
|
||||
ViewState("CveViaje") = GvRow.DataKey("CveViaje")
|
||||
Page.Response.Write("<script>console.log('El resultado de tu variable" + CveViaje + "')</script>")
|
||||
Dim fecha As DateTime
|
||||
|
||||
If DateTime.TryParse(GvRow.DataKey("Fecha").ToString, fecha) Then
|
||||
|
||||
@@ -735,6 +735,9 @@
|
||||
<div class="col-md-10">
|
||||
<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: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>
|
||||
<i></i>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.Net
|
||||
@@ -646,6 +647,19 @@ Partial Class Clientes
|
||||
End Property
|
||||
|
||||
#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
|
||||
If Not IsPostBack Then
|
||||
@@ -1231,7 +1245,7 @@ Partial Class Clientes
|
||||
End If
|
||||
|
||||
|
||||
|
||||
UpDatos.Update()
|
||||
|
||||
|
||||
End Sub
|
||||
@@ -1452,7 +1466,8 @@ Partial Class Clientes
|
||||
TxtNotificar.Text = ObjClientes.NotificarA
|
||||
TxtPagina.Text = ObjClientes.Pagina
|
||||
'TxtGiro.Text = ObjClientes.Giro
|
||||
DdlPrecioLista.SelectedValue = ObjClientes.CvePrecioLista.ToString()
|
||||
DdlPrecioLista.SelectedValueExist(ObjClientes.CvePrecioLista.ToString())
|
||||
CvePrecioListaOriginal = ObjClientes.CvePrecioLista
|
||||
|
||||
TxtCC.Text = ObjClientes.NotificarA
|
||||
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 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
|
||||
' CvePrecioListaNuevo = ObjVentas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, 0)
|
||||
@@ -2494,6 +2509,17 @@ Partial Class Clientes
|
||||
' 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
|
||||
'VERIFICA SI ES CLIENTE NUEVO O ACTUALIZACION
|
||||
If Me.CveCliente = -1 Then
|
||||
@@ -2614,6 +2640,7 @@ Partial Class Clientes
|
||||
|
||||
If ErrorProceso Then
|
||||
ObjClientes.RollBack()
|
||||
CargaPrecioLista()
|
||||
Alert("Ocurrió un error al guardar.", TipoMensaje.MsgError)
|
||||
Else
|
||||
ObjClientes.Commit()
|
||||
@@ -10300,25 +10327,75 @@ Partial Class Clientes
|
||||
RegistraScript("$('#DivAgregarPrecioLista').modal('show');")
|
||||
End Sub
|
||||
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)
|
||||
If CvePrecioListaNuevo > 0 Then
|
||||
Alert("La lista de precio se guardo correctamente")
|
||||
RegistraScript("$('#DivAgregarPrecioLista').modal('hide');")
|
||||
|
||||
LimpiaItemsListaPrecion()
|
||||
|
||||
If DdlPrecioListaClonar.SelectedValue.ToEntero > 0 Then
|
||||
DdlPrecioLista.Items.Add(New ListItem(TxtPrecioLista.Text, "-3"))
|
||||
DdlPrecioLista.SelectedValueExist("-3")
|
||||
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
|
||||
|
||||
'RECARGA GLOBAL DE LISTA DE PRECIOS SI SE GENERO UNO NUEVO
|
||||
If CvePrecioListaNuevo > 0 Then
|
||||
|
||||
|
||||
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)
|
||||
End If
|
||||
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Return respuesta
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user