From 62ba4e5c764efbc3a58600c3a4576d5f7bf37910 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 29 Jan 2024 20:02:13 -0700 Subject: [PATCH] =?UTF-8?q?--=20recepci=C3=B3n=20de=20parametro=20RFC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ashx/E119.ashx | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/Ashx/E119.ashx b/Ashx/E119.ashx index cbf1d3adf..72230ca94 100644 --- a/Ashx/E119.ashx +++ b/Ashx/E119.ashx @@ -381,6 +381,7 @@ Public Class E119 : Implements IHttpHandler Dim Cantidad, PU, Descuento As Decimal Dim CveDireccionEnvio As Integer = 0 Dim Obs As String = "" + Dim IdEcommerce As Integer = 0 CveSubProyecto = 12659 ' fijo Ecommerce CveCliente = 0 CveMoneda = 1 @@ -388,9 +389,19 @@ Public Class E119 : Implements IHttpHandler MsgLog.AppendLine("1.3 billing") Dim RFC As String = "" Dim NombreCliente As String = "" - If JsonRequest("billing") IsNot Nothing Then - RFC = JsonRequest("billing")("first_name").ToString() + Dim RegimenCliente As String = "" + Dim UsoCFDI As String = "" + Dim CveUsoCFDI As Integer = -1 + IdEcommerce = JsonRequest("wp_sale_id").ToEntero + + If JsonRequest("billing") IsNot Nothing AndAlso JsonRequest("rfc_info") IsNot Nothing Then + RFC = JsonRequest("rfc_info")("rfc_client").ToString() + RegimenCliente = JsonRequest("rfc_info")("regimen_client").ToString() + UsoCFDI = JsonRequest("rfc_info")("cfdi").ToString() NombreCliente = JsonRequest("billing")("first_name").ToString() & " " & JsonRequest("billing")("last_name").ToString() + If Not String.IsNullOrEmpty(UsoCFDI) Then + CveUsoCFDI = ClsPaginas.GlobalDTSATUsosCFDI().FiltroPrimeroValor("CveUsoCFDI", $"UsoCFDI = '{UsoCFDI.Trim}'").ToEntero() + End If End If 'BUSCAR SI ESTÁ REGISTRADO EL CLIENTE @@ -403,11 +414,14 @@ Public Class E119 : Implements IHttpHandler End If MsgLog.AppendLine("1.4 verificar cliente") + If CveCliente = 0 Then ' 'DATOS DE BILLING MsgLog.AppendLine("1.5 crear cliente") If JsonRequest("billing") IsNot Nothing Then Dim CveEstado 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 NumExt As String = "" Dim NumInt As String = "" @@ -426,7 +440,11 @@ Public Class E119 : Implements IHttpHandler Else CveEstado = 26 End If - If ObjClientes.AgregarClienteNoFrecuente(NombreCliente, Direccion, NumExt, NumInt, Colonia, Localidad, Ciudad, CveEstado, RFC, CP, Telefono, Correo, CveSubProyecto, CveUsuario, CveEmpresa, "", -1, -1) Then + If Not String.IsNullOrEmpty(RegimenCliente) Then + CveRegimenFiscal = ClsPaginas.GlobalDTRegimenesFiscales().FiltroPrimeroValor("CveRegimenFiscal", $"CodigoRegimenFiscal = '{RegimenCliente.Trim}'").ToEntero() + End If + + If ObjClientes.AgregarClienteNoFrecuente(NombreCliente, Direccion, NumExt, NumInt, Colonia, Localidad, Ciudad, CveEstado, RFC, CP, Telefono, Correo, CveSubProyecto, CveUsuario, CveEmpresa, "", -1, -1, CveRegimenFiscal:=CveRegimenFiscal, CveUsoCFDI:=CveUsoCFDI) Then If ObjClientes.DtResultados.Rows.Count > 0 Then CveCliente = ObjClientes.DtResultados(0)("CveCliente").ToString().ToEntero() MsgLog.AppendLine("1.5.5 cliente creado") @@ -489,7 +507,10 @@ Public Class E119 : Implements IHttpHandler ObjFactura.Alfa1 = Entrega End If - ObjFactura.CveDireccionEnvio = cvedireccionenvio + ObjFactura.CveDireccionEnvio = CveDireccionEnvio + ObjFactura.Num1 = IdEcommerce + ObjFactura.CveUsoCFDI = cveusocfdi + If JsonRequest("line_items") IsNot Nothing Then Dim ListaPS As JArray = JArray.Parse(JsonRequest("line_items").ToString())