Correciones API E141
This commit is contained in:
@@ -1680,6 +1680,63 @@ Public Class ClsClientes
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateClienteNoFrencuente(CveCliente As Integer, Nombre As String, Direccion As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Ciudad As String, CveEstado As Integer,
|
||||
RFC As String, CP As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer,
|
||||
NumCuentaPago As String, CveMetodoPago33 As Integer, CveFormaPago33 As Integer, Optional CvePrecioLista As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_ClientesNoFrecuenteUpdate")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||
.Add("@Nombre", SqlDbType.VarChar).Value = Nombre
|
||||
.Add("@Direccion", SqlDbType.VarChar).Value = Direccion
|
||||
.Add("@NoExt", SqlDbType.VarChar).Value = NoExt
|
||||
.Add("@NoInt", SqlDbType.VarChar).Value = NoInt
|
||||
.Add("@Colonia", SqlDbType.VarChar).Value = Colonia
|
||||
.Add("@Localidad", SqlDbType.VarChar).Value = Localidad
|
||||
.Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad
|
||||
.Add("@CveEstado", SqlDbType.Int).Value = CveEstado
|
||||
' .Add("@Pais", SqlDbType.VarChar).Value = Pais
|
||||
.Add("@RFC", SqlDbType.VarChar).Value = RFC
|
||||
.Add("@CP", SqlDbType.VarChar).Value = CP
|
||||
.Add("@Telefono", SqlDbType.VarChar).Value = Telefono
|
||||
.Add("@Mail", SqlDbType.VarChar).Value = Mail
|
||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@CveMetodoPago33", SqlDbType.Int).Value = CveMetodoPago33
|
||||
.Add("@CveFormaPago33", SqlDbType.Int).Value = CveFormaPago33
|
||||
.Add("@NumCuentaPago", SqlDbType.VarChar).Value = NumCuentaPago
|
||||
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch Ex1 As SqlException
|
||||
|
||||
If Ex1.Message.Contains("Número: 2627;") Then
|
||||
Alert("El Nuevo Cliente no se guardo debido a que actualmente se encuentra registrado", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
ElseIf Ex1.Message.Contains("Número: 2601;") Then
|
||||
If Ex1.Message.Contains("UN_ClientesRFCEmpresa") Then
|
||||
Alert("Ya existe un cliente registrado con el mismo RFC.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If Ex1.Message.Contains("IND_Clientes_Codigo") Then
|
||||
Alert("Ya existe un cliente registrado con el mismo Código.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
Me.OnError("Ocurrió un error al Intentar guardar el Nuevo Cliente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guardar el cliente", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
#Region "UNIFICAR CLIENTES"
|
||||
Public Function UnificarClientes(CveClienteAUnificar As Integer, CveClienteOriginal As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
258
Ashx/E141.ashx
258
Ashx/E141.ashx
@@ -115,6 +115,45 @@ Public Class E141 : Implements IHttpHandler
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property GlobalDTPSSimplificado(Optional CveClasificacion As Integer = -1, Optional Codigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable
|
||||
Get
|
||||
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa)
|
||||
If CveEmpresa <> -1 Then
|
||||
'sino existe, recarga los datos
|
||||
If HttpContext.Current.Application(AppNombre) Is Nothing Then
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPSSimplificado(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjPS.DtResultados.AsEnumerable()
|
||||
ObjPS.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim Cons = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow))
|
||||
|
||||
Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa))
|
||||
If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion))
|
||||
Codigo = Codigo.ToUpper()
|
||||
If Codigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!Codigo).ToUpper() = Codigo))
|
||||
If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus))
|
||||
If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta))
|
||||
If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS))
|
||||
|
||||
Try
|
||||
GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable
|
||||
Catch ex As Exception
|
||||
GlobalDTPSSimplificado = New DataTable
|
||||
End Try
|
||||
|
||||
Else
|
||||
GlobalDTPSSimplificado = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa)
|
||||
HttpContext.Current.Application(AppNombre) = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property GlobalDTMonedas() As DataTable
|
||||
Get
|
||||
GlobalDTMonedas = DirectCast(HttpContext.Current.Application("GlobalDTMonedas"), DataTable)
|
||||
@@ -632,11 +671,14 @@ Public Class E141 : Implements IHttpHandler
|
||||
|
||||
Dim ObjClientes As New ClsClientes()
|
||||
Dim ObjInventario As New ClsInventarios(ObjClientes.IniciaTransacSQL())
|
||||
ObjClientes.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
If Not String.IsNullOrEmpty(JsonRequest("timbrar").ToString) Then
|
||||
DebeTimbrar = CBool(JsonRequest("timbrar"))
|
||||
Dim timbrar_request As String = If(JsonRequest("timbrar") Is Nothing, "", JsonRequest("timbrar").ToString())
|
||||
|
||||
If Not String.IsNullOrEmpty(timbrar_request) Then
|
||||
DebeTimbrar = CBool(timbrar_request)
|
||||
Else
|
||||
DebeTimbrar = False
|
||||
End If
|
||||
|
||||
ObjFactura = CreaFactura(ObjInventario, ObjClientes, "Ing", Resp, JsonRequest, Usuario)
|
||||
@@ -646,7 +688,7 @@ Public Class E141 : Implements IHttpHandler
|
||||
|
||||
If Resp.CveVenta > 0 Then
|
||||
Respuesta.status = "success"
|
||||
Respuesta.data = Resp.CveVenta.ToString()
|
||||
Respuesta.data = Resp.SerieFolio
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
@@ -674,9 +716,11 @@ Public Class E141 : Implements IHttpHandler
|
||||
If TieneError Then
|
||||
ObjClientes.RollBack()
|
||||
ObjClientes.Dispose()
|
||||
ObjInventario.Dispose()
|
||||
Else
|
||||
ObjClientes.Commit()
|
||||
ObjClientes.Dispose()
|
||||
ObjInventario.Dispose()
|
||||
|
||||
If DebeTimbrar Then
|
||||
Dim SeTimbro As Boolean = ObjFactura.TimbrarFactura()
|
||||
@@ -690,6 +734,10 @@ Public Class E141 : Implements IHttpHandler
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.Dispose()
|
||||
End If
|
||||
|
||||
Else
|
||||
TieneError = True
|
||||
RespuestaError.message = "No hay un usuario disponible"
|
||||
@@ -708,26 +756,83 @@ Public Class E141 : Implements IHttpHandler
|
||||
|
||||
|
||||
#Region "D E F I N I R - O B J E T O S"
|
||||
Private Function CrearCliente(ObjClientes As ClsClientes, ByRef Resp As Modelos.Factura.MMensajeFactura, JsonRequest As JObject, UsuarioActual As Usuario) As Integer
|
||||
Private Function CrearCliente(TipoDocto As String, ObjClientes As ClsClientes, ByRef Resp As Modelos.Factura.MMensajeFactura, JsonRequest As JObject, UsuarioActual As Usuario) As Integer
|
||||
Dim CveCliente As Integer = -1
|
||||
|
||||
Dim CveSubProyecto As Integer = JsonRequest("branch_office_id").ToEntero()
|
||||
Dim Nombre As String = If(JsonRequest("contact_name") Is Nothing, "", JsonRequest("contact_name").ToString())
|
||||
Dim Direccion As String = If(JsonRequest("contact_address") Is Nothing, "", JsonRequest("contact_address").ToString())
|
||||
Dim NumExt As String = If(JsonRequest("contact_ext_number") Is Nothing, "", JsonRequest("contact_ext_number").ToString())
|
||||
Dim NumInt As String = If(JsonRequest("contact_int_number") Is Nothing, "", JsonRequest("contact_int_number").ToString())
|
||||
Dim Colonia As String = If(JsonRequest("contact_neighborhood") Is Nothing, "", JsonRequest("contact_neighborhood").ToString())
|
||||
Dim Localidad As String = If(JsonRequest("contact_city") Is Nothing, "", JsonRequest("contact_city").ToString())
|
||||
Dim Ciudad As String = Localidad
|
||||
Dim RFC As String = If(JsonRequest("invoice_rfc") Is Nothing, "XAXX010101000", JsonRequest("invoice_rfc").ToString())
|
||||
Dim CP As String = If(JsonRequest("contact_zip_code") Is Nothing, "", JsonRequest("contact_zip_code").ToString())
|
||||
Dim Telefono As String = If(JsonRequest("contact_phone") Is Nothing, "", JsonRequest("contact_phone").ToString())
|
||||
Dim Correo As String = If(JsonRequest("contact_email") Is Nothing, "", JsonRequest("contact_email").ToString())
|
||||
|
||||
|
||||
Dim Nombre As String = ""
|
||||
Dim Direccion As String = ""
|
||||
Dim NumExt As String = ""
|
||||
Dim NumInt As String = ""
|
||||
Dim Colonia As String = ""
|
||||
Dim Localidad As String = ""
|
||||
Dim Ciudad As String = ""
|
||||
Dim Estado As String = ""
|
||||
Dim RFC As String = ""
|
||||
Dim CP As String = ""
|
||||
Dim Telefono As String = ""
|
||||
Dim Correo As String = ""
|
||||
|
||||
'DATOS DE CONTACTO
|
||||
Dim contact_name As String = If(JsonRequest("contact_name") Is Nothing, "", JsonRequest("contact_name").ToString())
|
||||
Dim contact_address As String = If(JsonRequest("contact_address") Is Nothing, "", JsonRequest("contact_address").ToString())
|
||||
Dim contact_ext_number As String = If(JsonRequest("contact_ext_number") Is Nothing, "", JsonRequest("contact_ext_number").ToString())
|
||||
Dim contact_int_number As String = If(JsonRequest("contact_int_number") Is Nothing, "", JsonRequest("contact_int_number").ToString())
|
||||
Dim contact_neighborhood As String = If(JsonRequest("contact_neighborhood") Is Nothing, "", JsonRequest("contact_neighborhood").ToString())
|
||||
Dim contact_city As String = If(JsonRequest("contact_city") Is Nothing, "", JsonRequest("contact_city").ToString())
|
||||
Dim contact_zip_code As String = If(JsonRequest("contact_zip_code") Is Nothing, "", JsonRequest("contact_zip_code").ToString())
|
||||
Dim contact_phone As String = If(JsonRequest("contact_phone") Is Nothing, "", JsonRequest("contact_phone").ToString())
|
||||
Dim contact_email As String = If(JsonRequest("contact_email") Is Nothing, "", JsonRequest("contact_email").ToString())
|
||||
Dim contact_state As String = If(JsonRequest("contact_state") Is Nothing, "", JsonRequest("contact_state").ToString())
|
||||
|
||||
'DATOS DE FACTURACION
|
||||
Dim invoice_rfc As String = If(JsonRequest("invoice_rfc") Is Nothing, "", JsonRequest("invoice_rfc").ToString())
|
||||
Dim invoice_name As String = If(JsonRequest("invoice_name") Is Nothing, "", JsonRequest("invoice_name").ToString())
|
||||
Dim invoice_address As String = If(JsonRequest("invoice_address") Is Nothing, "", JsonRequest("invoice_address").ToString())
|
||||
Dim invoice_city As String = If(JsonRequest("invoice_city") Is Nothing, "", JsonRequest("invoice_city").ToString())
|
||||
Dim invoice_state As String = If(JsonRequest("invoice_state") Is Nothing, "", JsonRequest("invoice_state").ToString())
|
||||
Dim invoice_email As String = If(JsonRequest("invoice_email") Is Nothing, "", JsonRequest("invoice_email").ToString())
|
||||
Dim invoice_phone As String = If(JsonRequest("invoice_phone") Is Nothing, "", JsonRequest("invoice_phone").ToString())
|
||||
|
||||
Dim CveEstado As Integer = -1
|
||||
|
||||
If Not String.IsNullOrEmpty(JsonRequest("contact_state").ToString()) Then
|
||||
CveEstado = GlobalDTEstado("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{JsonRequest("contact_state").ToString().Trim}'").ToEntero()
|
||||
If TipoDocto = "Ing" Then
|
||||
RFC = If(Not String.IsNullOrEmpty(invoice_rfc), invoice_rfc, "XAXX010101000")
|
||||
Nombre = If(Not String.IsNullOrEmpty(invoice_name), invoice_name, contact_name)
|
||||
Direccion = If(Not String.IsNullOrEmpty(invoice_address), invoice_address, contact_address)
|
||||
'SI LA DIRECCION ES LA MISMA QUE LA DE CONTACTO
|
||||
If Direccion = contact_address Then
|
||||
NumExt = If(Not String.IsNullOrEmpty(contact_ext_number), contact_ext_number, "")
|
||||
NumInt = If(Not String.IsNullOrEmpty(contact_int_number), contact_int_number, "")
|
||||
Colonia = If(Not String.IsNullOrEmpty(contact_neighborhood), contact_neighborhood, "")
|
||||
End If
|
||||
Ciudad = If(Not String.IsNullOrEmpty(invoice_city), invoice_city, contact_city)
|
||||
Localidad = Ciudad
|
||||
Estado = If(Not String.IsNullOrEmpty(invoice_state), invoice_state, contact_state)
|
||||
CP = If(Not String.IsNullOrEmpty(contact_zip_code), contact_zip_code, "")
|
||||
Correo = If(Not String.IsNullOrEmpty(invoice_email), invoice_email, contact_email)
|
||||
Telefono = If(Not String.IsNullOrEmpty(invoice_phone), invoice_phone, contact_phone)
|
||||
|
||||
Else
|
||||
|
||||
Nombre = If(Not String.IsNullOrEmpty(contact_name), contact_name, "")
|
||||
Direccion = If(Not String.IsNullOrEmpty(contact_address), contact_address, "")
|
||||
NumExt = If(Not String.IsNullOrEmpty(contact_ext_number), contact_ext_number, "")
|
||||
NumInt = If(Not String.IsNullOrEmpty(contact_int_number), contact_int_number, "")
|
||||
Colonia = If(Not String.IsNullOrEmpty(contact_neighborhood), contact_neighborhood, "")
|
||||
Ciudad = If(Not String.IsNullOrEmpty(contact_city), contact_city, "")
|
||||
Localidad = Ciudad
|
||||
Estado = If(Not String.IsNullOrEmpty(contact_state), contact_state, "")
|
||||
CP = If(Not String.IsNullOrEmpty(contact_zip_code), contact_zip_code, "")
|
||||
Correo = If(Not String.IsNullOrEmpty(contact_email), contact_email, "")
|
||||
Telefono = If(Not String.IsNullOrEmpty(contact_phone), contact_phone, "")
|
||||
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrEmpty(Estado) Then
|
||||
CveEstado = GlobalDTEstado("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{Estado.Trim}'").ToEntero()
|
||||
|
||||
'SI NO ENCUENTRA EL ESTADO INGRESA EL DE SONORA
|
||||
If CveEstado <= 0 Then
|
||||
@@ -737,11 +842,18 @@ Public Class E141 : Implements IHttpHandler
|
||||
CveEstado = 26
|
||||
End If
|
||||
|
||||
|
||||
'SI NO EXISTE EL RFC UTILIZA EL GENERICO
|
||||
If String.IsNullOrEmpty(RFC) Then
|
||||
RFC = "XAXX010101000"
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(Nombre) Then
|
||||
Resp.TieneError = False
|
||||
Resp.Mensajes.Add("El cliente no tiene un nombre")
|
||||
Return -1
|
||||
End If
|
||||
|
||||
'VALIDAR QUE NO EXISTA EL RFC
|
||||
If RFC <> "XAXX010101000" Then
|
||||
If ObjClientes.GetClientes(-1, "-1", "-1", "-1", RFC, "-1", "-1", -1, UsuarioActual.CveEmpresa, 1, TipoCliente:=-1, TopSelect:=1) Then
|
||||
@@ -774,11 +886,19 @@ Public Class E141 : Implements IHttpHandler
|
||||
Resp.TieneError = False
|
||||
Dim Serie As String = "-1"
|
||||
Dim CveMoneda As Integer = 1
|
||||
|
||||
Dim CveSubProyecto As Integer = JsonRequest("branch_office_id").ToEntero()
|
||||
|
||||
If CveSubProyecto <= 0 Then
|
||||
Resp.TieneError = False
|
||||
Resp.Mensajes.Add("La sucursal es requerida")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Dim CveCliente As Integer = If(JsonRequest("user_id") Is Nothing, 0, JsonRequest("user_id").ToEntero())
|
||||
|
||||
If CveCliente <= 0 Then
|
||||
CveCliente = CrearCliente(ObjClientes, Resp, JsonRequest, UsuarioActual)
|
||||
CveCliente = CrearCliente(TipoDocto, ObjClientes, Resp, JsonRequest, UsuarioActual)
|
||||
End If
|
||||
|
||||
If CveCliente <= 0 Then
|
||||
@@ -854,19 +974,6 @@ Public Class E141 : Implements IHttpHandler
|
||||
|
||||
ElseIf ObjFactura.TipoDocto = "Ing" Then
|
||||
|
||||
If ObjFactura.Cliente IsNot Nothing AndAlso Not String.IsNullOrEmpty(JsonRequest("invoice_name").ToString()) Then
|
||||
ObjFactura.Cliente.Nombre = JsonRequest("invoice_name").ToString()
|
||||
ObjFactura.Cliente.NombreComercial = JsonRequest("invoice_name").ToString()
|
||||
ObjFactura.Cliente.Direccion = JsonRequest("invoice_address").ToString()
|
||||
ObjFactura.Cliente.Colonia = ""
|
||||
ObjFactura.Cliente.NoInt = ""
|
||||
ObjFactura.Cliente.NoExt = ""
|
||||
ObjFactura.Cliente.Localidad = JsonRequest("invoice_city").ToString()
|
||||
ObjFactura.Cliente.Estado = JsonRequest("invoice_state").ToString()
|
||||
ObjFactura.Cliente.Mail = JsonRequest("invoice_email").ToString()
|
||||
ObjFactura.Cliente.Telefono = JsonRequest("invoice_phone").ToString()
|
||||
End If
|
||||
|
||||
'FORMA DE PAGO
|
||||
If JsonRequest("invoice_way_to_pay") Is Nothing Then
|
||||
Resp.TieneError = False
|
||||
@@ -941,10 +1048,73 @@ Public Class E141 : Implements IHttpHandler
|
||||
|
||||
End If
|
||||
|
||||
If ObjFactura.Cliente IsNot Nothing AndAlso TipoDocto = "Ing" Then
|
||||
|
||||
'DATOS DE CONTACTO
|
||||
Dim contact_name As String = If(JsonRequest("contact_name") Is Nothing, "", JsonRequest("contact_name").ToString())
|
||||
Dim contact_address As String = If(JsonRequest("contact_address") Is Nothing, "", JsonRequest("contact_address").ToString())
|
||||
Dim contact_ext_number As String = If(JsonRequest("contact_ext_number") Is Nothing, "", JsonRequest("contact_ext_number").ToString())
|
||||
Dim contact_int_number As String = If(JsonRequest("contact_int_number") Is Nothing, "", JsonRequest("contact_int_number").ToString())
|
||||
Dim contact_neighborhood As String = If(JsonRequest("contact_neighborhood") Is Nothing, "", JsonRequest("contact_neighborhood").ToString())
|
||||
Dim contact_city As String = If(JsonRequest("contact_city") Is Nothing, "", JsonRequest("contact_city").ToString())
|
||||
Dim contact_zip_code As String = If(JsonRequest("contact_zip_code") Is Nothing, "", JsonRequest("contact_zip_code").ToString())
|
||||
Dim contact_phone As String = If(JsonRequest("contact_phone") Is Nothing, "", JsonRequest("contact_phone").ToString())
|
||||
Dim contact_email As String = If(JsonRequest("contact_email") Is Nothing, "", JsonRequest("contact_email").ToString())
|
||||
Dim contact_state As String = If(JsonRequest("contact_state") Is Nothing, "", JsonRequest("contact_state").ToString())
|
||||
|
||||
'DATOS DE FACTURACION
|
||||
Dim invoice_rfc As String = If(JsonRequest("invoice_rfc") Is Nothing, "", JsonRequest("invoice_rfc").ToString())
|
||||
Dim invoice_name As String = If(JsonRequest("invoice_name") Is Nothing, "", JsonRequest("invoice_name").ToString())
|
||||
Dim invoice_address As String = If(JsonRequest("invoice_address") Is Nothing, "", JsonRequest("invoice_address").ToString())
|
||||
Dim invoice_city As String = If(JsonRequest("invoice_city") Is Nothing, "", JsonRequest("invoice_city").ToString())
|
||||
Dim invoice_state As String = If(JsonRequest("invoice_state") Is Nothing, "", JsonRequest("invoice_state").ToString())
|
||||
Dim invoice_email As String = If(JsonRequest("invoice_email") Is Nothing, "", JsonRequest("invoice_email").ToString())
|
||||
Dim invoice_phone As String = If(JsonRequest("invoice_phone") Is Nothing, "", JsonRequest("invoice_phone").ToString())
|
||||
|
||||
Dim CveEstado As Integer = -1
|
||||
|
||||
ObjFactura.Cliente.RFC = If(Not String.IsNullOrEmpty(invoice_rfc), invoice_rfc, ObjFactura.Cliente.RFC)
|
||||
ObjFactura.Cliente.Nombre = If(Not String.IsNullOrEmpty(invoice_name), invoice_name, contact_name)
|
||||
ObjFactura.Cliente.NombreComercial = ObjFactura.Cliente.NombreComercial
|
||||
ObjFactura.Cliente.Direccion = If(Not String.IsNullOrEmpty(invoice_address), invoice_address, contact_address)
|
||||
ObjFactura.Cliente.Mail = If(Not String.IsNullOrEmpty(invoice_email), invoice_email, contact_email)
|
||||
ObjFactura.Cliente.Telefono = If(Not String.IsNullOrEmpty(invoice_phone), invoice_phone, contact_phone)
|
||||
ObjFactura.Cliente.Localidad = If(Not String.IsNullOrEmpty(invoice_city), invoice_city, contact_city)
|
||||
ObjFactura.Cliente.Ciudad = ObjFactura.Cliente.Localidad
|
||||
ObjFactura.Cliente.Estado = If(Not String.IsNullOrEmpty(invoice_state), invoice_state, contact_state)
|
||||
|
||||
If String.IsNullOrEmpty(ObjFactura.Cliente.RFC) Then
|
||||
Resp.Mensajes.Add("No se ha ingresado un RFC")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(ObjFactura.Cliente.Nombre) Then
|
||||
Resp.Mensajes.Add("No se ha ingresado un nombre para el cliente")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrEmpty(ObjFactura.Cliente.Estado) Then
|
||||
CveEstado = GlobalDTEstado("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{ObjFactura.Cliente.Estado.Trim}'").ToEntero()
|
||||
|
||||
'SI NO ENCUENTRA EL ESTADO INGRESA EL DE SONORA
|
||||
If CveEstado <= 0 Then
|
||||
CveEstado = 26
|
||||
End If
|
||||
Else
|
||||
CveEstado = 26
|
||||
End If
|
||||
|
||||
Dim Cliente = ObjFactura.Cliente
|
||||
If Not ObjClientes.UpdateClienteNoFrencuente(CveCliente, Cliente.Nombre, Cliente.Direccion, Cliente.NoExt, Cliente.NoInt, Cliente.Colonia, Cliente.Localidad, Cliente.Ciudad, CveEstado, Cliente.RFC, Cliente.CP, Cliente.Telefono, Cliente.Mail, CveSubProyecto, UsuarioActual.CveUsuario, CveEmpresa, "-1", ObjFactura.CveMetodoPago33, ObjFactura.CveFormaPago33) Then
|
||||
Resp.TieneError = False
|
||||
Resp.Mensajes.Add("No se puedo actualizar un cliente")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjFactura.CveAlmacen = GlobalDTAlmacen(CveEmpresa, CveTipoAlmacen:=1).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
|
||||
|
||||
'DETALLES
|
||||
ObjFactura.DtDetalle = CreaDTDetalle(ObjInventario, ObjFactura, Resp, UsuarioActual, JsonRequest)
|
||||
|
||||
@@ -958,7 +1128,6 @@ Public Class E141 : Implements IHttpHandler
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'INVENTARIO
|
||||
If TipoDocto = "Ing" Then
|
||||
ObjFactura.DtInventario = ObjFactura.DtDetalle.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
@@ -1235,7 +1404,9 @@ Public Class E141 : Implements IHttpHandler
|
||||
TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String))
|
||||
TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
|
||||
|
||||
|
||||
Try
|
||||
Dim ListaPS = JArray.Parse(JsonRequest("details").ToString())
|
||||
Dim DescuentoTotal As Decimal = JsonRequest("discount").ToString().ToDecimal()
|
||||
@@ -1245,7 +1416,9 @@ Public Class E141 : Implements IHttpHandler
|
||||
For Each JsonPS As JObject In ListaPS
|
||||
Dim Cantidad As Decimal = JsonPS("quantity").ToString.ToDecimal()
|
||||
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, Codigo:=JsonPS("product_sku").ToString()).FiltroPrimero("")
|
||||
Dim CvePS As Integer = GlobalDTPSSimplificado(Codigo:=JsonPS("product_sku").ToString()).FiltroPrimeroValor("CvePS").ToEntero()
|
||||
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Retorno.TieneError = True
|
||||
@@ -1487,7 +1660,7 @@ Public Class E141 : Implements IHttpHandler
|
||||
|
||||
If Resp.CveVenta > 0 Then
|
||||
Respuesta.status = "success"
|
||||
Respuesta.data = Resp.CveVenta.ToString()
|
||||
Respuesta.data = Resp.SerieFolio
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
@@ -1499,6 +1672,8 @@ Public Class E141 : Implements IHttpHandler
|
||||
Next
|
||||
RespuestaError.message = sb.ToString()
|
||||
End If
|
||||
|
||||
ObjFactura.Dispose()
|
||||
Else
|
||||
TieneError = True
|
||||
Dim sb As New StringBuilder()
|
||||
@@ -2077,7 +2252,8 @@ Public Class E141 : Implements IHttpHandler
|
||||
New JProperty("age", 0),
|
||||
New JProperty("gender", 0),
|
||||
New JProperty("address", ""),
|
||||
New JProperty("code", "")
|
||||
New JProperty("code", RowVendedor("CodigoVendedor")),
|
||||
New JProperty("default_branchoffice", RowVendedor("CveSubProyecto"))
|
||||
)
|
||||
|
||||
ArrayVendedores.Add(vendedor)
|
||||
@@ -2097,6 +2273,10 @@ Public Class E141 : Implements IHttpHandler
|
||||
End If
|
||||
End If
|
||||
|
||||
If CountPeticionesExitosas > 0 Then
|
||||
Retorno = True
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
Reference in New Issue
Block a user