159 lines
6.6 KiB
VB.net
159 lines
6.6 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Extensiones
|
|
Partial Class RepGastosCC
|
|
Inherits ClsPaginas
|
|
Private Shared missing As Object = System.Reflection.Missing.Value
|
|
|
|
#Region "PROPIEDADES"
|
|
Private Property DtVentas As DataTable
|
|
Get
|
|
Return DirectCast(ViewState("DtVentas"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtVentas") = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
|
|
|
|
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString()
|
|
txtFechaF.Text = NowADS().ToShortDateString
|
|
OrdenaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
#Region " C A R G A - D A T O S "
|
|
Public Sub CargaDatos()
|
|
Dim Obj As New ClsContabilidad
|
|
|
|
If Obj.GetGastosRepCC(txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim().ToDate, UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = Obj.DtResultados
|
|
|
|
End If
|
|
|
|
Obj.Dispose()
|
|
GvDatos.DataBind()
|
|
|
|
UPDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "O R D E N A M I E N T O"
|
|
Private Sub OrdenaDatos()
|
|
'If (GvDatos.Rows.Count > 0) Then
|
|
' GvDatos.UseAccessibleHeader = True
|
|
' GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
|
' RegistraScript("OrdenarGV();")
|
|
'End If
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "G V - D A T O S "
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
' e.Row.FCLiteral("LtlFolio").Text = "<a class=""Texto"" target=""_blank"" href=""/Ventas/RepRemisionesDetalle.aspx?CveVenta=" & e.Row.DBCampo("CveVenta") & """>" & e.Row.FCLiteral("LtlFolio").Text & "</a>"
|
|
|
|
' If e.Row.DBCampo("FechaVencimiento").ToDate < NowADS() Then
|
|
' ' e.Row.Cells(2).CssClass = "danger"
|
|
' e.Row.Cells(2).ForeColor = Drawing.Color.Red
|
|
' End If
|
|
|
|
' e.Row.Cells(5).Text = e.Row.Cells(5).Text + "%"
|
|
|
|
e.Row.Cells(1).Width = 250
|
|
e.Row.Cells(0).Visible = False
|
|
|
|
For Each Cells As TableCell In e.Row.Cells
|
|
Dim Celda As String = Cells.Text
|
|
If IsNumeric(Celda) Then
|
|
|
|
|
|
If Celda.ToDouble = 0 Then
|
|
Cells.Text = ""
|
|
Else
|
|
Dim ce = DirectCast(Cells, System.Web.UI.WebControls.DataControlFieldCell)
|
|
|
|
Cells.Text = Cells.Text.FormatoNumero(2)
|
|
Cells.HorizontalAlign = HorizontalAlign.Right
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
If e.Row.DBCampo("CveCuenta").ToEntero() < 1 Then
|
|
e.Row.CssClass = "Totales"
|
|
End If
|
|
ElseIf e.Row.RowType = DataControlRowType.Header Then
|
|
e.Row.Cells(0).Visible = False
|
|
|
|
End If
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
#Region "PDF"
|
|
'Private Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
|
' If DtVentas IsNot Nothing Then
|
|
' Dim StrFiltro As New StringBuilder
|
|
' If DdlSubProyectos.GetSelectedText <> "" Then StrFiltro.AppendFormat(" <b>Sucursal</b>: {0}", DdlSubProyectos.GetSelectedText)
|
|
' If DdlClientes.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Cliente</b>: {0}", DdlClientes.SelectedText)
|
|
' If DdlContrato.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Contrato</b>: {0}", DdlContrato.SelectedItem.Text)
|
|
|
|
' If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Inicio </b>: {0}", txtFechaI.Text.ToDate.ToShortDateString)
|
|
' If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Fin </b>: {0}", txtFechaF.Text.ToDate.ToShortDateString)
|
|
' If TxtFechaVencimiento.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Vencimiento al</b>: {0}", txtFechaI.Text.ToDate.ToShortDateString)
|
|
|
|
' If DdlVendedor.GetSelectedText <> "" Then StrFiltro.AppendFormat(" <b>Vendedor</b>: {0}", DdlVendedor.GetSelectedText)
|
|
|
|
' Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
|
|
|
' 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)
|
|
|
|
' 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("UsuarioImprimio", UsuarioActual.Nombre))
|
|
' params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString))
|
|
' params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
|
|
' If Imagen.Exists Then
|
|
' params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
|
|
' Else
|
|
' params.Add(New ReportParameter("LogoPath", ""))
|
|
' End If
|
|
' ImprimirPDF("Empresas/Grales/Formatos/RepRemisiones.rdlc", DtVentas, params, String.Format("ReporteRemisiones-{0}", NowADS().ToDateTime.ToShortDateString))
|
|
' Else
|
|
' Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
' End If
|
|
'End Sub
|
|
#End Region
|
|
|
|
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
|
Dim StrFiltro As New StringBuilder
|
|
If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" Fecha Inicio: {0}", txtFechaI.Text)
|
|
If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin: {0}", txtFechaF.Text)
|
|
GvDatos.ExportToExcelG("ReporteGastos" & NowADS().ToShortDateString, "Gastos Acumulados", UsuarioActual, StrFiltro.ToString, 100, 200)
|
|
End Sub
|
|
' Note, it is important to override the form verification in order to successfully call a GridView1.RenderControl method.
|
|
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
|
|
|
|
End Sub
|
|
|
|
End Class
|