diff --git a/Ventas/CatPromociones.aspx b/Ventas/CatPromociones.aspx index 97dec0a5a..7e08eec13 100644 --- a/Ventas/CatPromociones.aspx +++ b/Ventas/CatPromociones.aspx @@ -57,16 +57,16 @@ - + - + - - - + + + @@ -82,25 +82,6 @@ - - + diff --git a/Ventas/CatPromociones.aspx.vb b/Ventas/CatPromociones.aspx.vb index 6c5e2393d..e5a6f525f 100644 --- a/Ventas/CatPromociones.aspx.vb +++ b/Ventas/CatPromociones.aspx.vb @@ -36,7 +36,7 @@ Partial Class Ventas_CatPromociones Private Sub CargaDatos() Dim ObjVentas As New ClsVentas - If ObjVentas.GetPromociones(-1, "-1", -1, -1, DdlEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero) Then + If ObjVentas.GetPromociones(-1, MinFecha, -1, -1, DdlEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero, CveUsuario:=UsuarioActual.CveUsuario) Then DtDatos = ObjVentas.DtResultados Else DtDatos = Nothing @@ -58,12 +58,5 @@ Partial Class Ventas_CatPromociones Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) CargaDatos() End Sub - Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - e.Row.FCHyperLink("HLPromocion").NavigateUrl = String.Format("/Ventas/Promociones.aspx?CvePromocion={0}", e.Row.DBCampo("CvePromocion")) - - End If - End Sub End Class \ No newline at end of file diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 745338230..ced8bff96 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -20,12 +20,12 @@ Partial Class Ventas_Promociones End Set End Property - Private Property TempDTOrigial As DataTable + Private Property TempDTOriginal As DataTable Get - Return CType(ViewState("TempDTOrigial"), DataTable) + Return CType(ViewState("TempDTOriginal"), DataTable) End Get Set(value As DataTable) - ViewState("TempDTOrigial") = value + ViewState("TempDTOriginal") = value End Set End Property @@ -146,8 +146,6 @@ Partial Class Ventas_Promociones End Set End Property - - #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -176,8 +174,7 @@ Partial Class Ventas_Promociones CargaDatos() LnkAgrgarPlantillaPS.Visible = False - - ValidaPromosiones(False) + 'ValidaPromociones(False) If EmpresaGrupoDiaz Then If ChkEstatus.Checked = False AndAlso BloqueadoPromocionPorcentaje AndAlso Not PermisoAutorizPromocionPorcentaje Then @@ -198,7 +195,6 @@ Partial Class Ventas_Promociones CreaDT() End If - CargaGvBitacora() @@ -346,7 +342,7 @@ Partial Class Ventas_Promociones TempDT.Columns.Add("UtilidadPorcentaje", GetType(Decimal)) - TempDTOrigial = TempDT.Copy + TempDTOriginal = TempDT.Copy '366 Estatus '367 CvePS @@ -419,7 +415,7 @@ Partial Class Ventas_Promociones Private Sub CargaDatos() Dim ObjVentas As New ClsVentas - If ObjVentas.GetPromociones(CvePromocion, "-1", -1, -1, -1, UsuarioActual.CveEmpresa, -1) AndAlso ObjVentas.DtResultados.Rows.Count = 1 Then + If ObjVentas.GetPromociones(CvePromocion, MinFecha, -1, -1, -1, UsuarioActual.CveEmpresa, -1) AndAlso ObjVentas.DtResultados.Rows.Count = 1 Then Dim Dr As DataRow = ObjVentas.DtResultados.Rows(0) TxtPromocion.Text = Dr("Promocion").ToString TxtFechaI.Text = Dr("FechaInicio").ToString.ToDate.ToShortDateString @@ -438,11 +434,6 @@ Partial Class Ventas_Promociones Else DdlClientes.SelectedValue = Dr("CveCliente").ToString End If - - - - - End If ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False) @@ -455,12 +446,12 @@ Partial Class Ventas_Promociones If ObjVentas.GetPromocionesDetalle(CvePromocion, UsuarioActual.CveEmpresa) Then TempDT = ObjVentas.DtResultados.Copy - TempDTOrigial = ObjVentas.DtResultados.Copy + TempDTOriginal = ObjVentas.DtResultados.Copy CargaGrid() Else Alert("Ocurrió un error al consultar los detalles de la promoción. Por favor vuelva a intentar.", TipoMensaje.MsgError) End If - + CargaGvBitacora() Else Alert("Ocurrió un error al consultar la promoción. Por favor vuelva a intentar.", TipoMensaje.MsgError) End If @@ -480,7 +471,6 @@ Partial Class Ventas_Promociones UpDatos.Update() End Sub - Private Sub CargaMonedas() DdlMoneda.DataSource = GlobalDTMonedas DdlMoneda.DataBind() @@ -633,8 +623,6 @@ Partial Class Ventas_Promociones Dr("UltimoCosto") = UltimoCosto Dr("CostoPromedio") = CostoPromedio - - If UltimoCosto > 0 Then Dim Promocion As Decimal = TxtPromocionConcepto.Text.ToDecimal @@ -654,12 +642,6 @@ Partial Class Ventas_Promociones Dr("UtilidadPorcentaje") = 0.0D End If - - - - - - If CveConsecutivo >= 0 Then Dr.AcceptChanges() Else @@ -669,20 +651,18 @@ Partial Class Ventas_Promociones CargaGrid() RegistraScript("$('#DivAgregar').modal('hide')") - ValidaPromosiones(True) + ValidaPromociones(True) End Sub - Private Sub ValidaPromosiones(Bloquear As Boolean) - + Private Sub ValidaPromociones(Bloquear As Boolean) If Not EmpresaGrupoDiaz Then BloqueadoPromocionPorcentaje = False Exit Sub End If - Dim DTPSUltimoCosto = New DataTable Dim ObjInv As New ClsInventarios @@ -691,8 +671,6 @@ Partial Class Ventas_Promociones End If ObjInv.Dispose() - - If PorMinMasCostoVentaFnc129 > 0 Then For Each dRow As DataRow In TempDT.Rows @@ -724,11 +702,9 @@ Partial Class Ventas_Promociones Exit For End If End If - Else BloqueadoPromocionPorcentaje = True End If - Next End If @@ -736,7 +712,6 @@ Partial Class Ventas_Promociones ChkEstatus.Checked = False ChkEstatus.Enabled = False End If - UpGenerales.Update() End Sub @@ -751,7 +726,6 @@ Partial Class Ventas_Promociones #End Region - #Region " GV PS " Private Sub GvDatos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvDatos.RowCommand @@ -835,7 +809,7 @@ Partial Class Ventas_Promociones End If - ValidaPromosiones(True) + ValidaPromociones(True) Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero) Dim ObjVentas As New ClsVentas @@ -950,7 +924,7 @@ Partial Class Ventas_Promociones - Dim Dr2 As DataRow = TempDTOrigial.FiltraParametros($"CvePromocionDetalle = {Dr("CvePromocionDetalle").ToString}").Rows(0) + Dim Dr2 As DataRow = TempDTOriginal.FiltraParametros($"CvePromocionDetalle = {Dr("CvePromocionDetalle").ToString}").Rows(0) If Not TieneError And Dr("CvePS").ToString <> Dr2("CvePS").ToString Then If Not ObjGral.AddHistorialBitacora(367, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Dr("CodigoPS").ToString, Dr2("CodigoPS").ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, "Se elimino " & Dr("CodigoPS").ToString, "PS", "", CvePromocion:=CvePromocion) Then @@ -1271,14 +1245,12 @@ Partial Class Ventas_Promociones Dim contenido As Byte() = System.IO.File.ReadAllBytes(rutaArchivoPlantilla) Response.BinaryWrite(contenido) - Response.Flush() Response.End() End Sub - Protected Sub BrnAgregarPlantilla_Click(sender As Object, e As EventArgs) If TxtExcel.getfiles().Archivos.Count > 0 Then @@ -1374,15 +1346,13 @@ Partial Class Ventas_Promociones CargaGrid() RegistraScript("$('#DivAgregarPlantilla').modal('hide')") - ValidaPromosiones(True) + ValidaPromociones(True) End Sub Private Function ValidaDTPlantilla(ByRef DTPlantilla As DataTable) As Boolean Dim Errores As New StringBuilder - - DTPlantilla.Columns.Add("CveClasificacion", GetType(Integer)) DTPlantilla.Columns.Add("CvePS", GetType(Integer)) DTPlantilla.Columns.Add("CveTipoPromosicion", GetType(Integer)) @@ -1396,13 +1366,13 @@ Partial Class Ventas_Promociones Dim DTPS As DataTable = New DataTable Dim DTRines As DataTable = New DataTable - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then - DTPS = ObjPS.DtResultados - End If - ObjPS.Dispose() - + 'Dim ObjPS As New ClsProductosServicios + 'If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then + ' DTPS = ObjPS.DtResultados + 'End If + 'ObjPS.Dispose() + DTPS = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) DTRines = GlobalDTPSRinTamaños(UsuarioActual.CveEmpresa) Dim RegistroActual As Integer = 1 @@ -1436,7 +1406,6 @@ Partial Class Ventas_Promociones If ClasificacionStr.Length > 0 And CodigoStr.Length > 0 Then SBErrorRegistro.Append($"No se puede agregar Clasificación y codigo en un mismo registro. ") Else - If ClasificacionStr.Length > 0 Then SBErrorRegistro.Append(If(CveClasificacion > 0, "", $"No se encontro Clasificación '{ClasificacionStr}'.
")) Else @@ -1513,9 +1482,7 @@ Partial Class Ventas_Promociones LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", "").FormatoNumero(4) LbPUActual.Text = DTPSUltimoCosto.FiltroPrimeroValor("Importe", "").FormatoNumero(4) - UpAgregar.Update() End Sub - End Class \ No newline at end of file