2146 lines
99 KiB
Plaintext
2146 lines
99 KiB
Plaintext
<%@ WebService Language="VB" Class="WSApp" %>
|
|
|
|
Option Explicit On
|
|
|
|
Imports System.Data
|
|
Imports System.Web
|
|
Imports System.Web.Services
|
|
Imports System.Web.Services.Protocols
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Extensiones
|
|
Imports Newtonsoft.Json
|
|
Imports WebServiceAppModels2
|
|
Imports Modelos
|
|
Imports System.IO
|
|
Imports System
|
|
Imports System.Globalization
|
|
Imports Newtonsoft.Json.Linq
|
|
|
|
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
|
|
' <System.Web.Script.Services.ScriptService()> _
|
|
<WebService(Namespace:="http://ADSistemas.org/")>
|
|
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
|
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
|
Public Class WSApp
|
|
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
|
|
End Property
|
|
Property GlobalDTMonedas() As DataTable
|
|
Get
|
|
GlobalDTMonedas = DirectCast(Application("GlobalDTMonedas"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTMonedas") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTVtaMetodoPago() As DataTable
|
|
Get
|
|
GlobalDTVtaMetodoPago = DirectCast(Application("GlobalDTVtaMetodoPago"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTVtaMetodoPago") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTVtaFormaPago() As DataTable
|
|
Get
|
|
GlobalDTVtaFormaPago = DirectCast(Application("GlobalDTVtaFormaPago"), DataTable)
|
|
End Get
|
|
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
|
|
Property GlobalDTSATUsosCFDI(Optional EsPersonaFisica As Integer = -1) As DataTable
|
|
Get
|
|
If EsPersonaFisica <> -1 Then
|
|
Dim Tipo As String = ""
|
|
If EsPersonaFisica = 1 Then Tipo = "AplicaPersonaFisica = 1" Else Tipo = "AplicaPersonaMoral = 1"
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTSATUsosCFDI"), DataTable), Tipo, " UsoCFDIDescripcion", DataViewRowState.CurrentRows)
|
|
GlobalDTSATUsosCFDI = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTSATUsosCFDI = DirectCast(Application("GlobalDTSATUsosCFDI"), DataTable)
|
|
End If
|
|
|
|
End Get
|
|
Set(ByVal value As DataTable)
|
|
Application("GlobalDTSATUsosCFDI") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTUsuarios(Optional CveUsuario As Integer = -1, Optional CveEmpresa As Integer = -1, Optional CveCliente As Integer = -1, Optional CveProveedor As Integer = -1) As DataTable
|
|
Get
|
|
Dim Str As New StringBuilder
|
|
If CveUsuario <> -1 Then Str.AppendFormat("CveUsuario = {0}", CveUsuario)
|
|
If CveEmpresa <> -1 Then Str.AppendFormat(" {0} CveEmpresa = {1}", If(Str.Length > 0, "AND", ""), CveEmpresa)
|
|
If CveCliente <> -1 Then Str.AppendFormat(" {0} CveCliente = {1}", If(Str.Length > 0, "AND", ""), CveCliente)
|
|
If CveProveedor <> -1 Then Str.AppendFormat(" {0} CveProveedor = {1}", If(Str.Length > 0, "AND", ""), CveProveedor)
|
|
|
|
If CveUsuario <> -1 OrElse CveEmpresa <> -1 Then
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTUsuarios"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
|
|
GlobalDTUsuarios = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTUsuarios = DirectCast(Application("GlobalDTUsuarios"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTUsuarios") = value
|
|
End Set
|
|
End Property
|
|
'Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable
|
|
' Get
|
|
' If CveEmpresa <> -1 Then
|
|
' Dim Dv As New DataView(DirectCast(Application("GlobalDTUnidadesMedida"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows)
|
|
' GlobalDTUnidadesMedida = Dv.ToTable
|
|
' Dv.Dispose()
|
|
' Else
|
|
' GlobalDTUnidadesMedida = DirectCast(Application("GlobalDTUnidadesMedida"), DataTable)
|
|
' End If
|
|
' End Get
|
|
' Set(value As DataTable)
|
|
' Application("GlobalDTUnidadesMedida") = value
|
|
' End Set
|
|
'End Property
|
|
Property GlobalDTGralCategorias(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTGralCategorias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTGralCategorias = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTGralCategorias = DirectCast(Application("GlobalDTGralCategorias"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTGralCategorias") = value
|
|
End Set
|
|
End Property
|
|
Private ReadOnly Property GlobalDTProyectos(CveEmpresa As Integer, Optional Estatus As Integer = -1) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 OrElse Estatus <> -1 Then 'OrElse CveProyecto <> -1
|
|
|
|
Dim StrSQL As New StringBuilder
|
|
If CveEmpresa <> -1 Then StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa)
|
|
' If CveProyecto <> -1 Then StrSQL.AppendFormat(" {0} CveProyecto = {1}", If(StrSQL.Length > 0, "AND", ""), CveProyecto)
|
|
If Estatus <> -1 Then StrSQL.AppendFormat(" {0} CveEstatus = {1}", If(StrSQL.Length > 0, "AND", ""), Estatus)
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTProyectos"), DataTable), StrSQL.ToString, "", DataViewRowState.CurrentRows)
|
|
GlobalDTProyectos = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTProyectos = DirectCast(Application("GlobalDTProyectos"), DataTable)
|
|
End If
|
|
|
|
End Get
|
|
End Property
|
|
Property GlobalDTVendedores(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTVendedores"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTVendedores = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTVendedores = DirectCast(Application("GlobalDTVendedores"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTVendedores") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTCliente(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTCliente"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTCliente = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTCliente = DirectCast(Application("GlobalDTCliente"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTCliente") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTOCEstatus(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTOCEstatus"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTOCEstatus = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTOCEstatus = DirectCast(Application("GlobalDTOCEstatus"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTOCEstatus") = value
|
|
End Set
|
|
End Property
|
|
Public Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double
|
|
Get
|
|
If GlobalTipoCambio <= 0 Then
|
|
'sino tiene dato lo recargo por si ya esta insertado
|
|
If Fecha = MinFecha Then Fecha = Now
|
|
|
|
Dim ObjGral As New ClsGenerales
|
|
If ObjGral.GetTipoCambio(-1, Fecha) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
|
|
|
Application("GlobalTipoCambio") = ObjGral.DtResultados.Rows(0)("TipoCambio").ToString.ToDouble
|
|
Else
|
|
Application("GlobalTipoCambio") = 0
|
|
End If
|
|
ObjGral.Dispose()
|
|
|
|
End If
|
|
|
|
Return Application("GlobalTipoCambio").ToString.ToDouble
|
|
End Get
|
|
Set(value As Double)
|
|
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
|
|
' If CveEmpresa <> -1 Then
|
|
' 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(Application("GlobalDTOCEstatusUsuarios"), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows)
|
|
' GlobalDTOCEstatusUsuarios = Dv.ToTable
|
|
' Dv.Dispose()
|
|
' Else
|
|
' GlobalDTOCEstatusUsuarios = DirectCast(Application("GlobalDTOCEstatusUsuarios"), DataTable)
|
|
' End If
|
|
' End Get
|
|
' Set(value As DataTable)
|
|
' Application("GlobalDTOCEstatusUsuarios") = value
|
|
' End Set
|
|
'End Property
|
|
|
|
|
|
Property GlobalDTCompProveedores(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTCompProveedores"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTCompProveedores = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTCompProveedores = DirectCast(Application("GlobalDTCompProveedores"), DataTable)
|
|
End If
|
|
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTCompProveedores") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTProductosServicios(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional CveClasificacionCosto As Integer = -1, Optional Estatus As Integer = 1, Optional CvePS As Integer = -1, Optional AplicaParaVenta As Integer = -1, Optional CveTipoPS As Integer = -1) As DataTable
|
|
Get
|
|
If CveEmpresa = -1 Then
|
|
GlobalDTProductosServicios = DirectCast(Application("GlobalDTProductosServicios"), EnumerableRowCollection(Of DataRow)).CopyToDataTable
|
|
Else
|
|
|
|
Dim Cons = DirectCast(Application("GlobalDTProductosServicios"), 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 CveClasificacionCosto >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacionCosto) = CveClasificacionCosto))
|
|
If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus))
|
|
If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS))
|
|
If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta))
|
|
If CveTipoPS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveTipoPS) = CveTipoPS))
|
|
|
|
'Try, generado para cuando el resultado no tiene valores(The source contains no DataRows.), no detenga la ejecucion, no se le puso un count previo, porque el costo se duplica, al preguntar y luego ordenar y convertir a datatable
|
|
Try
|
|
GlobalDTProductosServicios = Cons.OrderBy(Function(a) a!PS).CopyToDataTable
|
|
Catch ex As Exception
|
|
GlobalDTProductosServicios = New DataTable
|
|
End Try
|
|
End If
|
|
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTProductosServicios") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
Dim Str As New StringBuilder
|
|
Str.AppendFormat("CveEmpresa = {0}", CveEmpresa)
|
|
If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria)
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTClasificaciones"), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows)
|
|
GlobalDTClasificaciones = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTClasificaciones = DirectCast(Application("GlobalDTClasificaciones"), DataTable)
|
|
End If
|
|
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTClasificaciones") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Property GlobalDTTurno(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTTurno"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTTurno = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTTurno = DirectCast(Application("GlobalDTTurno"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTTurno") = value
|
|
End Set
|
|
End Property
|
|
|
|
Property GlobalDTDepartamentos(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTDepartamentos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTDepartamentos = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTDepartamentos = DirectCast(Application("GlobalDTDepartamentos"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTDepartamentos") = value
|
|
End Set
|
|
End Property
|
|
|
|
Property GlobalDTRHPuestos(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTRHPuestos"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTRHPuestos = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTRHPuestos = DirectCast(Application("GlobalDTRHPuestos"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTRHPuestos") = value
|
|
End Set
|
|
End Property
|
|
Property GlobalDTMetodosPago() As DataTable
|
|
Get
|
|
GlobalDTMetodosPago = DirectCast(Application("GlobalDTMetodosPago"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTMetodosPago") = value
|
|
End Set
|
|
End Property
|
|
|
|
Property GlobalDTAsistenciasInasistencias(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTAsistenciasInasistencias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTAsistenciasInasistencias = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTAsistenciasInasistencias = DirectCast(Application("GlobalDTAsistenciasInasistencias"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
Application("GlobalDTAsistenciasInasistencias") = value
|
|
End Set
|
|
End Property
|
|
|
|
Property GlobalDTMotivosHorasExtras(CveEmpresa As Integer) As DataTable
|
|
Get
|
|
If CveEmpresa <> -1 Then
|
|
|
|
Dim Dv As New DataView(DirectCast(Application("GlobalDTMotivosHorasExtras"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows)
|
|
GlobalDTMotivosHorasExtras = Dv.ToTable
|
|
Dv.Dispose()
|
|
Else
|
|
GlobalDTMotivosHorasExtras = DirectCast(Application("GlobalDTMotivosHorasExtras"), DataTable)
|
|
End If
|
|
End Get
|
|
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 Region
|
|
|
|
Public Property CveEmpresa As Integer = 143
|
|
|
|
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
|
|
Else
|
|
End If
|
|
ObjEmpresa.Dispose()
|
|
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
|
|
Dim ObjUsuarios As New ClsSisUsuarios
|
|
If ObjUsuarios.GetUsuarios(CveUsuario) Then
|
|
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
|
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
|
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
|
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI)
|
|
CreaObjetoEmpresa(UsuarioActual)
|
|
End If
|
|
End If
|
|
ObjUsuarios.Dispose()
|
|
Return UsuarioActual
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function Login(Usuario As String, Contrasenia As String) As String
|
|
Dim retorno As String = ""
|
|
|
|
Dim Salida As WSUSER = Nothing
|
|
Dim ObjUsuarios As New ClsSisUsuarios
|
|
Dim ObjClientes As New ClsClientes
|
|
Try
|
|
Dim UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Encripta(Contrasenia), IMEI)
|
|
|
|
If UsuarioActual IsNot Nothing Then
|
|
Salida = New WSUSER
|
|
Salida.CveUsuario = UsuarioActual.CveUsuario
|
|
Salida.CveEmpresa = UsuarioActual.CveEmpresa
|
|
Salida.Empresa = GlobalDTUsuarios(UsuarioActual.CveUsuario).FiltroPrimeroValor("Empresa")
|
|
Salida.CveCliente = UsuarioActual.CveCliente
|
|
Salida.Usuario = UsuarioActual.Usuario
|
|
Salida.Nombre = UsuarioActual.Nombre
|
|
Salida.CveRol = UsuarioActual.CveRol
|
|
Salida.Rol = UsuarioActual.Rol
|
|
Salida.CveSubProyecto = UsuarioActual.CveSubProyecto
|
|
Salida.Procesos = UsuarioActual.Procesos.Values.Cast(Of String).ToList()
|
|
|
|
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
|
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
|
Salida.Cliente = ObjClientes.Nombre
|
|
Salida.CvePrecioLista = ObjClientes.CvePrecioLista
|
|
Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0)
|
|
End If
|
|
End If
|
|
|
|
retorno = JsonConvert.SerializeObject(Salida)
|
|
Else
|
|
retorno = "{}"
|
|
End If
|
|
Catch ex As Exception
|
|
retorno = "{}"
|
|
OnError("Ocurrió un Error al iniciar sesión.", ex)
|
|
Finally
|
|
ObjUsuarios.Dispose()
|
|
ObjClientes.Dispose()
|
|
End Try
|
|
Return retorno
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function LoginData(CveUsuario As Integer) As String
|
|
Dim retorno As String = ""
|
|
|
|
Dim Salida As WSUSER = Nothing
|
|
Dim ObjClientes As New ClsClientes
|
|
Try
|
|
Dim UsuarioActual As Usuario = ValidaUsuario(CveUsuario)
|
|
|
|
If UsuarioActual IsNot Nothing AndAlso UsuarioActual.CvePlataforma = 6 Then
|
|
Salida = New WSUSER
|
|
Salida.CveUsuario = UsuarioActual.CveUsuario
|
|
Salida.CveEmpresa = UsuarioActual.CveEmpresa
|
|
Salida.Empresa = GlobalDTUsuarios(UsuarioActual.CveUsuario).FiltroPrimeroValor("Empresa")
|
|
Salida.CveCliente = UsuarioActual.CveCliente
|
|
Salida.Usuario = UsuarioActual.Usuario
|
|
Salida.Nombre = UsuarioActual.Nombre
|
|
Salida.CveRol = UsuarioActual.CveRol
|
|
Salida.Rol = UsuarioActual.Rol
|
|
Salida.CveSubProyecto = UsuarioActual.CveSubProyecto
|
|
Salida.Procesos = UsuarioActual.Procesos.Values.Cast(Of String).ToList()
|
|
|
|
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
|
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
|
Salida.Cliente = ObjClientes.Nombre
|
|
Salida.CvePrecioLista = ObjClientes.CvePrecioLista
|
|
Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0)
|
|
End If
|
|
End If
|
|
|
|
retorno = JsonConvert.SerializeObject(Salida)
|
|
Else
|
|
retorno = "{}"
|
|
End If
|
|
Catch ex As Exception
|
|
retorno = "{}"
|
|
OnError("Ocurrió un Error al iniciar sesión.", ex)
|
|
Finally
|
|
ObjClientes.Dispose()
|
|
End Try
|
|
Return retorno
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function GetPedido(CveVenta As Integer) As String
|
|
Dim retorno As New JObject
|
|
Dim TieneError = False
|
|
Using ObjVentas As New ClsVentas
|
|
If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then
|
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
|
retorno.Add(New JProperty("Pedido", JArray.Parse(ObjVentas.DtResultados.ToJson())(0)))
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
If Not TieneError Then
|
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
|
retorno.Add(New JProperty("Productos", JArray.Parse(ObjVentas.DtResultados.ToJson())))
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
End If
|
|
|
|
End Using
|
|
Return If(TieneError, "{}", retorno.ToString())
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function GetListaPedidos(CveCliente As Integer, CveUsuario As Integer) As String
|
|
Dim retorno = "[]"
|
|
|
|
Dim Serie As String = "-1"
|
|
Dim Folio As Integer = -1
|
|
Dim Codigo As String = "-1"
|
|
Dim Cliente As String = "-1"
|
|
Dim FechaI As String = "-1"
|
|
Dim FechaF As String = "-1"
|
|
Dim FolioFiscal As String = "-1"
|
|
Dim PeidoContrato As String = "-1"
|
|
Dim OrdenCompra As String = "-1"
|
|
|
|
Using ObjVentas As New ClsVentas
|
|
If ObjVentas.GetVentas(CveEmpresa, "Rem", Serie, Folio, Codigo, CveCliente, -1, -1, -1, FechaI, FechaF, FolioFiscal, -1, -1, PedidoContrato:=PeidoContrato, OrdenCompra:=OrdenCompra, CveUsuarioConsulta:=100) Then
|
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
|
retorno = ObjVentas.DtResultados.FiltraParametros("", "Fecha DESC").ToJson()
|
|
End If
|
|
End If
|
|
End Using
|
|
|
|
Return retorno
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function GetProductos(CvePrecioLista As Integer, CveClasificacion As Integer) As String
|
|
Dim retorno As String = "[]"
|
|
Dim CvePS = -1
|
|
Dim ObjPS As New ClsProductosServicios
|
|
If ObjPS.GetPSExistenciasWS(CvePS, CvePrecioLista, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then
|
|
If CveClasificacion > 0 Then
|
|
retorno = ObjPS.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion}").ToJson()
|
|
Else
|
|
retorno = ObjPS.DtResultados.ToJson()
|
|
End If
|
|
End If
|
|
ObjPS.Dispose()
|
|
Return retorno
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function GetClasificaciones() As String
|
|
Return GlobalDTClasificaciones(CveEmpresa).ToJson()
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function GetPrecioLista() As String
|
|
Dim retorno As String = "[]"
|
|
Dim objInv As New ClsVentas
|
|
If objInv.GetPrecioListas(CveEmpresa) Then
|
|
retorno = objInv.DtResultados.ToJson()
|
|
End If
|
|
objInv.Dispose()
|
|
Return retorno
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function GetUnidadesMedida() As String
|
|
Return GlobalDTUnidadesMedida(CveEmpresa).ToJson()
|
|
End Function
|
|
|
|
<WebMethod()>
|
|
Public Function AddPedido(CveCliente As Integer, CveSubProyecto As Integer, CveUsuario As Integer, Observaciones As String, Productos As String) As String
|
|
Dim Retorno = New Modelos.Factura.MMensajeFactura()
|
|
Try
|
|
Dim UsuarioActual As Usuario = ValidaUsuario(CveUsuario)
|
|
|
|
If UsuarioActual IsNot Nothing Then
|
|
Dim ListaPS As List(Of MVentaProductos) = Nothing
|
|
If Not String.IsNullOrEmpty(Productos) Then
|
|
ListaPS = JsonConvert.DeserializeObject(Of List(Of MVentaProductos))(Productos)
|
|
End If
|
|
If ListaPS IsNot Nothing Then
|
|
Dim Continuar As Boolean = False
|
|
Dim ObjPS As New ClsProductosServicios
|
|
For Each PS In ListaPS
|
|
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 = (CveTipoPS = 2 AndAlso Existencia > 0) OrElse (CveTipoPS = 1)
|
|
|
|
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
|
|
Next
|
|
ObjPS.Dispose()
|
|
|
|
If Continuar Then
|
|
|
|
Dim Factura As Modelos.Factura = CreaFactura(Retorno, CveCliente, -1, CveSubProyecto, 1, UsuarioActual, Observaciones, ListaPS)
|
|
If Factura IsNot Nothing AndAlso Retorno.Mensajes.Count = 0 Then
|
|
Retorno = Factura.EmitirFactura()
|
|
Else
|
|
Retorno.Mensajes.Add("No se pudo generar la factura")
|
|
End If
|
|
If Retorno.CveVenta > 0 AndAlso CveSubProyecto.Contiene(11714, 11761, 11713) Then
|
|
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 = ""
|
|
Dim 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
|
|
ObjClientes.Dispose()
|
|
Dim Body = GeneraCorreoRemision(Retorno.CveVenta, SerieFolio, Factura.Cliente.Nombre, Factura.Cliente.NombreComercial, DireccionEnvio, Observaciones, DateTime.Now)
|
|
Factura.Dispose()
|
|
Try
|
|
Dim Asunto As String = String.Format("SIG - Se ha realizado un pedido: {0}", SerieFolio)
|
|
Dim Mail As New ClsSisMail()
|
|
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Correo, Asunto, Body)
|
|
Catch ex As Exception
|
|
OnError("Ocurrió error al mandar MAIL por cambio de Estatus", ex)
|
|
End Try
|
|
Else
|
|
Factura.Dispose()
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
Retorno.Mensajes.Add("No se pudo procesar los productos")
|
|
End If
|
|
Else
|
|
Retorno.Mensajes.Add("No se pudo comprobar el usuario")
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Retorno.Mensajes.Add(ex.ToString())
|
|
End Try
|
|
|
|
Return JsonConvert.SerializeObject(Retorno)
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function CancelarDocumento(CveVenta As Integer, CveUsuario As Integer) As String
|
|
Dim Retorno = New Modelos.Factura.MMensajeFactura()
|
|
Try
|
|
Dim ObjUsuarios As New ClsSisUsuarios()
|
|
Dim UsuarioActual As Usuario = ValidaUsuario(CveUsuario)
|
|
|
|
If UsuarioActual IsNot Nothing Then
|
|
'If UsuarioActual.TienePermisoProceso(159) Then
|
|
' Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, CveEmpresa, ModExtensiones.DirectorioBaseEmpresas)
|
|
' Retorno = Factura.CancelarDocumento()
|
|
'Else
|
|
' Retorno.Mensajes.Add("Este usuario no tiene permiso para cancelar documento")
|
|
'End If
|
|
Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, CveEmpresa, ModExtensiones.DirectorioBaseEmpresas)
|
|
If String.IsNullOrEmpty(Factura.FolioFiscal) Then
|
|
Factura.FolioFiscal = ""
|
|
End If
|
|
Retorno = Factura.CancelarDocumento()
|
|
If Not Retorno.TieneError Then
|
|
Dim DtInv As DataTable = Nothing
|
|
Dim ObjInv As New ClsInventarios()
|
|
ObjInv.GetMovimientos(-1, -1, "-1", UsuarioActual.CveEmpresa)
|
|
If ObjInv.DtResultados.Rows.Count > 0 Then
|
|
DtInv = ObjInv.DtResultados.FiltraParametros($"CveVenta = {CveVenta}")
|
|
ObjInv.Dispose()
|
|
If DtInv IsNot Nothing Then
|
|
For Each Dr As DataRow In DtInv.Rows
|
|
Dim CveMovimiento As Integer = Dr("CveMovimiento").ToString().ToEntero()
|
|
If CveMovimiento > 0 Then
|
|
EliminarMovimiento(Retorno, UsuarioActual, CveMovimiento)
|
|
End If
|
|
Next
|
|
Else
|
|
Retorno.Mensajes.Add("No se encontraron movimientos de almacen")
|
|
End If
|
|
Else
|
|
Retorno.Mensajes.Add("No se encontraron movimientos de almacen")
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Retorno.Mensajes.Add(ex.ToString())
|
|
End Try
|
|
|
|
Return JsonConvert.SerializeObject(Retorno)
|
|
End Function
|
|
Protected Sub EliminarMovimiento(ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, CveMovimiento As Integer)
|
|
Dim ObjInv As New ClsInventarios
|
|
ObjInv.IniciaTransacSQL()
|
|
Dim TieneError = False
|
|
|
|
If Not ObjInv.MovimientoRemove(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
|
TieneError = True
|
|
End If
|
|
|
|
If Not TieneError Then
|
|
ObjInv.Commit()
|
|
Else
|
|
Retorno.Mensajes.Add("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.")
|
|
End If
|
|
ObjInv.Dispose()
|
|
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
|
|
Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
|
|
Timbre.Comprobante.Folio = Obj.Folio.ToString
|
|
Timbre.Comprobante.Serie = Obj.Serie
|
|
Timbre.Comprobante.Fecha = Obj.FechaCP
|
|
Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
|
|
Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
|
|
Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
|
|
Timbre.Comprobante.Subtotal = Obj.SubTotal
|
|
Timbre.Comprobante.Descuentos = Obj.Descuento
|
|
Timbre.Comprobante.Moneda = Obj.MonedaSAT
|
|
Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
|
|
Timbre.Comprobante.Total = Obj.Total
|
|
|
|
Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP
|
|
Timbre.Comprobante.Confirmacion = ""
|
|
|
|
Timbre.Receptor.RFC = Obj.Cliente.RFC
|
|
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
|
|
Timbre.Receptor.ResidenciaFiscal = ""
|
|
Timbre.Receptor.NumeroRegistroTributario = ""
|
|
Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI
|
|
|
|
|
|
If Obj.CveTipoRelacion > 0 Then
|
|
Select Case Obj.CveTipoRelacion
|
|
Case 1
|
|
Timbre.CFDIRelacionados.TipoRelacion = "01"
|
|
Timbre.CFDIRelacionados.TipoRelacionTexto = "01-Nota de Crédito aplicada a Ingreso"
|
|
Case 2
|
|
Timbre.CFDIRelacionados.TipoRelacion = "02"
|
|
Timbre.CFDIRelacionados.TipoRelacionTexto = "02-Nota de débito de los documentos relacionados"
|
|
Case 3
|
|
Timbre.CFDIRelacionados.TipoRelacion = "03"
|
|
Timbre.CFDIRelacionados.TipoRelacionTexto = "03-Devolución aplicada a Ingreso"
|
|
Case 4
|
|
Timbre.CFDIRelacionados.TipoRelacion = "04"
|
|
Timbre.CFDIRelacionados.TipoRelacionTexto = "04-Refacturación de Ingreso"
|
|
Case 7
|
|
Timbre.CFDIRelacionados.TipoRelacion = "07"
|
|
Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
|
|
Case 8
|
|
Timbre.CFDIRelacionados.TipoRelacion = "08"
|
|
Timbre.CFDIRelacionados.TipoRelacionTexto = "08-Factura generada por pagos en parcialidades "
|
|
Case 9
|
|
Timbre.CFDIRelacionados.TipoRelacion = "09"
|
|
Timbre.CFDIRelacionados.TipoRelacionTexto = "09-Factura generada por pagos diferidos"
|
|
|
|
End Select
|
|
|
|
End If
|
|
|
|
|
|
Dim totSubTotal As Decimal = Obj.SubTotal
|
|
Dim totIVA As Decimal = Obj.IVA
|
|
Dim totRetIVA As Decimal = Obj.RetIVA
|
|
Dim totRetISR As Decimal = Obj.RetISR
|
|
Dim i As Integer = 1
|
|
|
|
'DETALLES
|
|
Dim tPS As String = ""
|
|
|
|
For Each drr As DataRow In Obj.DtDetalle.Rows
|
|
If drr("PS").ToString.Length = 1 Then
|
|
tPS = drr("Obs").ToString
|
|
Else
|
|
If drr("PS").ToString.Length = 0 Then
|
|
tPS = ""
|
|
Else
|
|
tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
|
|
End If
|
|
End If
|
|
|
|
'CONDICIONANTE, ESPECIAL
|
|
If Obj.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO
|
|
|
|
Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal,
|
|
.Descripcion = tPS,
|
|
.ValorUnitario = drr("PU").ToString.ToDecimal,
|
|
.Importe = drr("TotalImporte").ToString.ToDecimal,
|
|
.Descuento = drr("Descuento").ToString.ToDecimal,
|
|
.Unidad = drr("UM").ToString,
|
|
.ClaveUnidad = drr("SATClaveUM").ToString,
|
|
.ClaveProdServ = drr("SATClaveProdServ").ToString,
|
|
.Noidentificacion = drr("Noidentificacion").ToString,
|
|
.CuentaPredial = drr("CuentaPredial").ToString}
|
|
'VERIFICA SUMA SUBTOTALES
|
|
If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES
|
|
concepto.Importe = totSubTotal
|
|
End If
|
|
totSubTotal = totSubTotal - concepto.Importe
|
|
|
|
'SIEMPRE ESTAMOS AGREGANDO EL IVA
|
|
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal})
|
|
|
|
If drr("ImporteIEPS").ToString.ToDouble > 0 Then
|
|
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal})
|
|
End If
|
|
|
|
If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones
|
|
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal})
|
|
End If
|
|
|
|
If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR
|
|
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetISR").ToString.ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal})
|
|
End If
|
|
|
|
Timbre.Conceptos.Add(concepto)
|
|
i += 1
|
|
Next
|
|
Return Timbre
|
|
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
|
|
'SE ASIGNA EL SUBPROYECTO MATRIZ, EN CASO DE NO ENCONTRARSE SE LE ASIGNA CUALQUIERA
|
|
Dim Dr As DataRow = Nothing
|
|
If GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("TipoSucursal = 1").Rows.Count > 0 Then
|
|
Dr = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("TipoSucursal = 1").Rows(0)
|
|
ElseIf GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).Rows.Count > 0 Then
|
|
Dr = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)
|
|
End If
|
|
|
|
If Dr IsNot Nothing Then
|
|
CveSubProyecto = Dr("CveSubProyecto").ToString.ToEntero()
|
|
End If
|
|
|
|
If CveSubProyecto < 0 Then
|
|
Retorno.Mensajes.Add("No se tienen asignadas sucursales")
|
|
Return Nothing
|
|
End If
|
|
End If
|
|
Dim ObjFactura = New Modelos.Factura(UsuarioActual)
|
|
ObjFactura.DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas
|
|
|
|
Dim ObjFolios As New ClsGralFolios()
|
|
If ObjFolios.GetFolios("Rem", UsuarioActual.CveEmpresa) Then
|
|
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0} And Estado = 'Activo'", CveSubProyecto))
|
|
If DT.Rows.Count > 0 Then
|
|
ObjFactura.Folio = DT.Rows(0)("FActual").ToString
|
|
ObjFactura.Serie = DT.Rows(0)("Serie").ToString
|
|
End If
|
|
DT.Dispose()
|
|
End If
|
|
ObjFolios.Dispose()
|
|
|
|
If Not String.IsNullOrEmpty(ObjFactura.Folio) Then
|
|
|
|
Select Case CveMoneda
|
|
Case 1
|
|
ObjFactura.TipoCambio = "1"
|
|
Case 2
|
|
ObjFactura.TipoCambio = GlobalTipoCambio(Now).ToString
|
|
Case Else
|
|
ObjFactura.TipoCambio = GlobalTipoCambio(Now).ToString
|
|
End Select
|
|
ObjFactura.CveVendedor = -1
|
|
|
|
'VALIDA PROMOCIONES Y EXISTENCIAS
|
|
Dim ObjVentas As New ClsVentas
|
|
If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, CveCliente, ObjFactura.CveVendedor, UsuarioActual.CveEmpresa) Then
|
|
ObjFactura.DtPromociones = ObjVentas.DtResultados
|
|
End If
|
|
ObjVentas.Dispose()
|
|
|
|
Try
|
|
ObjFactura.TipoMensajeRespuesta = TipoMensajeRespuesta.TextoLimpio
|
|
ObjFactura.Version = "3.3"
|
|
ObjFactura.FolioFiscal = ""
|
|
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
|
|
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
|
|
ObjFactura.TipoCambio = 1
|
|
ObjFactura.ConvertirPesos = False
|
|
ObjFactura.CveMoneda = CveMoneda
|
|
ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {CveMoneda} ")
|
|
ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1")
|
|
ObjFactura.TipoDocto = "Rem"
|
|
ObjFactura.RefDocto = ""
|
|
ObjFactura.CveMesa = -1
|
|
ObjFactura.Fecha = Now
|
|
ObjFactura.CvePrePoliza = -1
|
|
ObjFactura.FechaPago = Now
|
|
ObjFactura.MotivoDescuento = ""
|
|
ObjFactura.Observaciones = Observaciones
|
|
ObjFactura.FechaEjecucion = Now
|
|
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
|
ObjFactura.CveCondicionEntrega = -1
|
|
ObjFactura.CondicionEntrega = ""
|
|
ObjFactura.NumeroCuenta = ""
|
|
ObjFactura.CondicionesPago = 0
|
|
ObjFactura.FormaPago = 0
|
|
ObjFactura.PedidoContrato = ""
|
|
ObjFactura.NumeroContrato = ""
|
|
ObjFactura.DescripcionContrato = ""
|
|
ObjFactura.CveCorte = -1
|
|
ObjFactura.TipoDocumento = "Remision"
|
|
ObjFactura.Alfa1 = ""
|
|
ObjFactura.Alfa2 = ""
|
|
ObjFactura.Alfa3 = ""
|
|
ObjFactura.Descuento = 0
|
|
ObjFactura.Amortizacion = 0
|
|
ObjFactura.CveContrato = -1
|
|
ObjFactura.ConvertirPesos = False
|
|
ObjFactura.CveSubProyecto = CveSubProyecto
|
|
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
|
|
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
|
|
ObjFactura.SubProyecto = New SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}"))
|
|
ObjFactura.SubProyectoMatriz = New SubProyectoModel(GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=CveEmpresa).FiltroPrimero("TipoSucursal=1"))
|
|
|
|
'CLIENTE
|
|
ObjFactura.CveCliente = CveCliente
|
|
ObjFactura.SetCliente()
|
|
ObjFactura.CveAlmacen = CveAlmacen
|
|
|
|
Dim ObjCliente As New ClsClientes
|
|
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa, -1, TipoCliente:=-1) Then
|
|
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
|
ObjFactura.CveFormaPago33 = ObjCliente.CveFormaPago33
|
|
ObjFactura.FormaPago33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPago", $"CveFormaPago = {ObjCliente.CveFormaPago33}")
|
|
ObjFactura.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {ObjCliente.CveFormaPago33}")
|
|
|
|
ObjFactura.CveMetodoPago33 = ObjCliente.CveMetodoPago33
|
|
ObjFactura.MetodoPago33 = GlobalDTVtaMetodoPago.FiltroPrimeroValor("MetodoPago", $"CveMetodoPago = {ObjCliente.CveMetodoPago33}")
|
|
ObjFactura.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {ObjCliente.CveMetodoPago33}")
|
|
|
|
ObjFactura.CveUsoCFDI = ObjCliente.CveUsoCFDI
|
|
ObjFactura.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", $"CveUsoCFDI = {ObjCliente.CveUsoCFDI}")
|
|
ObjFactura.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {ObjCliente.CveUsoCFDI}")
|
|
|
|
ObjFactura.CveMetodoPago = ObjCliente.CveMetodoPago
|
|
If GlobalDTMetodosPago.FiltraParametros($"CveMetodoPago = {ObjCliente.CveMetodoPago}").Rows.Count > 0 Then
|
|
ObjFactura.MetodoPago = GlobalDTMetodosPago.FiltraParametros($"CveMetodoPago = {ObjCliente.CveMetodoPago}").Rows(0)("MetodoPago").ToString
|
|
Else
|
|
ObjFactura.CveMetodoPago = 1
|
|
ObjFactura.MetodoPago = "Efectivo"
|
|
End If
|
|
|
|
ObjFactura.DtDetalle = CreaDTDetalle(Retorno, CveEmpresa, ObjCliente.CvePrecioLista, CveSubProyecto, (ObjCliente.RetIVA / 100D), (ObjCliente.RetISR / 100D), ListaPS)
|
|
|
|
ObjFactura.DtInventario = CreaDTInv(ObjFactura.DtDetalle)
|
|
End If
|
|
End If
|
|
If ObjCliente.GetSucursales(CveCliente) Then
|
|
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
|
ObjFactura.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero())
|
|
Else
|
|
ObjFactura.CveClienteSucursal = -1
|
|
End If
|
|
End If
|
|
ObjCliente.Dispose()
|
|
|
|
Dim TotalImporte As Decimal = ObjFactura.DtDetalle.SUM("TotalImporte").ToDecimal()
|
|
Dim ImporteIVA As Decimal = ObjFactura.DtDetalle.SUM("ImporteIVA").ToDecimal()
|
|
Dim ImporteRetIVA As Decimal = ObjFactura.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
|
|
Dim ImporteRetISR As Decimal = ObjFactura.DtDetalle.SUM("ImporteRetISR").ToDecimal()
|
|
Dim ImporteIEPS As Decimal = ObjFactura.DtDetalle.SUM("ImporteIEPS").ToDecimal()
|
|
Dim Descuento As Decimal = ObjFactura.DtDetalle.SUM("Descuento").ToDecimal()
|
|
Dim Amortizacion As Decimal = 0
|
|
|
|
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
|
|
|
|
'DETALLES
|
|
ObjFactura.SubTotal = TotalImporte
|
|
ObjFactura.Descuento = Descuento
|
|
ObjFactura.Amortizacion = Amortizacion
|
|
ObjFactura.IVA = ImporteIVA
|
|
ObjFactura.RetIVA = ImporteRetIVA
|
|
ObjFactura.RetISR = ImporteRetISR
|
|
ObjFactura.IEPS = ImporteIEPS
|
|
ObjFactura.Total = Total
|
|
|
|
ObjFactura.Timbre = PreParaTimbre(ObjFactura)
|
|
ObjFactura.CveContratoSecciones = ""
|
|
|
|
'BORRAR
|
|
ObjFactura.DtRecepcionUsados = New DataTable
|
|
ObjFactura.DtRecepcionUsados.Columns.Add("CvePS", GetType(Integer))
|
|
|
|
Catch ex As Exception
|
|
Retorno.Mensajes.Add(ex.ToString())
|
|
Return Nothing
|
|
End Try
|
|
Return ObjFactura
|
|
Else
|
|
Retorno.Mensajes.Add("No hay folios para esta factura.")
|
|
Return Nothing
|
|
End If
|
|
End Function
|
|
|
|
Private Function CreaDTDetalle(ByRef Retorno As Modelos.Factura.MMensajeFactura, CveEmpresa As Integer, CvePrecioLista As Integer, CveSubProyecto As Integer, ClienteRetIVA As Double, ClienteRetISR As Double, ListaPS As List(Of MVentaProductos)) As DataTable
|
|
Dim TmpDT = New DataTable
|
|
TmpDT.Columns.Add("CveVenta", GetType(Integer))
|
|
TmpDT.Columns.Add("Consec", GetType(Integer))
|
|
TmpDT.Columns.Add("Cantidad", GetType(Decimal))
|
|
TmpDT.Columns.Add("Codigo", GetType(String))
|
|
TmpDT.Columns.Add("CveUM", GetType(Integer))
|
|
TmpDT.Columns.Add("UM", GetType(String))
|
|
TmpDT.Columns.Add("SATClaveUM", GetType(String))
|
|
TmpDT.Columns.Add("CveClasificacion", GetType(Integer))
|
|
TmpDT.Columns.Add("Clasificacion", GetType(String))
|
|
TmpDT.Columns.Add("CvePS", GetType(Integer))
|
|
TmpDT.Columns.Add("PS", GetType(String))
|
|
TmpDT.Columns.Add("CodigoPS", GetType(String))
|
|
TmpDT.Columns.Add("SATClaveProdServ", GetType(String))
|
|
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
|
|
TmpDT.Columns.Add("CveTipoPS", GetType(Integer))
|
|
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
|
|
TmpDT.Columns.Add("Serie", GetType(String))
|
|
TmpDT.Columns.Add("CuentaPredial", GetType(String))
|
|
TmpDT.Columns.Add("Obs", GetType(String))
|
|
TmpDT.Columns.Add("TiempoEntrega", GetType(String))
|
|
TmpDT.Columns.Add("PU", GetType(Decimal))
|
|
TmpDT.Columns.Add("IVA", GetType(Decimal))
|
|
TmpDT.Columns.Add("ImporteIVA", GetType(Decimal))
|
|
TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal))
|
|
TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal))
|
|
TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal))
|
|
TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
|
|
TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal))
|
|
TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal))
|
|
TmpDT.Columns.Add("IEPS", GetType(Decimal))
|
|
TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal))
|
|
TmpDT.Columns.Add("Descuento", GetType(Decimal))
|
|
TmpDT.Columns.Add("TipoDescuento", GetType(Integer))
|
|
TmpDT.Columns.Add("TotalImporte", GetType(Decimal))
|
|
TmpDT.Columns.Add("Total", GetType(Decimal))
|
|
'Para uso del módulo contable
|
|
TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer))
|
|
TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer))
|
|
TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean))
|
|
TmpDT.Columns.Add("CveProyecto", GetType(Integer))
|
|
TmpDT.Columns.Add("Proyecto", GetType(String))
|
|
TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
|
|
TmpDT.Columns.Add("SubProyecto", GetType(String))
|
|
'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto
|
|
TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer))
|
|
TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer))
|
|
'Contratos
|
|
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
|
|
'Remisiones a Facturas
|
|
TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer))
|
|
TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer))
|
|
TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
|
|
|
|
'Pedido2 a Facturas
|
|
TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer))
|
|
|
|
TmpDT.Columns.Add("Origen", GetType(Integer))
|
|
'Ordenes Servicio
|
|
TmpDT.Columns.Add("CveOS", GetType(Integer))
|
|
TmpDT.Columns.Add("CveOSDetalle", GetType(Integer))
|
|
TmpDT.Columns.Add("SeFacturara", GetType(Integer))
|
|
TmpDT.Columns.Add("Folio", GetType(Integer))
|
|
TmpDT.Columns.Add("Estatus", GetType(String))
|
|
'Ordenamiento
|
|
TmpDT.Columns.Add("Orden", GetType(Integer))
|
|
TmpDT.Columns.Add("TipoDocto", GetType(String))
|
|
'OC
|
|
TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
|
|
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
|
|
|
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
|
TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal))
|
|
TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal))
|
|
TmpDT.Columns.Add("CantidadInventario", GetType(Decimal))
|
|
|
|
TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String))
|
|
TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String))
|
|
TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String))
|
|
TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String))
|
|
|
|
TmpDT.Columns.Add("CveTamaño", GetType(Double))
|
|
|
|
Try
|
|
For Each PS As MVentaProductos In ListaPS
|
|
Dim Row As DataRow = AgregarProductoServicio(Retorno, TmpDT, PS, CveEmpresa, CvePrecioLista, CveSubProyecto, ClienteRetIVA:=ClienteRetIVA, ClienteRetISR:=ClienteRetISR)
|
|
If Row IsNot Nothing Then
|
|
TmpDT.Rows.Add(Row)
|
|
Else
|
|
Retorno.Mensajes.Add($"No se pudo agregar el producto/servicio: {PS.PS}")
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
Retorno.Mensajes.Add(ex.ToString())
|
|
End Try
|
|
|
|
|
|
Return TmpDT
|
|
End Function
|
|
Private Function CreaDTInv(DtDetalle As DataTable) As DataTable
|
|
Dim TmpDT = New DataTable
|
|
TmpDT.Columns.Add("CvePS", GetType(Integer))
|
|
TmpDT.Columns.Add("CveUM", GetType(Integer))
|
|
TmpDT.Columns.Add("Cantidad", GetType(Decimal))
|
|
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
|
|
TmpDT.Columns.Add("Serie", GetType(String))
|
|
TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer))
|
|
|
|
For Each Dr As DataRow In DtDetalle.FiltraParametros("CveTipoPS = 2").Rows
|
|
Dim ss As DataRow = TmpDT.NewRow()
|
|
ss("CvePS") = Dr("CvePS")
|
|
ss("CveUM") = Dr("CveUM")
|
|
ss("Cantidad") = Dr("Cantidad")
|
|
ss("CveTipoInvPS") = Dr("CveTipoInvPS")
|
|
ss("Serie") = Dr("Serie")
|
|
ss("CveVentaDetalle") = -1
|
|
|
|
TmpDT.Rows.Add(ss)
|
|
Next
|
|
|
|
Return TmpDT
|
|
End Function
|
|
Private Function AgregarProductoServicio(ByRef Retorno As Modelos.Factura.MMensajeFactura, TmpDT As DataTable, PS As MVentaProductos, CveEmpresa As Integer, CvePrecioLista As Integer, CveSubProyecto As Integer,
|
|
Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
|
|
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
|
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
|
|
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0,
|
|
Optional ClienteRetIVA As Double = 0, Optional ClienteRetISR As Double = 0) As DataRow
|
|
|
|
|
|
Dim Row As DataRow = Nothing
|
|
Dim TotalCalculableImpuestos As Decimal = 0
|
|
|
|
Dim DrPS As DataRow = GlobalDTPS(CveEmpresa, CvePS:=PS.CvePS).FiltroPrimero("") ' Estado = -1
|
|
|
|
If DrPS Is Nothing Then
|
|
Retorno.Mensajes.Add("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.")
|
|
Return Nothing
|
|
End If
|
|
|
|
'verifica si tiene ventaminima
|
|
If PS.Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
|
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
|
If PS.Cantidad < DrPS("VentaMinima").ToString.ToDecimal() Then
|
|
Retorno.Mensajes.Add("La cantidad es menor que la venta minima")
|
|
Return Nothing
|
|
End If
|
|
End If
|
|
|
|
If CvePrecioLista > 0 Then
|
|
Dim ObjPS As New ClsProductosServicios
|
|
If ObjPS.GetPSPreciosLista(CveEmpresa, CvePrecioLista, CvePS:=PS.CvePS) Then
|
|
If ObjPS.DtResultados.Rows.Count > 0 Then
|
|
Dim PrecioLista = ObjPS.DtResultados.Rows(0)("PrecioLista").ToString().ToDecimal()
|
|
If PrecioLista > 0 Then
|
|
PS.Precio = Math.Round(PrecioLista, 6)
|
|
Else
|
|
PS.Precio = Math.Round(PS.Precio, 6)
|
|
End If
|
|
Else
|
|
PS.Precio = Math.Round(PS.Precio, 6)
|
|
End If
|
|
Else
|
|
PS.Precio = Math.Round(PS.Precio, 6)
|
|
End If
|
|
ObjPS.Dispose()
|
|
Else
|
|
PS.Precio = Math.Round(PS.Precio, 6)
|
|
End If
|
|
|
|
If PS.Precio <= 0 Then
|
|
Retorno.Mensajes.Add($"El producto/servicio {PS.PS} debe tener el precio unitario mayor a cero")
|
|
Return Nothing
|
|
End If
|
|
|
|
|
|
Dim DrSubProyecto As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto).Rows(0)
|
|
|
|
Row = TmpDT.NewRow()
|
|
Row("CveProyecto") = DrSubProyecto("CveProyecto").ToString().ToEntero()
|
|
Row("Proyecto") = DrSubProyecto("Proyecto").ToString()
|
|
Row("CveSubProyecto") = CveSubProyecto
|
|
Row("SubProyecto") = DrSubProyecto("SubProyecto").ToString()
|
|
Row("Serie") = Serie
|
|
Row("TiempoEntrega") = TiempoEntrega
|
|
Row("Orden") = TmpDT.Rows.Count + 1
|
|
Row("Cantidad") = PS.Cantidad
|
|
Row("CveUM") = DrPS("CveUnidadMedida").ToString().ToEntero()
|
|
Row("UM") = DrPS("UnidadMedida").ToString()
|
|
Row("CveClasificacion") = DrPS("CveClasificacion").ToString().ToEntero()
|
|
Row("Clasificacion") = DrPS("Clasificacion").ToString()
|
|
Row("CvePS") = PS.CvePS
|
|
Row("Obs") = PS.Obs
|
|
|
|
TotalCalculableImpuestos = (PS.Cantidad.Value * PS.Precio) - PS.Descuento
|
|
|
|
Row("PU") = PS.Precio
|
|
Row("Codigo") = DrPS("Codigo")
|
|
Row("NoIdentificacion") = DrPS("Codigo")
|
|
Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
|
|
Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
|
|
Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
|
|
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
|
|
|
|
Row("PS") = DrPS("PS")
|
|
Row("CodigoPS") = DrPS("PSCodigo").ToString
|
|
Row("CveTipoPS") = DrPS("CveTipoPS")
|
|
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
|
|
|
|
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
|
Row("PorcentajeIVA") = DrSubProyecto("IVA")
|
|
Else
|
|
Row("PorcentajeIVA") = DrPS("IVA")
|
|
End If
|
|
|
|
Row("IVA") = Row("PorcentajeIVA")
|
|
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, 2)
|
|
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, 2)
|
|
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, 2)
|
|
Row("PorcentajeRetIVA") = ClienteRetIVA
|
|
Row("PorcentajeRetISR") = ClienteRetISR
|
|
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
|
|
Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, 2)
|
|
Row("IEPS") = Row("ImporteIEPS")
|
|
Row("Descuento") = Math.Round(PS.Descuento, 2)
|
|
Row("TipoDescuento") = "2"
|
|
|
|
Row("Total") = (PS.Cantidad.Value * PS.Precio)
|
|
Row("TotalImporte") = Math.Round(PS.Cantidad.Value * PS.Precio, 2)
|
|
|
|
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
|
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
|
|
|
Row("EntregaDirecta") = EntregaDirecta
|
|
'Contratos
|
|
Row("CveContratoDetalle") = CveContratoDetalle
|
|
Row("CveVentaDetalle") = CveVentaDetalle
|
|
Row("CveMovimientoDetallePedido") = CveVentaDetalle
|
|
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
|
|
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
|
|
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
|
|
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
|
|
Row("CuentaPredial") = CuentaPredial
|
|
|
|
Return Row
|
|
End Function
|
|
|
|
Private Function GeneraCorreoRemision(CveVenta As Integer, SerieFolio As String, RazonSocial As String, NombreComercial As String, Direcciones As String, Obs As String, FechaPedido As DateTime) As String
|
|
Dim strBody As New StringBuilder
|
|
Dim ObjVentas As New ClsVentas
|
|
Try
|
|
strBody.Append("<html xmlns=""http://www.w3.org/1999/xhtml""> ")
|
|
strBody.Append("<head> ")
|
|
strBody.Append(" <style type=""text/css""> ")
|
|
strBody.Append(" body ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" margin:0px; ")
|
|
strBody.Append(" padding:0px 0px 0px 0px; ")
|
|
strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
|
strBody.Append(" font-size: 10px; ")
|
|
strBody.Append(" background-color:#F0F0F0; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" a.Texto ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" font-size:11px; ")
|
|
strBody.Append(" background-color:#F7F6F3; ")
|
|
strBody.Append(" text-decoration:none; ")
|
|
strBody.Append(" font-weight:bold; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .Texto ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .TextoAlterno ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
|
strBody.Append(" vertical-align:middle; height:20px;")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .BarraIdentidad ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" color:#FFFFFF; ")
|
|
strBody.Append(" background:#F0F0F0; ")
|
|
strBody.Append(" font-weight:bold; ")
|
|
strBody.Append(" font-size:19px; ")
|
|
strBody.Append(" font-style:oblique; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .Titulos ")
|
|
strBody.Append(" { ")
|
|
strBody.Append(" background-color: Gray;")
|
|
strBody.Append(" color:White; ")
|
|
strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
|
strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
|
strBody.Append(" text-decoration:none; ")
|
|
strBody.Append(" } ")
|
|
strBody.Append(" .Verde {color: #00CC00;} ")
|
|
strBody.Append(" .Negro {color: #000000;} ")
|
|
strBody.Append(" .Rojo {color: #FF0000;} ")
|
|
strBody.Append(" </style> ")
|
|
strBody.Append("</head> ")
|
|
strBody.Append("<body> ")
|
|
strBody.Append(" <div id=""C_divOC"" style=""width: 550px""> <fieldset> <legend><b> Datos del Pedido</b></legend> ")
|
|
strBody.Append(" <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""550px""> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td style=""width: 90px""> Razón Social:</td><td colspan=""3""><b>{0}</b></td> ", RazonSocial)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td style=""width: 90px""> Nombre Comercial:</td><td colspan=""3""><b>{0}</b></td> ", NombreComercial)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td>Serie-Folio:</td><td colspan='3'><b>{0}</b></td> ", SerieFolio)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td>Fecha:</td><td colspan='3'><b>{0}</b></td> ", FechaPedido.ToString("dd/MM/yyyy HH:mm:ss"))
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td style=""width: 90px""> Dirección de envío :</td><td colspan=""3""><b>{0}</b></td> ", Direcciones)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" <tr style=""height: 22px""> ")
|
|
strBody.AppendFormat(" <td style=""width: 90px""> Observaciones :</td><td colspan=""3""><b>{0}</b></td> ", Obs)
|
|
strBody.Append(" </tr> ")
|
|
strBody.Append(" </table> ")
|
|
strBody.Append(" </fieldset> ")
|
|
strBody.Append(" </div> ")
|
|
'Cargo el detalle
|
|
strBody.Append(" <div style='width: 550px'> ")
|
|
strBody.Append(" <fieldset> ")
|
|
strBody.Append(" <legend>Productos/Servicios</legend> ")
|
|
strBody.Append(" <table width=""550px""><tr style='background-color:gray;color:White;font-family:Verdana;font-size:10px;text-align:center;vertical-align:middle;font-weight:bold;height:20px;text-decoration:none;'>")
|
|
strBody.Append(" <th scope='col' style='width: 50px'>Cantidad</th> <th scope='col' style='width: 100px'>Clasificación</th><th scope='col' style='width: 225px'>Producto o Servicio</th>")
|
|
strBody.Append(" <th scope='col' style='width: 70px'>UnidadMedida</th></tr>")
|
|
'verifico los permisos según el estatus
|
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
|
For Each dr As DataRow In ObjVentas.DtResultados.Rows
|
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
|
strBody.AppendFormat("<tr class='Texto'><td>{0}</td><td>{1}</td><td style='width:150px;'><span style='width: 150px; border-bottom: 1px solid gray;'>{2}</span></td><td>{3}</td></tr>",
|
|
dr("Cantidad").ToString.FormatoNumero, dr("Clasificacion"), dr("PS"), dr("UM"))
|
|
End If
|
|
Next
|
|
End If
|
|
strBody.Append(" </table> ")
|
|
strBody.Append(" </fieldset> ")
|
|
strBody.Append(" </div> ")
|
|
strBody.Append("</body></html>")
|
|
Catch ex As Exception
|
|
OnError("Ocurrio un error al general el correo.", ex)
|
|
End Try
|
|
ObjVentas.Dispose()
|
|
Return strBody.ToString
|
|
End Function
|
|
#End Region
|
|
|
|
|
|
End Class
|
|
|
|
Namespace WebServiceAppModels2
|
|
|
|
Public Class WSUSER
|
|
Public Property CveUsuario As Integer
|
|
Public Property Usuario As String
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveCliente As String
|
|
Public Property CvePrecioLista As String
|
|
Public Property Procesos As List(Of String)
|
|
Public Property Empresa As String
|
|
Public Property Cliente As String
|
|
Public Property Nombre As String
|
|
Public Property CveRol As Integer
|
|
Public Property Rol As String
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property CveEstatusCliente As Integer
|
|
|
|
End Class
|
|
Public Class WsEmpresa
|
|
Public Property CveEmpresa As Integer
|
|
Public Property Empresa As String
|
|
Public Property CveEncuestaCRM As Integer
|
|
Public Property Tipo_CentroCosto As Integer
|
|
End Class
|
|
Public Class WSPersonal
|
|
Public Property CvePersonal As Integer
|
|
Public Property CodigoNombreCompleto As String
|
|
Public Property CveClienteAsignado As Integer
|
|
Public Property CveTurno As Integer
|
|
Public Property CveDepartamento As Integer
|
|
Public Property CvePuesto As Integer
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property CveProyecto As Integer
|
|
End Class
|
|
Public Class WSAsistencia
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property CvePersonal As Integer
|
|
Public Property CveCliente As Integer
|
|
Public Property FechaAsistencia As Date
|
|
Public Property CveAsistenciasInasistencias As Integer
|
|
Public Property PorcentajePago As Double
|
|
Public Property HorasDobles As Double
|
|
Public Property HorasTriples As Double
|
|
Public Property CveMotivoHoraExtra As Integer
|
|
Public Property Observacion As String
|
|
Public Property CveUsuario As Integer
|
|
Public Property CveEmpresa As Integer
|
|
End Class
|
|
Public Class WsModulos
|
|
Public Property CveModulo As Integer
|
|
Public Property CvePadre As Integer
|
|
Public Property CvePlataforma As Integer
|
|
Public Property Modulo As String
|
|
Public Property Liga As String
|
|
Public Property Estilo As String
|
|
End Class
|
|
|
|
Public Class WsRepOCGet
|
|
Public Property Tipo As String
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveProyecto As Integer
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property CveEstatus As Integer
|
|
Public Property CveUsuario As Integer
|
|
Public Property CveCliente As Integer
|
|
Public Property TipoBusqueda As Integer
|
|
Public Property Tick As DateTime
|
|
|
|
End Class
|
|
|
|
Public Class WsOCGetRep
|
|
Public Property EsDelUsuario As Integer
|
|
Public Property CveOrdenCompra As Integer
|
|
Public Property CveEstatus As Integer
|
|
Public Property Estatus As String
|
|
Public Property Descripcion As String
|
|
Public Property MonAbreviatura As String
|
|
Public Property Justificacion As String
|
|
Public Property RequiereCotizacion As Integer
|
|
Public Property FechaIng As DateTime
|
|
Public Property Fecha As DateTime
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveCliente As Integer
|
|
Public Property Cliente As String
|
|
Public Property CodigoAF As String
|
|
Public Property Total As Decimal
|
|
Public Property CveProyecto As Integer
|
|
Public Property Proyecto As String
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property SubProyecto As String
|
|
Public Property CveUsuario As Integer
|
|
Public Property Folio As String
|
|
Public Property Lugar As String
|
|
Public Property Proveedor As String
|
|
Public Property Solicito As String
|
|
|
|
End Class
|
|
Public Class WsOCGetRep2
|
|
Public Property EsDelUsuario As Integer
|
|
Public Property CveOrdenCompra As Integer
|
|
Public Property CveEstatus As Integer
|
|
Public Property Estatus As String
|
|
Public Property Descripcion As String
|
|
Public Property MonAbreviatura As String
|
|
Public Property Justificacion As String
|
|
Public Property RequiereCotizacion As Boolean
|
|
Public Property FechaIng As DateTime
|
|
Public Property Fecha As DateTime
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveCliente As Integer
|
|
Public Property Cliente As String
|
|
Public Property CodigoAF As String
|
|
Public Property Total As Decimal
|
|
Public Property CveProyecto As Integer
|
|
Public Property Proyecto As String
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property SubProyecto As String
|
|
Public Property CveUsuario As Integer
|
|
Public Property Folio As String
|
|
'Nuevos Campos
|
|
Public Property Lugar As String
|
|
Public Property Proveedor As String
|
|
Public Property Solicito As String
|
|
Public Property NombreCorto As String
|
|
|
|
|
|
|
|
End Class
|
|
Public Class WsOCEstatus
|
|
Public Property CveEstatusUsuarios As Integer
|
|
Public Property CveEstatus As Integer
|
|
Public Property FechaIng As DateTime
|
|
Public Property CveUsuario As Integer
|
|
Public Property Nombre As String
|
|
Public Property EstatusActivo As Integer
|
|
Public Property CveSuperior As Integer
|
|
Public Property Superior As Integer
|
|
Public Property LimiteInferior As Integer
|
|
Public Property LimiteSuperior As Integer
|
|
Public Property Estatus As String
|
|
Public Property Tipo As String
|
|
Public Property CveEmpresa As Integer
|
|
Public Property TipoTermino As Integer
|
|
Public Property EstatusSiguiente As String
|
|
Public Property CveEstatusSiguiente As Integer
|
|
Public Property Nivel As Integer
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property SubProyecto As String
|
|
Public Property CveProyecto As Integer
|
|
Public Property Proyecto As String
|
|
End Class
|
|
|
|
Public Class WsOCGet
|
|
Public Property CveOC As Integer
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveUsuario As Integer
|
|
Public Property Tick As DateTime
|
|
|
|
End Class
|
|
|
|
Public Class WsFiltroEvento
|
|
Public Property CveUsuario As Integer
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveActivoFijo As Integer
|
|
Public Property CveIE As Integer
|
|
Public Property CveProspecto As Integer
|
|
Public Property CveCliente As Integer
|
|
Public Property CveOS As Integer
|
|
Public Property CveOC As Integer
|
|
Public Property CvePersonal As Integer
|
|
Public Property CveProveedor As Integer
|
|
Public Property CveCompra As Integer
|
|
Public Property CveVenta As Integer
|
|
Public FechaI As DateTime
|
|
Public FechaF As DateTime
|
|
Public Tick As DateTime
|
|
End Class
|
|
Public Class WsHistorial
|
|
Public Property CveOrdenCompra As Integer
|
|
Public Property Fecha As DateTime
|
|
Public Property CveConceptoHistorialOrdenCompra As Integer
|
|
Public Property ConceptoHistorialOrdenCompra As String
|
|
Public Property ValorAnterior As String
|
|
Public Property ValorActual As String
|
|
Public Property CveUsuario As Integer
|
|
Public Property Usuario As String
|
|
|
|
End Class
|
|
Public Class WsHistorialEstatus
|
|
Public Property CveOrdenCompra As Integer
|
|
Public Property Fecha As DateTime
|
|
Public Property Estatus As String
|
|
Public Property CveUsuario As Integer
|
|
Public Property Usuario As String
|
|
End Class
|
|
Public Class WsProveedor
|
|
Public Property CveProveedor As Integer
|
|
Public Property Codigo As String
|
|
Public Property Estatus As String
|
|
Public Property CveEmpresa As Integer
|
|
Public Property RazonSocial As String
|
|
Public Property NombreComercial As String
|
|
Public Property RFC As String
|
|
Public Property Direccion As String
|
|
Public Property ContactoMail As String
|
|
Public Property CveUsuario As Integer
|
|
End Class
|
|
Public Class WsUnidadMedida
|
|
Public Property CvePS As Integer
|
|
Public Property UnidadBase As Boolean
|
|
Public Property Consec As Integer
|
|
Public Property Cantidad As Double
|
|
Public Property UnidadMedida As String
|
|
Public Property UM As String
|
|
Public Property Precio As Double
|
|
Public Property CveUM As Integer
|
|
Public Property CveUnidadMedida As Integer
|
|
End Class
|
|
Public Class WsFolio
|
|
Public Property CveFolio As Integer
|
|
Public Property FolioActual As String
|
|
End Class
|
|
Public Class WsMoneda
|
|
Public Property CveMoneda As Integer
|
|
Public Property Moneda As String
|
|
Public Property Abreviatura As String
|
|
Public Property AbreviaturaSAT As String
|
|
Public Property Estatus As String
|
|
|
|
End Class
|
|
Public Class WsSucursal
|
|
Public Property CveSucursal As Integer
|
|
Public Property Sucursal As String
|
|
End Class
|
|
Public Class WsCliente
|
|
Public Property CveCliente As Integer
|
|
Public Property Nombre As String
|
|
Public Property NombreComercial As String
|
|
Public Property NombreCorto As String
|
|
Public Property Direccion As String
|
|
Public Property Colonia As String
|
|
Public Property Ciudad As String
|
|
Public Property Localidad As String
|
|
Public Property Estado As String
|
|
Public Property RFC As String
|
|
Public Property CP As String
|
|
Public Property Mail As String
|
|
Public Property NotificarA As String
|
|
Public Property RetIVA As Decimal
|
|
Public Property RetISR As Decimal
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveSucursal As Integer
|
|
Public Property Sucursal As String
|
|
Public Property CveMetodoPago As Integer
|
|
Public Property SubProyecto As String
|
|
Public Property CveSubProyecto As Integer
|
|
|
|
End Class
|
|
Public Class WsVenta
|
|
Public Property CveVenta As Integer
|
|
Public Property TipoDocto As String
|
|
Public Property Folio As String
|
|
Public Property Fecha As DateTime
|
|
Public Property Total As Decimal
|
|
Public Property Sucursal As String
|
|
Public Property CveCliente As Integer
|
|
Public Property Nombre As String
|
|
Public Property EstatusFactura As String
|
|
Public Property Usuario As String
|
|
|
|
End Class
|
|
Public Class WsPromocion
|
|
Public Property CvePromocion As Integer
|
|
Public Property Promocion As String
|
|
Public Property FechaInicio As DateTime
|
|
Public Property FechaFin As DateTime
|
|
Public Property CveSucursal As Integer
|
|
Public Property Estatus As Boolean
|
|
Public Property CveVendedor As Integer
|
|
Public Property CveCliente As Integer
|
|
Public Property CveMoneda As Integer
|
|
Public Property CveEmpresa As Integer
|
|
|
|
Public Property CveUsuario As Integer
|
|
|
|
End Class
|
|
Public Class WsPromocionDetalle
|
|
Public Property PS As String
|
|
Public Property AplicaRestriccionTexto As String
|
|
Public Property AplicaRestriccion As Boolean
|
|
Public Property HoraInicio As DateTime
|
|
Public Property HoraFin As DateTime
|
|
Public Property AplicaLunes As Boolean
|
|
Public Property AplicaMartes As Boolean
|
|
Public Property AplicaMiercoles As Boolean
|
|
Public Property AplicaJueves As Boolean
|
|
Public Property AplicaViernes As Boolean
|
|
Public Property AplicaSabado As Boolean
|
|
Public Property AplicaDomingo As Boolean
|
|
Public Property CvePS As Integer
|
|
Public Property Promocion As Double
|
|
Public Property PUAnterior As Double
|
|
Public Property PUPromocion As Double
|
|
Public Property TipoPromocion As Integer
|
|
|
|
|
|
End Class
|
|
Public Class WsVendedor
|
|
Public Property CveVendedor As Integer
|
|
Public Property Promocion As String
|
|
Public Property CveEmpresa As Integer
|
|
End Class
|
|
Public Class WsMetodoPago
|
|
Public Property CveMetodoPago As Integer
|
|
Public Property ClaveSAT As String
|
|
Public Property MetodoPago As String
|
|
|
|
End Class
|
|
Public Class WsRepBancos
|
|
Public Property CveEmpresa As Integer
|
|
Public Property CveCuenta As Integer
|
|
Public Property CveBanco As Integer
|
|
Public Property Banco As String
|
|
Public Property NumCuenta As String
|
|
Public Property Moneda As String
|
|
Public Property CveMoneda As Integer
|
|
Public Property FechaInicio As String
|
|
Public Property FechaFin As String
|
|
Public Property Opcion As Integer
|
|
Public Property SaldoInicial As Integer
|
|
Public Property Cargos As Decimal
|
|
Public Property Abonos As Decimal
|
|
Public Property Saldo As Decimal
|
|
End Class
|
|
Public Class WsRepCxC
|
|
Public Property GPO As String
|
|
Public Property Saldo As Decimal
|
|
Public Property vencido_1_7 As Decimal
|
|
Public Property vencido_8_30 As Decimal
|
|
Public Property vencido_30_mas As Decimal
|
|
Public Property vencido As Decimal
|
|
Public Property por_vencer_0_7 As Decimal
|
|
Public Property por_vencer_8_14 As Decimal
|
|
Public Property por_vencer_15_30 As Decimal
|
|
Public Property por_vencer_30_mas As Decimal
|
|
Public Property por_vencer As Decimal
|
|
Public Property Total As Decimal
|
|
Public Property CveCliente As Integer
|
|
|
|
Public Property vencido_1_30 As Decimal
|
|
Public Property vencido_31_60 As Decimal
|
|
Public Property vencido_61_90 As Decimal
|
|
Public Property vencido_90_mas As Decimal
|
|
|
|
Public Property por_vencer_0_30 As Decimal
|
|
|
|
Public Property CveMoneda As Integer
|
|
Public Property Moneda As String
|
|
|
|
|
|
End Class
|
|
Public Class WsRepCxP
|
|
Public Property GPO As String
|
|
Public Property Saldo As Decimal
|
|
Public Property vencido_1_7 As Decimal
|
|
Public Property vencido_8_30 As Decimal
|
|
Public Property vencido_30_mas As Decimal
|
|
Public Property vencido As Decimal
|
|
Public Property por_vencer_0_7 As Decimal
|
|
Public Property por_vencer_8_14 As Decimal
|
|
Public Property por_vencer_15_30 As Decimal
|
|
Public Property por_vencer_30_mas As Decimal
|
|
Public Property por_vencer As Decimal
|
|
Public Property Total As Decimal
|
|
Public Property CveProveedor As Integer
|
|
|
|
Public Property CveMoneda As Integer
|
|
Public Property Moneda As String
|
|
End Class
|
|
Public Class WsRepPS
|
|
Public Property GPO As String
|
|
Public Property Total As Decimal
|
|
Public Property CveProyecto As Integer
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property CveClasificacion As Integer
|
|
Public Property CveMoneda As Integer
|
|
Public Property Moneda As String
|
|
End Class
|
|
Public Class WsIndicador
|
|
Public Property TotalBancos As Double
|
|
Public Property CxCTotal As Double
|
|
Public Property CxPTotal As Double
|
|
|
|
End Class
|
|
Public Class WsTipoCambio
|
|
Public Property CveTipoCambio As Integer
|
|
Public Property TipoCambio As Double
|
|
Public Property Fecha As Date
|
|
|
|
End Class
|
|
|
|
Public Class WsMovimientosMensualesCuenta
|
|
Public Property total As Double
|
|
Public Property mes1 As Double
|
|
Public Property mes2 As Double
|
|
Public Property mes3 As Double
|
|
Public Property mes4 As Double
|
|
Public Property mes5 As Double
|
|
Public Property mes6 As Double
|
|
Public Property mes7 As Double
|
|
Public Property mes8 As Double
|
|
Public Property mes9 As Double
|
|
Public Property mes10 As Double
|
|
Public Property mes11 As Double
|
|
Public Property mes12 As Double
|
|
End Class
|
|
|
|
Public Class WsVentaDetalle
|
|
Public Property CveVentaDetalle As Integer
|
|
Public Property CveVenta As Integer
|
|
Public Property FolioOC As String
|
|
Public Property Cantidad As Decimal
|
|
Public Property CveUnidadMedida As Integer
|
|
Public Property Abreviatura As String
|
|
Public Property CveUM As Integer
|
|
Public Property UM As String
|
|
Public Property CvePS As Integer
|
|
Public Property PS As String
|
|
Public Property PorcentajeIVA As Decimal
|
|
Public Property IVA As Decimal
|
|
Public Property RetIVA As Decimal
|
|
Public Property RetISR As Decimal
|
|
Public Property IEPS As Decimal
|
|
Public Property Descripcion As String
|
|
Public Property Importe As Decimal
|
|
Public Property Descuento As Decimal
|
|
Public Property Total As Decimal
|
|
Public Property TotalDescuento As Decimal
|
|
Public Property CveOrdenCompraPadre As Integer
|
|
Public Property Producto As String
|
|
Public Property CodigoPS As String
|
|
Public Property CveTipoPS As Integer
|
|
Public Property CveClasificacion As Integer
|
|
Public Property Clasificacion As String
|
|
Public Property CveActivoFijo As Integer
|
|
Public Property Observacion As String
|
|
Public Property Codigo As String
|
|
Public Property CodigoAF As String
|
|
Public Property TipoDato As String
|
|
Public Property Obs As String
|
|
Public Property CveProyecto As Integer
|
|
Public Property Proyecto As String
|
|
Public Property SubProyecto As String
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property FolioOrdenCompraPadre As String
|
|
Public Property CveOrdenCompraHija As Integer
|
|
Public Property FolioOrdenCompraHija As String
|
|
Public Property CvePresupuestoEgreso As Integer
|
|
Public Property CveProgramaOperativo As Integer
|
|
Public Property CveUnidadAdministrativa As Integer
|
|
Public Property CveFuenteFinanciamiento As Integer
|
|
Public Property CveTipoGasto As Integer
|
|
Public Property CveClasificacionOG As Integer
|
|
Public Property IdCuentaPorEjercer As Integer
|
|
Public Property IdCuentaComprometido As Integer
|
|
Public Property CantidadDisponible As Integer
|
|
Public Property CveCompra As Integer
|
|
Public Property FolioCompra As String
|
|
Public Property ProductoOC As String
|
|
Public Property CveProveedor As Integer
|
|
Public Property CveMoneda As Integer
|
|
End Class
|
|
|
|
Public Class WsBitacora
|
|
Public Property Descripcion As String
|
|
Public Property CvePrioridad As Integer
|
|
Public Property Imagen1 As String
|
|
Public Property Extension As String
|
|
End Class
|
|
|
|
Public Class MVenta
|
|
Public Sub New()
|
|
CveVenta = -1
|
|
Total = 0
|
|
IVA = 0
|
|
SubTotal = 0
|
|
Fecha = DateTime.Now
|
|
FechaIng = DateTime.Now
|
|
End Sub
|
|
|
|
Public Property IDTempVenta As Integer
|
|
Public Property CveVenta As Integer
|
|
Public Property FolioFiscal As String
|
|
Public Property TipoDocto As String
|
|
Public Property Serie As String
|
|
Public Property Folio As Integer
|
|
Public Property SerieFolio As String
|
|
Public Property CveCliente As Integer
|
|
Public Property CveClienteSucursal As Integer?
|
|
Public Property SubTotal As Double
|
|
Public Property Descuento As Double
|
|
Public Property Amortizacion As Double
|
|
Public Property IVA As Double
|
|
Public Property RetIVA As Double
|
|
Public Property RetISR As Double
|
|
Public Property IEPS As Double
|
|
Public Property Total As Double
|
|
Public Property CveMoneda As Integer
|
|
Public Property TipoCambio As Double
|
|
Public Property CveMetodoPago As Integer
|
|
Public Property CondicionesPago As Integer
|
|
Public Property FormaPago As Integer
|
|
Public Property Fecha As DateTime
|
|
Public Property FechaIng As DateTime
|
|
Public Property MotivoDescuento As String
|
|
Public Property Observaciones As String
|
|
Public Property CveEstatusFactura As Integer
|
|
Public Property EstatusFactura As String
|
|
Public Property EnvioMail As String
|
|
Public Property SeTimbro As String
|
|
Public Property TelefonoGenerico As String
|
|
Public Property FechaEjecucion As DateTime
|
|
Public Property CveVendedor As Integer
|
|
Public Property Alfa1 As String
|
|
Public Property Alfa2 As String
|
|
Public Property Alfa3 As String
|
|
Public Property Num1 As Integer
|
|
Public Property Num2 As Integer
|
|
Public Property Num3 As Integer
|
|
Public Property Fech1 As DateTime
|
|
Public Property Fech2 As DateTime
|
|
Public Property Fech3 As DateTime
|
|
Public Property CveUsuario As Integer
|
|
Public Property Nombre As String
|
|
Public Property SelloCancelacion As String
|
|
Public Property FechaCancelacion As DateTime
|
|
Public Property TipoDocto1 As String
|
|
Public Property Saldo As Double
|
|
Public Property Pagado As Double
|
|
Public Property TipoEstatus As Integer
|
|
Public Property CveUsoCFDI As Integer
|
|
Public Property UsoCFDI As String
|
|
Public Property CveOS As Integer
|
|
Public Property CveContrato As Integer
|
|
Public Property CveEmpresa As Integer
|
|
Public Property Det_OrdenCompra As String
|
|
Public Property Det_FechaOrdenCompra As String
|
|
Public Property Otros As Double
|
|
Public Property CvePrePoliza As Integer
|
|
Public Property CPCliente As String
|
|
Public Property Telefono As String
|
|
Public Property ClienteRFC As String
|
|
Public Property ClienteNombre As String
|
|
Public Property MetodoPago As String
|
|
Public Property CorreoVendedor As String
|
|
Public Property FechaVencimiento As DateTime
|
|
Public Property Moneda As String
|
|
Public Property DatosCliente As String
|
|
Public Property ColoniaCliente As String
|
|
Public Property ClienteNoExt As String
|
|
Public Property ClienteNoInt As String
|
|
Public Property Municipio As String
|
|
Public Property Estado As String
|
|
Public Property Calle As String
|
|
Public Property NoExt As String
|
|
Public Property NoInt As String
|
|
Public Property Colonia As String
|
|
Public Property CP As String
|
|
Public Property Pais As String
|
|
Public Property Serie1 As String
|
|
Public Property Mail As String
|
|
Public Property ClienteDireccion As String
|
|
Public Property ClienteCodigo As String
|
|
Public Property ClienteCiudad As String
|
|
Public Property ClienteLocalidad As String
|
|
Public Property ClienteEstado As String
|
|
Public Property ClientePais As String
|
|
Public Property ClienteLugar As String
|
|
Public Property SucCliente As String
|
|
Public Property ClaveMetodoPagoSAT As String
|
|
Public Property Entrega As String
|
|
Public Property Vigencia As DateTime
|
|
Public Property SucClienteLocalidad As String
|
|
Public Property SucClienteCiudad As String
|
|
Public Property SucClienteEstado As String
|
|
Public Property SucClienteDireccion As String
|
|
Public Property SucClienteNoExt As String
|
|
Public Property SucClienteNoInt As String
|
|
Public Property SucClienteColonia As String
|
|
Public Property SucClienteCP As String
|
|
Public Property SucClienteCorreo As String
|
|
Public Property SucClienteTelefono As String
|
|
Public Property SucClientePais As String
|
|
Public Property CveVentaFacturada As Integer
|
|
Public Property SucursalCliente As String
|
|
Public Property VendedorCodigo As String
|
|
Public Property Ref As String
|
|
Public Property Abreviatura As String
|
|
Public Property EsDevolucionVenta As Boolean
|
|
Public Property UsuarioCreo As String
|
|
Public Property EnvioDepartamento As String
|
|
Public Property Inv_CveEstatusEntrega As Integer
|
|
Public Property Inv_EstatusEntrega As String
|
|
Public Property ImprimeNombreSucursal As Boolean
|
|
Public Property Vigencia1 As DateTime
|
|
Public Property CvePAC As Integer
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property CveSubProyectoCobranza As Integer
|
|
Public Property CveSubProyectoEjecucion As Integer
|
|
Public Property CalleSubProyecto As String
|
|
Public Property NoExtSubProyecto As String
|
|
Public Property NoIntSubProyecto As String
|
|
Public Property ColoniaSubProyecto As String
|
|
Public Property LocalidadSubProyecto As String
|
|
Public Property MunicipioSubProyecto As String
|
|
Public Property EstadoSubProyecto As String
|
|
Public Property MunicipioSubProyecto1 As String
|
|
Public Property PaisSubProyecto As String
|
|
Public Property CPSubProyecto As String
|
|
Public Property SubProyecto As String
|
|
Public Property CveMetodoPago33 As Integer
|
|
Public Property CveFormaPago33 As Integer
|
|
Public Property MetodoPago33 As String
|
|
Public Property FormaPago33 As String
|
|
Public Property Version As String
|
|
Public Property TipoRelacion As String
|
|
End Class
|
|
|
|
Public Class MVentaProductos
|
|
Public Property CvePS As Integer
|
|
Public Property Cantidad As Double?
|
|
Public Property Obs As String
|
|
Public Property PS As String
|
|
Public Property Precio As Double
|
|
Public Property Descuento As Double
|
|
End Class
|
|
|
|
Public Class MMessage
|
|
Sub New()
|
|
Correcto = True
|
|
Mensajes = New List(Of String)
|
|
End Sub
|
|
Public Property Correcto As Boolean
|
|
Public Property Mensajes As List(Of String)
|
|
End Class
|
|
|
|
End Namespace
|
|
|