Reporte de Auxiliar de facturas de venta.

This commit is contained in:
2020-06-30 19:27:35 -07:00
parent 0f7967f1bf
commit b2c933895a
4 changed files with 544 additions and 0 deletions

View File

@@ -4820,6 +4820,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Ventas/RepVentasMensualesDetalle.aspx".ToUpper(), 721)
PaginaDict.Add("/Ventas/MetasVendedores.aspx".ToUpper(), 722)
PaginaDict.Add("/Ventas/CatMetasVendedores.aspx".ToUpper(), 723)
PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 704)
#End Region

View File

@@ -1638,6 +1638,43 @@ Public Class ClsVentas
Return Retorno
End Function
'Reporte de Ventas - Auxiliar Facturas
Public Function GetRepAuxliarFacturas(CveProyecto As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CvePS As Integer, FechaI As Date, FechaF As Date,
CveCliente As Integer, CveVendedor As Integer, CveUsuario As Integer, CveEstatus As Integer, CveEmpresa As Integer,
Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = -1, Optional CveUsuarioConsulta As Integer = -1, Optional TipoDocto As String = "-1") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_RepAuxiliarGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio
.Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico
.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el reporte auxiliar de facturas de venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region
#Region "V E N T A S - P R E C I O L I S T A S" 'Hecho por Charlie 1/9/2016

View File

@@ -0,0 +1,202 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepAuxiliarFacturas.aspx.vb" Inherits="Ventas_RepAuxiliarFacturas" %>
<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">
Reporte auxiliar de facturas de venta.
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
<li>
<asp:LinkButton ID="LnkPdf" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="ImgExcel" runat="server"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i> 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="Content5" ContentPlaceHolderID="H" runat="Server">
</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 class="portlet solid grey-cascade portlet-filter" id="idnecesaria">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row">
<label class="col-md-1 truncate">Productos Servicios:</label>
<div class="col-md-2">
<ADS:Dropdownlost runat="server" ID="DdlPS" Style="width: 95%;" CssClass="DdlPS" CssClassDdl="select2me " DataTextField="PSCodigo" DataValueField="CvePS" />
</div>
<div class="col-md-1 truncate">
Fecha Inicio:
</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: 100px !important; padding: 0px;">
<asp:TextBox Width="80px" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-1 truncate">
Fecha Fin:
</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
<asp:TextBox Width="80px" ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<label class="col-md-1 ">Estatus:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlEstatus" runat="server" AppendDataBoundItems="true" DataTextField="EstatusFactura" DataValueField="CveEstatusFactura" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
</div>
<div class="portlet-body" style="display: none">
<div class="row">
<label runat="server" id="LblProyecto" class="col-md-1 truncate">Proyecto:</label>
<div runat="server" id="DivProyecto" class="col-md-2">
<asp:DropDownList ID="DdlProyecto" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="Proyecto" DataValueField="CveProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
<label runat="server" id="LblSubProyecto" class="col-md-1 truncate">SubProyecto:</label>
<div runat="server" id="DivSubProyecto" class="col-md-2">
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
<label class="col-md-1 ">Cliente:</label>
<div class="col-md-2">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
<label class="col-md-1 truncate">Vendedor:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlVendedor" runat="server" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Class="table-group-action-input form-control input-inline input-small input-sm select2me" Style="width: 100%">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="row">
<label class="col-md-1 truncate">Clasificación:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlClasificacion" AutoPostBack="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me" runat="server" AppendDataBoundItems="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Style="width: 100%">
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
<label class="col-md-1">Tipo: </label>
<div class="col-md-2">
<asp:ListBox ID="DdlTipoComprobante" AutoPostBack="true" OnTextChanged="DdlTipoComprobante_SelectedIndexChanged" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server">
<asp:ListItem Text="Ingresos" Value="Ing"></asp:ListItem>
<asp:ListItem Text="Egresos" Value="Egs"></asp:ListItem>
<asp:ListItem Text="Remisión" Value="Rem"></asp:ListItem>
<asp:ListItem Text="Cotización" Value="Cot"></asp:ListItem>
<asp:ListItem Text="Anticipos" Value="Ant"></asp:ListItem>
<asp:ListItem Text="Pedido Con" Value="Ped"></asp:ListItem>
<asp:ListItem Text="Devolucion" Value="Dev"></asp:ListItem>
<asp:ListItem Text="Pedido" Value="Pd2"></asp:ListItem>
</asp:ListBox>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas con los filtros especificados" ToolTip="Listado de Ventas"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" Style="text-align: center;" GridLines="None" Width="99%">
<Columns>
<asp:BoundField HeaderText="Cliente" DataField="Cliente" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField HeaderText="Grupo" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Literal ID="LtlGrupo" runat="server" Text='<%# Eval("GPO") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Fecha" DataField="Fecha" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" ItemStyle-Width="10%" DataFormatString="{0:###,###,###,###.##}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Sub Total" DataField="SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Descuento" DataField="Descuento" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IVA" DataField="IVA" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total" DataField="Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Sub. Máximo" DataField="MAX_SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
<asp:BoundField HeaderText="Sub. Promedio" DataField="AVG_SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
<asp:BoundField HeaderText="Sub. Mínimo" DataField="MIN_SubTotal" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
<asp:BoundField HeaderText="Tot. Máximo" DataField="MAX_Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
<asp:BoundField HeaderText="Tot. Promedio" DataField="AVG_Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
<asp:BoundField HeaderText="Tot. Mínimo" DataField="MIN_Total" ItemStyle-Width="10%" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" />
</Columns>
<RowStyle CssClass="Texto" />
<HeaderStyle CssClass="Titulos" />
</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" AutoPostBack="true">
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Compra" 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" OnClick="BtnTipoCambio_Click1" runat="server" 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,304 @@
Option Explicit On
Option Strict On
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Imports System.Data
Partial Class Ventas_RepAuxiliarFacturas
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Private Property DtVentas As DataTable
Get
Return DirectCast(ViewState("DtVentas"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtVentas") = value
End Set
End Property
Private Property DtColor As DataTable
Get
Return DirectCast(ViewState("DtColor"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtColor") = value
End Set
End Property
Private Property Agrupador As String
Get
Return ViewState("Agrupador").ToString
End Get
Set(value As String)
ViewState("Agrupador") = value
End Set
End Property
Private Property TCEspecifico As Double
Get
Return ViewState("TCEspecifico").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TCEspecifico") = value
End Set
End Property
Private Property TipoCambio As Integer
Get
Return ViewState("TipoCambio").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("TipoCambio") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaCombos()
End If
End Sub
#Region "C A R G A - C O M B O S"
Private Sub CargaClientes()
DdlClientes.ddl.Items.Clear()
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClientes.DataBind()
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Protected Sub DdlTipoComprobante_SelectedIndexChanged(sender As Object, e As EventArgs)
DdlEstatus.Items.Clear()
If DdlTipoComprobante.SelectedValue <> "-1" Then
DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(String.Format("TipoDocto = '{0}'", DdlTipoComprobante.SelectedValue))
Else
DdlEstatus.DataSource = GlobalDTEstatusFactura
End If
DdlEstatus.Items.Add(New ListItem("Todos", "-1"))
DdlEstatus.DataBind()
DdlEstatus.SelectedValueExist("3")
End Sub
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged
DdlSubProyecto.Items.Clear()
If DdlProyecto.SelectedValue <> "-1" Then
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.DataBind()
End If
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClasificacion.SelectedIndexChanged
If UsuarioActual.Empresa.Funcionalidad(105) = "" Then
DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacion.SelectedValue.ToEntero)
DdlPS.DataBind()
DdlPS.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
Else
DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
DdlPS.SelectedText = "Todos"
DdlPS.SelectedValue = "-1"
End If
End Sub
Private Sub CargaTipoCentroCosto()
If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then
DdlSubProyecto.Items.Clear()
DivProyecto.Visible = False
LblProyecto.Visible = False
LblSubProyecto.InnerText = "Sucursal:"
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
DdlSubProyecto.DataBind()
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then
DdlSubProyecto.Items.Clear()
DivProyecto.Visible = False
LblProyecto.Visible = False
LblSubProyecto.InnerText = "Proyecto:"
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
DdlSubProyecto.DataBind()
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then
LblProyecto.InnerText = "Sucursal:"
LblSubProyecto.InnerText = "Proyecto:"
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then
LblProyecto.InnerText = "Proyecto:"
LblSubProyecto.InnerText = "Sucursal:"
End If
End Sub
Private Sub CargaCombos()
'Cargo Clientes
CargaClientes()
'Cargo Proyectos
DdlProyecto.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1)
DdlProyecto.DataBind()
'Cargo Clasificaciones
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacion.DataBind()
'CargaSubProyectos
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.DataBind()
'Vendedor
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedor.DataBind()
'Carga Productos
DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
DdlPS.SelectedText = ""
DdlPS.SelectedValue = "-1"
Else
DdlPS.ddl.Items.Clear()
DdlPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacion.SelectedValue.ToEntero)
DdlPS.ddl.DataBind()
DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
End If
'CargaEstatus
DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(" CveEstatusFactura NOT IN (1, 4, 5) ")
DdlEstatus.DataBind()
DdlEstatus.Items.Add(New ListItem("Canceladas", "4"))
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" Then
DdlEstatus.SelectedIndex = 2
Else
DdlEstatus.SelectedIndex = 1
End If
CargaTipoCentroCosto()
TipoCambio = 1
TCEspecifico = 0
Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
If EsWS Then
DdlClientes.setEsWebService(True)
Else
DdlClientes.setEsWebService(False)
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClientes.DataBind()
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End If
End Sub
#End Region
#Region "C A R G A - D A T O S"
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
CargaDatos()
UPDatos.Update()
End Sub
Private Sub CargaDatos()
Dim TipoComprobante As String = If(DdlTipoComprobante.GetSelectedValuesM = "", "-1", DdlTipoComprobante.GetSelectedValuesM)
Dim FechaI, FechaF As Date
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then TCEspecifico = TxtEspecifico.Text.ToDouble Else TCEspecifico = -1
Dim CveCliente As Integer = If(DdlClientes.SelectedValue.ToEntero > 0, DdlClientes.SelectedValue.ToEntero, -1)
Dim ObjVentas As New ClsVentas()
If ObjVentas.GetRepAuxliarFacturas(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero,
FechaI, FechaF, CveCliente, DdlVendedor.SelectedValue.ToEntero, -1, DdlEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa,
CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:=TipoComprobante, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico) Then
DtVentas = ObjVentas.DtResultados.Copy()
End If
ObjVentas.Dispose()
GvDatos.DataSource = DtVentas
GvDatos.DataBind()
End Sub
Protected Sub BtnTipoCambio_Click1(sender As Object, e As EventArgs)
CargaDatos()
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"))
UPDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Select Case e.Row.DBCampo("TipoFila")
Case "1"
e.Row.CssClass = "Totales"
Case "2"
e.Row.CssClass = "SubTotales"
e.Row.FCLiteral("LtlGrupo").Text = String.Format("<a target=""_blank"" Class=""{0}"" href=""{1}"">{2}</a>", "SubTotales", String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DBCampo("CveVenta")), e.Row.DBCampo("Gpo"))
End Select
End If
End Sub
#End Region
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
GvDatos.ExportToExcel("RepAuxiliarFacturas" & Now.ToShortDateString)
End Sub
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
If GvDatos.Rows.Count > 0 Then
GenerarPDF()
Else
Alert("No hay datos para imprimir")
End If
End Sub
Private Sub GenerarPDF()
Dim FechaI, FechaF As Date
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
Dim Cliente = If(DdlClientes.SelectedText = "", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}")
Dim FechaInicio = If(txtFechaI.Text = "", "", $"&emsp;<b>Fecha Inicio:</b>&nbsp;{txtFechaI.Text}")
Dim FechaFin = If(txtFechaF.Text = "", "", $"&emsp;<b>Fecha Fin:</b>&nbsp;{txtFechaF.Text}")
Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $"&emsp;<b>Clasificación:</b>&nbsp;{DdlClasificacion.SelectedItem.Text}")
Dim PS = If(DdlPS.SelectedValue = "-1", "", $"&emsp;<b>P.S.:</b>&nbsp;{DdlPS.SelectedText}")
Dim Proyecto = If(DdlSubProyecto.SelectedValue = "-1", "", $"&emsp;<b>Proyecto:</b>&nbsp;{DdlSubProyecto.SelectedItem.Text}")
Dim Estatus = If(DdlEstatus.SelectedValue = "-1", "", $"&emsp;<b>Estatus:</b>&nbsp;{DdlEstatus.SelectedItem.Text}")
If DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 Then
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("FechaInicio", If(txtFechaI.Text <> "", FechaI.ToShortDateString, "")))
params.Add(New ReportParameter("FechaFin", If(txtFechaF.Text <> "", FechaF.ToShortDateString, "")))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Filtros", $"{Cliente}{FechaInicio}{FechaFin}{Clasificacion}{PS}{Proyecto}{Estatus}"))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
ImprimirPDF("Empresas/Grales/Formatos/RepAuxiliarFacturas.rdlc", DtVentas, params, "ReporteAuxiliarFacturas")
Else
Alert("No hay información para mostrar.", TipoMensaje.MsgAdvertencia)
End If
End Sub
End Class