-- mejora en recepción de información
This commit is contained in:
@@ -379,6 +379,7 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
Dim ObjInventario As New ClsInventarios(ObjClientes.IniciaTransacSQL())
|
Dim ObjInventario As New ClsInventarios(ObjClientes.IniciaTransacSQL())
|
||||||
Dim CveSubProyecto, CveCliente, CveMoneda, CvePS As Integer
|
Dim CveSubProyecto, CveCliente, CveMoneda, CvePS As Integer
|
||||||
Dim Cantidad, PU, Descuento As Decimal
|
Dim Cantidad, PU, Descuento As Decimal
|
||||||
|
Dim CveDireccionEnvio As Integer = 0
|
||||||
Dim Obs As String = ""
|
Dim Obs As String = ""
|
||||||
CveSubProyecto = 12659 ' fijo Ecommerce
|
CveSubProyecto = 12659 ' fijo Ecommerce
|
||||||
CveCliente = 0
|
CveCliente = 0
|
||||||
@@ -388,8 +389,8 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
Dim RFC As String = ""
|
Dim RFC As String = ""
|
||||||
Dim NombreCliente As String = ""
|
Dim NombreCliente As String = ""
|
||||||
If JsonRequest("billing") IsNot Nothing Then
|
If JsonRequest("billing") IsNot Nothing Then
|
||||||
RFC = JsonRequest("billing").First("first_name").ToString()
|
RFC = JsonRequest("billing")("first_name").ToString()
|
||||||
NombreCliente = JsonRequest("billing").First("first_name").ToString() & " " & JsonRequest("billing").First("last_name").ToString()
|
NombreCliente = JsonRequest("billing")("first_name").ToString() & " " & JsonRequest("billing")("last_name").ToString()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'BUSCAR SI ESTÁ REGISTRADO EL CLIENTE
|
'BUSCAR SI ESTÁ REGISTRADO EL CLIENTE
|
||||||
@@ -407,16 +408,16 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
MsgLog.AppendLine("1.5 crear cliente")
|
MsgLog.AppendLine("1.5 crear cliente")
|
||||||
If JsonRequest("billing") IsNot Nothing Then
|
If JsonRequest("billing") IsNot Nothing Then
|
||||||
Dim CveEstado As Integer = -1
|
Dim CveEstado As Integer = -1
|
||||||
Dim Direccion As String = If(JsonRequest("billing").First("address_1") Is Nothing, "", JsonRequest("billing").First("address_1").ToString())
|
Dim Direccion As String = If(JsonRequest("billing")("address_1") Is Nothing, "", JsonRequest("billing")("address_1").ToString())
|
||||||
Dim NumExt As String = ""
|
Dim NumExt As String = ""
|
||||||
Dim NumInt As String = ""
|
Dim NumInt As String = ""
|
||||||
Dim Colonia As String = ""
|
Dim Colonia As String = ""
|
||||||
Dim Ciudad As String = If(JsonRequest("billing").First("city") Is Nothing, "", JsonRequest("billing").First("city").ToString())
|
Dim Ciudad As String = If(JsonRequest("billing")("city") Is Nothing, "", JsonRequest("billing")("city").ToString())
|
||||||
Dim Localidad As String = If(JsonRequest("billing").First("city") Is Nothing, "", JsonRequest("billing").First("city").ToString())
|
Dim Localidad As String = If(JsonRequest("billing")("city") Is Nothing, "", JsonRequest("billing")("city").ToString())
|
||||||
Dim CP As String = If(JsonRequest("billing").First("postcode") Is Nothing, "", JsonRequest("billing").First("postcode").ToString())
|
Dim CP As String = If(JsonRequest("billing")("postcode") Is Nothing, "", JsonRequest("billing")("postcode").ToString())
|
||||||
Dim Telefono As String = If(JsonRequest("billing").First("phone") Is Nothing, "", JsonRequest("billing").First("phone").ToString())
|
Dim Telefono As String = If(JsonRequest("billing")("phone") Is Nothing, "", JsonRequest("billing")("phone").ToString())
|
||||||
Dim Correo As String = If(JsonRequest("billing").First("email") Is Nothing, "", JsonRequest("billing").First("email").ToString())
|
Dim Correo As String = If(JsonRequest("billing")("email") Is Nothing, "", JsonRequest("billing")("email").ToString())
|
||||||
Dim Estado As String = If(JsonRequest("billing").First("state") Is Nothing, "", JsonRequest("billing").First("state").ToString())
|
Dim Estado As String = If(JsonRequest("billing")("state") Is Nothing, "", JsonRequest("billing")("state").ToString())
|
||||||
If Not String.IsNullOrEmpty(Estado) Then
|
If Not String.IsNullOrEmpty(Estado) Then
|
||||||
CveEstado = ClsPaginas.GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{Estado.Trim}'").ToEntero()
|
CveEstado = ClsPaginas.GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{Estado.Trim}'").ToEntero()
|
||||||
If CveEstado <= 0 Then 'SI NO ENCUENTRA EL ESTADO INGRESA EL DE SONORA
|
If CveEstado <= 0 Then 'SI NO ENCUENTRA EL ESTADO INGRESA EL DE SONORA
|
||||||
@@ -438,13 +439,58 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
' shiping
|
If JsonRequest("shipping") IsNot Nothing AndAlso Not TieneError Then
|
||||||
'shiping_lines/ method_id: free_shipping/local_pickup
|
Dim CveEstado As Integer = -1
|
||||||
|
Dim Direccion As String = If(JsonRequest("shipping")("address_1") Is Nothing, "", JsonRequest("shipping")("address_1").ToString())
|
||||||
|
Dim NumExt As String = ""
|
||||||
|
Dim NumInt As String = ""
|
||||||
|
Dim Colonia As String = ""
|
||||||
|
Dim Ciudad As String = If(JsonRequest("shipping")("city") Is Nothing, "", JsonRequest("shipping")("city").ToString())
|
||||||
|
Dim Localidad As String = If(JsonRequest("shipping")("city") Is Nothing, "", JsonRequest("shipping")("city").ToString())
|
||||||
|
Dim CP As String = If(JsonRequest("shipping")("postcode") Is Nothing, "", JsonRequest("shipping")("postcode").ToString())
|
||||||
|
Dim Telefono As String = If(JsonRequest("shipping")("phone") Is Nothing, "", JsonRequest("shipping")("phone").ToString())
|
||||||
|
Dim Correo As String = If(JsonRequest("shipping")("email") Is Nothing, "", JsonRequest("shipping")("email").ToString())
|
||||||
|
Dim Estado As String = If(JsonRequest("shipping")("state") Is Nothing, "", JsonRequest("shipping")("state").ToString())
|
||||||
|
If Not String.IsNullOrEmpty(Estado) Then
|
||||||
|
CveEstado = ClsPaginas.GlobalDTGralEstados("MEX").FiltroPrimeroValor("CveEstado", $"NombreEstado = '{Estado.Trim}'").ToEntero()
|
||||||
|
If CveEstado <= 0 Then 'SI NO ENCUENTRA EL ESTADO INGRESA EL DE SONORA
|
||||||
|
CveEstado = 26
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
CveEstado = 26
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then
|
||||||
|
Dim dtt As DataTable = ObjClientes.DtResultados
|
||||||
|
If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then
|
||||||
|
dtt = dtt.FiltraParametros($"EnvioDireccion = '{Direccion}' and EnvioCP = '{CP}'")
|
||||||
|
If dtt.Rows.Count > 0 Then
|
||||||
|
CveDireccionEnvio = dtt.FiltroPrimeroValor("CveDireccionEnvio").ToEntero
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, Direccion, NumExt, NumInt, Colonia, Ciudad, Estado, CP, "", 100, 1)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
MsgLog.AppendLine("1.5.9 sin datos cliente")
|
||||||
|
TieneError = True
|
||||||
|
Resp.Mensajes.Add("no existen datos del cliente")
|
||||||
|
End If
|
||||||
|
|
||||||
MsgLog.AppendLine("1.6 inicio generar venta")
|
MsgLog.AppendLine("1.6 inicio generar venta")
|
||||||
ObjFactura = Modelos.Factura.CrearVentaNueva(Usuario, CveSubProyecto, CveCliente, CveMoneda, "Rem")
|
ObjFactura = Modelos.Factura.CrearVentaNueva(Usuario, CveSubProyecto, CveCliente, CveMoneda, "Rem")
|
||||||
MsgLog.AppendFormat("1.6.0 objeto creado {0}", If(ObjFactura IsNot Nothing, "si", "no"))
|
MsgLog.AppendFormat("1.6.0 objeto creado {0}", If(ObjFactura IsNot Nothing, "si", "no"))
|
||||||
|
|
||||||
|
If JsonRequest("shiping_lines") IsNot Nothing Then
|
||||||
|
' shiping
|
||||||
|
'shiping_lines/ method_id: free_shipping/local_pickup
|
||||||
|
Dim Entrega As String = If(JsonRequest("shiping_lines")("method_id") Is Nothing, "", JsonRequest("shiping_lines")("method_id").ToString())
|
||||||
|
ObjFactura.Alfa1 = Entrega
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjFactura.CveDireccionEnvio = cvedireccionenvio
|
||||||
|
|
||||||
If JsonRequest("line_items") IsNot Nothing Then
|
If JsonRequest("line_items") IsNot Nothing Then
|
||||||
Dim ListaPS As JArray = JArray.Parse(JsonRequest("line_items").ToString())
|
Dim ListaPS As JArray = JArray.Parse(JsonRequest("line_items").ToString())
|
||||||
Dim Consec As Integer = 1
|
Dim Consec As Integer = 1
|
||||||
@@ -471,6 +517,7 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
Resp.Mensajes.Add("no existen productos definidos")
|
Resp.Mensajes.Add("no existen productos definidos")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
If ObjFactura IsNot Nothing AndAlso Not TieneError Then
|
If ObjFactura IsNot Nothing AndAlso Not TieneError Then
|
||||||
MsgLog.AppendLine("1.7 agregar la remision")
|
MsgLog.AppendLine("1.7 agregar la remision")
|
||||||
Resp = ObjFactura.EmitirFactura(False, Transac:=ObjClientes.IniciaTransacSQL())
|
Resp = ObjFactura.EmitirFactura(False, Transac:=ObjClientes.IniciaTransacSQL())
|
||||||
|
|||||||
Reference in New Issue
Block a user