164 lines
7.6 KiB
VB.net
164 lines
7.6 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
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()
|
|
CargaNombreClientes()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
|
|
End Sub
|
|
Private Sub CargaNombreClientes()
|
|
DdlNombre.setEsWebService(True)
|
|
DdlNombre.Attributes.Add("data-metodo", "getcliente")
|
|
End Sub
|
|
Public Sub CargaCombos()
|
|
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 22)
|
|
DdlAlmacen.DataBind()
|
|
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
TxtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
|
|
TxtFechaF.text = NowADS().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 CveCliente As Integer = If(DdlNombre.SelectedValue = "", "-1", DdlNombre.SelectedValue).ToString.ToEntero
|
|
Dim Acum As New ClsAcumuladores
|
|
|
|
If Acum.EntradasUsadosClientesRep(CveAlmacen, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente) 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 = "" And e.Row.DataKey("CveVenta").ToString.ToEntero = 0 Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
End If
|
|
|
|
If e.Row.DataKey("CvePS").ToString.ToEntero > 0 And e.Row.DataKey("CveVenta").ToString.ToEntero = 0 Then
|
|
e.Row.CssClass = "SubTotales"
|
|
End If
|
|
|
|
|
|
If e.Row.DataKey("CveVenta").ToString.ToEntero > 0 Then
|
|
e.Row.Cells(1).Text = $"<a class='Texto' href='/Ventas/Ventas.aspx?CveVenta={e.Row.DataKey("CveVenta")}' Target='_blank' >{e.Row.DataKey("SerieFolio")}</a>"
|
|
Else
|
|
e.Row.Cells(2).Text = ""
|
|
e.Row.Cells(3).Text = ""
|
|
e.Row.Cells(4).Text = ""
|
|
'e.Row.Cells(6).Text = ""
|
|
End If
|
|
|
|
If e.Row.DataKey("EsDistribuidor") <> "" Then
|
|
e.Row.Cells(5).Text = $"<a class='Texto' href='/Ventas/Ventas.aspx?CveVenta={e.Row.DataKey("CveVenta")}' Target='_blank' >{e.Row.DataKey("Total").ToDecimal.ToString("#########")}</a>"
|
|
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}
|
|
|
|
Dim FIRutaReporte As New System.IO.FileInfo(String.Format("{0}Formatos/RepEntradasUsadosClientes.rdlc", UsuarioActual.Empresa.Ruta))
|
|
Dim PathRutaReporte As String = "\Formatos\RepEntradasUsadosClientes.rdlc"
|
|
|
|
If Not FIRutaReporte.Exists Then
|
|
PathRutaReporte = "\Empresas\Grales\Formatos\RepEntradasUsadosClientes.rdlc" 'No existe el General solo se hizo para la 140
|
|
End If
|
|
|
|
ImprimirPDF(PathRutaReporte, DatosEntradasUsadosClientes, params, "Entradas usados clientes", "PDF")
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnExcel_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}
|
|
|
|
Dim FIRutaReporte As New System.IO.FileInfo(String.Format("{0}Formatos/RepEntradasUsadosClientes.rdlc", UsuarioActual.Empresa.Ruta))
|
|
Dim PathRutaReporte As String = "\Formatos\RepEntradasUsadosClientes.rdlc"
|
|
|
|
If Not FIRutaReporte.Exists Then
|
|
PathRutaReporte = "\Empresas\Grales\Formatos\RepEntradasUsadosClientes.rdlc" 'No existe el General solo se hizo para la 140
|
|
End If
|
|
|
|
ImprimirPDF(PathRutaReporte, DatosEntradasUsadosClientes, params, "Entradas usados clientes", "Excel")
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Public Sub CargarVentasGrupo(sender As Object, e As EventArgs)
|
|
Dim tempLink As LinkButton = CType(sender, LinkButton)
|
|
Dim renglon As GridViewRow = CType(tempLink.NamingContainer, GridViewRow)
|
|
|
|
LbCliente.Text = renglon.DataKey("NombreComercial")
|
|
LbTam.Text = renglon.DataKey("Codigo_Clientes")
|
|
Dim CveAlmacen As Integer = -1
|
|
Dim ObjAcum As New ClsAcumuladores
|
|
If ObjAcum.EntradasUsadosClientesDetalleRep(CBool(renglon.DataKey("EsDistribuidor")), renglon.DataKey("CveCliente").ToEntero, renglon.DataKey("CvePS").ToEntero, TxtFechaI.Text.ToDate, TxtFechaF.Text.ToDate, CveAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
GvVentas.DataSource = ObjAcum.DtResultados
|
|
End If
|
|
ObjAcum.Dispose()
|
|
GvVentas.DataBind()
|
|
|
|
RegistraScript("$('#ModalVentasAvance').modal();")
|
|
End Sub
|
|
End Class
|