From 6e58da32af9ee57fc85bf4448199c8a1e0126fe8 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 11 Mar 2021 16:22:20 -0700 Subject: [PATCH] =?UTF-8?q?Correcion=20de=20filtro=20por=20A=C3=B1o/Mes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ventas/RepProductosServiciosDetalle.aspx.vb | 32 +++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Ventas/RepProductosServiciosDetalle.aspx.vb b/Ventas/RepProductosServiciosDetalle.aspx.vb index 2a8e14c21..c176dfad1 100644 --- a/Ventas/RepProductosServiciosDetalle.aspx.vb +++ b/Ventas/RepProductosServiciosDetalle.aspx.vb @@ -341,11 +341,39 @@ Partial Class Ventas_RepProductosServiciosDetalle If AnioMes.Trim.Length = 7 Then txtFechaI.Text = If(AnioMes <> "-1", String.Format("01/{0}/{1}", AnioMes.Substring(5, 2).PadLeft(2, "0"c), AnioMes.Substring(0, 4)), txtFechaI.Text) FechaFtemporal = $"01/{AnioMes.Substring(5, 2).PadLeft(2, "0"c)}/{AnioMes.Substring(0, 4)}" - txtFechaF.Text = String.Format("{2}/{0}/{1}", AnioMes.Substring(5, 2).PadLeft(2, "0"c), AnioMes.Substring(0, 4), FechaFtemporal.ToDate.LastDayOfMonth.Day) + + If FechaF = "-1" Then + txtFechaF.Text = String.Format("{2}/{0}/{1}", AnioMes.Substring(5, 2).PadLeft(2, "0"c), AnioMes.Substring(0, 4), FechaFtemporal.ToDate.LastDayOfMonth.Day) + Else + Dim FechaFRef As DateTime = FechaF.ToDateTime + Dim FechaFMonth As DateTime = String.Format("{2}/{0}/{1}", AnioMes.Substring(5, 2).PadLeft(2, "0"c), AnioMes.Substring(0, 4), FechaFtemporal.ToDate.LastDayOfMonth.Day).ToDate() + + If FechaFRef > FechaFMonth Then + txtFechaF.Text = FechaFMonth.ToString("dd/MM/yyyy") + Else + txtFechaF.Text = FechaFRef.ToString("dd/MM/yyyy") + End If + + End If + Else txtFechaI.Text = If(AnioMes <> "-1", String.Format("01/{0}/{1}", AnioMes.Substring(5, 1).PadLeft(2, "0"c), AnioMes.Substring(0, 4)), txtFechaI.Text) FechaFtemporal = $"01/{AnioMes.Substring(5, 1).PadLeft(2, "0"c)}/{AnioMes.Substring(0, 4)}" - txtFechaF.Text = String.Format("{2}/{0}/{1}", AnioMes.Substring(5, 1).PadLeft(2, "0"c), AnioMes.Substring(0, 4), FechaFtemporal.ToDate.LastDayOfMonth.Day) + + If FechaF = "-1" Then + txtFechaF.Text = String.Format("{2}/{0}/{1}", AnioMes.Substring(5, 1).PadLeft(2, "0"c), AnioMes.Substring(0, 4), FechaFtemporal.ToDate.LastDayOfMonth.Day) + Else + Dim FechaFRef As DateTime = FechaF.ToDateTime + Dim FechaFMonth As DateTime = String.Format("{2}/{0}/{1}", AnioMes.Substring(5, 1).PadLeft(2, "0"c), AnioMes.Substring(0, 4), FechaFtemporal.ToDate.LastDayOfMonth.Day).ToDate + + If FechaFRef > FechaFMonth Then + txtFechaF.Text = FechaFMonth.ToString("dd/MM/yyyy") + Else + txtFechaF.Text = FechaFRef.ToString("dd/MM/yyyy") + End If + End If + + End If End If