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