Commit inicial Ventas Productivo
This commit is contained in:
142
Ventas/RepIngresos.aspx.vb
Normal file
142
Ventas/RepIngresos.aspx.vb
Normal file
@@ -0,0 +1,142 @@
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Ventas_RepIngresos
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "Propiedades"
|
||||
Protected ReadOnly Property Filtros As String
|
||||
Get
|
||||
Dim retorno As New StringBuilder
|
||||
If RsFechaI <> "-1" Then
|
||||
retorno.Append("&RsFechaI=")
|
||||
retorno.Append(RsFechaI)
|
||||
End If
|
||||
If RsFechaF <> "-1" Then
|
||||
retorno.Append("&RsFechaF=")
|
||||
retorno.Append(RsFechaF)
|
||||
End If
|
||||
If TipoDoc <> "-1" Then
|
||||
retorno.Append("&TipoDoc=")
|
||||
retorno.Append(TipoDoc)
|
||||
End If
|
||||
If CveSubProyecto <> -1 Then
|
||||
retorno.Append("&CveSubProyecto=")
|
||||
retorno.Append(CveSubProyecto)
|
||||
End If
|
||||
Return retorno.ToString()
|
||||
End Get
|
||||
End Property
|
||||
Private Property RsFechaI() As String
|
||||
Get
|
||||
Return If(IsNothing(ViewState("RsFechaI")), "-1", CStr(ViewState("RsFechaI")))
|
||||
End Get
|
||||
Set
|
||||
ViewState("RsFechaI") = Value
|
||||
End Set
|
||||
End Property
|
||||
Private Property RsFechaF() As String
|
||||
Get
|
||||
Return If(IsNothing(ViewState("RsFechaF")), "-1", CStr(ViewState("RsFechaF")))
|
||||
End Get
|
||||
Set
|
||||
ViewState("RsFechaF") = Value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TipoDoc() As String
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TipoDoc")), "-1", CStr(ViewState("TipoDoc")))
|
||||
End Get
|
||||
Set
|
||||
ViewState("TipoDoc") = Value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveSubProyecto() As Integer
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CveSubProyecto")), -1, ViewState("CveSubProyecto").ToString().ToEntero())
|
||||
End Get
|
||||
Set
|
||||
ViewState("CveSubProyecto") = Value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
|
||||
Set(ByVal value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CveSubProyecto = -1
|
||||
TxtFechaInicio.Text = String.Format("01/01/{0}", Now.Year)
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
||||
DdlSubProyecto.DataBind()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaRepIngresos(Optional tipoReporte As Integer = -1)
|
||||
Dim ObjRepI As New ClsVentas()
|
||||
ObjRepI.RepIngresos(UsuarioActual.CveEmpresa, If(RsFechaI = "-1", MinFecha, RsFechaI.ToDate), If(RsFechaF = "-1", MaxFecha, RsFechaF.ToDate), TipoDoc, DdlSubProyecto.SelectedValue.ToEntero)
|
||||
GVRepIngresos.DataSource = ObjRepI.DtResultados
|
||||
DtDatos = ObjRepI.DtResultados
|
||||
ObjRepI.Dispose()
|
||||
GVRepIngresos.DataBind()
|
||||
upDatosRepI.Update()
|
||||
End Sub
|
||||
Protected Sub LnkFiltrar_Click(sender As Object, e As EventArgs)
|
||||
RsFechaI = TxtFechaInicio.Text.Replace("__/__/____", "").Trim()
|
||||
RsFechaI = If(RsFechaI.Length > 6, RsFechaI.ToDate().ToString("yyyy/MM/dd"), "-1")
|
||||
RsFechaF = TxtFechaFin.Text.Replace("__/__/____", "").Trim()
|
||||
RsFechaF = If(RsFechaF.Length > 6, RsFechaF.ToDate().ToString("yyyy/MM/dd"), "-1")
|
||||
TipoDoc = DdlTipoDocto.SelectedValue
|
||||
CveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero()
|
||||
CargaRepIngresos()
|
||||
End Sub
|
||||
#Region "IMPRESION"
|
||||
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs)
|
||||
GeneraImpresion()
|
||||
End Sub
|
||||
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs)
|
||||
GeneraImpresion("Excel")
|
||||
End Sub
|
||||
|
||||
Private Sub GeneraImpresion(Optional Formato As String = "PDF")
|
||||
|
||||
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 FI As String = If(TxtFechaInicio.Text = "", "", $" <b>Fecha Inicio:</b> {TxtFechaInicio.Text}")
|
||||
Dim FF As String = If(TxtFechaFin.Text = "", "", $" <b>Fecha Fin:</b> {TxtFechaFin.Text}")
|
||||
Dim Tipo As String = If(DdlTipoDocto.SelectedValue = "-1", "", $" <b>Tipo Docto.:</b> {DdlTipoDocto.SelectedItem.Text}")
|
||||
Dim subProy As String = If(DdlSubProyecto.SelectedValue = "-1", "", $" <b>SubProyecto:</b> {DdlSubProyecto.SelectedItem.Text}")
|
||||
|
||||
If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("AgrupadoPor", $"{FI}{FF}{Tipo}{subProy}"))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepIngresos.rdlc", DtDatos, params, "RepPUESinPago", Formato)
|
||||
Else
|
||||
Alert("No se encontraron datos con los filtros especificados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user