From 2bb4c47c922df544c5abffe337c84194be131872 Mon Sep 17 00:00:00 2001 From: janeth arvizu Date: Thu, 26 Dec 2019 17:30:11 -0700 Subject: [PATCH] /cambios en globalDT separados por Empresa --- Acumuladores/CatTiposDefecto.aspx.vb | 5 +- Acumuladores/CatTiposUso.aspx.vb | 4 - App_Code/ClsAcumuladores.vb | 19 +- App_Code/ClsCompProveedores.vb | 3 +- App_Code/ClsInventarios.vb | 19 ++ App_Code/ClsPaginas.vb | 264 ++++++++++++++------ App_Code/ClsSubProyectos.vb | 10 +- App_Code/ClsUnidadesMedida.vb | 11 +- App_Code/Modelos.vb | 153 +----------- App_Code/WS_PuntoVenta.vb | 2 +- Ashx/SIGFacturacion.ashx | 17 -- Ashx/SIGWeb.ashx | 15 +- Bancos/IE.aspx.vb | 2 +- Compras/Compras.aspx.vb | 69 ++--- General/SaldosIniciales.aspx.vb | 3 +- Global.asax | 146 +++++------ Inventarios/Apartados.aspx.vb | 2 +- Inventarios/Consignaciones.aspx.vb | 2 +- Inventarios/EntradasSalidas.aspx.vb | 2 +- Inventarios/Kardex.aspx.vb | 2 +- Inventarios/KardexAlmacen.aspx.vb | 2 +- Inventarios/KardexAlmacenHorizontal.aspx.vb | 2 +- Inventarios/RecepcionUsados.aspx.vb | 2 +- Inventarios/ResguardoMaterial.aspx.vb | 2 +- Inventarios/TraspasoAlmacen.aspx.vb | 115 ++++++++- OC/OC.aspx.vb | 7 +- PortalCliente/PortalCliente.aspx.vb | 2 +- Sistemas/CatSesiones.aspx.vb | 7 +- Ventas/PV.aspx.vb | 42 ++-- Ventas/ProductosServicios.aspx.vb | 52 ++-- Ventas/Ventas.aspx | 2 +- Ventas/Ventas.aspx.vb | 98 ++++---- 32 files changed, 601 insertions(+), 482 deletions(-) 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/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 d03d0f075..bd8123ac9 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2361,10 +2361,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) @@ -3128,7 +3128,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() @@ -3809,7 +3809,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 @@ -5069,7 +5069,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'") @@ -10215,7 +10215,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 @@ -10378,17 +10378,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 @@ -12026,10 +12028,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")) @@ -16583,7 +16585,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 @@ -16707,7 +16709,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 @@ -17363,7 +17365,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 @@ -17424,7 +17426,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 @@ -17438,7 +17440,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") @@ -17450,7 +17452,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 @@ -17464,7 +17466,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 @@ -17559,7 +17561,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 @@ -17586,7 +17588,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 @@ -18982,11 +18984,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/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 9821c652d..b78138a65 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -867,7 +867,8 @@ Partial Class General_SaldosIniciales If Not ErrorPS Then ObjPS.Commit() - If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() If Contador > 0 Then Alert(String.Format("Se agregaron: {0} Productos/Servicios correctamente.
Se Actualizaron: {1} Productos/Servicios ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) Else diff --git a/Global.asax b/Global.asax index 6d228cc17..b5dc90938 100644 --- a/Global.asax +++ b/Global.asax @@ -318,27 +318,27 @@ If ObjVenta.GetClasificacionDetalle(-1, CveClasificacion:=-1) Then Application("GlobalDTClasificacionesDetalle") = ObjVenta.DtResultados End If - ObjVenta.Dispose() - - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'S U C U R S A L E S - - 'Dim ObjSucursales As New ClsSucursales() - 'If ObjSucursales.GetSucursales() Then Application("GlobalDTSucursales") = ObjSucursales.DtResultados Else Application("GlobalDTSucursales") = Nothing - 'ObjSucursales.Dispose() - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'U N I D A D E S - D E - M E D I D A - - Dim ObjUnidadesMedida As New ClsUnidadesMedida() - If ObjUnidadesMedida.GetUnidadesMedida() Then Application("GlobalDTUnidadesMedida") = ObjUnidadesMedida.DtResultados Else Application("GlobalDTUnidadesMedida") = Nothing - If ObjUnidadesMedida.GetUnidadesMedidaAlias() Then Application("GlobalDTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados Else Application("GlobalDTUnidadesMedidaAlias") = Nothing - ObjUnidadesMedida.Dispose() - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'M E T O D O S - D E - P A G O - + ObjVenta.Dispose() + + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'S U C U R S A L E S + + 'Dim ObjSucursales As New ClsSucursales() + 'If ObjSucursales.GetSucursales() Then Application("GlobalDTSucursales") = ObjSucursales.DtResultados Else Application("GlobalDTSucursales") = Nothing + 'ObjSucursales.Dispose() + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'U N I D A D E S - D E - M E D I D A + + 'Dim ObjUnidadesMedida As New ClsUnidadesMedida() + 'If ObjUnidadesMedida.GetUnidadesMedida(-1) Then Application("GlobalDTUnidadesMedida") = ObjUnidadesMedida.DtResultados Else Application("GlobalDTUnidadesMedida") = Nothing + 'If ObjUnidadesMedida.GetUnidadesMedidaAlias() Then Application("GlobalDTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados Else Application("GlobalDTUnidadesMedidaAlias") = Nothing + 'ObjUnidadesMedida.Dispose() + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'M E T O D O S - D E - P A G O + Dim ObjMetodoPago As New ClsMetodosPagos() If ObjMetodoPago.GetMetodosPago() Then Application("GlobalDTMetodosPago") = ObjMetodoPago.DtResultados Else Application("GlobalDTMetodosPago") = Nothing ObjMetodoPago.Dispose() @@ -383,7 +383,7 @@ 'S U B P R O Y E C T O S Dim ObjSubProyectos As New ClsSubProyectos - If ObjSubProyectos.GetSubProyectos Then Application("GlobalDTSubProyectos") = ObjSubProyectos.DtResultados Else Application("GlobalDTSubProyectos") = Nothing + 'If ObjSubProyectos.GetSubProyectos Then Application("GlobalDTSubProyectos") = ObjSubProyectos.DtResultados Else Application("GlobalDTSubProyectos") = Nothing If ObjSubProyectos.GetSubProyectosUsuarios Then Application("GlobalDTProyectosUsuarios") = ObjSubProyectos.DtResultados.FiltraParametros("", "", {"Proyecto", "CveProyecto", "CveUsuario", "CveEmpresa", "CveEstatusProyecto"}) Application("GlobalDTSubProyectosUsuarios") = ObjSubProyectos.DtResultados @@ -413,40 +413,40 @@ '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 'P R O D U C T O S S E R V I C I O S - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSAlias(-1, -1) Then Application("GlobalDTProductosServiciosAlias") = ObjPS.DtResultados Else Application("GlobalDTProductosServiciosAlias") = Nothing - If ObjPS.GetPSEquivalencias(-1, -1) Then Application("GlobalDTProductosServiciosEquivalencias") = ObjPS.DtResultados Else Application("GlobalDTProductosServiciosEquivalencias") = Nothing - 'If ObjPS.GetPS(-1, -1, -1) Then Application("GlobalDTProductosServicios") = ObjPS.DtResultados.AsEnumerable() Else Application("GlobalDTProductosServicios") = Nothing - If ObjPS.GetMetodosInv() Then Application("GlobalDTInvMetodosInventario") = ObjPS.DtResultados Else Application("GlobalDTInvMetodosInventario") = Nothing - If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() Else Application("GlobalDTPSSimplificado") = Nothing - If ObjPS.GetPSAdicionales(-1, -1) Then Application("GlobalDTPSAdicionales") = ObjPS.DtResultados Else Application("GlobalDTPSAdicionales") = Nothing - ObjPS.Dispose() - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'P R O V E E D O R E S - - Dim ObjProveedores As New ClsCompProveedores - If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCompProveedores") = ObjProveedores.DtResultados Else Application("GlobalDTCompProveedores") = Nothing - If ObjProveedores.GetProveedorClasificacion(-1) Then Application("GlobalDTProveedorClasificacion") = ObjProveedores.DtResultados Else Application("GlobalDTProveedorClasificacion") = Nothing - If ObjProveedores.GetSucursales(-1) Then Application("GlobalDTProveedorSucursales") = ObjProveedores.DtResultados Else Application("GlobalDTProveedorSucursales") = Nothing - ObjProveedores.Dispose() - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'P R O V E E D O R E S C U E N T A S + Dim ObjPS As New ClsProductosServicios + 'If ObjPS.GetPSAlias(-1, -1) Then Application("GlobalDTProductosServiciosAlias") = ObjPS.DtResultados Else Application("GlobalDTProductosServiciosAlias") = Nothing + 'If ObjPS.GetPSEquivalencias(-1, -1) Then Application("GlobalDTProductosServiciosEquivalencias") = ObjPS.DtResultados Else Application("GlobalDTProductosServiciosEquivalencias") = Nothing + 'If ObjPS.GetPS(-1, -1, -1) Then Application("GlobalDTProductosServicios") = ObjPS.DtResultados.AsEnumerable() Else Application("GlobalDTProductosServicios") = Nothing + If ObjPS.GetMetodosInv() Then Application("GlobalDTInvMetodosInventario") = ObjPS.DtResultados Else Application("GlobalDTInvMetodosInventario") = Nothing + 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() Else Application("GlobalDTPSSimplificado") = Nothing + 'If ObjPS.GetPSAdicionales(-1, -1) Then Application("GlobalDTPSAdicionales") = ObjPS.DtResultados Else Application("GlobalDTPSAdicionales") = Nothing + ObjPS.Dispose() + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'P R O V E E D O R E S + + 'Dim ObjProveedores As New ClsCompProveedores + 'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCompProveedores") = ObjProveedores.DtResultados Else Application("GlobalDTCompProveedores") = Nothing + 'If ObjProveedores.GetProveedorClasificacion(-1) Then Application("GlobalDTProveedorClasificacion") = ObjProveedores.DtResultados Else Application("GlobalDTProveedorClasificacion") = Nothing + 'If ObjProveedores.GetSucursales(-1, -1) Then Application("GlobalDTProveedorSucursales") = ObjProveedores.DtResultados Else Application("GlobalDTProveedorSucursales") = Nothing + 'ObjProveedores.Dispose() + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'P R O V E E D O R E S C U E N T A S Dim ObjProveedoresBancos As New ClsGenerales If ObjProveedoresBancos.GetCuentasDepositos() Then Application("GlobalDTProveedoresCuentas") = ObjProveedoresBancos.DtResultados Else Application("GlobalDTProveedoresCuentas") = Nothing - ObjProveedoresBancos.Dispose() - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'C L I E N T E S - - 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 - If ObjClientes.GetClienteClasificacion(-1) Then Application("GlobalDTClienteClasificaciones") = ObjClientes.DtResultados Else Application("GlobalDTClienteClasificaciones") = Nothing - ObjClientes.Dispose() - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'C O N T R A T O S - + ObjProveedoresBancos.Dispose() + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'C L I E N T E S + + '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 + 'If ObjClientes.GetClienteClasificacion(-1) Then Application("GlobalDTClienteClasificaciones") = ObjClientes.DtResultados Else Application("GlobalDTClienteClasificaciones") = Nothing + 'ObjClientes.Dispose() + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'C O N T R A T O S + Dim ObjContratos As New ClsContratos If ObjContratos.GetContratos(-1, -1) Then Application("GlobalDTContratos") = ObjContratos.DtResultados Else Application("GlobalDTContratos") = Nothing If ObjContratos.GetSecciones() Then Application("GlobalDTContratosSecciones") = ObjContratos.DtResultados Else Application("GlobalDTContratosSecciones") = Nothing @@ -565,25 +565,25 @@ System.Web.UI.ValidationSettings.UnobtrusiveValidationMode = UnobtrusiveValidationMode.None Dim EmpresaNotificaciones As New Empresa With {.SendMail = "signotificaciones@adssistemas.mx", .SendMailPassword = "sig123987", .SendMailServer = "mail.adssistemas.mx", .SendMailPuerto = 587} - ClsPaginas.EmpresaNotificaciones = EmpresaNotificaciones - - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 'I M P U E S T O S L O C A L E S - - Dim ObjPSImpuestos As New ClsProductosServicios - If ObjPSImpuestos.GetPSImpuestosLocales(-1, -1) Then - If ObjPSImpuestos.DtResultados.Rows.Count > 0 Then - Application("GlobalDTImpuestosLocales") = ObjPSImpuestos.DtResultados - Else - Application("GlobalDTImpuestosLocales") = Nothing - End If - End If - ObjPSImpuestos.Dispose() - - - '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - ' R A S T R E O + ClsPaginas.EmpresaNotificaciones = EmpresaNotificaciones + + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 'I M P U E S T O S L O C A L E S + + 'Dim ObjPSImpuestos As New ClsProductosServicios + 'If ObjPSImpuestos.GetPSImpuestosLocales(-1, -1) Then + ' If ObjPSImpuestos.DtResultados.Rows.Count > 0 Then + ' Application("GlobalDTImpuestosLocales") = ObjPSImpuestos.DtResultados + ' Else + ' Application("GlobalDTImpuestosLocales") = Nothing + ' End If + 'End If + 'ObjPSImpuestos.Dispose() + + + '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + ' R A S T R E O Dim ObjGPS As New ClsGPS If ObjGPS.DispositivosGet(-1, -1, -1, -1) Then If ObjGPS.DtResultados.Rows.Count > 0 Then diff --git a/Inventarios/Apartados.aspx.vb b/Inventarios/Apartados.aspx.vb index f2e78c27e..08456d654 100644 --- a/Inventarios/Apartados.aspx.vb +++ b/Inventarios/Apartados.aspx.vb @@ -264,7 +264,7 @@ Partial Class Inventarios_Apartados End If DdlUnidad.Items.Clear() - DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1) + DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() UpDatos.Update() diff --git a/Inventarios/Consignaciones.aspx.vb b/Inventarios/Consignaciones.aspx.vb index cccb8b517..7706639b3 100644 --- a/Inventarios/Consignaciones.aspx.vb +++ b/Inventarios/Consignaciones.aspx.vb @@ -1462,7 +1462,7 @@ Partial Class Inventarios_Consignaciones 'End If End If Dim dtpse As DataTable - dtpse = GlobalDTProductosServiciosEquivalencias(DdlProducto.SelectedValue.ToEntero, -1) + dtpse = GlobalDTProductosServiciosEquivalencias(DdlProducto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) 'dtpse.Columns("UM").ColumnName = "UnidadMedida" 'dtpse.Columns("CveUM").ColumnName = "CveUnidadMedida" DdlUnidad.DataSource = dtpse diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index c9a3d76c3..06da0da29 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -2154,7 +2154,7 @@ Partial Class Inventarios_EntradasSalidas End If DdlUnidad.Items.Clear() - DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1) + DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() UPDatos.Update() End Sub diff --git a/Inventarios/Kardex.aspx.vb b/Inventarios/Kardex.aspx.vb index b6fe14ec1..77fc82fed 100644 --- a/Inventarios/Kardex.aspx.vb +++ b/Inventarios/Kardex.aspx.vb @@ -162,7 +162,7 @@ Partial Class Inventarios_Kardex Protected Sub ddlProducto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlProducto2.selectedindexchange DdlUnidadMedida.Items.Clear() - DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(ddlProducto2.SelectedValue.ToEntero, -1) + DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(ddlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidadMedida.DataBind() DdlUnidadMedida.Items.Insert(0, New ListItem("Todos", "-1")) diff --git a/Inventarios/KardexAlmacen.aspx.vb b/Inventarios/KardexAlmacen.aspx.vb index 500899d26..e894daab8 100644 --- a/Inventarios/KardexAlmacen.aspx.vb +++ b/Inventarios/KardexAlmacen.aspx.vb @@ -90,7 +90,7 @@ Partial Class Inventarios_KardexAlmacen Protected Sub ddlProducto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlProducto2.selectedindexchange DdlUnidadMedida.Items.Clear() - DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(ddlProducto2.SelectedValue.ToEntero, -1) + DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(ddlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidadMedida.DataBind() DdlUnidadMedida.Items.Insert(0, New ListItem("Todos", "-1")) diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index 75cb2e694..6a63652a6 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -104,7 +104,7 @@ Partial Class Inventarios_KardexAlmacen Protected Sub ddlProducto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlProducto2.selectedindexchange DdlUnidadMedida.Items.Clear() - DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(ddlProducto2.SelectedValue.ToEntero, -1) + DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(ddlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidadMedida.DataBind() DdlUnidadMedida.Items.Insert(0, New ListItem("Todos", "-1")) diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 381d6ef3c..48c82b214 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1283,7 +1283,7 @@ Partial Class Inventarios_RecepcionUsados EscondeColumnasGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' ")) DdlUnidad.Items.Clear() - DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1) + DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() HdnCveTamaño.Value = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTamaño", $"CvePS = { DdlProducto2.SelectedValue.ToEntero }") diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb index a8f258238..5311877ee 100644 --- a/Inventarios/ResguardoMaterial.aspx.vb +++ b/Inventarios/ResguardoMaterial.aspx.vb @@ -367,7 +367,7 @@ Partial Class Inventarios_ResguardoMaterial 'End If DdlUnidad.Items.Clear() - DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1) + DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() UPDatos.Update() diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index a3a8b677b..f4ee07ca2 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -749,6 +749,10 @@ Partial Class Inventarios_TraspasoAlmacen Dim CveMovimientoEntrada = 0 Dim IDPoliza As Integer = 0 Dim FolioSalida = 0 + Dim CveMovimientoVirtualEntrada As Integer = 0 + Dim CveMovimientoVirtualSalida As Integer = 0 + Dim FolioVirtualEntrada As Integer = 0 + Dim FolioVirtualSalida As Integer = 0 Dim FolioEntrada = 0 Dim AlmacenEntrada = -1 Dim Fecha As Date = TxtFecha.Text.ToDate @@ -790,9 +794,38 @@ Partial Class Inventarios_TraspasoAlmacen End If Cont += 1 Next - End If - - 'AGREGAMOS LA ENTRADA + End If + + + 'VIRTUAL SALIDA + If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then + Dim CveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen= {DdlAlmacenOrigen.SelectedValue}").ToEntero() + + Dim CveAlmacenVirtual As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero() + + CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtual, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/V") + FolioVirtualSalida = ObjInventario.Folio + Dim dtvirtual As DataTable = Nothing + + If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + dtvirtual = ObjInventario.DtResultados + For Each RowVirtual As DataRow In dtvirtual.Rows + Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble() + Dim PU As Double = RowVirtual("PU").ToString().ToDouble() + Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualSalida, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next + Else + ErrorMovInv = True + End If + End If + + 'AGREGAMOS LA ENTRADA If Not ChkTransitorio.Checked Then 'SI NO ES TRANSITORIO SE HACE LA RECEPCION DE INMEDIATO If Not ErrorMovInv Then Dim TipoMovimientoEntrada = 9 @@ -826,7 +859,35 @@ Partial Class Inventarios_TraspasoAlmacen Cont += 1 Next End If + End If + 'VIRTUAL ENTRADA + If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then + Dim CveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen= {DdlAlmacenDestino.SelectedValue}").ToEntero() + + Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen =24 AND CveSubProyecto={CveSubProyecto}").ToEntero() + + CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 2, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S") + FolioVirtualEntrada = ObjInventario.Folio + Dim dtvirtual As DataTable = Nothing + + If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then + dtvirtual = ObjInventario.DtResultados + For Each RowVirtual As DataRow In dtvirtual.Rows + Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble() + Dim PU As Double = RowVirtual("PU").ToString().ToDouble() + Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next + Else + ErrorMovInv = True + End If End If + End If End If @@ -847,10 +908,13 @@ Partial Class Inventarios_TraspasoAlmacen MensajeAlert.AppendFormat("
Folio de Salida: {0}", FolioSalida, CveMovimientoSalida) MensajeAlert.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) - + If CveMovimientoVirtualSalida > 0 Then MensajeAlert.AppendFormat("
Folio: {2} Imprimir Salida Virtual", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtualSalida)), CveMovimientoVirtualSalida, FolioVirtualSalida) + If Not ChkTransitorio.Checked Then - MensajeAlert.AppendFormat("
Folio de Entrada: {0}", FolioEntrada, CveMovimientoEntrada) + MensajeAlert.AppendFormat("

Folio de Entrada: {0}", FolioEntrada, CveMovimientoEntrada) MensajeAlert.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) + If CveMovimientoVirtualEntrada > 0 Then MensajeAlert.AppendFormat("
Folio: {2} Imprimir Entrada Virtual", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtualEntrada)), CveMovimientoVirtualEntrada, FolioVirtualEntrada) + End If 'DdlClasificacion.SelectedValue = "-1" @@ -965,10 +1029,8 @@ Partial Class Inventarios_TraspasoAlmacen Mensaje.AppendFormat("
Folio: {0}", FolioMov, CveMovimiento) - Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) - - - + Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) + LimpiaMovimiento() Else @@ -1068,7 +1130,7 @@ Partial Class Inventarios_TraspasoAlmacen End If DdlUnidad.Items.Clear() - DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1) + DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() UpDatos.Update() End Sub @@ -1544,6 +1606,37 @@ Partial Class Inventarios_TraspasoAlmacen Cont += 1 Next + End If + + + 'VIRTUAL ENTRADA + Dim CveMovimientoVirtualEntrada As Integer = 0 + Dim FolioVirtualEntrada As Integer = 0 + If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then + Dim CveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen= {DdlAlmacenDestino.SelectedValue}").ToEntero() + + Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen =24 AND CveSubProyecto={CveSubProyecto}").ToEntero() + + CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 2, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S") + FolioVirtualEntrada = ObjInventario.Folio + Dim dtvirtual As DataTable = Nothing + + If CveMovimientoVirtualEntrada > 0 AndAlso ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then + dtvirtual = ObjInventario.DtResultados + For Each RowVirtual As DataRow In dtvirtual.Rows + Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() + Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble() + Dim PU As Double = RowVirtual("PU").ToString().ToDouble() + Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next + Else + ErrorMovInv = True + End If End If ''AGREGAMOS LA ENTRADA @@ -1619,6 +1712,8 @@ Partial Class Inventarios_TraspasoAlmacen Dim Mensaje As StringBuilder = New StringBuilder Mensaje.AppendFormat("Se realizo correctamente la recepción.
Folio de Entrada: {0}", Folio, CveMovimientoSalida) Mensaje.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) 'onclick='ImprimirTraslado()' + If CveMovimientoVirtualEntrada > 0 Then Mensaje.AppendFormat("
{2}Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtualEntrada)), CveMovimientoVirtualEntrada, FolioVirtualEntrada) 'onclick='ImprimirTraslado()' + Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index b9df5e9c2..32f164658 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -7315,11 +7315,12 @@ Partial Class OC RecargaPSGlobal() End Sub Private Sub RecargaPSGlobal() - Dim ObjPS As New ClsProductosServicios + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() + 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() - ObjPS.Dispose() + 'ObjPS.Dispose() End Sub diff --git a/PortalCliente/PortalCliente.aspx.vb b/PortalCliente/PortalCliente.aspx.vb index d225ec040..ca1eda77e 100644 --- a/PortalCliente/PortalCliente.aspx.vb +++ b/PortalCliente/PortalCliente.aspx.vb @@ -2313,7 +2313,7 @@ Partial Class Ventas_PortalCliente If drPS IsNot Nothing Then DdlUM.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then - DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlPS.SelectedValue.ToEntero, -1) + DdlUM.DataSource = GlobalDTProductosServiciosEquivalencias(DdlPS.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Else DdlUM.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) End If diff --git a/Sistemas/CatSesiones.aspx.vb b/Sistemas/CatSesiones.aspx.vb index f340b8c94..c60aab305 100644 --- a/Sistemas/CatSesiones.aspx.vb +++ b/Sistemas/CatSesiones.aspx.vb @@ -220,9 +220,10 @@ Partial Class Sistemas_CatSesiones Private Sub CargaProductosServiciosSimplificado() - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() Else Application("GlobalDTPSSimplificado") = Nothing - ObjPS.Dispose() + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS As New ClsProductosServicios + 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() Else Application("GlobalDTPSSimplificado") = Nothing + 'ObjPS.Dispose() End Sub diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 1ea131f5e..c63687031 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -1615,6 +1615,8 @@ Partial Class PV If (Boolean.Parse(ObjCliente.DtResultados(0)("EsDistribuidor").ToString)) Then TrEsDistribuidor.Visible = True LbVendedor.Text = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Vendedor", $"CveVendedor = {ObjCliente.Vendedor}") + Else + TrEsDistribuidor.Visible = False End If ViewState("CliNoExt") = ObjCliente.NoExt @@ -1643,8 +1645,14 @@ Partial Class PV End If If CveVenta <= 0 Then + CveMetodoPagoCliente = ObjCliente.DtResultados.Rows(0)("CveMetodoPago").ToString.ToEntero DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI.ToString) DdlMetodoPago.SelectedValueExist(ObjCliente.CveMetodoPago.ToString) + DdlMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString) + DdlMetodoPago33_SelectedIndexChanged(DdlMetodoPago33, EventArgs.Empty) + + DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString) + DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString) End If TxtFechaPago.Text = (Now.AddDays(ObjCliente.PlazoCobranza)).ToShortDateString @@ -1969,7 +1977,7 @@ Partial Class PV End If Catch ex As Exception - Alert("No se pudo verificar la fecha del certificado", TipoMensaje.MsgError) + Alert("No se pudo verificar la fecha del certificado", TipoMensaje.ToastError) End Try End Sub @@ -2800,7 +2808,7 @@ Partial Class PV DdlUnidadMedida.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then - DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(CvePSParametro, -1) + DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(CvePSParametro, -1, UsuarioActual.CveEmpresa) Else DdlUnidadMedida.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) End If @@ -4890,17 +4898,19 @@ Partial Class PV Hilo.Start() End Sub Private Sub GeneraGlobalDT() - Dim ObjPS As New ClsProductosServicios + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS As New ClsProductosServicios - If (ObjPS.GetPSSimplificado(-1)) Then - Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable 'Cargamos el GlobalDTPSSimplificado - End If + 'If (ObjPS.GetPSSimplificado(-1)) Then + ' Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable 'Cargamos el GlobalDTPSSimplificado + 'End If - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados - End If + 'If ObjPS.GetPSEquivalencias(-1, -1) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados + 'End If - ObjPS.Dispose() + 'ObjPS.Dispose() End Sub Private Sub RecargaGlobalCliente() @@ -5020,8 +5030,6 @@ Partial Class PV GvRecepcionUsados.DataBind() GvRecepcionUsadosModal.DataBind() - CargaPSAjuste() - CreaDTmpDTAjustes() CreaDTmpDTRecepcionUsados() CargaBCIAjuste() @@ -5216,10 +5224,11 @@ Partial Class PV Private Sub CalculaPorcentajeAjuste() If DdlPS.SelectedValue.ToEntero <= 0 Then - 'Alert("No se ha especificado producto a entregar") + Alert("No se ha especificado producto a entregar") Exit Sub End If Try + TxtImporteAjuste.Text = "0.00" If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then Dim CveMarca As Integer = -1 @@ -5267,10 +5276,13 @@ Partial Class PV TxtImporteAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero Else + Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia) 'cuando no está registrada, no da ajuste TxtImporteAjuste.ToolTip = "El producto no tiene ajuste en ese periodo" TxtImporteAjuste.Text = "0.00" End If + Else + Alert("No se tiene especificado tabla de garantía") End If ObjAcum.Dispose() End If @@ -5430,8 +5442,8 @@ Partial Class PV Protected Sub DdlFolioGarantia_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFolioGarantia.SelectedIndexChanged Dim ObjAcumuladores As New ClsAcumuladores If ObjAcumuladores.GetNuevoConsecutivoFolio(DdlFolioGarantia.SelectedValue.ToEntero) Then - Dim resultado As String = ObjAcumuladores.DtResultados.FiltroPrimeroValor("NuevoConsecutivo") - TxtConsecutivoAjuste.Text = resultado + Dim resultado As Integer = ObjAcumuladores.DtResultados.FiltroPrimeroValor("NuevoConsecutivo").ToEntero + TxtConsecutivoAjuste.Text = resultado.ToString UpAjuste.Update() End If ObjAcumuladores.Dispose() diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 50e8551cf..a0ae980b3 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1009,7 +1009,7 @@ Partial Class ProductosyServicios End Sub Private Sub ElProductoChange() ddlUnidad.Items.Clear() - ddlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductows.SelectedValue.ToEntero, -1) + ddlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProductows.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) ddlUnidad.DataBind() UpDatos.Update() End Sub @@ -1301,7 +1301,7 @@ Partial Class ProductosyServicios RecargaGlobal() End Sub Protected Sub HFProducto_ValueChanged(sender As Object, e As EventArgs) Handles HFProducto.ValueChanged - ddlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(HFProducto.Value.ToEntero, -1) + ddlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(HFProducto.Value.ToEntero, -1, UsuarioActual.CveEmpresa) ddlUnidad.DataBind() End Sub Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click @@ -1330,27 +1330,34 @@ Partial Class ProductosyServicios Hilo.Start() End Sub Private Sub GeneraGlobalDT() - Dim ObjPS As New ClsProductosServicios + GlobalDTPSAdicionales(-1, UsuarioActual.CveEmpresa) = Nothing + GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) = Nothing + GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa) = Nothing + GlobalDTImpuestosLocales(-1, UsuarioActual.CveEmpresa) = Nothing + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing + GlobalDTPSAdicionales(-1, UsuarioActual.CveEmpresa) = Nothing - If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() + 'Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSAlias(-1, -1) Then - GlobalDTProductosServiciosAlias(-1) = ObjPS.DtResultados - End If + 'If ObjPS.GetPSSimplificado(-1) Then Application("GlobalDTPSSimplificado") = ObjPS.DtResultados.AsEnumerable() - If ObjPS.GetPSImpuestosLocales(-1, -1) Then - GlobalDTImpuestosLocales(-1, -1) = ObjPS.DtResultados - End If + 'If ObjPS.GetPSAlias(-1, -1) Then + ' GlobalDTProductosServiciosAlias(-1) = ObjPS.DtResultados + 'End If - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados - End If + 'If ObjPS.GetPSImpuestosLocales(-1, -1) Then + ' GlobalDTImpuestosLocales(-1, -1) = ObjPS.DtResultados + 'End If - If ObjPS.GetPSAdicionales(-1, -1) Then - GlobalDTPSAdicionales(-1, -1) = ObjPS.DtResultados - End If + 'If ObjPS.GetPSEquivalencias(-1, -1) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados + 'End If - ObjPS.Dispose() + ''If ObjPS.GetPSAdicionales(-1, -1) Then + '' GlobalDTPSAdicionales(-1, -1) = ObjPS.DtResultados + ''End If + + 'ObjPS.Dispose() End Sub #End Region @@ -1398,11 +1405,12 @@ Partial Class ProductosyServicios Hilo.Start() End Sub Private Sub GeneraGlobalEquivalencias() - Dim ObjPS = New ClsProductosServicios - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados - End If - ObjPS.Dispose() + GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = Nothing + 'Dim ObjPS = New ClsProductosServicios + 'If ObjPS.GetPSEquivalencias(-1, -1) Then + ' GlobalDTProductosServiciosEquivalencias(-1, -1, UsuarioActual.CveEmpresa) = ObjPS.DtResultados + 'End If + 'ObjPS.Dispose() End Sub Private Sub CargaGvEquivalencias() If DtEquivalencias IsNot Nothing Then diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index ab26b65a5..019436ba6 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -5778,7 +5778,7 @@ <%--APLICAR NC--%>