Grupo Diaz 2024.05.31

This commit is contained in:
rakcsle
2024-06-06 00:01:04 -07:00
parent 0bf99fbca0
commit d4d02383d2
4 changed files with 773 additions and 1 deletions

298
General/SaldosMenores.aspx Normal file
View File

@@ -0,0 +1,298 @@
<%@ Page Title="Saldos Menores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="SaldosMenores.aspx.vb" Inherits="General_SaldosMenores" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Saldos Menores
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-ad-pdf"></i> Generar PDF</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" runat="server"><i class="fa fa-ad-excel"></i> Exporta Excel</asp:LinkButton>
</li>
<li>
<asp:HyperLink NavigateUrl="javascript:;" data-toggle="modal" data-target="#DivTipoCambio" ID="ImgTipoCambio" runat="server"> <i class="fa fa-money"></i> Ver Dlls en pesos</asp:HyperLink>
</li>
<%-- <asp:UpdatePanel ID="UpLnkAgregar" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkHabilitarSaldar" OnClick="LnkHabilitarSaldar_Click" runat="server">Otros Ingresos</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkSaldar" Visible="false" OnClick="LnkSaldar_Click" runat="server">Saldar</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>--%>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="PFiltro" 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" class="btn btn-primary" ValidationGroup="Valida" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row" style="margin-left: 10px;">
<%--<label class="col-md-1 " id="LblDdlSucursal" runat="server">Sucursal:</label>
<div class="col-md-2" id="DivDdlSucursal" runat="server">
<asp:DropDownList ID="DdlSucursal" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" Width="100%">
</asp:DropDownList>
</div>--%>
<div class="col-md-1" style="">Fecha Ini Doc:</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="margin-top: -5px; padding: 5px 0px;">
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Style="width: 80px;"></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>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" style="margin-left: 25px">Fecha Fin Doc:</div>
<div class="col-md-1" style="margin-left: -10px">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="margin-top: -5px; padding: 5px 0px;">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Style="width: 80px;"></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>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" >Saldo Mayor a: </div>
<div class="col-md-1" >
<asp:TextBox runat="server" ID="TxtSaldoMayorA" style="height:30px!important;width:80px!important"></asp:TextBox>
<ajax:FilteredTextBoxExtender FilterType="Custom" ValidChars="1234567890." runat="server" TargetControlID="TxtSaldoMayorA" />
</div>
<div class="col-md-1" >Saldo Menor a: </div>
<div class="col-md-1" >
<asp:TextBox runat="server" ID="TxtSaldoMenorA" style="height:30px!important;width:80px!important"></asp:TextBox>
<ajax:FilteredTextBoxExtender FilterType="Custom" ValidChars="1234567890." runat="server" TargetControlID="TxtSaldoMenorA" />
</div>
</div>
</div>
</div>
<div class="portlet-body" style="display: none;">
<div class="row" style="margin-left: 10px;">
<%-- <div class="col-md-1">Tipo:</div>
<div class="col-md-2">
<asp:DropDownList CssClass="form-control input-sm select2me" ID="DdlTipo" runat="server" Width="100%" Class="table-group-action-input form-control input-inline input-small input-sm">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Anticipos" Value="1"></asp:ListItem>
<asp:ListItem Selected="True" Text="NC X Aplicar" Value="2"></asp:ListItem>
<asp:ListItem Text="Ingresos X Comprobar" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1" style="width: 5%">Con Saldo:</div>
<div class="col-md-2" style="display:flex; width:20%">
<asp:DropDownList CssClass="form-control input-sm select2me" ID="DdlConSaldo" runat="server" Width="15%" Class="table-group-action-input form-control input-inline input-small input-sm">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Selected="True" Text="Si" Value="1"></asp:ListItem>
<asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:DropDownList>
<div style="width:30%;text-align:center">Vendedor:</div>
<div id="DivDdlVendedor" runat="server" style="width:55%;display:flex">
<asp:DropDownList ID="DdlVendedor" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" Width="100%">
</asp:DropDownList>
</div>
</div>--%>
<%-- <div class="col-md-1">Fecha Ini. Ap:</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 110px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaICorte" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaICorte" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaICorte" runat="server" TargetControlID="TxtFechaICorte" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaICorte" TargetControlID="TxtFechaICorte" PopupButtonID="LnkFechaICorte" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaICorte" runat="server" ControlToValidate="TxtFechaICorte" Display="None" ErrorMessage="El campo <b>''Fecha Inicial Corte''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaICorte2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaICorte" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" style="margin-left: 20px">Fecha Fin Ap:</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 110px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaFCorte" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaFCorte" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaFCorte" runat="server" TargetControlID="TxtFechaFCorte" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaFCorte" TargetControlID="TxtFechaFCorte" PopupButtonID="LnkFechaFCorte" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaFCorte" runat="server" ControlToValidate="TxtFechaFCorte" Display="None" ErrorMessage="El campo <b>''Fecha Final Corte''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaFCorte2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaFCorte" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>--%>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="Upsaldar" UpdateMode="Conditional">
<ContentTemplate>
<div class="row" runat="server" id="DvSaldar">
<div class="col-md-1" style="text-align: left">Fecha:</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtFecha" CssClass="form-control input-sm ADSMaskDate" Style="width: 118px" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkCortfecha" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEECortfecha" runat="server" TargetControlID="TxtFecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEECortfecha" TargetControlID="TxtFecha" PopupButtonID="LnkCortfecha" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RfvCortfecha" runat="server" ControlToValidate="TxtFecha" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="VgGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoCortfecha" runat="server" HighlightCssClass="vco" TargetControlID="RfvCortfecha"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" style="text-align: left">Centro Costo:</div>
<div class="col-md-1" style="text-align: left">
<asp:DropDownList ID="DdlSubProyectoSaldar" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" Width="100%">
</asp:DropDownList>
</div>
<div class="col-md-1" style="text-align: left">Concepto:</div>
<div class="col-md-1" style="text-align: left">
<asp:TextBox ID="TxtConcepto" CssClass="form-control" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvConcepto" runat="server" ControlToValidate="TxtConcepto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="VgGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoConcepto" runat="server" HighlightCssClass="vco" TargetControlID="RfvConcepto"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-1" >
<asp:Button ID="BtnSaldar" OnClick="BtnSaldar_Click" runat="server" Text="Saldar" CssClass="btn btn-primary" ValidationGroup="VgGuardar" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<ajax:TabContainer runat="server" ID="Tabs">
<ajax:TabPanel ID="TabIndicadores" runat="server" HeaderText="Indicadores" ClientIDMode="Static">
<ContentTemplate>
<div class="row">
<div class="row" style="margin-left: 0px; margin-top: 15px; margin-bottom: 5px; text-align: right; margin-right: 5px;" align="left">
<input type="text" id="TxtBusquedaIXC" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaIXC','{0}')", GvDatosIXC.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaIXC','{0}')", GvDatosIXC.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="col-md-6">
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatosIXC" runat="server" OnRowDataBound="GvDatosIXC_RowDataBound" GridLines="None"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" AutoGenerateColumns="False"
EmptyDataText="No se encontraron registros" data-sort="true" Width="99%"
DataKeyNames="CveCliente,CveMoneda,Saldo,CveVenta,NombreComercial,CveVentaAmortizacion,SerieFolioAmortizacion,SerieFolio,Total,TipoCambio,
Fecha,FechaAmortizacion,SubTotal,SubTotalAmortizacion,ImporteAmortizacion,CveIE,Tipo,SaldoAcumulativo,CveSubProyecto">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chk" Checked="false" Visible="false" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TipoColumna" HeaderText="" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="SerieFolio" HeaderText="Cliente/Folio" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Fecha" ItemStyle-Width="10%" HeaderText="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="SubTotal" ItemStyle-Width="10%" HeaderText="Importe" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="right" />
<asp:BoundField DataField="ImporteAmortizacion" ItemStyle-Width="10%" HeaderText="Aplicado" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="right" Visible="false" />
<asp:BoundField DataField="Saldo" ItemStyle-Width="10%" HeaderText="Saldo" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="right" />
<asp:BoundField DataField="Abreviatura" ItemStyle-Width="5%" HeaderText="Moneda" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Center" Visible="false" />
<asp:BoundField DataField="Costo" ItemStyle-Width="10%" HeaderText="Costo" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Center" Visible="false" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
<asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional">
<ContentTemplate>
<div id="DivTipoCambio" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:Label ID="Label2" runat="server" ClientIDMode="Static" Text="Cambiar Tipo Cambio de Dólares"></asp:Label>
</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional">
<ContentTemplate>
<asp:RadioButtonList runat="server" ID="RblTipoCambio" OnSelectedIndexChanged="RblTipoCambio_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Venta" Value="2"></asp:ListItem>
<asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem>
</asp:RadioButtonList>
<div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false">
Especifico:
<asp:TextBox ID="TxtEspecifico" runat="server" Width="55px" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:Button ID="BtnTipoCambio" runat="server" OnClick="BtnTipoCambio_Click" Text="Aceptar" class="btn btn-primary" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -0,0 +1,459 @@
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Web.UI.WebControls
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Public Class General_SaldosMenores
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Get
Return DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property Tipo As Integer
Get
Return DirectCast(ViewState("Tipo"), Integer)
End Get
Set(value As Integer)
ViewState("Tipo") = value
End Set
End Property
Private Property CveMoneda As Integer
Get
Return DirectCast(ViewState("CveMoneda"), Integer)
End Get
Set(value As Integer)
ViewState("CveMoneda") = value
End Set
End Property
Private Property TCEspecifico As Double
Get
Return DirectCast(ViewState("TCEspecifico"), Double)
End Get
Set(value As Double)
ViewState("TCEspecifico") = value
End Set
End Property
Private Property TipoCambio As Integer
Get
Return DirectCast(ViewState("TipoCambio"), Integer)
End Get
Set(value As Integer)
ViewState("TipoCambio") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
InicializaDatos()
End If
End Sub
#Region "I X C"
Protected Sub InicializaDatos()
txtFechaI.Text = $"01/01/{Now.Year}"
txtFechaF.Text = DateTime.Today.ToString()
TxtFecha.Text = DateTime.Today.ToString()
TxtSaldoMayorA.Text = "0"
TxtSaldoMenorA.Text = "1000"
CargaSucursales()
Dim CveCliente As Integer = If(Request("CveCliente") Is Nothing, -1, Request("CveCliente").ToString().ToEntero())
CveMoneda = If(Request("CveMoneda") Is Nothing, -1, Request("CveMoneda").ToString().ToEntero())
txtFechaI.Text = If(Request("FechaI") Is Nothing, NowADS().ToString(), Request("FechaI").ToString())
txtFechaF.Text = If(Request("FechaF") Is Nothing, NowADS().ToString(), Request("FechaF").ToString())
TipoCambio = If(Request("TipoCambio") Is Nothing, 1, Request("TipoCambio").ToString().ToEntero())
TCEspecifico = If(Request("TCEspecifico") Is Nothing, -1, Request("TCEspecifico").ToString().ToDouble())
RblTipoCambio.SelectedValue = TipoCambio.ToString()
LiEspecifico.InnerText = TCEspecifico.FormatoNumero()
Dim FechaICorte As DateTime
FechaICorte = If(Request("FechaICorte") Is Nothing, DateTime.MinValue, Request("FechaICorte").ToString().ToDate())
CargaDatos()
End Sub
Protected Sub CargaSucursales()
'DdlSucursal.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
'DdlSucursal.DataBind()
'DdlSucursal.Items.Insert(0, New ListItem("Todos", "-1"))
'DdlSucursal.SelectedValue = "-1"
DdlSubProyectoSaldar.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
DdlSubProyectoSaldar.DataBind()
End Sub
'Protected Sub CargaVendedores()
' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
' DdlVendedor.DataBind()
' DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1"))
'End Sub
Protected Sub CargaDatos()
If TipoCambio = 3 AndAlso TxtEspecifico.Text <> "" Then
TCEspecifico = TxtEspecifico.Text.ToDouble()
Else
TCEspecifico = -1
End If
If TipoCambio <> 1 Then
CveMoneda = -1
End If
Dim FechaICorte As DateTime = MinFecha
'If TxtFechaICorte.Text <> "" Then
' FechaICorte = TxtFechaICorte.Text.ToDate()
'Else
' FechaICorte = DateTime.MinValue
'End If
Dim FechaFCorte As DateTime = MaxFecha
'If TxtFechaFCorte.Text <> "" Then
' FechaFCorte = TxtFechaFCorte.Text.ToDate()
'Else
' FechaFCorte = DateTime.MaxValue
'End If
Dim ObjVenta As New ClsVentas()
Dim CveCliente As Integer = -1
If ObjVenta.GetRepAnticiposNCIXCDetalle(CveCliente, -1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, 1, -1, CveMoneda, FechaICorte, FechaFCorte, TipoCambio, TCEspecifico,
SaldoMayorA:=TxtSaldoMayorA.Text.ToDecimal, SaldoMenorA:=TxtSaldoMenorA.Text.ToDecimal) Then
GvDatosIXC.DataSource = ObjVenta.DtResultados
DtDatos = ObjVenta.DtResultados
End If
ObjVenta.Dispose()
GvDatosIXC.DataBind()
UpDatos.Update()
'If TxtFechaFCorte.Text <> NowADS().ToShortDateString() AndAlso txtFechaI.Text <> "" Then
' LnkHabilitarSaldar.Visible = False
' LnkSaldar.Visible = False
'Else
'LnkHabilitarSaldar.Visible = True
''End If
'If LnkSaldar.Visible Then
' HabilitarCheckbox()
'End If
Tipo = -1
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
'GenerarPDF("EXCEL")
End Sub
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
'GenerarPDF("PDF")
End Sub
'Protected Sub GenerarPDF(Opcion As String)
' Dim FechaI As String
' If txtFechaI.Text = "" OrElse txtFechaI.Text = "__/__/____" Then
' FechaI = "-1"
' Else
' FechaI = $"&emsp;<b>Fecha Inicial:</b> {txtFechaI.Text}"
' End If
' Dim FechaF As String
' If txtFechaF.Text = "" OrElse txtFechaF.Text = "__/__/____" Then
' FechaF = "-1"
' Else
' FechaF = $"&emsp;<b>Fecha Final:</b> {txtFechaF.Text}"
' End If
' Dim FechaICorte As String
' If TxtFechaICorte.Text = "" OrElse TxtFechaICorte.Text = "__/__/____" Then
' FechaICorte = ""
' Else
' FechaICorte = $"&emsp;<b>Fecha Inicial Corte:</b> {TxtFechaICorte.Text}"
' End If
' Dim FechaFCorte As String
' If TxtFechaFCorte.Text = "" OrElse TxtFechaFCorte.Text = "__/__/____" Then
' FechaFCorte = ""
' Else
' FechaFCorte = $"&emsp;<b>Fecha Final Corte:</b> {TxtFechaFCorte.Text}"
' End If
' Dim Sucursal As String
' If DdlSucursal.SelectedValue <> "-1" Then
' Sucursal = $"&emsp;<b>Sucursal:</b> {DdlSucursal.SelectedItem.Text}"
' Else
' Sucursal = ""
' End If
' Dim Cliente As String = ""
' Dim ConSaldo As String
' If DdlConSaldo.SelectedValue <> "-1" Then
' ConSaldo = $"&emsp;<b>Con Saldo:</b> {DdlConSaldo.SelectedItem.Text}"
' Else
' ConSaldo = ""
' End If
' Dim Tipo2 As String
' If DdlTipo.SelectedValue <> "-1" Then
' Tipo2 = $"&emsp;<b>Tipo:</b> {DdlTipo.SelectedItem.Text}"
' Else
' Tipo2 = ""
' End If
' If DtDatos.Rows.Count > 0 Then
' Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
' Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
' Dim para As New List(Of ReportParameter) From {
' New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
' New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre),
' New ReportParameter("FechaImpresion", NowADS().ToString()),
' New ReportParameter("Tipo", Tipo.ToString()),
' New ReportParameter("AgrupadoPor", $"<b>Agrupado Por:</b> {Cliente}{Sucursal}{ConSaldo}{Tipo2}{FechaI}{FechaF}{FechaICorte}{FechaFCorte}")
' }
' If Imagen.Exists Then
' para.Add(New ReportParameter("LogoPath", logouri))
' Else
' para.Add(New ReportParameter("LogoPath", ""))
' End If
' ImprimirPDF("Empresas/Grales/Formatos/RepAnt-NC-IXCDetalle.rdlc", DtDatos, para, "Reporte de Anticipos - NCXAplicar - IXC Detalle", Opcion)
' Else
' Alert("No hay datos consultados", ModExtensiones.TipoMensaje.MsgAdvertencia)
' End If
'End Sub
Protected Sub GvDatosIXC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosIXC.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Css As String = "Texto"
Dim Liga As String = ""
If e.Row.DataKey("Tipo").ToEntero() < 1 Then
e.Row.CssClass = "SubTotales3"
e.Row.Cells(2).Text = e.Row.DBCampo("Moneda").ToString()
ElseIf e.Row.DataKey("CveCliente").ToEntero() < 1 Then
e.Row.CssClass = "SubTotales2"
Select Case e.Row.DataKey("Tipo").ToEntero()
Case 1
e.Row.Cells(2).Text = "Anticipos"
Case 2
e.Row.Cells(2).Text = "NC X Aplicar"
Case 3
e.Row.Cells(2).Text = "Ingresos X Comprobar"
End Select
ElseIf e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1 AndAlso e.Row.DataKey("CveVenta").ToEntero() < 1 AndAlso e.Row.DataKey("CveIE").ToEntero() < 1 Then
e.Row.CssClass = "Totales"
e.Row.Cells(2).Text = e.Row.DataKey("NombreComercial")
e.Row.Cells(7).Text = ""
ElseIf e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1 AndAlso e.Row.DataKey("CveVenta").ToEntero() > 0 Then
e.Row.CssClass = "SubTotales"
e.Row.Cells(2).Text = e.Row.DataKey("SerieFolio")
e.Row.Cells(3).Text = e.Row.DataKey("Fecha").ToDate().ToShortDateString()
'If DdlTipo.SelectedValue.ToEntero() = 1 Then
' e.Row.Cells(4).Text = "$" & e.Row.DataKey("SubTotal").FormatoNumero()
'ElseIf DdlTipo.SelectedValue.ToEntero() = 2 Then
' e.Row.Cells(4).Text = "$" & e.Row.DataKey("Total").FormatoNumero()
'End If
Liga = $"/Ventas/Ventas.aspx?&CveVenta={e.Row.DataKey("CveVenta")}"
e.Row.Cells(2).Text = $"<a class=""{Css}"" href=""{Liga}"">{e.Row.Cells(2).Text}</a>"
ElseIf e.Row.DataKey("CveIE").ToEntero() > 0 AndAlso e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1 Then
e.Row.CssClass = "SubTotales"
e.Row.Cells(2).Text = e.Row.DataKey("SerieFolio")
e.Row.Cells(3).Text = e.Row.DataKey("Fecha").ToDate().ToShortDateString()
e.Row.Cells(4).Text = "$" & e.Row.DataKey("Total").FormatoNumero()
Liga = $"/Bancos/IE.aspx?&CveIE={e.Row.DataKey("CveIE")}"
e.Row.Cells(2).Text = $"<a class=""{Css}"" href=""{Liga}"">{e.Row.Cells(2).Text}</a>"
Else
e.Row.Cells(2).Text = e.Row.DataKey("SerieFolioAmortizacion")
e.Row.Cells(3).Text = e.Row.DataKey("FechaAmortizacion").ToDate().ToShortDateString()
e.Row.Cells(4).Text = "$" & e.Row.DataKey("ImporteAmortizacion").FormatoNumero()
e.Row.Cells(5).Text = "$" & e.Row.DataKey("ImporteAmortizacion").FormatoNumero()
e.Row.Cells(6).Text = "$" & e.Row.DataKey("SaldoAcumulativo").FormatoNumero()
Liga = $"/Ventas/Ventas.aspx?&CveVenta={e.Row.DataKey("CveVentaAmortizacion")}"
e.Row.Cells(2).Text = $"<a class=""{Css}"" href=""{Liga}"">{e.Row.Cells(2).Text}</a>"
End If
If (e.Row.DataKey("CveVenta").ToEntero() > 0 OrElse e.Row.DataKey("CveIE").ToEntero() > 0) AndAlso (e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1) Then
e.Row.FCCheckBox("Chk").Visible = True
End If
End If
End Sub
#Region "SALDAR"
'Private Sub HabilitarCheckbox()
' For Each Gv As GridViewRow In GvDatosIXC.Rows
' If (Gv.DataKey("CveVenta").ToEntero() > 0 OrElse Gv.DataKey("CveIE").ToEntero() > 0) AndAlso (Gv.DataKey("CveVentaAmortizacion").ToEntero() < 1) Then
' Gv.FCCheckBox("Chk").Visible = True
' End If
' Next
'End Sub
'Protected Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click
' HabilitarCheckbox()
' LnkSaldar.Visible = True
' LnkHabilitarSaldar.Visible = False
' UpLnkAgregar.Update()
' UpDatos.Update()
'End Sub
Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) 'Handles LnkSaldar.Click
If Tipo = 1 Then
TxtConcepto.Text = "Cancelación de Anticipos"
ElseIf Tipo = 2 Then
TxtConcepto.Text = "Cancelación de Saldo de Nota de crédito"
ElseIf Tipo = 3 Then
TxtConcepto.Text = "Cancelación de Ingresos por Comprobar"
End If
Upsaldar.Update()
RegistraScript("$('#DivModalSaldar').modal();")
End Sub
Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) Handles BtnSaldar.Click
Dim ObjConta As New ClsContabilidad()
ObjConta.IniciaTransacSQL()
Dim CvePrePoliza As Integer = 0, CveVenta As Integer = -1, CveIE As Integer = -1
Dim Saldo As Decimal = 0
Dim SaldoAdmin As Decimal = 0
Dim ImporteTotalGasto As Decimal = 0
Dim MsgError As String = ""
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepNCXAplicar", 6, 0, 0, 1, TxtFecha.Text.ToDate(), TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 3)
Dim tMovto As Boolean = True
Dim tConceptoSaldar As Integer = 78
If CvePrePoliza > 0 Then
For Each Gv As GridViewRow In GvDatosIXC.Rows
Dim ConPreP As New ConceptosTipoSaldo()
If Gv.FCCheckBox("Chk").Checked Then
If Tipo = 2 Then
ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(6, Gv.DataKey("CveMoneda").ToEntero(), False, 2)
ElseIf Tipo = 1 Then
ConPreP.CveConcepto = 3
End If
'If Tipo = 1 OrElse Tipo = 2 Then
If Gv.DataKey("CveVenta").ToEntero() > 0 Then
CveVenta = Gv.DataKey("CveVenta").ToEntero()
Saldo = -Gv.DataKey("Saldo").ToDecimal()
SaldoAdmin = Saldo
ElseIf Gv.DataKey("CveIE").ToEntero() > 0 Then
'ElseIf Tipo = 3 Then
ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(18, Gv.DataKey("CveMoneda").ToEntero(), True, 2)
CveIE = Gv.DataKey("CveIE").ToEntero()
Saldo = Gv.DataKey("Saldo").ToDecimal()
SaldoAdmin = Saldo
End If
Saldo = -Saldo ' invertimos el saldo para que se haga negativo para que sea Abono
ImporteTotalGasto += Saldo
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, SaldoAdmin, Saldo, ConPreP.CveConcepto, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
Exit For
End If
If Gv.DataKey("CveMoneda").ToEntero() > 1 Then
Dim ImporteMN As Decimal = (Saldo * Gv.DataKey("TipoCambio").ToDecimal() - Saldo).RoundSQL()
ImporteTotalGasto += ImporteMN
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, Saldo, ImporteMN, ConPreP.CveConceptoComplementario, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero(), ImporteME:=Saldo, TipoCambio:=Gv.DataKey("TipoCambio").ToDecimal()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
Exit For
End If
End If
End If
Next
If ImporteTotalGasto <> 0 Then
ImporteTotalGasto *= -1 ' se invierte el valor, para cuadre de prepoliza
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, ImporteTotalGasto, ImporteTotalGasto, tConceptoSaldar, "", TxtConcepto.Text, CveIE, CveVenta, CveSubProyecto:=DdlSubProyectoSaldar.SelectedValue.ToEntero()) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
MsgError = "Poliza no insertada"
End If
End If
If MsgError = "" Then
ObjConta.Commit()
Dim Msg As String = "Los movimientos se saldaron correctamente."
Msg &= $"<br/><br/><a Class='Texto' target='_blank' href='/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={CvePrePoliza}'>Ver Póliza</a>&nbsp;&nbsp; "
Alert(Msg)
Else
ObjConta.RollBack()
Alert(MsgError, ModExtensiones.TipoMensaje.MsgError)
End If
'LnkSaldar.Visible = False
'LnkHabilitarSaldar.Visible = True
CargaDatos()
'UpLnkAgregar.Update()
ObjConta.Dispose()
'RegistraScript("$('#DivModalSaldar').modal('hide');")
TxtFecha.Text = DateTime.Today.ToString()
Upsaldar.Update()
End Sub
#End Region
#Region "TIPO DE CAMBIO"
Protected Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click
CargaDatos()
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"))
End Sub
Protected Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
TipoCambio = RblTipoCambio.SelectedValue.ToEntero()
If TipoCambio = 3 Then
LiEspecifico.Visible = True
TCEspecifico = GlobalTipoCambio(NowADS()).ToString().ToDouble()
TxtEspecifico.Text = TCEspecifico.ToString()
Else
LiEspecifico.Visible = False
End If
UpBodyTipoCambio.Update()
End Sub
#End Region
#End Region
End Class