Commit inicial Ventas Productivo
This commit is contained in:
187
Bancos/RepClientesAnticipo.aspx.vb
Normal file
187
Bancos/RepClientesAnticipo.aspx.vb
Normal file
@@ -0,0 +1,187 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Bancos_RepClientesAnticipo
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property DTDatos As DataTable
|
||||
Get
|
||||
If ViewState("DTDatos") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTDatos"), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
SetValues()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " SET VALUES "
|
||||
Private Sub SetValues()
|
||||
|
||||
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
||||
DdlClientes.DataBind()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjBancos As New ClsBancos
|
||||
|
||||
Dim FechaI = If(IsDate(txtFechaI.Text), txtFechaI.Text.ToDate, MinFecha)
|
||||
Dim FechaF = If(IsDate(txtFechaF.Text), txtFechaF.Text.ToDate, MaxFecha)
|
||||
|
||||
|
||||
If ObjBancos.GetClienteAnticiposRep(DdlClientes.SelectedValue.ToEntero, DdlTipoReporte.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
|
||||
DTDatos = ObjBancos.DtResultados
|
||||
GvDatos.DataSource = ObjBancos.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
DTDatos = Nothing
|
||||
End If
|
||||
|
||||
ObjBancos.Dispose()
|
||||
GvDatos.DataBind()
|
||||
|
||||
If (GvDatos.Rows.Count > 0) Then
|
||||
GvDatos.UseAccessibleHeader = True
|
||||
GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
||||
RegistraScript("OrdenarGV();")
|
||||
End If
|
||||
|
||||
UPDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " GV DATOS "
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
'If e.Row.DBCampo("TipoDato") = "TOTAL" Then
|
||||
' e.Row.CssClass = "Totales2"
|
||||
' e.Row.Font.Italic = True
|
||||
'End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDato") = "CABECERA LIDER" Then
|
||||
' e.Row.CssClass = "Totales"
|
||||
' e.Row.Font.Bold = True
|
||||
' e.Row.Attributes.Add("style", "background:#67809F !important")
|
||||
'End If
|
||||
|
||||
'If e.Row.DBCampo("TipoDato") = "CABECERA MOVILIZADOR" Then
|
||||
' e.Row.CssClass = "SubTotales2"
|
||||
' e.Row.Font.Italic = True
|
||||
'End If
|
||||
|
||||
Dim Liga = ""
|
||||
|
||||
If e.Row.DBCampo("CveCliente") = "" Then
|
||||
e.Row.CssClass = "Totales sinlink white"
|
||||
e.Row.Font.Italic = True
|
||||
e.Row.FCHyperLink("HLLiga").Text = e.Row.DBCampo("Nombre")
|
||||
Else
|
||||
|
||||
If e.Row.DBCampo("CveVenta") = "" Then
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
e.Row.Font.Bold = True
|
||||
e.Row.Attributes.Add("style", "background:#CCCCCC !important")
|
||||
|
||||
e.Row.FCHyperLink("HLLiga").NavigateUrl = $"/Ventas/Clientes.aspx?CveCliente={e.Row.DBCampo("CveCliente")}"
|
||||
e.Row.FCHyperLink("HLLiga").Text = e.Row.DBCampo("Nombre")
|
||||
Else
|
||||
|
||||
e.Row.FCHyperLink("HLLiga").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta")}"
|
||||
e.Row.FCHyperLink("HLLiga").Text = e.Row.DBCampo("Folio")
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " SELECTED INDEX CHANGED "
|
||||
Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "I M P R I M I R P D F/Excel"
|
||||
|
||||
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
GenerarPDF("Excel")
|
||||
End Sub
|
||||
Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
|
||||
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
||||
Dim ObjTareas As New ClsOIEventos
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
|
||||
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 Filtros As String = "<b>Filtros: </b>"
|
||||
|
||||
If DdlClientes.SelectedIndex > 0 Then Filtros = Filtros & " Clientes Todos: " Else Filtros = Filtros & " Cliente: " & DdlClientes.SelectedItem.Text
|
||||
|
||||
Dim FechaI, FechaF As String
|
||||
FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
|
||||
FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
|
||||
|
||||
If FechaI <> "-1" Then Filtros = Filtros & " Fecha I " & FechaI
|
||||
If FechaF <> "-1" Then Filtros = Filtros & " Fecha F " & FechaF
|
||||
|
||||
|
||||
Filtros = Filtros & " Tipo: " & DdlTipoReporte.SelectedItem.Text
|
||||
|
||||
params.Add(New ReportParameter("Filtros", Filtros))
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicio", FechaI))
|
||||
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
|
||||
ImprimirPDF("Empresas\Grales\Formatos\RepClientesAnticipo.rdlc", DTDatos, params, "ReporteAnticipoClientes", Formato:=Formato)
|
||||
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user