CveSubProyecto al loguear
This commit is contained in:
444
asmx/WSApp.asmx
444
asmx/WSApp.asmx
@@ -1,5 +1,5 @@
|
||||
<%@ WebService Language="VB" Class="WSApp" %>
|
||||
|
||||
<%@ WebService Language="VB" Class="WSApp" %>
|
||||
|
||||
Option Explicit On
|
||||
|
||||
Imports System.Data
|
||||
@@ -22,26 +22,26 @@ Imports Newtonsoft.Json.Linq
|
||||
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
||||
Public Class WSApp
|
||||
Inherits System.Web.Services.WebService
|
||||
Inherits System.Web.Services.WebService
|
||||
#Region "G L O B A L - D T"
|
||||
|
||||
|
||||
Public ReadOnly Property UrlSitio As String
|
||||
Get
|
||||
Return ConfigurationManager.AppSettings("UrlSitio").ToString
|
||||
End Get
|
||||
End Property
|
||||
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
|
||||
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
|
||||
|
||||
Property GlobalDTMonedas() As DataTable
|
||||
@@ -67,37 +67,37 @@ Public Class WSApp
|
||||
Set(value As DataTable)
|
||||
Application("GlobalDTVtaFormaPago") = value
|
||||
End Set
|
||||
End Property
|
||||
Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable
|
||||
Get
|
||||
Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa)
|
||||
'sino existe, recarga los datos
|
||||
If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then
|
||||
Dim P As New ClsSubProyectos
|
||||
If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = P.DtResultados
|
||||
P.Dispose()
|
||||
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(Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows)
|
||||
GlobalDTSubProyectos = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
|
||||
Else
|
||||
GlobalDTSubProyectos = DirectCast(Application(AppNombre), DataTable)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(ByVal value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa)
|
||||
Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable
|
||||
Get
|
||||
Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa)
|
||||
'sino existe, recarga los datos
|
||||
If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then
|
||||
Dim P As New ClsSubProyectos
|
||||
If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = P.DtResultados
|
||||
P.Dispose()
|
||||
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(Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows)
|
||||
GlobalDTSubProyectos = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
|
||||
Else
|
||||
GlobalDTSubProyectos = DirectCast(Application(AppNombre), DataTable)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(ByVal value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa)
|
||||
Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
Property GlobalDTSATUsosCFDI(Optional EsPersonaFisica As Integer = -1) As DataTable
|
||||
Get
|
||||
@@ -249,43 +249,43 @@ Public Class WSApp
|
||||
Application("GlobalTipoCambio") = value
|
||||
End Set
|
||||
|
||||
End Property
|
||||
|
||||
Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable
|
||||
Get
|
||||
|
||||
Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa)
|
||||
'sino existe, recarga los datos
|
||||
If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Then
|
||||
|
||||
Dim ObjOC As New ClsOC
|
||||
If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, CveEmpresa) Then
|
||||
HttpContext.Current.Application(AppNombre) = ObjOC.DtResultados
|
||||
Else
|
||||
HttpContext.Current.Application(AppNombre) = Nothing
|
||||
End If
|
||||
|
||||
ObjOC.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
Dim filtro As New StringBuilder
|
||||
filtro.AppendFormat("CveEmpresa = {0} ", CveEmpresa)
|
||||
If CveUsuario > 0 Then
|
||||
filtro.AppendFormat(" AND CveUsuario={0} ", CveUsuario)
|
||||
End If
|
||||
If Tipo <> "" Then
|
||||
filtro.AppendFormat(" AND Tipo='{0}'", Tipo)
|
||||
End If
|
||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows)
|
||||
GlobalDTOCEstatusUsuarios = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa)
|
||||
HttpContext.Current.Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable
|
||||
Get
|
||||
|
||||
Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa)
|
||||
'sino existe, recarga los datos
|
||||
If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Then
|
||||
|
||||
Dim ObjOC As New ClsOC
|
||||
If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, CveEmpresa) Then
|
||||
HttpContext.Current.Application(AppNombre) = ObjOC.DtResultados
|
||||
Else
|
||||
HttpContext.Current.Application(AppNombre) = Nothing
|
||||
End If
|
||||
|
||||
ObjOC.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
Dim filtro As New StringBuilder
|
||||
filtro.AppendFormat("CveEmpresa = {0} ", CveEmpresa)
|
||||
If CveUsuario > 0 Then
|
||||
filtro.AppendFormat(" AND CveUsuario={0} ", CveUsuario)
|
||||
End If
|
||||
If Tipo <> "" Then
|
||||
filtro.AppendFormat(" AND Tipo='{0}'", Tipo)
|
||||
End If
|
||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows)
|
||||
GlobalDTOCEstatusUsuarios = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa)
|
||||
HttpContext.Current.Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable
|
||||
@@ -327,42 +327,42 @@ Public Class WSApp
|
||||
Application("GlobalDTCompProveedores") = value
|
||||
End Set
|
||||
End Property
|
||||
Public 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, 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 Application(AppNombre) Is Nothing Then
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPSSimplificado(CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados.AsEnumerable()
|
||||
ObjPS.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim Cons = DirectCast(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))
|
||||
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))
|
||||
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(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa)
|
||||
Application(AppNombre) = value
|
||||
End Set
|
||||
Public 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, 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 Application(AppNombre) Is Nothing Then
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPSSimplificado(CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados.AsEnumerable()
|
||||
ObjPS.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim Cons = DirectCast(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))
|
||||
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))
|
||||
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(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa)
|
||||
Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable
|
||||
Get
|
||||
@@ -471,34 +471,34 @@ Public Class WSApp
|
||||
Set(value As DataTable)
|
||||
Application("GlobalDTMotivosHorasExtras") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Public 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(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then
|
||||
Dim ObjUnidadesMedida As New ClsUnidadesMedida()
|
||||
If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados
|
||||
ObjUnidadesMedida.Dispose()
|
||||
End If
|
||||
|
||||
If CveEmpresa <> -1 Then
|
||||
Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows)
|
||||
GlobalDTUnidadesMedida = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
Else
|
||||
GlobalDTUnidadesMedida = DirectCast(Application(AppNombre), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa)
|
||||
Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
End Property
|
||||
|
||||
|
||||
Public 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(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then
|
||||
Dim ObjUnidadesMedida As New ClsUnidadesMedida()
|
||||
If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados
|
||||
ObjUnidadesMedida.Dispose()
|
||||
End If
|
||||
|
||||
If CveEmpresa <> -1 Then
|
||||
Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows)
|
||||
GlobalDTUnidadesMedida = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
Else
|
||||
GlobalDTUnidadesMedida = DirectCast(Application(AppNombre), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa)
|
||||
Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
|
||||
Public Property CveEmpresa As Integer = 143
|
||||
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
@@ -519,7 +519,7 @@ Public Class WSApp
|
||||
Else
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
End Sub
|
||||
#Region "M E T O D O S - S E R V I C I O"
|
||||
Public Function ValidaUsuario(CveUsuario As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
@@ -535,6 +535,7 @@ Public Class WSApp
|
||||
ObjUsuarios.Dispose()
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
|
||||
<WebMethod()>
|
||||
Public Function Login(Usuario As String, Contrasenia As String) As String
|
||||
Dim retorno As String = ""
|
||||
@@ -562,15 +563,17 @@ Public Class WSApp
|
||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||
Salida.Cliente = ObjClientes.Nombre
|
||||
Salida.CvePrecioLista = ObjClientes.CvePrecioLista
|
||||
Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0)
|
||||
|
||||
Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0)
|
||||
If ObjClientes.CveSubProyecto > 0 Then
|
||||
Salida.CveSubProyecto = ObjClientes.CveSubProyecto
|
||||
End If
|
||||
retorno = JsonConvert.SerializeObject(Salida)
|
||||
End If
|
||||
Else
|
||||
End If
|
||||
Else
|
||||
retorno = "{}"
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
retorno = "{}"
|
||||
End If
|
||||
@@ -610,6 +613,9 @@ Public Class WSApp
|
||||
Salida.Cliente = ObjClientes.Nombre
|
||||
Salida.CvePrecioLista = ObjClientes.CvePrecioLista
|
||||
Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0)
|
||||
If ObjClientes.CveSubProyecto > 0 Then
|
||||
Salida.CveSubProyecto = ObjClientes.CveSubProyecto
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -725,40 +731,40 @@ Public Class WSApp
|
||||
End If
|
||||
If ListaPS IsNot Nothing Then
|
||||
Dim Continuar As Boolean = False
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
Try
|
||||
For Each PS In ListaPS
|
||||
Dim CveTipoPS As Integer = GlobalDTPSSimplificado(CveEmpresa, CvePS:=PS.CvePS).FiltroPrimeroValor("CveTipoPS").ToEntero()
|
||||
If CveTipoPS > 0 Then
|
||||
If CveTipoPS = 2 Then
|
||||
If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then
|
||||
If ObjPS.DtResultados.Rows.Count > 0 Then
|
||||
Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal()
|
||||
'Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero()
|
||||
|
||||
Continuar = Existencia > 0
|
||||
|
||||
If Not Continuar Then
|
||||
Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.")
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Continuar = False
|
||||
Retorno.Mensajes.Add("No se pudo comprobar la existencia.")
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
ElseIf CveTipoPS = 1 Then
|
||||
Continuar = True
|
||||
End If
|
||||
Else
|
||||
Continuar = False
|
||||
Retorno.Mensajes.Add("No se pudo comprobar si es producto o servicio.")
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al consultar la existencia", ex)
|
||||
Continuar = False
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
Try
|
||||
For Each PS In ListaPS
|
||||
Dim CveTipoPS As Integer = GlobalDTPSSimplificado(CveEmpresa, CvePS:=PS.CvePS).FiltroPrimeroValor("CveTipoPS").ToEntero()
|
||||
If CveTipoPS > 0 Then
|
||||
If CveTipoPS = 2 Then
|
||||
If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then
|
||||
If ObjPS.DtResultados.Rows.Count > 0 Then
|
||||
Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal()
|
||||
'Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero()
|
||||
|
||||
Continuar = Existencia > 0
|
||||
|
||||
If Not Continuar Then
|
||||
Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.")
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Continuar = False
|
||||
Retorno.Mensajes.Add("No se pudo comprobar la existencia.")
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
ElseIf CveTipoPS = 1 Then
|
||||
Continuar = True
|
||||
End If
|
||||
Else
|
||||
Continuar = False
|
||||
Retorno.Mensajes.Add("No se pudo comprobar si es producto o servicio.")
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al consultar la existencia", ex)
|
||||
Continuar = False
|
||||
End Try
|
||||
ObjPS.Dispose()
|
||||
|
||||
@@ -774,15 +780,15 @@ Public Class WSApp
|
||||
Dim Correo As String = If(CveSubProyecto.Contiene(11714, 11761), "mezclas.pescadito@gmail.com", "pedidosaguas@gmail.com")
|
||||
'Dim Correo As String = "japmx95@gmail.com"
|
||||
Dim SerieFolio As String = Factura.SerieFolio
|
||||
Dim DireccionEnvio As String = ""
|
||||
Using ObjClientes As New ClsClientes
|
||||
If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then
|
||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||
DireccionEnvio = ObjClientes.DtResultados.FiltroPrimeroValor("DireccionEnvioContacto")
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
Factura.Dispose()
|
||||
Dim DireccionEnvio As String = ""
|
||||
Using ObjClientes As New ClsClientes
|
||||
If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then
|
||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||
DireccionEnvio = ObjClientes.DtResultados.FiltroPrimeroValor("DireccionEnvioContacto")
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
Factura.Dispose()
|
||||
EnviarCorreo(Correo, Factura, Retorno, DireccionEnvio, UsuarioActual)
|
||||
Else
|
||||
Factura.Dispose()
|
||||
@@ -801,7 +807,7 @@ Public Class WSApp
|
||||
End Try
|
||||
|
||||
Return JsonConvert.SerializeObject(Retorno)
|
||||
End Function
|
||||
End Function
|
||||
Private Sub EnviarCorreo(Correo As String, Factura As Modelos.Factura, Retorno As Modelos.Factura.MMensajeFactura, DireccionEnvio As String, UsuarioActual As Usuario)
|
||||
Try
|
||||
Dim Hilo As New System.Threading.Thread(Sub() EnviarCorreoFactura(Correo, Factura, Retorno, DireccionEnvio, UsuarioActual))
|
||||
@@ -809,17 +815,17 @@ Public Class WSApp
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar el correo de facturación", ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub EnviarCorreoFactura(Correo As String, Factura As Modelos.Factura, Retorno As Modelos.Factura.MMensajeFactura, DireccionEnvio As String, UsuarioActual As Usuario)
|
||||
Dim Body = GeneraCorreoRemision(Retorno.CveVenta, Retorno.SerieFolio, Factura.Cliente.Nombre, Factura.Cliente.NombreComercial, DireccionEnvio, Factura.Observaciones, DateTime.Now)
|
||||
Factura.Dispose()
|
||||
Try
|
||||
Dim Asunto As String = String.Format("SIG - Se ha realizado un pedido: {0}", Retorno.SerieFolio)
|
||||
Dim Mail As New ClsSisMail()
|
||||
Mail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Body)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar MAIL por cambio de Estatus", ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub EnviarCorreoFactura(Correo As String, Factura As Modelos.Factura, Retorno As Modelos.Factura.MMensajeFactura, DireccionEnvio As String, UsuarioActual As Usuario)
|
||||
Dim Body = GeneraCorreoRemision(Retorno.CveVenta, Retorno.SerieFolio, Factura.Cliente.Nombre, Factura.Cliente.NombreComercial, DireccionEnvio, Factura.Observaciones, DateTime.Now)
|
||||
Factura.Dispose()
|
||||
Try
|
||||
Dim Asunto As String = String.Format("SIG - Se ha realizado un pedido: {0}", Retorno.SerieFolio)
|
||||
Dim Mail As New ClsSisMail()
|
||||
Mail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Body)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar MAIL por cambio de Estatus", ex)
|
||||
End Try
|
||||
End Sub
|
||||
<WebMethod()>
|
||||
Public Function CancelarDocumento(CveVenta As Integer, CveUsuario As Integer) As String
|
||||
@@ -885,9 +891,9 @@ Public Class WSApp
|
||||
Retorno.Mensajes.Add("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.")
|
||||
End If
|
||||
ObjInv.Dispose()
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "P E D I D O S"
|
||||
Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre
|
||||
Dim Timbre As New CFDITimbre
|
||||
@@ -1001,9 +1007,9 @@ Public Class WSApp
|
||||
i += 1
|
||||
Next
|
||||
Return Timbre
|
||||
End Function
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "R E M I S I O N E S"
|
||||
Private Function CreaFactura(ByRef Retorno As Modelos.Factura.MMensajeFactura, CveCliente As Integer, CveAlmacen As Integer, CveSubProyecto As Integer, CveMoneda As Integer, UsuarioActual As Usuario, Observaciones As String, ListaPS As List(Of MVentaProductos)) As Modelos.Factura
|
||||
If CveSubProyecto <= 0 Then
|
||||
@@ -1411,8 +1417,8 @@ Public Class WSApp
|
||||
|
||||
Row("Total") = (PS.Cantidad.Value * PS.Precio)
|
||||
Row("TotalImporte") = Math.Round(PS.Cantidad.Value * PS.Precio, 2)
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
Row("EntregaDirecta") = EntregaDirecta
|
||||
@@ -1530,10 +1536,10 @@ Public Class WSApp
|
||||
End Try
|
||||
ObjVentas.Dispose()
|
||||
Return strBody.ToString
|
||||
End Function
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Namespace WebServiceAppModels2
|
||||
|
||||
Reference in New Issue
Block a user