-- mejora
This commit is contained in:
@@ -420,11 +420,17 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
Return JsonConvert.SerializeObject(Respuesta)
|
Return JsonConvert.SerializeObject(Respuesta)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Dim bill As JToken = Nothing
|
||||||
If JsonRequest("billing") IsNot Nothing AndAlso JsonRequest("rfc_info") IsNot Nothing AndAlso JsonRequest("rfc_info").Count > 0 Then
|
If JsonRequest("billing") IsNot Nothing AndAlso JsonRequest("rfc_info") IsNot Nothing AndAlso JsonRequest("rfc_info").Count > 0 Then
|
||||||
RFC = JsonRequest("rfc_info")(0)("rfc_client").ToString()
|
Dim billrfc As JToken
|
||||||
RegimenCliente = JsonRequest("rfc_info")(0)("regimen_client").ToString()
|
|
||||||
UsoCFDI = JsonRequest("rfc_info")(0)("cfdi").ToString()
|
If JsonRequest("rfc_info").Type = JTokenType.Array Then billrfc = JsonRequest("rfc_info").First Else billrfc = JsonRequest("rfc_info")
|
||||||
NombreCliente = JsonRequest("billing")(0)("first_name").ToString() & " " & JsonRequest("billing")(0)("last_name").ToString()
|
If JsonRequest("billing").Type = JTokenType.Array Then bill = JsonRequest("billing").First Else bill = JsonRequest("billing")
|
||||||
|
|
||||||
|
RFC = billrfc("rfc_client").ToString()
|
||||||
|
RegimenCliente = billrfc("regimen_client").ToString()
|
||||||
|
UsoCFDI = billrfc("cfdi").ToString()
|
||||||
|
NombreCliente = bill("first_name").ToString() & " " & bill("last_name").ToString()
|
||||||
'si vienen vacío toman datos predeterminados
|
'si vienen vacío toman datos predeterminados
|
||||||
If RFC = "" Then RFC = "XAXX010101000"
|
If RFC = "" Then RFC = "XAXX010101000"
|
||||||
If RegimenCliente = "" Then RegimenCliente = "616"
|
If RegimenCliente = "" Then RegimenCliente = "616"
|
||||||
@@ -439,7 +445,6 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If Not TieneError Then
|
If Not TieneError Then
|
||||||
|
|
||||||
'BUSCAR SI ESTÁ REGISTRADO EL CLIENTE
|
'BUSCAR SI ESTÁ REGISTRADO EL CLIENTE
|
||||||
If ObjClientes.GetClientes(-1, "-1", "-1", "-1", RFC, "-1", "-1", -1, CveEmpresa, 1, TipoCliente:=-1, TopSelect:=1) Then
|
If ObjClientes.GetClientes(-1, "-1", "-1", "-1", RFC, "-1", "-1", -1, CveEmpresa, 1, TipoCliente:=-1, TopSelect:=1) Then
|
||||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||||
@@ -453,20 +458,20 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
If CveCliente = 0 Then
|
If CveCliente = 0 Then
|
||||||
' 'DATOS DE BILLING
|
' 'DATOS DE BILLING
|
||||||
MsgLog.AppendLine("1.5 crear cliente")
|
MsgLog.AppendLine("1.5 crear cliente")
|
||||||
If JsonRequest("billing") IsNot Nothing Then
|
If bill IsNot Nothing Then
|
||||||
Dim CveEstado As Integer = -1
|
Dim CveEstado As Integer = -1
|
||||||
Dim CveRegimenFiscal As Integer = -1
|
Dim CveRegimenFiscal As Integer = -1
|
||||||
|
|
||||||
Dim Direccion As String = If(JsonRequest("billing")("address_1") Is Nothing, "", JsonRequest("billing")("address_1").ToString())
|
Dim Direccion As String = If(bill("address_1") Is Nothing, "", bill("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")("city") Is Nothing, "", JsonRequest("billing")("city").ToString())
|
Dim Ciudad As String = If(bill("city") Is Nothing, "", bill("city").ToString())
|
||||||
Dim Localidad As String = If(JsonRequest("billing")("city") Is Nothing, "", JsonRequest("billing")("city").ToString())
|
Dim Localidad As String = If(bill("city") Is Nothing, "", bill("city").ToString())
|
||||||
Dim CP As String = If(JsonRequest("billing")("postcode") Is Nothing, "", JsonRequest("billing")("postcode").ToString())
|
Dim CP As String = If(bill("postcode") Is Nothing, "", bill("postcode").ToString())
|
||||||
Dim Telefono As String = If(JsonRequest("billing")("phone") Is Nothing, "", JsonRequest("billing")("phone").ToString())
|
Dim Telefono As String = If(bill("phone") Is Nothing, "", bill("phone").ToString())
|
||||||
Dim Correo As String = If(JsonRequest("billing")("email") Is Nothing, "", JsonRequest("billing")("email").ToString())
|
Dim Correo As String = If(bill("email") Is Nothing, "", bill("email").ToString())
|
||||||
Dim Estado As String = If(JsonRequest("billing")("state") Is Nothing, "", JsonRequest("billing")("state").ToString())
|
Dim Estado As String = If(bill("state") Is Nothing, "", bill("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
|
||||||
@@ -493,17 +498,19 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
If JsonRequest("shipping") IsNot Nothing AndAlso Not TieneError Then
|
If JsonRequest("shipping") IsNot Nothing AndAlso Not TieneError Then
|
||||||
|
Dim jship As JToken
|
||||||
|
If JsonRequest("shipping").Type = JTokenType.Array Then jship = JsonRequest("shipping").First Else jship = JsonRequest("shipping")
|
||||||
Dim CveEstado As Integer = -1
|
Dim CveEstado As Integer = -1
|
||||||
Dim Direccion As String = If(JsonRequest("shipping")(0)("address_1") Is Nothing, "", JsonRequest("shipping")(0)("address_1").ToString())
|
Dim Direccion As String = If(jship("address_1") Is Nothing, "", jship("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("shipping")(0)("city") Is Nothing, "", JsonRequest("shipping")(0)("city").ToString())
|
Dim Ciudad As String = If(jship("city") Is Nothing, "", jship("city").ToString())
|
||||||
Dim Localidad As String = If(JsonRequest("shipping")(0)("city") Is Nothing, "", JsonRequest("shipping")(0)("city").ToString())
|
Dim Localidad As String = If(jship("city") Is Nothing, "", jship("city").ToString())
|
||||||
Dim CP As String = If(JsonRequest("shipping")(0)("postcode") Is Nothing, "", JsonRequest("shipping")(0)("postcode").ToString())
|
Dim CP As String = If(jship("postcode") Is Nothing, "", jship("postcode").ToString())
|
||||||
Dim Telefono As String = If(JsonRequest("shipping")(0)("phone") Is Nothing, "", JsonRequest("shipping")(0)("phone").ToString())
|
Dim Telefono As String = If(jship("phone") Is Nothing, "", jship("phone").ToString())
|
||||||
Dim Correo As String = If(JsonRequest("shipping")(0)("email") Is Nothing, "", JsonRequest("shipping")(0)("email").ToString())
|
Dim Correo As String = If(jship("email") Is Nothing, "", jship("email").ToString())
|
||||||
Dim Estado As String = If(JsonRequest("shipping")(0)("state") Is Nothing, "", JsonRequest("shipping")(0)("state").ToString())
|
Dim Estado As String = If(jship("state") Is Nothing, "", jship("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
|
||||||
@@ -524,7 +531,6 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, Direccion, NumExt, NumInt, Colonia, Ciudad, Estado, CP, "", 100, 1)
|
CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, Direccion, NumExt, NumInt, Colonia, Ciudad, Estado, CP, "", 100, 1)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
MsgLog.AppendLine("1.5.9 sin datos cliente")
|
MsgLog.AppendLine("1.5.9 sin datos cliente")
|
||||||
TieneError = True
|
TieneError = True
|
||||||
@@ -536,10 +542,12 @@ Public Class E119 : Implements IHttpHandler
|
|||||||
ObjFactura.AtencionA = NombreCliente
|
ObjFactura.AtencionA = NombreCliente
|
||||||
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
|
If JsonRequest("shipping_lines") IsNot Nothing Then
|
||||||
' shiping
|
Dim jshiplines As JToken
|
||||||
|
If JsonRequest("shipping_lines").Type = JTokenType.Array Then jshiplines = JsonRequest("shipping_lines").First Else jshiplines = JsonRequest("shipping_lines")
|
||||||
|
|
||||||
'shiping_lines/ method_id: free_shipping/local_pickup
|
'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())
|
Dim Entrega As String = If(jshiplines("method_id") Is Nothing, "", jshiplines("method_id").ToString())
|
||||||
ObjFactura.Alfa1 = Entrega
|
ObjFactura.Alfa1 = Entrega
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user