diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 89892002b..368d96e14 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4595,6 +4595,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/CatPreciosLista.aspx".ToUpper(), 378) PaginaDict.Add("/Ventas/RepProductosServicios.aspx".ToUpper(), 352) PaginaDict.Add("/Ventas/RepProductosServiciosDetalle.aspx".ToUpper(), 352) + PaginaDict.Add("/Ventas/RepPS.aspx".ToUpper(), 701) PaginaDict.Add("/Ventas/RepABT.aspx".ToUpper(), 353) PaginaDict.Add("/Ventas/CatPromociones.aspx".ToUpper(), 123) PaginaDict.Add("/Ventas/Promociones.aspx".ToUpper(), 124) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index cfddc9043..4519bd0b3 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1536,6 +1536,34 @@ Public Class ClsVentas Return Retorno End Function + Public Function GetRepPSEcono(CveSubProyecto As Integer, CvePS As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, Optional CveUsuarioConsulta As Integer = -1, Optional GPO As Integer = -1, + Optional CveMoneda As Integer = -1, Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_RepPSEconoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@GPO", SqlDbType.Int).Value = GPO + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function GetRepNCxAplicar(CveClienteSucursal As Integer, CveSubProyecto As Integer, CveCliente As Integer, FechaInicio As DateTime, FechaFin As DateTime, ConSaldo As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/Ventas/RepPS.aspx b/Ventas/RepPS.aspx new file mode 100644 index 000000000..85d50862d --- /dev/null +++ b/Ventas/RepPS.aspx @@ -0,0 +1,164 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepPS.aspx.vb" Inherits="Ventas_RepPS" %> + + + + + + + + Reporte de Ventas por Producto + + + + + + + + + + +
+
+
+ + +
+
+
+ +
+ + + +
+
+ Fecha Inicio: + +
+
+
+ + + + +
+ + + + + + +
+
+ Fecha Fin: + +
+
+
+ + + + +
+ + + + + + +
+ +
+ + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb new file mode 100644 index 000000000..e62b9120d --- /dev/null +++ b/Ventas/RepPS.aspx.vb @@ -0,0 +1,102 @@ +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.Data +Partial Class Ventas_RepPS + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaDatosIniciales() + CargaCombos() + CargaDatos() + End If + End Sub + Private Sub CargaDatosIniciales() + txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" + txtFechaF.Text = Now.ToString("dd/MM/yyyy") + End Sub + Private Sub CargaCombos() + CargaTipoCentroCosto() + End Sub + + Private Sub CargaTipoCentroCosto() + + If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then + DdlSubProyecto.Items.Clear() + 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() + + 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 = 3 Then + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then + LblSubProyecto.InnerText = "Proyecto:" + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then + LblSubProyecto.InnerText = "Sucursal:" + End If + End Sub + + Private Sub CargaDatos() + + Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero() + Dim Grupo As Integer = DdlGrupo.SelectedValue.ToEntero() + Dim CvePS As Integer = -1 + Dim CveMoneda As Integer = -1 + Dim TC As Integer = 1 + Dim TCEspecifico As Decimal = -1 + Dim FechaI, FechaF As DateTime + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) + + Dim ObjVentas As New ClsVentas() + If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then + GvDatos.DataSource = ObjVentas.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjVentas.Dispose() + GvDatos.DataBind() + + 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("Orden").ToString.ToEntero() + Case 4 + e.Row.CssClass = "Totales" + Case 3 + e.Row.CssClass = "SubTotales2" + Case 2 + e.Row.CssClass = "SubTotales" + Case 1 + e.Row.CssClass = "SubTotalesB" + Case 0 + e.Row.CssClass = "Texto" + End Select + End If + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub +End Class