From 2e1f6ef80be9e380d65a8a379176b29714b8e184 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 13 Dec 2019 01:00:14 -0700 Subject: [PATCH] poliza virtual --- Ashx/SIGPolizaVirtual.ashx | 2 +- Ventas/Ventas.aspx.vb | 92 +++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/Ashx/SIGPolizaVirtual.ashx b/Ashx/SIGPolizaVirtual.ashx index 6ba9db938..10eab84ae 100644 --- a/Ashx/SIGPolizaVirtual.ashx +++ b/Ashx/SIGPolizaVirtual.ashx @@ -93,7 +93,7 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState obj.sale_type = "01" 'PISO obj.sale_type_service = "01" 'PARTICULAR obj.sale_total = ObjFactura.Total - obj.sale_discount = ObjFactura.SubTotal + obj.sale_discount = 0 'ObjFactura.SubTotal obj.sale_id = GuidGenerator.GenerateTimeBasedGuid().ToString() 'Dim PS = ObjFactura.DtDetalle.Rows(0) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index aff09fb81..9a55104d1 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6735,7 +6735,9 @@ Partial Class Ventas 'ENVIAR POLIZA VIRTUAL If ErrorList.Count = 0 Then If UsuarioActual.Empresa.Funcionalidad(576) = "1" Then - GeneraPolizaVentaWS(ObjFactura) + If Not GeneraPolizaVentaWS(ObjVentas, ObjFactura) Then + ErrorList.Add("Ocurrió un error al registrar los movimientos de almacén del contrato de consignación") + End If End If End If @@ -23812,49 +23814,61 @@ Partial Class Ventas CargaRNC() RegistraScript("$('#ModalAplicarRemisionesNC').modal({backdrop: 'static', keyboard: false });") End Sub - Protected Function GeneraPolizaVentaWS(ObjFactura As Modelos.Factura) As Boolean - Dim obj As New Modelos.MPolizaVentaWS - 'DATOS DEL CLIENTE - obj.customer_name = ObjFactura.Cliente.Nombre - obj.customer_last_name1 = "" - obj.customer_last_name2 = "" - obj.customer_birthday = Nothing - obj.customer_phone = ObjFactura.Cliente.Telefono - obj.customer_email = ObjFactura.Cliente.Mail - obj.customer_gender = "03" 'OTRO GENERO - obj.customer_advertising = False - obj.customer_car_brand = "00" - obj.customer_car_model = "00" - obj.customer_car_year = ObjFactura.Fecha.Year + Protected Function GeneraPolizaVentaWS(ByRef ObjVentas As ClsVentas, ObjFactura As Modelos.Factura) As Boolean + Dim DtUsados As DataTable = Nothing - 'DATOS DE VENTA - obj.sale_date = Now - obj.sale_paidby = "01" - obj.sale_type = "01" 'PISO - obj.sale_type_service = "01" 'PARTICULAR - obj.sale_total = ObjFactura.Total - obj.sale_discount = ObjFactura.SubTotal - obj.sale_id = ObjFactura.CveVenta.ToString() + If ObjVentas.GetVentasUsadosDetalle(ObjFactura.CveVenta) Then + DtUsados = ObjVentas.DtResultados.Copy() + End If - 'DATOS DEL PRODUCTO - obj.product_code = "174925" - obj.product_unique_code = "65047187" - obj.product_sale_type = "02" 'AJUSTE + For Each Row As DataRow In DtUsados.Rows + Dim obj As New Modelos.MPolizaVentaWS + 'DATOS DEL CLIENTE + obj.customer_name = ObjFactura.Cliente.Nombre + obj.customer_last_name1 = "" + obj.customer_last_name2 = "" + obj.customer_birthday = Nothing + obj.customer_phone = ObjFactura.Cliente.Telefono + obj.customer_email = ObjFactura.Cliente.Mail + obj.customer_gender = "03" 'OTRO GENERO + obj.customer_advertising = False + obj.customer_car_brand = "00" + obj.customer_car_model = "00" + obj.customer_car_year = ObjFactura.Fecha.Year - 'DATOS DE USADO - obj.used_product = True - obj.used_brand = "01" - obj.used_bci = "25" - obj.used_month = 1 - obj.used_year = 2015 - obj.used_sale_date = ObjFactura.Fecha + 'DATOS DE VENTA + obj.sale_date = ObjFactura.Fecha + obj.sale_paidby = "01" + obj.sale_type = "01" 'PISO + obj.sale_type_service = "02" 'COMERCIAL + obj.sale_total = ObjFactura.Total + obj.sale_discount = ObjFactura.Descuento + obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta) - Return False - 'EnviarPolizaVentaWS(obj) + 'DATOS DEL PRODUCTO + obj.product_code = Row("Codigo").ToString() + obj.product_unique_code = "" 'se indique el código único de la batería. + obj.product_sale_type = "01 " 'VENTA + + Dim FechaUsado As DateTime = Row("FechaAjuste").ToString().ToDateTime() + + 'DATOS DE USADO + obj.used_product = True + obj.used_brand = Row("IdModelo").ToString() 'MARCAR DEL USADO + obj.used_bci = Row("CveBCIUsado").ToString() 'VALOR DEL BCI + obj.used_month = FechaUsado.Month + obj.used_year = FechaUsado.Year + obj.used_sale_date = FechaUsado + + EnviarPolizaVentaWS(obj) + Next + + Return True End Function Protected Sub EnviarPolizaVentaWS(obj As Modelos.MPolizaVentaWS) - Dim Retorno As String = "[]" + + Dim Respuesta As String = "[]" Dim User As String = "cslth.2809@jcilink.com" Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076" @@ -23898,14 +23912,12 @@ Partial Class Ventas Dim content As New FormUrlEncodedContent(Parametros) Dim response = wc.PostAsync(Url, content).Result - Retorno = response.Content.ReadAsStringAsync().Result + Respuesta = response.Content.ReadAsStringAsync().Result End Using Catch ex As Exception ex.GuardaLog(ex.Message) End Try - - End Sub End Class \ No newline at end of file