diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index bd527c324..22e7526ab 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -6,19 +6,19 @@ Imports System.IO Imports System.Data Imports Microsoft.Reporting.WebForms Imports ZXing -Imports Newtonsoft.Json.Linq - +Imports Newtonsoft.Json.Linq + Partial Class AF_AF - Inherits ClsPaginas - - 'Configuración + Inherits ClsPaginas + + 'Configuración #Region "PROPIEDADES" Private Property CveActivoFijo As Integer - Get - - If ViewState("CveActivoFijo") Is Nothing Then - ViewState("CveActivoFijo") = -1 - End If + Get + + If ViewState("CveActivoFijo") Is Nothing Then + ViewState("CveActivoFijo") = -1 + End If Return ViewState("CveActivoFijo").ToString.ToEntero End Get Set(value As Integer) @@ -26,9 +26,9 @@ Partial Class AF_AF End Set End Property Private Property CodigoAF As String - Get - If ViewState("CodigoAF") Is Nothing Then - ViewState("CodigoAF") = "" + Get + If ViewState("CodigoAF") Is Nothing Then + ViewState("CodigoAF") = "" End If Return ViewState("CodigoAF").ToString End Get @@ -112,7 +112,7 @@ Partial Class AF_AF Set(value As Integer) ViewState("AFInvCveAlmacen") = value End Set - End Property + End Property Private Property AFInvCveSeccionAlmacen As Integer Get Return If(ViewState("AFInvCveSeccionAlmacen") Is Nothing, -1, ViewState("AFInvCveSeccionAlmacen").ToString.ToEntero()) @@ -184,11 +184,11 @@ Partial Class AF_AF Set(value As DataTable) ViewState("DTCompras") = value End Set - End Property - - + End Property + + #Region "CLASIFICACIONES" - + Private Property DTAFCaracteristicas As DataTable Get Return CType(ViewState("DTAFCaracteristicas"), DataTable) @@ -205,10 +205,10 @@ Partial Class AF_AF Set(value As Integer) ViewState("CveCaracteristica") = value End Set - End Property + End Property #End Region - - + + #Region "G P S" Public Property CveClienteGPS As Integer Get @@ -248,129 +248,129 @@ Partial Class AF_AF Set(value As DataTable) ViewState("DTDescargas") = value End Set - End Property - + End Property + #End Region - - + + Private Property CveProduccion As Integer - Get - If ViewState("CveProduccion") Is Nothing Then - ViewState("CveProduccion") = -1 - End If - Return ViewState("CveProduccion").ToString.ToEntero + Get + If ViewState("CveProduccion") Is Nothing Then + ViewState("CveProduccion") = -1 + End If + Return ViewState("CveProduccion").ToString.ToEntero End Get Set(value As Integer) ViewState("CveProduccion") = value End Set - End Property - + End Property + Private Property IndexProduccion As Integer - Get - If ViewState("IndexProduccion") Is Nothing Then - ViewState("IndexProduccion") = -1 - End If - Return ViewState("IndexProduccion").ToString.ToEntero + Get + If ViewState("IndexProduccion") Is Nothing Then + ViewState("IndexProduccion") = -1 + End If + Return ViewState("IndexProduccion").ToString.ToEntero End Get Set(value As Integer) ViewState("IndexProduccion") = value End Set - End Property - - + End Property + + Private Property CveMantenimiento As Integer - Get - If ViewState("CveMantenimiento") Is Nothing Then - ViewState("CveMantenimiento") = -1 - End If - Return ViewState("CveMantenimiento").ToString.ToEntero + Get + If ViewState("CveMantenimiento") Is Nothing Then + ViewState("CveMantenimiento") = -1 + End If + Return ViewState("CveMantenimiento").ToString.ToEntero End Get Set(value As Integer) ViewState("CveMantenimiento") = value End Set - End Property - - + End Property + + Private Property IndexMantenimiento As Integer - Get - If ViewState("IndexMantenimiento") Is Nothing Then - ViewState("IndexMantenimiento") = -1 - End If - Return ViewState("IndexMantenimiento").ToString.ToEntero + Get + If ViewState("IndexMantenimiento") Is Nothing Then + ViewState("IndexMantenimiento") = -1 + End If + Return ViewState("IndexMantenimiento").ToString.ToEntero End Get Set(value As Integer) ViewState("IndexMantenimiento") = value End Set - End Property - + End Property + Private Property CvePlagaEnfermedad As Integer - Get - If ViewState("CvePlagaEnfermedad") Is Nothing Then - ViewState("CvePlagaEnfermedad") = -1 - End If - Return ViewState("CvePlagaEnfermedad").ToString.ToEntero + Get + If ViewState("CvePlagaEnfermedad") Is Nothing Then + ViewState("CvePlagaEnfermedad") = -1 + End If + Return ViewState("CvePlagaEnfermedad").ToString.ToEntero End Get Set(value As Integer) ViewState("CvePlagaEnfermedad") = value End Set - End Property - - + End Property + + Private Property IndexPlagaEnfermedad As Integer - Get - If ViewState("IndexPlagaEnfermedad") Is Nothing Then - ViewState("IndexPlagaEnfermedad") = -1 - End If - Return ViewState("IndexPlagaEnfermedad").ToString.ToEntero + Get + If ViewState("IndexPlagaEnfermedad") Is Nothing Then + ViewState("IndexPlagaEnfermedad") = -1 + End If + Return ViewState("IndexPlagaEnfermedad").ToString.ToEntero End Get Set(value As Integer) ViewState("IndexPlagaEnfermedad") = value End Set - End Property - + End Property + #End Region - - - + + + Private Property DT_Produccion As DataTable - Get - If ViewState("DT_Produccion") Is Nothing Then - ViewState("DT_Produccion") = CreaDTProduccion() - End If - Return DirectCast(ViewState("DT_Produccion"), DataTable) + Get + If ViewState("DT_Produccion") Is Nothing Then + ViewState("DT_Produccion") = CreaDTProduccion() + End If + Return DirectCast(ViewState("DT_Produccion"), DataTable) End Get Set(value As DataTable) ViewState("DT_Produccion") = value End Set - End Property - - + End Property + + Private Property DT_PlgaEfermedad As DataTable - Get - If ViewState("DT_PlgaEfermedad") Is Nothing Then - ViewState("DT_PlgaEfermedad") = CreaDTPlagaEngermedad() - End If - Return DirectCast(ViewState("DT_PlgaEfermedad"), DataTable) + Get + If ViewState("DT_PlgaEfermedad") Is Nothing Then + ViewState("DT_PlgaEfermedad") = CreaDTPlagaEngermedad() + End If + Return DirectCast(ViewState("DT_PlgaEfermedad"), DataTable) End Get Set(value As DataTable) ViewState("DT_PlgaEfermedad") = value End Set - End Property - - + End Property + + Private Property DT_Mantenimiento As DataTable - Get - If ViewState("DT_Mantenimiento") Is Nothing Then - ViewState("DT_Mantenimiento") = CreaDTMantenimiento() - End If - Return DirectCast(ViewState("DT_Mantenimiento"), DataTable) + Get + If ViewState("DT_Mantenimiento") Is Nothing Then + ViewState("DT_Mantenimiento") = CreaDTMantenimiento() + End If + Return DirectCast(ViewState("DT_Mantenimiento"), DataTable) End Get Set(value As DataTable) ViewState("DT_Mantenimiento") = value End Set - End Property - - + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -386,13 +386,13 @@ Partial Class AF_AF ViewState("CveActivoFijo") = Request("CveActivoFijo") CargaDatos() CargaEventos() - CargaActividades() - CargaProduccion() - CargaMantenimento() - CargaPlagaEnfermedad() - ModalidadesPaginaAF() - - 'Configuración de Modalidad Update + CargaActividades() + CargaProduccion() + CargaMantenimento() + CargaPlagaEnfermedad() + ModalidadesPaginaAF() + + 'Configuración de Modalidad Update BtnGuardar.Text = "Guardar Cambios" LtlTitulo.Text = "Consulta del Activo Fijo:" @@ -400,10 +400,10 @@ Partial Class AF_AF HlEvento.Visible = True HlEvento.NavigateUrl = String.Format("/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveActivoFijo=" & CveActivoFijo & "&TB_iframe=true&height=370&width=600;") Else - ViewState("CveActivoFijo") = -1 - - - 'Configuración de Modalidad Insert + ViewState("CveActivoFijo") = -1 + + + 'Configuración de Modalidad Insert ImgAddObs.Visible = False LblFechaCaptura.Text = Now.ToShortDateString() LblUsuarioCapturo.Text = UsuarioActual.Usuario @@ -422,68 +422,68 @@ Partial Class AF_AF - If Request("Op") IsNot Nothing Then - ModalidadesPaginaAFInicial(Request("Op").ToString) - End If - - - + If Request("Op") IsNot Nothing Then + ModalidadesPaginaAFInicial(Request("Op").ToString) + End If + + + End If End Sub - Private Sub cargaOrdenesdeservicio() - Dim dt As New DataTable() - dt.Columns.Add("Folio", GetType(String)) - dt.Columns.Add("Fecha", GetType(Date)) - dt.Columns.Add("Obra", GetType(String)) - dt.Columns.Add("TipodeServicio", GetType(String)) - dt.Columns.Add("Servicio", GetType(String)) - dt.Columns.Add("Estatus", GetType(String)) - dt.Columns.Add("Duracion", GetType(String)) - dt.Columns.Add("Atendio", GetType(String)) - - Dim dr As DataRow = dt.NewRow() - dr("Folio") = "101" - dr("Fecha") = "2019/08/23" - dr("Obra") = "Ganaderos" - dr("TipodeServicio") = "Preventivo" - dr("Servicio") = "100 Hrs" - dr("Estatus") = "Terminada" - dr("Duracion") = "5 Hrs" - dr("Atendio") = "Juan perez" - dt.Rows.Add(dr) - dr = dt.NewRow() - dr("Folio") = "190" - dr("Fecha") = "2019/09/30" - dr("Obra") = "Ganaderos" - dr("TipodeServicio") = "Preventivo" - dr("Servicio") = "200 Hrs" - dr("Estatus") = "Terminada" - dr("Duracion") = "5 hrs" - dr("Atendio") = "Ernesto Lopez" - dt.Rows.Add(dr) - dr = dt.NewRow() - dr("Folio") = "501" - dr("Fecha") = "2019/11/30" - dr("Obra") = "Vildósola" - dr("TipodeServicio") = "Preventivo" - dr("Servicio") = "400 Hrs" - dr("Estatus") = "Terminada" - dr("Duracion") = "8 hrs" - dr("Atendio") = "Juan perez" - dt.Rows.Add(dr) - dr = dt.NewRow() - dr("Folio") = "505" - dr("Fecha") = "2019/12/14" - dr("Obra") = "Vildósola" - dr("TipodeServicio") = "Correctivo" - dr("Servicio") = "Rep. Mayor motor" - dr("Estatus") = "En proceso" - dr("Duracion") = "ND" - dr("Atendio") = "Juan perez" - dt.Rows.Add(dr) - - GVOrdenesdeServicio.DataSource = dt - GVOrdenesdeServicio.DataBind() + Private Sub cargaOrdenesdeservicio() + Dim dt As New DataTable() + dt.Columns.Add("Folio", GetType(String)) + dt.Columns.Add("Fecha", GetType(Date)) + dt.Columns.Add("Obra", GetType(String)) + dt.Columns.Add("TipodeServicio", GetType(String)) + dt.Columns.Add("Servicio", GetType(String)) + dt.Columns.Add("Estatus", GetType(String)) + dt.Columns.Add("Duracion", GetType(String)) + dt.Columns.Add("Atendio", GetType(String)) + + Dim dr As DataRow = dt.NewRow() + dr("Folio") = "101" + dr("Fecha") = "2019/08/23" + dr("Obra") = "Ganaderos" + dr("TipodeServicio") = "Preventivo" + dr("Servicio") = "100 Hrs" + dr("Estatus") = "Terminada" + dr("Duracion") = "5 Hrs" + dr("Atendio") = "Juan perez" + dt.Rows.Add(dr) + dr = dt.NewRow() + dr("Folio") = "190" + dr("Fecha") = "2019/09/30" + dr("Obra") = "Ganaderos" + dr("TipodeServicio") = "Preventivo" + dr("Servicio") = "200 Hrs" + dr("Estatus") = "Terminada" + dr("Duracion") = "5 hrs" + dr("Atendio") = "Ernesto Lopez" + dt.Rows.Add(dr) + dr = dt.NewRow() + dr("Folio") = "501" + dr("Fecha") = "2019/11/30" + dr("Obra") = "Vildósola" + dr("TipodeServicio") = "Preventivo" + dr("Servicio") = "400 Hrs" + dr("Estatus") = "Terminada" + dr("Duracion") = "8 hrs" + dr("Atendio") = "Juan perez" + dt.Rows.Add(dr) + dr = dt.NewRow() + dr("Folio") = "505" + dr("Fecha") = "2019/12/14" + dr("Obra") = "Vildósola" + dr("TipodeServicio") = "Correctivo" + dr("Servicio") = "Rep. Mayor motor" + dr("Estatus") = "En proceso" + dr("Duracion") = "ND" + dr("Atendio") = "Juan perez" + dt.Rows.Add(dr) + + GVOrdenesdeServicio.DataSource = dt + GVOrdenesdeServicio.DataBind() End Sub Private Sub CargaFechaGPS() TxtFechaIH.Text = $"01/{DateTime.Now.ToString("MM")}/{DateTime.Now.Year} 00:00" @@ -511,147 +511,137 @@ Partial Class AF_AF AFInvSerie = "" CveEmpresaActual = UsuarioActual.CveEmpresa - End Sub - - - - Private Sub ModalidadesPaginaAFInicial(Optional Op As String = "") - - TabProduccion.Visible = False - TabPlagaEnfermedad.Visible = False - TabServyMant.Visible = False - - LblFechaCompra.Text = "Fecha de Compra:" - LblFechaBaja.Text = "Fecha de Baja:" - - - If Op.Length > 0 Then - - 'Arbol Frutal - If Op = "AR" Then - - Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'ARBOLES FRUTALES'").ToEntero - DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) - DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'ARBOLES FRUTALES'").ToEntero - DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) - DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - - LblFechaCompra.Text = "Fecha de Nacimiento" - LblFechaBaja.Text = "Fecha de Muerte" - TabProduccion.Visible = True - - End If - - 'Arbol Apicola - If Op = "AP" Then - - - Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'APICOLAS'").ToEntero - DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) - DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'APICOLAS'").ToEntero - DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) - DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - TabPlagaEnfermedad.Visible = True - - End If - - 'Pozos - If Op = "PO" Then - - - Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'POZOS'").ToEntero - DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) - DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'POZOS'").ToEntero - DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) - DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - TabServyMant.Visible = True - End If - - 'Inmuebles - If Op = "IN" Then - - Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'INMUEBLES'").ToEntero - DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) - DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'INMUEBLES'").ToEntero - DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) - DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) - - End If - - UpDatos.Update() - - End If - - End Sub - - - Private Sub ModalidadesPaginaAF() - - TabProduccion.Visible = False - TabPlagaEnfermedad.Visible = False - TabServyMant.Visible = False - - LblFechaCompra.Text = "Fecha de Compra:" - LblFechaBaja.Text = "Fecha de Baja:" - - - If DdlTipoActivoFijo.SelectedItem.Text = "ARBOLES FRUTALES" And DdlSubTipoActivoFijo.SelectedItem.Text = "ARBOLES FRUTALES" Then - LblFechaCompra.Text = "Fecha de Nacimiento" - LblFechaBaja.Text = "Fecha de Muerte" - TabProduccion.Visible = True - End If - - 'Arbol Apicola - If DdlTipoActivoFijo.SelectedItem.Text = "APICOLAS" And DdlSubTipoActivoFijo.SelectedItem.Text = "APICOLAS" Then - TabPlagaEnfermedad.Visible = True - End If - - 'Pozos - If DdlTipoActivoFijo.SelectedItem.Text = "POZOS" And DdlSubTipoActivoFijo.SelectedItem.Text = "POZOS" Then - TabServyMant.Visible = True - End If - - 'Inmuebles - If DdlTipoActivoFijo.SelectedItem.Text = "INMUEBLES" And DdlSubTipoActivoFijo.SelectedItem.Text = "INMUEBLES" Then - - End If - - - - - - UpDatos.Update() - - End Sub - + End Sub + + + + Private Sub ModalidadesPaginaAFInicial(Optional Op As String = "") + + TabProduccion.Visible = False + TabPlagaEnfermedad.Visible = False + TabServyMant.Visible = False + + LblFechaCompra.Text = "Fecha de Compra:" + LblFechaBaja.Text = "Fecha de Baja:" + + + If Op.Length > 0 Then + + 'Arbol Frutal + If Op = "AR" Then + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'ARBOLES FRUTALES'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'ARBOLES FRUTALES'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + + LblFechaCompra.Text = "Fecha de Nacimiento" + LblFechaBaja.Text = "Fecha de Muerte" + TabProduccion.Visible = True + + End If + + 'Arbol Apicola + If Op = "AP" Then + + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'APICOLAS'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'APICOLAS'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + TabPlagaEnfermedad.Visible = True + + End If + + 'Pozos + If Op = "PO" Then + + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'POZOS'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'POZOS'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + TabServyMant.Visible = True + End If + + 'Inmuebles + If Op = "IN" Then + + Dim CveTipoActivoFijoTmp As Integer = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo").FiltroPrimeroValor("CveTipoActivoFijo", $"TipoActivoFijo = 'INMUEBLES'").ToEntero + DdlTipoActivoFijo.SelectedValueExist(CveTipoActivoFijoTmp) + DdlTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + Dim CveSubTipoActivoFijoTemp As Integer = GlobalDTSubTipoActivoFijo(CveEmpresaActual).FiltraParametros(String.Format(" CveTipoActivoFijo = {0}", DdlTipoActivoFijo.SelectedValue), "SubTipoActivoFijo").FiltroPrimeroValor("CveSubTipoActivoFijo", $"SubTipoActivoFijo = 'INMUEBLES'").ToEntero + DdlSubTipoActivoFijo.SelectedValueExist(CveSubTipoActivoFijoTemp) + DdlSubTipoActivoFijo_SelectedIndexChanged(Nothing, Nothing) + + End If + + UpDatos.Update() + + End If + + End Sub + + + Private Sub ModalidadesPaginaAF() + + TabProduccion.Visible = False + TabPlagaEnfermedad.Visible = False + TabServyMant.Visible = False + + LblFechaCompra.Text = "Fecha de Compra:" + LblFechaBaja.Text = "Fecha de Baja:" + + + If DdlTipoActivoFijo.SelectedItem.Text = "ARBOLES FRUTALES" And DdlSubTipoActivoFijo.SelectedItem.Text = "ARBOLES FRUTALES" Then + LblFechaCompra.Text = "Fecha de Nacimiento" + LblFechaBaja.Text = "Fecha de Muerte" + TabProduccion.Visible = True + End If + + 'Arbol Apicola + If DdlTipoActivoFijo.SelectedItem.Text = "APICOLAS" And DdlSubTipoActivoFijo.SelectedItem.Text = "APICOLAS" Then + TabPlagaEnfermedad.Visible = True + End If + + 'Pozos + If DdlTipoActivoFijo.SelectedItem.Text = "POZOS" And DdlSubTipoActivoFijo.SelectedItem.Text = "POZOS" Then + TabServyMant.Visible = True + End If + + 'Inmuebles + If DdlTipoActivoFijo.SelectedItem.Text = "INMUEBLES" And DdlSubTipoActivoFijo.SelectedItem.Text = "INMUEBLES" Then + + End If + + + + + + UpDatos.Update() + + End Sub + #Region " CARGA COMBOS " Private Sub CargaCombos() CargaTipoActivoFijo() CargaResponsable() CargaEstatusActivoFijo() CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, lblProyecto, LblSubProyecto) - - 'If UsuarioActual.CveEmpresa.Contiene(172, 173) Then - ' lblProyecto.Text = "Proyecto:" - ' lblProyecto.Visible = True - ' DdlProyecto.Visible = True - - ' LblSubProyecto.Text = "SubProyecto:" - 'End If - RowProyecto.Visible = DdlProyecto.Visible - 'CargaCliente() CargaGrupos() CargaMarcas() @@ -754,79 +744,79 @@ Partial Class AF_AF ' DdlClientes.DataBind() 'End Sub - Private Sub CargaCultivos() - DdlModalCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue}") - DdlModalCultivosCuadro.DataBind() - DdlModalCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + Private Sub CargaCultivos() + DdlModalCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue}") + DdlModalCultivosCuadro.DataBind() + DdlModalCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) End Sub - Private Function CreaDTProduccion() As DataTable - 'CveProduccion, CveActivoFijo, CveCultivoCuadroDetalle, Cantidad, Fecha, CveUsuario, FechaIng, Codigo, Descripcion, Usuario, Cuadro - - Dim DTProduccion As New DataTable - - - DTProduccion.Columns.Add("CveProduccion", GetType(Integer)) - DTProduccion.Columns.Add("CveActivoFijo", GetType(Integer)) - DTProduccion.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer)) - DTProduccion.Columns.Add("Cantidad", GetType(Decimal)) - DTProduccion.Columns.Add("Fecha", GetType(Date)) - DTProduccion.Columns.Add("Cuadro", GetType(String)) - - DTProduccion.Columns.Add("CveUsuario", GetType(Integer)) - DTProduccion.Columns.Add("FechaIng", GetType(Date)) - DTProduccion.Columns.Add("Codigo", GetType(String)) - DTProduccion.Columns.Add("Descripcion", GetType(String)) - DTProduccion.Columns.Add("Usuario", GetType(String)) - - - Return DTProduccion - + Private Function CreaDTProduccion() As DataTable + 'CveProduccion, CveActivoFijo, CveCultivoCuadroDetalle, Cantidad, Fecha, CveUsuario, FechaIng, Codigo, Descripcion, Usuario, Cuadro + + Dim DTProduccion As New DataTable + + + DTProduccion.Columns.Add("CveProduccion", GetType(Integer)) + DTProduccion.Columns.Add("CveActivoFijo", GetType(Integer)) + DTProduccion.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer)) + DTProduccion.Columns.Add("Cantidad", GetType(Decimal)) + DTProduccion.Columns.Add("Fecha", GetType(Date)) + DTProduccion.Columns.Add("Cuadro", GetType(String)) + + DTProduccion.Columns.Add("CveUsuario", GetType(Integer)) + DTProduccion.Columns.Add("FechaIng", GetType(Date)) + DTProduccion.Columns.Add("Codigo", GetType(String)) + DTProduccion.Columns.Add("Descripcion", GetType(String)) + DTProduccion.Columns.Add("Usuario", GetType(String)) + + + Return DTProduccion + End Function - Private Function CreaDTPlagaEngermedad() As DataTable - 'CvePlagaEnfermedad,CveActivoFijo,Observaciones,Fecha,CveUsuario,FechaIng - Dim DTPlgaEfermedad As New DataTable - - DTPlgaEfermedad.Columns.Add("CvePlagaEnfermedad", GetType(Integer)) - DTPlgaEfermedad.Columns.Add("CveActivoFijo", GetType(Integer)) - - DTPlgaEfermedad.Columns.Add("Observaciones", GetType(String)) - DTPlgaEfermedad.Columns.Add("Fecha", GetType(Date)) - - DTPlgaEfermedad.Columns.Add("CveUsuario", GetType(Integer)) - DTPlgaEfermedad.Columns.Add("FechaIng", GetType(Date)) - - DTPlgaEfermedad.Columns.Add("Usuario", GetType(String)) - - - - Return DTPlgaEfermedad - + Private Function CreaDTPlagaEngermedad() As DataTable + 'CvePlagaEnfermedad,CveActivoFijo,Observaciones,Fecha,CveUsuario,FechaIng + Dim DTPlgaEfermedad As New DataTable + + DTPlgaEfermedad.Columns.Add("CvePlagaEnfermedad", GetType(Integer)) + DTPlgaEfermedad.Columns.Add("CveActivoFijo", GetType(Integer)) + + DTPlgaEfermedad.Columns.Add("Observaciones", GetType(String)) + DTPlgaEfermedad.Columns.Add("Fecha", GetType(Date)) + + DTPlgaEfermedad.Columns.Add("CveUsuario", GetType(Integer)) + DTPlgaEfermedad.Columns.Add("FechaIng", GetType(Date)) + + DTPlgaEfermedad.Columns.Add("Usuario", GetType(String)) + + + + Return DTPlgaEfermedad + End Function - Private Function CreaDTMantenimiento() As DataTable - 'CveMantenimiento, CveActivoFijo, Mantenimiento, Observaciones, Fecha, FechaIng, CveUsuario, Codigo, Descripcion,Usuario,Archivo - Dim DTMantenimiento As New DataTable - - DTMantenimiento.Columns.Add("CveMantenimiento", GetType(Integer)) - DTMantenimiento.Columns.Add("CveActivoFijo", GetType(Integer)) - - DTMantenimiento.Columns.Add("Mantenimiento", GetType(String)) - DTMantenimiento.Columns.Add("Observaciones", GetType(String)) - DTMantenimiento.Columns.Add("Fecha", GetType(Date)) - DTMantenimiento.Columns.Add("FechaIng", GetType(Date)) - - DTMantenimiento.Columns.Add("CveUsuario", GetType(Integer)) - DTMantenimiento.Columns.Add("Codigo", GetType(String)) - DTMantenimiento.Columns.Add("Descripcion", GetType(String)) - DTMantenimiento.Columns.Add("Usuario", GetType(String)) - DTMantenimiento.Columns.Add("Archivo", GetType(String)) - - - Return DTMantenimiento - + Private Function CreaDTMantenimiento() As DataTable + 'CveMantenimiento, CveActivoFijo, Mantenimiento, Observaciones, Fecha, FechaIng, CveUsuario, Codigo, Descripcion,Usuario,Archivo + Dim DTMantenimiento As New DataTable + + DTMantenimiento.Columns.Add("CveMantenimiento", GetType(Integer)) + DTMantenimiento.Columns.Add("CveActivoFijo", GetType(Integer)) + + DTMantenimiento.Columns.Add("Mantenimiento", GetType(String)) + DTMantenimiento.Columns.Add("Observaciones", GetType(String)) + DTMantenimiento.Columns.Add("Fecha", GetType(Date)) + DTMantenimiento.Columns.Add("FechaIng", GetType(Date)) + + DTMantenimiento.Columns.Add("CveUsuario", GetType(Integer)) + DTMantenimiento.Columns.Add("Codigo", GetType(String)) + DTMantenimiento.Columns.Add("Descripcion", GetType(String)) + DTMantenimiento.Columns.Add("Usuario", GetType(String)) + DTMantenimiento.Columns.Add("Archivo", GetType(String)) + + + Return DTMantenimiento + End Function @@ -884,9 +874,7 @@ Partial Class AF_AF End If ObjFolios.Dispose() - If CveActivoFijo <= 0 Then - CargaSubTipoActivoFijo() - End If + CargaSubTipoActivoFijo() UpDatos.Update() End Sub @@ -900,7 +888,7 @@ Partial Class AF_AF DdlAFInvAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) DdlAFInvAlmacen.SelectedValue = "-1" DdlAFInvAlmacen.DataBind() - DdlAFInvAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) + DdlAFInvAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) DdlAFInvPS.setEsWebService(True) 'DdlAFInvPS.DataSource = GlobalDTPS(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2", "PSCodigo") @@ -919,15 +907,16 @@ Partial Class AF_AF DdlModelos.DataSource = GlobalDTModeloActivoFijo(UsuarioActual.CveEmpresa, CveMarca) DdlModelos.DataBind() DdlModelos.Items.Insert(0, New ListItem("-", "-1")) - End Sub - - Private Sub CargaProduccionCuadros() - DdlModalCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue}") - DdlModalCultivosCuadro.DataBind() - DdlModalCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) - End Sub - + End Sub + + Private Sub CargaProduccionCuadros() + DdlModalCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue}") + DdlModalCultivosCuadro.DataBind() + DdlModalCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + End Sub + #End Region + Private Sub CargaDatos() Dim ObjActivoFijo As New ClsAF() @@ -943,10 +932,10 @@ Partial Class AF_AF TxtDescripcion.Text = ObjActivoFijo.Descripcion TxtCodigo.Text = ObjActivoFijo.Codigo TxtValorCompra.Text = ObjActivoFijo.ValorCompra.ToString.FormatoNumero - TxtFechaCompra.Text = ObjActivoFijo.FechaCompra.ToShortDateString - - - + TxtFechaCompra.Text = ObjActivoFijo.FechaCompra.ToShortDateString + + + TxtFechaBaja.Text = If(ObjActivoFijo.FechaBaja = New Date(1900, 1, 1), "", ObjActivoFijo.FechaBaja.ToString("dd/MM/yyyy")) @@ -1024,8 +1013,8 @@ Partial Class AF_AF CargaPlacas() CargaLicencias() - CargaSeguros() - + CargaSeguros() + CargaFallas() CargaAccidentes() @@ -1035,13 +1024,13 @@ Partial Class AF_AF DdlEstadoActivoFijo.SelectedValue = ObjActivoFijo.DtResultados.Rows(0)("CveEstadoActivoFijo").ToString DdlResponsable.SelectedValue = ObjActivoFijo.DtResultados.Rows(0)("CvePersonaResponsable").ToString - 'DdlProyecto.SelectedValue = ObjActivoFijo.CveProyecto.ToString + DdlProyecto.SelectedValue = ObjActivoFijo.CveProyecto.ToString CargaSubProyecto() - DdlSubProyecto.SelectedValue = ObjActivoFijo.DtResultados.Rows(0)("CveSubProyecto").ToString - Ddlclientes.SelectedValue = ObjActivoFijo.CveCliente.ToString - If ObjActivoFijo.CveCliente > 0 Then - Ddlclientes.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=ObjActivoFijo.CveCliente).FiltroPrimeroValor("NombreComercial") - End If + DdlSubProyecto.SelectedValue = ObjActivoFijo.DtResultados.Rows(0)("CveSubProyecto").ToString + Ddlclientes.SelectedValue = ObjActivoFijo.CveCliente.ToString + If ObjActivoFijo.CveCliente > 0 Then + Ddlclientes.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=ObjActivoFijo.CveCliente).FiltroPrimeroValor("NombreComercial") + End If DdlMarcas.SelectedValueExist(ObjActivoFijo.CveMarcaActivoFijo) CargaModelos(DdlMarcas.SelectedValue.ToEntero) DdlModelos.SelectedValueExist(ObjActivoFijo.CveModeloActivoFijo) @@ -1070,8 +1059,8 @@ Partial Class AF_AF End If End If ObjActivoFijo.Dispose() - End Sub - + End Sub + #Region "P L A C A S" Public Sub CargaPlacas() Dim ObjAF As New ClsAF() @@ -1184,9 +1173,9 @@ Partial Class AF_AF End If End If End If - End Sub + End Sub #End Region - + #Region "L I C E N C I A S" Public Sub CargaLicencias() Dim ObjAF As New ClsAF() @@ -1313,7 +1302,7 @@ Partial Class AF_AF extencion = array(array.Length - 1) End If - If Adjunto.Trim.Length > 0 Then + If Adjunto.Trim.Length > 0 Then Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/AF/Polizas/" & Adjunto & "." & extencion Dim linkDescargaArchivo = UsuarioActual.Empresa.Ruta & "AF/Polizas/" & Adjunto & "." & extencion @@ -1327,9 +1316,9 @@ Partial Class AF_AF End If End If End If - End Sub + End Sub #End Region - + #Region "S E G U R O S" Public Sub CargaSeguros() Dim ObjAF As New ClsAF() @@ -1426,30 +1415,30 @@ Partial Class AF_AF CargaSeguros() ObjAF.Dispose() UpDatos.Update() - End Sub - - + End Sub + + #End Region - + #Region "S E R V I C I O S - M A N T E M I E N T O" - 'Public Sub CargaServicios() - ' Dim TmpServicios As New DataTable - ' TmpServicios.Columns.Add("CveProveedor", GetType(Integer)) - ' TmpServicios.Columns.Add("CveCompra", GetType(Integer)) - ' TmpServicios.Columns.Add("Tipo", GetType(String)) - ' TmpServicios.Columns.Add("Fecha", GetType(Date)) - ' TmpServicios.Columns.Add("Proveedor", GetType(String)) - ' TmpServicios.Columns.Add("Factura", GetType(String)) - ' TmpServicios.Columns.Add("OdHorometro", GetType(Double)) - ' TmpServicios.Columns.Add("Observaciones", GetType(String)) - - - - ' GvServiciosMant.DataSource = TmpServicios - ' GvServiciosMant.DataBind() - 'End Sub + 'Public Sub CargaServicios() + ' Dim TmpServicios As New DataTable + ' TmpServicios.Columns.Add("CveProveedor", GetType(Integer)) + ' TmpServicios.Columns.Add("CveCompra", GetType(Integer)) + ' TmpServicios.Columns.Add("Tipo", GetType(String)) + ' TmpServicios.Columns.Add("Fecha", GetType(Date)) + ' TmpServicios.Columns.Add("Proveedor", GetType(String)) + ' TmpServicios.Columns.Add("Factura", GetType(String)) + ' TmpServicios.Columns.Add("OdHorometro", GetType(Double)) + ' TmpServicios.Columns.Add("Observaciones", GetType(String)) + + + + ' GvServiciosMant.DataSource = TmpServicios + ' GvServiciosMant.DataBind() + 'End Sub #End Region - + #Region "F A L L A S" Public Sub CargaTipoFallas() Dim ObjAF As New ClsAF() @@ -1657,9 +1646,9 @@ Partial Class AF_AF OnError("Ocurrió error al mandar MAIL", ex) End Try - End Sub + End Sub #End Region - + #Region "A C C I D E N T E S " Public Sub CargaAccidentes() Dim ObjAF As New ClsAF() @@ -1843,9 +1832,9 @@ Partial Class AF_AF OnError("Ocurrió error al mandar MAIL", ex) End Try - End Sub + End Sub #End Region - + #Region "A C T I V I D A D E S " Private Sub CargaDdlActividades() DdlActividad.DataSource = GlobalDTMFActividad(UsuarioActual.CveEmpresa, 1) @@ -1979,10 +1968,10 @@ Partial Class AF_AF e.Row.Cells(5).Text = "Horómetro Final" End If End If - End Sub - + End Sub + #End Region - + #Region "P R O G R A M A C I Ó N - D E - E V E N T O S" Private Sub LnkAddEvento_Click(sender As Object, e As EventArgs) Handles LnkAddEvento.Click TxtAsuntoEvento.Text = "" @@ -2036,81 +2025,81 @@ Partial Class AF_AF End If ObjEventos.Dispose() - End Sub + End Sub #End Region - + #Region " R E S G U A R D O S" - - '#Region "Ordenamiento" - ' Protected Sub LbNombre_Click(sender As Object, e As System.EventArgs) Handles LbNombre.Click, ImgNombre.Click - ' If ViewState("ONombre").ToString() = "Nombre DESC" Then - ' ViewState("ONombre") = "Nombre ASC" - ' ImgNombre.ImageUrl = "/Imagenes/FlechasArriba.gif" - ' Else - ' ViewState("ONombre") = "Nombre DESC" - ' ImgNombre.ImageUrl = "/Imagenes/FlechasAbajo.gif" - ' End If - ' ViewState("Orden") = ViewState("ONombre") - ' CargaGrid(ViewState("Orden").ToString()) - ' End Sub - ' Protected Sub LbFechaInicio_Click(sender As Object, e As System.EventArgs) Handles LbFechaInicio.Click, ImgFechaInicio.Click - ' If ViewState("OFechaInicio").ToString() = "FechaInicio DESC" Then - ' ViewState("OFechaInicio") = "FechaInicio ASC" - ' ImgFechaInicio.ImageUrl = "/Imagenes/FlechasArriba.gif" - ' Else - ' ViewState("OFechaInicio") = "FechaInicio DESC" - ' ImgFechaInicio.ImageUrl = "/Imagenes/FlechasAbajo.gif" - ' End If - ' ViewState("Orden") = ViewState("OFechaInicio") - ' CargaGrid(ViewState("Orden").ToString()) - ' End Sub - ' Protected Sub LbFechaFin_Click(sender As Object, e As System.EventArgs) Handles LbFechaFin.Click, ImgFechaFin.Click - ' If ViewState("OFechaFin").ToString() = "FechaFin DESC" Then - ' ViewState("OFechaFin") = "FechaFin ASC" - ' ImgFechaFin.ImageUrl = "/Imagenes/FlechasArriba.gif" - ' Else - ' ViewState("OFechaFin") = "FechaFin DESC" - ' ImgFechaFin.ImageUrl = "/Imagenes/FlechasAbajo.gif" - ' End If - ' ViewState("Orden") = ViewState("OFechaFin") - ' CargaGrid(ViewState("Orden").ToString()) - ' End Sub - ' Protected Sub LbObservaciones_Click(sender As Object, e As System.EventArgs) Handles LbObservaciones.Click, ImgObservaciones.Click - ' If ViewState("OObservaciones").ToString() = "Observaciones DESC" Then - ' ViewState("OObservaciones") = "Observaciones ASC" - ' ImgObservaciones.ImageUrl = "/Imagenes/FlechasArriba.gif" - ' Else - ' ViewState("OObservaciones") = "Observaciones DESC" - ' ImgObservaciones.ImageUrl = "/Imagenes/FlechasAbajo.gif" - ' End If - ' ViewState("Orden") = ViewState("OObservaciones") - ' CargaGrid(ViewState("Orden").ToString()) - ' End Sub - ' Protected Sub LbURL_Click(sender As Object, e As System.EventArgs) Handles LbURL.Click, ImgURL.Click - ' If ViewState("OURL").ToString() = "URL DESC" Then - ' ViewState("OURL") = "URL ASC" - ' ImgURL.ImageUrl = "/Imagenes/FlechasArriba.gif" - ' Else - ' ViewState("OURL") = "URL DESC" - ' ImgURL.ImageUrl = "/Imagenes/FlechasAbajo.gif" - ' End If - ' ViewState("Orden") = ViewState("OURL") - ' CargaGrid(ViewState("Orden").ToString()) - ' End Sub - ' Protected Sub LbUsuario_Click(sender As Object, e As System.EventArgs) Handles LbUsuario.Click, ImgUsuario.Click - ' If ViewState("OUsuario").ToString() = "Usuario DESC" Then - ' ViewState("OUsuario") = "Usuario ASC" - ' ImgUsuario.ImageUrl = "/Imagenes/FlechasArriba.gif" - ' Else - ' ViewState("OUsuario") = "Usuario DESC" - ' ImgUsuario.ImageUrl = "/Imagenes/FlechasAbajo.gif" - ' End If - ' ViewState("Orden") = ViewState("OUsuario") - ' CargaGrid(ViewState("Orden").ToString()) - ' End Sub - - '#End Region - + + '#Region "Ordenamiento" + ' Protected Sub LbNombre_Click(sender As Object, e As System.EventArgs) Handles LbNombre.Click, ImgNombre.Click + ' If ViewState("ONombre").ToString() = "Nombre DESC" Then + ' ViewState("ONombre") = "Nombre ASC" + ' ImgNombre.ImageUrl = "/Imagenes/FlechasArriba.gif" + ' Else + ' ViewState("ONombre") = "Nombre DESC" + ' ImgNombre.ImageUrl = "/Imagenes/FlechasAbajo.gif" + ' End If + ' ViewState("Orden") = ViewState("ONombre") + ' CargaGrid(ViewState("Orden").ToString()) + ' End Sub + ' Protected Sub LbFechaInicio_Click(sender As Object, e As System.EventArgs) Handles LbFechaInicio.Click, ImgFechaInicio.Click + ' If ViewState("OFechaInicio").ToString() = "FechaInicio DESC" Then + ' ViewState("OFechaInicio") = "FechaInicio ASC" + ' ImgFechaInicio.ImageUrl = "/Imagenes/FlechasArriba.gif" + ' Else + ' ViewState("OFechaInicio") = "FechaInicio DESC" + ' ImgFechaInicio.ImageUrl = "/Imagenes/FlechasAbajo.gif" + ' End If + ' ViewState("Orden") = ViewState("OFechaInicio") + ' CargaGrid(ViewState("Orden").ToString()) + ' End Sub + ' Protected Sub LbFechaFin_Click(sender As Object, e As System.EventArgs) Handles LbFechaFin.Click, ImgFechaFin.Click + ' If ViewState("OFechaFin").ToString() = "FechaFin DESC" Then + ' ViewState("OFechaFin") = "FechaFin ASC" + ' ImgFechaFin.ImageUrl = "/Imagenes/FlechasArriba.gif" + ' Else + ' ViewState("OFechaFin") = "FechaFin DESC" + ' ImgFechaFin.ImageUrl = "/Imagenes/FlechasAbajo.gif" + ' End If + ' ViewState("Orden") = ViewState("OFechaFin") + ' CargaGrid(ViewState("Orden").ToString()) + ' End Sub + ' Protected Sub LbObservaciones_Click(sender As Object, e As System.EventArgs) Handles LbObservaciones.Click, ImgObservaciones.Click + ' If ViewState("OObservaciones").ToString() = "Observaciones DESC" Then + ' ViewState("OObservaciones") = "Observaciones ASC" + ' ImgObservaciones.ImageUrl = "/Imagenes/FlechasArriba.gif" + ' Else + ' ViewState("OObservaciones") = "Observaciones DESC" + ' ImgObservaciones.ImageUrl = "/Imagenes/FlechasAbajo.gif" + ' End If + ' ViewState("Orden") = ViewState("OObservaciones") + ' CargaGrid(ViewState("Orden").ToString()) + ' End Sub + ' Protected Sub LbURL_Click(sender As Object, e As System.EventArgs) Handles LbURL.Click, ImgURL.Click + ' If ViewState("OURL").ToString() = "URL DESC" Then + ' ViewState("OURL") = "URL ASC" + ' ImgURL.ImageUrl = "/Imagenes/FlechasArriba.gif" + ' Else + ' ViewState("OURL") = "URL DESC" + ' ImgURL.ImageUrl = "/Imagenes/FlechasAbajo.gif" + ' End If + ' ViewState("Orden") = ViewState("OURL") + ' CargaGrid(ViewState("Orden").ToString()) + ' End Sub + ' Protected Sub LbUsuario_Click(sender As Object, e As System.EventArgs) Handles LbUsuario.Click, ImgUsuario.Click + ' If ViewState("OUsuario").ToString() = "Usuario DESC" Then + ' ViewState("OUsuario") = "Usuario ASC" + ' ImgUsuario.ImageUrl = "/Imagenes/FlechasArriba.gif" + ' Else + ' ViewState("OUsuario") = "Usuario DESC" + ' ImgUsuario.ImageUrl = "/Imagenes/FlechasAbajo.gif" + ' End If + ' ViewState("Orden") = ViewState("OUsuario") + ' CargaGrid(ViewState("Orden").ToString()) + ' End Sub + + '#End Region + Private Sub CargaResguardos() Dim ObjResguardos As New ClsAF If ObjResguardos.GetActivosFijosResguardos(CveActivoFijo, -1, -1, -1) Then @@ -2166,102 +2155,102 @@ Partial Class AF_AF End If End If - End Sub - - 'Protected Sub GvResguardos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvResguardos.RowCancelingEdit - ' GvResguardos.EditIndex = -1 - ' GvResguardos.DataBind() - ' CargaResguardos() - 'End Sub - - 'Protected Sub GvResguardos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvResguardos.RowEditing - ' GvResguardos.EditIndex = e.NewEditIndex - ' CargaResguardos() - 'End Sub - - 'Protected Sub GvResguardos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvResguardos.RowUpdating - - ' Dim ObjResguardos As New ClsAF - - ' ' Dim FechaFin As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtFechaFin"), TextBox).Text - ' ' FechaFin = If(IsDate(FechaFin), FechaFin, "-1") - ' Dim Observaciones As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtObservaciones"), TextBox).Text.Trim - ' Dim URL As String = "-1" - ' Dim URL2 As String = "-1" - ' Dim RutaGuardar = "" - ' Dim RutaArchivo = "" - ' Dim RutaArchivo2 = "" - ' Dim Archivo As String = "" - ' Dim Archivo2 As String = "" - ' Dim CveActivoFijoResguardo As Integer = GvResguardos.DataKeys(e.RowIndex).Value.ToString.ToEntero - - ' 'If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString)) Then - ' ' Dim TmpArchivo As String = String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString) - ' ' Dim TmpRuta As String = String.Format("{0}ActivosFijos\Resguardos\", UsuarioActual.Empresa.Ruta) - ' ' Dim Extension As String = Path.GetExtension(TmpArchivo) - ' ' TmpRuta.DirectoryExistsCreate() - ' ' 'If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") - ' ' TmpRuta = String.Format("{0}{1}{2}", TmpRuta, CveActivoFijoResguardo, Extension) - ' ' File.Move(TmpArchivo, TmpRuta) - ' ' Session("FileUpload") = "" - - ' ' If File.Exists(TmpRuta) Then - ' ' URL = URL & Extension - ' ' Else - ' ' URL = "" - ' ' End If - ' 'Else - ' ' URL = URLOld - ' 'End If - - - ' 'RutaGuardar = String.Format("{0}OI\", UsuarioActual.Empresa.Ruta) - ' 'If A2.HRef <> "" Then RutaArchivo = String.Format("{0}{1}", ModExtensiones.DirectorioBaseEmpresas, A2.HRef.Substring(1)) - - - ' 'End If - - ' 'If UsuarioActual.CveRol = 1037 Then - ' ' RutaGuardar = String.Format("{0}Empresas\70\OI\", ModExtensiones.DirectorioBaseEmpresas) - ' ' RutaGuardar.DirectoryExistsCreate() - ' 'End If - ' 'Else - ' RutaGuardar = String.Format("{0}AF\Resguardos\", UsuarioActual.Empresa.Ruta) - ' RutaArchivo = String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF")) - ' RutaArchivo2 = (String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF1"))) - - ' If Session("AF") IsNot Nothing AndAlso File.Exists(RutaArchivo) Then - ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) - ' Archivo = Path.GetExtension(Session("AF").ToString) - ' File.Move(RutaArchivo, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_1" + Archivo)) - ' Session("AF") = "" - ' URL = CveActivoFijoResguardo.ToString + "_1" + Archivo - ' End If - - - ' If Session("AF1") IsNot Nothing AndAlso File.Exists(RutaArchivo2) Then - ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) - ' Archivo2 = Path.GetExtension(Session("AF1").ToString) - ' File.Move(RutaArchivo2, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_2" + Archivo2)) - ' Session("AF1") = "" - ' URL2 = CveActivoFijoResguardo.ToString + "_2" + Archivo2 - ' End If - - - ' If ObjResguardos.UpdateActivosFijosResguardos("-1", Observaciones, URL, CveActivoFijoResguardo, -1, URL2) Then - ' GvResguardos.EditIndex = -1 - ' ViewState("DTResguardos") = ObjResguardos.DtResultados - ' GvResguardos.DataSource = ObjResguardos.DtResultados - ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - ' 'If FechaFin <> "-1" Then DdlResponsable.Enabled = True : DdlResponsable.SelectedValue = "-1" - ' UPEstatus.Update() - ' End If - - ' ObjResguardos.Dispose() - ' GvResguardos.DataBind() - 'End Sub - - + End Sub + + 'Protected Sub GvResguardos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvResguardos.RowCancelingEdit + ' GvResguardos.EditIndex = -1 + ' GvResguardos.DataBind() + ' CargaResguardos() + 'End Sub + + 'Protected Sub GvResguardos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvResguardos.RowEditing + ' GvResguardos.EditIndex = e.NewEditIndex + ' CargaResguardos() + 'End Sub + + 'Protected Sub GvResguardos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvResguardos.RowUpdating + + ' Dim ObjResguardos As New ClsAF + + ' ' Dim FechaFin As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtFechaFin"), TextBox).Text + ' ' FechaFin = If(IsDate(FechaFin), FechaFin, "-1") + ' Dim Observaciones As String = DirectCast(GvResguardos.Rows(e.RowIndex).FindControl("TxtObservaciones"), TextBox).Text.Trim + ' Dim URL As String = "-1" + ' Dim URL2 As String = "-1" + ' Dim RutaGuardar = "" + ' Dim RutaArchivo = "" + ' Dim RutaArchivo2 = "" + ' Dim Archivo As String = "" + ' Dim Archivo2 As String = "" + ' Dim CveActivoFijoResguardo As Integer = GvResguardos.DataKeys(e.RowIndex).Value.ToString.ToEntero + + ' 'If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString)) Then + ' ' Dim TmpArchivo As String = String.Format("{0}Temp\{1}", UsuarioActual.Empresa.Ruta, Session("FileUpload").ToString) + ' ' Dim TmpRuta As String = String.Format("{0}ActivosFijos\Resguardos\", UsuarioActual.Empresa.Ruta) + ' ' Dim Extension As String = Path.GetExtension(TmpArchivo) + ' ' TmpRuta.DirectoryExistsCreate() + ' ' 'If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Resguardos\") + ' ' TmpRuta = String.Format("{0}{1}{2}", TmpRuta, CveActivoFijoResguardo, Extension) + ' ' File.Move(TmpArchivo, TmpRuta) + ' ' Session("FileUpload") = "" + + ' ' If File.Exists(TmpRuta) Then + ' ' URL = URL & Extension + ' ' Else + ' ' URL = "" + ' ' End If + ' 'Else + ' ' URL = URLOld + ' 'End If + + + ' 'RutaGuardar = String.Format("{0}OI\", UsuarioActual.Empresa.Ruta) + ' 'If A2.HRef <> "" Then RutaArchivo = String.Format("{0}{1}", ModExtensiones.DirectorioBaseEmpresas, A2.HRef.Substring(1)) + + + ' 'End If + + ' 'If UsuarioActual.CveRol = 1037 Then + ' ' RutaGuardar = String.Format("{0}Empresas\70\OI\", ModExtensiones.DirectorioBaseEmpresas) + ' ' RutaGuardar.DirectoryExistsCreate() + ' 'End If + ' 'Else + ' RutaGuardar = String.Format("{0}AF\Resguardos\", UsuarioActual.Empresa.Ruta) + ' RutaArchivo = String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF")) + ' RutaArchivo2 = (String.Format("{0}AF\Resguardos\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("AF1"))) + + ' If Session("AF") IsNot Nothing AndAlso File.Exists(RutaArchivo) Then + ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) + ' Archivo = Path.GetExtension(Session("AF").ToString) + ' File.Move(RutaArchivo, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_1" + Archivo)) + ' Session("AF") = "" + ' URL = CveActivoFijoResguardo.ToString + "_1" + Archivo + ' End If + + + ' If Session("AF1") IsNot Nothing AndAlso File.Exists(RutaArchivo2) Then + ' If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar) + ' Archivo2 = Path.GetExtension(Session("AF1").ToString) + ' File.Move(RutaArchivo2, String.Format("{0}{1}", RutaGuardar, CveActivoFijoResguardo.ToString + "_2" + Archivo2)) + ' Session("AF1") = "" + ' URL2 = CveActivoFijoResguardo.ToString + "_2" + Archivo2 + ' End If + + + ' If ObjResguardos.UpdateActivosFijosResguardos("-1", Observaciones, URL, CveActivoFijoResguardo, -1, URL2) Then + ' GvResguardos.EditIndex = -1 + ' ViewState("DTResguardos") = ObjResguardos.DtResultados + ' GvResguardos.DataSource = ObjResguardos.DtResultados + ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + ' 'If FechaFin <> "-1" Then DdlResponsable.Enabled = True : DdlResponsable.SelectedValue = "-1" + ' UPEstatus.Update() + ' End If + + ' ObjResguardos.Dispose() + ' GvResguardos.DataBind() + 'End Sub + + #Region " ARCHIVO " Protected Sub ImgArchivo_Click(sender As Object, e As ImageClickEventArgs) CveResguardoPadre = CType(sender, ImageButton).CommandArgument.ToEntero @@ -2343,35 +2332,35 @@ Partial Class AF_AF nombreArchivoFormateado = nombreArchivoFormateado.Replace("~", "_") nombreArchivoFormateado = nombreArchivoFormateado.Replace("^", "_") Return nombreArchivoFormateado - End Function - + End Function + #End Region - - + + #End Region - + #Region "GALERIA DE IMAGENES" - 'Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click - ' If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) Then - ' Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) - ' If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") - ' File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString, ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\" & CveActivoFijo & "_" & ImgConsecutivo & Extension) - ' Session("FileUpload") = "" - - ' If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) Then - ' Dim ObjActivosFijos As New ClsAF - ' If ObjActivosFijos.AddActivosFijosImagenes(CveActivoFijo, CveActivoFijo & "_" & ImgConsecutivo & Extension, UsuarioActual.CveUsuario) Then - ' CargarArchivo() - ' Else - ' File.Delete(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) - ' End If - - ' ObjActivosFijos.Dispose() - - ' End If - ' End If - 'End Sub - + 'Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click + ' If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) Then + ' Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString) + ' If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes") + ' File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\Temp\" & Session("FileUpload").ToString, ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\" & CveActivoFijo & "_" & ImgConsecutivo & Extension) + ' Session("FileUpload") = "" + + ' If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) Then + ' Dim ObjActivosFijos As New ClsAF + ' If ObjActivosFijos.AddActivosFijosImagenes(CveActivoFijo, CveActivoFijo & "_" & ImgConsecutivo & Extension, UsuarioActual.CveUsuario) Then + ' CargarArchivo() + ' Else + ' File.Delete(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & CveEmpresaActual & "\ActivosFijos\Imagenes" & CveActivoFijo & "_" & ImgConsecutivo & Extension) + ' End If + + ' ObjActivosFijos.Dispose() + + ' End If + ' End If + 'End Sub + Private Sub BtnUpFotos_Click(sender As Object, e As EventArgs) Handles BtnUpFotos.Click Dim FilesGral As List(Of Archivo) = TxtUpFotos.getfiles().Archivos @@ -2425,9 +2414,9 @@ Partial Class AF_AF ObjActivoFijo.Dispose() End If - End Sub + End Sub #End Region - + Private Sub CargarArchivo() Dim StrBuilder As New StringBuilder Dim TmpDT As DataTable = Nothing @@ -2500,80 +2489,80 @@ Partial Class AF_AF ErrorGuardar = True End If - If Not ErrorGuardar Then - - For Each GvRowProduccion As GridViewRow In GvProduccion.Rows - If Not ObjAF.AddProduccion(ObjAF.CveActivoFijo, GvRowProduccion.DataKey("CveCultivoCuadroDetalle").ToEntero, GvRowProduccion.DataKey("Cantidad").ToDecimal, GvRowProduccion.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario) Then - ErrorGuardar = True - Exit For - End If - Next - - - If Not ErrorGuardar Then - For Each GvRowPlagaEnfermedad As GridViewRow In GvPlagaEnfermedad.Rows - If Not ObjAF.AddPlagaEnfermedad(ObjAF.CveActivoFijo, GvRowPlagaEnfermedad.DataKey("Observaciones"), GvRowPlagaEnfermedad.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario) Then - ErrorGuardar = True - Exit For - End If - Next - End If - - - - If Not ErrorGuardar Then - - - For Each GvRowMantenimiento As GridViewRow In GvMantenimientos.Rows - - Dim CveMantenimientoTemp As Integer = ObjAF.AddMantenimientos(ObjAF.CveActivoFijo, GvRowMantenimiento.DataKey("Mantenimiento"), GvRowMantenimiento.DataKey("Observaciones"), GvRowMantenimiento.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario, "") - - If CveMantenimientoTemp > 0 Then - - If GvRowMantenimiento.DataKey("Archivo").Trim.Length > 0 Then - - Dim fi As New FileInfo(GvRowMantenimiento.DataKey("Archivo").Trim) - - If fi.Exists Then - - Dim Filename As String = fi.Name - Dim FileExtension As String = IO.Path.GetExtension(fi.FullName) - - Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimientoTemp}.{FileExtension}")) - If Archivo.Exists() Then - Archivo.Delete() - End If - - If Not Filename.FilesMove(String.Format("{0}", CveMantenimientoTemp.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then - ErrorGuardar = True - Alert("Error al mover Archivo", TipoMensaje.MsgError) - End If - - If Not ErrorGuardar Then - If Not ObjAF.UpdateMantenimientos(CveMantenimientoTemp, ObjAF.CveActivoFijo, GvRowMantenimiento.DataKey("Mantenimiento"), GvRowMantenimiento.DataKey("Observaciones"), GvRowMantenimiento.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario, $"{CveMantenimientoTemp}{FileExtension}") Then - ErrorGuardar = True - End If - End If - - End If - - End If - - - Else - ErrorGuardar = True - Exit For - End If - - Next - - - - End If - - - - + If Not ErrorGuardar Then + + For Each GvRowProduccion As GridViewRow In GvProduccion.Rows + If Not ObjAF.AddProduccion(ObjAF.CveActivoFijo, GvRowProduccion.DataKey("CveCultivoCuadroDetalle").ToEntero, GvRowProduccion.DataKey("Cantidad").ToDecimal, GvRowProduccion.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario) Then + ErrorGuardar = True + Exit For + End If + Next + + + If Not ErrorGuardar Then + For Each GvRowPlagaEnfermedad As GridViewRow In GvPlagaEnfermedad.Rows + If Not ObjAF.AddPlagaEnfermedad(ObjAF.CveActivoFijo, GvRowPlagaEnfermedad.DataKey("Observaciones"), GvRowPlagaEnfermedad.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario) Then + ErrorGuardar = True + Exit For + End If + Next + End If + + + + If Not ErrorGuardar Then + + + For Each GvRowMantenimiento As GridViewRow In GvMantenimientos.Rows + + Dim CveMantenimientoTemp As Integer = ObjAF.AddMantenimientos(ObjAF.CveActivoFijo, GvRowMantenimiento.DataKey("Mantenimiento"), GvRowMantenimiento.DataKey("Observaciones"), GvRowMantenimiento.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario, "") + + If CveMantenimientoTemp > 0 Then + + If GvRowMantenimiento.DataKey("Archivo").Trim.Length > 0 Then + + Dim fi As New FileInfo(GvRowMantenimiento.DataKey("Archivo").Trim) + + If fi.Exists Then + + Dim Filename As String = fi.Name + Dim FileExtension As String = IO.Path.GetExtension(fi.FullName) + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimientoTemp}.{FileExtension}")) + If Archivo.Exists() Then + Archivo.Delete() + End If + + If Not Filename.FilesMove(String.Format("{0}", CveMantenimientoTemp.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then + ErrorGuardar = True + Alert("Error al mover Archivo", TipoMensaje.MsgError) + End If + + If Not ErrorGuardar Then + If Not ObjAF.UpdateMantenimientos(CveMantenimientoTemp, ObjAF.CveActivoFijo, GvRowMantenimiento.DataKey("Mantenimiento"), GvRowMantenimiento.DataKey("Observaciones"), GvRowMantenimiento.DataKey("Fecha").ToDate, UsuarioActual.CveUsuario, $"{CveMantenimientoTemp}{FileExtension}") Then + ErrorGuardar = True + End If + End If + + End If + + End If + + + Else + ErrorGuardar = True + Exit For + End If + + Next + + + + End If + + + + End If End If @@ -2659,10 +2648,10 @@ Partial Class AF_AF Alert("El Activo Fijo se Eliminó correctamente.", TipoMensaje.MsgInformacion, "window.location.href=""/AF/CatAF.aspx""") End If ObjActivoFijo.Dispose() - End Sub - + End Sub + #Region "CLASIFICACIONES CARACTERISTICAS" - + Protected Sub GvCaracteristicas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvC.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If CaracClasif <> e.Row.DBCampo("CaracteristicaClasificacion") OrElse e.Row.RowIndex = 0 Then @@ -2767,125 +2756,125 @@ Partial Class AF_AF ObjAFCaracteristicas.Dispose() GvC.DataBind() UpDatos.Update() - End Sub - 'Protected Sub GuardaValores() - ' Dim ObjActivoFijo As New ClsAF - - ' For Each DR As GridViewRow In GvC.Rows - ' Dim CveCaracteristicaOpcion As Integer = -1 - ' Dim CveValor As Integer = DR.FCHiddenField("HdnCveValor").Value.ToEntero - ' Dim Valor As String = DR.FCTextBox("TxtValor").Text.Trim - ' Dim CveCaracteristica As Integer = DR.FCHiddenField("HdnCveCaracteristica").Value.ToEntero - ' Select Case DR.FCHiddenField("HdnEsOpcion").Value - ' Case "1" 'Listado o DropDownList - ' CveCaracteristicaOpcion = DR.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero - ' Case "2" 'Radio o RadioButtonList - ' CveCaracteristicaOpcion = DR.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero - ' Case "5" - ' Valor = DR.FCCheckBox("ChbValor").Checked.ToString - ' Case "6" 'Numerico - ' Valor = DR.FCTextBox("TxtValorNum").Text.Trim - ' End Select - - ' ObjActivoFijo.AddUpdActivosFijosValores(CveActivoFijo, CveCaracteristica, CveCaracteristicaOpcion, If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario) - - ' Next - ' GVHistModificaciones.DataSource = ObjActivoFijo.DtResultados - ' GVHistModificaciones.DataBind() - ' UPHistModificaciones.Update() - ' ObjActivoFijo.Dispose() - 'End Sub - - - 'Private Sub GuardarAFCaracteristica() - ' If CveActivoFijo = -1 Then - - ' Dim Correcto As Boolean = True - ' Dim ObjActivosFijos As New ClsAF - - ' Dim RetValue As Integer = ObjActivosFijos.AddActivosFijos2(TxtCodigo.Text.Trim, TxtDescripcion.Text.Trim, TxtValorCompra.Text.Trim.ToDouble, TxtFechaCompra.Text.Trim.ToDate, DdlSubTipoActivoFijo.SelectedValue.ToEntero, - ' DdlResponsable.SelectedValue.ToEntero, TxtNoSerie.Text.Trim, TxtAño.Text.Trim.ToEntero, - ' DdlSubProyecto.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.Trim.ToEntero, DdlEstadoActivoFijo.SelectedValue.ToEntero, DdlCtaContableDepreciacion.SelectedValue.ToEntero, - ' TxtPorDepreciacion.Text.Trim.ToDouble, TxtPorDeduccion.Text.Trim.ToDouble, UsuarioActual.CveUsuario, CveEmpresaActual) - - ' If RetValue > 0 OrElse RetValue = -2 Then - ' Dim tCveActivoFijo As Integer = ObjActivosFijos.CveActivoFijo - ' Dim Actualizar As Boolean = False - ' 'registro la encuesta - ' Dim Clave As Integer = 0 - ' 'verifico si ya existe una encuesta registrada - ' If ObjActivosFijos.GetActivosFijosValores(tCveActivoFijo, CveEmpresaActual) Then - ' If ObjActivosFijos.DtResultados.Rows.Count > 0 Then - ' Clave = ObjActivosFijos.DtResultados(0)("CveCaracteristica").ToString.ToEntero - - ' Actualizar = True - - ' End If - ' End If - - ' If Clave > 0 Then - - - ' For Each gvr As GridViewRow In GvC.Rows - - ' Dim CveOpcion As Integer = -1 - ' Dim Valor As String = gvr.FCTextBox("TxtValor").Text.Trim - - ' Select Case gvr.DataKey("PreguntaTipo") - ' Case "1" 'Listado o DropDownList - ' CveOpcion = gvr.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero - ' Case "2" 'Radio o RadioButtonList - ' CveOpcion = gvr.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero - ' End Select - ' Next - ' Else - ' Correcto = False - ' Alert("El Prospecto ya tiene esta encuesta registrada") - ' End If - ' Else - ' Correcto = False - ' ObjActivosFijos.Dispose() - - ' End If - ' End If - 'End Sub - 'Private Sub GuardarCaracteristicas() - ' Dim ObjActivoFijoValores As New ClsAF - - ' For Each GridValores As GridViewRow In GvC.Rows - ' Dim CveOpcion As Integer = -1 - ' Dim Valor As String = GridValores.FCTextBox("TxtValor").Text.Trim - - ' Select Case GridValores.DataKey("TipoCampo") - ' Case "1" 'Listado o DropDownList - ' CveOpcion = GridValores.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero - ' Case "2" 'Radio o RadioButtonList - ' CveOpcion = GridValores.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero - ' End Select - - ' If GridValores.DataKey("CveCaracteristica").ToEntero > 0 Then - ' If CveActivoFijo > 0 Then - ' If ObjActivoFijoValores.AddActivosFijosValores(CveActivoFijo, CveCaracteristica, CveOpcion, Valor, UsuarioActual.CveUsuario) Then - ' Alert("por aqui pasó" & CveActivoFijo & "") - ' Exit For - ' End If - ' ObjActivoFijoValores.Dispose() - - ' End If - ' End If - ' Next - - 'End Sub + End Sub + 'Protected Sub GuardaValores() + ' Dim ObjActivoFijo As New ClsAF + + ' For Each DR As GridViewRow In GvC.Rows + ' Dim CveCaracteristicaOpcion As Integer = -1 + ' Dim CveValor As Integer = DR.FCHiddenField("HdnCveValor").Value.ToEntero + ' Dim Valor As String = DR.FCTextBox("TxtValor").Text.Trim + ' Dim CveCaracteristica As Integer = DR.FCHiddenField("HdnCveCaracteristica").Value.ToEntero + ' Select Case DR.FCHiddenField("HdnEsOpcion").Value + ' Case "1" 'Listado o DropDownList + ' CveCaracteristicaOpcion = DR.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero + ' Case "2" 'Radio o RadioButtonList + ' CveCaracteristicaOpcion = DR.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero + ' Case "5" + ' Valor = DR.FCCheckBox("ChbValor").Checked.ToString + ' Case "6" 'Numerico + ' Valor = DR.FCTextBox("TxtValorNum").Text.Trim + ' End Select + + ' ObjActivoFijo.AddUpdActivosFijosValores(CveActivoFijo, CveCaracteristica, CveCaracteristicaOpcion, If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario) + + ' Next + ' GVHistModificaciones.DataSource = ObjActivoFijo.DtResultados + ' GVHistModificaciones.DataBind() + ' UPHistModificaciones.Update() + ' ObjActivoFijo.Dispose() + 'End Sub + + + 'Private Sub GuardarAFCaracteristica() + ' If CveActivoFijo = -1 Then + + ' Dim Correcto As Boolean = True + ' Dim ObjActivosFijos As New ClsAF + + ' Dim RetValue As Integer = ObjActivosFijos.AddActivosFijos2(TxtCodigo.Text.Trim, TxtDescripcion.Text.Trim, TxtValorCompra.Text.Trim.ToDouble, TxtFechaCompra.Text.Trim.ToDate, DdlSubTipoActivoFijo.SelectedValue.ToEntero, + ' DdlResponsable.SelectedValue.ToEntero, TxtNoSerie.Text.Trim, TxtAño.Text.Trim.ToEntero, + ' DdlSubProyecto.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.Trim.ToEntero, DdlEstadoActivoFijo.SelectedValue.ToEntero, DdlCtaContableDepreciacion.SelectedValue.ToEntero, + ' TxtPorDepreciacion.Text.Trim.ToDouble, TxtPorDeduccion.Text.Trim.ToDouble, UsuarioActual.CveUsuario, CveEmpresaActual) + + ' If RetValue > 0 OrElse RetValue = -2 Then + ' Dim tCveActivoFijo As Integer = ObjActivosFijos.CveActivoFijo + ' Dim Actualizar As Boolean = False + ' 'registro la encuesta + ' Dim Clave As Integer = 0 + ' 'verifico si ya existe una encuesta registrada + ' If ObjActivosFijos.GetActivosFijosValores(tCveActivoFijo, CveEmpresaActual) Then + ' If ObjActivosFijos.DtResultados.Rows.Count > 0 Then + ' Clave = ObjActivosFijos.DtResultados(0)("CveCaracteristica").ToString.ToEntero + + ' Actualizar = True + + ' End If + ' End If + + ' If Clave > 0 Then + + + ' For Each gvr As GridViewRow In GvC.Rows + + ' Dim CveOpcion As Integer = -1 + ' Dim Valor As String = gvr.FCTextBox("TxtValor").Text.Trim + + ' Select Case gvr.DataKey("PreguntaTipo") + ' Case "1" 'Listado o DropDownList + ' CveOpcion = gvr.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero + ' Case "2" 'Radio o RadioButtonList + ' CveOpcion = gvr.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero + ' End Select + ' Next + ' Else + ' Correcto = False + ' Alert("El Prospecto ya tiene esta encuesta registrada") + ' End If + ' Else + ' Correcto = False + ' ObjActivosFijos.Dispose() + + ' End If + ' End If + 'End Sub + 'Private Sub GuardarCaracteristicas() + ' Dim ObjActivoFijoValores As New ClsAF + + ' For Each GridValores As GridViewRow In GvC.Rows + ' Dim CveOpcion As Integer = -1 + ' Dim Valor As String = GridValores.FCTextBox("TxtValor").Text.Trim + + ' Select Case GridValores.DataKey("TipoCampo") + ' Case "1" 'Listado o DropDownList + ' CveOpcion = GridValores.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero + ' Case "2" 'Radio o RadioButtonList + ' CveOpcion = GridValores.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero + ' End Select + + ' If GridValores.DataKey("CveCaracteristica").ToEntero > 0 Then + ' If CveActivoFijo > 0 Then + ' If ObjActivoFijoValores.AddActivosFijosValores(CveActivoFijo, CveCaracteristica, CveOpcion, Valor, UsuarioActual.CveUsuario) Then + ' Alert("por aqui pasó" & CveActivoFijo & "") + ' Exit For + ' End If + ' ObjActivoFijoValores.Dispose() + + ' End If + ' End If + ' Next + + 'End Sub #End Region - - + + #Region "B I T A C O R A" - + Private Sub CargaBitacora() - End Sub + End Sub #End Region - - + + #Region "E V E N T O - B I T A C O R A" Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -2963,10 +2952,10 @@ Partial Class AF_AF HttpContext.Current.Response.End() Archivo = Nothing - End Sub + End Sub #End Region - - + + #Region " H I S T O R I A L" Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -2994,10 +2983,10 @@ Partial Class AF_AF ObjHistorial.Dispose() GVHistorial.DataBind() - End Sub + End Sub #End Region - - + + #Region "H I S T O R I A L - M O D I F I C A C I O N E S" Protected Sub GVHistModificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVHistModificaciones.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -3023,10 +3012,10 @@ Partial Class AF_AF ObjGral.Dispose() GVHistModificaciones.DataBind() - End Sub + End Sub #End Region - - + + #Region "GUARDAR ARCHIVO" Protected Sub BtnGuardaArchivo1_Click(sender As Object, e As ImageClickEventArgs) Dim objResguardos As New ClsAF @@ -3102,18 +3091,18 @@ Partial Class AF_AF GvResguardos.DataBind() - End Sub + End Sub #End Region - + Protected Sub DdlSubTipoActivoFijo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubTipoActivoFijo.SelectedIndexChanged CargaCaracteristicas() CargaDispositivos() ModalidadesPaginaAF() - End Sub - + End Sub + #Region "CARGAR CUENTA CONTABLE" - + Private Sub CargaCuentasContables() trCuentaContable.Visible = True @@ -3194,12 +3183,12 @@ Partial Class AF_AF ObjContaAC.Dispose() ObjAF.Dispose() UpDatos.Update() - End Sub - - + End Sub + + #End Region - - + + #Region "IMPRESIÓN FULL" Private Sub GenerarPDF(Optional Formato As String = "PDF") @@ -3226,11 +3215,10 @@ Partial Class AF_AF params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen}")) Else params.Add(New ReportParameter("LogoPath", "")) End If @@ -3295,12 +3283,12 @@ Partial Class AF_AF Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click GenerarPDF("PDF") - End Sub + End Sub #End Region - - + + #Region "Codigo Barras" - 'Codigo barras/QR se retorna como una imagen bmp + 'Codigo barras/QR se retorna como una imagen bmp Private Function GeneraCodigoQR(CodigoBarras As String, Alto As Integer, Largo As Integer, Margen As Integer, Formato As String) As Byte() Dim barcodeWriter As New BarcodeWriter @@ -3491,18 +3479,18 @@ Partial Class AF_AF Catch ex As Exception End Try - End Sub - - + End Sub + + #End Region - - + + #Region " AFInv " Protected Sub BtnAFInv_Click(sender As Object, e As EventArgs) - If DdlAFInvPS.SelectedValue.ToEntero <= 0 Then - Alert("Seleccione un producto.") - Exit Sub + If DdlAFInvPS.SelectedValue.ToEntero <= 0 Then + Alert("Seleccione un producto.") + Exit Sub End If Dim CveSeccionAlmacen As Integer = -1 AFInvSerie = "" @@ -3511,14 +3499,14 @@ Partial Class AF_AF AFInvCveSeccionAlmacen = -1 Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlAFInvPS.SelectedValue.ToEntero).FiltroPrimero("") - If DrPS Is Nothing Then Exit Sub - + If DrPS Is Nothing Then Exit Sub + Dim Inv_CveMetodoInventario As Integer = If(DrPS("AplicaSerie").ToString() = "True", 5, 1) If CBool(DrPS("AplicaSeccion")) Then CveSeccionAlmacen = DdlSeccionAlmacen.SelectedValue.ToEntero - AFInvSerie = If(Inv_CveMetodoInventario = 5, TxtAFInvSerie.Text.Trim, "-1") - - + AFInvSerie = If(Inv_CveMetodoInventario = 5, TxtAFInvSerie.Text.Trim, "-1") + + Dim ObjInventario As New ClsInventarios Dim Existencia = ObjInventario.GetExistenciasPS(DdlAFInvPS.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, FechaMovto:=Now.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=AFInvSerie) Dim Costo As Decimal = 0 @@ -3543,7 +3531,7 @@ Partial Class AF_AF TxtDescripcion.Text = DdlAFInvPS.SelectedText TxtValorCompra.Text = Costo.FormatoNumero - TxtFechaCompra.Text = Now.ToShortDateString + TxtFechaCompra.Text = Now.ToShortDateString TxtFechaBaja.Text = "" TxtNoSerie.Text = TxtAFInvSerie.Text.Trim @@ -3560,11 +3548,11 @@ Partial Class AF_AF DivAFInvAdvertencia.Visible = True UpDatos.Update() - End Sub - - + End Sub + + #End Region - + #Region "AF GRUPOS" Private Sub BtnAgregarGrupo_Click(sender As Object, e As EventArgs) Handles BtnAgregarGrupo.Click TxtGrupoAF.Text = "" @@ -3706,15 +3694,15 @@ Partial Class AF_AF End If ObjAF.Dispose() UpDatos.Update() - End Sub + End Sub #End Region - + #Region "AF MARCAR / MODELOS" Private Sub DdlMarcas_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMarcas.SelectedIndexChanged CargaModelos(DdlMarcas.SelectedValue.ToEntero) - End Sub + End Sub #End Region - + #Region "AF PADRE E HIJOS" Public Sub CargaAFPAdreEHijos() CargaAFPadres() @@ -3752,10 +3740,10 @@ Partial Class AF_AF ObjAF.Dispose() UpDatos.Update() - End Sub - + End Sub + #End Region - + #Region "G P S" Protected Sub DdlDispositivo_SelectedIndexChanged(sender As Object, e As EventArgs) CargaUltimaPosicion(DdlDispositivo.SelectedValue.ToEntero) @@ -4103,27 +4091,27 @@ Partial Class AF_AF UpGeocercas.Update() RegistraScript(SBJS.ToString()) End Try - End Sub + End Sub #End Region Protected Sub DdlAFInvPS_SelectedIndexChanged(sender As Object, e As EventArgs) Dim drr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlAFInvPS.SelectedValue.ToEntero).FiltroPrimero("") - If drr IsNot Nothing Then - DivSerie.Visible = CBool(drr("AplicaSerie")) - DivSeccion.Visible = CBool(drr("AplicaSeccion")) - DdlSeccionAlmacen.Items.Clear() - If CBool(drr("AplicaSeccion")) Then - 'CargaSeccionesAlmacen(DdlSeccionAlmacen, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) - Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero) - DdlSeccionAlmacen.DataSource = dtt - DdlSeccionAlmacen.DataBind() - - dtt.Dispose() - - End If - - End If - - + If drr IsNot Nothing Then + DivSerie.Visible = CBool(drr("AplicaSerie")) + DivSeccion.Visible = CBool(drr("AplicaSeccion")) + DdlSeccionAlmacen.Items.Clear() + If CBool(drr("AplicaSeccion")) Then + 'CargaSeccionesAlmacen(DdlSeccionAlmacen, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) + Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero) + DdlSeccionAlmacen.DataSource = dtt + DdlSeccionAlmacen.DataBind() + + dtt.Dispose() + + End If + + End If + + End Sub Protected Sub BtnPDFCompras_Click(sender As Object, e As EventArgs) Imprime() @@ -4163,9 +4151,8 @@ Partial Class AF_AF params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else @@ -4174,721 +4161,721 @@ Partial Class AF_AF ImprimirPDF("Empresas/Grales/Formatos/RepComprasInsumos.rdlc", DTCompras, params, "RepComprasInsumos", Formato) - End Sub - - -#Region "Produccion" - - - - Private Sub CargaProduccion() - - - - If CveActivoFijo > 0 Then - - Dim ObjAF As New ClsAF - - If ObjAF.GetProduccion(CveActivoFijo, UsuarioActual.CveEmpresa) Then - GvProduccion.DataSource = ObjAF.DtResultados - Else - GvProduccion.DataSource = Nothing - End If - - ObjAF.Dispose() - - - Else - GvProduccion.DataSource = DT_Produccion - End If - - - GvProduccion.DataBind() - - UpProduccion.Update() - - End Sub - - - Protected Sub LnkAgregarProduccion_Click(sender As Object, e As EventArgs) - - - CveProduccion = -1 - IndexProduccion = -1 - - LblModaProduccionTitulo.Text = "Agregar Producción" - LnkModalAgregarProduccion.Text = "Agregar" - - - DdlModalCultivosCuadro.SelectedValueExist(-1) - TxtModalProduccionCantidad.Text = "" - TxtModalProduccionFecha.Text = "" - - RegistraScript("$('#DVModalProduccion').modal('show');") - - UpModalProduccion.Update() - End Sub - - Protected Sub LnkGvProduccionEdit_Click(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - - - If CveActivoFijo > 0 Then - CveProduccion = GvRow.DataKey("CveProduccion").ToEntero - Else - IndexProduccion = GvRow.RowIndex - End If - - - Dim CveCultivoCuadroDetalle As Integer = GvRow.DataKey("CveCultivoCuadroDetalle").ToEntero - Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal - Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate - - DdlModalCultivosCuadro.SelectedValueExist(CveCultivoCuadroDetalle) - TxtModalProduccionCantidad.Text = Cantidad.ToString("###,###,###.00") - TxtModalProduccionFecha.Text = Fecha.ToString("dd/MM/yyyy") - - - LblModaProduccionTitulo.Text = "Actualizar Producción" - LnkModalAgregarProduccion.Text = "Actualizar" - - UpModalProduccion.Update() - - - RegistraScript("$('#DVModalProduccion').modal('show');") - End Sub - - Protected Sub LnkGvProduccionRemove_Click(sender As Object, e As EventArgs) - - Dim ErrorProceso As Boolean = False - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - If CveActivoFijo > 0 Then - - Dim CveProduccionEliminar As Integer = GvRow.DataKey("CveProduccion").ToEntero - Dim ObjAF As New ClsAF - If ObjAF.RemoveProduccion(CveProduccionEliminar, UsuarioActual.CveEmpresa) Then - ErrorProceso = False - Else - ErrorProceso = True - End If - ObjAF.Dispose() - - Else - Dim IndexProduccionEliminar As Integer = GvRow.RowIndex - - DT_Produccion.Rows(IndexProduccionEliminar).Delete() - DT_Produccion.AcceptChanges() - ErrorProceso = False - - End If - - - If Not ErrorProceso Then - Alert("Producción Eliminada Correctamente.") - CargaProduccion() - End If - - End Sub - - - - Protected Sub LnkModalAgregarProduccion_Click(sender As Object, e As EventArgs) - Dim ErrorProceso As Boolean = False - - - - - - If CveActivoFijo > 0 Then - - Dim ObjAF As New ClsAF - - If CveProduccion > 0 Then - If ObjAF.UpdateProduccion(CveProduccion, CveActivoFijo, DdlModalCultivosCuadro.SelectedValue.ToEntero, TxtModalProduccionCantidad.Text.ToDecimal, TxtModalProduccionFecha.Text.ToDate, UsuarioActual.CveUsuario) Then - ErrorProceso = False - Else - ErrorProceso = True - End If - Else - If ObjAF.AddProduccion(CveActivoFijo, DdlModalCultivosCuadro.SelectedValue.ToEntero, TxtModalProduccionCantidad.Text.ToDecimal, TxtModalProduccionFecha.Text.ToDate, UsuarioActual.CveUsuario) Then - ErrorProceso = False - Else - ErrorProceso = True - End If - End If - - ObjAF.Dispose() - - Else - - - If IndexProduccion >= 0 Then - DT_Produccion.Rows(IndexProduccion)("Cuadro") = DdlModalCultivosCuadro.SelectedItem.Text - DT_Produccion.Rows(IndexProduccion)("CveCultivoCuadroDetalle") = DdlModalCultivosCuadro.SelectedValue.ToEntero - DT_Produccion.Rows(IndexProduccion)("Fecha") = TxtModalProduccionFecha.Text.ToDate - DT_Produccion.Rows(IndexProduccion)("Cantidad") = TxtModalProduccionCantidad.Text.ToDecimal - Else - - Dim nRow As DataRow = DT_Produccion.NewRow - - nRow("Cuadro") = DdlModalCultivosCuadro.SelectedItem.Text - nRow("CveCultivoCuadroDetalle") = DdlModalCultivosCuadro.SelectedValue.ToEntero - nRow("Fecha") = TxtModalProduccionFecha.Text.ToDate - nRow("Cantidad") = TxtModalProduccionCantidad.Text.ToDecimal - - DT_Produccion.Rows.Add(nRow) - ErrorProceso = False - - End If - - DT_Produccion.AcceptChanges() - - End If - - - If Not ErrorProceso Then - RegistraScript("$('#DVModalProduccion').modal('hide');") - Alert("Producción Agregada Correctamente.") - CargaProduccion() - End If - - End Sub - -#End Region - -#Region "MANTENIMIENTO" - - - - - Private Sub CargaMantenimento() - - If CveActivoFijo > 0 Then - - Dim ObjAF As New ClsAF - If ObjAF.GetMantenimientos(CveActivoFijo, UsuarioActual.CveEmpresa) Then - GvMantenimientos.DataSource = ObjAF.DtResultados - Else - GvMantenimientos.DataSource = Nothing - End If - ObjAF.Dispose() - - Else - GvMantenimientos.DataSource = DT_Mantenimiento - End If - - - GvMantenimientos.DataBind() - - UpMantenimientos.Update() - - End Sub - - - Protected Sub LnkAgregarMantenimiento_Click(sender As Object, e As EventArgs) - - - CveMantenimiento = -1 - IndexMantenimiento = -1 - - LblModaMantenimientoTitulo.Text = "Agregar Mantenimiento" - LnkModalAgregarMantenimiento.Text = "Agregar" - - - - TxtModalMantenimiento.Text = "" - TxtModalMantenimientoObservaciones.Text = "" - TxtModalMantenimientoFecha.Text = "" - TxtArchivoMantenimiento.Text = "[]" - - RegistraScript("$('#DVModalMantenimiento').modal('show');") - - UpModalMantenimiento.Update() - End Sub - - Protected Sub LnkGvMantenimientoEdit_Click(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - 'CveMantenimiento, CveActivoFijo, Mantenimiento, Observaciones, Fecha, FechaIng, CveUsuario, Codigo, Descripcion, Usuario - - - If CveActivoFijo > 0 Then - CveMantenimiento = GvRow.DataKey("CveMantenimiento").ToEntero - Else - IndexMantenimiento = GvRow.RowIndex - End If - - - Dim Mantenimiento As String = GvRow.DataKey("Mantenimiento") - Dim Observaciones As String = GvRow.DataKey("Observaciones") - Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate - - TxtModalMantenimiento.Text = Mantenimiento - TxtModalMantenimientoObservaciones.Text = Observaciones - TxtModalMantenimientoFecha.Text = Fecha.ToString("dd/MM/yyyy") - TxtArchivoMantenimiento.Text = "[]" - - - LblModaMantenimientoTitulo.Text = "Actualizar Mantenimiento" - LnkModalAgregarMantenimiento.Text = "Actualizar" - - UpModalMantenimiento.Update() - - - RegistraScript("$('#DVModalMantenimiento').modal('show');") - End Sub - - Protected Sub LnkGvMantenimientoRemove_Click(sender As Object, e As EventArgs) - - Dim ErrorProceso As Boolean = False - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim IndexMantenimientoEliminar As Integer = GvRow.RowIndex - - If CveActivoFijo > 0 Then - Dim CveMantenimientoEliminar As Integer = GvRow.DataKey("CveMantenimiento").ToEntero - Dim ObjAF As New ClsAF - If ObjAF.RemoveMantenimientos(CveMantenimientoEliminar, UsuarioActual.CveEmpresa) Then - ErrorProceso = False - Else - ErrorProceso = True - End If - ObjAF.Dispose() - - Else - - DT_Mantenimiento.Rows(IndexMantenimientoEliminar).Delete() - DT_Mantenimiento.AcceptChanges() - - End If - - - - - If Not ErrorProceso Then - Alert("Mantenimiento Eliminado Correctamente.") - CargaMantenimento() - End If - - End Sub - - - - Protected Sub LnkModalAgregarMantenimiento_Click(sender As Object, e As EventArgs) - Dim ErrorProceso As Boolean = False - Dim ObjAF As New ClsAF - ObjAF.IniciaTransacSQL() - - - If CveActivoFijo > 0 Then - - If CveMantenimiento > 0 Then - - Dim FileExtension As String = "" - Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos - Dim Filename As String = "-1" - - If Filesgral.Count > 0 Then - - For Each fileItem As Archivo In Filesgral - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Filename = fileItem.filename - Exit For - Next - - Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimiento}.{FileExtension}")) - If Archivo.Exists() Then - Archivo.Delete() - End If - - - If Not Filename.FilesMove(String.Format("{0}", CveMantenimiento.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then - ErrorProceso = True - Alert("Error al mover Archivo", TipoMensaje.MsgError) - End If - - End If - - If Not ErrorProceso Then - If Not ObjAF.UpdateMantenimientos(CveMantenimiento, CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, $"{CveMantenimiento}.{FileExtension}") Then - ErrorProceso = True - End If - End If - Else - - Dim CveMantenimientoTemp As Integer = -1 - - CveMantenimientoTemp = ObjAF.AddMantenimientos(CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, "-1") - If CveMantenimientoTemp > 0 Then - ErrorProceso = False - Else - ErrorProceso = True - End If - - If Not ErrorProceso Then - - Dim FileExtension As String = "" - Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos - Dim Filename As String = "" - - If Filesgral.Count > 0 Then - - For Each fileItem As Archivo In Filesgral - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Filename = fileItem.filename - Exit For - Next - - Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimientoTemp}.{FileExtension}")) - If Archivo.Exists() Then - Archivo.Delete() - End If - - - If Not Filename.FilesMove(String.Format("{0}", CveMantenimientoTemp.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then - ErrorProceso = True - Alert("Error al mover Archivo", TipoMensaje.MsgError) - End If - - If Not ErrorProceso Then - If Not ObjAF.UpdateMantenimientos(CveMantenimientoTemp, CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, $"{CveMantenimientoTemp}.{FileExtension}") Then - ErrorProceso = True - End If - End If - End If - End If - End If - - - - If Not ErrorProceso Then - TxtArchivoMantenimiento.Text = "" - UpModalMantenimiento.Update() - End If - - - If Not ErrorProceso Then - ObjAF.Commit() - ObjAF.Dispose() - - 'RegistraScript("$('#DVModalMantenimiento').modal('hide');") - 'Alert("Mantenimiento Guardado Correctamente.") - 'CargaMantenimento() - Else - ObjAF.RollBack() - ObjAF.Dispose() - End If - - - Else - - Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos - - - If IndexMantenimiento >= 0 Then - - DT_Mantenimiento.Rows(IndexMantenimiento)("Mantenimiento") = TxtModalMantenimiento.Text - DT_Mantenimiento.Rows(IndexMantenimiento)("Observaciones") = TxtModalMantenimientoObservaciones.Text - DT_Mantenimiento.Rows(IndexMantenimiento)("Fecha") = TxtModalMantenimientoFecha.Text.ToDate - - - If Filesgral.Count > 0 Then - - For Each fileItem As Archivo In Filesgral - - Dim fi As New FileInfo(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)) - - If fi.Exists Then - DT_Mantenimiento.Rows(IndexMantenimiento)("Archivo") = fi.FullName - End If - - Exit For - Next - End If - - DT_Mantenimiento.AcceptChanges() - - Else - - Dim nRow As DataRow = DT_Mantenimiento.NewRow - - nRow("Mantenimiento") = TxtModalMantenimiento.Text - nRow("Observaciones") = TxtModalMantenimientoObservaciones.Text - nRow("Fecha") = TxtModalMantenimientoFecha.Text.ToDate - - If Filesgral.Count > 0 Then - - For Each fileItem As Archivo In Filesgral - - Dim fi As New FileInfo(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)) - - If fi.Exists Then - nRow("Archivo") = fi.FullName - End If - - Exit For - Next - End If - - DT_Mantenimiento.Rows.Add(nRow) - DT_Mantenimiento.AcceptChanges() - - End If - - TxtArchivoMantenimiento.Text = "" - - End If - - If Not ErrorProceso Then - RegistraScript("$('#DVModalMantenimiento').modal('hide');") - Alert("Mantenimiento Guardado Correctamente.") - CargaMantenimento() - End If - - - - End Sub - - Protected Sub LnkDescargaArcgivo_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim Archivo As String = GvRow.DataKey("Archivo") - - Dim InfArchivo As FileInfo - - If CveActivoFijo > 0 Then - InfArchivo = New FileInfo($"{UsuarioActual.Empresa.Ruta}\AF\Mantenimientos\{Archivo}") - Else - InfArchivo = New FileInfo(Archivo) - End If - - If InfArchivo.Exists Then - - Response.Clear() - Response.AppendHeader("Content-Disposition", "attachment; filename=" + InfArchivo.Name) - Response.AppendHeader("Content-Length", InfArchivo.Length.ToString()) - Response.ContentType = "application/octet-stream" - Response.WriteFile(InfArchivo.FullName) - - Response.End() - - End If - - - - End Sub - - Protected Sub GvMantenimientos_RowDataBound(sender As Object, e As GridViewRowEventArgs) - - If e.Row.RowType = DataControlRowType.DataRow Then - - Dim Archivo As String = e.Row.DataKey("Archivo") - - If Archivo.Length > 0 Then - - - Dim InfArchivo As FileInfo - - If CveActivoFijo > 0 Then - InfArchivo = New FileInfo($"{UsuarioActual.Empresa.Ruta}\AF\Mantenimientos\{Archivo}") - Else - InfArchivo = New FileInfo(Archivo) - End If - - If InfArchivo.Exists Then - e.Row.FCLinkButton("LnkDescargaArcgivo").Visible = True - ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkDescargaArcgivo")) - End If - - - End If - - - End If - - End Sub - -#End Region - - -#Region "PLAGA ENFERMEDAD" - - - - Private Sub CargaPlagaEnfermedad() - - - - If CveActivoFijo > 0 Then - Dim ObjAF As New ClsAF - If ObjAF.GetPlagaEnfermedad(CveActivoFijo, UsuarioActual.CveEmpresa) Then - GvPlagaEnfermedad.DataSource = ObjAF.DtResultados - Else - GvPlagaEnfermedad.DataSource = Nothing - End If - - ObjAF.Dispose() - Else - GvPlagaEnfermedad.DataSource = DT_PlgaEfermedad - End If - - - GvPlagaEnfermedad.DataBind() - - UpPlagaEnfermedad.Update() - - End Sub - - - Protected Sub LnkAgregarPlagaEnfermedad_Click(sender As Object, e As EventArgs) - - - If CveActivoFijo > 0 Then - CvePlagaEnfermedad = -1 - Else - IndexProduccion = -1 - End If - - - LblModalTituloPlagaEnfermedad.Text = "Agregar Plaga Enfermedad" - LnkModalAgregarProduccion.Text = "Agregar" - - - - TxtModalPlagaEnfermedadObservaciones.Text = "" - TxtModalPlagaEnfermedadFecha.Text = "" - - RegistraScript("$('#DVModalPlagaEnfermedad').modal('show');") - - UpModalPlagaEnfermedad.Update() - End Sub - - Protected Sub LnkGvPlagaEnfermedadEdit_Click(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - If CveActivoFijo > 0 Then - CvePlagaEnfermedad = GvRow.DataKey("CvePlagaEnfermedad").ToEntero - Else - IndexPlagaEnfermedad = GvRow.RowIndex - End If - - Dim Observaciones As String = GvRow.DataKey("Observaciones") - Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate - - - TxtModalPlagaEnfermedadObservaciones.Text = Observaciones - TxtModalPlagaEnfermedadFecha.Text = Fecha.ToString("dd/MM/yyyy") - - - LblModalTituloPlagaEnfermedad.Text = "Actualizar plaga enfermedad" - LnkModalAgregarPlagaEnfermedad.Text = "Actualizar" - - UpModalPlagaEnfermedad.Update() - - - RegistraScript("$('#DVModalPlagaEnfermedad').modal('show');") - End Sub - - Protected Sub LnkGvPlagaEnfermedadRemove_Click(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - Dim ErrorProceso As Boolean = False - - If CveActivoFijo > 0 Then - Dim CvePlagaEnfermedadEliminar As Integer = GvRow.DataKey("CvePlagaEnfermedad").ToEntero - Dim ObjAF As New ClsAF - - If ObjAF.RemovePlagaEnfermedad(CvePlagaEnfermedadEliminar, UsuarioActual.CveEmpresa) Then - ErrorProceso = False - Else - ErrorProceso = True - End If - - ObjAF.Dispose() - Else - - Dim IndexPlagaEnfermedadEliminar As Integer = GvRow.RowIndex - DT_PlgaEfermedad.Rows(IndexPlagaEnfermedadEliminar).Delete() - DT_PlgaEfermedad.AcceptChanges() - ErrorProceso = False - - End If - - - If Not ErrorProceso Then - Alert("Plaga Enfermedad Eliminada Correctamente.") - CargaPlagaEnfermedad() - End If - - End Sub - - - - Protected Sub LnkModalAgregarPlagaEnfermedad_Click(sender As Object, e As EventArgs) - Dim ErrorProceso As Boolean = False - - - If CveActivoFijo > 0 Then - - Dim ObjAF As New ClsAF - If CvePlagaEnfermedad > 0 Then - If ObjAF.UpdatePlagaEnfermedad(CvePlagaEnfermedad, CveActivoFijo, TxtModalPlagaEnfermedadObservaciones.Text, TxtModalPlagaEnfermedadFecha.Text.ToDate, UsuarioActual.CveUsuario) Then - ErrorProceso = False - Else - ErrorProceso = True - End If - Else - If ObjAF.AddPlagaEnfermedad(CveActivoFijo, TxtModalPlagaEnfermedadObservaciones.Text, TxtModalPlagaEnfermedadFecha.Text.ToDate, UsuarioActual.CveUsuario) Then - ErrorProceso = False - Else - ErrorProceso = True - End If - End If - ObjAF.Dispose() - - Else - - If IndexPlagaEnfermedad >= 0 Then - - DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Observaciones") = TxtModalPlagaEnfermedadObservaciones.Text - DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Fecha") = TxtModalPlagaEnfermedadFecha.Text.ToDate - DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Usuario") = UsuarioActual.Usuario - - Else - - Dim nRow As DataRow = DT_PlgaEfermedad.NewRow - - nRow("Observaciones") = TxtModalPlagaEnfermedadObservaciones.Text - nRow("Fecha") = TxtModalPlagaEnfermedadFecha.Text.ToDate - nRow("Usuario") = UsuarioActual.Usuario - - DT_PlgaEfermedad.Rows.Add(nRow) - - DT_PlgaEfermedad.AcceptChanges() - - - - End If - ErrorProceso = False - End If - - - - - If Not ErrorProceso Then - RegistraScript("$('#DVModalPlagaEnfermedad').modal('hide');") - Alert("Plaga Enfermedad guardada Correctamente.") - CargaPlagaEnfermedad() - End If - - End Sub - -#End Region - - - - + End Sub + + +#Region "Produccion" + + + + Private Sub CargaProduccion() + + + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.GetProduccion(CveActivoFijo, UsuarioActual.CveEmpresa) Then + GvProduccion.DataSource = ObjAF.DtResultados + Else + GvProduccion.DataSource = Nothing + End If + + ObjAF.Dispose() + + + Else + GvProduccion.DataSource = DT_Produccion + End If + + + GvProduccion.DataBind() + + UpProduccion.Update() + + End Sub + + + Protected Sub LnkAgregarProduccion_Click(sender As Object, e As EventArgs) + + + CveProduccion = -1 + IndexProduccion = -1 + + LblModaProduccionTitulo.Text = "Agregar Producción" + LnkModalAgregarProduccion.Text = "Agregar" + + + DdlModalCultivosCuadro.SelectedValueExist(-1) + TxtModalProduccionCantidad.Text = "" + TxtModalProduccionFecha.Text = "" + + RegistraScript("$('#DVModalProduccion').modal('show');") + + UpModalProduccion.Update() + End Sub + + Protected Sub LnkGvProduccionEdit_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + + If CveActivoFijo > 0 Then + CveProduccion = GvRow.DataKey("CveProduccion").ToEntero + Else + IndexProduccion = GvRow.RowIndex + End If + + + Dim CveCultivoCuadroDetalle As Integer = GvRow.DataKey("CveCultivoCuadroDetalle").ToEntero + Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal + Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate + + DdlModalCultivosCuadro.SelectedValueExist(CveCultivoCuadroDetalle) + TxtModalProduccionCantidad.Text = Cantidad.ToString("###,###,###.00") + TxtModalProduccionFecha.Text = Fecha.ToString("dd/MM/yyyy") + + + LblModaProduccionTitulo.Text = "Actualizar Producción" + LnkModalAgregarProduccion.Text = "Actualizar" + + UpModalProduccion.Update() + + + RegistraScript("$('#DVModalProduccion').modal('show');") + End Sub + + Protected Sub LnkGvProduccionRemove_Click(sender As Object, e As EventArgs) + + Dim ErrorProceso As Boolean = False + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + If CveActivoFijo > 0 Then + + Dim CveProduccionEliminar As Integer = GvRow.DataKey("CveProduccion").ToEntero + Dim ObjAF As New ClsAF + If ObjAF.RemoveProduccion(CveProduccionEliminar, UsuarioActual.CveEmpresa) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + ObjAF.Dispose() + + Else + Dim IndexProduccionEliminar As Integer = GvRow.RowIndex + + DT_Produccion.Rows(IndexProduccionEliminar).Delete() + DT_Produccion.AcceptChanges() + ErrorProceso = False + + End If + + + If Not ErrorProceso Then + Alert("Producción Eliminada Correctamente.") + CargaProduccion() + End If + + End Sub + + + + Protected Sub LnkModalAgregarProduccion_Click(sender As Object, e As EventArgs) + Dim ErrorProceso As Boolean = False + + + + + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + + If CveProduccion > 0 Then + If ObjAF.UpdateProduccion(CveProduccion, CveActivoFijo, DdlModalCultivosCuadro.SelectedValue.ToEntero, TxtModalProduccionCantidad.Text.ToDecimal, TxtModalProduccionFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + Else + If ObjAF.AddProduccion(CveActivoFijo, DdlModalCultivosCuadro.SelectedValue.ToEntero, TxtModalProduccionCantidad.Text.ToDecimal, TxtModalProduccionFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + End If + + ObjAF.Dispose() + + Else + + + If IndexProduccion >= 0 Then + DT_Produccion.Rows(IndexProduccion)("Cuadro") = DdlModalCultivosCuadro.SelectedItem.Text + DT_Produccion.Rows(IndexProduccion)("CveCultivoCuadroDetalle") = DdlModalCultivosCuadro.SelectedValue.ToEntero + DT_Produccion.Rows(IndexProduccion)("Fecha") = TxtModalProduccionFecha.Text.ToDate + DT_Produccion.Rows(IndexProduccion)("Cantidad") = TxtModalProduccionCantidad.Text.ToDecimal + Else + + Dim nRow As DataRow = DT_Produccion.NewRow + + nRow("Cuadro") = DdlModalCultivosCuadro.SelectedItem.Text + nRow("CveCultivoCuadroDetalle") = DdlModalCultivosCuadro.SelectedValue.ToEntero + nRow("Fecha") = TxtModalProduccionFecha.Text.ToDate + nRow("Cantidad") = TxtModalProduccionCantidad.Text.ToDecimal + + DT_Produccion.Rows.Add(nRow) + ErrorProceso = False + + End If + + DT_Produccion.AcceptChanges() + + End If + + + If Not ErrorProceso Then + RegistraScript("$('#DVModalProduccion').modal('hide');") + Alert("Producción Agregada Correctamente.") + CargaProduccion() + End If + + End Sub + +#End Region + +#Region "MANTENIMIENTO" + + + + + Private Sub CargaMantenimento() + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + If ObjAF.GetMantenimientos(CveActivoFijo, UsuarioActual.CveEmpresa) Then + GvMantenimientos.DataSource = ObjAF.DtResultados + Else + GvMantenimientos.DataSource = Nothing + End If + ObjAF.Dispose() + + Else + GvMantenimientos.DataSource = DT_Mantenimiento + End If + + + GvMantenimientos.DataBind() + + UpMantenimientos.Update() + + End Sub + + + Protected Sub LnkAgregarMantenimiento_Click(sender As Object, e As EventArgs) + + + CveMantenimiento = -1 + IndexMantenimiento = -1 + + LblModaMantenimientoTitulo.Text = "Agregar Mantenimiento" + LnkModalAgregarMantenimiento.Text = "Agregar" + + + + TxtModalMantenimiento.Text = "" + TxtModalMantenimientoObservaciones.Text = "" + TxtModalMantenimientoFecha.Text = "" + TxtArchivoMantenimiento.Text = "[]" + + RegistraScript("$('#DVModalMantenimiento').modal('show');") + + UpModalMantenimiento.Update() + End Sub + + Protected Sub LnkGvMantenimientoEdit_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + 'CveMantenimiento, CveActivoFijo, Mantenimiento, Observaciones, Fecha, FechaIng, CveUsuario, Codigo, Descripcion, Usuario + + + If CveActivoFijo > 0 Then + CveMantenimiento = GvRow.DataKey("CveMantenimiento").ToEntero + Else + IndexMantenimiento = GvRow.RowIndex + End If + + + Dim Mantenimiento As String = GvRow.DataKey("Mantenimiento") + Dim Observaciones As String = GvRow.DataKey("Observaciones") + Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate + + TxtModalMantenimiento.Text = Mantenimiento + TxtModalMantenimientoObservaciones.Text = Observaciones + TxtModalMantenimientoFecha.Text = Fecha.ToString("dd/MM/yyyy") + TxtArchivoMantenimiento.Text = "[]" + + + LblModaMantenimientoTitulo.Text = "Actualizar Mantenimiento" + LnkModalAgregarMantenimiento.Text = "Actualizar" + + UpModalMantenimiento.Update() + + + RegistraScript("$('#DVModalMantenimiento').modal('show');") + End Sub + + Protected Sub LnkGvMantenimientoRemove_Click(sender As Object, e As EventArgs) + + Dim ErrorProceso As Boolean = False + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim IndexMantenimientoEliminar As Integer = GvRow.RowIndex + + If CveActivoFijo > 0 Then + Dim CveMantenimientoEliminar As Integer = GvRow.DataKey("CveMantenimiento").ToEntero + Dim ObjAF As New ClsAF + If ObjAF.RemoveMantenimientos(CveMantenimientoEliminar, UsuarioActual.CveEmpresa) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + ObjAF.Dispose() + + Else + + DT_Mantenimiento.Rows(IndexMantenimientoEliminar).Delete() + DT_Mantenimiento.AcceptChanges() + + End If + + + + + If Not ErrorProceso Then + Alert("Mantenimiento Eliminado Correctamente.") + CargaMantenimento() + End If + + End Sub + + + + Protected Sub LnkModalAgregarMantenimiento_Click(sender As Object, e As EventArgs) + Dim ErrorProceso As Boolean = False + Dim ObjAF As New ClsAF + ObjAF.IniciaTransacSQL() + + + If CveActivoFijo > 0 Then + + If CveMantenimiento > 0 Then + + Dim FileExtension As String = "" + Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos + Dim Filename As String = "-1" + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Filename = fileItem.filename + Exit For + Next + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimiento}.{FileExtension}")) + If Archivo.Exists() Then + Archivo.Delete() + End If + + + If Not Filename.FilesMove(String.Format("{0}", CveMantenimiento.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then + ErrorProceso = True + Alert("Error al mover Archivo", TipoMensaje.MsgError) + End If + + End If + + If Not ErrorProceso Then + If Not ObjAF.UpdateMantenimientos(CveMantenimiento, CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, $"{CveMantenimiento}.{FileExtension}") Then + ErrorProceso = True + End If + End If + Else + + Dim CveMantenimientoTemp As Integer = -1 + + CveMantenimientoTemp = ObjAF.AddMantenimientos(CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, "-1") + If CveMantenimientoTemp > 0 Then + ErrorProceso = False + Else + ErrorProceso = True + End If + + If Not ErrorProceso Then + + Dim FileExtension As String = "" + Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos + Dim Filename As String = "" + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Filename = fileItem.filename + Exit For + Next + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}AF\Mantenimientos\{1}", UsuarioActual.Empresa.Ruta, $"{CveMantenimientoTemp}.{FileExtension}")) + If Archivo.Exists() Then + Archivo.Delete() + End If + + + If Not Filename.FilesMove(String.Format("{0}", CveMantenimientoTemp.ToString), String.Format("{0}AF\Mantenimientos", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) Then + ErrorProceso = True + Alert("Error al mover Archivo", TipoMensaje.MsgError) + End If + + If Not ErrorProceso Then + If Not ObjAF.UpdateMantenimientos(CveMantenimientoTemp, CveActivoFijo, TxtModalMantenimiento.Text, TxtModalMantenimientoObservaciones.Text, TxtModalMantenimientoFecha.Text.ToDate, UsuarioActual.CveUsuario, $"{CveMantenimientoTemp}.{FileExtension}") Then + ErrorProceso = True + End If + End If + End If + End If + End If + + + + If Not ErrorProceso Then + TxtArchivoMantenimiento.Text = "" + UpModalMantenimiento.Update() + End If + + + If Not ErrorProceso Then + ObjAF.Commit() + ObjAF.Dispose() + + 'RegistraScript("$('#DVModalMantenimiento').modal('hide');") + 'Alert("Mantenimiento Guardado Correctamente.") + 'CargaMantenimento() + Else + ObjAF.RollBack() + ObjAF.Dispose() + End If + + + Else + + Dim Filesgral As List(Of Archivo) = TxtArchivoMantenimiento.getfiles().Archivos + + + If IndexMantenimiento >= 0 Then + + DT_Mantenimiento.Rows(IndexMantenimiento)("Mantenimiento") = TxtModalMantenimiento.Text + DT_Mantenimiento.Rows(IndexMantenimiento)("Observaciones") = TxtModalMantenimientoObservaciones.Text + DT_Mantenimiento.Rows(IndexMantenimiento)("Fecha") = TxtModalMantenimientoFecha.Text.ToDate + + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + + Dim fi As New FileInfo(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)) + + If fi.Exists Then + DT_Mantenimiento.Rows(IndexMantenimiento)("Archivo") = fi.FullName + End If + + Exit For + Next + End If + + DT_Mantenimiento.AcceptChanges() + + Else + + Dim nRow As DataRow = DT_Mantenimiento.NewRow + + nRow("Mantenimiento") = TxtModalMantenimiento.Text + nRow("Observaciones") = TxtModalMantenimientoObservaciones.Text + nRow("Fecha") = TxtModalMantenimientoFecha.Text.ToDate + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + + Dim fi As New FileInfo(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)) + + If fi.Exists Then + nRow("Archivo") = fi.FullName + End If + + Exit For + Next + End If + + DT_Mantenimiento.Rows.Add(nRow) + DT_Mantenimiento.AcceptChanges() + + End If + + TxtArchivoMantenimiento.Text = "" + + End If + + If Not ErrorProceso Then + RegistraScript("$('#DVModalMantenimiento').modal('hide');") + Alert("Mantenimiento Guardado Correctamente.") + CargaMantenimento() + End If + + + + End Sub + + Protected Sub LnkDescargaArcgivo_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Archivo As String = GvRow.DataKey("Archivo") + + Dim InfArchivo As FileInfo + + If CveActivoFijo > 0 Then + InfArchivo = New FileInfo($"{UsuarioActual.Empresa.Ruta}\AF\Mantenimientos\{Archivo}") + Else + InfArchivo = New FileInfo(Archivo) + End If + + If InfArchivo.Exists Then + + Response.Clear() + Response.AppendHeader("Content-Disposition", "attachment; filename=" + InfArchivo.Name) + Response.AppendHeader("Content-Length", InfArchivo.Length.ToString()) + Response.ContentType = "application/octet-stream" + Response.WriteFile(InfArchivo.FullName) + + Response.End() + + End If + + + + End Sub + + Protected Sub GvMantenimientos_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim Archivo As String = e.Row.DataKey("Archivo") + + If Archivo.Length > 0 Then + + + Dim InfArchivo As FileInfo + + If CveActivoFijo > 0 Then + InfArchivo = New FileInfo($"{UsuarioActual.Empresa.Ruta}\AF\Mantenimientos\{Archivo}") + Else + InfArchivo = New FileInfo(Archivo) + End If + + If InfArchivo.Exists Then + e.Row.FCLinkButton("LnkDescargaArcgivo").Visible = True + ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkDescargaArcgivo")) + End If + + + End If + + + End If + + End Sub + +#End Region + + +#Region "PLAGA ENFERMEDAD" + + + + Private Sub CargaPlagaEnfermedad() + + + + If CveActivoFijo > 0 Then + Dim ObjAF As New ClsAF + If ObjAF.GetPlagaEnfermedad(CveActivoFijo, UsuarioActual.CveEmpresa) Then + GvPlagaEnfermedad.DataSource = ObjAF.DtResultados + Else + GvPlagaEnfermedad.DataSource = Nothing + End If + + ObjAF.Dispose() + Else + GvPlagaEnfermedad.DataSource = DT_PlgaEfermedad + End If + + + GvPlagaEnfermedad.DataBind() + + UpPlagaEnfermedad.Update() + + End Sub + + + Protected Sub LnkAgregarPlagaEnfermedad_Click(sender As Object, e As EventArgs) + + + If CveActivoFijo > 0 Then + CvePlagaEnfermedad = -1 + Else + IndexProduccion = -1 + End If + + + LblModalTituloPlagaEnfermedad.Text = "Agregar Plaga Enfermedad" + LnkModalAgregarProduccion.Text = "Agregar" + + + + TxtModalPlagaEnfermedadObservaciones.Text = "" + TxtModalPlagaEnfermedadFecha.Text = "" + + RegistraScript("$('#DVModalPlagaEnfermedad').modal('show');") + + UpModalPlagaEnfermedad.Update() + End Sub + + Protected Sub LnkGvPlagaEnfermedadEdit_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + If CveActivoFijo > 0 Then + CvePlagaEnfermedad = GvRow.DataKey("CvePlagaEnfermedad").ToEntero + Else + IndexPlagaEnfermedad = GvRow.RowIndex + End If + + Dim Observaciones As String = GvRow.DataKey("Observaciones") + Dim Fecha As Date = GvRow.DataKey("Fecha").ToDate + + + TxtModalPlagaEnfermedadObservaciones.Text = Observaciones + TxtModalPlagaEnfermedadFecha.Text = Fecha.ToString("dd/MM/yyyy") + + + LblModalTituloPlagaEnfermedad.Text = "Actualizar plaga enfermedad" + LnkModalAgregarPlagaEnfermedad.Text = "Actualizar" + + UpModalPlagaEnfermedad.Update() + + + RegistraScript("$('#DVModalPlagaEnfermedad').modal('show');") + End Sub + + Protected Sub LnkGvPlagaEnfermedadRemove_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim ErrorProceso As Boolean = False + + If CveActivoFijo > 0 Then + Dim CvePlagaEnfermedadEliminar As Integer = GvRow.DataKey("CvePlagaEnfermedad").ToEntero + Dim ObjAF As New ClsAF + + If ObjAF.RemovePlagaEnfermedad(CvePlagaEnfermedadEliminar, UsuarioActual.CveEmpresa) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + + ObjAF.Dispose() + Else + + Dim IndexPlagaEnfermedadEliminar As Integer = GvRow.RowIndex + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedadEliminar).Delete() + DT_PlgaEfermedad.AcceptChanges() + ErrorProceso = False + + End If + + + If Not ErrorProceso Then + Alert("Plaga Enfermedad Eliminada Correctamente.") + CargaPlagaEnfermedad() + End If + + End Sub + + + + Protected Sub LnkModalAgregarPlagaEnfermedad_Click(sender As Object, e As EventArgs) + Dim ErrorProceso As Boolean = False + + + If CveActivoFijo > 0 Then + + Dim ObjAF As New ClsAF + If CvePlagaEnfermedad > 0 Then + If ObjAF.UpdatePlagaEnfermedad(CvePlagaEnfermedad, CveActivoFijo, TxtModalPlagaEnfermedadObservaciones.Text, TxtModalPlagaEnfermedadFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + Else + If ObjAF.AddPlagaEnfermedad(CveActivoFijo, TxtModalPlagaEnfermedadObservaciones.Text, TxtModalPlagaEnfermedadFecha.Text.ToDate, UsuarioActual.CveUsuario) Then + ErrorProceso = False + Else + ErrorProceso = True + End If + End If + ObjAF.Dispose() + + Else + + If IndexPlagaEnfermedad >= 0 Then + + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Observaciones") = TxtModalPlagaEnfermedadObservaciones.Text + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Fecha") = TxtModalPlagaEnfermedadFecha.Text.ToDate + DT_PlgaEfermedad.Rows(IndexPlagaEnfermedad)("Usuario") = UsuarioActual.Usuario + + Else + + Dim nRow As DataRow = DT_PlgaEfermedad.NewRow + + nRow("Observaciones") = TxtModalPlagaEnfermedadObservaciones.Text + nRow("Fecha") = TxtModalPlagaEnfermedadFecha.Text.ToDate + nRow("Usuario") = UsuarioActual.Usuario + + DT_PlgaEfermedad.Rows.Add(nRow) + + DT_PlgaEfermedad.AcceptChanges() + + + + End If + ErrorProceso = False + End If + + + + + If Not ErrorProceso Then + RegistraScript("$('#DVModalPlagaEnfermedad').modal('hide');") + Alert("Plaga Enfermedad guardada Correctamente.") + CargaPlagaEnfermedad() + End If + + End Sub + +#End Region + + + + End Class \ No newline at end of file diff --git a/AF/CatAF.aspx.vb b/AF/CatAF.aspx.vb index 14a3d44f4..46e3271d5 100644 --- a/AF/CatAF.aspx.vb +++ b/AF/CatAF.aspx.vb @@ -457,7 +457,7 @@ Partial Class AF_CatAF If DtActivosFijos.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\CatAF.rdlc", UsuarioActual.Empresa.Ruta)) Dim Ruta As String = "" params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) @@ -465,7 +465,7 @@ Partial Class AF_CatAF params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/AF/RepAF.aspx.vb b/AF/RepAF.aspx.vb index c22268a9c..bbd39fd61 100644 --- a/AF/RepAF.aspx.vb +++ b/AF/RepAF.aspx.vb @@ -326,15 +326,14 @@ Partial Class AF_RepAF Private Sub GenerarPDF(Optional Formato As String = "PDF") If DtActivosFijos.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/AF/RepDepreciacion.aspx.vb b/AF/RepDepreciacion.aspx.vb index 77c32ae7f..03b7aaf75 100644 --- a/AF/RepDepreciacion.aspx.vb +++ b/AF/RepDepreciacion.aspx.vb @@ -13,7 +13,7 @@ Partial Class AF_RepDepreciacion #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then - txtFechaI.Text = Now.ToString + txtFechaI.Text = New Date(Now.Year, Now.Month + 1, 1).AddDays(-1).ToString("dd/MM/yyyy") End If End Sub @@ -35,6 +35,7 @@ Partial Class AF_RepDepreciacion Dim CvePrePoliza = ObjConta.AddPrePolizas("Depreciacion", 74, 0, 0, 1, txtFechaI.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + For Each RowsDt As GridViewRow In GvDatos.Rows CveActivoFijo = RowsDt.DataKey("CveActivoFijo").ToEntero If RowsDt.FCLiteral("LtlDepreciacionMensual").Text.ToDouble > 0 And CveActivoFijo <> 0 Then diff --git a/Acarreos/RepContratosAcarreos.aspx.vb b/Acarreos/RepContratosAcarreos.aspx.vb index aecbfcb18..d67432b70 100644 --- a/Acarreos/RepContratosAcarreos.aspx.vb +++ b/Acarreos/RepContratosAcarreos.aspx.vb @@ -150,8 +150,6 @@ Partial Class Acarreos_RepContratosAcarreos If DdlAgrupador.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Agrupador: {0}", DdlAgrupador.SelectedItem.Text) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) @@ -159,7 +157,7 @@ Partial Class Acarreos_RepContratosAcarreos params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen}")) Else params.Add(New ReportParameter("LogoPath", "")) End If @@ -180,9 +178,6 @@ Partial Class Acarreos_RepContratosAcarreos If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin : {0}", txtFechaF.Text.ToDate.ToShortDateString) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) @@ -190,7 +185,7 @@ Partial Class Acarreos_RepContratosAcarreos params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/Acarreos/RepContratosAcarreosDetalle.aspx.vb b/Acarreos/RepContratosAcarreosDetalle.aspx.vb index 3b4191fe5..867f4b816 100644 --- a/Acarreos/RepContratosAcarreosDetalle.aspx.vb +++ b/Acarreos/RepContratosAcarreosDetalle.aspx.vb @@ -179,7 +179,6 @@ Partial Class Acarreos_RepContratosAcarreosDetalle If DTCont IsNot Nothing Then Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) @@ -202,7 +201,7 @@ Partial Class Acarreos_RepContratosAcarreosDetalle params.Add(New ReportParameter("VolF", LblVolFaltante.Text)) params.Add(New ReportParameter("PresF", LblPresFaltante.Text)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen}")) Else params.Add(New ReportParameter("LogoPath", "")) End If @@ -218,7 +217,7 @@ Partial Class Acarreos_RepContratosAcarreosDetalle If DTCont IsNot Nothing Then Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) @@ -241,7 +240,7 @@ Partial Class Acarreos_RepContratosAcarreosDetalle params.Add(New ReportParameter("VolF", LblVolFaltante.Text)) params.Add(New ReportParameter("PresF", LblPresFaltante.Text)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/Acarreos/RepPreEstimacionDetalle.aspx.vb b/Acarreos/RepPreEstimacionDetalle.aspx.vb index 0f8b67161..559972ceb 100644 --- a/Acarreos/RepPreEstimacionDetalle.aspx.vb +++ b/Acarreos/RepPreEstimacionDetalle.aspx.vb @@ -94,7 +94,7 @@ Partial Class Acarreos_RepPreEstimacionDetalle Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim params As New List(Of ReportParameter) @@ -103,7 +103,7 @@ Partial Class Acarreos_RepPreEstimacionDetalle params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen}")) Else params.Add(New ReportParameter("LogoPath", "")) End If @@ -127,7 +127,7 @@ Partial Class Acarreos_RepPreEstimacionDetalle Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim params As New List(Of ReportParameter) @@ -136,7 +136,7 @@ Partial Class Acarreos_RepPreEstimacionDetalle params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/Acumuladores/RepIndicadorDiario.aspx.vb b/Acumuladores/RepIndicadorDiario.aspx.vb index 460b62abe..f6c5c4fdd 100644 --- a/Acumuladores/RepIndicadorDiario.aspx.vb +++ b/Acumuladores/RepIndicadorDiario.aspx.vb @@ -193,8 +193,8 @@ Partial Class ACumuladores_RepIndicadorDiario If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) @@ -205,7 +205,7 @@ Partial Class ACumuladores_RepIndicadorDiario params.Add(New ReportParameter("AgrupadoPor", $"Filtros Por: {FechaIn} {FechaFn} {SubProyecto} ")) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 31e4184e0..d80321677 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -193,7 +193,7 @@ Public Class ClsContabilidad End Function Public Function AddPrePolizas(Modulo As String, CvePlantillaPoliza As Integer, Cargos As Double, Abonos As Double, CveMoneda As Integer, Fecha As Date, Concepto As String, CveUsuario As Integer, CveEmpresa As Integer, Optional FolioFijo As Integer = 0, Optional ReglaFolioPoliza As String = "", Optional CveTipoPoliza As Integer = -1, - Optional AgregarFolio As Boolean = False, Optional TipoContable As Integer = -1) As Integer + Optional AgregarFolio As Boolean = False, Optional TipoContable As Integer = 1) As Integer FolioPoliza = -1 Dim Retorno As Integer = -1 diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 4d153e356..4dcd35be4 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1611,17 +1611,18 @@ Public Class ClsInventarios End Function - Public Function GetExistenciasProductoSerie(CvePS As Integer, CveAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CveAlmacenes As String = "-1") As Boolean + Public Function GetExistenciasProductoSerie(CvePS As Integer, CveUsuario As Integer, CveEmpresa As Integer, Fecha As DateTime, Optional CveAlmacenes As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_ExistenciaPSSeriesGet") With SqlAdapter.SelectCommand.Parameters .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@CveAlmacen", SqlDbType.VarChar).Value = CveAlmacen + ' .Add("@CveAlmacen", SqlDbType.VarChar).Value = CveAlmacen .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveAlmacenes", SqlDbType.VarChar).Value = CveAlmacenes + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha End With Try diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 8d262bcc5..6d9a760da 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -221,9 +221,15 @@ Public Class ClsOIEventos End Sub #End Region - Public Sub IniciaTransacSQL() - SqlTransacc = SqlConexion.BeginTransaction() - End Sub + 'Public Sub IniciaTransacSQL() + ' SqlTransacc = SqlConexion.BeginTransaction() + + 'End Sub + + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc + End Function Public Sub RollBack() SqlTransacc.Rollback() End Sub diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index be991e0fc..319c6a699 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -1770,6 +1770,11 @@ Public Class ClsProductosServicios SqlAdapter.Fill(Data) Retorno = True Catch Ex1 As SqlException + + If Ex1.Message.Contains("Producto princial no encontrado:") Or Ex1.Message.Contains("Producto unificado no encontrado:") Then + Alert(Ex1.Message, TipoMensaje.MsgAdvertencia) + End If + OnError("Ocurrió un error al intentar Unificar los Productos o Servicios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) Catch ex As Exception OnError("Ocurrió un error al intentar Unificar los Productos o Servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index d2852c461..67d37fb3b 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -195,7 +195,7 @@ Public Class ClsVentas SqlAdapter.Fill(Data) retorno = True Catch ex As Exception - OnError("Ocurrió un error al actualizar venta manifiesto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al actualizar venta Orden de Producción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return retorno End Function @@ -2151,7 +2151,7 @@ Public Class ClsVentas End Function Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoAplicacion As String, - Optional CveMarca As Integer = -1, Optional EsDistribuidor As Integer = -1) As Integer + Optional CveMarca As Integer = -1, Optional EsDistribuidor As Integer = -1, Optional CvePromocionPadre As Integer = -1) As Integer Dim Retorno = -1 DataAdapter("PA_Vta_PromocionesAdd") @@ -2169,6 +2169,7 @@ Public Class ClsVentas .Add("@TipoAplicacion", SqlDbType.VarChar).Value = TipoAplicacion .Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@CvePromocionPadre", SqlDbType.Int).Value = CvePromocionPadre .Add("@CvePromocion", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -2181,6 +2182,30 @@ Public Class ClsVentas Return Retorno End Function + + + Public Function AddPromociones(CvePromocion As Integer, CveUsuario As Integer, CveEmpresa As Integer, Actualizar As Boolean) As Integer + Dim Retorno = -1 + DataAdapter("PA_Vta_PromocionesAddClonar") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePromocion", SqlDbType.Int).Value = CvePromocion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Actualizar", SqlDbType.Bit).Value = Actualizar + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CvePromocion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al agregar la Promoción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdatePromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CvePromocion As Integer, CveSubProyecto As Integer, TipoAplicacion As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional EsDistribuidor As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -2278,7 +2303,7 @@ Public Class ClsVentas Public Function AddPromocionesDetalle(CvePromocion As Integer, CvePS As Integer, TipoPromocion As Integer, Promocion As Double, PUAnterior As Double, PUPromocion As Double, AplicaRestriccion As Boolean, AplicaLunes As Boolean, AplicaMartes As Boolean, AplicaMiercoles As Boolean, AplicaJueves As Boolean, AplicaViernes As Boolean, AplicaSabado As Boolean, AplicaDomingo As Boolean, HoraInicio As DateTime, HoraFin As DateTime, Optional CantidadMinima As Integer = 1, - Optional CveClasificacion As Integer = -1, Optional CveRinTamaño As Integer = -1, Optional IncluyeImpuestos As Boolean = False) As Boolean + Optional CveClasificacion As Integer = -1, Optional CveRinTamaño As Integer = -1, Optional IncluyeImpuestos As Boolean = False, Optional Opcion As Integer = 1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesDetalleAdd") @@ -2304,6 +2329,7 @@ Public Class ClsVentas .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveRinTamaño", SqlDbType.Int).Value = CveRinTamaño .Add("@IncluyeImpuestos", SqlDbType.Bit).Value = IncluyeImpuestos + .Add("@Opcion", SqlDbType.Int).Value = Opcion End With Try @@ -2357,12 +2383,39 @@ Public Class ClsVentas Return Retorno End Function - Public Function RemovePromocionesDetalle(CvePromocionDetalle As Integer) As Boolean + Public Function SincronizarPromocionesClonar(CvePromocion As Integer, CveUsuario As Integer, CveEmpresa As Integer, Opcion As Integer) As Boolean + 'Opcion 1 replicar insert + 'Opcion 2 replicar actualización + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_PromocionesClonar") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePromocion", SqlDbType.Int).Value = CvePromocion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Opcion", SqlDbType.Int).Value = Opcion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError($"Ocurrió un error al actualizar las franquicias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + Public Function RemovePromocionesDetalle(CvePromocionDetalle As Integer, Optional Opcion As Integer = 1, Optional CvePromocion As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesDetalleRemove") With SqlAdapter.SelectCommand.Parameters .Add("@CvePromocionDetalle", SqlDbType.Int).Value = CvePromocionDetalle + .Add("@CvePromocion", SqlDbType.Int).Value = CvePromocion + .Add("@Opcion", SqlDbType.Int).Value = Opcion End With Try @@ -2374,6 +2427,7 @@ Public Class ClsVentas Return Retorno End Function + #End Region #Region "Pruebas" @@ -5474,20 +5528,14 @@ Public Class ClsVentas End Function - Public Function GetLineasAdicionales(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, TipoLinea As Integer, CveMoneda As Integer, - FechaI As Date, FechaF As Date, CveLineaAdicionalEstatus As Integer, CveEmpresa As Integer) As Boolean + Public Function GetLineasAdicionales(CveCliente As Integer, TipoLinea As Integer, CveMoneda As Integer, CveLineaAdicionalEstatus As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_LineasAdicionalesGet") With SqlAdapter.SelectCommand.Parameters - - .Add("@CveLineaAdicional", SqlDbType.Int).Value = CveLineaAdicional .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor .Add("@TipoLinea", SqlDbType.Int).Value = TipoLinea .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@CveLineaAdicionalEstatus", SqlDbType.Int).Value = CveLineaAdicionalEstatus .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index f72a279b9..ab0e74c3a 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -10371,6 +10371,8 @@ Namespace Modelos Telefono = "" UTCOffsetVerano = -7 UTCOffsetInvierno = -7 + Acum_PortalUsuario = "" + Acum_PortalContrasena = "" End Sub Public Sub New() MyBase.New() @@ -10409,6 +10411,8 @@ Namespace Modelos Public Property ImprimeNombre As String Public Property UTCOffsetVerano As Integer Public Property UTCOffsetInvierno As Integer + Public Property Acum_PortalUsuario As String + Public Property Acum_PortalContrasena As String End Class diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index 2f5a0ee5d..79411b565 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -101,98 +101,138 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState Try For Each dr As DataRow In ObjEventos.DtResultados.Rows - Dim cevent As CalendarEvent = New CalendarEvent() - cevent.id = dr("CveEvento").ToString.ToEntero - cevent.title = dr("Asunto").ToString - cevent.description = dr("Descripcion").ToString - cevent.start = String.Format("{0:s}", dr("FechaInicio").ToString.ToDateTime) - cevent.end = String.Format("{0:s}", dr("FechaFin").ToString.ToDateTime) - cevent.allDay = False - cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero - cevent.cveagendatipo = dr("CveAgendaTipo").ToString - cevent.prioridad = dr("CvePrioridad").ToString.ToEntero - cevent.backgroundColor = dr("BackGroundColor").ToString - cevent.recurrenciatipo = dr("RecurrenciaTipo").ToString.ToEntero - cevent.frecuencia = dr("Frecuencia").ToString.ToEntero - cevent.diassemana = dr("DiasSemana").ToString - cevent.dia = dr("Dia").ToString.ToEntero - cevent.mes = dr("Mes").ToString.ToEntero - cevent.recurrenciafin = dr("RecurrenciaFin").ToString - cevent.CveProspecto = dr("CveProspecto").ToString.ToEntero - cevent.Prospecto = dr("Prospecto").ToString - cevent.CveTipoEvento = dr("Prospecto").ToString.ToEntero - cevent.EmpresaCRM = dr("EmpresaCRM").ToString - cevent.SubProyecto = dr("SubProyecto").ToString - cevent.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero - cevent.Direccion = dr("Direccion").ToString - '11/05/2018 - Evento Gasto Recurrente - cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero - If cevent.CveTipoEvento = 10 Then - cevent.Importe = dr("Importe").ToString.ToDouble - End If + If dr("CveEventoEstatus").ToString.ToEntero <> 5 Then - If cevent.CveEventoEstatus.ToString.ToEntero = 3 Then - cevent.backgroundColor = "#1BBC9B" - End If + Dim cevent As CalendarEvent = New CalendarEvent() + cevent.id = dr("CveEvento").ToString.ToEntero + cevent.title = dr("Asunto").ToString + cevent.description = dr("Descripcion").ToString + cevent.start = String.Format("{0:s}", dr("FechaInicio").ToString.ToDateTime) + cevent.end = String.Format("{0:s}", dr("FechaFin").ToString.ToDateTime) + cevent.allDay = False + cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero + cevent.cveagendatipo = dr("CveAgendaTipo").ToString + cevent.prioridad = dr("CvePrioridad").ToString.ToEntero + cevent.backgroundColor = dr("BackGroundColor").ToString + cevent.recurrenciatipo = dr("RecurrenciaTipo").ToString.ToEntero + cevent.frecuencia = dr("Frecuencia").ToString.ToEntero + cevent.diassemana = dr("DiasSemana").ToString + cevent.dia = dr("Dia").ToString.ToEntero + cevent.mes = dr("Mes").ToString.ToEntero + cevent.recurrenciafin = dr("RecurrenciaFin").ToString + cevent.CveProspecto = dr("CveProspecto").ToString.ToEntero + cevent.Prospecto = dr("Prospecto").ToString + cevent.CveTipoEvento = dr("Prospecto").ToString.ToEntero + cevent.EmpresaCRM = dr("EmpresaCRM").ToString + cevent.SubProyecto = dr("SubProyecto").ToString + cevent.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero + cevent.Direccion = dr("Direccion").ToString - 'VERIFICAMOS SI TIENE O NO RECURRENCIA - If Not cevent.recurrenciatipo > 0 Then - - 'AGREGAMOS CUANDO NO ES RECURRENTE - Dim tFecha As DateTime = DateAdd(DateInterval.Month, -6, Date.Now) - 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA - If dr("FechaFin").ToString.ToDateTime > tFecha Or dr("FechaInicio").ToString.ToDateTime > tFecha Then - events.Add(cevent) + '11/05/2018 - Evento Gasto Recurrente + cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero + If cevent.CveTipoEvento = 10 Then + cevent.Importe = dr("Importe").ToString.ToDouble End If - Else - 'EMPIEZA METODO PARA AGREGAR CUANDO SI ES RECURRENTE + If cevent.CveEventoEstatus.ToString.ToEntero = 3 Then + cevent.backgroundColor = "#1BBC9B" + End If - Dim FinRecurrencia = cevent.recurrenciafin.ToEntero - Dim FI As DateTime, FF As DateTime, FT As DateTime - Dim DiasSemana = cevent.diassemana.Split(","c) - FI = cevent.start.ToDateTime - FF = cevent.end.ToDateTime + 'VERIFICAMOS SI TIENE O NO RECURRENCIA + If Not cevent.recurrenciatipo > 0 Then - 'OBTENEMOS LA FECHA TERMINO (FT) DE LA RECURRENCIA - Select Case FinRecurrencia - Case -1 - FT = DateAdd(DateInterval.Year, 2, dr("FechaInicio").ToString.ToDateTime) - Case 0 - FT = dr("RecurrenciaFin").ToString.ToDate - Case Is > 0 - FinRecurrencia -= 1 - Select Case cevent.recurrenciatipo - Case 1 - FT = DateAdd(DateInterval.Hour, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) - Case 2 - FT = DateAdd(DateInterval.Day, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) - Case 3 - FT = DateAdd(DateInterval.WeekOfYear, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) - FT = DateAdd(DateInterval.Day, (7 - Weekday(FT)).ToString.ToDouble, FT) - Case 4 - FT = DateAdd(DateInterval.Month, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) - Case 5 - FT = DateAdd(DateInterval.Year, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) - End Select - End Select + 'AGREGAMOS CUANDO NO ES RECURRENTE + Dim tFecha As DateTime = DateAdd(DateInterval.Month, -6, Date.Now) + 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA + If dr("FechaFin").ToString.ToDateTime > tFecha Or dr("FechaInicio").ToString.ToDateTime > tFecha Then + events.Add(cevent) + End If + Else - 'SI ES TIPO SEMANAL Y DIASSEMANA TIENE VALORES CHECKEA ESTOS VALORES - Do - If DiasSemana.Length > 0 AndAlso DiasSemana(0) <> "" Then - For Each drDias As String In DiasSemana - Dim FIT = FI, FFT = FF + 'EMPIEZA METODO PARA AGREGAR CUANDO SI ES RECURRENTE - FIT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FI)).ToString.ToDouble, FI) - FFT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FF)).ToString.ToDouble, FF) + Dim FinRecurrencia = cevent.recurrenciafin.ToEntero + Dim FI As DateTime, FF As DateTime, FT As DateTime + Dim DiasSemana = cevent.diassemana.Split(","c) + FI = cevent.start.ToDateTime + FF = cevent.end.ToDateTime + 'OBTENEMOS LA FECHA TERMINO (FT) DE LA RECURRENCIA + Select Case FinRecurrencia + Case -1 + FT = DateAdd(DateInterval.Year, 2, dr("FechaInicio").ToString.ToDateTime) + Case 0 + FT = dr("RecurrenciaFin").ToString.ToDate + Case Is > 0 + FinRecurrencia -= 1 + Select Case cevent.recurrenciatipo + Case 1 + FT = DateAdd(DateInterval.Hour, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) + Case 2 + FT = DateAdd(DateInterval.Day, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) + Case 3 + FT = DateAdd(DateInterval.WeekOfYear, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) + FT = DateAdd(DateInterval.Day, (7 - Weekday(FT)).ToString.ToDouble, FT) + Case 4 + FT = DateAdd(DateInterval.Month, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) + Case 5 + FT = DateAdd(DateInterval.Year, FinRecurrencia * cevent.frecuencia, dr("FechaInicio").ToString.ToDateTime) + End Select + End Select + + 'SI ES TIPO SEMANAL Y DIASSEMANA TIENE VALORES CHECKEA ESTOS VALORES + Do + If DiasSemana.Length > 0 AndAlso DiasSemana(0) <> "" Then + For Each drDias As String In DiasSemana + Dim FIT = FI, FFT = FF + + FIT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FI)).ToString.ToDouble, FI) + FFT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FF)).ToString.ToDouble, FF) + + cevent = New CalendarEvent() + cevent.id = dr("CveEvento").ToString.ToEntero + cevent.title = dr("Asunto").ToString + cevent.description = dr("Descripcion").ToString + cevent.start = String.Format("{0:s}", FIT) + cevent.end = String.Format("{0:s}", FFT) + cevent.allDay = False + cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero + cevent.cveagendatipo = dr("CveAgendaTipo").ToString + cevent.prioridad = dr("CvePrioridad").ToString.ToEntero + cevent.backgroundColor = dr("BackGroundColor").ToString + + cevent.recurrenciatipo = dr("RecurrenciaTipo").ToString.ToEntero + cevent.frecuencia = dr("Frecuencia").ToString.ToEntero + cevent.diassemana = dr("DiasSemana").ToString + cevent.dia = dr("Dia").ToString.ToEntero + cevent.mes = dr("Mes").ToString.ToEntero + cevent.recurrenciafin = dr("RecurrenciaFin").ToString + cevent.CveProspecto = dr("CveProspecto").ToString.ToEntero + cevent.Prospecto = dr("Prospecto").ToString + + '11/05/2018 - Evento Gasto Recurrente + cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero + If cevent.CveTipoEvento = 10 Then + cevent.Importe = dr("Importe").ToString.ToDouble + End If + + If cevent.CveEventoEstatus.ToString.ToEntero = 3 Then + cevent.backgroundColor = "#1BBC9B" + End If + + 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL Y/0 SI LA FECHA INICIAL DE LA RECURRENCIA ES MENOR A LA FECHA QUE SE CREO EL EVENTO NO LO AGREGA + If FIT > DateAdd(DateInterval.Month, -6, Date.Now) And FIT >= dr("FechaInicio").ToString.ToDateTime Then + events.Add(cevent) + End If + Next + Else cevent = New CalendarEvent() cevent.id = dr("CveEvento").ToString.ToEntero cevent.title = dr("Asunto").ToString cevent.description = dr("Descripcion").ToString - cevent.start = String.Format("{0:s}", FIT) - cevent.end = String.Format("{0:s}", FFT) + cevent.start = String.Format("{0:s}", FI) + cevent.end = String.Format("{0:s}", FF) cevent.allDay = False cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero cevent.cveagendatipo = dr("CveAgendaTipo").ToString @@ -218,69 +258,37 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.backgroundColor = "#1BBC9B" End If - 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL Y/0 SI LA FECHA INICIAL DE LA RECURRENCIA ES MENOR A LA FECHA QUE SE CREO EL EVENTO NO LO AGREGA - If FIT > DateAdd(DateInterval.Month, -6, Date.Now) And FIT >= dr("FechaInicio").ToString.ToDateTime Then + 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA + If FI > DateAdd(DateInterval.Month, -6, Date.Now) Then events.Add(cevent) End If - Next - Else - cevent = New CalendarEvent() - cevent.id = dr("CveEvento").ToString.ToEntero - cevent.title = dr("Asunto").ToString - cevent.description = dr("Descripcion").ToString - cevent.start = String.Format("{0:s}", FI) - cevent.end = String.Format("{0:s}", FF) - cevent.allDay = False - cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero - cevent.cveagendatipo = dr("CveAgendaTipo").ToString - cevent.prioridad = dr("CvePrioridad").ToString.ToEntero - cevent.backgroundColor = dr("BackGroundColor").ToString - - cevent.recurrenciatipo = dr("RecurrenciaTipo").ToString.ToEntero - cevent.frecuencia = dr("Frecuencia").ToString.ToEntero - cevent.diassemana = dr("DiasSemana").ToString - cevent.dia = dr("Dia").ToString.ToEntero - cevent.mes = dr("Mes").ToString.ToEntero - cevent.recurrenciafin = dr("RecurrenciaFin").ToString - cevent.CveProspecto = dr("CveProspecto").ToString.ToEntero - cevent.Prospecto = dr("Prospecto").ToString - - '11/05/2018 - Evento Gasto Recurrente - cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero - If cevent.CveTipoEvento = 10 Then - cevent.Importe = dr("Importe").ToString.ToDouble End If - If cevent.CveEventoEstatus.ToString.ToEntero = 3 Then - cevent.backgroundColor = "#1BBC9B" - End If + Select Case cevent.recurrenciatipo + Case 1 + FI = DateAdd(DateInterval.Hour, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Hour, cevent.frecuencia, FF) + Case 2 + FI = DateAdd(DateInterval.Day, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Day, cevent.frecuencia, FF) + Case 3 + FI = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FF) + Case 4 + FI = DateAdd(DateInterval.Month, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Month, cevent.frecuencia, FF) + Case 5 + FI = DateAdd(DateInterval.Year, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Year, cevent.frecuencia, FF) + End Select - 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA - If FI > DateAdd(DateInterval.Month, -6, Date.Now) Then - events.Add(cevent) - End If - End If + Loop Until FI > FT + End If - Select Case cevent.recurrenciatipo - Case 1 - FI = DateAdd(DateInterval.Hour, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Hour, cevent.frecuencia, FF) - Case 2 - FI = DateAdd(DateInterval.Day, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Day, cevent.frecuencia, FF) - Case 3 - FI = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FF) - Case 4 - FI = DateAdd(DateInterval.Month, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Month, cevent.frecuencia, FF) - Case 5 - FI = DateAdd(DateInterval.Year, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Year, cevent.frecuencia, FF) - End Select - Loop Until FI > FT End If + + Next Catch ex As Exception GuardaLog(ex.ToString()) diff --git a/Bancos/CatBancos.aspx.vb b/Bancos/CatBancos.aspx.vb index 0aee43f9b..f0546778c 100644 --- a/Bancos/CatBancos.aspx.vb +++ b/Bancos/CatBancos.aspx.vb @@ -218,12 +218,12 @@ Partial Class Bancos_CatBancos If DtBan IsNot Nothing AndAlso DtBan.Rows.Count > 0 Then Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/Bancos/CuentasBancarias.aspx.vb b/Bancos/CuentasBancarias.aspx.vb index ce28b5f56..74260599c 100644 --- a/Bancos/CuentasBancarias.aspx.vb +++ b/Bancos/CuentasBancarias.aspx.vb @@ -154,12 +154,12 @@ Partial Class Bancos_CuentasBancarias Private Sub Imprime(Formato As String) If DtBan IsNot Nothing AndAlso DtBan.Rows.Count > 0 Then Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 57848c6e1..5b5937e02 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -43,8 +43,8 @@ Partial Class Bancos_DepositosCaja DdlCajaChica.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta = 1", "", {"CveCuenta", "NumCuentaMoneda"}) DdlCajaChica.DataBind() - 'código temporal, para claudia y toñita, monge, anadelia, alba - If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897) Then + 'código temporal, para claudia y toñita, monge, anadelia, alba,patricia + If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then DdlCajaChica.Items.Add(New ListItem("Todas", "-1")) divFolio.Visible = True End If @@ -255,8 +255,8 @@ Partial Class Bancos_DepositosCaja CveTransaccionBanco = 6 End If - 'código temporal, para claudia y toñita, monge, anadelia, alba - If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897) Then + 'código temporal, para claudia y toñita, monge, anadelia, alba,patricia + If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then FolioIE = TxtFolio.Text.ToEntero End If diff --git a/Bancos/FluctuacionCambiaria.aspx.vb b/Bancos/FluctuacionCambiaria.aspx.vb index 9efa900c9..8bfe86260 100644 --- a/Bancos/FluctuacionCambiaria.aspx.vb +++ b/Bancos/FluctuacionCambiaria.aspx.vb @@ -139,10 +139,8 @@ Partial Class Bancos_FluctuacionCambiaria LtIndicador_CPPesosFinal.Text = Final.Abs.ToString.FormatoNumero LblComprasPerdidaGanancia.Text = If(Final < 0, "Ganancia", "Pérdida") - LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero - Else - GvProveedores.DataSource = Nothing - Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia) + LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero + End If ObjBancos.Dispose() GvProveedores.DataBind() @@ -179,10 +177,8 @@ Partial Class Bancos_FluctuacionCambiaria LtIndicador_CPPesosFinal.Text = Final.Abs.ToString.FormatoNumero LblComprasPerdidaGanancia.Text = If(Final > 0, "Ganancia", "Pérdida") - LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero - Else - GvProveedoresAnt.DataSource = Nothing - Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia) + LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero + End If ObjBancos.Dispose() GvProveedoresAnt.DataBind() @@ -220,10 +216,8 @@ Partial Class Bancos_FluctuacionCambiaria LblTotalVentas.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero - UpIndicadoresVentas.Visible = True - Else - GvVentas.DataSource = Nothing - Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia) + UpIndicadoresVentas.Visible = True + End If ObjBancos.Dispose() GvVentas.DataBind() @@ -257,10 +251,8 @@ Partial Class Bancos_FluctuacionCambiaria LblTotalVentasAnt.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero - UpIndicadoresVentas.Visible = True - Else - GvClientesAnt.DataSource = Nothing - Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia) + UpIndicadoresVentas.Visible = True + End If ObjBancos.Dispose() GvClientesAnt.DataBind() @@ -359,7 +351,7 @@ Partial Class Bancos_FluctuacionCambiaria Private Sub CargaDatosDeudores() Dim ObjBancos As New ClsBancos LblTotalDeudores.Text = "0.00" - If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 5, UsuarioActual.CveEmpresa) Then + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 9, UsuarioActual.CveEmpresa) Then GvDeudores.DataSource = ObjBancos.DtResultados LblTotalDeudores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero Else @@ -374,7 +366,7 @@ Partial Class Bancos_FluctuacionCambiaria Private Sub CargaDatosFiliales() Dim ObjBancos As New ClsBancos LblTotalAcreedores.Text = "0.00" - If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 7, UsuarioActual.CveEmpresa) Then + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 8, UsuarioActual.CveEmpresa) Then GvFiliales.DataSource = ObjBancos.DtResultados.FiltraParametros("Saldo > 0") LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero Else diff --git a/Bancos/FlujoDiario.aspx.vb b/Bancos/FlujoDiario.aspx.vb index e812818d7..b6b9367b0 100644 --- a/Bancos/FlujoDiario.aspx.vb +++ b/Bancos/FlujoDiario.aspx.vb @@ -51,7 +51,7 @@ Partial Class Bancos_FlujoDiario Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click Dim params As New List(Of ReportParameter) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) @@ -59,7 +59,7 @@ Partial Class Bancos_FlujoDiario params.Add(New ReportParameter("Fecha", TxtFecha.Text.ToDate.ToLongDateString)) If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) + params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) Else params.Add(New ReportParameter("LogoPath", "")) End If diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index 3cd458484..7406155c3 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -209,7 +209,7 @@