--Catalogo de bloqueo diario
This commit is contained in:
@@ -1,20 +1,120 @@
|
|||||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatBloqueoDiario.aspx.vb" Inherits="Contabilidad_CatBloqueoDiario" %>
|
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatBloqueoDiario.aspx.vb" Inherits="Contabilidad_CatBloqueoDiario" %>
|
||||||
|
|
||||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
|
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
|
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||||
|
<style>
|
||||||
|
.Totales, .table-striped > tbody > tr.Totales {
|
||||||
|
background: forestgreen !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
table > tbody > .SubTotales2:hover, .SubTotales2 {
|
||||||
|
background-color: #ed4116 !important;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
|
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||||
Catálogo de bloqueo diario
|
Catálogo de bloqueo diario
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
|
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
|
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
|
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||||
|
<asp:UpdatePanel runat="server" ID="UpDatos" UpdateMode="Conditional">
|
||||||
|
<ContentTemplate>
|
||||||
|
|
||||||
|
<%--Consulta--%>
|
||||||
|
<div class="portlet solid grey-cascade portlet-filter" id="idnecesaria">
|
||||||
|
<div class="portlet-title portlet-filterT smalltitle " style="">
|
||||||
|
<div class="tools">
|
||||||
|
<asp:Button ID="BtnConsulta" runat="server" Text="Consultar" class="btn btn-primary" OnClick="BtnConsulta_Click" ValidationGroup="GrpObligatorio" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="titlefiltros caption">
|
||||||
|
|
||||||
|
<div class="row" style="height: 32px;">
|
||||||
|
<div class="col-md-1 truncate">
|
||||||
|
Fecha Inicio:
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1" style="min-width: 115px">
|
||||||
|
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||||
|
<asp:TextBox Width="80px" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||||
|
<span class="input-group-btn ">
|
||||||
|
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||||
|
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||||
|
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||||
|
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1 truncate">
|
||||||
|
Fecha Fin:
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1" style="min-width: 115px">
|
||||||
|
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||||
|
<asp:TextBox Width="80px" ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||||
|
<span class="input-group-btn ">
|
||||||
|
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||||
|
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||||
|
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||||
|
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%--Seccion lista resultados--%>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="portlet light ">
|
||||||
|
<div class="portlet-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right">
|
||||||
|
<div style="margin-right: 15px">
|
||||||
|
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||||
|
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<asp:GridView ID="GvDatos" runat="server" GridLines="None" Width="100%" OnRowDataBound="GvDatos_RowDataBound" DataKeyNames="CveBloqueoDiario,Fecha" CssClass=" table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
|
||||||
|
<Columns>
|
||||||
|
<asp:TemplateField HeaderText="Modificado" ItemStyle-Width="10%">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:Literal runat="server" Text='<%# If(CInt(Eval("CveBloqueoDiario")) > 0, "Si", "No") %>'></asp:Literal>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
<asp:BoundField DataField="Fecha" DataFormatString="{0:d}" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70%" />
|
||||||
|
<asp:TemplateField HeaderText="Bloqueado" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:CheckBox ID="ChkBloqueo" runat="server" Checked='<%# Eval("Bloqueado") %>' OnCheckedChanged="ChkBloqueo_CheckedChanged" AutoPostBack="true" />
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
</Columns>
|
||||||
|
</asp:GridView>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ContentTemplate>
|
||||||
|
</asp:UpdatePanel>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,125 @@
|
|||||||
|
Option Explicit On
|
||||||
|
Option Strict On
|
||||||
|
|
||||||
|
Imports System
|
||||||
|
Imports System.Data
|
||||||
|
Imports Extensiones
|
||||||
|
|
||||||
Partial Class Contabilidad_CatBloqueoDiario
|
Partial Class Contabilidad_CatBloqueoDiario
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
|
If Not Page.IsPostBack Then
|
||||||
|
txtFechaI.Text = Now.AddMonths(-1).ToShortDateString()
|
||||||
|
txtFechaF.Text = Now.AddMonths(1).ToShortDateString()
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub BtnConsulta_Click(sender As Object, e As EventArgs)
|
||||||
|
CargaDatos()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargaDatos()
|
||||||
|
Dim FechaI = txtFechaI.Text.ToDate()
|
||||||
|
Dim FechaF = txtFechaF.Text.ToDate()
|
||||||
|
|
||||||
|
GvDatos.DataSource = GenerateDTBloqueos(FechaI, FechaF)
|
||||||
|
GvDatos.DataBind()
|
||||||
|
|
||||||
|
UpDatos.Update()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Function GenerateDTBloqueos(FechaI As DateTime, FechaF As DateTime) As DataTable
|
||||||
|
Dim DtDatos As New DataTable()
|
||||||
|
DtDatos.Columns.Add(New DataColumn("CveBloqueoDiario", GetType(Integer)))
|
||||||
|
DtDatos.Columns.Add(New DataColumn("Fecha", GetType(DateTime)))
|
||||||
|
DtDatos.Columns.Add(New DataColumn("Bloqueado", GetType(Boolean)))
|
||||||
|
|
||||||
|
Dim TieneError As Boolean = False
|
||||||
|
Try
|
||||||
|
Dim DtBloqueos As DataTable = Nothing
|
||||||
|
|
||||||
|
Using ObjConta As New ClsContabilidad
|
||||||
|
If ObjConta.GetBloqueoDiario(-1, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtBloqueos = ObjConta.DtResultados.Copy()
|
||||||
|
Else
|
||||||
|
TieneError = True
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
If Not TieneError Then
|
||||||
|
Dim dateList As List(Of DateTime) = GenerateDateList(FechaI, FechaF)
|
||||||
|
'GENERA EL LISTADO DE FECHAS
|
||||||
|
For Each dateValue As DateTime In dateList
|
||||||
|
Dim Row As DataRow = DtDatos.NewRow()
|
||||||
|
|
||||||
|
Row("CveBloqueoDiario") = -1
|
||||||
|
Row("Fecha") = dateValue
|
||||||
|
Row("Bloqueado") = False
|
||||||
|
|
||||||
|
DtDatos.Rows.Add(Row)
|
||||||
|
Next
|
||||||
|
|
||||||
|
'ASIGNA LOS QUE TIENEN VALORES
|
||||||
|
For Each RowValores As DataRow In DtBloqueos.Rows
|
||||||
|
Dim RowsFechas As DataRow() = DtDatos.Select($"Fecha = '{RowValores("Fecha").ToString().ToDate().ToString("dd/MM/yyyy")}'")
|
||||||
|
|
||||||
|
If RowsFechas IsNot Nothing AndAlso RowsFechas.Count() > 0 Then
|
||||||
|
RowsFechas(0)("CveBloqueoDiario") = RowValores("CveBloqueoDiario")
|
||||||
|
RowsFechas(0)("Bloqueado") = RowValores("Bloqueado")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error generar la tabla", ex)
|
||||||
|
DtDatos.Rows.Clear()
|
||||||
|
TieneError = True
|
||||||
|
End Try
|
||||||
|
|
||||||
|
If TieneError Then
|
||||||
|
DtDatos.Rows.Clear()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return DtDatos
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function GenerateDateList(startDate As DateTime, endDate As DateTime) As List(Of DateTime)
|
||||||
|
Dim dates As New List(Of DateTime)()
|
||||||
|
Dim dateValue As DateTime = startDate
|
||||||
|
While dateValue <= endDate
|
||||||
|
dates.Add(dateValue)
|
||||||
|
dateValue = dateValue.AddDays(1)
|
||||||
|
End While
|
||||||
|
Return dates
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||||
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
|
If e.Row.DBCampo("CveBloqueoDiario").ToEntero() > 0 Then
|
||||||
|
If CBool(e.Row.DBCampo("Bloqueado")) Then
|
||||||
|
e.Row.CssClass = "SubTotales2"
|
||||||
|
Else
|
||||||
|
e.Row.CssClass = "Totales"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
Protected Sub ChkBloqueo_CheckedChanged(sender As Object, e As EventArgs)
|
||||||
|
Dim ChkBloqueo = DirectCast(sender, CheckBox)
|
||||||
|
|
||||||
|
Dim GvRow As GridViewRow = DirectCast(ChkBloqueo.NamingContainer, GridViewRow)
|
||||||
|
|
||||||
|
Dim CveBloqueoDiario As Integer = GvRow.DataKey("CveBloqueoDiario").ToEntero()
|
||||||
|
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDate()
|
||||||
|
|
||||||
|
Using ObjConta As New ClsContabilidad
|
||||||
|
If ObjConta.AddUpdateBloqueoDiario(CveBloqueoDiario, Fecha, ChkBloqueo.Checked, UsuarioActual.CveEmpresa) Then
|
||||||
|
Alert($"Se actualizó el estatus de bloqueo en el dia {Fecha.ToString("dd/MM/yyyy")}")
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
CargaDatos()
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user