This commit is contained in:
2025-05-02 19:42:20 -07:00
8 changed files with 454 additions and 53 deletions

View File

@@ -11067,6 +11067,7 @@ Public Class ClsPaginas
'Reportes de Anticipos-NC-IXC
PaginaDict.Add("/Ventas/RepAnticipo-NC-IXC.aspx".ToUpper(), 869)
PaginaDict.Add("/Ventas/RepAnticipo-NC-IXCDetalle.aspx".ToUpper(), 869)
PaginaDict.Add("/Ventas/RepAnticipo-NC-IXCAplicados.aspx".ToUpper(), 877)
PaginaDict.Add("/Ventas/CatAutorizacionDescuentos.aspx".ToUpper(), 1037)
PaginaDict.Add("/Ventas/RepPUESinPago.aspx".ToUpper(), 672)
PaginaDict.Add("/Ventas/RepVentasResumen.aspx".ToUpper(), 674)

View File

@@ -4771,6 +4771,31 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function GetRepAnticiposNCIXCAplicados(CveCliente As Integer, CveSubProyecto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, FechaICorte As Date, FechaFCorte As Date, TipoCambio As Integer, TCEspecifico As Double, Optional CveVendedor As Integer = -1, Optional ConSaldo As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_RepAnt-NC-IXCAplicadosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@FechaICorte", SqlDbType.Date).Value = FechaICorte
.Add("@FechaFCorte", SqlDbType.Date).Value = FechaFCorte
.Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio
.Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
.Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el reporte de aplicaiones de anticipos - nc - ixc .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetRepAnticiposNCIXCDetalle(CveCliente As Integer, CveSubProyecto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, ConSaldo As Integer, Tipo As Integer, CveMoneda As Integer, FechaICorte As Date, FechaFCorte As Date, TipoCambio As Integer, TCEspecifico As Double, Optional CveVendedor As Integer = -1,
Optional SaldoMayorA As Decimal = -999999999999, Optional SaldoMenorA As Decimal = 999999999999) As Boolean
Dim Retorno As Boolean = False

View File

@@ -200,32 +200,7 @@ Partial Class Bancos_RepCortes
Fecha = gvr.DataKey("FechaInicial")
Nombre = gvr.DataKey("Nombre")
'If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then
' DtCortesVentas = ObjPuntoVenta.DtResultados.Copy()
' GvD.DataSource = DtCortesVentas
' divDetalle.Visible = True
'End If
'If ObjVentas.GetCortesDetalleVentasResumen(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
' GvP.DataSource = ObjVentas.DtResultados
' DtCortesVentasResumen = ObjVentas.DtResultados
'End If
'If UsuarioActual.CveEmpresa.Contiene(190, 192) Then
' DivIVA.Visible = True
' If ObjVentas.GetCortesDetalleVentasResumenIVA(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
' GvPorIVA.DataSource = ObjVentas.DtResultados
' End If
'End If
Dim FechaConsulta = ModExtensiones.MaxFecha
Dim ConsultaPorSucursal As Boolean = UsuarioActual.Empresa.Funcionalidad(382) = "1"
If ConsultaPorSucursal Then
'CveCorte = -1
FechaConsulta = gvr.DataKey("FechaInicial").ToDate()
End If
Dim FechaConsulta = gvr.DataKey("FechaInicial").ToDate()
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVta_ReporteCortesDetalle(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Opcion:=2, ConsultaIVA:=UsuarioActual.CveEmpresa.Contiene(190, 192), FechaConsulta:=FechaConsulta) Then

View File

@@ -1736,20 +1736,13 @@ Partial Class PopUpVerFactura
Dim OpcionDetallado As Integer = 1
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(197, 189) Then OpcionDetallado = 2
Dim ConsultaPorSucursal As Boolean = UsuarioActual.Empresa.Funcionalidad(382) = "1"
If ConsultaPorSucursal Then
'SI NO TIENE ESTOS VALORES, SARCALOS DEL CORTE
If CveCorte > 0 AndAlso (FechaConsulta = ModExtensiones.MaxFecha OrElse CveSubProyecto <= 0) Then
Using ObjVta As New ClsPuntoVenta
If ObjVta.GetVta_Cortes("-1", "-1", -1, CveCorte, UsuarioActual.CveEmpresa, -1) AndAlso ObjVta.DtResultados.Rows.Count > 0 Then
FechaConsulta = ObjVta.DtResultados.FiltroPrimeroValor("FechaInicial").ToString().ToDate().Date
CveSubProyecto = ObjVta.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToEntero()
End If
End Using
End If
'CveCorte = -1
If CveCorte > 0 AndAlso (FechaConsulta = ModExtensiones.MaxFecha OrElse CveSubProyecto <= 0) Then
Using ObjVta As New ClsPuntoVenta
If ObjVta.GetVta_Cortes("-1", "-1", -1, CveCorte, UsuarioActual.CveEmpresa, -1) AndAlso ObjVta.DtResultados.Rows.Count > 0 Then
FechaConsulta = ObjVta.DtResultados.FiltroPrimeroValor("FechaInicial").ToString().ToDate().Date
CveSubProyecto = ObjVta.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToEntero()
End If
End Using
End If
Dim ObjVenta As New ClsVentas
@@ -1774,16 +1767,9 @@ Partial Class PopUpVerFactura
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(189, 197) Then
If ConsultaPorSucursal Then
If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaConsulta, FechaConsulta, CveSubProyecto) Then
DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("FechaInicial IS NOT NULL")
Fecha = FechaConsulta.ToString("dd/MM/yyyy")
End If
Else
If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, CveSubProyecto, CveCorte:=CveCorte) Then
DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("CveCorte > 0")
Fecha = DtReporteCorte.FiltroPrimeroValor("FechaInicial", "")
End If
If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaConsulta, FechaConsulta, CveSubProyecto) Then
DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("FechaInicial IS NOT NULL")
Fecha = FechaConsulta.ToString("dd/MM/yyyy")
End If
If ObjVenta.GetVta_MovimientosCajas(CveCorte, -1, CveSubProyecto:=CveSubProyecto, FechaConsulta:=FechaConsulta) Then
@@ -1799,7 +1785,7 @@ Partial Class PopUpVerFactura
Dim FechaCorte As String = $"&emsp;<b>Fecha fin</b> {Fecha}"
If ConsultaPorSucursal Then
If OpcionDetallado = 2 Then
FechaCorte = $"&emsp;<b>Fecha: </b> {Fecha}"
End If

View File

@@ -4888,7 +4888,8 @@ Partial Class Clientes
ImporteAplicar = Importe
CveVenta = Gvr.DataKey("CveVenta").ToEntero()
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar * -1, ImporteAplicar * -1, 12, "Traspaso de saldos de anticipos", "Traspaso de saldos de anticipos", CveCliente:=Gvr.DataKey("CveCliente").ToEntero(), CveIE:=Gvr.DataKey("CveIE").ToEntero(), CveVenta:=CveVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ImporteAplicar * -1, 91, "Traspaso de saldos de anticipos", "Traspaso de saldos de anticipos",
CveCliente:=Gvr.DataKey("CveCliente").ToEntero(), CveIE:=Gvr.DataKey("CveIE").ToEntero(), CveVenta:=CveVenta, CveVentaAmortizacion:=CveVenta) Then
TieneError = True
End If

View File

@@ -963,6 +963,13 @@ Partial Class Ventas_PVCobranza
Else
'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO
RegistrarPago = False
If DebeTenerCorteCaja Then
If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, tCveCorte) Then
MsgError = "Error al aplicar el corte"
End If
End If
End If
End If
Catch ex As Exception
@@ -1452,7 +1459,7 @@ Partial Class Ventas_PVCobranza
ObjFactura.CveVendedor = CveVendedor
ObjFactura.ObservacionesAlmacen = ObservacionesAlmacen
ObjFactura.Observaciones = Observaciones
ObjFactura.Observaciones = $"Remisión: {VentaRemision.SerieFolio} {Observaciones}"
ObjFactura.PedidoContrato = PedidoContrato
ObjFactura.OrdenCompra = OrdenCompra

View File

@@ -0,0 +1,182 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepAnticipo-NC-IXCAplicados.aspx.cs" Inherits="Ventas_RepAnticipo_NC_IXCAplicados" %>
<asp:Content ID="Content9" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content10" ContentPlaceHolderID="Css" runat="Server">
<style>
.dataTables_scrollHead {
background-color: #95A5A6;
color: white;
}
.check {
margin-top: 10px !important;
}
.box {
margin-top: 10px !important;
}
</style>
</asp:Content>
<asp:Content ID="Content11" ContentPlaceHolderID="E" runat="Server">
Reporte de aplicaciones de Anticipos - NC - Ingresos X Comprobar
</asp:Content>
<asp:Content ID="Content12" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content13" 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:Content>
<asp:Content ID="Content14" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content15" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpFiltros" runat="server" UpdateMode="Always">
<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" OnClick="BtnConsultar_Click" />
<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>
<label class="col-md-1 " id="LblCliente" runat="server">Cliente:</label>
<div class="col-md-2" id="DivDdlCliente" runat="server">
<ADS:Dropdownlost ID="DdlCliente" runat="server" AutoPostBack="False" DataTextField="NombreComercial" IncluyeTodos="false" DataValueField="CveCliente" CssClassDdl="select2me" CssStyle="width: 250px; "></ADS:Dropdownlost>
</div>
<div class="col-md-1" title="Fecha Inicio de Aplicación">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="margin-top: -5px; padding: 5px 0px;">
<asp:TextBox ID="TxtFechaICorte" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Style="width: 80px;"></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: 25px" title="Fecha Fin de Aplicación">Fecha Fin Ap:</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="TxtFechaFCorte" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Style="width: 80px;"></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>
<div class="portlet-body" style="display: none;">
<div class="row" style="margin-left: 10px;">
<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="40%" 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: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">
<asp:CheckBox runat="server" ID="ChkAnticipos" Text="Anticipos" Checked="true" />
</div>
<div class="col-md-1">
<asp:CheckBox runat="server" ID="ChkNCxAplicar" Text="NC x Aplicar" Checked="true" />
</div>
<div class="col-md-2">
<asp:CheckBox runat="server" ID="ChkIngresosxComprobar" Text="Ingreos x Comprobar" Checked="true" />
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<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="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>
<table class="table Widthall ">
<tr>
<td style="width: 37%;"></td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 21%; border-right: 3px solid white;">Anticipos</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 21%; border-right: 3px solid white;">Notas de crédito</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 21%; border-right: 3px solid white;">Ingresos por Comprobar</td>
</tr>
</table>
<asp:GridView ID="GvDatos" runat="server" OnRowDataBound="GvDatos_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,CveSubProyecto,FechaI,FechaF,FechaICorte,FechaFCorte,TipoCambio,TCEspecifico,ConSaldo">
<Columns>
<asp:BoundField DataField="NombreComercial" ItemStyle-Width="30%" HeaderText="Cliente" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="TipoTexto" ItemStyle-Width="7%" HeaderText="Tipo" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="AplicadoAnticipos" ItemStyle-Width="21%" HeaderText="Importe" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="right" />
<asp:BoundField DataField="AplicadoNC" ItemStyle-Width="21%" HeaderText="Importe" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="right" />
<asp:BoundField DataField="AplicadoIXC" ItemStyle-Width="21%" HeaderText="Importe" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="right" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<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="Content16" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -0,0 +1,224 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using Extensiones;
using System.Data;
using Microsoft.Reporting.WebForms;
using ADSNetLibrary.SIGAPI.Models.CGame;
public partial class Ventas_RepAnticipo_NC_IXCAplicados : ClsPaginas
{
#region PROPIEDADES
private DataTable DtDatos
{
get { return DtDatos = (DataTable)ViewState["DtDatos"]; }
set { ViewState["DtDatos"] = value; }
}
private double TCEspecifico
{
get { return TCEspecifico = (double)ViewState["TCEspecifico"]; }
set { ViewState["TCEspecifico"] = value; }
}
private int TipoCambio
{
get { return TipoCambio = (int)ViewState["TipoCambio"]; }
set { ViewState["TipoCambio"] = value; }
}
private int Vendedor
{
get { return Vendedor = (int)ViewState["Vendedor"]; }
set { ViewState["Vendedor"] = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InicializaValores();
}
}
private void InicializaValores()
{
//txtFechaI.Text = "01/01/2000";
//txtFechaF.Text = DateTime.Today.ToString();
TxtFechaFCorte.Text = DateTime.Today.ToString();
TipoCambio = 1;
TCEspecifico = -1;
Vendedor = 0;
CargaSucursales();
CargaClientes();
CargaVendedores();
CargaDatos();
}
protected void CargaSucursales()
{
DdlSucursal.DataSource = get_GlobalDTSubProyectos(UsuarioActual.CveEmpresa);
DdlSucursal.DataBind();
DdlSucursal.Items.Insert(0, new ListItem("Todos", "-1"));
}
//protected void CargaClientes()
//{
// DdlCliente.DataSource = get_GlobalDTCliente(UsuarioActual.CveEmpresa,-1);
// DdlCliente.DataBind();
// DdlCliente.Items.Insert(0, new ListItem("Todos", "-1"));
//}
protected void CargaClientes()
{
DdlCliente.setEsWebService(true);
DdlCliente.Attributes.Add("data-metodo", "getcliente");
}
protected void CargaVendedores()
{
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
DdlVendedor.DataBind();
DdlVendedor.Items.Insert(0, new ListItem("Todos", "-1"));
//DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor);
}
protected void CargaDatos()
{
if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; }
DateTime FechaICorte;
if (TxtFechaICorte.Text != "") { FechaICorte = TxtFechaICorte.Text.ToDate(); } else { FechaICorte = ModExtensiones.MinFecha; }
DateTime FechaFCorte;
if (TxtFechaFCorte.Text != "") { FechaFCorte = TxtFechaFCorte.Text.ToDate(); } else { FechaFCorte = ModExtensiones.MaxFecha; }
ClsVentas ObjVenta = new ClsVentas();
int CveCliente = -1;
if (DdlCliente.SelectedValue.ToEntero() != 0)
{
CveCliente = DdlCliente.SelectedValue.ToEntero();
}
if (ObjVenta.GetRepAnticiposNCIXCAplicados(CveCliente, DdlSucursal.SelectedValue.ToEntero(), ModExtensiones.MinFecha,
ModExtensiones.MaxFecha, UsuarioActual.CveEmpresa, FechaICorte, FechaFCorte, TipoCambio, TCEspecifico, DdlVendedor.SelectedValue.ToEntero(), DdlConSaldo.SelectedValue.ToEntero()))
{
GvDatos.DataSource = ObjVenta.DtResultados;
DtDatos = ObjVenta.DtResultados;
}
ObjVenta.Dispose();
GvDatos.DataBind();
UpDatos.Update();
}
protected void BtnConsultar_Click(object sender, EventArgs e)
{
CargaDatos();
Vendedor = DdlVendedor.SelectedIndex;
}
protected void LnkExcel_Click(object sender, EventArgs e)
{
GenerarPDF("EXCEL");
}
protected void LnkPdf_Click(object sender, EventArgs e)
{
GenerarPDF("PDF");
}
protected void GenerarPDF(String Opcion)
{
//String FechaI;
//if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = ""; } else { FechaI = $"&emsp;<b>Fecha Inicial:</b> {txtFechaI.Text}"; }
//String FechaF;
//if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = ""; } else { FechaF = $"&emsp;<b>Fecha Final:</b> {txtFechaF.Text}"; }
String FechaICorte;
if (TxtFechaICorte.Text == "" || TxtFechaICorte.Text == "__/__/____") { FechaICorte = ""; } else { FechaICorte = $"&emsp;<b>Fecha Inicial Corte:</b> {TxtFechaICorte.Text}"; }
String FechaFCorte;
if (TxtFechaFCorte.Text == "" || TxtFechaFCorte.Text == "__/__/____") { FechaFCorte = ""; } else { FechaFCorte = $"&emsp;<b>Fecha Final Corte:</b> {TxtFechaFCorte.Text}"; }
String Sucursal;
if (DdlSucursal.SelectedValue != "-1") { Sucursal = $"&emsp;<b>Sucursal:</b> {DdlSucursal.SelectedItem.Text}"; } else { Sucursal = ""; }
String Cliente;
if (DdlCliente.SelectedValue != "-1") { Cliente = $"&emsp;<b>Cliente:</b> {DdlCliente.SelectedText}"; } else { Cliente = ""; }
if (DtDatos.Rows.Count > 0)
{
System.IO.FileInfo Imagen = new System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png");
String logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
List<ReportParameter> para = new List<ReportParameter>();
para.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
para.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
para.Add(new ReportParameter("FechaImpresion", NowADS().ToString()));
para.Add(new ReportParameter("AgrupadoPor", $"<b>Agrupado Por:</b> {Cliente}{Sucursal}{FechaICorte}{FechaFCorte}"));
para.Add(new ReportParameter("MostarAnticipos", ChkAnticipos.Checked ? "1" : "0"));
para.Add(new ReportParameter("MostarNCxAplicar", ChkNCxAplicar.Checked ? "1" : "0"));
para.Add(new ReportParameter("MostarIngresosxComprobar", ChkIngresosxComprobar.Checked ? "1" : "0"));
if (Imagen.Exists)
{
para.Add(new ReportParameter("LogoPath", logouri));
}
else
{
para.Add(new ReportParameter("LogoPath", ""));
}
ImprimirPDF("Empresas/Grales/Formatos/RepAnt-NC-IXC.rdlc", DtDatos, para, "Reporte de Anticipos - NCXAplicar - IXC", Opcion);
}
else
{
Alert("No hay datos consultados", ModExtensiones.TipoMensaje.MsgAdvertencia);
}
}
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DBCampo("CveCliente").ToEntero() < 1)
{
e.Row.CssClass = "Totales";
if (e.Row.DBCampo("CveMoneda").ToEntero() == 1)
{
e.Row.Cells[0].Text = "Total Pesos";
}
else if (e.Row.DBCampo("CveMoneda").ToEntero() == 2)
{
e.Row.Cells[0].Text = "Total Dolares";
}
}
if (e.Row.DBCampo("CveCliente").ToEntero() > 0)
{
if (e.Row.DBCampo("Tipo").ToEntero() == 0)
{
e.Row.CssClass = "SubTotales";
}
}
}
}
protected void BtnTipoCambio_Click(object sender, EventArgs e)
{
CargaDatos();
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"));
}
protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e)
{
TipoCambio = RblTipoCambio.SelectedValue.ToEntero();
if (TipoCambio == 3)
{
LiEspecifico.Visible = true;
TCEspecifico = get_GlobalTipoCambio(NowADS()).ToString().ToDouble();
TxtEspecifico.Text = TCEspecifico.ToString();
}
else
{
LiEspecifico.Visible = false;
}
UpBodyTipoCambio.Update();
}
}