diff --git a/Acumuladores/CatTiposDefecto.aspx.vb b/Acumuladores/CatTiposDefecto.aspx.vb index 6bfa9a850..423974ef4 100644 --- a/Acumuladores/CatTiposDefecto.aspx.vb +++ b/Acumuladores/CatTiposDefecto.aspx.vb @@ -206,10 +206,7 @@ Partial Class Acumuladores_CatTiposDefecto 'TxtCompra.Text = GvRow.DataKey("Compra").ToDecimal.ToString("###,###,###.00") 'TxtPuntos.Text = GvRow.DataKey("Puntos").ToDecimal.ToString("###,###,###.00") - 'DdlPS.Items.Clear() - 'DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - 'DdlPS.DataBind() - 'DdlPS.SelectedValueExist(GvRow.DataKey("CvePSCargo").ToEntero) + BtnAgregarTiposDModal.Text = "Actualizar" diff --git a/Acumuladores/CatTiposUso.aspx.vb b/Acumuladores/CatTiposUso.aspx.vb index 138f85a69..bec66d598 100644 --- a/Acumuladores/CatTiposUso.aspx.vb +++ b/Acumuladores/CatTiposUso.aspx.vb @@ -207,10 +207,6 @@ Partial Class Acumuladores_CatTiposUso 'TxtCompra.Text = GvRow.DataKey("Compra").ToDecimal.ToString("###,###,###.00") 'TxtPuntos.Text = GvRow.DataKey("Puntos").ToDecimal.ToString("###,###,###.00") - 'DdlPS.Items.Clear() - 'DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - 'DdlPS.DataBind() - 'DdlPS.SelectedValueExist(GvRow.DataKey("CvePSCargo").ToEntero) BtnAgregarTiposUsoModal.Text = "Actualizar" diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 6b459c171..614160d81 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -587,7 +587,7 @@ Public Class ClsAcumuladores Public Function GetNuevoConsecutivoFolio(CveFolioGarantia As Integer) As Boolean Dim Retorno As Boolean = False - SqlDataAdapter(String.Format("SELECT MAX(Consecutivo) + 1 AS NuevoConsecutivo FROM Acum_GarantiasDetalle d WHERE d.CveFolioGarantia = {0}", CveFolioGarantia), CommandType.Text) + SqlDataAdapter(String.Format("SELECT MAX(dbo.FNC_Numero(Consecutivo)) AS NuevoConsecutivo FROM Acum_GarantiasDetalle d WHERE d.CveFolioGarantia = {0}", CveFolioGarantia), CommandType.Text) Try SqlAdapter.Fill(Data) @@ -758,6 +758,23 @@ Public Class ClsAcumuladores Return Retorno End Function + Public Function UpdateGarantiasDetallePoliza(CveVenta As Integer, FolioPolizaVirtual As String) As Boolean + Dim Retorno As Boolean = False + SqlDataAdapter("PA_Acum_GarantiasDetallePolizaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@FolioPolizaVirtual", SqlDbType.VarChar).Value = FolioPolizaVirtual + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error a actualizar folio de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + #End Region diff --git a/App_Code/ClsCompProveedores.vb b/App_Code/ClsCompProveedores.vb index 474060720..cc81e5ff1 100644 --- a/App_Code/ClsCompProveedores.vb +++ b/App_Code/ClsCompProveedores.vb @@ -1100,11 +1100,12 @@ Public Class ClsCompProveedores #Region "S U C U R S A L E S" - Public Function GetSucursales(CveProveedor As Integer) As Boolean + Public Function GetSucursales(CveProveedor As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Comp_ProveedorSucursalGet") SqlAdapter.SelectCommand.Parameters.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa Try SqlAdapter.Fill(Data) Retorno = True diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 610360c63..8f89239ca 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5901,7 +5901,7 @@ Public Class ClsContabilidad Return Retorno End Function - Public Function UpdatePeriodosBloqueo(CveEmpresa As Integer, Ejercicio As Integer, Mes1 As Integer, Mes2 As Integer, Mes3 As Integer, Mes4 As Integer, Mes5 As Integer, Mes6 As Integer, Mes7 As Integer, Mes8 As Integer, Mes9 As Integer, Mes10 As Integer, Mes11 As Integer, Mes12 As Integer) As Boolean + Public Function UpdatePeriodosBloqueo(CveEmpresa As Integer, Ejercicio As Integer, Mes1 As Integer, Mes2 As Integer, Mes3 As Integer, Mes4 As Integer, Mes5 As Integer, Mes6 As Integer, Mes7 As Integer, Mes8 As Integer, Mes9 As Integer, Mes10 As Integer, Mes11 As Integer, Mes12 As Integer, CveUsuario As Integer) As Boolean Dim Retorno = False DataAdapter("PA_Conta_EmpresasBloqueoMesesUpdate") @@ -5920,6 +5920,7 @@ Public Class ClsContabilidad .Add("@Mes10", SqlDbType.Bit).Value = Mes10 .Add("@Mes11", SqlDbType.Bit).Value = Mes11 .Add("@Mes12", SqlDbType.Bit).Value = Mes12 + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario End With Try @@ -5949,5 +5950,24 @@ Public Class ClsContabilidad Return Retorno End Function + + Public Function GetBloqueoMesesBitacora(CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_GetBloqueoMesesBitacora") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener el almacén contable", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function #End Region End Class \ No newline at end of file diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 4d3dd108d..18fbe3683 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1238,6 +1238,25 @@ Public Class ClsInventarios Return Retorno End Function + + Public Function GetMovimientosDetalleVirtual(CveMovimiento As Integer, CveEmpresa As Integer, Optional CveCompra As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Inv_MovimientosDetalleVirtualGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los movimientos virtuales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function Public Function AddMovimientoDetalle(CveMovimiento As Integer, Cantidad As Double, CveUM As Integer, CvePS As Integer, PU As Double, CveAF As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional SerieLote As String = "", Optional Observaciones As String = "", Optional CveMovimientoDetalleEntrada As Integer = -1, Optional PUTC As Double = -1, Optional FechaCaducidad As Date = MinFecha, Optional CostoIndirecto As Double = 0, Optional CveCompraDetalle As Integer = -1, Optional CveOrdenCompraDetalle As Integer = -1, Optional CveVentaDetalle As Integer = -1, diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index bc28e49ea..64ee112a5 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -431,32 +431,50 @@ Public Class ClsPaginas End Property Property GlobalDTProveedorClasificacion(CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTProveedorClasificacion{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim P As New ClsCompProveedores + If P.GetProveedorClasificacion(UsuarioActual.CveEmpresa) Then Application(AppNombre) = P.DtResultados + P.Dispose() + End If + If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTProveedorClasificacion"), DataTable), String.Format("CveEmpresa ={0}", CveEmpresa), "", DataViewRowState.CurrentRows) + 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("GlobalDTProveedorClasificacion"), DataTable) + GlobalDTProveedorClasificacion = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTProveedorClasificacion") = value + Dim AppNombre As String = String.Format("GlobalDTProveedorClasificacion{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property - Property GlobalDTProveedorSucursales(CveProveedor As Integer) As DataTable + Property GlobalDTProveedorSucursales(CveProveedor As Integer, CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim P As New ClsCompProveedores + If P.GetSucursales(-1, UsuarioActual.CveEmpresa) Then Application(AppNombre) = P.DtResultados + P.Dispose() + End If + If CveProveedor <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTProveedorSucursales"), DataTable), String.Format("CveProveedor = {0}", CveProveedor), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveProveedor = {0}", CveProveedor), "", DataViewRowState.CurrentRows) GlobalDTProveedorSucursales = Dv.ToTable Dv.Dispose() Else - GlobalDTProveedorSucursales = DirectCast(Application("GlobalDTProveedorSucursales"), DataTable) + GlobalDTProveedorSucursales = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTProveedorSucursales") = value + Dim AppNombre As String = String.Format("GlobalDTProveedorSucursales{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTRoles(CveEmpresa As Integer) As DataTable @@ -737,32 +755,50 @@ Public Class ClsPaginas Application("GlobalDTSATUsosCFDI") = value End Set End Property - Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable - Get + Public Shared Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim ObjUnidadesMedida As New ClsUnidadesMedida() + If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjUnidadesMedida.DtResultados Else HttpContext.Current.Application(AppNombre) = Nothing + 'If ObjUnidadesMedida.GetUnidadesMedidaAlias() Then Application("GlobalDTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados Else Application("GlobalDTUnidadesMedidaAlias") = Nothing + ObjUnidadesMedida.Dispose() + End If + If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + 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(Application("GlobalDTUnidadesMedida"), DataTable) + GlobalDTUnidadesMedida = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End If End Get - Set(value As DataTable) - Application("GlobalDTUnidadesMedida") = value + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value End Set End Property Property GlobalDTUnidadesMedidaAlias(Optional CveEmpresa As Integer = -1) As DataTable - Get + Get + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedidaAlias{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim ObjUnidadesMedida As New ClsUnidadesMedida() + If ObjUnidadesMedida.GetUnidadesMedidaAlias(CveEmpresa, -1) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados Else Application(AppNombre) = Nothing + ObjUnidadesMedida.Dispose() + End If If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTUnidadesMedidaAlias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + 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("GlobalDTUnidadesMedidaAlias"), DataTable) + GlobalDTUnidadesMedidaAlias = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTUnidadesMedidaAlias") = value + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedidaAlias{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTEstatusOrdenCompra() As DataTable @@ -843,19 +879,20 @@ Public Class ClsPaginas Application("GlobalDTProyectos") = value End Set End Property - Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + Public Shared Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable Get - - If DirectCast(Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then + Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then Dim P As New ClsSubProyectos - If P.GetSubProyectos Then - Application("GlobalDTSubProyectos") = P.DtResultados + If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then + HttpContext.Current.Application(AppNombre) = P.DtResultados End If P.Dispose() Dim msg As String = "aqui no se carga subproyectos" - If Request IsNot Nothing Then - msg = msg & Request.ServerVariables("URL") + If HttpContext.Current.Request IsNot Nothing Then + msg = msg & HttpContext.Current.Request.ServerVariables("URL") End If msg.GuardaLog() @@ -868,25 +905,26 @@ Public Class ClsPaginas If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) GlobalDTSubProyectos = Dv.ToTable Dv.Dispose() Else - GlobalDTSubProyectos = DirectCast(Application("GlobalDTSubProyectos"), DataTable) + GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End If End Get - Set(ByVal value As DataTable) + Set(ByVal value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos{0}", CveEmpresa) If value Is Nothing OrElse value.Rows.Count = 0 Then Dim msg As String = "aqui no se carga subproyectos" - If Request IsNot Nothing Then - msg = msg & Request.ServerVariables("URL") + If HttpContext.Current.Request IsNot Nothing Then + msg = msg & HttpContext.Current.Request.ServerVariables("URL") End If msg.GuardaLog() - End If - Application("GlobalDTSubProyectos") = value + End If + HttpContext.Current.Application(AppNombre) = value End Set End Property Property GlobalDTSubProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable @@ -1141,11 +1179,20 @@ Public Class ClsPaginas ObjPS.Dispose() End Get End Property - Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1) As DataTable + Public Shared Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1) As DataTable Get - If CveEmpresa <> -1 Then + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa) + If CveEmpresa <> -1 Then + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSSimplificado(-1) Then HttpContext.Current.Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() Else HttpContext.Current.Application("GlobalDTPSSimplificado") = Nothing + ObjPS.Dispose() + + End If + - Dim Cons = DirectCast(Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) + Dim Cons = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)) Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) @@ -1160,48 +1207,73 @@ Public Class ClsPaginas End Try Else - GlobalDTPSSimplificado = DirectCast(Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)).CopyToDataTable + GlobalDTPSSimplificado = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable End If End Get Set(value As DataTable) - Application("GlobalDTPSSimplificado") = value + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value End Set End Property Property GlobalDTProductosServiciosAlias(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSAlias(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados Else Application(AppNombre) = Nothing + 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("GlobalDTProductosServiciosAlias"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) GlobalDTProductosServiciosAlias = Dv.ToTable Dv.Dispose() Else - GlobalDTProductosServiciosAlias = DirectCast(Application("GlobalDTProductosServiciosAlias"), DataTable) + GlobalDTProductosServiciosAlias = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTProductosServiciosAlias") = value + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosAlias{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property - Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer) As DataTable + Public Shared Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) + If CveEmpresa <> -1 Then + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSEquivalencias(-1, CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjPS.DtResultados Else HttpContext.Current.Application(AppNombre) = Nothing + ObjPS.Dispose() + + End If + End If + If CvePS <> -1 OrElse CveUM <> -1 Then Dim StrSQL As New StringBuilder If CvePS <> -1 Then StrSQL.AppendFormat(" AND CvePS = {0}", CvePS) - If CveUM <> -1 Then StrSQL.AppendFormat(" AND CveUM = {0}", CveUM) + If CveUM <> -1 Then StrSQL.AppendFormat(" AND CveUM = {0}", CveUM) + If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(Application("GlobalDTProductosServiciosEquivalencias"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) GlobalDTProductosServiciosEquivalencias = Dv.ToTable Dv.Dispose() Else - GlobalDTProductosServiciosEquivalencias = DirectCast(Application("GlobalDTProductosServiciosEquivalencias"), DataTable) + GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTProductosServiciosEquivalencias") = value + Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value End Set End Property Property GlobalDTProductosServiciosCaracteristicas(CveEmpresa As Integer) As DataTable @@ -1222,20 +1294,31 @@ Public Class ClsPaginas Property GlobalDTPSAdicionales(CvePS As Integer, CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTPSAdicionales{0}", 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 Else Application(AppNombre) = Nothing + ObjPS.Dispose() + + End If + 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("GlobalDTPSAdicionales"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) GlobalDTPSAdicionales = Dv.ToTable Dv.Dispose() Else - GlobalDTPSAdicionales = DirectCast(Application("GlobalDTPSAdicionales"), DataTable) + GlobalDTPSAdicionales = DirectCast(Application(AppNombre), DataTable) End If End Get - Set(value As DataTable) - Application("GlobalDTPSAdicionales") = value + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTPSAdicionales{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTProductosServiciosCaracteristicasOpciones(CveEmpresa As Integer) As DataTable @@ -1287,20 +1370,29 @@ Public Class ClsPaginas End Property Property GlobalDTImpuestosLocales(CvePS As Integer, CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTImpuestosLocales{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSImpuestosLocales(-1, CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados Else Application(AppNombre) = Nothing + 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("GlobalDTImpuestosLocales"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) GlobalDTImpuestosLocales = Dv.ToTable Dv.Dispose() Else - GlobalDTImpuestosLocales = DirectCast(Application("GlobalDTImpuestosLocales"), DataTable) + GlobalDTImpuestosLocales = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTImpuestosLocales") = value + Dim AppNombre As String = String.Format("GlobalDTImpuestosLocales{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property 'Bancos @@ -1419,49 +1511,56 @@ Public Class ClsPaginas 'Fin Ruta 'Cliente Property GlobalDTCliente(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable - Get + Get + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus:=-1) Then Application(AppNombre) = ObjClientes.DtResultados Else Application(AppNombre) = Nothing + ObjClientes.Dispose() + End If + + If CveEmpresa <> -1 Then Dim StrSQL As New StringBuilder StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If Estatus >= 0 Then StrSQL.AppendFormat(" AND EstatusBool = {0} ", Estatus) - - If Application("GlobalDTCliente") Is Nothing Then - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then Application("GlobalDTCliente") = ObjClientes.DtResultados Else Application("GlobalDTCliente") = Nothing - ObjClientes.Dispose() - - Dim Dv As New DataView(DirectCast(Application("GlobalDTCliente"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) + If Estatus >= 0 Then StrSQL.AppendFormat(" AND EstatusBool = {0} ", Estatus) + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) GlobalDTCliente = Dv.ToTable - Dv.Dispose() - - Else - Dim Dv As New DataView(DirectCast(Application("GlobalDTCliente"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTCliente = Dv.ToTable - Dv.Dispose() - End If - + Dv.Dispose() + Else - GlobalDTCliente = DirectCast(Application("GlobalDTCliente"), DataTable) + GlobalDTCliente = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTCliente") = value + Dim AppNombre As String = String.Format("GlobalDTCliente{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTClienteClasificaciones(CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClienteClasificacion(UsuarioActual.CveEmpresa) Then Application(AppNombre) = ObjClientes.DtResultados Else Application(AppNombre) = Nothing + ObjClientes.Dispose() + End If If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTClienteClasificaciones"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + 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("GlobalDTClienteClasificaciones"), DataTable) + GlobalDTClienteClasificaciones = DirectCast(Application(AppNombre), DataTable) End If End Get - Set(value As DataTable) - Application("GlobalDTClasificacionesCliente") = value + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTClienteClasificaciones{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property Property GlobalDTEstatusOrdenServicios(CveEmpresa As Integer) As DataTable @@ -1509,17 +1608,26 @@ Public Class ClsPaginas End Property Property GlobalDTCompProveedores(CveEmpresa As Integer) As DataTable Get + Dim AppNombre As String = String.Format("GlobalDTCompProveedores{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjProveedores As New ClsCompProveedores + If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then Application(AppNombre) = ObjProveedores.DtResultados Else Application(AppNombre) = Nothing + ObjProveedores.Dispose() + End If + If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTCompProveedores"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) GlobalDTCompProveedores = Dv.ToTable Dv.Dispose() Else - GlobalDTCompProveedores = DirectCast(Application("GlobalDTCompProveedores"), DataTable) + GlobalDTCompProveedores = DirectCast(Application(AppNombre), DataTable) End If End Get Set(value As DataTable) - Application("GlobalDTCompProveedores") = value + Dim AppNombre As String = String.Format("GlobalDTCompProveedores{0}", CveEmpresa) + Application(AppNombre) = value End Set End Property 'EstatusFactura @@ -1637,7 +1745,7 @@ Public Class ClsPaginas Application("GlobalDTNom_Periodos") = value End Set End Property - Property GlobalDTVtaFormaPago() As DataTable + Public Property GlobalDTVtaFormaPago() As DataTable Get GlobalDTVtaFormaPago = DirectCast(Application("GlobalDTVtaFormaPago"), DataTable) End Get diff --git a/App_Code/ClsSubProyectos.vb b/App_Code/ClsSubProyectos.vb index b93b363dc..508c6f3de 100644 --- a/App_Code/ClsSubProyectos.vb +++ b/App_Code/ClsSubProyectos.vb @@ -110,10 +110,14 @@ Public Class ClsSubProyectos SqlTransacc.Commit() End Sub - Public Function GetSubProyectos() As Boolean + Public Function GetSubProyectos(Optional CveEmpresa As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_SubProyectosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try SqlAdapter.Fill(Data) Retorno = True @@ -121,10 +125,6 @@ Public Class ClsSubProyectos OnError("Ocurrió un error al obtener el Catálogo de SubProyectos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try - - - - Return Retorno End Function diff --git a/App_Code/ClsUnidadesMedida.vb b/App_Code/ClsUnidadesMedida.vb index ac7b58041..5df5ed959 100644 --- a/App_Code/ClsUnidadesMedida.vb +++ b/App_Code/ClsUnidadesMedida.vb @@ -126,14 +126,14 @@ Public Class ClsUnidadesMedida #Region " UNIDADES DE MEDIDA " - Public Function GetUnidadesMedida() As Boolean + Public Function GetUnidadesMedida(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_UnidadesMedidaGet") - ' With SqlAdapter.SelectCommand.Parameters - '.Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida - 'End With + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With Try SqlAdapter.Fill(Data) Retorno = True @@ -234,10 +234,11 @@ Public Class ClsUnidadesMedida #End Region #Region " UM ALIAS " - Public Function GetUnidadesMedidaAlias(Optional CveUnidadMedida As Integer = -1) As Boolean + Public Function GetUnidadesMedidaAlias(CveEmpresa As Integer, CveUnidadMedida As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_UnidadesMedidaAliasGet") With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida End With Try diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 4e15fb81d..c5e33a480 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2630,7 +2630,7 @@ Namespace Modelos importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador) importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" + Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, ClsPaginas.GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas @@ -2705,7 +2705,7 @@ Namespace Modelos importeMovimiento = ((TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador) importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago - Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" + Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, ClsPaginas.GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}" If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas @@ -3204,7 +3204,7 @@ Namespace Modelos If UsuarioActual.CveEmpresa = 1 Then DtEquivalencias = New DataTable - DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1) + DtEquivalencias = ClsPaginas.GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa) Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'") @@ -5446,11 +5446,11 @@ Namespace Modelos Public Sub SetSubProyecto() If CveSubProyecto > 0 Then - SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) + SubProyecto = New Modelos.SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) End If End Sub Public Sub SetSubProyectoMatriz() - Dim Row As Data.DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") + Dim Row As Data.DataRow = ClsPaginas.GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") If Not IsNothing(Row) Then SubProyectoMatriz = New Modelos.SubProyectoModel(Row) End If @@ -5496,12 +5496,12 @@ Namespace Modelos End Sub Public Sub SetSubProyecto(obj As ClsPaginas) If CveSubProyecto > 0 AndAlso Not IsNothing(obj) Then - SubProyecto = New Modelos.SubProyectoModel(obj.GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) + SubProyecto = New Modelos.SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}")) End If End Sub Public Sub SetSubProyectoMatriz(obj As ClsPaginas) If Not IsNothing(obj) Then - Dim Row As Data.DataRow = obj.GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=obj.UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") + Dim Row As Data.DataRow = ClsPaginas.GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=obj.UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1") If Not IsNothing(Row) Then SubProyectoMatriz = New Modelos.SubProyectoModel(Row) End If @@ -6339,45 +6339,8 @@ Namespace Modelos End If HttpContext.Current.Application("GlobalDTProyectos") = value End Set - End Property - Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - Get - - If DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then - Dim P As New ClsSubProyectos - If P.GetSubProyectos Then - HttpContext.Current.Application("GlobalDTSubProyectos") = P.DtResultados - End If - P.Dispose() - - Dim msg As String = "aqui no se carga subproyectos" - - End If - - If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -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 Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTSubProyectos = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - If value Is Nothing OrElse value.Rows.Count = 0 Then - Dim msg As String = "aqui no se carga subproyectos" - - End If - HttpContext.Current.Application("GlobalDTSubProyectos") = value - End Set - End Property + End Property + Property GlobalDTSubProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable Get @@ -6566,100 +6529,10 @@ Namespace Modelos ObjPS.Dispose() End Get - End Property - Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Cons = DirectCast(HttpContext.Current.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) - - Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) - If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) - If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo)) - If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) - If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) - - Try - GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable - Catch ex As Exception - GlobalDTPSSimplificado = New DataTable - End Try - - Else - GlobalDTPSSimplificado = DirectCast(HttpContext.Current.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)).CopyToDataTable - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTPSSimplificado") = value - End Set - End Property - Property GlobalDTProductosServiciosAlias(CveEmpresa As Integer, Optional Estatus As Integer = 1) As DataTable - Get - 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(HttpContext.Current.Application("GlobalDTProductosServiciosAlias"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows) - GlobalDTProductosServiciosAlias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProductosServiciosAlias = DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosAlias"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProductosServiciosAlias") = value - End Set - End Property - Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer) As DataTable - Get - If CvePS <> -1 OrElse CveUM <> -1 Then - Dim StrSQL As New StringBuilder - If CvePS <> -1 Then StrSQL.AppendFormat(" AND CvePS = {0}", CvePS) - If CveUM <> -1 Then StrSQL.AppendFormat(" AND CveUM = {0}", CveUM) - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosEquivalencias"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTProductosServiciosEquivalencias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosEquivalencias"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProductosServiciosEquivalencias") = value - End Set - End Property - Property GlobalDTProductosServiciosCaracteristicas(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosCaracteristicas"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProductosServiciosCaracteristicas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProductosServiciosCaracteristicas = DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosCaracteristicas"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProductosServiciosCaracteristicas") = value - End Set - End Property - Property GlobalDTProductosServiciosCaracteristicasOpciones(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosCaracteristicasOpciones"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTProductosServiciosCaracteristicasOpciones = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProductosServiciosCaracteristicasOpciones = DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosCaracteristicasOpciones"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProductosServiciosCaracteristicasOpciones") = value - End Set - End Property + End Property + + + Property GlobalDTInvMetodosInventario() As DataTable Get GlobalDTInvMetodosInventario = DirectCast(HttpContext.Current.Application("GlobalDTInvMetodosInventario"), DataTable) diff --git a/App_Code/WS_PuntoVenta.vb b/App_Code/WS_PuntoVenta.vb index f828c3ba8..2f1c60dac 100644 --- a/App_Code/WS_PuntoVenta.vb +++ b/App_Code/WS_PuntoVenta.vb @@ -519,7 +519,7 @@ Public Class WS_PuntoVenta Dim objUnidadesMedida As New ClsUnidadesMedida Dim Respuesta As New RespuestaWS - If objUnidadesMedida.GetUnidadesMedida() Then + If objUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then Respuesta.Datos = objUnidadesMedida.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) Respuesta.Datos.TableName = "Resultados" Respuesta.HuboError = False diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index 43af054f9..97adc819d 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -1929,24 +1929,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState HttpContext.Current.Application("GlobalDTProductosServiciosAlias") = value End Set End Property - Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer) As DataTable - Get - If CvePS <> -1 OrElse CveUM <> -1 Then - Dim StrSQL As New StringBuilder - If CvePS <> -1 Then StrSQL.AppendFormat(" AND CvePS = {0}", CvePS) - If CveUM <> -1 Then StrSQL.AppendFormat(" AND CveUM = {0}", CveUM) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosEquivalencias"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTProductosServiciosEquivalencias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application("GlobalDTProductosServiciosEquivalencias"), DataTable) - End If - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTProductosServiciosEquivalencias") = value - End Set - End Property Property GlobalDTProductosServiciosCaracteristicas(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index daee5c0f4..0dc50dcd3 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -344,10 +344,10 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If - If UsaGlobal Then - - Dim DTPS = DirectCast(context.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) - + If UsaGlobal Then + + 'Dim DTPS = DirectCast(context.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) + Dim DTPS = ClsPaginas.GlobalDTPSSimplificado(CveEmpresa).AsEnumerable If DTPS IsNot Nothing Then @@ -583,10 +583,9 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState - Dim DTPS = DirectCast(context.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) - - - + Dim DTPS = ClsPaginas.GlobalDTPSSimplificado(CveEmpresa).AsEnumerable ' DirectCast(context.Application("GlobalDTPSSimplificado"), EnumerableRowCollection(Of DataRow)) + + If DTPS IsNot Nothing Then 'APLICACION DE FILTROS diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 51d00e121..79d753686 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -2804,7 +2804,7 @@ Partial Class Bancos_IE If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL() If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + MsgError = "Ocurrió un error al registrara el asiento de bancos complementaria de devolución" End If End If diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 2b2904ada..e2d13433c 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2411,10 +2411,10 @@ Partial Class Compras_Compras CambiaEjercicioAC(False) End If - If GlobalDTProveedorSucursales(CveProveedor).Rows.Count > 0 Then + If GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa).Rows.Count > 0 Then RowProveedorSucursal.Visible = True DdlProveedorSucursal.Items.Clear() - DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(CveProveedor) + DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa) DdlProveedorSucursal.DataBind() DdlProveedorSucursal.Items.Insert(0, New ListItem("Matriz", "0")) DdlProveedorSucursal.SelectedValueExist(dr("CveProveedorSucursal").ToString.ToEntero) @@ -3178,7 +3178,7 @@ Partial Class Compras_Compras If Not CveCompra > 0 Then '[IPP] SI YA ESTA REGISTRADA LOS VALORES SE CARGAN EN EL CARGACOMPRA() 'DF 11-04-17 - Dim dtprovsuc As DataTable = GlobalDTProveedorSucursales(ObjProveedor.CveProveedor) + Dim dtprovsuc As DataTable = GlobalDTProveedorSucursales(ObjProveedor.CveProveedor, UsuarioActual.CveEmpresa) If dtprovsuc IsNot Nothing AndAlso dtprovsuc.Rows.Count > 0 Then RowProveedorSucursal.Visible = True DdlProveedorSucursal.Items.Clear() @@ -3859,7 +3859,7 @@ Partial Class Compras_Compras 'DF - 10/04/2017 If UsuarioActual.TienePermisoProceso(187) Then If TxtSerie.Text <> SerieVieja Then - Dim SerieNueva As String = GlobalDTProveedorSucursales(CveProveedor).FiltroPrimeroValor("Serie", $"Serie = '{TxtSerie.Text}'").ToString + Dim SerieNueva As String = GlobalDTProveedorSucursales(CveProveedor, UsuarioActual.CveEmpresa).FiltroPrimeroValor("Serie", $"Serie = '{TxtSerie.Text}'").ToString If SerieNueva = "" Then Alert("La Serie no es válida, por favor revise que se encuentre dentro de la lista de las sucursales del proveedor.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -5119,7 +5119,7 @@ Partial Class Compras_Compras 'UNIDAD BASE - EQUIVALENCIAS - INVENTARIO If UsuarioActual.CveEmpresa = 1 Then DtEquivalencias = New DataTable - DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1) + DtEquivalencias = GlobalDTProductosServiciosEquivalencias(CveProducto, -1, UsuarioActual.CveEmpresa) Dim CveUnidadBase As Integer = DtEquivalencias.FiltroPrimeroValor("CveUM", "UnidadBase = 'True'").ToEntero Dim drUMBase As DataRow = DtEquivalencias.FiltroPrimero("UnidadBase = 'True'") @@ -10295,7 +10295,7 @@ Partial Class Compras_Compras 'VALIDA UNIDAD DE MEDIDA If e.Row.DBCampo("CvePS").ToString.ToEntero > 0 Then - Dim DtEquivalencias = GlobalDTProductosServiciosEquivalencias(e.Row.DBCampo("CvePS").ToString.ToEntero, -1) + Dim DtEquivalencias = GlobalDTProductosServiciosEquivalencias(e.Row.DBCampo("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) 'SI UM NO ESTA REGISTRADA If e.Row.DBCampo("CveUM").ToString.ToEntero <= 0 Then @@ -10458,17 +10458,19 @@ Partial Class Compras_Compras #Region "METODOS" Private Sub GeneraGlobalDT(data As Object) - Dim ObjPS As New ClsProductosServicios - - If (ObjPS.GetPSSimplificado(-1)) Then - Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable - End If - - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados - End If - - ObjPS.Dispose() + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS As New ClsProductosServicios + + 'If (ObjPS.GetPSSimplificado(-1)) Then + ' Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable + 'End If + + 'If ObjPS.GetPSEquivalencias(-1, -1) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados + 'End If + + 'ObjPS.Dispose() End Sub Private Function notienepresupuesto() As Boolean Dim notienerecursos = False @@ -12106,10 +12108,10 @@ Partial Class Compras_Compras ChkConsignacion.Enabled = False End If - If GlobalDTProveedorSucursales(DdlProveedor.SelectedValue.ToEntero).Rows.Count > 0 Then + If GlobalDTProveedorSucursales(DdlProveedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows.Count > 0 Then RowProveedorSucursal.Visible = True DdlProveedorSucursal.Items.Clear() - DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(DdlProveedor.SelectedValue.ToEntero) + DdlProveedorSucursal.DataSource = GlobalDTProveedorSucursales(DdlProveedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) DdlProveedorSucursal.DataBind() DdlProveedorSucursal.Items.Insert(0, New ListItem("Selecciona una Sucursal", "-1")) DdlProveedorSucursal.Items.Insert(0, New ListItem("Matriz", "0")) @@ -16667,7 +16669,7 @@ Partial Class Compras_Compras ddlUM.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then - ddlUM.DataSource = GlobalDTProductosServiciosEquivalencias(GvRow.DataKey("CvePS").ToEntero, -1) + ddlUM.DataSource = GlobalDTProductosServiciosEquivalencias(GvRow.DataKey("CvePS").ToEntero, -1, UsuarioActual.CveEmpresa) Else ddlUM.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) End If @@ -16791,7 +16793,7 @@ Partial Class Compras_Compras ddlUM.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then - ddlUM.DataSource = GlobalDTProductosServiciosEquivalencias(PS("CvePS").ToString.ToEntero, -1) + ddlUM.DataSource = GlobalDTProductosServiciosEquivalencias(PS("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Else ddlUM.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) End If @@ -17447,7 +17449,7 @@ Partial Class Compras_Compras If Not DdlPSAlias2.SelectedValue = "" Then Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSAlias2.SelectedValue.ToEntero).FiltroPrimero("") If DrPS IsNot Nothing Then - DdlUnidadAlias.DataSource = GlobalDTProductosServiciosEquivalencias(DdlPSAlias2.SelectedValue.ToEntero, -1) + DdlUnidadAlias.DataSource = GlobalDTProductosServiciosEquivalencias(DdlPSAlias2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidadAlias.DataBind() HdnPSAliasCveClasificacion.Value = DrPS("CveClasificacion").ToString HdnPSAliasClasificacion.Value = DrPS("Clasificacion").ToString @@ -17508,7 +17510,7 @@ Partial Class Compras_Compras Private Sub GeneraGlobalEquivalencias() Dim ObjPS = New ClsProductosServicios If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados End If ObjPS.Dispose() End Sub @@ -17522,7 +17524,7 @@ Partial Class Compras_Compras UpUMAlias.Update() End Sub Protected Sub DdlUMAlias_SelectedIndexChanged(sender As Object, e As EventArgs) - If GlobalDTProductosServiciosEquivalencias(TmpDT.Rows(HdnUMAliasInd.Value.ToEntero)("CvePS").ToString.ToEntero, DdlUMAlias.SelectedValue.ToEntero).Rows.Count > 0 Then + If GlobalDTProductosServiciosEquivalencias(TmpDT.Rows(HdnUMAliasInd.Value.ToEntero)("CvePS").ToString.ToEntero, DdlUMAlias.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows.Count > 0 Then RegistraScript("$('#RowUMEquivalencia').addClass('hidden')", "RowUMEquivalenciaShow") Else RegistraScript("$('#RowUMEquivalencia').removeClass('hidden')", "RowUMEquivalenciaHide") @@ -17534,7 +17536,7 @@ Partial Class Compras_Compras Dim ObjPS As New ClsProductosServicios(ObjUM.IniciaTransacSQL()) Dim TieneError = False - Dim DtEquivalencia = GlobalDTProductosServiciosEquivalencias(TmpDT.Rows(HdnUMAliasInd.Value.ToEntero)("CvePS").ToString.ToEntero, -1) + Dim DtEquivalencia = GlobalDTProductosServiciosEquivalencias(TmpDT.Rows(HdnUMAliasInd.Value.ToEntero)("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Dim CveUM = -1 Dim UM = "" Dim Equivalencia = 0.0 @@ -17548,7 +17550,7 @@ Partial Class Compras_Compras 'SI NO TIENE EQUIVALENCIA DEL PS - AGREGA LA EQUIVALENCIA If Not TieneError Then - If Not GlobalDTProductosServiciosEquivalencias(TmpDT.Rows(HdnUMAliasInd.Value.ToEntero)("CvePS").ToString.ToEntero, DdlUMAlias.SelectedValue.ToEntero).Rows.Count > 0 Then + If Not GlobalDTProductosServiciosEquivalencias(TmpDT.Rows(HdnUMAliasInd.Value.ToEntero)("CvePS").ToString.ToEntero, DdlUMAlias.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows.Count > 0 Then If Not ObjPS.AddPSEquivalencias(TmpDT.Rows(HdnUMAliasInd.Value.ToEntero)("CvePS").ToString.ToEntero, DdlUMAlias.SelectedValue.ToEntero, TxtUMEquivalenciaCantidad.Text.ToDecimal, False, 0, UsuarioActual.CveUsuario) Then TieneError = True End If @@ -17643,7 +17645,7 @@ Partial Class Compras_Compras End Sub Protected Sub LBAplicarEquivalencia_Click(sender As Object, e As EventArgs) Dim Dr = TmpDT.Rows(CType(CType(sender, LinkButton).NamingContainer, GridViewRow).RowIndex) - Dim DtEquivalencia = GlobalDTProductosServiciosEquivalencias(Dr("CvePS").ToString.ToEntero, -1) + Dim DtEquivalencia = GlobalDTProductosServiciosEquivalencias(Dr("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Dim Equivalencia = DtEquivalencia.FiltroPrimeroValor("Cantidad", $"CveUM = {Dr("CveUM")}").ToDouble If Equivalencia > 0 Then @@ -17670,7 +17672,7 @@ Partial Class Compras_Compras Dim OjbUM As New ClsUnidadesMedida If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados End If If OjbUM.GetUnidadesMedidaAlias(-1) Then @@ -19066,11 +19068,12 @@ Partial Class Compras_Compras RecargaPSGlobal() End Sub Private Sub RecargaPSGlobal() - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() - - ObjPS.Dispose() + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS As New ClsProductosServicios + + 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() + + 'ObjPS.Dispose() End Sub #End Region diff --git a/Contabilidad/CatPeriodosBloqueo.aspx b/Contabilidad/CatPeriodosBloqueo.aspx index 0892172c5..80fa6e358 100644 --- a/Contabilidad/CatPeriodosBloqueo.aspx +++ b/Contabilidad/CatPeriodosBloqueo.aspx @@ -172,7 +172,21 @@ - +