475 lines
23 KiB
Plaintext
475 lines
23 KiB
Plaintext
<%@ WebHandler Language="VB" Class="E48" %>
|
|
|
|
Imports System
|
|
Imports System.Web
|
|
Imports System.Data
|
|
Imports Newtonsoft.Json
|
|
Imports Extensiones
|
|
Imports System.IO
|
|
Imports System.Net.Http
|
|
Imports Newtonsoft.Json.Linq
|
|
|
|
Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|
Private ReadOnly Property CveEmpresa As Integer = 48
|
|
|
|
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
|
Get
|
|
Return False
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Application As HttpApplicationState
|
|
|
|
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
|
|
|
Try
|
|
Select Case context.Request("metodo")
|
|
Case "Salida"
|
|
Salida(context)
|
|
End Select
|
|
Catch ex As Exception
|
|
ex.GuardaLog(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Function Salida(ByVal context As HttpContext) As String
|
|
Dim retorno As String = ""
|
|
|
|
Dim Respuesta As New APHAppsResponse
|
|
Dim RespuestaError As New APHAppResponseError
|
|
Dim TieneError As Boolean = False
|
|
Dim JsonRequest As JObject = Nothing
|
|
Dim ObjInventario As New ClsInventarios
|
|
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
|
Dim CveMovimiento As Integer = 0
|
|
Dim Mensaje As String = ""
|
|
Dim SinExistencia As String = "No hay existencias suficientes del producto: "
|
|
Dim ObjUsuarios As New ClsSisUsuarios
|
|
Dim CveUsuario As Integer
|
|
Dim UsuarioActual As Usuario = Nothing 'ValidaUsuarioSistema(100, CveEmpresa)
|
|
Dim FolioSalida As Integer = 0
|
|
|
|
Dim ErrorAC As Boolean = False
|
|
Dim ErrorMovInv As Boolean = False
|
|
|
|
If context.Request.InputStream IsNot Nothing Then
|
|
Using reader As New StreamReader(context.Request.InputStream)
|
|
Dim json As String = reader.ReadToEnd
|
|
|
|
If Not String.IsNullOrEmpty(json) Then
|
|
JsonRequest = JObject.Parse(json)
|
|
If JsonRequest Is Nothing Then
|
|
TieneError = True
|
|
End If
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
|
|
End Using
|
|
End If
|
|
If TieneError Then
|
|
RespuestaError.Message = "Ocurrió un error al obtener el cuerpo de los parametros"
|
|
End If
|
|
|
|
If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha").ToString) Then
|
|
Dim ObjContaAC As ClsContPAQi = Nothing
|
|
|
|
Dim observaciones As String = If(JsonRequest("observaciones").ToString() <> "", JsonRequest("observaciones").ToString(), "Salida Almacen")
|
|
|
|
Dim IDPoliza As Integer = 0
|
|
Dim usuario As String = JsonRequest("usuario").ToString()
|
|
If ObjUsuarios.GetUsuariosEmpresas(-1, -1) Then
|
|
CveUsuario = ObjUsuarios.DtResultados.FiltroPrimeroValor("CveUsuario", String.Format("Usuario = '{0}' ", usuario)).ToEntero
|
|
If CveUsuario > 0 Then
|
|
UsuarioActual = ValidaUsuarioSistema(CveUsuario, CveEmpresa)
|
|
Else
|
|
Mensaje = "No se encontro el usuario ingresado"
|
|
TieneError = True
|
|
End If
|
|
Else
|
|
Mensaje = "No se encontro el usuario ingresado"
|
|
TieneError = True
|
|
End If
|
|
|
|
If Not TieneError Then
|
|
|
|
Dim GlobalDTInvConceptos As DataTable
|
|
If ObjInventario.GetConceptos Then GlobalDTInvConceptos = ObjInventario.DtResultados Else GlobalDTInvConceptos = Nothing
|
|
|
|
Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate
|
|
Dim almacen As String = JsonRequest("almacen").ToString()
|
|
Dim Recibe As String = JsonRequest("entrega").ToString()
|
|
Dim CveAlmacen As Integer = GlobalDTAlmacen(CveEmpresa).FiltroPrimeroValor("CveAlmacen", String.Format(" Almacen = '{0}'", almacen)).ToEntero
|
|
|
|
Dim EsContabilizable As Boolean = True
|
|
Dim tFolio As Integer = ObjInventario.GetFolioSiguiente(3, CveEmpresa)
|
|
|
|
Try
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, CveEmpresa, CveTipoPoliza:=3)
|
|
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48")
|
|
|
|
If CveMovimiento <= 0 OrElse CvePrePoliza <= 0 Then
|
|
RespuestaError.Message = "No se pudo almacenar el movimiento correctamente"
|
|
TieneError = True
|
|
ObjInventario.RollBack() 'deshace lo insertado
|
|
Else
|
|
|
|
End If
|
|
|
|
''VALIDA EXISTENCIAS
|
|
Dim Cont As Integer = 0
|
|
Dim ListaPS As JArray = JArray.Parse(JsonRequest("productos").ToString())
|
|
|
|
For Each JsonPS As JObject In ListaPS
|
|
|
|
Dim Cantidad As Decimal = JsonPS("cantidad").ToString.ToDecimal()
|
|
Dim dtt As DataTable = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString())
|
|
Dim CvePS As Integer = dtt.FiltroPrimeroValor("CvePS").ToEntero()
|
|
Dim CveUM As Integer = dtt.FiltroPrimeroValor("CveUnidadMedida").ToEntero()
|
|
|
|
If CvePS > 0 Then
|
|
If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then
|
|
|
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
|
Mensaje = "Error al guardar los movimientos"
|
|
|
|
ErrorMovInv = True
|
|
Exit For
|
|
End If
|
|
Else
|
|
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
|
ErrorMovInv = True
|
|
End If
|
|
Else
|
|
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
|
ErrorMovInv = True
|
|
End If
|
|
|
|
Cont += 1
|
|
Next
|
|
Mensaje = SinExistencia
|
|
'Registro la prepóliza
|
|
If Not ErrorMovInv AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, CveEmpresa) Then
|
|
Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL()
|
|
Dim tValorOtro As Decimal = tValorInventario
|
|
Dim TipoMovtoAlmacen As Boolean = False
|
|
Dim TipoMovtoOtro As Boolean = True
|
|
Dim tCveSubProyecto As Integer = -1
|
|
Dim drA2 As DataRow = GlobalDTAlmacen(CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen))
|
|
If drA2 IsNot Nothing Then
|
|
tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
|
|
End If
|
|
|
|
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 3).ToEntero
|
|
If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
|
|
TipoMovtoOtro = Not TipoMovtoAlmacen
|
|
Dim CveConceptoContable As Integer = 78
|
|
Dim CveClasificacion As Integer = -1
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAlmacen, tValorInventario, tValorInventario, 68, observaciones, observaciones, CveMovimientoAlmacen:=CveMovimiento, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
|
ErrorMovInv = True
|
|
Else
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoOtro, tValorOtro, tValorOtro, CveConceptoContable, observaciones, observaciones, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=tCveSubProyecto, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
|
ErrorMovInv = True
|
|
End If
|
|
End If
|
|
Else
|
|
ErrorMovInv = True
|
|
End If
|
|
|
|
'------------------------------------------------
|
|
If Not ErrorMovInv Then
|
|
'DEVENGAR
|
|
Dim TotalPorDevengar As Double = 0
|
|
|
|
'cuando tiene AC y es salida de almacen, se manda al gasto, solo aplica si el almacen es contable
|
|
If UsuarioActual.Empresa.UsaAC AndAlso EsContabilizable Then
|
|
Dim DtII As DataTable = Nothing
|
|
Dim TotalDetalle As Double = 0.0
|
|
Dim Importe As Decimal = 0
|
|
'NOTA. CUANDO ES SALIDA, EN AUTOMATICO NO TENEMOS LOS VALORES DE LA SALIDA TODAVIA, Y POR ESO IMPORTE ES CERO, ES RECARGAR CON LOS DATOS YA INSERTADOS
|
|
|
|
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
|
DtII = ObjInventario.DtResultados
|
|
End If
|
|
|
|
TotalPorDevengar += Importe ' GvInv.Rows.Cast(Of GridViewRow)().Sum(Function(Gvr) Math.Round(Gvr.DataKey("PU").ToString.ToDouble, 4) * Math.Round(Gvr.DataKey("CantidadF").ToString.ToDouble, 4))
|
|
TotalPorDevengar = Math.Round(TotalPorDevengar, 4)
|
|
ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa)
|
|
ObjContaAC.IniciaTransacSQL()
|
|
|
|
Dim AC As New ClsAC
|
|
Dim DtPresupuestos As DataTable = Nothing
|
|
If AC.GetPresupuestoEgresos(-1, True, UsuarioActual.Empresa.EjercicioActual, UsuarioActual.CveEmpresa) Then
|
|
DtPresupuestos = AC.DtResultados.Copy
|
|
Else
|
|
Mensaje = "Ocurrió un error al cargar los Presupuestos. Por favor vuelva a cargar la página"
|
|
End If
|
|
AC.Dispose()
|
|
|
|
IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, Fecha)
|
|
|
|
If IDPoliza > 0 Then
|
|
Dim CuentaCargoCOG As Integer
|
|
Dim CuentaAbonoAlmacen As Integer = 0
|
|
If UsuarioActual.CveEmpresa = 48 Then ' APH
|
|
CuentaCargoCOG = 1386
|
|
End If
|
|
Dim ConceptoRenglon As String = "Salida de Almacen"
|
|
|
|
If IDPoliza > 0 Then
|
|
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
|
Dim DtMovtos As DataTable = ObjInventario.DtResultados
|
|
Importe = DtMovtos.SUMD("Total", "Estatus = ''")
|
|
|
|
If Importe > 0 Then
|
|
If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then
|
|
If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, Fecha, "") Then
|
|
'actualizo el idcuenta del presupuesto
|
|
If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, Fecha, "") Then
|
|
ErrorAC = True
|
|
Mensaje = "No se pudo insertar movimiento en la poliza 2."
|
|
End If
|
|
Else
|
|
ErrorAC = True
|
|
Mensaje = "No se pudo insertar movimiento en la poliza 1."
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If IDPoliza > 0 Then
|
|
ObjInventario.UpdateMovimientoPoliza(IDPoliza, CveMovimiento, UsuarioActual.CveEmpresa)
|
|
End If
|
|
Else
|
|
ErrorAC = True
|
|
Mensaje = "No se pudo insertar la poliza"
|
|
End If
|
|
End If
|
|
|
|
|
|
If Not ErrorAC And Not ErrorMovInv Then
|
|
Dim Msg As New StringBuilder
|
|
FolioSalida = ObjInventario.Folio
|
|
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
|
|
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
|
|
|
If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza)
|
|
If IDPoliza > 0 Then Msg = Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza)
|
|
|
|
ObjInventario.Commit() ' aplica los movimientos insertados
|
|
If ObjContaAC IsNot Nothing Then ObjContaAC.Commit()
|
|
|
|
|
|
'Limpia Valores cuando inserta de campos especiales
|
|
|
|
Else
|
|
ObjInventario.RollBack()
|
|
CveMovimiento = 0
|
|
If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack()
|
|
End If
|
|
|
|
|
|
Else
|
|
ObjInventario.RollBack() 'deshace lo insertado
|
|
CveMovimiento = 0
|
|
If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack()
|
|
End If
|
|
|
|
|
|
Catch ex As Exception
|
|
Try 'por si ya le habian dado rollback o commit
|
|
ObjInventario.RollBack() 'deshace lo insertad
|
|
Catch exx As Exception
|
|
|
|
End Try
|
|
CveMovimiento = 0
|
|
If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack()
|
|
GuardaLog("Ocurrió un Error inesperado en el registro" & ex.ToString())
|
|
Mensaje = "Ocurrió un Error inesperado en el registro" & ex.ToString()
|
|
|
|
TieneError = True
|
|
End Try
|
|
Else
|
|
|
|
End If
|
|
|
|
ObjInventario.Dispose() 'elimino la instancia
|
|
If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose()
|
|
|
|
|
|
Else
|
|
TieneError = True
|
|
Mensaje = "Ocurrió un error al obtener el cuerpo de los parametros"
|
|
End If
|
|
|
|
If TieneError Or ErrorAC Or ErrorMovInv Then
|
|
context.Response.StatusCode = 200
|
|
RespuestaError.Message = Mensaje
|
|
retorno = JsonConvert.SerializeObject(RespuestaError).ToString
|
|
Else
|
|
context.Response.StatusCode = 200
|
|
Respuesta.Message = "La salida se registró correctamente"
|
|
Respuesta.Folio = FolioSalida.ToString
|
|
|
|
retorno = JsonConvert.SerializeObject(Respuesta).ToString
|
|
|
|
End If
|
|
|
|
context.Response.Write(retorno)
|
|
Return retorno
|
|
|
|
End Function
|
|
|
|
Private Class APHAppsResponse
|
|
Sub New()
|
|
IsSuccess = "true"
|
|
End Sub
|
|
Public Property IsSuccess As String
|
|
Public Property Message As String
|
|
Public Property Folio As String
|
|
End Class
|
|
|
|
Private Class APHAppResponseError
|
|
Sub New()
|
|
IsSuccess = "false"
|
|
End Sub
|
|
Public Property IsSuccess As String
|
|
Public Property Folio As String
|
|
Public Property Message As String
|
|
End Class
|
|
|
|
Private Class AuthMessage
|
|
Public Property IsSucces As Boolean
|
|
Public Property ErrorMessage As APHAppResponseError
|
|
Public Property StatusCode As Integer
|
|
End Class
|
|
|
|
ReadOnly Property GlobalDTPS(CveEmpresa As Integer, Optional CvePS As Integer = -1, Optional SATClavePS As String = "-1", Optional AplicaParaVenta As Integer = -1, Optional Estatus As Integer = -1, Optional Codigo As String = "-1") As DataTable
|
|
Get
|
|
Dim ObjPS As New ClsProductosServicios
|
|
|
|
If ObjPS.GetPS(CvePS, -1, CveEmpresa, Codigo:=Codigo, SATClavePS:=SATClavePS, pAplicaParaVenta:=AplicaParaVenta, pEstado:=Estatus) Then
|
|
GlobalDTPS = ObjPS.DtResultados
|
|
Else
|
|
GlobalDTPS = Nothing
|
|
End If
|
|
|
|
ObjPS.Dispose()
|
|
End Get
|
|
End Property
|
|
|
|
Public Property GlobalDTPSSimplificado(Optional CveClasificacion As Integer = -1, Optional Codigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable
|
|
Get
|
|
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(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjPS.DtResultados.AsEnumerable()
|
|
ObjPS.Dispose()
|
|
|
|
End If
|
|
|
|
|
|
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))
|
|
Codigo = Codigo.ToUpper()
|
|
If Codigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!Codigo).ToUpper() = Codigo))
|
|
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))
|
|
If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS))
|
|
|
|
Try
|
|
GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable
|
|
Catch ex As Exception
|
|
GlobalDTPSSimplificado = New DataTable
|
|
End Try
|
|
|
|
Else
|
|
GlobalDTPSSimplificado = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa)
|
|
HttpContext.Current.Application(AppNombre) = value
|
|
End Set
|
|
End Property
|
|
Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
|
Dim UsuarioActual As Usuario = Nothing
|
|
Dim NombreCadena As String = ClsPaginas.GlobalNombreCadenaConexion(CveEmpresa)
|
|
Dim ObjUsuarios As New ClsSisUsuarioAutenticacion(NombreCadena:=NombreCadena)
|
|
UsuarioActual = ObjUsuarios.GetUsuarioDetalle(100)
|
|
If UsuarioActual IsNot Nothing Then
|
|
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
|
'CreaObjetoEmpresa(UsuarioActual)
|
|
End If
|
|
ObjUsuarios.Dispose()
|
|
|
|
Return UsuarioActual
|
|
End Function
|
|
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
|
|
|
Dim ObjEmpresa As New ClsSisEmpresas()
|
|
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
|
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
|
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
|
|
|
Dim EmpresasFuncionalidades As New HybridDictionary
|
|
For Each Row As Data.DataRow In dttmp.Rows
|
|
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
|
|
Next
|
|
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
|
|
End If
|
|
|
|
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
|
End If
|
|
ObjEmpresa.Dispose()
|
|
End Sub
|
|
Property GlobalDTAlmacen(CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = -1, Optional CveEstatus As Integer = 1, Optional CveAlmacen As Integer = -1) As DataTable
|
|
Get
|
|
Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa)
|
|
Dim dttemp As DataTable = Nothing
|
|
'sino existe, recarga los datos
|
|
Dim ObjUsr As New ClsInventarios
|
|
If ObjUsr.GetAlmacenes(-1, -1, CveEmpresa, -1) Then dttemp = ObjUsr.DtResultados
|
|
ObjUsr.Dispose()
|
|
|
|
Dim Str As New StringBuilder
|
|
Str.Append("1=1 AND ")
|
|
If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa)
|
|
If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen)
|
|
If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus)
|
|
If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen)
|
|
|
|
Dim Dv As New DataView(DirectCast(dttemp, DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
|
|
GlobalDTAlmacen = Dv.ToTable
|
|
Dv.Dispose()
|
|
End Get
|
|
Set(value As DataTable)
|
|
Dim dttemp As DataTable
|
|
Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa)
|
|
dttemp = value
|
|
End Set
|
|
'Get
|
|
|
|
' Dim Str As New StringBuilder
|
|
' Str.Append("1=1 AND ")
|
|
' If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa)
|
|
' If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen)
|
|
' If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus)
|
|
' If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen)
|
|
|
|
' Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacen"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
|
|
' GlobalDTAlmacen = Dv.ToTable
|
|
' Dv.Dispose()
|
|
|
|
'End Get
|
|
'Set(value As DataTable)
|
|
' Application("GlobalDTAlmacen") = value
|
|
'End Set
|
|
End Property
|
|
End Class |