Reporte de ventas por producto
This commit is contained in:
102
Ventas/RepPS.aspx.vb
Normal file
102
Ventas/RepPS.aspx.vb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user