-- filtro de promciones

This commit is contained in:
2024-12-27 22:10:00 -07:00
parent 0035ae33ed
commit 125447db65
3 changed files with 26 additions and 85 deletions

View File

@@ -57,16 +57,16 @@
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvDatos" CssClass="table table-striped table-hover" runat="server" AutoGenerateColumns="False" GridLines="None"> <asp:GridView ID="GvDatos" CssClass="table table-striped table-hover Widthall ScrollAD" data-sort="true" runat="server" AutoGenerateColumns="False" GridLines="None">
<Columns> <Columns>
<asp:TemplateField HeaderText="Promoción" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="Promoción" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <ItemTemplate>
<asp:HyperLink runat="server" ID="HLPromocion" Text='<%# Eval("Promocion").ToString %>' CssClass="Texto"></asp:HyperLink> <asp:HyperLink runat="server" ID="HLPromocion" Text='<%# Eval("Promocion").ToString %>' NavigateUrl ='<%# Eval("CvePromocion", "/Ventas/Promociones.aspx?CvePromocion={0}") %>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="FechaInicio" DataFormatString="{0:d}" HeaderText="F. Inicio" ItemStyle-Width="70px" /> <asp:BoundField DataField="FechaInicio" DataFormatString="{0:d}" HeaderText="F. Inicio" ItemStyle-Width="80px" />
<asp:BoundField DataField="FechaFin" DataFormatString="{0:d}" HeaderText="F. Fin" ItemStyle-Width="70px" /> <asp:BoundField DataField="FechaFin" DataFormatString="{0:d}" HeaderText="F. Fin" ItemStyle-Width="80px" />
<asp:BoundField DataField="SubProyecto" HeaderText="SubProyecto" ItemStyle-Width="100px" /> <asp:BoundField DataField="SubProyecto" HeaderText="Sucursal" ItemStyle-Width="125px" />
<asp:TemplateField HeaderText="Estatus" ItemStyle-Width="70px"> <asp:TemplateField HeaderText="Estatus" ItemStyle-Width="70px">
<ItemTemplate> <ItemTemplate>
<asp:Label runat="server" ID="LbEstatus" Text='<%#If(Eval("Estatus").ToString = "True", "Activo", "Inactivo") %>' /> <asp:Label runat="server" ID="LbEstatus" Text='<%#If(Eval("Estatus").ToString = "True", "Activo", "Inactivo") %>' />
@@ -83,24 +83,5 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
function pageLoad() {
$(document).ready(function () {
gridviewScroll();
});
function gridviewScroll() {
var Tam = TamañoVentana();
var Alto = Tam.height - 210;
$('#<%=GvDatos.ClientID%>').gridviewScroll({
width: 995,
height: Alto,
freezesize: 1,
headerrowcount: 1
});
}
}
</script>
</asp:Content> </asp:Content>

View File

@@ -36,7 +36,7 @@ Partial Class Ventas_CatPromociones
Private Sub CargaDatos() Private Sub CargaDatos()
Dim ObjVentas As New ClsVentas 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 DtDatos = ObjVentas.DtResultados
Else Else
DtDatos = Nothing DtDatos = Nothing
@@ -58,12 +58,5 @@ Partial Class Ventas_CatPromociones
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos() CargaDatos()
End Sub 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 End Class

View File

@@ -20,12 +20,12 @@ Partial Class Ventas_Promociones
End Set End Set
End Property End Property
Private Property TempDTOrigial As DataTable Private Property TempDTOriginal As DataTable
Get Get
Return CType(ViewState("TempDTOrigial"), DataTable) Return CType(ViewState("TempDTOriginal"), DataTable)
End Get End Get
Set(value As DataTable) Set(value As DataTable)
ViewState("TempDTOrigial") = value ViewState("TempDTOriginal") = value
End Set End Set
End Property End Property
@@ -146,8 +146,6 @@ Partial Class Ventas_Promociones
End Set End Set
End Property End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -176,8 +174,7 @@ Partial Class Ventas_Promociones
CargaDatos() CargaDatos()
LnkAgrgarPlantillaPS.Visible = False LnkAgrgarPlantillaPS.Visible = False
'ValidaPromociones(False)
ValidaPromosiones(False)
If EmpresaGrupoDiaz Then If EmpresaGrupoDiaz Then
If ChkEstatus.Checked = False AndAlso BloqueadoPromocionPorcentaje AndAlso Not PermisoAutorizPromocionPorcentaje Then If ChkEstatus.Checked = False AndAlso BloqueadoPromocionPorcentaje AndAlso Not PermisoAutorizPromocionPorcentaje Then
@@ -198,7 +195,6 @@ Partial Class Ventas_Promociones
CreaDT() CreaDT()
End If End If
CargaGvBitacora()
@@ -346,7 +342,7 @@ Partial Class Ventas_Promociones
TempDT.Columns.Add("UtilidadPorcentaje", GetType(Decimal)) TempDT.Columns.Add("UtilidadPorcentaje", GetType(Decimal))
TempDTOrigial = TempDT.Copy TempDTOriginal = TempDT.Copy
'366 Estatus '366 Estatus
'367 CvePS '367 CvePS
@@ -419,7 +415,7 @@ Partial Class Ventas_Promociones
Private Sub CargaDatos() Private Sub CargaDatos()
Dim ObjVentas As New ClsVentas 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) Dim Dr As DataRow = ObjVentas.DtResultados.Rows(0)
TxtPromocion.Text = Dr("Promocion").ToString TxtPromocion.Text = Dr("Promocion").ToString
TxtFechaI.Text = Dr("FechaInicio").ToString.ToDate.ToShortDateString TxtFechaI.Text = Dr("FechaInicio").ToString.ToDate.ToShortDateString
@@ -438,11 +434,6 @@ Partial Class Ventas_Promociones
Else Else
DdlClientes.SelectedValue = Dr("CveCliente").ToString DdlClientes.SelectedValue = Dr("CveCliente").ToString
End If End If
End If End If
ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False) ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False)
@@ -455,12 +446,12 @@ Partial Class Ventas_Promociones
If ObjVentas.GetPromocionesDetalle(CvePromocion, UsuarioActual.CveEmpresa) Then If ObjVentas.GetPromocionesDetalle(CvePromocion, UsuarioActual.CveEmpresa) Then
TempDT = ObjVentas.DtResultados.Copy TempDT = ObjVentas.DtResultados.Copy
TempDTOrigial = ObjVentas.DtResultados.Copy TempDTOriginal = ObjVentas.DtResultados.Copy
CargaGrid() CargaGrid()
Else Else
Alert("Ocurrió un error al consultar los detalles de la promoción. Por favor vuelva a intentar.", TipoMensaje.MsgError) Alert("Ocurrió un error al consultar los detalles de la promoción. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If End If
CargaGvBitacora()
Else Else
Alert("Ocurrió un error al consultar la promoción. Por favor vuelva a intentar.", TipoMensaje.MsgError) Alert("Ocurrió un error al consultar la promoción. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If End If
@@ -480,7 +471,6 @@ Partial Class Ventas_Promociones
UpDatos.Update() UpDatos.Update()
End Sub End Sub
Private Sub CargaMonedas() Private Sub CargaMonedas()
DdlMoneda.DataSource = GlobalDTMonedas DdlMoneda.DataSource = GlobalDTMonedas
DdlMoneda.DataBind() DdlMoneda.DataBind()
@@ -633,8 +623,6 @@ Partial Class Ventas_Promociones
Dr("UltimoCosto") = UltimoCosto Dr("UltimoCosto") = UltimoCosto
Dr("CostoPromedio") = CostoPromedio Dr("CostoPromedio") = CostoPromedio
If UltimoCosto > 0 Then If UltimoCosto > 0 Then
Dim Promocion As Decimal = TxtPromocionConcepto.Text.ToDecimal Dim Promocion As Decimal = TxtPromocionConcepto.Text.ToDecimal
@@ -654,12 +642,6 @@ Partial Class Ventas_Promociones
Dr("UtilidadPorcentaje") = 0.0D Dr("UtilidadPorcentaje") = 0.0D
End If End If
If CveConsecutivo >= 0 Then If CveConsecutivo >= 0 Then
Dr.AcceptChanges() Dr.AcceptChanges()
Else Else
@@ -669,20 +651,18 @@ Partial Class Ventas_Promociones
CargaGrid() CargaGrid()
RegistraScript("$('#DivAgregar').modal('hide')") RegistraScript("$('#DivAgregar').modal('hide')")
ValidaPromosiones(True) ValidaPromociones(True)
End Sub End Sub
Private Sub ValidaPromosiones(Bloquear As Boolean) Private Sub ValidaPromociones(Bloquear As Boolean)
If Not EmpresaGrupoDiaz Then If Not EmpresaGrupoDiaz Then
BloqueadoPromocionPorcentaje = False BloqueadoPromocionPorcentaje = False
Exit Sub Exit Sub
End If End If
Dim DTPSUltimoCosto = New DataTable Dim DTPSUltimoCosto = New DataTable
Dim ObjInv As New ClsInventarios Dim ObjInv As New ClsInventarios
@@ -691,8 +671,6 @@ Partial Class Ventas_Promociones
End If End If
ObjInv.Dispose() ObjInv.Dispose()
If PorMinMasCostoVentaFnc129 > 0 Then If PorMinMasCostoVentaFnc129 > 0 Then
For Each dRow As DataRow In TempDT.Rows For Each dRow As DataRow In TempDT.Rows
@@ -724,11 +702,9 @@ Partial Class Ventas_Promociones
Exit For Exit For
End If End If
End If End If
Else Else
BloqueadoPromocionPorcentaje = True BloqueadoPromocionPorcentaje = True
End If End If
Next Next
End If End If
@@ -736,7 +712,6 @@ Partial Class Ventas_Promociones
ChkEstatus.Checked = False ChkEstatus.Checked = False
ChkEstatus.Enabled = False ChkEstatus.Enabled = False
End If End If
UpGenerales.Update() UpGenerales.Update()
End Sub End Sub
@@ -751,7 +726,6 @@ Partial Class Ventas_Promociones
#End Region #End Region
#Region " GV PS " #Region " GV PS "
Private Sub GvDatos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvDatos.RowCommand Private Sub GvDatos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvDatos.RowCommand
@@ -835,7 +809,7 @@ Partial Class Ventas_Promociones
End If End If
ValidaPromosiones(True) ValidaPromociones(True)
Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero) Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero)
Dim ObjVentas As New ClsVentas 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 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 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) Dim contenido As Byte() = System.IO.File.ReadAllBytes(rutaArchivoPlantilla)
Response.BinaryWrite(contenido) Response.BinaryWrite(contenido)
Response.Flush() Response.Flush()
Response.End() Response.End()
End Sub End Sub
Protected Sub BrnAgregarPlantilla_Click(sender As Object, e As EventArgs) Protected Sub BrnAgregarPlantilla_Click(sender As Object, e As EventArgs)
If TxtExcel.getfiles().Archivos.Count > 0 Then If TxtExcel.getfiles().Archivos.Count > 0 Then
@@ -1374,15 +1346,13 @@ Partial Class Ventas_Promociones
CargaGrid() CargaGrid()
RegistraScript("$('#DivAgregarPlantilla').modal('hide')") RegistraScript("$('#DivAgregarPlantilla').modal('hide')")
ValidaPromosiones(True) ValidaPromociones(True)
End Sub End Sub
Private Function ValidaDTPlantilla(ByRef DTPlantilla As DataTable) As Boolean Private Function ValidaDTPlantilla(ByRef DTPlantilla As DataTable) As Boolean
Dim Errores As New StringBuilder Dim Errores As New StringBuilder
DTPlantilla.Columns.Add("CveClasificacion", GetType(Integer)) DTPlantilla.Columns.Add("CveClasificacion", GetType(Integer))
DTPlantilla.Columns.Add("CvePS", GetType(Integer)) DTPlantilla.Columns.Add("CvePS", GetType(Integer))
DTPlantilla.Columns.Add("CveTipoPromosicion", GetType(Integer)) DTPlantilla.Columns.Add("CveTipoPromosicion", GetType(Integer))
@@ -1396,13 +1366,13 @@ Partial Class Ventas_Promociones
Dim DTPS As DataTable = New DataTable Dim DTPS As DataTable = New DataTable
Dim DTRines As DataTable = New DataTable Dim DTRines As DataTable = New DataTable
Dim ObjPS As New ClsProductosServicios 'Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then 'If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then
DTPS = ObjPS.DtResultados ' DTPS = ObjPS.DtResultados
End If 'End If
ObjPS.Dispose() 'ObjPS.Dispose()
DTPS = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
DTRines = GlobalDTPSRinTamaños(UsuarioActual.CveEmpresa) DTRines = GlobalDTPSRinTamaños(UsuarioActual.CveEmpresa)
Dim RegistroActual As Integer = 1 Dim RegistroActual As Integer = 1
@@ -1436,7 +1406,6 @@ Partial Class Ventas_Promociones
If ClasificacionStr.Length > 0 And CodigoStr.Length > 0 Then If ClasificacionStr.Length > 0 And CodigoStr.Length > 0 Then
SBErrorRegistro.Append($"No se puede agregar Clasificación y codigo en un mismo registro. ") SBErrorRegistro.Append($"No se puede agregar Clasificación y codigo en un mismo registro. ")
Else Else
If ClasificacionStr.Length > 0 Then If ClasificacionStr.Length > 0 Then
SBErrorRegistro.Append(If(CveClasificacion > 0, "", $"No se encontro Clasificación '{ClasificacionStr}'. </br>")) SBErrorRegistro.Append(If(CveClasificacion > 0, "", $"No se encontro Clasificación '{ClasificacionStr}'. </br>"))
Else Else
@@ -1513,9 +1482,7 @@ Partial Class Ventas_Promociones
LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", "").FormatoNumero(4) LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", "").FormatoNumero(4)
LbPUActual.Text = DTPSUltimoCosto.FiltroPrimeroValor("Importe", "").FormatoNumero(4) LbPUActual.Text = DTPSUltimoCosto.FiltroPrimeroValor("Importe", "").FormatoNumero(4)
UpAgregar.Update() UpAgregar.Update()
End Sub End Sub
End Class End Class