Ruta dinamica de carpeta "Empresas" asignar valor desde el web config
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Ventas_RepPS
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "P R O P I E D A D E S"
|
||||
Imports System.Data
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Ventas_RepPS
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "P R O P I E D A D E S"
|
||||
Private Property DtReporte As DataTable
|
||||
Get
|
||||
Return DirectCast(ViewState("DtReporte"), DataTable)
|
||||
@@ -16,25 +16,25 @@ Partial Class Ventas_RepPS
|
||||
Set(value As DataTable)
|
||||
ViewState("DtReporte") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaDatosIniciales()
|
||||
CargaCombos()
|
||||
If Not IsPostBack Then
|
||||
CargaDatosIniciales()
|
||||
CargaCombos()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaDatosIniciales()
|
||||
txtFechaI.Text = $"01/{Now.Month}/{Now.Year}"
|
||||
txtFechaF.Text = Now.ToString("dd/MM/yyyy")
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCombos()
|
||||
CargaTipoCentroCosto()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
Private Sub CargaDatosIniciales()
|
||||
txtFechaI.Text = $"01/{Now.Month}/{Now.Year}"
|
||||
txtFechaF.Text = Now.ToString("dd/MM/yyyy")
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCombos()
|
||||
CargaTipoCentroCosto()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaTipoCentroCosto()
|
||||
|
||||
If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then
|
||||
@@ -66,23 +66,23 @@ Partial Class Ventas_RepPS
|
||||
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then
|
||||
LblSubProyecto.InnerText = "Sucursal:"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero()
|
||||
Dim Grupo As Integer = DdlGrupo.SelectedValue.ToEntero()
|
||||
Dim CvePS As Integer = -1
|
||||
Dim CveMoneda As Integer = -1
|
||||
Dim TC As Integer = 1
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero()
|
||||
Dim Grupo As Integer = DdlGrupo.SelectedValue.ToEntero()
|
||||
Dim CvePS As Integer = -1
|
||||
Dim CveMoneda As Integer = -1
|
||||
Dim TC As Integer = 1
|
||||
Dim TCEspecifico As Decimal = -1
|
||||
Dim FechaI, FechaF As DateTime
|
||||
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
|
||||
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||
|
||||
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then
|
||||
DtReporte = ObjVentas.DtResultados.Copy()
|
||||
If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then
|
||||
DtReporte = ObjVentas.DtResultados.Copy()
|
||||
GvDatos.DataSource = DtReporte
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
@@ -92,28 +92,28 @@ Partial Class Ventas_RepPS
|
||||
GvDatos.DataBind()
|
||||
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
End Sub
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Select Case e.Row.DBCampo("Orden").ToString.ToEntero()
|
||||
Case 4
|
||||
e.Row.CssClass = "Totales"
|
||||
Case 3
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
Case 2
|
||||
e.Row.CssClass = "SubTotales"
|
||||
Case 1
|
||||
e.Row.CssClass = "SubTotalesB"
|
||||
Case 0
|
||||
e.Row.CssClass = "Texto"
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Select Case e.Row.DBCampo("Orden").ToString.ToEntero()
|
||||
Case 4
|
||||
e.Row.CssClass = "Totales"
|
||||
Case 3
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
Case 2
|
||||
e.Row.CssClass = "SubTotales"
|
||||
Case 1
|
||||
e.Row.CssClass = "SubTotalesB"
|
||||
Case 0
|
||||
e.Row.CssClass = "Texto"
|
||||
End Select
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " IMPRIMIR "
|
||||
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
||||
If GvDatos.Rows.Count > 0 Then
|
||||
@@ -128,10 +128,10 @@ Partial Class Ventas_RepPS
|
||||
Private Sub GenerarPDF()
|
||||
Dim FechaI, FechaF As Date
|
||||
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
|
||||
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||
If DtReporte IsNot Nothing AndAlso DtReporte.Rows.Count > 0 Then
|
||||
Dim SbParametros As New StringBuilder
|
||||
SbParametros.AppendFormat("Sucursal:{0}", DdlSubProyecto.SelectedItem.Text)
|
||||
SbParametros.AppendFormat("Sucursal:{0}", DdlSubProyecto.SelectedItem.Text)
|
||||
SbParametros.AppendFormat(", Orden:{0}", DdlGrupo.SelectedItem.Text)
|
||||
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
@@ -147,20 +147,20 @@ Partial Class Ventas_RepPS
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
params.Add(New ReportParameter("Parametros", SbParametros.ToString()))
|
||||
|
||||
If System.IO.File.Exists($"{Server.MapPath("/")}/Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc") Then
|
||||
ImprimirPDF($"Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS")
|
||||
Else
|
||||
ImprimirPDF($"Empresas/Grales/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS")
|
||||
End If
|
||||
params.Add(New ReportParameter("Parametros", SbParametros.ToString()))
|
||||
|
||||
If System.IO.File.Exists($"{ModExtensiones.DirectorioBaseEmpresas}/Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc") Then
|
||||
ImprimirPDF($"Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS")
|
||||
Else
|
||||
ImprimirPDF($"Empresas/Grales/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS")
|
||||
End If
|
||||
Else
|
||||
Alert("No hay información para mostrar.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user