diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4dc2f5f81..52d10bc83 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -182,13 +182,12 @@ Public Class ClsPaginas If ObjUsuarios.GetUsuariosEmpresas(-1, CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjUsuarios.DtResultados End Using End If - Dim Str As New StringBuilder - If CveUsuario <> -1 Then Str.AppendFormat("CveUsuario = {0}", CveUsuario) - 'If CveEmpresa <> -1 Then Str.AppendFormat(" {0} CveEmpresa = {1}", If(Str.Length > 0, "AND", ""), CveEmpresa) - If CveCliente <> -1 Then Str.AppendFormat(" {0} CveCliente = {1}", If(Str.Length > 0, "AND", ""), CveCliente) - If CveProveedor <> -1 Then Str.AppendFormat(" {0} CveProveedor = {1}", If(Str.Length > 0, "AND", ""), CveProveedor) - If CveUsuario <> -1 OrElse CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + Dim filtros As New List(Of String) + If CveUsuario <> -1 Then filtros.Add($"CveUsuario = {CveUsuario}") + If CveCliente <> -1 Then filtros.Add($"CveCliente = {CveCliente}") + If CveProveedor <> -1 Then filtros.Add($"CveProveedor = {CveProveedor}") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) GlobalDTUsuarios = Dv.ToTable Dv.Dispose() Else @@ -220,14 +219,11 @@ Public Class ClsPaginas Dim AppNombre As String = $"GlobalDTTiposGastos-{CveEmpresa}" If Application(AppNombre) Is Nothing Then Dim ObjCompra As New ClsCompras() - If ObjCompra.GetTipoGasto(-1, -1) Then Application(AppNombre) = ObjCompra.DtResultados Else Application(AppNombre) = Nothing + If ObjCompra.GetTipoGasto(-1, CveEmpresa) Then Application(AppNombre) = ObjCompra.DtResultados Else Application(AppNombre) = Nothing ObjCompra.Dispose() End If - If CveEmpresa <> -1 Then - Dim StrSQL As New StringBuilder - StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If Estatus >= 0 Then StrSQL.AppendFormat(" AND CveEstatus = {0} ", Estatus) - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) + If Estatus <> -1 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), $"CveEstatus = {Estatus}", "", DataViewRowState.CurrentRows) GlobalDTTiposGastos = Dv.ToTable Dv.Dispose() Else @@ -561,10 +557,9 @@ Public Class ClsPaginas End Using End If 'Dim Str As New StringBuilder - ''If CveEmpresa <> -1 Then Str.AppendFormat(" {0} CveEmpresa = {1}", If(Str.Length > 0, "AND", ""), CveEmpresa) 'If CveCliente <> -1 Then Str.AppendFormat(" {0} CveCliente = {1}", If(Str.Length > 0, "AND", ""), CveCliente) 'If CveProveedor <> -1 Then Str.AppendFormat(" {0} CveProveedor = {1}", If(Str.Length > 0, "AND", ""), CveProveedor) - 'If CveUsuario <> -1 OrElse CveEmpresa <> -1 Then + 'If CveUsuario <> -1 OrElse CveCliente <> -1 OrElse CveProveedor <> -1 ' Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) ' GlobalDTUsuarios = Dv.ToTable ' Dv.Dispose() @@ -617,13 +612,7 @@ Public Class ClsPaginas If P.GetProveedorClasificacion(CveEmpresa) Then Application(AppNombre) = P.DtResultados P.Dispose() End If - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa ={0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProveedorClasificacion = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProveedorClasificacion = DirectCast(Application(AppNombre), DataTable) - End If + GlobalDTProveedorClasificacion = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) Dim AppNombre As String = $"GlobalDTProveedorClasificacion-{CveEmpresa}" @@ -738,6 +727,7 @@ Public Class ClsPaginas Application("GlobalDTNomSatTipoIncapacidad") = value End Set End Property + 'Este GlobalDT no estoy seguro si se deba segmentar por empresa, se usa mucho en todos lados Public Shared Property GlobalDTEmpresas(Optional CveEmpresa As Integer = -1) As DataTable Get Dim AppNombre As String = "GlobalDTEmpresas" @@ -756,7 +746,7 @@ Public Class ClsPaginas End Using End If If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), $"CveEmpresa = {CveEmpresa}", "", DataViewRowState.CurrentRows) GlobalDTEmpresas = Dv.ToTable Dv.Dispose() Else @@ -825,13 +815,12 @@ Public Class ClsPaginas If ObjClasificaciones.GetClasificaciones(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjClasificaciones.DtResultados ObjClasificaciones.Dispose() End If - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) - If UsoClasificacion <> -1 Then Str.AppendFormat(" AND UsoClasificacion IN ({0},3) ", UsoClasificacion) - If CveClasificacion <> -1 Then Str.AppendFormat(" AND CveClasificacion = {0}", CveClasificacion) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) + Dim filtros As New List(Of String) + If CveCategoria <> -1 Then filtros.Add($"CveCategoria = {CveCategoria}") + If UsoClasificacion <> -1 Then filtros.Add($"UsoClasificacion = {UsoClasificacion}") + If CveClasificacion <> -1 Then filtros.Add($"CveClasificacion = {CveClasificacion}") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) GlobalDTClasificaciones = Dv.ToTable Dv.Dispose() Else @@ -852,16 +841,7 @@ Public Class ClsPaginas If ObjRH.GetActividades(CveEmpresa) Then Application(AppNombre) = ObjRH.DtResultados ObjRH.Dispose() End If - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) - GlobalDTRHActividades = Dv.ToTable - Dv.Dispose() - Else - GlobalDTRHActividades = DirectCast(Application(AppNombre), DataTable) - End If - + GlobalDTRHActividades = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) Dim AppNombre As String = $"GlobalDTRHActividades-{CveEmpresa}" @@ -877,11 +857,8 @@ Public Class ClsPaginas If ObjClasificaciones.GetClasificaciones(CveEmpresa, Tipo:=4) Then Application(AppNombre) = ObjClasificaciones.DtResultados ObjClasificaciones.Dispose() End If - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) + If CveCategoria <> -1 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), $"CveCategoria = {CveCategoria}", "", DataViewRowState.CurrentRows) GlobalDTClasificaciones2 = Dv.ToTable Dv.Dispose() Else @@ -1120,13 +1097,7 @@ Public Class ClsPaginas If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjUnidadesMedida.DtResultados ObjUnidadesMedida.Dispose() End If - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedida = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) - End If + GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End Get Set(value As DataTable) Dim AppNombre As String = $"GlobalDTUnidadesMedida-{CveEmpresa}" @@ -1142,20 +1113,11 @@ Public Class ClsPaginas If ObjUnidadesMedida.GetUnidadesMedidaAlias(CveEmpresa, -1) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados ObjUnidadesMedida.Dispose() End If - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedidaAlias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedidaAlias = DirectCast(Application(AppNombre), DataTable) - End If + GlobalDTUnidadesMedidaAlias = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) Dim AppNombre As String = $"GlobalDTUnidadesMedidaAlias-{CveEmpresa}" Application(AppNombre) = value - 'Dim ObjUnidadesMedida As New ClsUnidadesMedida() - 'If ObjUnidadesMedida.GetUnidadesMedidaAlias(CveEmpresa, -1) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados - 'ObjUnidadesMedida.Dispose() End Set End Property Public Shared Property GlobalDTSATMotivosCancelacion(Optional CveSATMotivoCancelacion As Integer = -1, Optional CodigoSAT As String = "-1") As DataTable @@ -1330,13 +1292,13 @@ Public Class ClsPaginas If ObjSubProyectos.GetSubProyectosUsuarios(CveEmpresa:=CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjSubProyectos.DtResultados ObjSubProyectos.Dispose() End If - If CveUsuario <> -1 OrElse CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEstatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - If CveUsuario <> -1 Then StrSQL.AppendFormat(" AND CveUsuario = {0}", CveUsuario) - If CveEstatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", CveEstatus) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + Dim filtros As New List(Of String) + If CveProyecto <> -1 Then filtros.Add($"CveProyecto = {CveProyecto}") + If CveSubProyecto <> -1 Then filtros.Add($"CveSubProyecto = {CveSubProyecto}") + If CveUsuario <> -1 Then filtros.Add($"CveUsuario = {CveUsuario}") + If CveEstatus <> -1 Then filtros.Add($"CveEstatus = {CveEstatus}") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) GlobalDTSubProyectosUsuarios = Dv.ToTable Dv.Dispose() Else @@ -1356,12 +1318,12 @@ Public Class ClsPaginas If ObjSubProyectos.GetSubProyectosUsuarios(CveEmpresa:=CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjSubProyectos.DtResultados.FiltraParametros("", "", {"Proyecto", "CveProyecto", "CveUsuario", "CveEmpresa", "CveEstatusProyecto"}) ObjSubProyectos.Dispose() End If - If CveUsuario <> -1 OrElse CveProyecto <> -1 OrElse CveEstatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveUsuario <> -1 Then StrSQL.AppendFormat(" AND CveUsuario = {0}", CveUsuario) - If CveEstatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatusProyecto = {0}", CveEstatus) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + Dim filtros As New List(Of String) + If CveProyecto <> -1 Then filtros.Add($"CveProyecto = {CveProyecto}") + If CveUsuario <> -1 Then filtros.Add($"CveUsuario = {CveUsuario}") + If CveEstatus <> -1 Then filtros.Add($"CveEstatus = {CveEstatus}") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) GlobalDTProyectosUsuarios = Dv.ToTable Dv.Dispose() Else @@ -1588,11 +1550,8 @@ Public Class ClsPaginas ObjPS.Dispose() End If - If CveEmpresa <> -1 Then - Dim StrSQL As New StringBuilder - StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If Estatus >= 0 Then StrSQL.AppendFormat(" AND CveEstado = {0} ", Estatus) - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) + If Estatus >= 0 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), $"CveEstado = {Estatus}", "", DataViewRowState.CurrentRows) GlobalDTProductosServiciosAlias = Dv.ToTable Dv.Dispose() Else @@ -1646,19 +1605,14 @@ Public Class ClsPaginas Property GlobalDTPSAdicionales(CvePS As Integer, CveEmpresa As Integer) As DataTable Get Dim AppNombre As String = $"GlobalDTPSAdicionales-{CveEmpresa}" - If CveEmpresa <> -1 Then - 'sino existe, recarga los datos - If Application(AppNombre) Is Nothing Then - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSAdicionales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados - ObjPS.Dispose() - End If + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSAdicionales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados + ObjPS.Dispose() End If - Dim Str As New StringBuilder - If CvePS > 0 Then Str.AppendFormat("CvePS = {0}", CvePS) - If CveEmpresa > 0 Then Str.AppendFormat("{0} CveEmpresa = {1}", If(CvePS > 0, " AND ", ""), CveEmpresa) If CvePS > 0 Then - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), $"CvePS = {CvePS}", "", DataViewRowState.CurrentRows) GlobalDTPSAdicionales = Dv.ToTable Dv.Dispose() Else @@ -1926,18 +1880,19 @@ Public Class ClsPaginas Dim AppNombre As String = $"GlobalDTCliente-{CveEmpresa}" If HttpContext.Current.Application(AppNombre) Is Nothing Then Dim ObjClientes As New ClsClientes - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, Estatus:=-1) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados.Copy() + If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa:=CveEmpresa, Estatus:=-1) Then HttpContext.Current.Application(AppNombre) = ObjClientes.DtResultados.Copy() ObjClientes.Dispose() End If - - Dim StrSQL As New StringBuilder - StrSQL.AppendFormat("1 = 1") - If Estatus >= 0 Then StrSQL.AppendFormat(" AND EstatusBool = {0} ", Estatus) - If CveCliente >= 0 Then StrSQL.AppendFormat(" AND CveCliente = {0} ", CveCliente) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCliente = Dv.ToTable - Dv.Dispose() - + Dim filtros As New List(Of String) + If Estatus >= 0 Then filtros.Add($"EstatusBool = {Estatus}") + If CveCliente >= 0 Then filtros.Add($"CveCliente = {CveCliente}") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) + GlobalDTCliente = Dv.ToTable + Dv.Dispose() + Else + GlobalDTCliente = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If End Get Set(value As DataTable) Dim AppNombre As String = $"GlobalDTCliente-{CveEmpresa}" @@ -1953,13 +1908,7 @@ Public Class ClsPaginas If ObjClientes.GetClienteClasificacion(CveEmpresa) Then Application(AppNombre) = ObjClientes.DtResultados ObjClientes.Dispose() End If - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTClienteClasificaciones = Dv.ToTable - Dv.Dispose() - Else - GlobalDTClienteClasificaciones = DirectCast(Application(AppNombre), DataTable) - End If + GlobalDTClienteClasificaciones = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) Dim AppNombre As String = $"GlobalDTClienteClasificaciones-{CveEmpresa}" @@ -1992,12 +1941,11 @@ Public Class ClsPaginas If ObjVendedores.GetVendedores(CveEmpresa) Then Application(AppNombre) = ObjVendedores.DtResultados ObjVendedores.Dispose() End If - If CveEmpresa <> -1 Then - Dim StrSQL As New StringBuilder - StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If VendedorTipo >= 0 Then StrSQL.AppendFormat(" AND VendedorTipo = {0} ", VendedorTipo) - If Estatus >= 0 Then StrSQL.AppendFormat(" AND CveEstatus = {0} ", If(Estatus = 1, True, False)) - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) + Dim filtros As New List(Of String) + If VendedorTipo >= 0 Then filtros.Add($"VendedorTipo = {VendedorTipo}") + If Estatus >= 0 Then filtros.Add($"CveEstatus = {Estatus}") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) GlobalDTVendedores = Dv.ToTable Dv.Dispose() Else @@ -3261,23 +3209,18 @@ Public Class ClsPaginas 'sino existe, recarga los datos If Application(AppNombre) Is Nothing Then Dim ObjOC As New ClsOC - If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, CveEmpresa) Then + If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, CveEmpresa:=CveEmpresa) Then Application(AppNombre) = ObjOC.DtResultados Else Application(AppNombre) = Nothing End If ObjOC.Dispose() End If - If CveEmpresa <> -1 Then - Dim filtro As New StringBuilder - filtro.AppendFormat("CveEmpresa = {0} ", CveEmpresa) - If CveUsuario > 0 Then - filtro.AppendFormat(" AND CveUsuario={0} ", CveUsuario) - End If - If Tipo <> "" Then - filtro.AppendFormat(" AND Tipo='{0}'", Tipo) - End If - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) + Dim filtros As New List(Of String) + If CveUsuario > 0 Then filtros.Add($"CveUsuario = {CveUsuario}") + If Tipo <> "" Then filtros.Add($"Tipo = {Tipo}") + If filtros.Count > 0 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows) GlobalDTOCEstatusUsuarios = Dv.ToTable Dv.Dispose() Else diff --git a/CGame/CatEstatus.aspx.VB b/CGame/CatEstatus.aspx.VB index 710c68a21..c13b1c7ba 100644 --- a/CGame/CatEstatus.aspx.VB +++ b/CGame/CatEstatus.aspx.VB @@ -19,7 +19,7 @@ #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then CargaEstatus() - 'CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + 'CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) End If End Sub Protected Sub CargaEstatus() Dim ObjEsta As New ClsCGame() If ObjEsta.GetEstatus(UsuarioActual.CveEmpresa) Then GVEstatus.DataSource = ObjEsta.DtResultados GVEstatus.DataBind() diff --git a/Compras/RepComprasAF.aspx b/Compras/RepComprasAF.aspx index 4002fd32d..20b3912ae 100644 --- a/Compras/RepComprasAF.aspx +++ b/Compras/RepComprasAF.aspx @@ -126,14 +126,12 @@
-
- Proyecto: -
-
+ Proyecto: +
- SubProyecto: + SubProyecto:
diff --git a/Compras/RepComprasAF.aspx.vb b/Compras/RepComprasAF.aspx.vb index de5fb0b0a..fbd61c616 100644 --- a/Compras/RepComprasAF.aspx.vb +++ b/Compras/RepComprasAF.aspx.vb @@ -85,7 +85,7 @@ Partial Class Compras_RepComprasAF DdlActivoFijo.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa) DdlActivoFijo.DataBind() - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) CargaPS(-1) diff --git a/Compras/RepComprasAFDetalle.aspx b/Compras/RepComprasAFDetalle.aspx index c715eade2..2d7f86d01 100644 --- a/Compras/RepComprasAFDetalle.aspx +++ b/Compras/RepComprasAFDetalle.aspx @@ -168,14 +168,13 @@
-
Proyecto:
-
+ Proyecto: +
- - SubProyecto: + SubProyecto:
diff --git a/Compras/RepComprasAFDetalle.aspx.vb b/Compras/RepComprasAFDetalle.aspx.vb index 2a49b588f..d475ebca4 100644 --- a/Compras/RepComprasAFDetalle.aspx.vb +++ b/Compras/RepComprasAFDetalle.aspx.vb @@ -160,7 +160,7 @@ Partial Class Compras_RepComprasAFDetalle Private Sub CargaCombos() - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) DdlProveedores.DataBind() diff --git a/Compras/RepPagado.aspx.cs b/Compras/RepPagado.aspx.cs index 6758ae234..23dc27109 100644 --- a/Compras/RepPagado.aspx.cs +++ b/Compras/RepPagado.aspx.cs @@ -36,7 +36,7 @@ public partial class Compras_RepPagado : ClsPaginas private void InicializaValores() { - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, null, LblSubProyecto); + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:DivProyecto); //Carga Moneda DdlMoneda.DataSource = GlobalDTMonedas; diff --git a/Compras/RepPagadoDetalle.aspx.cs b/Compras/RepPagadoDetalle.aspx.cs index 796c57137..217deb3a5 100644 --- a/Compras/RepPagadoDetalle.aspx.cs +++ b/Compras/RepPagadoDetalle.aspx.cs @@ -41,7 +41,7 @@ public partial class Compras_RepPágadoDetalle : ClsPaginas private void InicializaValores() { - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, null, LblSubProyecto); + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:DivProyecto); //Carga Moneda DdlMoneda.DataSource = GlobalDTMonedas; diff --git a/Compras/RepPagadoPeriodo.aspx.cs b/Compras/RepPagadoPeriodo.aspx.cs index 47708e604..93e7839e1 100644 --- a/Compras/RepPagadoPeriodo.aspx.cs +++ b/Compras/RepPagadoPeriodo.aspx.cs @@ -78,7 +78,7 @@ public partial class Compras_RepPagadoPeriodo : ClsPaginas TxtFechaICompra.Text = MinFecha.ToShortDateString(); //'$"01/01/{DateTime.Now.Year}"; TxtFechaFCompra.Text = DateTime.Now.ToShortDateString(); - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, null, LblSubProyecto); + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:DivProyecto); } private void CargaCuentasBancarias() { diff --git a/Contabilidad/AuxiliarPrePolizas.aspx.cs b/Contabilidad/AuxiliarPrePolizas.aspx.cs index 32f47b7a4..6b3a11e38 100644 --- a/Contabilidad/AuxiliarPrePolizas.aspx.cs +++ b/Contabilidad/AuxiliarPrePolizas.aspx.cs @@ -28,7 +28,7 @@ public partial class Contabilidad_AuxiliarPrePolizas : ClsPaginas private void InicializaValores() { - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, null, LblSubProyecto); + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:DivProyecto); txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString(); txtFechaF.Text = DateTime.Now.ToShortDateString(); DdlPlantillaPoliza.DataSource = get_GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa); diff --git a/Inventarios/Remanufactura.aspx.vb b/Inventarios/Remanufactura.aspx.vb index 4678ec2b7..cd1c6528e 100644 --- a/Inventarios/Remanufactura.aspx.vb +++ b/Inventarios/Remanufactura.aspx.vb @@ -87,7 +87,7 @@ Partial Class Inventarios_Remanufactura Public Sub InicializaValores() - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) TxtFecha.Text = Now.ToShortDateString diff --git a/Inventarios/RepReciclaje.aspx.vb b/Inventarios/RepReciclaje.aspx.vb index f7bc68a00..1203fec98 100644 --- a/Inventarios/RepReciclaje.aspx.vb +++ b/Inventarios/RepReciclaje.aspx.vb @@ -20,7 +20,7 @@ Partial Class Inventarios_RepReciclaje Public Sub InicializaValores() - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) txtFechaI.Text = Now.FirstDayOfMonth.ToShortDateString txtFechaF.Text = Now.ToShortDateString diff --git a/OC/CatEstatus.aspx b/OC/CatEstatus.aspx index 4ecfbac81..78258212e 100644 --- a/OC/CatEstatus.aspx +++ b/OC/CatEstatus.aspx @@ -84,7 +84,7 @@
- + Proyecto:
diff --git a/OC/CatEstatus.aspx.vb b/OC/CatEstatus.aspx.vb index 48e439649..31793a760 100644 --- a/OC/CatEstatus.aspx.vb +++ b/OC/CatEstatus.aspx.vb @@ -69,7 +69,7 @@ Partial Class OC_CatEstatus ViewState("TipoSeleccionado") = DdlTipo.SelectedValue CargaDatos() CargaEstatus() - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) CargaUsuarios() sssss() diff --git a/OS/CatEstatusOrdenServicio.aspx b/OS/CatEstatusOrdenServicio.aspx index a70926a4b..c6f3a8e0f 100644 --- a/OS/CatEstatusOrdenServicio.aspx +++ b/OS/CatEstatusOrdenServicio.aspx @@ -134,7 +134,7 @@
- + Proyecto:
diff --git a/OS/CatEstatusOrdenServicio.aspx.vb b/OS/CatEstatusOrdenServicio.aspx.vb index dc7598417..a03757d98 100644 --- a/OS/CatEstatusOrdenServicio.aspx.vb +++ b/OS/CatEstatusOrdenServicio.aspx.vb @@ -63,7 +63,7 @@ Partial Class OS_CatEstatusOrdenServicio Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) CargarTodosLosDatos() CveEstatuOS = -1 End If diff --git a/Ventas/RepAuxiliarFacturas.aspx.vb b/Ventas/RepAuxiliarFacturas.aspx.vb index d67fb28c3..7d2b84137 100644 --- a/Ventas/RepAuxiliarFacturas.aspx.vb +++ b/Ventas/RepAuxiliarFacturas.aspx.vb @@ -127,7 +127,7 @@ Partial Class Ventas_RepAuxiliarFacturas DdlEstatus.SelectedIndex = 1 End If - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, Nothing, LblSubProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) TipoCambio = 1 TCEspecifico = 0 diff --git a/Ventas/RepProductosServiciosPeriodo.aspx.cs b/Ventas/RepProductosServiciosPeriodo.aspx.cs index e298f18ef..92e01ef39 100644 --- a/Ventas/RepProductosServiciosPeriodo.aspx.cs +++ b/Ventas/RepProductosServiciosPeriodo.aspx.cs @@ -142,7 +142,7 @@ public partial class Ventas_RepProductosServiciosPeriodo : ClsPaginas CargaGrupo(); //Carga Tipo Centro de Costo - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, null, LblSubProyecto); + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:DivProyecto); } diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 6aa55776f..2662b079d 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9490,7 +9490,7 @@ Partial Class Ventas End If 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE - If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional <= ObjFactura.Total Then + If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional < ObjFactura.Total Then TmpDT = TmpDTError.Copy() CalculaTotalesVenta(RecalcularTotalOriginal:=False) Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia) @@ -9504,7 +9504,7 @@ Partial Class Ventas Exit Sub End If - If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional <= ObjFactura.Total Then + If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional < ObjFactura.Total Then TmpDT = TmpDTError.Copy() CalculaTotalesVenta(RecalcularTotalOriginal:=False) Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia) @@ -17727,6 +17727,7 @@ Partial Class Ventas Private Sub CambiaTipoComprobante() CambiaTipoDocto() LimpiaEscondeContado() + End Sub Private Sub CambiaTipoDocto() CargaNC(IfNull(Request("CveDevolucion"), "-1").ToString().ToEntero()) @@ -17884,6 +17885,8 @@ Partial Class Ventas TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + TabAlmacen.Enabled = DdlTipoComprobante.SelectedValue <> "Ant" 'VALIDA ESTATUS CLIENTE - SOLO SE PUEDE USAR EL CLIENTE PARA COTIZAR EN CASO DE ESTAR INACTIVO @@ -18688,7 +18691,9 @@ Partial Class Ventas 'SI TIENE PRONTO PAGO CALCULA EL IMPORTE If DdlTipoComprobante.SelectedValue = "Ing" AndAlso RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then - Dim TotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento + Dim SubTotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento + Dim TotalProntoPago As Decimal = SubTotalProntoPago * (1 + PorcentajeIVA) + Dim PorcentajeProntoPago = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D ObjDescuento.ImporteProntoPago = (TotalProntoPago * PorcentajeProntoPago).RoundSQL(2) @@ -22649,6 +22654,8 @@ Partial Class Ventas imgCalendario.Visible = False End If + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + UpContado.Update() UPCondicionesPago.Update() End Sub @@ -32063,6 +32070,8 @@ Partial Class Ventas TxtFechaPago.Text = If(EsDiasCreditoFijo, Now.AddDays(DiasCredito).ToShortDateString, TxtFechaPago.Text) + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + UpRemisionesFacturas.Update() UpFacturar.Update() UpPS.Update() @@ -32734,9 +32743,12 @@ Partial Class Ventas ObjCliente.Dispose() DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty) + TrVistaPrevia.Visible = True TxtFechaVencimientoCotizacion.Text = Now.ToShortDateString + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + 'HABILITA EDITAR Y ELIMINAR DEL GV GvPS.Columns(17).Visible = True GvPS.Columns(18).Visible = True @@ -32968,6 +32980,8 @@ Partial Class Ventas TxtFechaPago.Text = If(TipoDoctoViejo = "Rem" AndAlso EsDiasCreditoFijo, Now.AddDays(DiasCredito), If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza))).ToShortDateString TxtFechaEjecucion.Text = Now.ToString() + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + 'VALIDAR QUE NO SE HAYA REMISIONADO If TipoDoctoViejo = "PA" Then Dim RowVenta As DataRow = Nothing @@ -36318,47 +36332,58 @@ Partial Class Ventas Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs) - TxtFechaPago.Enabled = True - imgCalendario.Visible = True - If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then - RBLPago.SelectedValue = "1" - RBLPago.Enabled = False + If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then + TxtFechaPago.Enabled = True + imgCalendario.Visible = True - Using ObjVentas As New ClsVentas - If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then - Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0) - If RowLinea IsNot Nothing Then - If CveVenta <= 0 Then - TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then + RBLPago.SelectedValue = "1" + RBLPago.Enabled = False + + Using ObjVentas As New ClsVentas + If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0) + If RowLinea IsNot Nothing Then + If CveVenta <= 0 Then + TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + + 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL + If RowLinea("TipoLinea").ToString() = "2" Then + TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") + Else + TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + End If - 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL - If RowLinea("TipoLinea").ToString() = "2" Then - TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") TxtFechaPago.Enabled = False imgCalendario.Visible = False + + TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString() End If - TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString() - End If + Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() + Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() + Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal() + Me.SaldoIngresosLineaAdicional = RowLinea("SaldoIngresos").ToString().ToDecimal() - Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() - Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() - Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal() - Me.SaldoIngresosLineaAdicional = RowLinea("SaldoIngresos").ToString().ToDecimal() - - If CveVenta <= 0 Then - If DdlTipoComprobante.SelectedValue.Contiene("PA") Then - 'SI NO TIENE LA OPCION DE FACTURAR LA PERMITE - If DdlTipoComprobante.Items.FindByValue("Rem") Is Nothing Then - DdlTipoComprobante.Items.Insert(0, New ListItem("Remisión", "Rem")) - HabilitoFacturacionIngresoLineaAdicional = True + If CveVenta <= 0 Then + If DdlTipoComprobante.SelectedValue.Contiene("PA") Then + 'SI NO TIENE LA OPCION DE FACTURAR LA PERMITE + If DdlTipoComprobante.Items.FindByValue("Rem") Is Nothing Then + DdlTipoComprobante.Items.Insert(0, New ListItem("Remisión", "Rem")) + HabilitoFacturacionIngresoLineaAdicional = True + End If + DdlTipoComprobante.SelectedValueExist("Rem") End If - DdlTipoComprobante.SelectedValueExist("Rem") End If - End If + End If + Else + Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) + Me.SaldoLineaAdicional = 0 + Me.SaldoIngresosLineaAdicional = 0 + Me.CveCategoriaLineaAdicional = 0 End If Else Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) @@ -36366,36 +36391,32 @@ Partial Class Ventas Me.SaldoIngresosLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0 End If - Else - Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) - Me.SaldoLineaAdicional = 0 - Me.SaldoIngresosLineaAdicional = 0 - Me.CveCategoriaLineaAdicional = 0 + End Using + Else + Me.SaldoLineaAdicional = 0 + Me.SaldoIngresosLineaAdicional = 0 + Me.CveCategoriaLineaAdicional = 0 + + If CveVenta <= 0 Then + TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") + TxtOrdenCompra.Text = "" + + 'SI SE HABILITO LA FACTURACION DESDE LA LINEA ADICIONAL DEBE QUITARLO + If HabilitoFacturacionIngresoLineaAdicional Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + DdlTipoComprobante.SelectedValueExist("PA") + + UpParametros.Update() + End If End If - End Using - Else - Me.SaldoLineaAdicional = 0 - Me.SaldoIngresosLineaAdicional = 0 - Me.CveCategoriaLineaAdicional = 0 - If CveVenta <= 0 Then - TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") - TxtOrdenCompra.Text = "" - - 'SI SE HABILITO LA FACTURACION DESDE LA LINEA ADICIONAL DEBE QUITARLO - If HabilitoFacturacionIngresoLineaAdicional Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) - DdlTipoComprobante.SelectedValueExist("PA") - - UpParametros.Update() - End If End If + UpParametros.Update() + UPCondicionesPago.Update() + UPObservaciones.Update() End If - UpParametros.Update() - UPCondicionesPago.Update() - UPObservaciones.Update() End Sub Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs) 'VALIDAR LINEAS ADICIONALES @@ -36432,7 +36453,7 @@ Partial Class Ventas End If 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE - If Me.SaldoLineaAdicional <= TxtTotal.Text.ToDecimal() Then + If Me.SaldoLineaAdicional < TxtTotal.Text.ToDecimal() Then Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia) Exit Sub End If