From 7eb64f0243f3d4390444bee16751f0725f02b500 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 21 Jan 2020 11:51:58 -0700 Subject: [PATCH 1/7] Correcion en ventas --- Ventas/Ventas.aspx.vb | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 7660824e9..8a00cd0f9 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6383,8 +6383,7 @@ Partial Class Ventas Continue For End If - - If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then ' si tiene relacionada una OC, + If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then 'VALIDA EXISTENCIA CveProducto = dr("CvePS").ToString.ToEntero CveUnidad = dr("CveUM").ToString.ToEntero @@ -6495,7 +6494,7 @@ Partial Class Ventas 'Valida si en caso de que el detalle tenga llantas o polizas se agreguén kilometraje/serie en la parte de observaciones(solo para el caso de empresas llanteras) If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - If txtkilometraje.text.toentero = 0 Then + If TxtKilometraje.Text.ToEntero = 0 Then 'cuando es la clasificacion de llantas Dim FaltaObservacion As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion = 20342").ToEntero If FaltaObservacion = 20342 Then @@ -6914,8 +6913,7 @@ Partial Class Ventas 'ENVIAR POLIZA VIRTUAL If ErrorList.Count = 0 Then If UsuarioActual.Empresa.Funcionalidad(576) = "1" Then - Dim TipoPoliza As Integer = 1 - GeneraPolizaVentaWS(ObjFactura, TipoPoliza) + GeneraPolizaVentaWS(ObjFactura) End If End If @@ -9168,7 +9166,7 @@ Partial Class Ventas CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)), CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM, DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False), - Kilometraje:=TxtKilometraje.Text.todouble) Then + Kilometraje:=TxtKilometraje.Text.ToDouble) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") @@ -15479,7 +15477,7 @@ Partial Class Ventas If ConSalida AndAlso Not OcurrioError Then If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then - OcurrioError = GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura) + OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura) End If If Not OcurrioError Then @@ -15804,7 +15802,7 @@ Partial Class Ventas OcurrioError = True End Try - Return OcurrioError + Return Not OcurrioError End Function Private Function SalidaAlmacenMateriales(ByRef ObjInventario As ClsInventarios, CveOS As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean @@ -23938,23 +23936,22 @@ Partial Class Ventas GvCodigosUnicos.DataBind() End If End Sub - Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura, TipoPoliza As Integer) - 'TipoPoliza: 01 Venta, 02 Ajuste, 03 Garantía + Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura) Try For Each Row As GridViewRow In GvCodigosUnicos.Rows If Row.RowType = DataControlRowType.DataRow Then Dim obj As New Modelos.MPolizaVentaWS 'DATOS DEL CLIENTE obj.customer_name = ObjFactura.Cliente.Nombre - obj.customer_last_name1 = "." + 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 = "01" - obj.customer_car_model = "01" + obj.customer_car_brand = "00" + obj.customer_car_model = "00" obj.customer_car_year = ObjFactura.Fecha.Year 'DATOS DE VENTA @@ -23964,12 +23961,12 @@ Partial Class Ventas obj.sale_type_service = "02" 'COMERCIAL obj.sale_total = ObjFactura.Total obj.sale_discount = ObjFactura.Descuento - obj.sale_id = ObjFactura.CveVenta.ToString + obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta) 'DATOS DEL PRODUCTO obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString() obj.product_unique_code = Row.FCTextBox("TxtCodigoUnico").Text 'se indique el código único de la batería. (SERIE LOTE) - obj.product_sale_type = "0" & TipoPoliza 'VENTA + obj.product_sale_type = "01 " 'VENTA Dim FechaUsado As DateTime = Row.DataKey("FechaAjuste").ToString().ToDateTime() From cf14fd17d2dcbe7159a1460f0e753821e4a8816a Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Tue, 21 Jan 2020 13:21:58 -0700 Subject: [PATCH 2/7] al darle click al label proveedor hay una propiedad que toma valor 305 si el label es acreedor --- Compras/Compras.aspx | 84 +++++++++++++++++++++++++++++------------ Compras/Compras.aspx.vb | 19 ++++++++++ 2 files changed, 78 insertions(+), 25 deletions(-) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index e79fadb0c..6e0b5e8f0 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -181,8 +181,8 @@ --%> - - Proveedor: + Proveedor: + <%--Proveedor:--%> <%-- Proveedor:--%>
@@ -407,12 +407,14 @@ Importe:
+
Saldo:
+
@@ -589,7 +591,9 @@ Cant Unidad Clasificación +     +
@@ -599,6 +603,7 @@ Observación   +
@@ -606,6 +611,7 @@
Tipo de Gasto +
@@ -657,7 +663,7 @@ <%-- 0 --%> - + @@ -773,6 +779,7 @@       + @@ -798,12 +805,14 @@ Anticipo/NC   + Mon   + @@ -883,6 +892,7 @@     + @@ -907,9 +917,9 @@ - - - Deglose 6% + + + Deglose 6% <%----%> @@ -920,7 +930,6 @@ 0% --%> - Ret. IVA: @@ -1002,6 +1011,7 @@
TC: +
@@ -1036,7 +1046,8 @@
  • Aplica consignación: - + +

  • @@ -1046,7 +1057,8 @@
  • Consignación: - + +
  • <%--
  • Folio Consignación: @@ -1308,7 +1320,8 @@
    • Tipo Cambio: - + + @@ -1707,8 +1720,10 @@ Clasificación -
      + +
      Producto/Servicio +
      @@ -1932,6 +1947,7 @@ + @@ -2023,6 +2039,7 @@ + @@ -2116,6 +2133,7 @@ Personal +
      @@ -2134,6 +2152,7 @@ + @@ -2259,7 +2278,7 @@
    - + @@ -2299,6 +2318,7 @@ @@ -3573,6 +3597,7 @@
    Tipo Cambio: +
    @@ -3813,6 +3838,7 @@
    Rembolso: + Personal/Empleado Caja Chica @@ -2568,6 +2588,7 @@ Descripción   + @@ -2665,16 +2686,16 @@
    -
    +
    - +
    -
    +
    - +

    @@ -2700,11 +2721,13 @@   +   + @@ -2857,6 +2880,7 @@

    Enviar + a otro Almacén

    +
    - + +
    @@ -4240,7 +4270,8 @@
    - + +
    <%-- @@ -4382,7 +4413,8 @@
      $ - + +
    @@ -4530,6 +4562,7 @@
    @@ -4544,6 +4577,7 @@
    @@ -5256,7 +5290,7 @@ - function chkAnt(t, txt, importe, TotalSaldo,CveMonedaAnticipo,TCAnticipo,CveMonedaOriginal) { + function chkAnt(t, txt, importe, TotalSaldo, CveMonedaAnticipo, TCAnticipo, CveMonedaOriginal) { var Total = ToDouble($get('TxtTotal').value); //TotalSaldo = Total; var txtvalue = ToDouble(txt.value); @@ -5271,7 +5305,7 @@ //var SaldoCompra = parseFloat(parseFloat($get('HdnCompraSaldo').value).toFixed(2)); var SaldoCompra = (TotalSaldo - FnSumaValoresAnt() + txtvalue).toFixed(2); // le agrego lo del valor actual para validarlo - + if (t.checked) { @@ -5600,9 +5634,9 @@ function CalculaTotalOCEdit(PS, CantidadOriginal, TxtCantidad, TxtPU, TxtTotal, IEPSOriginal, HdnIEPS, IVAOriginal, HdnIVA, RetIVAOriginal, HdnRetIVA, RetISROriginal, HdnRetISR, IEPSIVAOriginal, HdnIEPSIVA, DescuentoOriginal, HdnDescuento, IVAPorcentaje, RetIVAPorcentaje, RetISRPorcentaje, IEPSPSPorcentaje, IEPSPSIVAPorcentaje) { //var Proporcional = ((ToDouble(TxtCantidad.value) * 100) / CantidadOriginal) / 100; - + var TotalGravado = ToDouble(TxtCantidad.value) * ToDouble(TxtPU.value); - var Total = ToDouble(TxtCantidad.value) * ToDouble(TxtPU.value); + var Total = ToDouble(TxtCantidad.value) * ToDouble(TxtPU.value); HdnDescuento.value = ToDouble(DescuentoOriginal * ToDouble(TxtCantidad.value) / CantidadOriginal); if (true) { @@ -5622,7 +5656,7 @@ if (RetISROriginal > 0) { HdnRetISR.value = ToDouble(RetISRPorcentaje * (Total - ToDouble(HdnDescuento.value))); } - + TxtTotal.value = FormatoNumero(Total - ToDouble(HdnDescuento.value), 2); //RECALCULA IMPORTES GENERALES CalculaTotalesOC(); @@ -5638,7 +5672,7 @@ } function CalculaTotalesOC() { - + var SumaSubTotal = 0, SumaIEPS = 0, SumaIEPSIVA = 0, SumaIVA = 0, SumaRetIVA = 0, SumaRetISR = 0, SumaTotal = 0, SumaDescuento = 0, Amortizacion = 0; $('input[name*=TxtTotalOC1]').each(function () { diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 8fea41205..aefa1347e 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1102,6 +1102,15 @@ Partial Class Compras_Compras End Set End Property + Private Property CveConceptoContable As Integer + Get + Return ViewState("CveConceptoContable").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveConceptoContable") = value + End Set + End Property + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then 'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip") @@ -19338,4 +19347,14 @@ Partial Class Compras_Compras End Sub + Public Sub LblProveedor_OnClick(sender As Object, e As EventArgs) Handles LblProveedor.Click + If LblProveedor.Text = "Proveedor:" Then + LblProveedor.Text = "Acreedor:" + CveConceptoContable = 305 + Else + LblProveedor.Text = "Proveedor:" + CveConceptoContable = 5 + End If + End Sub + End Class \ No newline at end of file From 30d634216877d96aedfd3fa1cdd1fe2c5b9d7ef1 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Tue, 21 Jan 2020 15:46:29 -0700 Subject: [PATCH 3/7] se agrego el campo de CveConceptoContable a la tabla de compras --- App_Code/ClsCompras.vb | 4 ++-- Compras/Compras.aspx.vb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 9dcdf3eb5..c02185a18 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -191,7 +191,7 @@ Public Class ClsCompras AplicaNotaCredito As Boolean, Observaciones As String, CveEstatusCompra As Integer, CvePrePoliza As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional IdPoliza As Integer = -1, Optional CveOC As Integer = -1, Optional CveCajaChica As Integer = -1, Optional CvePersonal As Integer = -1, Optional NumeroReembolso As String = "-1", Optional CveProveedorSucursal As Integer = -1, Optional AplicoPromocion As Boolean = False, Optional PorcentajeIVA As Double = 0, Optional CveMetodoPago As Integer = -1, Optional CveRetIVAConcepto As Integer = -1, Optional CveConceptoContableAlmacen As Integer = -1, - Optional CveRetISRConcepto As Integer = -1, Optional NoDeducible As Boolean = False, Optional CveTipoCompra As Integer = -1, Optional TotalOriginal As Double = 0) As Boolean + Optional CveRetISRConcepto As Integer = -1, Optional NoDeducible As Boolean = False, Optional CveTipoCompra As Integer = -1, Optional TotalOriginal As Double = 0, Optional CveConceptoContable As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -240,7 +240,7 @@ Public Class ClsCompras .Add("@NoDeducible", SqlDbType.Bit).Value = NoDeducible .Add("@CveTipoCompra", SqlDbType.Int).Value = CveTipoCompra .Add("@TotalOriginal", SqlDbType.Money).Value = TotalOriginal - + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable End With Try diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index c312c7dee..249aacf1a 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1596,7 +1596,7 @@ Partial Class Compras_Compras HplAddClasificacion.Visible = False ImgClasificacion.Visible = False End If - + CveConceptoContable = 5 @@ -4417,7 +4417,7 @@ Partial Class Compras_Compras TxtRedondeo.Text.ToDouble, TxtTotal.Text.ToDouble, TxtFecha.Text.Trim.ToDate, DdlMoneda.SelectedValue.ToEntero, TipoCambio, TxtFechaPago.Text.Trim.ToDate, ChkAplicaNotaCredito.Checked, TxtObsFact.Text.Trim, CveEstatusFactura, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, IdPoliza, CveCajaChica:=CveCajaChica, CvePersonal:=CvePersonal, NumeroReembolso:=NumeroReembolso, CveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, AplicoPromocion:=ChkOCPromocion.Checked, PorcentajeIVA:=PorcentajeIVA, CveMetodoPago:=CveMetodoPago, CveRetIVAConcepto:=If(DdlRetIVAConcepto.Items.Count > 0, DdlRetIVAConcepto.SelectedValue.ToEntero, -1), CveConceptoContableAlmacen:=CveConceptoContableAlmacen, - CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal) Then + CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveConceptoContable:=CveConceptoContable) Then ViewState("CveCompra") = ObjCompras.CveCompra If ObjCompras.DtResultados.Rows.Count > 0 Then ViewState("CompraFolio") = ObjCompras.DtResultados.Rows(0)("vFolio").ToString From 0493a18d50512f691d71d2d87fa441593d5393e7 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 21 Jan 2020 15:54:15 -0700 Subject: [PATCH 4/7] Notificaciones Trayectos --- Ashx/SIGGPS.ashx | 156 ++++++++++++++++++++++++++++++++++- GPS/RastreoTrayectos.aspx.vb | 66 ++++++++++++--- GPS/Trayectos.aspx.vb | 135 +++++++----------------------- 3 files changed, 237 insertions(+), 120 deletions(-) diff --git a/Ashx/SIGGPS.ashx b/Ashx/SIGGPS.ashx index f9736c0e1..a58642f67 100644 --- a/Ashx/SIGGPS.ashx +++ b/Ashx/SIGGPS.ashx @@ -18,7 +18,9 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState Case "getimginstalacion" GetImgInstalacion(context) Case "EjecutarNotificaciones" - EjecutarNotificaciones(context) + EjecutarNotificaciones(context) + Case "EjecutaTrayectos" + EnviarCorreoTrayectos(context, context.Request("CveTrayecto").ToString().ToEntero()) End Select ElseIf context.Request.InputStream IsNot Nothing Then Using reader As New StreamReader(context.Request.InputStream) @@ -224,5 +226,155 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState ) Return Json - End Function + End Function + +#Region "N O T F I C A C I O N - T R A Y E C T O S" + Private Sub EnviarCorreoTrayectos(ByVal context As HttpContext, CveTrayecto As Integer) + Dim Retorno As JObject = New JObject(New JProperty("EnvioCorreo", False), New JProperty("Mensaje", "")) + + Dim DtInfoTrayecto As DataTable = Nothing + Dim DtTrayecto As DataTable = Nothing + + Using ObjGPS As New ClsGPS + If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then + DtTrayecto = ObjGPS.DtResultados.Copy() + End If + + If ObjGPS.GetTrayectosDatos(CveTrayecto) Then + DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy() + End If + End Using + + If DtTrayecto IsNot Nothing AndAlso DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then + Dim RowTrayecto As DataRow = DtTrayecto.Rows(0) + Dim RowInfo As DataRow = DtInfoTrayecto.Rows(0) + + Dim EnviarLiga As Boolean = CBool(RowTrayecto("EnviarLiga").ToString()) + + Dim Asunto As String = "Estatus de Trayecto" + Dim Cuerpo As String = GeneraCorreo(CveTrayecto, EnviarLiga, RowInfo) + Dim Correos As String = RowTrayecto("CorreosNotificacion").ToString() + + Dim ObjMail As New ClsSisMail + If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, Asunto, Cuerpo) Then + Retorno("EnvioCorreo") = True + Retorno("Mensaje") = "El correo fue enviado correctamente" + Else + Retorno("EnvioCorreo") = False + Retorno("Mensaje") = "Ocurrió un error al enviar el correo" + End If + + End If + + context.Response.Write(Retorno.ToString()) + End Sub + + Protected Function GeneraCorreo(CveTrayecto As Integer, EnviarLiga As Boolean, Row As DataRow) As String + Dim strBody As New StringBuilder + Try + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append("
    ") + strBody.Append("
    Datos del Trayecto") + strBody.Append("
    Número de Reembolso: + @@ -4036,6 +4062,7 @@ Saldo   + @@ -4043,6 +4070,7 @@ Fecha   + @@ -4104,13 +4132,15 @@
    ") + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("Trayecto")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("Vehiculo")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("Estatus")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("LatitudActual")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("LongitudActual")) + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Row("LatitudActual"), Row("LongitudActual")) + strBody.Append("") + If EnviarLiga Then + strBody.Append("") + strBody.Append("") + strBody.AppendFormat("", Encripta($"CveTrayecto={Row("CveTrayecto").ToString()}")) + strBody.Append("") + End If + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.Append("") + strBody.Append("
     Trayecto: {0}
     Vehículo: {0}strong>
     Estatus: {0}
     Latitud: {0}
     Longitud: {0}
     Posición: Ver en google maps
     Rastreo: Rastrear Vehículo
    ") + strBody.Append("
") + strBody.Append("
") + strBody.Append(" ") + strBody.Append("
") + strBody.Append("
") + strBody.Append("") + Catch ex As Exception + OnError("Ocurrio un error al general el correo.", ex) + End Try + Return strBody.ToString() + End Function +#End Region + End Class \ No newline at end of file diff --git a/GPS/RastreoTrayectos.aspx.vb b/GPS/RastreoTrayectos.aspx.vb index 46c849a09..96c2666bd 100644 --- a/GPS/RastreoTrayectos.aspx.vb +++ b/GPS/RastreoTrayectos.aspx.vb @@ -13,6 +13,14 @@ Partial Class GPS_RastreoTrayectos Inherits Page #Region "P R O P I E D A D E S" + Private Property RastreoValido As Boolean + Get + Return CType(ViewState("RastreoValido"), Boolean) + End Get + Set(value As Boolean) + ViewState("RastreoValido") = value + End Set + End Property Private Property TrazarLineaContinuo As Boolean Get Return CType(ViewState("TrazarLineaContinuo"), Boolean) @@ -87,12 +95,19 @@ Partial Class GPS_RastreoTrayectos Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then RegistraScript("$('#SideNav').click();initMap();") - Me.CveTrayecto = 97 - - CreaDTPosiciones() - CargaDatos() - RastrearEquipos() - CargaTabla() + If Request("P") IsNot Nothing Then + Dim URLParametros = Parametros(Decripta((Request("P").ToString))) + Me.CveTrayecto = URLParametros("CVETRAYECTO").ToString().ToEntero() + CargaDatos() + If RastreoValido Then + TrazarLineaContinuo = True + CreaDTCoordenadas() + CreaDTPosiciones() + RastrearEquipos() + CargaTabla() + End If + + End If End If End Sub Private Sub CreaDTPosiciones() @@ -123,16 +138,19 @@ Partial Class GPS_RastreoTrayectos Using ObjGPS As New ClsGPS If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then Dim Row As DataRow = ObjGPS.DtResultados.Rows(0) + Me.CveDispositivo = Row("CveDispositivo").ToString().ToEntero() Me.CveCliente = Row("CveCliente").ToString().ToEntero() + Me.RastreoValido = Not CBool(Row("EsFin")) + End If End Using - TrazarLineaContinuo = True - CreaDTCoordenadas() End Sub Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs) DtPosiciones.Rows.Clear() RegistraScript("DeleteMarkers();") + + Dim LastCoord As String = "" Dim TmpDT As New DataTable Dim Info = "" @@ -143,6 +161,14 @@ Partial Class GPS_RastreoTrayectos Dim ObjGPS As New ClsGPS Try + If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then + Dim Row As DataRow = ObjGPS.DtResultados.Rows(0) + Me.RastreoValido = Not CBool(Row("EsFin")) + End If + If Not RastreoValido Then + Alert("El trayecto ha sido finalizado.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If Dim RowVehiculo As DataRow = GlobalDTDispositivos(CveCliente).FiltroPrimero($"CveDispositivo = {CveDispositivo}") If ObjGPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha) Then @@ -178,7 +204,12 @@ Partial Class GPS_RastreoTrayectos OnError("Ocurrió un error al rastrear equipo", ex) End Try End Sub - Private Sub RastrearEquipos() + Private Sub RastrearEquipos() + If Not RastreoValido Then + Alert("El trayecto ha sido finalizado.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim LastCoord As String = "" Dim TmpDT As New DataTable Dim Info = "" @@ -217,7 +248,6 @@ Partial Class GPS_RastreoTrayectos End Try ObjGPS.Dispose() End Sub - Private Sub CargaTabla() If DtPosiciones IsNot Nothing Then GvBarra.DataSource = DtPosiciones @@ -229,7 +259,6 @@ Partial Class GPS_RastreoTrayectos GvBarra.HeaderRow.Cells(4).Style.Add("display", "none !important") End If End Sub - Private Sub AddRowCoordenadasContinuas(Coord As String, CveDispositivo As Integer) Dim dr As DataRow = DtCoordenadasContinuas.NewRow() dr("CveDispositivo") = CveDispositivo @@ -333,8 +362,19 @@ Partial Class GPS_RastreoTrayectos RegistraScript("setTimeout(function(){OpcionesHistorico();},500);") End Sub - - + Private Function Parametros(Cadena As String) As Hashtable + Dim P1() As String = Cadena.Split("&"c) + Dim Tmp As String + Dim P2() As String + + Dim URLParametros As New Hashtable + + For Each Tmp In P1 + P2 = Tmp.Replace("%26%", "&").Split("="c) + URLParametros.Add(P2(0).ToString.ToUpper, P2(1)) + Next + Return URLParametros + End Function Public Sub RegistraScript(Script As String, Optional valuetick As String = "") Dim Rdm As Random = New Random() ScriptManager.RegisterStartupScript(Page, Me.GetType(), String.Format("{0}{1}{2}", (DateTime.Now.Ticks + 1), Rdm.Next(), valuetick), String.Format("", Script), False) diff --git a/GPS/Trayectos.aspx.vb b/GPS/Trayectos.aspx.vb index a1977fccd..ac950d613 100644 --- a/GPS/Trayectos.aspx.vb +++ b/GPS/Trayectos.aspx.vb @@ -8,10 +8,11 @@ Imports Extensiones Imports Microsoft.Reporting.WebForms Imports Newtonsoft.Json.Linq Imports System.Linq - +Imports System.Net.Http + Partial Class GPS_Trayectos - Inherits ClsPaginas - + Inherits ClsPaginas + #Region "P R O P I E D A D E S" Private Property DtGeocercasAgregar As DataTable Get @@ -36,9 +37,9 @@ Partial Class GPS_Trayectos Set(value As DataTable) ViewState("DtPosiciones") = value End Set - End Property + End Property #End Region - + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True @@ -276,12 +277,12 @@ Partial Class GPS_Trayectos Private Sub LimpiaCampos() TxtNombre.Text = "" DdlDispositivo.SelectedIndex = 0 - End Sub - + End Sub + #Region "C O N S U L T A " Protected Sub LnkConsultar_Click(sender As Object, e As EventArgs) CargaTrayectos() - End Sub + End Sub #End Region Protected Sub GvBarra_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then @@ -413,105 +414,29 @@ Partial Class GPS_Trayectos Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim CveTrayecto As Integer = GvRow.DataKey("CveTrayecto").ToEntero() - Dim EnviarLiga As Boolean = CBool(GvRow.DataKey("EnviarLiga")) If CveTrayecto > 0 Then - Dim DtInfoTrayecto As DataTable = Nothing - Using ObjGPS As New ClsGPS - If ObjGPS.GetTrayectosDatos(CveTrayecto) Then - DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy() + Dim Url = New Uri(String.Format("{0}/ashx/SIGGPS.ashx?metodo=EjecutaTrayectos&CveTrayecto={1}", "https://gps.signalsgps.com", CveTrayecto)) + Dim Retorno As String = "{}" + Try + Using httpClient = New HttpClient() + httpClient.Timeout = New TimeSpan(0, 0, 15) + Using request = New HttpRequestMessage(HttpMethod.Get, Url) + Dim response = httpClient.SendAsync(request).Result + If response.StatusCode = Net.HttpStatusCode.OK Then + Retorno = response.Content.ReadAsStringAsync().Result + End If + End Using + End Using + + Dim Resp = JObject.Parse(Retorno) + If CBool(Resp("EnvioCorreo").ToString()) Then + Alert(Resp("Mensaje").ToString(), TipoMensaje.MsgInformacion) + Else + Alert(Resp("Mensaje").ToString(), TipoMensaje.MsgError) End If - End Using - If DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then - Dim Row As DataRow = DtInfoTrayecto.Rows(0) - GeneraCorreo(CveTrayecto, EnviarLiga, Row) - End If + Catch ex As Exception + OnError("Ocurrió un error al descargar la factura", ex) + End Try End If End Sub - - Protected Function GeneraCorreo(CveTrayecto As Integer, EnviarLiga As Boolean, Row As DataRow) As String - Dim strBody As New StringBuilder - Try - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append("
") - strBody.Append(" ") - strBody.Append("
") - strBody.Append("
Datos del Trayecto ") - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Row("Trayecto")) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Row("Vehiculo")) - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Row("Estatus")) - strBody.Append(" ") - If EnviarLiga Then - strBody.Append(" ") - strBody.AppendFormat(" ", String.Format("http://gps.signalsgps.com/GPS/RastreoTrayectos.aspx?P={0}", Encripta($"CveTrayecto={CveTrayecto}"))) - strBody.Append(" ") - End If - strBody.Append(" ") - strBody.AppendFormat(" ", Row("LigaImagen")) - strBody.Append(" ") - strBody.Append("
Trayecto:{0}
Vehículo:{0}
Estatus:{0}
Rastrea Equipo:{0}
Posición:
") - strBody.Append("
") - strBody.Append("
") - strBody.Append(" ") - strBody.Append("
") - strBody.Append("
") - strBody.Append("") - Catch ex As Exception - OnError("Ocurrio un error al general el correo.", ex) - End Try - Return strBody.ToString() - End Function End Class From eb74aceac9b75e811533eb79f33196d2d0221c83 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 22 Jan 2020 10:12:51 -0700 Subject: [PATCH 5/7] Cambio de nombre de CveConceptoContable ahora es CveTipoConcepto --- App_Code/ClsCompras.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index c02185a18..f35f52a0b 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -240,7 +240,7 @@ Public Class ClsCompras .Add("@NoDeducible", SqlDbType.Bit).Value = NoDeducible .Add("@CveTipoCompra", SqlDbType.Int).Value = CveTipoCompra .Add("@TotalOriginal", SqlDbType.Money).Value = TotalOriginal - .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .Add("@CveTipoConcepto", SqlDbType.Int).Value = CveConceptoContable End With Try From 98af8ea8cc4a76cbf6598f2441d3444eb65d1a0a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 22 Jan 2020 13:05:19 -0700 Subject: [PATCH 6/7] Redondeo SQL --- Ventas/Ventas.aspx.vb | 78 ++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 8a00cd0f9..2d40eee5b 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5938,16 +5938,17 @@ Partial Class Ventas Dim ClienteRetIVA = Me.ClienteRetIVA If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then - ClienteRetIVA = 0.0D - If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then - ClienteRetIVA = 0.106667D - ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then - ClienteRetIVA = 0.04D - ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(TmpDT.Rows(e.RowIndex)("EsOutSourcing").ToString()) Then - ClienteRetIVA = 0.06D + 'ClienteRetIVA = 0.0D + If ClienteRetIVA <= 0 Then + If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then + ClienteRetIVA = 0.106667D + ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then + ClienteRetIVA = 0.04D + ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(TmpDT.Rows(e.RowIndex)("EsOutSourcing").ToString()) Then + ClienteRetIVA = 0.06D + End If End If - - LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero + ' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero DdlTipoRetencion.Visible = True End If @@ -5959,11 +5960,11 @@ Partial Class Ventas TmpDT.Rows(e.RowIndex)("TiempoEntrega") = GvPS.Rows(e.RowIndex).FCTextBox("TxtTiempoEntrega").Text.Trim TmpDT.Rows(e.RowIndex)("PU") = PU TmpDT.Rows(e.RowIndex)("Descuento") = Descuento - TmpDT.Rows(e.RowIndex)("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) - TmpDT.Rows(e.RowIndex)("ImporteIVA") = Math.Round(TmpDT.Rows(e.RowIndex)("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales) - TmpDT.Rows(e.RowIndex)("ImporteIEPS") = Math.Round(TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) - TmpDT.Rows(e.RowIndex)("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) - TmpDT.Rows(e.RowIndex)("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) + TmpDT.Rows(e.RowIndex)("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) + TmpDT.Rows(e.RowIndex)("ImporteIVA") = (TmpDT.Rows(e.RowIndex)("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + TmpDT.Rows(e.RowIndex)("ImporteIEPS") = (TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + TmpDT.Rows(e.RowIndex)("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + TmpDT.Rows(e.RowIndex)("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) TmpDT.Rows(e.RowIndex)("PorcentajeRetIVA") = ClienteRetIVA TmpDT.Rows(e.RowIndex)("PorcentajeRetISR") = ClienteRetISR TmpDT.Rows(e.RowIndex)("CuentaPredial") = CuentaPredial @@ -14258,32 +14259,36 @@ Partial Class Ventas Dim ClienteRetIVA = Me.ClienteRetIVA If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then - ClienteRetIVA = 0.0D - If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then - ClienteRetIVA = 0.106667D - ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then - ClienteRetIVA = 0.04D - ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(DrPS("EsOutSourcing").ToString()) Then - ClienteRetIVA = 0.06D + 'ClienteRetIVA = 0.0D + If ClienteRetIVA <= 0 Then + If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then + ClienteRetIVA = 0.106667D + ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then + ClienteRetIVA = 0.04D + ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(DrPS("EsOutSourcing").ToString()) Then + ClienteRetIVA = 0.06D + End If + End If - LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero + ' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero DdlTipoRetencion.Visible = True End If Row("IVA") = Row("PorcentajeIVA") - Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) + Row("ImporteIVA") = (Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) Row("PorcentajeRetIVA") = ClienteRetIVA Row("PorcentajeRetISR") = ClienteRetISR Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") - Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) Row("IEPS") = Row("ImporteIEPS") - Row("Descuento") = Math.Round(Descuento, NumeroDecimales) + Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales) Row("TipoDescuento") = HdnTipoDescuento.Value Row("Total") = (Cantidad * PU) - Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) + Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) + 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") ' Row("IdCtaContVentas") = IdCtaContable ' Row("AplicaParaConcepto") = AplicaParaConcepto @@ -24065,13 +24070,16 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then For Each RowServicio As DataRow In TmpDT.Rows - Dim ClienteRetIVA = 0.0D - If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then - ClienteRetIVA = 0.106667D - ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then - ClienteRetIVA = 0.04D - ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then - ClienteRetIVA = 0.06D + Dim tClienteRetIVA = ClienteRetIVA + If tClienteRetIVA <= 0 Then + If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then + tClienteRetIVA = 0.106667D + ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then + tClienteRetIVA = 0.04D + ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then + tClienteRetIVA = 0.06D + End If + ViewState("ClienteRetIVA") = tClienteRetIVA End If Dim TotalCalculableImpuestos As Decimal = (RowServicio("Cantidad").ToString().ToDecimal() * RowServicio("PU").ToString().ToDecimal()) - RowServicio("Descuento").ToString().ToDecimal() From 094dc5abe30e4c7e5055c2c3e3af44073cb226df Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 22 Jan 2020 15:34:29 -0700 Subject: [PATCH 7/7] =?UTF-8?q?se=20agreg=C3=B3=20el=20campo=20tipo=20apli?= =?UTF-8?q?caci=C3=B3n=20en=20las=20promociones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsVentas.vb | 3 ++- Ventas/Promociones.aspx | 11 +++++++++++ Ventas/Promociones.aspx.vb | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 25fb3c073..5e5e7fc56 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1873,7 +1873,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer) As Integer + Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoAplicacion As String) As Integer Dim Retorno = -1 DataAdapter("PA_Vta_PromocionesAdd") @@ -1889,6 +1889,7 @@ Public Class ClsVentas .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@TipoAplicacion", SqlDbType.VarChar).Value = TipoAplicacion .Add("@CvePromocion", SqlDbType.Int).Direction = ParameterDirection.Output End With diff --git a/Ventas/Promociones.aspx b/Ventas/Promociones.aspx index b1fe35644..6ed0aabef 100644 --- a/Ventas/Promociones.aspx +++ b/Ventas/Promociones.aspx @@ -128,6 +128,17 @@ + +
+ +
+ + Seleccione + Descuento + PU + +
+
diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 6b7e1941d..abb594cff 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -380,7 +380,9 @@ Partial Class Ventas_Promociones Dim ObjVentas As New ClsVentas Dim TieneError = False ObjVentas.IniciaTransacSQL() - CvePromocion = ObjVentas.AddPromociones(TxtPromocion.Text.Trim, If(IsDate(TxtFechaI.Text), TxtFechaI.Text.ToDate, MinFecha), If(IsDate(TxtFechaF.Text), TxtFechaF.Text.ToDate, MaxFecha), DdlVendedor.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, ChkEstatus.Checked, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero) + CvePromocion = ObjVentas.AddPromociones(TxtPromocion.Text.Trim, If(IsDate(TxtFechaI.Text), TxtFechaI.Text.ToDate, MinFecha), If(IsDate(TxtFechaF.Text), TxtFechaF.Text.ToDate, MaxFecha), + DdlVendedor.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, ChkEstatus.Checked, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero, DdlTipoAplicacion.SelectedValue.ToString) If CvePromocion > 0 Then For Each Dr As DataRow In TempDT.Rows