Files
SIG/Ventas/RepEntregasEcommerce.aspx.vb
2023-12-12 11:17:52 -07:00

140 lines
4.4 KiB
VB.net

Imports System.Data
Imports Extensiones
Imports iText.Barcodes.Dmcode
Imports Microsoft.Reporting.WebForms
Partial Class Ventas_RepEntregasEcommerce
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaCombos()
CargaDatos()
End If
End Sub
Private Sub CargaCombos()
txtFechaI.Text = NowADS.AddDays(-3).ToShortDateString
txtFechaF.Text = NowADS.ToShortDateString
End Sub
Private Sub CargaDatos()
Dim FechaI, FechaF As Date
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text.Trim.ToDate Else FechaI = MinFecha
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text.Trim.ToDate Else FechaF = MaxFecha
Dim Obj As New ClsVentas
If Obj.GetEntregasEcommerce(FechaI, FechaF, 1, UsuarioActual.CveEmpresa) Then
GvD.DataSource = Obj.DtResultados
End If
Obj.Dispose()
GvD.DataBind()
UPDatos.Update()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
#Region " I M P R I M I R P D F"
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
Dim EsVisibleColPagoProveedor As Boolean = False
If GvD.Columns(10).Visible Then
EsVisibleColPagoProveedor = True
GvD.Columns(10).Visible = False
End If
GenerarPDFpp("Excel")
End Sub
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPDF.Click
GenerarPDFpp()
End Sub
Protected Sub LnkPDFSubProyecto_Click(sender As Object, e As EventArgs)
GenerarPDFpp(AgrupadoPorSubProyecto:=True)
End Sub
Protected Sub LnkExcelSubProyecto_Click(sender As Object, e As EventArgs)
Dim EsVisibleColPagoProveedor As Boolean = False
If GvD.Columns(10).Visible Then
EsVisibleColPagoProveedor = True
GvD.Columns(10).Visible = False
End If
GenerarPDFpp("Excel", True)
If EsVisibleColPagoProveedor Then
GvD.Columns(10).Visible = True
End If
End Sub
Private Sub GenerarPDFpp(Optional Formato As String = "PDF", Optional AgrupadoPorSubProyecto As Boolean = False)
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
'OBTENEMOS LOS DATOS
Dim DTpp As DataTable = Nothing
If DTpp.Rows.Count > 0 Then
Dim dr As DataRow = DTpp.Rows(0)
Dim params As New List(Of ReportParameter)
Dim Filtros As New StringBuilder
Filtros.Append("<b>Filtros </b>")
Dim ExistenFechas As Boolean = False
If txtFechaI.Text.Trim.Length > 0 Then
Filtros.Append($" Fecha Inicio: {txtFechaI.Text.Trim}")
ExistenFechas = True
End If
If txtFechaF.Text.Trim.Length > 0 Then
Filtros.Append($" Fecha Fin: {txtFechaF.Text.Trim}")
ExistenFechas = True
End If
If ExistenFechas Then
params.Add(New ReportParameter("AgrupadoPor", Filtros.ToString))
End If
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
' params.Add(New ReportParameter("FechaInicio", FI))
' params.Add(New ReportParameter("FechaFin", FF))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToString))
' params.Add(New ReportParameter("AgrupadoPor", $"{Programo} {Proveedor} {Registro} {Responsable} {Clasificacion} {Moneda} {Estatus} {SubProyecto} {FechaIn} {FechaFn}{FVI}{FVF}"))
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
ImprimirPDF("Empresas/Grales/Formatos/RepPagoProveedores.rdlc", DTpp, params, "ReportePagoProveedores", Formato)
Else
Alert("No se tienen registrados movimientos", TipoMensaje.MsgAdvertencia)
End If
End Sub
Private Sub GvD_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvD.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CvePS") = "" Then e.Row.CssClass = "SubTotales"
End If
End Sub
#End Region
End Class