diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 21eb83cd4..2a66e9236 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -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
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index c348cebec..f49aabb3c 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -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
diff --git a/Ventas/RepAuxiliarFacturas.aspx b/Ventas/RepAuxiliarFacturas.aspx
new file mode 100644
index 000000000..4146eba0b
--- /dev/null
+++ b/Ventas/RepAuxiliarFacturas.aspx
@@ -0,0 +1,202 @@
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepAuxiliarFacturas.aspx.vb" Inherits="Ventas_RepAuxiliarFacturas" %>
+
+
+
+
+
+
+ Reporte auxiliar de facturas de venta.
+
+
+
+
+
+
+
+
+
diff --git a/Ventas/RepAuxiliarFacturas.aspx.vb b/Ventas/RepAuxiliarFacturas.aspx.vb
new file mode 100644
index 000000000..82890d330
--- /dev/null
+++ b/Ventas/RepAuxiliarFacturas.aspx.vb
@@ -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("{2}", "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 = "", "", $" Cliente: {DdlClientes.SelectedText}")
+ Dim FechaInicio = If(txtFechaI.Text = "", "", $" Fecha Inicio: {txtFechaI.Text}")
+ Dim FechaFin = If(txtFechaF.Text = "", "", $" Fecha Fin: {txtFechaF.Text}")
+ Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $" Clasificación: {DdlClasificacion.SelectedItem.Text}")
+ Dim PS = If(DdlPS.SelectedValue = "-1", "", $" P.S.: {DdlPS.SelectedText}")
+ Dim Proyecto = If(DdlSubProyecto.SelectedValue = "-1", "", $" Proyecto: {DdlSubProyecto.SelectedItem.Text}")
+ Dim Estatus = If(DdlEstatus.SelectedValue = "-1", "", $" Estatus: {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