Commit inicial Ventas Productivo
This commit is contained in:
228
Bancos/RepCobradoPagado.aspx.vb
Normal file
228
Bancos/RepCobradoPagado.aspx.vb
Normal file
@@ -0,0 +1,228 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Bancos_RepCobradoPagado
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property PrendeLink As Boolean
|
||||
Get
|
||||
Return CType(ViewState("PrendeLink"), Boolean)
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("PrendeLink") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TCEspecifico As Double
|
||||
Get
|
||||
If ViewState("TCEspecifico") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return DirectCast(ViewState("TCEspecifico"), Double)
|
||||
End If
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TCEspecifico") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaCombos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "CARGA DATOS"
|
||||
Private Sub CargaCombos()
|
||||
DdlGrupo.Items.Clear()
|
||||
txtFechaI.Text = DateTime.Now.FirstDayOfMonth.ToShortDateString
|
||||
txtFechaF.Text = DateTime.Now.LastDayOfMonth.ToShortDateString
|
||||
If DdlModalidad.SelectedValue = "2" Then
|
||||
DdlGrupo.Items.Insert(0, New ListItem("Año", "1"))
|
||||
DdlGrupo.Items.Insert(1, New ListItem("Año/Mes", "2"))
|
||||
DdlGrupo.Items.Insert(2, New ListItem("Proveedor", "3"))
|
||||
DdlGrupo.Items.Insert(3, New ListItem("Usuario", "4"))
|
||||
DdlGrupo.Items.Insert(4, New ListItem("Responsable", "5"))
|
||||
DdlGrupo.Items.Insert(5, New ListItem("Clasificacion Proveedor", "6"))
|
||||
DdlGrupo.Items.Insert(6, New ListItem("Moneda", "7"))
|
||||
DdlGrupo.Items.Insert(7, New ListItem("Centro de Costo", "8"))
|
||||
DdlGrupo.Items.Insert(8, New ListItem("Clasificacion ", "9"))
|
||||
DdlGrupo.Items.Insert(9, New ListItem("Centro de Costo - Clasificación", "10"))
|
||||
DdlGrupo.Items.Insert(10, New ListItem("Proyecto - CC - Clasificación", "11"))
|
||||
|
||||
ElseIf DdlModalidad.SelectedValue = "1" Then
|
||||
DdlGrupo.Items.Insert(0, New ListItem("Año", "1"))
|
||||
DdlGrupo.Items.Insert(1, New ListItem("Año/Mes", "2"))
|
||||
DdlGrupo.Items.Insert(2, New ListItem("Cliente", "3"))
|
||||
DdlGrupo.Items.Insert(3, New ListItem("Usuario", "4"))
|
||||
DdlGrupo.Items.Insert(4, New ListItem("Moneda", "7"))
|
||||
DdlGrupo.Items.Insert(5, New ListItem("Centro de Costo", "8"))
|
||||
DdlGrupo.Items.Insert(6, New ListItem("Clasificacion", "9"))
|
||||
DdlGrupo.Items.Insert(7, New ListItem("Centro de Costo - Clasificacion", "10"))
|
||||
End If
|
||||
|
||||
DdlProyecto.DataSource = GlobalDTProyectos(UsuarioActual.CveEmpresa).FiltraParametros("", DistinctColumns:={"CveProyecto", "Proyecto"})
|
||||
DdlProyecto.DataBind()
|
||||
|
||||
End Sub
|
||||
Private Sub Consultar()
|
||||
If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then
|
||||
TCEspecifico = TxtEspecifico.Text.ToDouble
|
||||
Else
|
||||
TCEspecifico = -1
|
||||
End If
|
||||
|
||||
Dim ObjBancos As New ClsBancos
|
||||
|
||||
If ObjBancos.GetCobradoPagado(DdlModalidad.SelectedValue.ToEntero, DdlGrupo.SelectedValue.ToEntero,
|
||||
If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", MinFecha, txtFechaI.Text.ToDate),
|
||||
If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", Now, txtFechaF.Text.ToDate),
|
||||
DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico) Then
|
||||
DtDatos = ObjBancos.DtResultados
|
||||
If DtDatos.Rows.Count > 0 Then
|
||||
LblFUltimaSemana.Text = ObjBancos.DtResultados(0)("FUltimaSemana").ToString
|
||||
LblFUltimoMes.Text = ObjBancos.DtResultados(0)("FUltimoMes").ToString
|
||||
LblPenultimoMes.Text = ObjBancos.DtResultados(0)("FPenultimoMes").ToString
|
||||
End If
|
||||
Else
|
||||
DtDatos = Nothing
|
||||
Alert("Ocurrió un error al consultar el reporte. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjBancos.Dispose()
|
||||
|
||||
If DdlGrupo.SelectedValue.ToEntero = 3 Then PrendeLink = True Else PrendeLink = False 'Verifica que el agrupador sea cliente o provedor para mandar al detalle
|
||||
|
||||
If DtDatos IsNot Nothing Then
|
||||
GvDatos.DataSource = DtDatos
|
||||
GvDatos.DataBind()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
Consultar()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlModalidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlModalidad.SelectedIndexChanged
|
||||
CargaCombos()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "G V D A T O S"
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
'If PrendeLink Then
|
||||
' e.Row.FCLiteral("Gpo").Text = $"<a class=""Texto"" href='/Bancos/RepCobradoPagadoDetalle.aspx?FI={If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", MinFecha.ToDate.ToShortDateString, txtFechaI.Text)}&FF={If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", Now.ToDate.ToShortDateString, txtFechaF.Text)}&MOD={DdlModalidad.SelectedValue}&CVEPC={e.Row.DBCampo("CveProveedorCliente")}' target='_blank'>{e.Row.DBCampo("GPO")}</a>"
|
||||
'End If
|
||||
|
||||
If e.Row.DBCampo("Orden") = "" Then
|
||||
e.Row.CssClass = "Totales"
|
||||
Else
|
||||
e.Row.FCLiteral("Gpo").Text = $"<a class=""Texto"" href='/Bancos/RepCobradoPagadoDetalle.aspx?FI={If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", MinFecha.ToDate.ToShortDateString, txtFechaI.Text)}&FF={If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", Now.ToDate.ToShortDateString, txtFechaF.Text)}&CveProyecto={e.Row.DBCampo("CveProyecto")}&CveSubProyecto={e.Row.DBCampo("CveSubProyecto")}&MOD={DdlModalidad.SelectedValue}&Grupo={e.Row.DBCampo("Grupo")}&GPO={e.Row.DBCampo("GPO")}&TipoCambio={RblTipoCambio.SelectedValue}&TCEspecifico={TxtEspecifico.Text}&CveMoneda={e.Row.DBCampo("CveMoneda")}' target='_blank'>{e.Row.DBCampo("GPO")}</a>"
|
||||
End If
|
||||
If e.Row.DBCampo("Grupo") = "10" Then
|
||||
If e.Row.DBCampo("CveSubProyecto") <> "" AndAlso e.Row.DBCampo("CveClasificacion") = "" Then
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
End If
|
||||
End If
|
||||
If e.Row.DBCampo("Grupo") = "11" Then
|
||||
If e.Row.DBCampo("CveProyecto") <> "" AndAlso e.Row.DBCampo("CveSubProyecto") = "" Then
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
End If
|
||||
If e.Row.DBCampo("CveSubProyecto") <> "" AndAlso e.Row.DBCampo("CveClasificacion") = "" Then
|
||||
e.Row.CssClass = "SubTotales"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
|
||||
If RblTipoCambio.SelectedValue.ToEntero = 3 Then
|
||||
Dim TipoCambio As Double
|
||||
LiEspecifico.Visible = True
|
||||
TipoCambio = GlobalTipoCambio(Now)
|
||||
TxtEspecifico.Text = TipoCambio.ToString
|
||||
Else
|
||||
LiEspecifico.Visible = False
|
||||
End If
|
||||
UpBodyTipoCambio.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click
|
||||
Consultar()
|
||||
End Sub
|
||||
|
||||
#Region "I M P R I M I R <i class='fa fa-print'></i>"
|
||||
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
GvDatos.ExportToExcel("ReporteCobrado-Pagado" & Now.ToShortDateString)
|
||||
End Sub
|
||||
|
||||
Private Sub GenerarPDF()
|
||||
|
||||
Dim FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
|
||||
Dim FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
|
||||
Dim Grupo = DdlGrupo.SelectedItem.Text
|
||||
Dim Moneda = If(DdlModalidad.SelectedValue = "-1", "", $" <b>Modalidad:</b> {DdlModalidad.SelectedItem.Text}")
|
||||
Dim FechaIn As String = $" <b>Fecha Inicio:</b> {txtFechaI.Text}"
|
||||
Dim FechaFn As String = $" <b>Fecha Fin:</b> {txtFechaF.Text}"
|
||||
If txtFechaI.Text = "" Then FechaIn = ""
|
||||
If txtFechaF.Text = "" Then FechaFn = ""
|
||||
Dim FUltimaSemana As String = LblFUltimaSemana.Text
|
||||
Dim FUltimoMes As String = LblFUltimoMes.Text
|
||||
Dim FPenultimoMes As String = LblPenultimoMes.Text
|
||||
|
||||
If DtDatos.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", FechaI))
|
||||
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToString))
|
||||
params.Add(New ReportParameter("AgrupadoPor", $"<b>Agrupado Por:</b> {Grupo}{Moneda}{FechaIn}{FechaFn}"))
|
||||
params.Add(New ReportParameter("FUltimaSemana", FUltimaSemana))
|
||||
params.Add(New ReportParameter("FUltimoMes", FUltimoMes))
|
||||
params.Add(New ReportParameter("FPenultimoMes", FPenultimoMes))
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepCobradoPagado.rdlc", DtDatos, params, "ReporteCobrado-Pagado")
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
||||
GenerarPDF()
|
||||
UpAcciones.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged
|
||||
DdlSubProyecto.Items.Clear()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
DdlSubProyecto.DataBind()
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user