diff --git a/Ashx/E119.ashx b/Ashx/E119.ashx index 938ca01b6..f0370597d 100644 --- a/Ashx/E119.ashx +++ b/Ashx/E119.ashx @@ -355,9 +355,9 @@ Public Class E119 : Implements IHttpHandler TieneError = True End If Else - MsgLog.AppendLine("json:" & json) TieneError = True End If + MsgLog.AppendLine("json:" & json) End Using End If @@ -405,7 +405,7 @@ Public Class E119 : Implements IHttpHandler New JProperty("SerieFolio", dr("SerieFolio")) ) data.Add(objSucursal) - Respuesta.status = "success" + Respuesta.status = "error" Respuesta.data = data Respuesta.message = "Folio registrado previamente." MsgLog.AppendLine("Folio registrado previamente.") @@ -420,11 +420,16 @@ Public Class E119 : Implements IHttpHandler Return JsonConvert.SerializeObject(Respuesta) End If - 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 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() + RegimenCliente = JsonRequest("rfc_info")(0)("regimen_client").ToString() + UsoCFDI = JsonRequest("rfc_info")(0)("cfdi").ToString() + NombreCliente = JsonRequest("billing")(0)("first_name").ToString() & " " & JsonRequest("billing")(0)("last_name").ToString() + 'si vienen vacío toman datos predeterminados + If RFC = "" Then RFC = "XAXX010101000" + If RegimenCliente = "" Then RegimenCliente = "616" + If UsoCFDI = "" Then UsoCFDI = "S01" + If Not String.IsNullOrEmpty(UsoCFDI) Then CveUsoCFDI = ClsPaginas.GlobalDTSATUsosCFDI().FiltroPrimeroValor("CveUsoCFDI", $"UsoCFDI = '{UsoCFDI.Trim}'").ToEntero() End If @@ -489,16 +494,16 @@ Public Class E119 : Implements IHttpHandler End If If JsonRequest("shipping") IsNot Nothing AndAlso Not TieneError Then Dim CveEstado As Integer = -1 - Dim Direccion As String = If(JsonRequest("shipping")("address_1") Is Nothing, "", JsonRequest("shipping")("address_1").ToString()) + Dim Direccion As String = If(JsonRequest("shipping")(0)("address_1") Is Nothing, "", JsonRequest("shipping")(0)("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()) + Dim Ciudad As String = If(JsonRequest("shipping")(0)("city") Is Nothing, "", JsonRequest("shipping")(0)("city").ToString()) + Dim Localidad As String = If(JsonRequest("shipping")(0)("city") Is Nothing, "", JsonRequest("shipping")(0)("city").ToString()) + Dim CP As String = If(JsonRequest("shipping")(0)("postcode") Is Nothing, "", JsonRequest("shipping")(0)("postcode").ToString()) + Dim Telefono As String = If(JsonRequest("shipping")(0)("phone") Is Nothing, "", JsonRequest("shipping")(0)("phone").ToString()) + Dim Correo As String = If(JsonRequest("shipping")(0)("email") Is Nothing, "", JsonRequest("shipping")(0)("email").ToString()) + Dim Estado As String = If(JsonRequest("shipping")(0)("state") Is Nothing, "", JsonRequest("shipping")(0)("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 @@ -528,6 +533,7 @@ Public Class E119 : Implements IHttpHandler MsgLog.AppendLine("1.6 inicio generar venta") ObjFactura = Modelos.Factura.CrearVentaNueva(Usuario, CveSubProyecto, CveCliente, CveMoneda, "Rem") + ObjFactura.AtencionA = NombreCliente MsgLog.AppendFormat("1.6.0 objeto creado {0}", If(ObjFactura IsNot Nothing, "si", "no")) If JsonRequest("shiping_lines") IsNot Nothing Then @@ -616,6 +622,7 @@ Public Class E119 : Implements IHttpHandler MsgLog.Append("99.0 ocurrió un error en el proceso") Else MsgLog.Append("4.0 proceso terminado") + MsgLog.AppendFormat("Folio:{0} Estatus:", Resp.SerieFolio, Respuesta.status) ObjClientes.Commit() ObjClientes.Dispose() ObjInventario.Dispose() @@ -627,7 +634,7 @@ Public Class E119 : Implements IHttpHandler Catch ex As Exception TieneError = True Finally - MsgLog.ToString.GuardaLogAD("LogE119") + 'MsgLog.ToString.GuardaLogAD("LogE119") End Try If TieneError Then