198 lines
7.7 KiB
VB.net
198 lines
7.7 KiB
VB.net
|
|
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
|
|
|
|
Private Property TipoCambio As Integer
|
|
Get
|
|
Return ViewState("TipoCambio").ToString.ToEntero
|
|
End Get
|
|
|
|
Set(value As Integer)
|
|
ViewState("TipoCambio") = value
|
|
End Set
|
|
End Property
|
|
Private Property TCEspecifico As Decimal
|
|
Get
|
|
Return ViewState("TCEspecifico").ToString.ToDecimal
|
|
End Get
|
|
|
|
Set(value As Decimal)
|
|
ViewState("TCEspecifico") = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
TCEspecifico = -1
|
|
TipoCambio = 1
|
|
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 Cves_Subprotectos As String = If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM)
|
|
Dim TiposDoc As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM)
|
|
|
|
'If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then
|
|
' TCEspecifico = TxtEspecifico.Text.ToDecimal
|
|
'Else
|
|
' TCEspecifico = -1
|
|
'End If
|
|
|
|
Dim ObjRepI As New ClsVentas()
|
|
If ObjRepI.RepIngresos(UsuarioActual.CveEmpresa, If(RsFechaI = "-1", MinFecha, RsFechaI.ToDate), If(RsFechaF = "-1", MaxFecha, RsFechaF.ToDate), TiposDoc, Cves_Subprotectos, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico) Then
|
|
GVRepIngresos.DataSource = ObjRepI.DtResultados
|
|
DtDatos = ObjRepI.DtResultados
|
|
End If
|
|
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 = "", "", $"Fecha Inicio: {TxtFechaInicio.Text} ")
|
|
Dim FF As String = If(TxtFechaFin.Text = "", "", $"Fecha Fin: {TxtFechaFin.Text} ")
|
|
Dim Tipo As String = If(DdlTipoDocto.SelectedValue = "", "", $"Tipo Docto: {DdlTipoDocto.GetSelectedText} ")
|
|
Dim subProy As String = If(DdlSubProyecto.SelectedValue = "", "", $"SubProyecto: {DdlSubProyecto.GetSelectedText} ")
|
|
|
|
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}"))
|
|
params.Add(New ReportParameter("FechaImpresion", DateAndTime.Now))
|
|
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
|
|
Protected Sub GVRepIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("TipoAmortizacion") = "" Then
|
|
e.Row.CssClass = "Totales"
|
|
ElseIf e.Row.DBCampo("TipoAmortizacion") <> "" AndAlso e.Row.DBCampo("CveConceptoContable") = "" Then
|
|
e.Row.CssClass = "SubTotales"
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
|
|
TipoCambio = RblTipoCambio.SelectedValue.ToEntero
|
|
'If TipoCambio = 3 Then
|
|
' LiEspecifico.Visible = True
|
|
' TCEspecifico = GlobalTipoCambio(Now).ToDecimal
|
|
' TxtEspecifico.Text = TCEspecifico.ToString
|
|
'Else
|
|
' LiEspecifico.Visible = False
|
|
'End If
|
|
UpBodyTipoCambio.Update()
|
|
End Sub
|
|
Private Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"))
|
|
LnkFiltrar_Click(LnkFiltrar, EventArgs.Empty)
|
|
End Sub
|
|
End Class
|