157 lines
6.6 KiB
VB.net
157 lines
6.6 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Extensiones
|
|
Partial Class RepRemisiones
|
|
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
|
|
CargaSucursales()
|
|
CargaCliente()
|
|
CargaContrato()
|
|
CargaDatos()
|
|
OrdenaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
#Region " C A R G A - D A T O S "
|
|
Public Sub CargaDatos()
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
Dim FechaI, FechaF, FechaV As String
|
|
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
|
|
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
|
|
FechaV = If(IsDate(TxtFechaVencimiento.Text.Trim()), TxtFechaVencimiento.Text.Trim(), "-1")
|
|
|
|
|
|
If ObjVentas.GetRepCotizacionesSinFacturar(FechaI, FechaF, FechaV, DdlSucursales.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlContrato.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = ObjVentas.DtResultados
|
|
DtVentas = ObjVentas.DtResultados
|
|
GvDatos.DataBind()
|
|
UPDatos.Update()
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
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/RepCotizacionesDetalle.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 + "%"
|
|
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "CARGA COMBOS FILTRO"
|
|
Private Sub CargaCliente()
|
|
'CargaClientes
|
|
DdlClientes.DataSource() = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
|
DdlClientes.DataBind()
|
|
DdlClientes.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
End Sub
|
|
Private Sub CargaSucursales()
|
|
DdlSucursales.DataSource() = GlobalDTSubProyectos(UsuarioActual.CveEmpresa)
|
|
DdlSucursales.DataBind()
|
|
DdlSucursales.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
UPFiltros.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaContrato()
|
|
Dim ObjContratos As New ClsContratos
|
|
|
|
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, DdlClientes.SelectedValue.ToEntero, 10, 1) Then
|
|
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
|
DdlContrato.Items.Clear()
|
|
DdlContrato.DataSource = ObjContratos.DtResultados
|
|
DdlContrato.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
DdlContrato.DataBind()
|
|
End If
|
|
End If
|
|
|
|
ObjContratos.Dispose()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "DDLS SELECTED INDEX CHANGED"
|
|
Private Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientes.SelectedIndexChanged
|
|
CargaContrato()
|
|
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 DdlClientes.SelectedValue <> "-1" Then StrFiltro.AppendFormat("<b>Cliente</b>: {0}", DdlClientes.SelectedItem.Text)
|
|
'If DdlContrato.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Contrato</b>: {0}", DdlContrato.SelectedItem.Text)
|
|
If DdlSucursales.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" <b>Sucursal</b>: {0}", DdlSucursales.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)
|
|
|
|
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))
|
|
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepCotizaciones.rdlc", DtVentas, params, String.Format("RepCotizaciones-{0}", NowADS().ToDateTime.ToShortDateString))
|
|
Else
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
|
End Sub
|
|
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
|
|
GvDatos.ExportToExcel("Reporte de Coizaciones por Facturar" & NowADS().ToShortDateString)
|
|
End Sub
|
|
End Class
|