This commit is contained in:
2024-09-17 20:40:23 -07:00
15 changed files with 1370 additions and 1356 deletions

View File

@@ -6283,12 +6283,13 @@ Public Class ClsInventarios
Return Retorno Return Retorno
End Function End Function
Public Function GetUltimoCosto(CveEmpresa As Integer) As Boolean Public Function GetUltimoCosto(CveEmpresa As Integer, Optional CvePS As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Inv_UltimoCostoGet") DataAdapter("PA_Inv_UltimoCostoGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CvePS", SqlDbType.Int).Value = CvePS
End With End With
Try Try

View File

@@ -10127,6 +10127,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Contabilidad/RepFisImpuestos.aspx".ToUpper(), 432) PaginaDict.Add("/Contabilidad/RepFisImpuestos.aspx".ToUpper(), 432)
PaginaDict.Add("/Contabilidad/LibroDiario.aspx".ToUpper(), 620) PaginaDict.Add("/Contabilidad/LibroDiario.aspx".ToUpper(), 620)
PaginaDict.Add("/Contabilidad/LibroMayor.aspx".ToUpper(), 619) PaginaDict.Add("/Contabilidad/LibroMayor.aspx".ToUpper(), 619)
PaginaDict.Add("/Contabilidad/LibroMayorCI.aspx".ToUpper(), 619)
PaginaDict.Add("/Contabilidad/Reportes/RepCuadreContaAdmon.aspx".ToUpper(), -1) PaginaDict.Add("/Contabilidad/Reportes/RepCuadreContaAdmon.aspx".ToUpper(), -1)
PaginaDict.Add("/Contabilidad/Reportes/RepCuadreContaAdmonDetalle.aspx".ToUpper(), -1) PaginaDict.Add("/Contabilidad/Reportes/RepCuadreContaAdmonDetalle.aspx".ToUpper(), -1)
PaginaDict.Add("/Contabilidad/ComparacionesContabilidad.aspx".ToUpper(), 330) PaginaDict.Add("/Contabilidad/ComparacionesContabilidad.aspx".ToUpper(), 330)
@@ -10168,7 +10169,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Contabilidad/RepEstadoResultadosHorizontal.aspx".ToUpper(), 420) PaginaDict.Add("/Contabilidad/RepEstadoResultadosHorizontal.aspx".ToUpper(), 420)
PaginaDict.Add("/Contabilidad/RepAnexoCatalogoMensualHorizontal.aspx".ToUpper(), -1) PaginaDict.Add("/Contabilidad/RepAnexoCatalogoMensualHorizontal.aspx".ToUpper(), -1)
PaginaDict.Add("/Contabilidad/CatBloqueoDiario.aspx".ToUpper(), 680) PaginaDict.Add("/Contabilidad/CatBloqueoDiario.aspx".ToUpper(), 680)
PaginaDict.Add("/Contabilidad/LibroMayor2.aspx".ToUpper(), 1353) 'PaginaDict.Add("/Contabilidad/LibroMayor2.aspx".ToUpper(), 1353)
#End Region #End Region

View File

@@ -1456,7 +1456,7 @@ Partial Class Bancos_PopIECompras
End If End If
If MsgError = "" Then If MsgError = "" Then
Dim VentaActual As New Venta(UsuarioActual) With {.CveVenta = rw.DataKey("CveVenta").ToEntero, .ClienteNombre = NombreCliente, .SerieFolio = rw.DataKey("SerieFolio"), .CveCliente = rw.DataKey("CveCliente").ToEntero, .IVA = rw.DataKey("IVA").ToDecimal, .IEPS = rw.DataKey("IEPS").ToDecimal, .RetIVA = rw.DataKey("RetIVA").ToDecimal, .RetISR = rw.DataKey("RetISR").ToDecimal, .Total = rw.DataKey("Total").ToDecimal, .PorcentajeIVA = rw.DataKey("PorcentajeIVA").ToDecimal, .CveSubProyecto = rw.DataKey("CveSubProyecto").ToEntero, .CveMoneda = rw.DataKey("CveMoneda").ToEntero} Dim VentaActual As New Venta(UsuarioActual) With {.CveVenta = rw.DataKey("CveVenta").ToEntero, .ClienteNombre = NombreCliente, .SerieFolio = rw.DataKey("SerieFolio"), .CveCliente = rw.DataKey("CveCliente").ToEntero, .IVA = rw.DataKey("IVA").ToDecimal, .IEPS = rw.DataKey("IEPS").ToDecimal, .RetIVA = rw.DataKey("RetIVA").ToDecimal, .RetISR = rw.DataKey("RetISR").ToDecimal, .Total = rw.DataKey("Total").ToDecimal, .PorcentajeIVA = rw.DataKey("PorcentajeIVA").ToDecimal, .CveSubProyecto = rw.DataKey("CveSubProyecto").ToEntero, .CveMoneda = rw.DataKey("CveMoneda").ToEntero, .TC = rw.DataKey("TipoCambio").ToDecimal}
Dim PagoVenta As New VentaPago Dim PagoVenta As New VentaPago
PagoVenta.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero PagoVenta.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
PagoVenta.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal PagoVenta.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal

View File

@@ -1,4 +1,4 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="LibroMayor.aspx.vb" Inherits="Contabilidad_LibroMayor" %> <%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="LibroMayor.aspx.vb" Inherits="Conta_LibroMayor" EnableEventValidation="false" %>
<asp:Content ContentPlaceHolderID="Css" runat="server"> <asp:Content ContentPlaceHolderID="Css" runat="server">
<style> <style>
@@ -6,111 +6,260 @@
width: 300px; width: 300px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
}
table {
border: none !important;
}
tr {
border: none !important;
}
td {
border: none !important;
} }
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server"> <asp:UpdatePanel ID="UpAcciones" runat="server" >
<ContentTemplate> <ContentTemplate>
<li> <li>
<asp:LinkButton ID="ImgExcel" Visible="false" runat="server"><i class="fa fa-ad-excel"></i> Generar EXCEL</asp:LinkButton> <asp:LinkButton ID="ImgExcel" runat="server" Visible="true"><i class="fa fa-file-excel-o" ></i> Generar EXCEL</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="Imprimir" Visible="false" runat="server"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
</li> </li>
</ContentTemplate> </ContentTemplate>
<Triggers> <Triggers>
<asp:PostBackTrigger ControlID="ImgExcel" /> <asp:PostBackTrigger ControlID="ImgExcel" />
<asp:PostBackTrigger ControlID="Imprimir" />
</Triggers> </Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
<%-- <li>
<asp:LinkButton ID="Imprimir" runat="server" Visible="false"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
</li>--%>
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Libro Mayor Libro Mayor
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter"> <div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle"> <div class="portlet-title portlet-filterT smalltitle">
<div class="tools"> <div class="tools">
<asp:Button ID="BtnConsultar" runat="server" CssClass="btn btn-primary" Text="Consultar" Width="100px" OnClick="BtnConsultar_Click" Enabled="false"/> <asp:Button ID="BtnConsultar" runat="server" Text="Consultar" CssClass="btn btn-default" OnClick="BtnConsultar_Click" ValidationGroup="Valida" />
<a href="javascript:;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a><%--class="expand"--%>
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
</div> </div>
<div class="titlefiltros caption "> <div class="titlefiltros caption ">
<div class="row"> <div class="row">
<label class="col-md-1" style="width: 90px; padding-right: 2px;">Fecha Inicio:</label>
<div class="col-md-2" style="width: 140px;">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 80px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaDel" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgCalendarioDel" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaDel" runat="server" TargetControlID="TxtFechaDel" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalendarioDel" runat="server" TargetControlID="TxtFechaDel" PopupButtonID="ImgCalendarioDel" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaDel" runat="server" ControlToValidate="TxtFechaDel" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFecha2Del" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaDel" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<label class="col-md-1" style="width: 80px; padding-right: 2px;">Fecha Fin:</label>
<div class="col-md-2" style="width: 140px;">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 80px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaAl" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgCalendarioAl" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaAl" runat="server" TargetControlID="TxtFechaAl" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalendarioAl" runat="server" TargetControlID="TxtFechaAl" PopupButtonID="ImgCalendarioAl" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaAl" runat="server" ControlToValidate="TxtFechaAl" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFecha2Al" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaAl" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<%-- <label class="col-md-2" style="width: 60px;">Moneda:</label>
<div class="col-md-1"> <div class="col-md-1">
<asp:DropDownList ID="DdlMoneda" CssClass="select2me" runat="server" DataTextField="Moneda" DataValueField="CveMoneda" TabIndex="5" ClientIDMode="Static"> Cuenta:
</div>
<div class="col-md-3">
<asp:DropDownList ID="DdlCuentas" runat="server" AppendDataBoundItems="true" DataTextField="CuentaFormatoNombre" DataValueField="CveCuenta" CssClass="form-control input-sm select2me" Enabled="false">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</div>--%> <asp:RequiredFieldValidator ID="RFVDdlCuentas" runat="server" InitialValue="-1" ControlToValidate="DdlCuentas" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cuenta''</b> es necesario, por favor ingréselo." ValidationGroup="GrpConsulta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="CERFVDdlCuentas" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlCuentas" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-1">
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="GrpConsulta"></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="GrpConsulta"></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">
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: 100% !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="GrpConsulta"></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="GrpConsulta"></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>
</div> </div>
<div class="portlet-body" <%= IIf(chkexpand.Checked = True, "", "style=""display:none;""")%>>
<div class="row">
<div class="col-md-1 ">
Tipo Movto
</div>
<div class="col-md-3 ">
<asp:DropDownList ID="DdlOpcionCuentas" runat="server" DataTextField="Cuenta" DataValueField="CveCuenta" TabIndex="4" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Con movimientos" Value="1"></asp:ListItem>
<asp:ListItem Text="Saldo actual no igual a cero" Value="2"></asp:ListItem>
<asp:ListItem Text="Con movimientos y saldo no igual a cero" Value="3"></asp:ListItem>
<asp:ListItem Text="Con movimientos o saldo no igual a cero" Value="4"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 " id="tdTipoReporte" visible="false" runat="server">
Tipo
</div>
<div class="col-md-2" id="tdTipoReporte2" visible="false" runat="server">
<asp:DropDownList ID="DdlTipoReporte" CssClass="form-control input-sm select2me" runat="server" Width="100%">
<asp:ListItem Text="Contable" Value="1"></asp:ListItem>
<asp:ListItem Text="Contable y Complementario" Value="3"></asp:ListItem>
<asp:ListItem Text="Complementario" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1" id="divProyecto" runat="server">
<asp:Label ID="LblProyecto" runat="server">Proyecto:</asp:Label>
</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlProyecto" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Width="95%">
</asp:DropDownList>
</div>
<asp:Label runat="server" ID="LblSubProyecto" CssClass="col-md-1">SubProyecto:</asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlSubproyecto" CssClass="form-control input-sm select2me" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="95%" AutoPostBack="True">
</asp:DropDownList>
</div>
</div>
</div>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<div class="row" style="margin-right: 10px; margin-top: 8px;" align="right">
<%-- <br /> <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;" />
<div class="text-right">Buscar : <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>
<input type="text" id="Buscar" style="margin-right: 30px;" /> </div>
</div>--%> <asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server" style="margin-left: 15px; margin-right: 15px;">
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvDatos" CssClass="table table-striped table-hover Widthall" GridLines="None" AutoGenerateColumns="False" runat="server"> <div style='color:red'></div>
<asp:GridView ID="GvDatos" runat="server"
CssClass="table table-striped table-advance table-hover " AutoGenerateColumns="False"
EmptyDataText="No se encontrarios movimientos."
DataKeyNames="" OnRowDataBound="GvDatos_RowDataBound">
<Columns> <Columns>
<asp:BoundField HeaderText="Fecha" DataField="Fecha" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" /> <asp:TemplateField ControlStyle-CssClass="Widthall">
<asp:BoundField HeaderText="Tipo" DataField="TipoPol" /> <HeaderTemplate>
<asp:BoundField HeaderText="Poliza" DataField="Folio" />
<asp:BoundField HeaderText="Descripción" DataField="Concepto" /> <table width="100%" style="border: none">
<asp:BoundField HeaderText="Cargos" DataField="Cargos" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.00}" /> <tr>
<asp:BoundField HeaderText="Abonos" DataField="Abonos" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.00}" /> <td colspan="3"><font size="2">Cuenta</font></td>
<asp:BoundField HeaderText="Saldo" DataField="Saldo" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.00}" /> <td colspan="1"><font size="2">Nombre</font></td>
<td colspan="4"></td>
<td><font size="2">Saldo Inicial</font></td>
</tr>
<tr>
<td width="60px" align="center">Fecha</td>
<td width="60px" align="center">Tipo</td>
<td width="60px" align="center">Número</td>
<td width="300px" align="left">Concepto</td>
<td width="100px" align="center">Referencia</td>
<td width="100px" align="center">Referencia Movto</td>
<td width="100px" align="center"><asp:Label ID="LblSubProyecto" runat="server"></asp:Label> </td>
<td width="100px" align="center">Cargos</td>
<td width="100px" align="center">Abonos</td>
<td width="100px" align="center">Saldo</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%" style="border: none">
<tr runat="server" id="tr1">
<td colspan="3" align="left" width="180px">
<asp:Label ID="LbCuenta" runat="server" Text='<%# Eval("Codigo")%>'></asp:Label>
</td>
<td colspan="1" align="left" width="300px">
<asp:Label ID="LbNombre" runat="server" Text='<%# Eval("Nombre")%>'></asp:Label>
</td>
<td colspan="2" width="200px"></td>
<td style="font-weight: normal;" align="right" width="100px">Saldo Inicial:
</td>
<td style="font-weight: normal;" align="right" width="100px">
<asp:Label ID="LbSaldoInicial" runat="server" Text='<%# Eval("SaldoInicial", "{0:N2}")%>'></asp:Label>
</td>
</tr>
<tr runat="server" id="tr2">
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LbFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Literal>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LbTipo" runat="server" Text='<%# Eval("TipoPoliza")%>'></asp:Literal>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:HyperLink ID="HLPoliza" runat="server" Text='<%# Eval("Folio")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</td>
<td width="300px" align="left">
<div class="truncate" style="width: 300px;">
<asp:Label ID="LbConcepto" runat="server" CssClass="truncate" Text='<%# Eval("Concepto")%>' title='<%# Eval("Concepto")%>'></asp:Label>
</div>
</td>
<td width="100px">
<asp:Label ID="LbReferencia" runat="server" Text='<%# Eval("Referencia")%>'></asp:Label>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LtlRefMovto" runat="server" Text='<%# Eval("ReferenciaAdmin")%>'></asp:Literal>
</td>
<td width="100px">
<asp:Label ID="LblSubProyecto" runat="server" Text='<%# Eval("SubProyecto")%>'></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbCargos" runat="server"></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbAbonos" runat="server"></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbSaldo" runat="server"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle />
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>
</asp:Content>

View File

@@ -2,22 +2,40 @@
Option Strict On Option Strict On
Imports System.Data Imports System.Data
Imports ADServerControl.DragableList
Imports System.IO
Imports Extensiones Imports Extensiones
Imports Microsoft.Reporting.WebForms Imports Microsoft.Reporting.WebForms
Imports ClosedXML.Excel
Imports System.Drawing
Partial Class Contabilidad_LibroMayor Partial Class Conta_LibroMayor
Inherits ClsPaginas Inherits ClsPaginas
#Region "PROPIEDADES" #Region "PROPIEDADES"
Private Property DtDatos As DataTable Private Property DtDatos As DataTable
Get Get
DtDatos = DirectCast(ViewState("DtDatos"), DataTable) If ViewState("DtDatos") Is Nothing Then
ViewState("DtDatos") = New DataTable
End If
Return DirectCast(ViewState("DtDatos"), DataTable)
End Get End Get
Set(ByVal value As DataTable) Set(ByVal value As DataTable)
ViewState("DtDatos") = value ViewState("DtDatos") = value
End Set End Set
End Property End Property
Private Property DtTotales As DataTable
Get
DtTotales = DirectCast(ViewState("DtTotales"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtTotales") = value
End Set
End Property
Private Property FechaInicio As Date Private Property FechaInicio As Date
Get Get
FechaInicio = ViewState("FechaInicio").ToString.ToDate FechaInicio = ViewState("FechaInicio").ToString.ToDate
@@ -34,147 +52,312 @@ Partial Class Contabilidad_LibroMayor
ViewState("FechaFin") = value ViewState("FechaFin") = value
End Set End Set
End Property End Property
Private Property TotalPadre As Boolean
Get
TotalPadre = CBool(ViewState("TotalPadre"))
End Get
Set(value As Boolean)
ViewState("TotalPadre") = value
End Set
End Property
Private Property DTCuentas As DataTable
Get
Return CType(ViewState("DTCuentas"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTCuentas") = value
End Set
End Property
Private Property TipoReporte As String
Get
TipoReporte = ViewState("TP").ToString
End Get
Set(value As String)
ViewState("TP") = value
End Set
End Property
Private Property Cuenta As String
Get
Return ViewState("Cuenta").ToString
End Get
Set(value As String)
ViewState("Cuenta") = value
End Set
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
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
InicializaValores() If UsuarioActual.Empresa.TipoContabilidad = 2 Then Response.Redirect($"/Contabilidad/LibroMayorCI.aspx")
Dim ErrorParametros As Boolean = True
CargaTipoCuentas()
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
txtFechaF.Text = NowADS().LastDayOfMonth.ToShortDateString
If Request("CveCuenta") IsNot Nothing AndAlso IsNumeric(Request("CveCuenta")) AndAlso Request("CveCuenta").ToEntero > 0 Then
If Request("FF") IsNot Nothing AndAlso Request("FF").ToString.Length = 10 AndAlso Request("FF").ToDate > "01/01/1000".ToDate Then
FechaFin = Request("FF").ToDate
txtFechaF.Text = FechaFin.ToShortDateString
DdlCuentas.SelectedValueExist(Request("CveCuenta").ToEntero)
If Request("FI") IsNot Nothing AndAlso Request("FI").ToString.Length = 10 AndAlso Request("FI").ToDate > "01/01/1000".ToDate Then
FechaInicio = Request("FI").ToDate
txtFechaI.Text = FechaInicio.ToShortDateString
Else
FechaInicio = DateSerial(Year(FechaFin), Month(FechaFin), 1)
txtFechaF.Text = FechaInicio.ToShortDateString
End If
If Request("CveProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveProyecto")) Then
DdlProyecto.SelectedValueExist(Request("CveProyecto"))
DdlProyecto_SelectedIndexChanged(Nothing, Nothing)
End If
If Request("CveSubProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveSubProyecto")) Then
DdlSubproyecto.SelectedValueExist(Request("CveSubProyecto"))
End If
ErrorParametros = False
If Request("TP") IsNot Nothing AndAlso IsNumeric(Request("TP")) AndAlso Request("TP").ToEntero > 0 Then
TipoReporte = Request("TP").ToString
End If
If UsuarioActual.Empresa.UsaAC Then
BtnConsultar.Enabled = True
Else
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
BtnConsultar.Enabled = True
Else
Alert("La empresa no usa Armonización Contable", TipoMensaje.MsgError)
End If End If
End If End If
If Not ErrorParametros Then
TotalPadre = True
TipoReporte = "1"
CargaDatos()
End If
End If End If
End Sub End Sub
Private Sub InicializaValores()
TxtFechaDel.Text = $"01/01/{NowADS().Year}"
TxtFechaAl.Text = NowADS().ToShortDateString
'DdlMoneda.DataSource = GlobalDTMonedas
'DdlMoneda.DataBind()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos() If DdlCuentas.SelectedValue.ToEntero = -2 Then
Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError)
Else
FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
CargaDatos()
End If
End Sub End Sub
#Region "C A R G A - D A T O S" #Region "C A R G A - D A T O S"
Private Sub CargaDatos()
FechaInicio = If(IsDate(TxtFechaDel.Text), TxtFechaDel.Text.ToDate, MinFecha) Private Sub CargaTipoCuentas()
FechaFin = If(IsDate(TxtFechaAl.Text), TxtFechaAl.Text.ToDate, MaxFecha)
Dim ObjTipoCuenta As New ClsContabilidad
DdlCuentas.Enabled = True
If ObjTipoCuenta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
DTCuentas = ObjTipoCuenta.DtResultados
DdlCuentas.DataSource = ObjTipoCuenta.DtResultados.FiltraParametros("Codigo NOT IN ('_ACTIVO', '_PASIVO', '_CAPITAL', '_CUADRE', '_ESTADISTICAS', '_ORDEN', '_RACREEDOR', '_RDEUDOR', '_UTILIDAD')")
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
Dim ObjConta As New ClsContabilidad
If ObjConta.GetLibroMayorSIG(-1, FechaInicio, FechaFin, 1, UsuarioActual.CveEmpresa) Then
DtDatos = ObjConta.DtResultados
Else
DtDatos = Nothing
End If
ObjConta.Dispose()
Else
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
If ObjConta.GetLibroMayor(1, FechaInicio, FechaFin, 1) Then
DtDatos = ObjConta.DtResultados
Else
DtDatos = Nothing
End If
ObjConta.Dispose()
End If End If
ObjTipoCuenta.Dispose()
DdlCuentas.DataBind()
CargarCentrosDeCosto(DdlProyecto, DdlSubproyecto, LblProyecto, LblSubProyecto, divProyecto:=divProyecto)
If DtDatos IsNot Nothing Then
ImgExcel.Visible = True
Imprimir.Visible = True
CargaGrid()
Else
ImgExcel.Visible = False
Imprimir.Visible = False
End If
End Sub End Sub
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged
CargarSubProyecto(DdlSubproyecto, DdlProyecto.SelectedValue, "Todos")
End Sub
Private Sub CargaDatos(Optional RenderGv As Boolean = True)
Dim CveProyecto As Integer = DdlProyecto.SelectedValue.ToEntero
Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero
TipoReporte = DdlTipoReporte.SelectedValue.ToString
Cuenta = DdlCuentas.SelectedItem.ToString
Dim ObjConta As New ClsContabilidad
If ObjConta.GetLibroMayor2(DdlCuentas.SelectedValue.ToEntero, FechaInicio, FechaFin, -1, CveProyecto, CveSubProyecto, UsuarioActual.CveEmpresa, TipoReporte, DdlOpcionCuentas.SelectedValue.ToEntero) Then
DtDatos = ObjConta.DtResultados
DtTotales = DtDatos.Clone
If RenderGv Then
CargaGrid()
End If
Else
DtDatos = Nothing
End If
ObjConta.Dispose()
End Sub
#End Region #End Region
Private Sub InsertaTotales()
Dim i As Integer = 0
Dim Aumento As Integer = 0
Dim Row As DataRow
Dim Row2 As DataRow
'Llena DtTotales
For Each dr As DataRow In DtDatos.Rows
If dr("Concepto").ToString = "" Then
Row = DtTotales.NewRow
Row("CveCuenta") = -1
Row("CargosMovto") = If("1" = "1", dr("Cargos"), dr("CargosME"))
Row("AbonosMovto") = If("1" = "1", dr("Abonos"), dr("AbonosME"))
Row("Saldo") = dr("SaldoActual")
Row("CtaMayor") = dr("CtaMayor")
Row("Concepto") = String.Format("Total {0}:", dr("Nombre"))
Row("Nombre") = dr("Nombre")
DtTotales.Rows.Add(Row)
Row("Clasificacion") = i
End If
i += 1
Next
'Inserta Totales en DtDatos
For Each dr As DataRow In DtTotales.Rows
i = 0
If dr("CtaMayor").ToString = "1" Then
DtDatos.ImportRow(dr)
End If
If dr("CtaMayor").ToString = "2" Then
For index As Integer = dr("Clasificacion").ToString.ToEntero + Aumento To DtDatos.Rows.Count
If DtDatos.Rows(index)("Nombre").ToString <> dr("Nombre").ToString Then
i = index
Exit For
End If
Next
Row2 = DtDatos.NewRow
Row2.ItemArray = dr.ItemArray
DtDatos.Rows.InsertAt(Row2, i + Aumento)
Aumento += 1
End If
Next
End Sub
#Region "G R I D - GV DATOS" #Region "G R I D - GV DATOS"
Private Sub CargaGrid() Private Sub CargaGrid()
GvDatos.DataSource = DtDatos GvDatos.DataSource = DtDatos
'GvDatos.Dispose()
GvDatos.DataBind() GvDatos.DataBind()
UpDatos.Update() UpDatos.Update()
End Sub End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
e.Row.FCLabel("LblSubProyecto").Text = LblSubProyecto.Text
End If
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Concepto") = "" Then
e.Row.ControlStyle.Font.Bold = True
e.Row.ControlStyle.Height = 35
'0 Fecha 'Cuando es Titulo
'1 TipoPol If e.Row.DBCampo("SaldoActual") = "" Then
'2 Folio CType(e.Row.FindControl("tr2"), HtmlTableRow).Visible = False
'3 Concepto
'4 Cargos
'5 Abonos
'6 Saldo
'CABECERA
If e.Row.DBCampo("TipoRenglon") = "1" Then
e.Row.Font.Bold = True
e.Row.Cells(0).Text = ""
e.Row.Cells(1).Text = ""
e.Row.Cells(2).Text = ""
e.Row.Cells(3).Text = e.Row.DBCampo("Nombre")
e.Row.Cells(4).Text = ""
e.Row.Cells(5).Text = "Saldo inicial:"
e.Row.Cells(6).Text = e.Row.DBCampo("SaldoInicial").FormatoNumero
e.Row.CssClass = "Totales"
End If
'DETALLE 'Cuando Es Total
If e.Row.DBCampo("TipoRenglon") = "2" Then Else
CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
'Anterior para TotalPadre
'If e.Row.DBCampo("CtaMayor").ToString = "2" And (e.Row.DBCampo("Nivel3").ToString <> "" Xor e.Row.DBCampo("Orden").ToString.Length = 18) Then
' e.Row.FCLabel("LbReferencia").Text = "Total:"
'Else
' e.Row.FCLabel("LbConcepto").Text = String.Format("Total {0}:", e.Row.DBCampo("Nombre").ToString)
'End If
If TotalPadre Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Width = "1px"
'CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells.Remove(CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3))
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Align = "Right"
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Width = "400px"
If e.Row.RowIndex + 1 = DtDatos.Rows.Count Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(4).Attributes.Add("style", "border-top: 1px solid black;")
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(5).Attributes.Add("style", "border-top: 1px solid black;")
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(6).Attributes.Add("style", "border-top: 1px solid black;")
End If
e.Row.FCLabel("LbReferencia").Text = String.Format("Total {0}:", e.Row.DBCampo("Nombre").ToString)
Else
TotalPadre = True
e.Row.FCLabel("LbReferencia").Font.Bold = False
e.Row.FCLabel("LbReferencia").Text = "Total:"
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(4).Align = "Right"
End If
'e.Row.FCLabel("LbReferencia").Text = String.Format("Total {0}:", If(e.Row.DBCampo("CtaMayor").ToString = "2", "", e.Row.DBCampo("Nombre").ToString))
e.Row.FCLabel("LbCargos").Text = e.Row.DBCampo("Cargos").ToString.FormatoNumero(If("1" = "1", 2, 4))
e.Row.FCLabel("LbAbonos").Text = e.Row.DBCampo("Abonos").ToString.FormatoNumero(If("1" = "1", 2, 4))
e.Row.FCLabel("LbSaldo").Text = e.Row.DBCampo("SaldoActual").ToString.FormatoNumero(If("1" = "1", 2, 4))
End If
Else
TotalPadre = False
e.Row.ControlStyle.Font.Bold = False
CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
e.Row.FCHyperLink("HLPoliza").NavigateUrl = String.Format("/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}", e.Row.DBCampo("CvePoliza"))
If e.Row.DBCampo("CargosMovto").ToDouble <> 0 Then e.Row.FCLabel("LbCargos").Text = e.Row.DBCampo("CargosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
If e.Row.DBCampo("AbonosMovto").ToDouble <> 0 Then e.Row.FCLabel("LbAbonos").Text = e.Row.DBCampo("AbonosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
If e.Row.DBCampo("Saldo").ToDouble <> 0 Then e.Row.FCLabel("LbSaldo").Text = e.Row.DBCampo("Saldo").ToString.FormatoNumero(If("1" = "1", 2, 4))
End If End If
'SUBTOTAL
If e.Row.DBCampo("TipoRenglon") = "3" Then 'COLOREA NEGATIVOS
e.Row.Font.Bold = True If e.Row.FCLabel("LbCargos").Text.ToDouble < 0 Then
e.Row.Cells(1).Text = "" e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Red
e.Row.Cells(2).Text = "" Else
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Black
e.Row.Cells(3).Text = "SubTotal:"
e.Row.Cells(6).Text = ""
e.Row.CssClass = "SubTotales"
End If End If
'TOTAL If e.Row.FCLabel("LbAbonos").Text.ToDouble < 0 Then
If e.Row.DBCampo("TipoRenglon") = "4" Then e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Red
e.Row.Font.Bold = True Else
e.Row.Cells(0).Text = "" e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Black
e.Row.Cells(1).Text = "" End If
e.Row.Cells(2).Text = ""
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right If e.Row.FCLabel("LbSaldo").Text.ToDouble < 0 Then
e.Row.Cells(3).Text = $"Total ({e.Row.DBCampo("Nombre")}):" e.Row.FCLabel("LbSaldo").ForeColor = Drawing.Color.Red
e.Row.Cells(6).Text = "" Else
e.Row.CssClass = "Totales" e.Row.FCLabel("LbSaldo").ForeColor = Drawing.Color.Black
End If
If e.Row.FCLabel("LbSaldoInicial").Text.ToDouble < 0 Then
e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Black
End If End If
End If End If
@@ -182,37 +365,382 @@ Partial Class Contabilidad_LibroMayor
#End Region #End Region
Protected Sub Imprimir_click(sender As Object, e As EventArgs)
If DdlCuentas.SelectedValue.ToEntero = -1 Then
Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError)
Else
FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
#Region " IMPRIMIR " DtDatos = DtDatos
ImprimirReporte()
#End Region End If
Protected Sub Imprimir_click(sender As Object, e As EventArgs) Handles Imprimir.Click
FechaInicio = If(TxtFechaDel.Text = "" Or TxtFechaDel.Text = "__/__/____", NowADS(), TxtFechaDel.Text.ToDate)
FechaFin = If(TxtFechaAl.Text = "" Or TxtFechaAl.Text = "__/__/____", NowADS(), TxtFechaAl.Text.ToDate)
DtDatos = DtDatos
ImprimirReporte()
End Sub End Sub
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
FechaInicio = If(TxtFechaDel.Text = "" Or TxtFechaDel.Text = "__/__/____", NowADS(), TxtFechaDel.Text.ToDate) ImprimirReporte("Excel")
FechaFin = If(TxtFechaAl.Text = "" Or TxtFechaAl.Text = "__/__/____", NowADS(), TxtFechaAl.Text.ToDate)
DtDatos = DtDatos
ImprimirReporte("EXCEL")
End Sub End Sub
Private Sub ImprimirReporte(Optional Formato As String = "PDF") Private Sub ImprimirReporte(Optional Formato As String = "PDF")
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim lista = New List(Of CrystalParametro) Dim WBLibroMayor = New ClosedXML.Excel.XLWorkbook
lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)) Dim TipoReporte = DdlTipoReporte.SelectedValue.ToEntero
lista.Add(New CrystalParametro("FechaInicio", FechaInicio.ToString("dd/MM/yyyy")))
lista.Add(New CrystalParametro("FechaFin", FechaFin.ToString("dd/MM/yyyy"))) FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)) FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
lista.Add(New CrystalParametro("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
DtDatos.Rows.Clear()
CargaDatos(False)
If DtDatos.Rows.Count > 0 Then
Dim sp As String = If(DdlSubproyecto.SelectedValue.ToEntero > 0, DdlSubproyecto.SelectedItem.Text, "")
WBLibroMayor.AddWorksheet(WSDocumento(sp, DtDatos))
WBLibroMayor.Worksheet(1).Name = $"LibroMayor"
End If
Dim msB = New MemoryStream()
WBLibroMayor.SaveAs(msB)
Dim BB As Byte() = msB.ToArray
msB.Dispose()
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment; filename=Balanza_" & Now.ToString("yyyyMMddhhmmss") & ".xlsx")
Response.ContentType = "application/vnd.ms-excel"
Response.BinaryWrite(BB)
Response.End()
ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/LibroMayor.rpt"), DtDatos, lista, "LibroMayor", Formato), "LibroMayor", Formato)
End Sub End Sub
Function WSDocumento(SubProyecto As String, DtDatos As DataTable) As IXLWorksheet
Dim WBAnexoSalvar = New ClosedXML.Excel.XLWorkbook
Dim WBReporte = New ClosedXML.Excel.XLWorkbook()
WBReporte.Worksheets.Add("1")
Dim WSReporte = WBReporte.Worksheet(1)
Dim RutaLogo As String = String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)
If File.Exists(RutaLogo) Then
Dim imagePath As String = RutaLogo
Dim img As Bitmap = New Bitmap(imagePath)
Dim picture = WSReporte.AddPicture(img).MoveTo(WSReporte.Cell("A1"))
picture.Scale(0.5)
End If
Dim Tamaniofuente As Integer = 13
Dim Range = WSReporte.Range("A1:D1")
WSReporte.Style.Font.FontSize = 10
WSReporte.Style.Font.FontName = "Arial Narrow"
WSReporte.Style.Alignment.WrapText = True
Range.Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A1:J1").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A2:J2").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A3:J3").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A4:J4").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A5:J5").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A1:A5").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Column(1).Width = 15
WSReporte.Column(2).Width = 15
WSReporte.Column(3).Width = 14
WSReporte.Column(4).Width = 70
WSReporte.Column(5).Width = 35
WSReporte.Column(6).Width = 20
WSReporte.Column(7).Width = 14
WSReporte.Column(8).Width = 14
WSReporte.Column(9).Width = 14
WSReporte.Column(10).Width = 14
WSReporte.Cell(1, 1).Value = UsuarioActual.Empresa.Empresa
WSReporte.Cell(2, 1).Value = $"Libro Mayor del {txtFechaI.Text} al {txtFechaF.Text}"
If SubProyecto.Length > 0 Then
WSReporte.Cell(5, 1).Value = $"Sub Proyecto: {SubProyecto}"
WSReporte.Cell(5, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left
WSReporte.Cell(5, 1).Style.Font.Bold = True
End If
WSReporte.Cell(6, 1).Value = "Fecha"
WSReporte.Cell(6, 2).Value = $"Cuenta{vbCrLf}Tipo"
WSReporte.Cell(6, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 3).Value = $"Número"
WSReporte.Cell(6, 4).Value = $"Concepto"
WSReporte.Cell(6, 5).Value = $"Referencia"
WSReporte.Cell(6, 6).Value = $"Referencia Movto"
WSReporte.Cell(6, 7).Value = $"{LblSubProyecto.Text}"
WSReporte.Cell(6, 8).Value = $"Cargos"
WSReporte.Cell(6, 9).Value = $"Abonos"
WSReporte.Cell(6, 10).Value = $"Saldo"
WSReporte.Range("A6:J6").Style.Font.Bold = True
WSReporte.Range("A6:J6").Style.Font.FontSize = 10
WSReporte.Range("A6:J6").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Range("A6:J6").Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:J6").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:J6").Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
Dim CuerrentRow As Integer = 7
CuerrentRow = CuerrentRow + 1
For Each Drow As DataRow In DtDatos.Rows
If Drow("Concepto").ToString = "" Then
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.Bold = True
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.FontSize = FontSize.XXLarge '35
If Drow("SaldoActual").ToString = "" Then
'CType(e.Row.FindControl("tr2"), HtmlTableRow).Visible = False
'Cuando Es Total
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Codigo").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Nombre").ToString
WSReporte.Cell(CuerrentRow, 9).Value = "Saldo Inicial:"
WSReporte.Cell(CuerrentRow, 10).Value = Drow("SaldoInicial").ToString
WSReporte.Cell(CuerrentRow, 10).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Cell(CuerrentRow, 10).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("SaldoInicial").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
Else
'CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Fecha").ToString
WSReporte.Cell(CuerrentRow, 2).Value = Drow("TipoPoliza").ToString
WSReporte.Cell(CuerrentRow, 3).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Concepto").ToString
WSReporte.Cell(CuerrentRow, 5).Value = Drow("Referencia").ToString
WSReporte.Cell(CuerrentRow, 6).Value = Drow("ReferenciaAdmin").ToString
WSReporte.Cell(CuerrentRow, 7).Value = Drow("SubProyecto").ToString
If TotalPadre Then
WSReporte.Cell(CuerrentRow, 5).Value = String.Format("Total {0}:", Drow("Nombre").ToString)
WSReporte.Cell(CuerrentRow, 5).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
Else
TotalPadre = True
WSReporte.Cell(CuerrentRow, 5).Style.Font.Bold = False
WSReporte.Cell(CuerrentRow, 5).Value = "Total:"
WSReporte.Cell(CuerrentRow, 5).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
End If
WSReporte.Cell(CuerrentRow, 8).Value = Drow("Cargos").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 9).Value = Drow("Abonos").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 10).Value = Drow("SaldoActual").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("Cargos").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 8).Style.Font.FontColor = XLColor.Red
End If
If Drow("Abonos").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 9).Style.Font.FontColor = XLColor.Red
End If
If Drow("SaldoActual").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
End If
Else
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Fecha").ToString
WSReporte.Cell(CuerrentRow, 2).Value = Drow("TipoPoliza").ToString
WSReporte.Cell(CuerrentRow, 3).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Concepto").ToString
WSReporte.Cell(CuerrentRow, 5).Value = Drow("Referencia").ToString
WSReporte.Cell(CuerrentRow, 6).Value = Drow("ReferenciaAdmin").ToString
WSReporte.Cell(CuerrentRow, 7).Value = Drow("SubProyecto").ToString
TotalPadre = False
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.Bold = False
WSReporte.Cell(CuerrentRow, 10).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 8).Value = Drow("CargosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 9).Value = Drow("AbonosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 10).Value = Drow("Saldo").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("CargosMovto").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 8).Style.Font.FontColor = XLColor.Red
End If
If Drow("AbonosMovto").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 9).Style.Font.FontColor = XLColor.Red
End If
If Drow("Saldo").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
End If
CuerrentRow = CuerrentRow + 1
Next
For xy As Integer = 6 To CuerrentRow
WSReporte.Cell(xy, 10).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(xy, 1).Style.Border.LeftBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
Next
'CuerrentRow = CuerrentRow + 1
'WSReporte.Cell(CuerrentRow, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
'WSReporte.Cell(CuerrentRow, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
'WSReporte.Cell(CuerrentRow, 3).Value = $"Saldos Iniciales{vbCrLf}Deudor Acreedor"
'WSReporte.Cell(CuerrentRow, 4).Value = $"Cargos"
'WSReporte.Cell(CuerrentRow, 5).Value = $"Abonos"
'WSReporte.Cell(CuerrentRow, 6).Value = $"Saldo Actuales{vbCrLf} Deudor Acreedo"
WSReporte.Range($"A{CuerrentRow}:J{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Font.Bold = True
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Font.FontSize = 10
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'CuerrentRow = CuerrentRow + 1
'Dim ultimaFila As DataRow = DtDatos.Rows(DtDatos.Rows.Count - 1)
'Dim LastSaldoID As Decimal = ultimaFila("SaldoID").ToString.ToDecimal
'Dim LastTotalAbonos As Decimal = ultimaFila("TotalAbonos").ToString.ToDecimal
'Dim LastTotalCargos As Decimal = ultimaFila("TotalCargos").ToString.ToDecimal
'Dim LastSaldoAD As Decimal = ultimaFila("SaldoAD").ToString.ToDecimal
'Dim LastSaldoIA As Decimal = ultimaFila("SaldoIA").ToString.ToDecimal
'Dim LastSaldoAA As Decimal = ultimaFila("SaldoAA").ToString.ToDecimal
'WSReporte.Cell(CuerrentRow, 2).Value = "Sumas Iguales"
'WSReporte.Cell(CuerrentRow, 3).Value = LastSaldoID
'WSReporte.Cell(CuerrentRow, 4).Value = LastTotalCargos
'WSReporte.Cell(CuerrentRow, 5).Value = LastTotalAbonos
'WSReporte.Cell(CuerrentRow, 6).Value = LastSaldoAD
'WSReporte.Cell(CuerrentRow, 3).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 4).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 5).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 6).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
CuerrentRow = CuerrentRow + 1
'WSReporte.Cell(CuerrentRow, 3).Value = LastSaldoIA
'WSReporte.Cell(CuerrentRow, 6).Value = LastSaldoAA
'WSReporte.Cell(CuerrentRow, 3).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 6).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Range($"B{CuerrentRow}:F{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.PageSetup.PrintAreas.Add($"A1:G{CuerrentRow + 0 + 1}")
WSReporte.PageSetup.Margins.Top = 0.3
WSReporte.PageSetup.Margins.Left = 0.8
WSReporte.PageSetup.Margins.Right = 0.8
WSReporte.PageSetup.FitToPages(1, 1)
WBReporte.Worksheet(1).CopyTo(WBAnexoSalvar, "LibroMayor")
Return WBReporte.Worksheet(1)
End Function
Public Function CloneGridView(ByVal originalGridView As GridView) As GridView
' Crear un nuevo GridView
Dim clonedGridView As New GridView()
' Copiar propiedades básicas del GridView
clonedGridView.ID = originalGridView.ID & "_Copy"
clonedGridView.AutoGenerateColumns = originalGridView.AutoGenerateColumns
clonedGridView.CssClass = originalGridView.CssClass
clonedGridView.GridLines = originalGridView.GridLines
clonedGridView.HeaderStyle.CopyFrom(originalGridView.HeaderStyle)
clonedGridView.RowStyle.CopyFrom(originalGridView.RowStyle)
clonedGridView.AlternatingRowStyle.CopyFrom(originalGridView.AlternatingRowStyle)
clonedGridView.FooterStyle.CopyFrom(originalGridView.FooterStyle)
clonedGridView.EmptyDataText = originalGridView.EmptyDataText
clonedGridView.ShowHeader = originalGridView.ShowHeader
clonedGridView.ShowFooter = originalGridView.ShowFooter
' Copiar columnas
For Each col As DataControlField In originalGridView.Columns
' Crear una copia de la columna
Dim clonedCol As DataControlField = CType(Activator.CreateInstance(col.GetType()), DataControlField)
clonedCol.HeaderStyle.CopyFrom(col.HeaderStyle)
clonedCol.ItemStyle.CopyFrom(col.ItemStyle)
clonedCol.FooterStyle.CopyFrom(col.FooterStyle)
' Si es un BoundField, copiar propiedades específicas
If TypeOf col Is BoundField Then
Dim originalBoundField As BoundField = CType(col, BoundField)
Dim clonedBoundField As BoundField = CType(clonedCol, BoundField)
clonedBoundField.DataField = originalBoundField.DataField
clonedBoundField.HeaderText = originalBoundField.HeaderText
clonedBoundField.SortExpression = originalBoundField.SortExpression
clonedBoundField.ReadOnly = originalBoundField.ReadOnly
End If
' Añadir la columna clonada al nuevo GridView
clonedGridView.Columns.Add(clonedCol)
Next
' Copiar el DataSource (opcional, dependiendo de si deseas copiar los datos actuales)
clonedGridView.DataSource = originalGridView.DataSource
clonedGridView.DataBind()
Return clonedGridView
End Function
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
End Sub
End Class End Class

View File

@@ -1,265 +0,0 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="LibroMayor2.aspx.vb" Inherits="Conta_LibroMayor2" EnableEventValidation="false" %>
<asp:Content ContentPlaceHolderID="Css" runat="server">
<style>
.truncate {
width: 300px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
table {
border: none !important;
}
tr {
border: none !important;
}
td {
border: none !important;
}
</style>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel ID="UpAcciones" runat="server" >
<ContentTemplate>
<li>
<asp:LinkButton ID="ImgExcel" runat="server" Visible="true"><i class="fa fa-file-excel-o" ></i> Generar EXCEL</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ImgExcel" />
</Triggers>
</asp:UpdatePanel>
<%-- <li>
<asp:LinkButton ID="Imprimir" runat="server" Visible="false"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
</li>--%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Libro Mayor
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" CssClass="btn btn-default" OnClick="BtnConsultar_Click" ValidationGroup="Valida" />
<a href="javascript:;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a><%--class="expand"--%>
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
</div>
<div class="titlefiltros caption ">
<div class="row">
<div class="col-md-1">
Cuenta:
</div>
<div class="col-md-3">
<asp:DropDownList ID="DdlCuentas" runat="server" AppendDataBoundItems="true" DataTextField="CuentaFormatoNombre" DataValueField="CveCuenta" CssClass="form-control input-sm select2me" Enabled="false">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDdlCuentas" runat="server" InitialValue="-1" ControlToValidate="DdlCuentas" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cuenta''</b> es necesario, por favor ingréselo." ValidationGroup="GrpConsulta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="CERFVDdlCuentas" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlCuentas" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-1">
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="GrpConsulta"></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="GrpConsulta"></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">
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: 100% !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="GrpConsulta"></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="GrpConsulta"></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 class="portlet-body" <%= IIf(chkexpand.Checked = True, "", "style=""display:none;""")%>>
<div class="row">
<div class="col-md-1 ">
Tipo Movto
</div>
<div class="col-md-3 ">
<asp:DropDownList ID="DdlOpcionCuentas" runat="server" DataTextField="Cuenta" DataValueField="CveCuenta" TabIndex="4" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Con movimientos" Value="1"></asp:ListItem>
<asp:ListItem Text="Saldo actual no igual a cero" Value="2"></asp:ListItem>
<asp:ListItem Text="Con movimientos y saldo no igual a cero" Value="3"></asp:ListItem>
<asp:ListItem Text="Con movimientos o saldo no igual a cero" Value="4"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 " id="tdTipoReporte" visible="false" runat="server">
Tipo
</div>
<div class="col-md-2" id="tdTipoReporte2" visible="false" runat="server">
<asp:DropDownList ID="DdlTipoReporte" CssClass="form-control input-sm select2me" runat="server" Width="100%">
<asp:ListItem Text="Contable" Value="1"></asp:ListItem>
<asp:ListItem Text="Contable y Complementario" Value="3"></asp:ListItem>
<asp:ListItem Text="Complementario" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1" id="divProyecto" runat="server">
<asp:Label ID="LblProyecto" runat="server">Proyecto:</asp:Label>
</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlProyecto" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Width="95%">
</asp:DropDownList>
</div>
<asp:Label runat="server" ID="LblSubProyecto" CssClass="col-md-1">SubProyecto:</asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlSubproyecto" CssClass="form-control input-sm select2me" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="95%" AutoPostBack="True">
</asp:DropDownList>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row" style="margin-right: 10px; margin-top: 8px;" align="right">
<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>
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div style='color:red'></div>
<asp:GridView ID="GvDatos" runat="server"
CssClass="table table-striped table-advance table-hover " AutoGenerateColumns="False"
EmptyDataText="No se encontrarios movimientos."
DataKeyNames="" OnRowDataBound="GvDatos_RowDataBound">
<Columns>
<asp:TemplateField ControlStyle-CssClass="Widthall">
<HeaderTemplate>
<table width="100%" style="border: none">
<tr>
<td colspan="3"><font size="2">Cuenta</font></td>
<td colspan="1"><font size="2">Nombre</font></td>
<td colspan="4"></td>
<td><font size="2">Saldo Inicial</font></td>
</tr>
<tr>
<td width="60px" align="center">Fecha</td>
<td width="60px" align="center">Tipo</td>
<td width="60px" align="center">Número</td>
<td width="300px" align="left">Concepto</td>
<td width="100px" align="center">Referencia</td>
<td width="100px" align="center">Referencia Movto</td>
<td width="100px" align="center"><asp:Label ID="LblSubProyecto" runat="server"></asp:Label> </td>
<td width="100px" align="center">Cargos</td>
<td width="100px" align="center">Abonos</td>
<td width="100px" align="center">Saldo</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%" style="border: none">
<tr runat="server" id="tr1">
<td colspan="3" align="left" width="180px">
<asp:Label ID="LbCuenta" runat="server" Text='<%# Eval("Codigo")%>'></asp:Label>
</td>
<td colspan="1" align="left" width="300px">
<asp:Label ID="LbNombre" runat="server" Text='<%# Eval("Nombre")%>'></asp:Label>
</td>
<td colspan="2" width="200px"></td>
<td style="font-weight: normal;" align="right" width="100px">Saldo Inicial:
</td>
<td style="font-weight: normal;" align="right" width="100px">
<asp:Label ID="LbSaldoInicial" runat="server" Text='<%# Eval("SaldoInicial", "{0:N2}")%>'></asp:Label>
</td>
</tr>
<tr runat="server" id="tr2">
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LbFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Literal>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LbTipo" runat="server" Text='<%# Eval("TipoPoliza")%>'></asp:Literal>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:HyperLink ID="HLPoliza" runat="server" Text='<%# Eval("Folio")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</td>
<td width="300px" align="left">
<div class="truncate" style="width: 300px;">
<asp:Label ID="LbConcepto" runat="server" CssClass="truncate" Text='<%# Eval("Concepto")%>' title='<%# Eval("Concepto")%>'></asp:Label>
</div>
</td>
<td width="100px">
<asp:Label ID="LbReferencia" runat="server" Text='<%# Eval("Referencia")%>'></asp:Label>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LtlRefMovto" runat="server" Text='<%# Eval("ReferenciaAdmin")%>'></asp:Literal>
</td>
<td width="100px">
<asp:Label ID="LblSubProyecto" runat="server" Text='<%# Eval("SubProyecto")%>'></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbCargos" runat="server"></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbAbonos" runat="server"></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbSaldo" runat="server"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle />
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -1,746 +0,0 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports ADServerControl.DragableList
Imports System.IO
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Imports ClosedXML.Excel
Imports System.Drawing
Partial Class Conta_LibroMayor2
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Get
If ViewState("DtDatos") Is Nothing Then
ViewState("DtDatos") = New DataTable
End If
Return DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property DtTotales As DataTable
Get
DtTotales = DirectCast(ViewState("DtTotales"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtTotales") = value
End Set
End Property
Private Property FechaInicio As Date
Get
FechaInicio = ViewState("FechaInicio").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaInicio") = value
End Set
End Property
Private Property FechaFin As Date
Get
FechaFin = ViewState("FechaFin").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaFin") = value
End Set
End Property
Private Property TotalPadre As Boolean
Get
TotalPadre = CBool(ViewState("TotalPadre"))
End Get
Set(value As Boolean)
ViewState("TotalPadre") = value
End Set
End Property
Private Property DTCuentas As DataTable
Get
Return CType(ViewState("DTCuentas"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTCuentas") = value
End Set
End Property
Private Property TipoReporte As String
Get
TipoReporte = ViewState("TP").ToString
End Get
Set(value As String)
ViewState("TP") = value
End Set
End Property
Private Property Cuenta As String
Get
Return ViewState("Cuenta").ToString
End Get
Set(value As String)
ViewState("Cuenta") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim ErrorParametros As Boolean = True
CargaTipoCuentas()
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
txtFechaF.Text = NowADS().LastDayOfMonth.ToShortDateString
If Request("CveCuenta") IsNot Nothing AndAlso IsNumeric(Request("CveCuenta")) AndAlso Request("CveCuenta").ToEntero > 0 Then
If Request("FF") IsNot Nothing AndAlso Request("FF").ToString.Length = 10 AndAlso Request("FF").ToDate > "01/01/1000".ToDate Then
FechaFin = Request("FF").ToDate
txtFechaF.Text = FechaFin.ToShortDateString
DdlCuentas.SelectedValueExist(Request("CveCuenta").ToEntero)
If Request("FI") IsNot Nothing AndAlso Request("FI").ToString.Length = 10 AndAlso Request("FI").ToDate > "01/01/1000".ToDate Then
FechaInicio = Request("FI").ToDate
txtFechaI.Text = FechaInicio.ToShortDateString
Else
FechaInicio = DateSerial(Year(FechaFin), Month(FechaFin), 1)
txtFechaF.Text = FechaInicio.ToShortDateString
End If
If Request("CveProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveProyecto")) Then
DdlProyecto.SelectedValueExist(Request("CveProyecto"))
DdlProyecto_SelectedIndexChanged(Nothing, Nothing)
End If
If Request("CveSubProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveSubProyecto")) Then
DdlSubproyecto.SelectedValueExist(Request("CveSubProyecto"))
End If
ErrorParametros = False
If Request("TP") IsNot Nothing AndAlso IsNumeric(Request("TP")) AndAlso Request("TP").ToEntero > 0 Then
TipoReporte = Request("TP").ToString
End If
End If
End If
If Not ErrorParametros Then
TotalPadre = True
TipoReporte = "1"
CargaDatos()
End If
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
If DdlCuentas.SelectedValue.ToEntero = -2 Then
Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError)
Else
FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
CargaDatos()
End If
End Sub
#Region "C A R G A - D A T O S"
Private Sub CargaTipoCuentas()
Dim ObjTipoCuenta As New ClsContabilidad
DdlCuentas.Enabled = True
If ObjTipoCuenta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
DTCuentas = ObjTipoCuenta.DtResultados
DdlCuentas.DataSource = ObjTipoCuenta.DtResultados.FiltraParametros("Codigo NOT IN ('_ACTIVO', '_PASIVO', '_CAPITAL', '_CUADRE', '_ESTADISTICAS', '_ORDEN', '_RACREEDOR', '_RDEUDOR', '_UTILIDAD')")
End If
ObjTipoCuenta.Dispose()
DdlCuentas.DataBind()
CargarCentrosDeCosto(DdlProyecto, DdlSubproyecto, LblProyecto, LblSubProyecto, divProyecto:=divProyecto)
End Sub
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged
CargarSubProyecto(DdlSubproyecto, DdlProyecto.SelectedValue, "Todos")
End Sub
Private Sub CargaDatos(Optional RenderGv As Boolean = True)
Dim CveProyecto As Integer = DdlProyecto.SelectedValue.ToEntero
Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero
TipoReporte = DdlTipoReporte.SelectedValue.ToString
Cuenta = DdlCuentas.SelectedItem.ToString
Dim ObjConta As New ClsContabilidad
If ObjConta.GetLibroMayor2(DdlCuentas.SelectedValue.ToEntero, FechaInicio, FechaFin, -1, CveProyecto, CveSubProyecto, UsuarioActual.CveEmpresa, TipoReporte, DdlOpcionCuentas.SelectedValue.ToEntero) Then
DtDatos = ObjConta.DtResultados
DtTotales = DtDatos.Clone
If RenderGv Then
CargaGrid()
End If
Else
DtDatos = Nothing
End If
ObjConta.Dispose()
End Sub
#End Region
Private Sub InsertaTotales()
Dim i As Integer = 0
Dim Aumento As Integer = 0
Dim Row As DataRow
Dim Row2 As DataRow
'Llena DtTotales
For Each dr As DataRow In DtDatos.Rows
If dr("Concepto").ToString = "" Then
Row = DtTotales.NewRow
Row("CveCuenta") = -1
Row("CargosMovto") = If("1" = "1", dr("Cargos"), dr("CargosME"))
Row("AbonosMovto") = If("1" = "1", dr("Abonos"), dr("AbonosME"))
Row("Saldo") = dr("SaldoActual")
Row("CtaMayor") = dr("CtaMayor")
Row("Concepto") = String.Format("Total {0}:", dr("Nombre"))
Row("Nombre") = dr("Nombre")
DtTotales.Rows.Add(Row)
Row("Clasificacion") = i
End If
i += 1
Next
'Inserta Totales en DtDatos
For Each dr As DataRow In DtTotales.Rows
i = 0
If dr("CtaMayor").ToString = "1" Then
DtDatos.ImportRow(dr)
End If
If dr("CtaMayor").ToString = "2" Then
For index As Integer = dr("Clasificacion").ToString.ToEntero + Aumento To DtDatos.Rows.Count
If DtDatos.Rows(index)("Nombre").ToString <> dr("Nombre").ToString Then
i = index
Exit For
End If
Next
Row2 = DtDatos.NewRow
Row2.ItemArray = dr.ItemArray
DtDatos.Rows.InsertAt(Row2, i + Aumento)
Aumento += 1
End If
Next
End Sub
#Region "G R I D - GV DATOS"
Private Sub CargaGrid()
GvDatos.DataSource = DtDatos
'GvDatos.Dispose()
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
e.Row.FCLabel("LblSubProyecto").Text = LblSubProyecto.Text
End If
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Concepto") = "" Then
e.Row.ControlStyle.Font.Bold = True
e.Row.ControlStyle.Height = 35
'Cuando es Titulo
If e.Row.DBCampo("SaldoActual") = "" Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Visible = False
'Cuando Es Total
Else
CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
'Anterior para TotalPadre
'If e.Row.DBCampo("CtaMayor").ToString = "2" And (e.Row.DBCampo("Nivel3").ToString <> "" Xor e.Row.DBCampo("Orden").ToString.Length = 18) Then
' e.Row.FCLabel("LbReferencia").Text = "Total:"
'Else
' e.Row.FCLabel("LbConcepto").Text = String.Format("Total {0}:", e.Row.DBCampo("Nombre").ToString)
'End If
If TotalPadre Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Width = "1px"
'CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells.Remove(CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3))
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Align = "Right"
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Width = "400px"
If e.Row.RowIndex + 1 = DtDatos.Rows.Count Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(4).Attributes.Add("style", "border-top: 1px solid black;")
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(5).Attributes.Add("style", "border-top: 1px solid black;")
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(6).Attributes.Add("style", "border-top: 1px solid black;")
End If
e.Row.FCLabel("LbReferencia").Text = String.Format("Total {0}:", e.Row.DBCampo("Nombre").ToString)
Else
TotalPadre = True
e.Row.FCLabel("LbReferencia").Font.Bold = False
e.Row.FCLabel("LbReferencia").Text = "Total:"
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(4).Align = "Right"
End If
'e.Row.FCLabel("LbReferencia").Text = String.Format("Total {0}:", If(e.Row.DBCampo("CtaMayor").ToString = "2", "", e.Row.DBCampo("Nombre").ToString))
e.Row.FCLabel("LbCargos").Text = e.Row.DBCampo("Cargos").ToString.FormatoNumero(If("1" = "1", 2, 4))
e.Row.FCLabel("LbAbonos").Text = e.Row.DBCampo("Abonos").ToString.FormatoNumero(If("1" = "1", 2, 4))
e.Row.FCLabel("LbSaldo").Text = e.Row.DBCampo("SaldoActual").ToString.FormatoNumero(If("1" = "1", 2, 4))
End If
Else
TotalPadre = False
e.Row.ControlStyle.Font.Bold = False
CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
e.Row.FCHyperLink("HLPoliza").NavigateUrl = String.Format("/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}", e.Row.DBCampo("CvePoliza"))
If e.Row.DBCampo("CargosMovto").ToDouble <> 0 Then e.Row.FCLabel("LbCargos").Text = e.Row.DBCampo("CargosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
If e.Row.DBCampo("AbonosMovto").ToDouble <> 0 Then e.Row.FCLabel("LbAbonos").Text = e.Row.DBCampo("AbonosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
If e.Row.DBCampo("Saldo").ToDouble <> 0 Then e.Row.FCLabel("LbSaldo").Text = e.Row.DBCampo("Saldo").ToString.FormatoNumero(If("1" = "1", 2, 4))
End If
'COLOREA NEGATIVOS
If e.Row.FCLabel("LbCargos").Text.ToDouble < 0 Then
e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Black
End If
If e.Row.FCLabel("LbAbonos").Text.ToDouble < 0 Then
e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Black
End If
If e.Row.FCLabel("LbSaldo").Text.ToDouble < 0 Then
e.Row.FCLabel("LbSaldo").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbSaldo").ForeColor = Drawing.Color.Black
End If
If e.Row.FCLabel("LbSaldoInicial").Text.ToDouble < 0 Then
e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Black
End If
End If
End Sub
#End Region
Protected Sub Imprimir_click(sender As Object, e As EventArgs)
If DdlCuentas.SelectedValue.ToEntero = -1 Then
Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError)
Else
FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
DtDatos = DtDatos
ImprimirReporte()
End If
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
ImprimirReporte("Excel")
End Sub
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
Dim WBLibroMayor = New ClosedXML.Excel.XLWorkbook
Dim TipoReporte = DdlTipoReporte.SelectedValue.ToEntero
FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
DtDatos.Rows.Clear()
CargaDatos(False)
If DtDatos.Rows.Count > 0 Then
Dim sp As String = If(DdlSubproyecto.SelectedValue.ToEntero > 0, DdlSubproyecto.SelectedItem.Text, "")
WBLibroMayor.AddWorksheet(WSDocumento(sp, DtDatos))
WBLibroMayor.Worksheet(1).Name = $"LibroMayor"
End If
Dim msB = New MemoryStream()
WBLibroMayor.SaveAs(msB)
Dim BB As Byte() = msB.ToArray
msB.Dispose()
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment; filename=Balanza_" & Now.ToString("yyyyMMddhhmmss") & ".xlsx")
Response.ContentType = "application/vnd.ms-excel"
Response.BinaryWrite(BB)
Response.End()
End Sub
Function WSDocumento(SubProyecto As String, DtDatos As DataTable) As IXLWorksheet
Dim WBAnexoSalvar = New ClosedXML.Excel.XLWorkbook
Dim WBReporte = New ClosedXML.Excel.XLWorkbook()
WBReporte.Worksheets.Add("1")
Dim WSReporte = WBReporte.Worksheet(1)
Dim RutaLogo As String = String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)
If File.Exists(RutaLogo) Then
Dim imagePath As String = RutaLogo
Dim img As Bitmap = New Bitmap(imagePath)
Dim picture = WSReporte.AddPicture(img).MoveTo(WSReporte.Cell("A1"))
picture.Scale(0.5)
End If
Dim Tamaniofuente As Integer = 13
Dim Range = WSReporte.Range("A1:D1")
WSReporte.Style.Font.FontSize = 10
WSReporte.Style.Font.FontName = "Arial Narrow"
WSReporte.Style.Alignment.WrapText = True
Range.Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A1:J1").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A2:J2").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A3:J3").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A4:J4").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A5:J5").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A1:A5").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Column(1).Width = 15
WSReporte.Column(2).Width = 15
WSReporte.Column(3).Width = 14
WSReporte.Column(4).Width = 70
WSReporte.Column(5).Width = 35
WSReporte.Column(6).Width = 20
WSReporte.Column(7).Width = 14
WSReporte.Column(8).Width = 14
WSReporte.Column(9).Width = 14
WSReporte.Column(10).Width = 14
WSReporte.Cell(1, 1).Value = UsuarioActual.Empresa.Empresa
WSReporte.Cell(2, 1).Value = $"Libro Mayor del {txtFechaI.Text} al {txtFechaF.Text}"
If SubProyecto.Length > 0 Then
WSReporte.Cell(5, 1).Value = $"Sub Proyecto: {SubProyecto}"
WSReporte.Cell(5, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left
WSReporte.Cell(5, 1).Style.Font.Bold = True
End If
WSReporte.Cell(6, 1).Value = "Fecha"
WSReporte.Cell(6, 2).Value = $"Cuenta{vbCrLf}Tipo"
WSReporte.Cell(6, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 3).Value = $"Número"
WSReporte.Cell(6, 4).Value = $"Concepto"
WSReporte.Cell(6, 5).Value = $"Referencia"
WSReporte.Cell(6, 6).Value = $"Referencia Movto"
WSReporte.Cell(6, 7).Value = $"{LblSubProyecto.Text}"
WSReporte.Cell(6, 8).Value = $"Cargos"
WSReporte.Cell(6, 9).Value = $"Abonos"
WSReporte.Cell(6, 10).Value = $"Saldo"
WSReporte.Range("A6:J6").Style.Font.Bold = True
WSReporte.Range("A6:J6").Style.Font.FontSize = 10
WSReporte.Range("A6:J6").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Range("A6:J6").Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:J6").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:J6").Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
Dim CuerrentRow As Integer = 7
CuerrentRow = CuerrentRow + 1
For Each Drow As DataRow In DtDatos.Rows
If Drow("Concepto").ToString = "" Then
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.Bold = True
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.FontSize = FontSize.XXLarge '35
If Drow("SaldoActual").ToString = "" Then
'CType(e.Row.FindControl("tr2"), HtmlTableRow).Visible = False
'Cuando Es Total
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Codigo").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Nombre").ToString
WSReporte.Cell(CuerrentRow, 9).Value = "Saldo Inicial:"
WSReporte.Cell(CuerrentRow, 10).Value = Drow("SaldoInicial").ToString
WSReporte.Cell(CuerrentRow, 10).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Cell(CuerrentRow, 10).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("SaldoInicial").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
Else
'CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Fecha").ToString
WSReporte.Cell(CuerrentRow, 2).Value = Drow("TipoPoliza").ToString
WSReporte.Cell(CuerrentRow, 3).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Concepto").ToString
WSReporte.Cell(CuerrentRow, 5).Value = Drow("Referencia").ToString
WSReporte.Cell(CuerrentRow, 6).Value = Drow("ReferenciaAdmin").ToString
WSReporte.Cell(CuerrentRow, 7).Value = Drow("SubProyecto").ToString
If TotalPadre Then
WSReporte.Cell(CuerrentRow, 5).Value = String.Format("Total {0}:", Drow("Nombre").ToString)
WSReporte.Cell(CuerrentRow, 5).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
Else
TotalPadre = True
WSReporte.Cell(CuerrentRow, 5).Style.Font.Bold = False
WSReporte.Cell(CuerrentRow, 5).Value = "Total:"
WSReporte.Cell(CuerrentRow, 5).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
End If
WSReporte.Cell(CuerrentRow, 8).Value = Drow("Cargos").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 9).Value = Drow("Abonos").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 10).Value = Drow("SaldoActual").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("Cargos").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 8).Style.Font.FontColor = XLColor.Red
End If
If Drow("Abonos").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 9).Style.Font.FontColor = XLColor.Red
End If
If Drow("SaldoActual").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
End If
Else
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Fecha").ToString
WSReporte.Cell(CuerrentRow, 2).Value = Drow("TipoPoliza").ToString
WSReporte.Cell(CuerrentRow, 3).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Concepto").ToString
WSReporte.Cell(CuerrentRow, 5).Value = Drow("Referencia").ToString
WSReporte.Cell(CuerrentRow, 6).Value = Drow("ReferenciaAdmin").ToString
WSReporte.Cell(CuerrentRow, 7).Value = Drow("SubProyecto").ToString
TotalPadre = False
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.Bold = False
WSReporte.Cell(CuerrentRow, 10).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 8).Value = Drow("CargosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 9).Value = Drow("AbonosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 10).Value = Drow("Saldo").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("CargosMovto").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 8).Style.Font.FontColor = XLColor.Red
End If
If Drow("AbonosMovto").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 9).Style.Font.FontColor = XLColor.Red
End If
If Drow("Saldo").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
End If
CuerrentRow = CuerrentRow + 1
Next
For xy As Integer = 6 To CuerrentRow
WSReporte.Cell(xy, 10).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(xy, 1).Style.Border.LeftBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
Next
'CuerrentRow = CuerrentRow + 1
'WSReporte.Cell(CuerrentRow, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
'WSReporte.Cell(CuerrentRow, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
'WSReporte.Cell(CuerrentRow, 3).Value = $"Saldos Iniciales{vbCrLf}Deudor Acreedor"
'WSReporte.Cell(CuerrentRow, 4).Value = $"Cargos"
'WSReporte.Cell(CuerrentRow, 5).Value = $"Abonos"
'WSReporte.Cell(CuerrentRow, 6).Value = $"Saldo Actuales{vbCrLf} Deudor Acreedo"
WSReporte.Range($"A{CuerrentRow}:J{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Font.Bold = True
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Font.FontSize = 10
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'CuerrentRow = CuerrentRow + 1
'Dim ultimaFila As DataRow = DtDatos.Rows(DtDatos.Rows.Count - 1)
'Dim LastSaldoID As Decimal = ultimaFila("SaldoID").ToString.ToDecimal
'Dim LastTotalAbonos As Decimal = ultimaFila("TotalAbonos").ToString.ToDecimal
'Dim LastTotalCargos As Decimal = ultimaFila("TotalCargos").ToString.ToDecimal
'Dim LastSaldoAD As Decimal = ultimaFila("SaldoAD").ToString.ToDecimal
'Dim LastSaldoIA As Decimal = ultimaFila("SaldoIA").ToString.ToDecimal
'Dim LastSaldoAA As Decimal = ultimaFila("SaldoAA").ToString.ToDecimal
'WSReporte.Cell(CuerrentRow, 2).Value = "Sumas Iguales"
'WSReporte.Cell(CuerrentRow, 3).Value = LastSaldoID
'WSReporte.Cell(CuerrentRow, 4).Value = LastTotalCargos
'WSReporte.Cell(CuerrentRow, 5).Value = LastTotalAbonos
'WSReporte.Cell(CuerrentRow, 6).Value = LastSaldoAD
'WSReporte.Cell(CuerrentRow, 3).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 4).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 5).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 6).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
CuerrentRow = CuerrentRow + 1
'WSReporte.Cell(CuerrentRow, 3).Value = LastSaldoIA
'WSReporte.Cell(CuerrentRow, 6).Value = LastSaldoAA
'WSReporte.Cell(CuerrentRow, 3).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Cell(CuerrentRow, 6).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
'WSReporte.Range($"B{CuerrentRow}:F{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.PageSetup.PrintAreas.Add($"A1:G{CuerrentRow + 0 + 1}")
WSReporte.PageSetup.Margins.Top = 0.3
WSReporte.PageSetup.Margins.Left = 0.8
WSReporte.PageSetup.Margins.Right = 0.8
WSReporte.PageSetup.FitToPages(1, 1)
WBReporte.Worksheet(1).CopyTo(WBAnexoSalvar, "LibroMayor")
Return WBReporte.Worksheet(1)
End Function
Public Function CloneGridView(ByVal originalGridView As GridView) As GridView
' Crear un nuevo GridView
Dim clonedGridView As New GridView()
' Copiar propiedades básicas del GridView
clonedGridView.ID = originalGridView.ID & "_Copy"
clonedGridView.AutoGenerateColumns = originalGridView.AutoGenerateColumns
clonedGridView.CssClass = originalGridView.CssClass
clonedGridView.GridLines = originalGridView.GridLines
clonedGridView.HeaderStyle.CopyFrom(originalGridView.HeaderStyle)
clonedGridView.RowStyle.CopyFrom(originalGridView.RowStyle)
clonedGridView.AlternatingRowStyle.CopyFrom(originalGridView.AlternatingRowStyle)
clonedGridView.FooterStyle.CopyFrom(originalGridView.FooterStyle)
clonedGridView.EmptyDataText = originalGridView.EmptyDataText
clonedGridView.ShowHeader = originalGridView.ShowHeader
clonedGridView.ShowFooter = originalGridView.ShowFooter
' Copiar columnas
For Each col As DataControlField In originalGridView.Columns
' Crear una copia de la columna
Dim clonedCol As DataControlField = CType(Activator.CreateInstance(col.GetType()), DataControlField)
clonedCol.HeaderStyle.CopyFrom(col.HeaderStyle)
clonedCol.ItemStyle.CopyFrom(col.ItemStyle)
clonedCol.FooterStyle.CopyFrom(col.FooterStyle)
' Si es un BoundField, copiar propiedades específicas
If TypeOf col Is BoundField Then
Dim originalBoundField As BoundField = CType(col, BoundField)
Dim clonedBoundField As BoundField = CType(clonedCol, BoundField)
clonedBoundField.DataField = originalBoundField.DataField
clonedBoundField.HeaderText = originalBoundField.HeaderText
clonedBoundField.SortExpression = originalBoundField.SortExpression
clonedBoundField.ReadOnly = originalBoundField.ReadOnly
End If
' Añadir la columna clonada al nuevo GridView
clonedGridView.Columns.Add(clonedCol)
Next
' Copiar el DataSource (opcional, dependiendo de si deseas copiar los datos actuales)
clonedGridView.DataSource = originalGridView.DataSource
clonedGridView.DataBind()
Return clonedGridView
End Function
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
End Sub
End Class

View File

@@ -0,0 +1,116 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="LibroMayorCI.aspx.vb" Inherits="Contabilidad_LibroMayorCI" %>
<asp:Content ContentPlaceHolderID="Css" runat="server">
<style>
.truncate {
width: 300px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<li>
<asp:LinkButton ID="ImgExcel" Visible="false" runat="server"><i class="fa fa-ad-excel"></i> Generar EXCEL</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="Imprimir" Visible="false" runat="server"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ImgExcel" />
<asp:PostBackTrigger ControlID="Imprimir" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Libro Mayor
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" CssClass="btn btn-primary" Text="Consultar" Width="100px" OnClick="BtnConsultar_Click" Enabled="false"/>
</div>
<div class="titlefiltros caption ">
<div class="row">
<label class="col-md-1" style="width: 90px; padding-right: 2px;">Fecha Inicio:</label>
<div class="col-md-2" style="width: 140px;">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 80px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaDel" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgCalendarioDel" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaDel" runat="server" TargetControlID="TxtFechaDel" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalendarioDel" runat="server" TargetControlID="TxtFechaDel" PopupButtonID="ImgCalendarioDel" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaDel" runat="server" ControlToValidate="TxtFechaDel" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFecha2Del" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaDel" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<label class="col-md-1" style="width: 80px; padding-right: 2px;">Fecha Fin:</label>
<div class="col-md-2" style="width: 140px;">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 80px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaAl" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgCalendarioAl" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaAl" runat="server" TargetControlID="TxtFechaAl" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalendarioAl" runat="server" TargetControlID="TxtFechaAl" PopupButtonID="ImgCalendarioAl" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaAl" runat="server" ControlToValidate="TxtFechaAl" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFecha2Al" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaAl" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<%-- <label class="col-md-2" style="width: 60px;">Moneda:</label>
<div class="col-md-1">
<asp:DropDownList ID="DdlMoneda" CssClass="select2me" runat="server" DataTextField="Moneda" DataValueField="CveMoneda" TabIndex="5" ClientIDMode="Static">
</asp:DropDownList>
</div>--%>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<%-- <br />
<div class="text-right">Buscar :
<input type="text" id="Buscar" style="margin-right: 30px;" />
</div>--%>
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server" style="margin-left: 15px; margin-right: 15px;">
<ContentTemplate>
<asp:GridView ID="GvDatos" CssClass="table table-striped table-hover Widthall" GridLines="None" AutoGenerateColumns="False" runat="server">
<Columns>
<asp:BoundField HeaderText="Fecha" DataField="Fecha" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Tipo" DataField="TipoPol" />
<asp:BoundField HeaderText="Poliza" DataField="Folio" />
<asp:BoundField HeaderText="Descripción" DataField="Concepto" />
<asp:BoundField HeaderText="Cargos" DataField="Cargos" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.00}" />
<asp:BoundField HeaderText="Abonos" DataField="Abonos" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.00}" />
<asp:BoundField HeaderText="Saldo" DataField="Saldo" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.00}" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -0,0 +1,220 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Contabilidad_LibroMayorCI
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Get
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property FechaInicio As Date
Get
FechaInicio = ViewState("FechaInicio").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaInicio") = value
End Set
End Property
Private Property FechaFin As Date
Get
FechaFin = ViewState("FechaFin").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaFin") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
InicializaValores()
If UsuarioActual.Empresa.UsaAC Then
BtnConsultar.Enabled = True
Else
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
BtnConsultar.Enabled = True
Else
Alert("La empresa no usa Armonización Contable", TipoMensaje.MsgError)
End If
End If
End If
End Sub
Private Sub InicializaValores()
TxtFechaDel.Text = $"01/01/{NowADS().Year}"
TxtFechaAl.Text = NowADS().ToShortDateString
'DdlMoneda.DataSource = GlobalDTMonedas
'DdlMoneda.DataBind()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
#Region "C A R G A - D A T O S"
Private Sub CargaDatos()
FechaInicio = If(IsDate(TxtFechaDel.Text), TxtFechaDel.Text.ToDate, MinFecha)
FechaFin = If(IsDate(TxtFechaAl.Text), TxtFechaAl.Text.ToDate, MaxFecha)
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
Dim ObjConta As New ClsContabilidad
If ObjConta.GetLibroMayorSIG(-1, FechaInicio, FechaFin, 1, UsuarioActual.CveEmpresa) Then
DtDatos = ObjConta.DtResultados
Else
DtDatos = Nothing
End If
ObjConta.Dispose()
Else
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
If ObjConta.GetLibroMayor(1, FechaInicio, FechaFin, 1) Then
DtDatos = ObjConta.DtResultados
Else
DtDatos = Nothing
End If
ObjConta.Dispose()
End If
If DtDatos IsNot Nothing Then
ImgExcel.Visible = True
Imprimir.Visible = True
CargaGrid()
Else
ImgExcel.Visible = False
Imprimir.Visible = False
End If
End Sub
#End Region
#Region "G R I D - GV DATOS"
Private Sub CargaGrid()
GvDatos.DataSource = DtDatos
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'0 Fecha
'1 TipoPol
'2 Folio
'3 Concepto
'4 Cargos
'5 Abonos
'6 Saldo
'CABECERA
If e.Row.DBCampo("TipoRenglon") = "1" Then
e.Row.Font.Bold = True
e.Row.Cells(0).Text = ""
e.Row.Cells(1).Text = ""
e.Row.Cells(2).Text = ""
e.Row.Cells(3).Text = e.Row.DBCampo("Nombre")
e.Row.Cells(4).Text = ""
e.Row.Cells(5).Text = "Saldo inicial:"
e.Row.Cells(6).Text = e.Row.DBCampo("SaldoInicial").FormatoNumero
e.Row.CssClass = "Totales"
End If
'DETALLE
If e.Row.DBCampo("TipoRenglon") = "2" Then
End If
'SUBTOTAL
If e.Row.DBCampo("TipoRenglon") = "3" Then
e.Row.Font.Bold = True
e.Row.Cells(1).Text = ""
e.Row.Cells(2).Text = ""
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(3).Text = "SubTotal:"
e.Row.Cells(6).Text = ""
e.Row.CssClass = "SubTotales"
End If
'TOTAL
If e.Row.DBCampo("TipoRenglon") = "4" Then
e.Row.Font.Bold = True
e.Row.Cells(0).Text = ""
e.Row.Cells(1).Text = ""
e.Row.Cells(2).Text = ""
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(3).Text = $"Total ({e.Row.DBCampo("Nombre")}):"
e.Row.Cells(6).Text = ""
e.Row.CssClass = "Totales"
End If
End If
End Sub
#End Region
#Region " IMPRIMIR "
#End Region
Protected Sub Imprimir_click(sender As Object, e As EventArgs) Handles Imprimir.Click
FechaInicio = If(TxtFechaDel.Text = "" Or TxtFechaDel.Text = "__/__/____", NowADS(), TxtFechaDel.Text.ToDate)
FechaFin = If(TxtFechaAl.Text = "" Or TxtFechaAl.Text = "__/__/____", NowADS(), TxtFechaAl.Text.ToDate)
DtDatos = DtDatos
ImprimirReporte()
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
FechaInicio = If(TxtFechaDel.Text = "" Or TxtFechaDel.Text = "__/__/____", NowADS(), TxtFechaDel.Text.ToDate)
FechaFin = If(TxtFechaAl.Text = "" Or TxtFechaAl.Text = "__/__/____", NowADS(), TxtFechaAl.Text.ToDate)
DtDatos = DtDatos
ImprimirReporte("EXCEL")
End Sub
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim lista = New List(Of CrystalParametro)
lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa))
lista.Add(New CrystalParametro("FechaInicio", FechaInicio.ToString("dd/MM/yyyy")))
lista.Add(New CrystalParametro("FechaFin", FechaFin.ToString("dd/MM/yyyy")))
lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre))
lista.Add(New CrystalParametro("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/LibroMayor.rpt"), DtDatos, lista, "LibroMayor", Formato), "LibroMayor", Formato)
End Sub
End Class

View File

@@ -2884,7 +2884,7 @@ Partial Class Inventarios_EntradasSalidas
DdlProducto2.SelectedValue = GvRow.DataKey("CvePS") DdlProducto2.SelectedValue = GvRow.DataKey("CvePS")
DdlProducto2.SelectedText = GvRow.DataKey("CodigoPS") DdlProducto2.SelectedText = GvRow.DataKey("CodigoPS")
ElProductoChange() ElProductoChange()
DdlUnidad.SelectedValue = GvRow.DataKey("CveUM") DdlUnidad.SelectedValueExist(GvRow.DataKey("CveUM"))
CveAFEdit = GvRow.DataKey("CveAF").ToEntero CveAFEdit = GvRow.DataKey("CveAF").ToEntero
txtPrecio.Text = GvRow.DataKey("PU").ToDouble.ToString("0.00########") txtPrecio.Text = GvRow.DataKey("PU").ToDouble.ToString("0.00########")
TxtnSerie.Text = GvRow.DataKey("Serie") TxtnSerie.Text = GvRow.DataKey("Serie")

View File

@@ -644,8 +644,8 @@ Partial Class OC_OC
GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa) = Nothing GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa) = Nothing
CargaDatosAgregarPS() CargaDatosAgregarPS()
CveProveedorOriginal = -1 CveProveedorOriginal = -1
EnviarNotificacionWhatsApp("526621430964", "hola34 https:/sig.adssistemas.mx/ventas/ventas.aspx") 'EnviarNotificacionWhatsApp("526621430964", "hola34 https:/sig.adssistemas.mx/ventas/ventas.aspx")
EnviarNotificacionWhatsApp("526621430964", "", "hello_world") 'EnviarNotificacionWhatsApp("526621430964", "", "hello_world")
'MODALIDAD MULTIEMPRESA 'MODALIDAD MULTIEMPRESA
CveEmpresaActual = UsuarioActual.CveEmpresa CveEmpresaActual = UsuarioActual.CveEmpresa
If CveEmpresaActual > 0 Then If CveEmpresaActual > 0 Then
@@ -1647,7 +1647,7 @@ Partial Class OC_OC
DdlProveedores.SelectedValue = objOC.CveProveedor.ToString DdlProveedores.SelectedValue = objOC.CveProveedor.ToString
If DdlProveedores.SelectedValue.ToEntero > 0 Then If DdlProveedores.SelectedValue.ToEntero > 0 Then
CveProveedorOriginal = objOC.CveProveedor CveProveedorOriginal = objOC.CveProveedor
DdlProveedores.SelectedText = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveProveedor = {objOC.CveProveedor}").Rows(0)("RazonSocial").ToString DdlProveedores.SelectedText = GlobalDTCompProveedores(UsuarioActual.CveEmpresa, CveProveedor:=objOC.CveProveedor).FiltroPrimeroValor("RazonSocial")
Else Else
DdlProveedores.SelectedText = "-" DdlProveedores.SelectedText = "-"
End If End If
@@ -1697,7 +1697,7 @@ Partial Class OC_OC
ChkCotizacion.Visible = True ChkCotizacion.Visible = True
DdlProveedores.SelectedValue = objOC.CveProveedor.ToString DdlProveedores.SelectedValue = objOC.CveProveedor.ToString
If DdlProveedores.SelectedValue.ToEntero > 0 Then If DdlProveedores.SelectedValue.ToEntero > 0 Then
DdlProveedores.SelectedText = GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {objOC.CveProveedor}").Rows(0)("RazonSocial").ToString DdlProveedores.SelectedText = GlobalDTCompProveedores(UsuarioActual.CveEmpresa, CveProveedor:=objOC.CveProveedor).FiltroPrimeroValor("RazonSocial")
Else Else
DdlProveedores.SelectedText = "-" DdlProveedores.SelectedText = "-"
End If End If
@@ -2756,8 +2756,6 @@ Partial Class OC_OC
End Function End Function
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
'VALIDACIONES PARA GUARDAR 'VALIDACIONES PARA GUARDAR
If ValidaGuardar() Then Exit Sub If ValidaGuardar() Then Exit Sub
@@ -2765,8 +2763,6 @@ Partial Class OC_OC
Exit Sub Exit Sub
End If End If
Dim MsgError As String = "Hubo un error al registrar" Dim MsgError As String = "Hubo un error al registrar"
'VARIABLES 'VARIABLES
Dim CveProveedorSucursal As Integer = -1 Dim CveProveedorSucursal As Integer = -1
@@ -3740,7 +3736,7 @@ Partial Class OC_OC
If CveProveedor > 0 Then If CveProveedor > 0 Then
'CUANDO VIENE DE COTIZACION 'CUANDO VIENE DE COTIZACION
tTotalIVA = (DtDetalle.SUM("Total", String.Format("CveProveedor = {0}", CveProveedor)) * tPorIVA).ToString.ToDecimal tTotalIVA = (DtDetalle.SUM("Total", String.Format("CveProveedor = {0}", CveProveedor)) * tPorIVA).ToString.ToDecimal
tPorIVA = GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros(String.Format("CveProveedor = {0}", CveProveedor)).Rows(0)("IVA").ToString.ToDecimal tPorIVA = GlobalDTCompProveedores(CveEmpresaActual, CveProveedor:=CveProveedor).FiltroPrimeroValor("IVA").ToDecimal
tTotalGral = DtDetalle.SUM("Total", String.Format("CveProveedor = {0}", CveProveedor)).ToString.ToDecimal tTotalGral = DtDetalle.SUM("Total", String.Format("CveProveedor = {0}", CveProveedor)).ToString.ToDecimal
Else Else
'CUANDO NO VIENE DE COTIZACION 'CUANDO NO VIENE DE COTIZACION
@@ -4260,7 +4256,6 @@ Partial Class OC_OC
End If End If
'SE TOMAN VALORES EN CASO DE QUE LA CvePS SEA DIFERENTE DE LA ANTERIOR 'SE TOMAN VALORES EN CASO DE QUE LA CvePS SEA DIFERENTE DE LA ANTERIOR
Dim CvePSAnterior As Integer = gvr.DataKey("CvePS").ToEntero Dim CvePSAnterior As Integer = gvr.DataKey("CvePS").ToEntero
PS = gvr.DataKey("PS").ToString PS = gvr.DataKey("PS").ToString
@@ -4306,7 +4301,6 @@ Partial Class OC_OC
CveSubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero CveSubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero
SubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedItem.Text SubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedItem.Text
CveCultivoCuadroDetalle = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedValue.ToEntero CveCultivoCuadroDetalle = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedValue.ToEntero
Cuadro = "" Cuadro = ""
If CveCultivoCuadroDetalle > 0 Then If CveCultivoCuadroDetalle > 0 Then
@@ -4322,93 +4316,65 @@ Partial Class OC_OC
End If End If
If UsuarioActual.Empresa.Funcionalidad(532).Contiene("1", "2") Then If UsuarioActual.Empresa.Funcionalidad(532).Contiene("1", "2") Then
Dim ObjCon As New ClsContratos 'se envía el dato anterior, para restarlo y agregar el nuevo importe
Dim CvePresupuesto As Integer = 0 If Not ValidaPresupuesto(1, CveSubProyecto, SubProyecto, CveClasificacion, Clasificacion, (Importe * Cantidad).RoundSQL, DdlMoneda.SelectedValue.ToEntero, (gvr.DataKey("Importe").ToDecimal * gvr.DataKey("Cantidad").ToDecimal).RoundSQL) Then
Dim Autorizado As Decimal = 0 Exit Sub
Dim Ejercido As Decimal = 0
If ObjCon.GetPresupuestos(-1, "-1", CveSubProyecto, 2, -1, UsuarioActual.CveEmpresa) Then
If ObjCon.DtResultados.Rows.Count > 0 Then
CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero
If CvePresupuesto > 0 Then
If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then
If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion} And Importe > 0").Rows.Count > 0 Then
Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion} And Importe > 0").Rows(0)("Importe").ToString.ToDecimal
End If
End If
If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{NowADS().Year - 1}".ToDate, NowADS(), UsuarioActual.CveEmpresa, CveProyecto,
CveSubProyecto, UsuarioActual.CveUsuario, CveClasificacion) Then
If ObjCon.DtResultados.Rows.Count > 0 Then
Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDecimal
End If
End If
End If
End If
End If End If
ObjCon.Dispose()
'If CvePresupuesto > 0 And Autorizado > 0 Then
' Dim Diferencia As Decimal = (Ejercido + Total) - Autorizado
' If Diferencia > 0 Then
' Alert($"No hay presupuesto disponible en el subproyecto <b>{SubProyecto}</b> y la clasificación <b>{Clasificacion}</b> se excede por <b>{Diferencia.FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
'End If
End If End If
'Agarra el nuevo AF si se modifico o deja el pasado 'Agarra el nuevo AF si se modifico o deja el pasado
CveActivoFijo = If(gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero > 0, gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero, HdnEditCveActivoFijo.Value.ToEntero) CveActivoFijo = If(gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero > 0, gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero, HdnEditCveActivoFijo.Value.ToEntero)
Codigo = If(gvr.FCHiddenField("HdnCodigoAF").Value <> "-1", gvr.FCHiddenField("HdnCodigoAF").Value, HdnEditCodigo.Value) Codigo = If(gvr.FCHiddenField("HdnCodigoAF").Value <> "-1", gvr.FCHiddenField("HdnCodigoAF").Value, HdnEditCodigo.Value)
HdnEditCveActivoFijo.Value = "" HdnEditCveActivoFijo.Value = ""
HdnEditCodigo.Value = "" HdnEditCodigo.Value = ""
Dim dr As DataRow() = DtDetalle.Select("CveOrdenCompraDetalle = " & gvr.DataKey("CveOrdenCompraDetalle").ToString.ToEntero) Dim dr As DataRow() = DtDetalle.Select("CveOrdenCompraDetalle = " & gvr.DataKey("CveOrdenCompraDetalle").ToString.ToEntero)
If dr.Count > 0 Then
dr(0)("Cantidad") = Cantidad
dr(0)("CveUnidadMedida") = CveUnidad
dr(0)("UM") = UM
dr(0)("CveClasificacion") = CveClasificacion
dr(0)("Clasificacion") = Clasificacion
dr(0)("Cantidad") = Cantidad If isWithFamily() Then
dr(0)("CveUnidadMedida") = CveUnidad dr(0)("CveSubFamilia") = CveClasificacion
dr(0)("UM") = UM dr(0)("SubFamilia") = Clasificacion
dr(0)("CveClasificacion") = CveClasificacion End If
dr(0)("Clasificacion") = Clasificacion
If isWithFamily() Then dr(0)("CvePS") = CvePS
dr(0)("CveSubFamilia") = CveClasificacion dr(0)("PS") = PS
dr(0)("SubFamilia") = Clasificacion dr(0)("Observacion") = Obs
dr(0)("CveSubProyecto") = CveSubProyecto
dr(0)("SubProyecto") = SubProyecto
dr(0)("CveProyecto") = CveProyecto
dr(0)("Proyecto") = Proyecto
dr(0)("Importe") = Importe
dr(0)("Descuento") = Descuento
dr(0)("Total") = Total
dr(0)("IEPSPS") = IEPSPS * Total
dr(0)("IEPSPSPorcentaje") = IEPSPS
dr(0)("IEPSPSIVA") = IEPSPSIVA * Total
dr(0)("IEPSPSIVAPorcentaje") = IEPSPSIVA
'If DdlIVA.SelectedValue.ToDecimal = 1 Then dr(0)("IVA") = 0 Else dr(0)("IVA") = IvaPS * Total
dr(0)("IVAPorcentaje") = If(IvaPS = -1, Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), 0)
Dim TotalGravado As Decimal = Total
If IEPSPSIVA > 0 Then TotalGravado = Total * (1 + IEPSPSIVA) 'grava para iva, el importe del IEPS
dr(0)("IVA") = Math.Round(dr(0)("IVAPorcentaje").ToString.ToDecimal * TotalGravado, 2)
dr(0)("RetIVA") = (RetIVA * Total).RoundSQL(6)
dr(0)("RetIVAPorcentaje") = RetIVA
dr(0)("RetISR") = (RetISR * Total).RoundSQL(6)
dr(0)("RetISRPorcentaje") = RetISR
dr(0)("CveActivoFijo") = CveActivoFijo
dr(0)("CodigoAF") = Codigo
dr(0)("CveCultivoCuadroDetalle") = CveCultivoCuadroDetalle
dr(0)("Cuadro") = Cuadro
End If End If
dr(0)("CvePS") = CvePS
dr(0)("PS") = PS
dr(0)("Observacion") = Obs
dr(0)("CveSubProyecto") = CveSubProyecto
dr(0)("SubProyecto") = SubProyecto
dr(0)("CveProyecto") = CveProyecto
dr(0)("Proyecto") = Proyecto
dr(0)("Importe") = Importe
dr(0)("Descuento") = Descuento
dr(0)("Total") = Total
dr(0)("IEPSPS") = IEPSPS * Total
dr(0)("IEPSPSPorcentaje") = IEPSPS
dr(0)("IEPSPSIVA") = IEPSPSIVA * Total
dr(0)("IEPSPSIVAPorcentaje") = IEPSPSIVA
'If DdlIVA.SelectedValue.ToDecimal = 1 Then dr(0)("IVA") = 0 Else dr(0)("IVA") = IvaPS * Total
dr(0)("IVAPorcentaje") = If(IvaPS = -1, Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), 0)
Dim TotalGravado As Decimal = Total
If IEPSPSIVA > 0 Then TotalGravado = Total * (1 + IEPSPSIVA) 'grava para iva, el importe del IEPS
dr(0)("IVA") = Math.Round(dr(0)("IVAPorcentaje").ToString.ToDecimal * TotalGravado, 2)
dr(0)("RetIVA") = (RetIVA * Total).RoundSQL(6)
dr(0)("RetIVAPorcentaje") = RetIVA
dr(0)("RetISR") = (RetISR * Total).RoundSQL(6)
dr(0)("RetISRPorcentaje") = RetISR
dr(0)("CveActivoFijo") = CveActivoFijo
dr(0)("CodigoAF") = Codigo
dr(0)("CveCultivoCuadroDetalle") = CveCultivoCuadroDetalle
dr(0)("Cuadro") = Cuadro
'si el tipodato viene de la BD, entonces sufrió una actualización 'si el tipodato viene de la BD, entonces sufrió una actualización
If dr(0)("TipoDato").ToString.ToEntero = 2 Then dr(0)("TipoDato") = 1 If dr(0)("TipoDato").ToString.ToEntero = 2 Then dr(0)("TipoDato") = 1
DtDetalle.AcceptChanges() DtDetalle.AcceptChanges()
@@ -9213,7 +9179,7 @@ Partial Class OC_OC
''' <param name="ValImporte">Usado al validar Presupuesto cuando se agrega un producto o servicio </param> ''' <param name="ValImporte">Usado al validar Presupuesto cuando se agrega un producto o servicio </param>
''' <returns>Verdadero si hay presupuesto, Falso si no hay presupuesto.</returns> ''' <returns>Verdadero si hay presupuesto, Falso si no hay presupuesto.</returns>
Public Function ValidaPresupuesto(Opcion As Integer, Optional ValCveSubProyecto As Integer = -1, Optional ValSubProyecto As String = "", Optional ValCveClasificacion As Integer = -1, Optional ValClasificacion As String = "", Public Function ValidaPresupuesto(Opcion As Integer, Optional ValCveSubProyecto As Integer = -1, Optional ValSubProyecto As String = "", Optional ValCveClasificacion As Integer = -1, Optional ValClasificacion As String = "",
Optional ValImporte As Decimal = 0, Optional CveMoneda As Integer = 1) As Boolean Optional ValImporte As Decimal = 0, Optional CveMoneda As Integer = 1, Optional ImportePrevioGuardado As Decimal = 0) As Boolean
Dim respuesta As Boolean = False Dim respuesta As Boolean = False
@@ -9224,6 +9190,7 @@ Partial Class OC_OC
Dim Autorizado As Decimal = 0 Dim Autorizado As Decimal = 0
Dim Ejercido As Decimal = 0 Dim Ejercido As Decimal = 0
Dim FechaCompra As Date = TxtFecha.Text.ToDate Dim FechaCompra As Date = TxtFecha.Text.ToDate
ValImporte = (ValImporte - ImportePrevioGuardado)
If CveMoneda > 1 Then ValImporte = ValImporte * GlobalTipoCambio(FechaCompra).ToDecimal If CveMoneda > 1 Then ValImporte = ValImporte * GlobalTipoCambio(FechaCompra).ToDecimal
@@ -9289,19 +9256,17 @@ Partial Class OC_OC
row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion
Select row.Field(Of Decimal)(ColumnaSaldo)).Sum() Select row.Field(Of Decimal)(ColumnaSaldo)).Sum()
If saldoTotal > 0 Then If saldoTotal > 0 Then
Dim Diferencia As Decimal = saldoTotal - item.TotalSum Dim Diferencia As Decimal = saldoTotal - item.TotalSum
If (Diferencia) < 0 Then If (Diferencia) < 0 Then
Alert($"No hay presupuesto disponible en: <br/> Subproyecto: <b>{item.SubProyecto}</b><br/> Clasificación <b>{item.Clasificacion}</b>. Se excede por <b>{Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia) Alert($"No hay presupuesto disponible en: <br/> Subproyecto: <b>{item.SubProyecto}</b><br/> Clasificación <b>{item.Clasificacion}</b>. Se excede por <b>{Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
respuesta = True respuesta = False
Exit For Exit For
Else Else
respuesta = True respuesta = True
End If End If
Else Else
Alert($"No hay presupuesto disponible en: <br/> Subproyecto: <b>{item.SubProyecto}</b><br/> Clasificación <b>{item.Clasificacion}</b>.", TipoMensaje.MsgAdvertencia) Alert($"No hay presupuesto disponible en: <br/> Subproyecto: <b>{item.SubProyecto}</b><br/> Clasificación <b>{item.Clasificacion}</b>.", TipoMensaje.MsgAdvertencia)
respuesta = True respuesta = False
Exit For Exit For
End If End If
Else Else
@@ -9309,7 +9274,6 @@ Partial Class OC_OC
End If End If
Next Next
End If End If
Else Else
' Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia) ' Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
respuesta = True respuesta = True
@@ -9406,7 +9370,6 @@ Partial Class OC_OC
Dim descuentoParts As String() = TxtDescuentoEscalonado.Text.Split("+"c) Dim descuentoParts As String() = TxtDescuentoEscalonado.Text.Split("+"c)
For Each dRow As DataRow In DtDetalle.Rows For Each dRow As DataRow In DtDetalle.Rows
Dim PU As Decimal = dRow("Importe").ToString.ToDecimal Dim PU As Decimal = dRow("Importe").ToString.ToDecimal
@@ -9452,12 +9415,6 @@ Partial Class OC_OC
dRow("TipoDato") = 1 dRow("TipoDato") = 1
End If End If
Next Next
DtDetalle.AcceptChanges() DtDetalle.AcceptChanges()
@@ -9470,7 +9427,6 @@ Partial Class OC_OC
UpIvas.Update() UpIvas.Update()
UPPDetalle.Update() UPPDetalle.Update()
End Sub End Sub
Protected Sub BtnEdicionMasiva_Click(sender As Object, e As EventArgs) Protected Sub BtnEdicionMasiva_Click(sender As Object, e As EventArgs)
@@ -9484,17 +9440,13 @@ Partial Class OC_OC
End If End If
ModoEdicionMasiva() ModoEdicionMasiva()
End Sub End Sub
Private Sub ModoEdicionMasiva() Private Sub ModoEdicionMasiva()
If EstaEnmodiEdicionMasiva Then If EstaEnmodiEdicionMasiva Then
BtnEdicionMasiva.Text = "Aplicar Edición Masiva" BtnEdicionMasiva.Text = "Aplicar Edición Masiva"
For Each GvRow As GridViewRow In GvD.Rows For Each GvRow As GridViewRow In GvD.Rows
GvRow.FCTextBox("TxtEMObsPS").Visible = True GvRow.FCTextBox("TxtEMObsPS").Visible = True
GvRow.FCTextBox("TxtEMCantEdit").Visible = True GvRow.FCTextBox("TxtEMCantEdit").Visible = True
GvRow.FCTextBox("TxtEMDescuentoEdit").Visible = True GvRow.FCTextBox("TxtEMDescuentoEdit").Visible = True
@@ -9505,15 +9457,11 @@ Partial Class OC_OC
GvRow.FCLiteral("LtlDescuento").Visible = False GvRow.FCLiteral("LtlDescuento").Visible = False
GvRow.FCLabel("LtlImporte").Visible = False GvRow.FCLabel("LtlImporte").Visible = False
GvRow.FCLinkButton("imgE").Visible = False GvRow.FCLinkButton("imgE").Visible = False
'observación, PU, descuento, cantidad 'observación, PU, descuento, cantidad
Next Next
Else Else
'GvD_RecalculaEdicionMasiva() 'GvD_RecalculaEdicionMasiva()
BtnEdicionMasiva.Text = "Edición Masiva" BtnEdicionMasiva.Text = "Edición Masiva"
For Each GvRow As GridViewRow In GvD.Rows For Each GvRow As GridViewRow In GvD.Rows
GvRow.FCTextBox("TxtEMObsPS").Visible = False GvRow.FCTextBox("TxtEMObsPS").Visible = False
@@ -9526,39 +9474,28 @@ Partial Class OC_OC
GvRow.FCLiteral("LtlDescuento").Visible = True GvRow.FCLiteral("LtlDescuento").Visible = True
GvRow.FCLabel("LtlImporte").Visible = True GvRow.FCLabel("LtlImporte").Visible = True
GvRow.FCLinkButton("imgE").Visible = True GvRow.FCLinkButton("imgE").Visible = True
Next Next
End If End If
RegistraScript("$(document).ready(function() {setTimeout(function() {document.getElementById('DVSeccionGVD').scrollIntoView({ behavior: 'smooth' }); }, 250);});", "100") RegistraScript("$(document).ready(function() {setTimeout(function() {document.getElementById('DVSeccionGVD').scrollIntoView({ behavior: 'smooth' }); }, 250);});", "100")
UPPDetalle.Update() UPPDetalle.Update()
uppOpciones.Update() uppOpciones.Update()
End Sub End Sub
Private Function GvD_RecalculaEdicionMasiva() As Boolean Private Function GvD_RecalculaEdicionMasiva() As Boolean
For Each gvr As GridViewRow In GvD.Rows For Each gvr As GridViewRow In GvD.Rows
Dim Cantidad, Importe, Descuento As Decimal Dim Cantidad, Importe, Descuento As Decimal
Cantidad = gvr.FCTextBox("TxtEMCantEdit").Text.Trim.ToDecimal Cantidad = gvr.FCTextBox("TxtEMCantEdit").Text.Trim.ToDecimal
Importe = gvr.FCTextBox("TxtEMImporteEdit").Text.Trim.ToDecimal Importe = gvr.FCTextBox("TxtEMImporteEdit").Text.Trim.ToDecimal
Descuento = gvr.FCTextBox("TxtEMDescuentoEdit").Text.Trim.ToDecimal Descuento = gvr.FCTextBox("TxtEMDescuentoEdit").Text.Trim.ToDecimal
Dim PS As String = gvr.DataKey("PS").ToString Dim PS As String = gvr.DataKey("PS").ToString
Dim Total As Decimal = Importe * Cantidad - Descuento Dim Total As Decimal = Importe * Cantidad - Descuento
'VALIDA 'VALIDA
If Descuento > 0 AndAlso ((Cantidad * Importe) <= Descuento) Then If Descuento > 0 AndAlso ((Cantidad * Importe) <= Descuento) Then
Alert($"El producto {PS}, cantidad {Cantidad}, el campo <b>'Descuento'</b> no debe ser mayor o igual al total({(Cantidad * Importe).ToString("###,###,###.00")}).", TipoMensaje.MsgAdvertencia) Alert($"El producto {PS}, cantidad {Cantidad}, el campo <b>'Descuento'</b> no debe ser mayor o igual al total({(Cantidad * Importe).ToString("###,###,###.00")}).", TipoMensaje.MsgAdvertencia)
Return False Return False
End If End If
Next Next
For Each gvr As GridViewRow In GvD.Rows For Each gvr As GridViewRow In GvD.Rows

View File

@@ -350,19 +350,36 @@ Partial Class RepContratoDetalle
New ReportParameter("Servicio", TxtDescripcion.Text), New ReportParameter("Servicio", TxtDescripcion.Text),
New ReportParameter("Observaciones", TxtObservaciones.Text), New ReportParameter("Observaciones", TxtObservaciones.Text),
New ReportParameter("Ubicacion", TxtUbicacion.Text), New ReportParameter("Ubicacion", TxtUbicacion.Text),
New ReportParameter("FechaSalida", TxtFechaSalida.Text.ToDate.ToString("dd/MM/yyyy")), New ReportParameter("FechaSalida", TxtFechaSalida.Text.ToDate.ToString("dd/MM/yyyy HH:mm tt")),
New ReportParameter("FechaRegreso", TxtFechaRegreso.Text.ToDate.ToString("dd/MM/yyyy")), New ReportParameter("FechaRegreso", TxtFechaRegreso.Text.ToDate.ToString("dd/MM/yyyy HH:mm tt")),
New ReportParameter("CantidadPasajeros", TxtCantidadPasajeros.Text), New ReportParameter("CantidadPasajeros", TxtCantidadPasajeros.Text),
New ReportParameter("TipoAF", DdlTipoAF.SelectedItem.ToString()), New ReportParameter("TipoAF", DdlTipoAF.SelectedItem.ToString()),
New ReportParameter("Pesos", Math.Round(TxtImporte.Text.ToDecimal, 2).ToString), New ReportParameter("Pesos", TxtImporte.Text.ToDecimal.ToString("###,###,###.00")),
New ReportParameter("Moneda", DdlMoneda.SelectedItem.ToString), New ReportParameter("Moneda", DdlMoneda.SelectedItem.ToString),
New ReportParameter("Anticipo", Math.Round((TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal), 2).ToString), New ReportParameter("Anticipo", TxtAnticipo.Text.ToDecimal.ToString("###,###,###.00")),
New ReportParameter("Total", Math.Round((TxtImporte.Text.ToDecimal - (TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal)), 2).ToString), New ReportParameter("Total", (TxtImporte.Text.ToDecimal - (TxtAnticipo.Text.ToDecimal)).ToString("###,###,###.00")),
New ReportParameter("DiaSalida", $"{TxtFechaSalida.Text.ToDate.Hour}:{TxtFechaSalida.Text.ToDate.Minute} "), New ReportParameter("DiaSalida", TxtFechaSalida.Text.ToDate.ToString("HH:mm tt")),
New ReportParameter("TelefonoEmpresa", TelefonoEmpresa), New ReportParameter("TelefonoEmpresa", TelefonoEmpresa),
New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")), New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
New ReportParameter("Usuario", UsuarioActual.Nombre) New ReportParameter("Usuario", UsuarioActual.Nombre)
} }
'New ReportParameter("Folio", TxtFolio.Text),
' New ReportParameter("Cliente", DdlClientes.SelectedText),
' New ReportParameter("Servicio", TxtDescripcion.Text),
' New ReportParameter("Observaciones", TxtObservaciones.Text),
' New ReportParameter("Ubicacion", TxtUbicacion.Text),
' New ReportParameter("FechaSalida", TxtFechaSalida.Text.ToDate.ToString("dd/MM/yyyy")),
' New ReportParameter("FechaRegreso", TxtFechaRegreso.Text.ToDate.ToString("dd/MM/yyyy")),
' New ReportParameter("CantidadPasajeros", TxtCantidadPasajeros.Text),
' New ReportParameter("TipoAF", DdlTipoAF.SelectedItem.ToString()),
' New ReportParameter("Pesos", Math.Round(TxtImporte.Text.ToDecimal, 2).ToString),
' New ReportParameter("Moneda", DdlMoneda.SelectedItem.ToString),
' New ReportParameter("Anticipo", Math.Round((TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal), 2).ToString),
' New ReportParameter("Total", Math.Round((TxtImporte.Text.ToDecimal - (TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal)), 2).ToString),
' New ReportParameter("DiaSalida", $"{TxtFechaSalida.Text.ToDate.Hour}:{TxtFechaSalida.Text.ToDate.Minute} "),
' New ReportParameter("TelefonoEmpresa", TelefonoEmpresa),
' New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
' New ReportParameter("Usuario", UsuarioActual.Nombre)
ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Contrato.mrt", dtResult, params, NombreArchivo:=TxtFolio.Text) ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Contrato.mrt", dtResult, params, NombreArchivo:=TxtFolio.Text)
End Sub End Sub

View File

@@ -230,8 +230,7 @@ Partial Class RepContratosCalendario
End If End If
Dim ObjContratos As New ClsContratos Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL() Dim objGenerales As New ClsGenerales(ObjContratos.IniciaTransacSQL())
Dim DTAgendadados As New DataTable Dim DTAgendadados As New DataTable
If ObjContratos.GetContratosValUnidadesAgendadas(DdlAF.SelectedValue.ToEntero, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, UsuarioActual.CveEmpresa, CveContrato) Then If ObjContratos.GetContratosValUnidadesAgendadas(DdlAF.SelectedValue.ToEntero, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, UsuarioActual.CveEmpresa, CveContrato) Then
@@ -248,13 +247,14 @@ Partial Class RepContratosCalendario
DTAgendadados.Dispose() DTAgendadados.Dispose()
ObjContratos.Dispose() ObjContratos.Dispose()
Exit Sub Exit Sub
End If End If
End If End If
If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
TieneError = True
End If
End If
If ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", DdlSubProyectoModal.SelectedValue.ToEntero, If ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", DdlSubProyectoModal.SelectedValue.ToEntero,
-1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34,
@@ -266,25 +266,14 @@ Partial Class RepContratosCalendario
TieneError = True TieneError = True
End If End If
If HidCveAF.Value.ToEntero <> DdlAF.SelectedValue.ToEntero Then
Dim objGenerales = New ClsGenerales(ObjContratos.IniciaTransacSQL())
If Not objGenerales.AddHistorialBitacora(465, -1, -1, -1, -1, -1, -1, -1, DdlAF.SelectedItem.Text, HidCveAFDes.Value, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, TxtMotivoCambioUnidad.Text, "", "", CveContrato:=CveContrato) Then
TieneError = True
End If
End If
If TieneError Then If TieneError Then
ObjContratos.RollBack() ObjContratos.RollBack()
Else Else
ObjContratos.Commit() ObjContratos.Commit()
End If End If
ObjContratos.Dispose() ObjContratos.Dispose()
objGenerales.Dispose()
UpTitulos.Update() UpTitulos.Update()
CargaDatos() CargaDatos()

View File

@@ -205,21 +205,35 @@
OnRowDataBound="GvDatos_RowDataBound" OnRowDataBound="GvDatos_RowDataBound"
> >
<Columns> <Columns>
<asp:BoundField HeaderText="Producto / Servicio" DataField="CodigoPS" ItemStyle-Width="30%" /> <%--0--%>
<%--<asp:BoundField HeaderText="Producto / Servicio" DataField="PS" ItemStyle-Width="30%" />--%> <asp:BoundField HeaderText="Producto / Servicio" DataField="CodigoPS" ItemStyle-Width="30%" />
<%--1--%>
<asp:BoundField HeaderText="P.U. Actual" DataField="PUAnterior" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00##}" ItemStyle-Width="10%" /> <asp:BoundField HeaderText="P.U. Actual" DataField="PUAnterior" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00##}" ItemStyle-Width="10%" />
<%--2--%>
<asp:BoundField HeaderText="Tipo Promoción" DataField="TipoPromocion" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="15%" /> <asp:BoundField HeaderText="Tipo Promoción" DataField="TipoPromocion" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="15%" />
<%--3--%>
<asp:BoundField HeaderText="Cant. Mínima" DataField="CantidadMinima" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" /> <asp:BoundField HeaderText="Cant. Mínima" DataField="CantidadMinima" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
<%--4--%>
<asp:BoundField HeaderText="Promoción" DataField="Promocion" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00##}" ItemStyle-Width="10%" /> <asp:BoundField HeaderText="Promoción" DataField="Promocion" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00##}" ItemStyle-Width="10%" />
<%--5--%>
<asp:BoundField HeaderText="P.U. Promoción" DataField="PUPromocion" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00##}" ItemStyle-Width="10%" /> <asp:BoundField HeaderText="P.U. Promoción" DataField="PUPromocion" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00##}" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Ultimo Costo" DataField="UltimoCosto" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00##}" ItemStyle-Width="10%" Visible="false" />
<asp:BoundField HeaderText="% Utilidad" DataField="UtilidadPorcentaje" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,###.00}" ItemStyle-Width="10%" Visible="false" />
<%--6--%>
<asp:BoundField HeaderText="Condiciones" ItemStyle-HorizontalAlign="Center" DataField="AplicaRestriccionTexto" ItemStyle-Width="15%" /> <asp:BoundField HeaderText="Condiciones" ItemStyle-HorizontalAlign="Center" DataField="AplicaRestriccionTexto" ItemStyle-Width="15%" />
<%--7--%>
<asp:BoundField HeaderText="Clasificacion" ItemStyle-HorizontalAlign="Left" DataField="Clasificacion"/> <asp:BoundField HeaderText="Clasificacion" ItemStyle-HorizontalAlign="Left" DataField="Clasificacion"/>
<%--8--%>
<asp:BoundField HeaderText="Rin" ItemStyle-HorizontalAlign="Left" DataField="RinTamaño" Visible="false"/> <asp:BoundField HeaderText="Rin" ItemStyle-HorizontalAlign="Left" DataField="RinTamaño" Visible="false"/>
<%--9--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%"> <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="LnkGvDetalleEditar" runat="server" AlternateText="Editar" CausesValidation="False" CommandArgument='<%# Container.DataItemIndex%>' CommandName="Editar" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" /> <asp:LinkButton ID="LnkGvDetalleEditar" runat="server" AlternateText="Editar" CausesValidation="False" CommandArgument='<%# Container.DataItemIndex%>' CommandName="Editar" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<%--10--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%"> <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="LnkGvDetalleEliminar" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" /> <asp:LinkButton ID="LnkGvDetalleEliminar" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />
@@ -301,7 +315,7 @@
<h4 class="modal-title" style="color: #FFF; text-align: center;">Agregar Producto/Servicio</h4> <h4 class="modal-title" style="color: #FFF; text-align: center;">Agregar Producto/Servicio</h4>
</div> </div>
<div class="modal-body rowpadding"> <div class="modal-body rowpadding">
<div class="row"> <div class="row" runat="server" id="DVModalClasificacion" visible="true">
<label class="col-md-3 truncate">Clasificación:</label> <label class="col-md-3 truncate">Clasificación:</label>
<div class="col-md-9"> <div class="col-md-9">
<asp:DropDownList ID="DdlClasificacion" DataTextField="Clasificacion" DataValueField="CveClasificacion" AutoPostBack="true" OnSelectedIndexChanged="DdlClasificacion_SelectedIndexChanged" CssClass="select2me" Width="100%" runat="server"></asp:DropDownList> <asp:DropDownList ID="DdlClasificacion" DataTextField="Clasificacion" DataValueField="CveClasificacion" AutoPostBack="true" OnSelectedIndexChanged="DdlClasificacion_SelectedIndexChanged" CssClass="select2me" Width="100%" runat="server"></asp:DropDownList>

View File

@@ -1,13 +1,11 @@
Option Explicit On Option Explicit On
Option Strict On Option Strict On
Imports System.Activities.Expressions
Imports System.Data Imports System.Data
Imports DocumentFormat.OpenXml.Drawing.Diagrams
Imports Extensiones Imports Extensiones
Imports iText.StyledXmlParser.Css.Resolve.Shorthand.Impl Imports Stimulsoft.Report
Imports Microsoft.Owin.Security.Provider
Imports Telerik.Web.UI
Partial Class Ventas_Promociones Partial Class Ventas_Promociones
Inherits ClsPaginas Inherits ClsPaginas
@@ -162,6 +160,12 @@ Partial Class Ventas_Promociones
EmpresaFnc382 = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) 'Grupo díaz EmpresaFnc382 = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) 'Grupo díaz
'EmpresaFnc382 = True ''Para pruebas 'EmpresaFnc382 = True ''Para pruebas
If EmpresaFnc382 Then
DVModalClasificacion.Visible = False
GvDatos.Columns(6).Visible = True
GvDatos.Columns(7).Visible = True
End If
CvePromocion = -1 CvePromocion = -1
CargaValoresIniciales() CargaValoresIniciales()
CargaMonedas() CargaMonedas()
@@ -187,10 +191,16 @@ Partial Class Ventas_Promociones
CargaGvBitacora() CargaGvBitacora()
End If End If
End Sub End Sub
Private Sub RemoverClasificacion()
End Sub
#Region "BITACORA" #Region "BITACORA"
@@ -260,7 +270,7 @@ Partial Class Ventas_Promociones
DdlMarca.Items.Insert(0, New ListItem("Todos", "-1")) DdlMarca.Items.Insert(0, New ListItem("Todos", "-1"))
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
GvDatos.Columns(8).Visible = True GvDatos.Columns(10).Visible = True
DivRin.Visible = True DivRin.Visible = True
'Dim ObjGral As New ClsGenerales 'Dim ObjGral As New ClsGenerales
'If ObjGral.GetRinTamanios(UsuarioActual.CveEmpresa) Then 'If ObjGral.GetRinTamanios(UsuarioActual.CveEmpresa) Then
@@ -315,6 +325,7 @@ Partial Class Ventas_Promociones
TempDT.Columns.Add("UltimoCosto", GetType(Decimal)) TempDT.Columns.Add("UltimoCosto", GetType(Decimal))
TempDT.Columns.Add("CostoPromedio", GetType(Decimal)) TempDT.Columns.Add("CostoPromedio", GetType(Decimal))
TempDT.Columns.Add("UtilidadPorcentaje", GetType(Decimal))
TempDTOrigial = TempDT.Copy TempDTOrigial = TempDT.Copy
@@ -499,6 +510,8 @@ Partial Class Ventas_Promociones
Protected Sub BtnAgregar_Click(sender As Object, e As EventArgs) Protected Sub BtnAgregar_Click(sender As Object, e As EventArgs)
Dim CveTipoPromocion As Integer = DdlTipoPromocion.SelectedValue.ToEntero
If DdlClasificacion.SelectedValue.ToEntero <= 0 Then If DdlClasificacion.SelectedValue.ToEntero <= 0 Then
If DdlPS.SelectedValue.ToEntero <= 0 Then If DdlPS.SelectedValue.ToEntero <= 0 Then
Alert("Debe seleccionar una clasificacion o un producto y/o servicio", TipoMensaje.MsgAdvertencia) Alert("Debe seleccionar una clasificacion o un producto y/o servicio", TipoMensaje.MsgAdvertencia)
@@ -513,6 +526,15 @@ Partial Class Ventas_Promociones
End If End If
End If End If
' validación de %minimo considerado 02580104V
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
Dim tuc As Decimal = LblUltimoCosto.Text.ToDecimal
Dim tpu As Decimal = TxtPromocionConcepto.Text.ToDecimal
If (tpu - tuc) / tuc < UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100 Then
Alert("El producto está debajo de la utilidad permitida, la promoción requerirá autorización.", TipoMensaje.MsgAdvertencia.ToastAdventencia)
End If
End If
If TxtCantMinima.Text.ToEntero <= 0 Then If TxtCantMinima.Text.ToEntero <= 0 Then
Alert("La cantidad minima debe ser de 1", TipoMensaje.MsgAdvertencia) Alert("La cantidad minima debe ser de 1", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -545,15 +567,11 @@ Partial Class Ventas_Promociones
Dr("CodigoPS") = If(String.IsNullOrEmpty(DdlPS.SelectedText), "Todos", DdlPS.SelectedText) Dr("CodigoPS") = If(String.IsNullOrEmpty(DdlPS.SelectedText), "Todos", DdlPS.SelectedText)
Dr("PUAnterior") = LbPUActual.Text.ToDecimal Dr("PUAnterior") = LbPUActual.Text.ToDecimal
Dr("UltimoCosto") = LblUltimoCosto.Text.ToDecimal Dr("CveTipoPromocion") = CveTipoPromocion
Dr("CostoPromedio") = LblCostoPromedio.Text.ToDecimal
Dr("CveTipoPromocion") = DdlTipoPromocion.SelectedValue.ToEntero
Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text
Dr("Promocion") = TxtPromocionConcepto.Text Dr("Promocion") = TxtPromocionConcepto.Text
If DdlTipoPromocion.SelectedValue.ToEntero.Contiene(1, 3) Then If CveTipoPromocion.Contiene(1, 3) Then
Dr("PUPromocion") = TxtPromocionConcepto.Text.ToDecimal Dr("PUPromocion") = TxtPromocionConcepto.Text.ToDecimal
Else Else
Dr("PUPromocion") = LbPUActual.Text.ToDecimal - (LbPUActual.Text.ToDecimal * TxtPromocionConcepto.Text.ToDecimal / 100) Dr("PUPromocion") = LbPUActual.Text.ToDecimal - (LbPUActual.Text.ToDecimal * TxtPromocionConcepto.Text.ToDecimal / 100)
@@ -596,6 +614,39 @@ Partial Class Ventas_Promociones
Dr("CveRinTamaño") = -1 Dr("CveRinTamaño") = -1
End If End If
Dim UltimoCosto As Decimal = LblUltimoCosto.Text.ToDecimal
Dim CostoPromedio As Decimal = LblCostoPromedio.Text.ToDecimal
Dr("UltimoCosto") = UltimoCosto
Dr("CostoPromedio") = CostoPromedio
If UltimoCosto > 0 Then
Dim Promocion As Decimal = TxtPromocionConcepto.Text.ToDecimal
If CveTipoPromocion = 1 Then 'importe
Dim porciento As Decimal = (Promocion * 100 / UltimoCosto) - 100
Dr("UtilidadPorcentaje") = porciento
ElseIf CveTipoPromocion = 2 Then '% descuento
Dim calculo As Decimal = (UltimoCosto) - (UltimoCosto * (Promocion / 100))
Dim porciento As Decimal = (calculo * 100 / UltimoCosto) - 100
Dr("UtilidadPorcentaje") = porciento
End If
Else
Dr("UtilidadPorcentaje") = 0.0D
End If
If CveConsecutivo >= 0 Then If CveConsecutivo >= 0 Then
Dr.AcceptChanges() Dr.AcceptChanges()
Else Else
@@ -1416,13 +1467,15 @@ Partial Class Ventas_Promociones
Dim DTPSUltimoCosto = New DataTable Dim DTPSUltimoCosto = New DataTable
Dim ObjInv As New ClsInventarios Dim ObjInv As New ClsInventarios
If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero) Then
DTPSUltimoCosto = ObjInv.DtResultados DTPSUltimoCosto = ObjInv.DtResultados
End If End If
ObjInv.Dispose() ObjInv.Dispose()
LblUltimoCosto.Text = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero LblUltimoCosto.Text = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", "").FormatoNumero(4)
LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", "").FormatoNumero(4)
LbPUActual.Text = DTPSUltimoCosto.FiltroPrimeroValor("Importe", "").FormatoNumero(4)
UpAgregar.Update() UpAgregar.Update()
End Sub End Sub