93 lines
3.6 KiB
VB.net
93 lines
3.6 KiB
VB.net
Imports Extensiones
|
|
Imports System.Data
|
|
Imports System
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class Acumuladores_RepEntradasUsadosClientes
|
|
Inherits ClsPaginas
|
|
|
|
Private Property DatosEntradasUsadosClientes() As DataTable
|
|
Get
|
|
Return CType(ViewState("DatosEntradasUsados"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DatosEntradasUsados") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub Acumuladores_EntradasUsados_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
CargaCombos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
|
|
End Sub
|
|
|
|
Public Sub CargaCombos()
|
|
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
DdlAlmacen.DataBind()
|
|
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
TxtFechaI.text = now.Firstdayofmonth
|
|
txtfechaf.text = now.toshortdatestring
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
|
|
Dim FechaI, FechaF As Date
|
|
FechaI = If(IsDate(TxtFechaI.Text.Trim()), TxtFechaI.Text.Trim.todate, minfecha)
|
|
FechaF = If(IsDate(TxtFechaF.Text.Trim()), TxtFechaF.Text.Trim.todate, maxfecha)
|
|
|
|
Dim CveAlmacen As Integer = If(DdlAlmacen.SelectedValue = "", "-1", DdlAlmacen.SelectedValue).ToString.toentero
|
|
|
|
Dim Acum As New ClsAcumuladores
|
|
|
|
If Acum.EntradasUsadosClientesRep(CveAlmacen, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = Acum.DtResultados.FiltraParametros("Codigo_Clientes <> 'Total:'") 'los renglones generados con esta caracteriztica son con un grouping set en la consulta, se pueden quitar
|
|
DatosEntradasUsadosClientes = Acum.DtResultados.FiltraParametros("Codigo_Clientes <> 'Total:'")
|
|
End If
|
|
|
|
Acum.Dispose()
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
If e.Row.DBCampo("EsHeader").ToString = "-1" Or e.Row.DBCampo("Codigo").ToString = "" Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs)
|
|
|
|
|
|
Dim Dia As String = {"lunes", "martes", "miércoles", "jueves", "viernes", "sábado", "domingo"}(If((Weekday(Today) - 2) = -1, 7, Weekday(Today) - 2))
|
|
Dim Mes As String = {"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"}(Month(Today) - 1)
|
|
|
|
Dim FechaConFormato As String = String.Format("{0}, {1} de {2} de {3}", Dia, Day(Today), Mes, Year(Today))
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
|
|
params.Add(New ReportParameter("Direccion", "Tamaulipas Esq. con Guadalupe Victoria"))
|
|
params.Add(New ReportParameter("FechaConFormato", FechaConFormato))
|
|
params.Add(New ReportParameter("FechaInicial", TxtFechaI.Text))
|
|
params.Add(New ReportParameter("FechaFinal", TxtFechaF.Text))
|
|
|
|
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = DatosEntradasUsadosClientes}
|
|
|
|
ImprimirPDF(String.Format("Empresas/{0}/Formatos/RepEntradasUsadosClientes.rdlc", UsuarioActual.CveEmpresa), DatosEntradasUsadosClientes, params, "Entradas usados clientes", "PDF")
|
|
|
|
End Sub
|
|
|
|
End Class
|