593 lines
27 KiB
VB.net
593 lines
27 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports System.IO
|
|
Imports System.Security.Cryptography.X509Certificates
|
|
Imports ADSNetLibrary.SIGAPI.Services.SAT.DescargaCFDI
|
|
Imports DocumentFormat.OpenXml.Spreadsheet
|
|
Imports Extensiones
|
|
|
|
Partial Class Site
|
|
Inherits BaseMasterPage
|
|
#Region "Propiedades"
|
|
|
|
Public Overrides Property EsPopup() As Boolean
|
|
Get
|
|
Return Convert.ToBoolean(HdnEsPopup.Value)
|
|
End Get
|
|
Set(value As Boolean)
|
|
HdnEsPopup.Value = value.ToString()
|
|
End Set
|
|
End Property
|
|
|
|
Public Overrides Property PopupWidth() As Integer
|
|
Get
|
|
Return HdnPopUpWidth.Value.ToEntero()
|
|
End Get
|
|
Set(value As Integer)
|
|
HdnPopUpWidth.Value = value.ToString()
|
|
End Set
|
|
End Property
|
|
Public Property userx As Usuario
|
|
Get
|
|
userx = DirectCast(ViewState("userx"), Usuario)
|
|
End Get
|
|
Set(value As Usuario)
|
|
ViewState("userx") = value
|
|
End Set
|
|
End Property
|
|
Public Property countNotificaciones As Integer
|
|
Get
|
|
countNotificaciones = If(IsNothing(ViewState("countNotificaciones")), 0, ViewState("countNotificaciones").ToString().ToEntero())
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("countNotificaciones") = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property UsuarioCve As Integer
|
|
Get
|
|
Return 15
|
|
End Get
|
|
Set(value As Integer)
|
|
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
#End Region
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
lblFecha.Text = DateTime.Now.ToString("dd.MMMyyyy HH:mm tt")
|
|
MasterChat.Visible = False
|
|
|
|
If Request("Masterimpoup") IsNot Nothing AndAlso Request("Masterimpoup").ToString() = "true" Then EsPopup = True
|
|
If UsuarioActual IsNot Nothing Then
|
|
HdnCveE.Value = UsuarioActual.CveEmpresa.ToString()
|
|
HdnCveU.Value = UsuarioActual.CveUsuario.ToString()
|
|
LitTit.Text = UsuarioActual.Empresa.EmpresaEncabezado
|
|
If UsuarioActual.CveUsuario = 100 Then
|
|
LitTit.Text = String.Format("<span style='color:white; font-size:x-large'></span> <span style='color: #32A1CF; font-size:x-large'>Mi Empresa de Ventas ({0})</span> ", UsuarioActual.CveEmpresa)
|
|
TxtTit.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.Empresa.CvePlataforma = 3 Then
|
|
lnkFavicon.Href = "/Imagenes/favicongps.ico"
|
|
tTitulo.Text = "SIGNALS GPS"
|
|
LnkDescargarManual.Visible = False
|
|
Else
|
|
lnkFavicon.Href = "/Imagenes/favicon.ico"
|
|
End If
|
|
|
|
Dim thisURL As String = Request.Url.Segments(Request.Url.Segments.Count - 1)
|
|
If thisURL.Equals("WizardRegistro.aspx") OrElse thisURL.Equals("Registro.aspx") Then
|
|
LitTit.Text = "<span style='color:white; font-size:x-large'>AD</span> <span style='color: #32A1CF; font-size:x-large'> Soluciones en TI</span> "
|
|
End If
|
|
|
|
userx = New Usuario
|
|
userx.Empresa = New Empresa
|
|
userx.Referencia = Encripta(UsuarioActual.CveUsuario.ToString())
|
|
userx.Usuario = Encripta(UsuarioActual.Usuario)
|
|
userx.Liga = Encripta(UsuarioActual.Rol)
|
|
|
|
If UsuarioActual.CvePersonal > 0 Then
|
|
DivPerfil.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.CveRol = 1 Then
|
|
userx.Empresa.Direccion = Encripta("-999")
|
|
userx.Empresa.Empresa = Encripta("ADSistemas")
|
|
Else
|
|
'.Empresa.Direccion = Encripta(UsuarioActual.Empresa.CveEmpresa)
|
|
'userx.Empresa.Empresa = Encripta(UsuarioActual.Empresa.Empresa)
|
|
End If
|
|
|
|
If UsuarioActual.CveRol = 1200 Then
|
|
dashboard.Visible = True
|
|
End If
|
|
|
|
If UsuarioActual.CvePlataforma = 6 Or UsuarioActual.CvePlataforma = 7 Then
|
|
header_search_bar.Visible = False
|
|
header_notification_bar.Visible = False
|
|
End If
|
|
|
|
If EsPopup Then
|
|
|
|
scriptoppner.Visible = True
|
|
divMenu.Visible = False
|
|
RegistraScript("$('#barradenavegacion').css({'display':'none'})")
|
|
divContenido.Attributes.CssStyle("background") = "white"
|
|
divpagecontainer.Attributes.CssStyle("margin") = "0px !important"
|
|
headertitleh3.Attributes.CssStyle("margin") = "0px !important"
|
|
divtopmenu.Visible = False
|
|
Else
|
|
'MyChat_Init(Nothing, Nothing)
|
|
|
|
'19/05/2018 - CARGA TIPO DE CAMBIO
|
|
'2018.08.14, se movió de la linea 59 a la actual
|
|
CargaTipoCambio()
|
|
|
|
CargaUsuario()
|
|
If UsuarioActual.Portal = False Then
|
|
CreaMenu()
|
|
'Configuracion()
|
|
CargaBuscadores()
|
|
End If
|
|
|
|
End If
|
|
CargarNotificaciones()
|
|
Else
|
|
|
|
Dim thisURL As String = Request.Url.Segments(Request.Url.Segments.Count - 1)
|
|
If thisURL.Equals("WizardRegistro.aspx") OrElse thisURL.Equals("Registro.aspx") Then
|
|
LitTit.Text = "<span style='color:white; font-size:x-large'>AD</span> <span style='color: #32A1CF; font-size:x-large'> Soluciones en TI</span> "
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
If UsuarioActual.CvePlataforma.Contiene(6, 7) Then
|
|
LiSideBar.Visible = False
|
|
End If
|
|
|
|
Else
|
|
'VALIDACION DE SEGURIDAD, EN LA QUE SE VALIDA QUE LA EMPRESA EN LA QUE SE GENERO LA PAGINA SEA LA MISMA A LA DE LA SESION,
|
|
'DE NO SER ASI, SE REDIRECCIONA A INICIO.
|
|
If UsuarioActual IsNot Nothing AndAlso (HdnCveE.Value <> UsuarioActual.CveEmpresa.ToString() OrElse HdnCveU.Value <> UsuarioActual.CveUsuario.ToString()) Then
|
|
Response.Redirect(FormsAuthentication.DefaultUrl)
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub CargaUsuario()
|
|
If UsuarioActual IsNot Nothing Then
|
|
'LtMasterNombre.Text = UsuarioActual.Nombre
|
|
LtMasterPerfil.Text = UsuarioActual.Rol
|
|
LtMasterUsuario.Text = UsuarioActual.Usuario
|
|
|
|
|
|
'DivConfiguracionEmpresa.Visible = True
|
|
' BtnConfiguracionEmpresa.Attributes.Add("onclick", String.Format("javascript:document.location.href='/Sistemas/Empresa.aspx?CveEmpresa={0}'", UsuarioActual.CveEmpresa))
|
|
BtnConfiguracionEmpresa.Visible = False
|
|
DivConfiguracionEmpresa.Visible = False
|
|
'loadchat()
|
|
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.ModoSimulacion Then
|
|
DivCambiarUsuario.Visible = True
|
|
BtnCambiarUsuario.Attributes.Add("onclick", "javascript:AbrirVentana('/Sistemas/PopUpCambiaUsuario.aspx');")
|
|
End If
|
|
If UsuarioActual.ModoSimulacionXEmpresa Then '.TienePermisoProceso(ADSSession.ADSSessionConfig.procesomodosimulacion) Then
|
|
DivCambiarUsuarioEmpresa.Visible = True
|
|
BtnCambiarUsuarioEmpresa.Attributes.Add("onclick", "javascript:AbrirVentana('/Sistemas/PopUpCambiaUsuarioEmpresa.aspx');")
|
|
End If
|
|
If UsuarioActual.MultipleEmpresa Then
|
|
BtnCambiarEmpresa.Attributes.Add("onclick", "javascript:AbrirVentana('/Sistemas/PopUpSeleccionarEmpresa.aspx');")
|
|
DivCambiarEmpresa.Visible = True
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
'Private Sub loadchat()
|
|
|
|
' If UsuarioActual.CveRol = 1 OrElse UsuarioActual.ModoSimulacion Then
|
|
' Dim GlobalDTUsuarios As DataTable = DirectCast(Application("GlobalDTUsuarios"), DataTable)
|
|
' Dim userconectedlist As List(Of Integer) = (From c In MyHub.usuarios Select c.CveUsuario Distinct).ToList
|
|
' Dim prefix As String = ""
|
|
' Dim userstring As New StringBuilder
|
|
' For Each item As Integer In userconectedlist
|
|
' userstring.AppendFormat("{0}{1} ", prefix, item)
|
|
' prefix = ","
|
|
' Next
|
|
' stringusers = userstring.ToString()
|
|
' If userconectedlist.Count > 0 Then
|
|
' GlobalDTUsuarios = GlobalDTUsuarios.FiltraParametros(String.Format("CveUsuario in ({0})", userstring))
|
|
' RptChatEmpresa.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa >1", "", {"CveEmpresa", "Empresa"})
|
|
' RptChatEmpresa.DataBind()
|
|
' End If
|
|
' MasterChat.Visible = True
|
|
|
|
' End If
|
|
'End Sub
|
|
'Private stringusers As String = "0"
|
|
'Private Sub RptChatEmpresa_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles RptChatEmpresa.ItemDataBound
|
|
' Dim CveEmpresa As Integer = e.Item.DataItem("CveEmpresa").ToString().ToEntero()
|
|
' Dim GlobalDTUsuarios As DataTable = DirectCast(Application("GlobalDTUsuarios"), DataTable).FiltraParametros(String.Format("CveUsuario in ({0}) AND CveEmpresa ={1}", stringusers, CveEmpresa))
|
|
|
|
' Dim rpthijo As Repeater = DirectCast(e.Item.FindControl("RPTChatuser"), Repeater)
|
|
' rpthijo.DataSource = GlobalDTUsuarios
|
|
' rpthijo.DataBind()
|
|
'End Sub
|
|
Private Sub CargaBuscadores()
|
|
'Proveedores
|
|
If UsuarioActual.TienePermisoPagina(37) Then tdProv.Visible = True
|
|
|
|
If UsuarioActual.TienePermisoPagina(679) Then tdProvBancos.Visible = True
|
|
|
|
'Clientes
|
|
If UsuarioActual.TienePermisoPagina(26) Then tdCliente.Visible = True
|
|
|
|
'Factura de Ventas
|
|
If UsuarioActual.TienePermisoPagina(6) Then tdVentas.Visible = True
|
|
|
|
'Personal
|
|
If UsuarioActual.TienePermisoPagina(46) Then tdPersonal.Visible = True
|
|
|
|
'Buscar Productos servicios
|
|
If UsuarioActual.TienePermisoPagina(13) Then tdBuscarPs.Visible = True
|
|
|
|
'Compras
|
|
If UsuarioActual.TienePermisoPagina(38) Then tdCompras.Visible = True
|
|
|
|
'Ordenes Servicio
|
|
If UsuarioActual.TienePermisoPagina(135) Then tdOS.Visible = True
|
|
|
|
'Ingresos / Egresos
|
|
If UsuarioActual.TienePermisoPagina(153) Then tdCheques.Visible = True
|
|
|
|
'Órdenes de Compra
|
|
If UsuarioActual.TienePermisoPagina(103) Then tdOC.Visible = True
|
|
|
|
'Cuando es Requisición
|
|
If UsuarioActual.TienePermisoPagina(250) Then tdOC.Visible = True
|
|
|
|
'Inventarios Movimientos
|
|
If UsuarioActual.TienePermisoPagina(219) Then TdMovInv.Visible = True
|
|
|
|
'Prospectos
|
|
If UsuarioActual.TienePermisoPagina(181) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx',980,547,'popBuscarProspectos');")
|
|
'ProspectosRedes
|
|
If UsuarioActual.TienePermisoPagina(183) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx?Opt=Redes',980,547,'popBuscarProspectos');")
|
|
'ProspectosG15
|
|
If UsuarioActual.TienePermisoPagina(187) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx?Opt=Atn',980,547,'popBuscarProspectos');")
|
|
'ProspectosSIP
|
|
If UsuarioActual.TienePermisoPagina(207) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospectos/PopUpBuscarProspectos.aspx?Opt=SIP',980,547,'popBuscarProspectos');")
|
|
|
|
If UsuarioActual.TienePermisoPagina(392) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospeccion/PopUpBuscarProspectos.aspx',980,547,'popBuscarProspectos');")
|
|
|
|
If UsuarioActual.TienePermisoPagina(228) OrElse UsuarioActual.TienePermisoPagina(6) Then tdBExi.Visible = True
|
|
|
|
'Contratos
|
|
If UsuarioActual.TienePermisoPagina(313) Then TdContratos.Visible = True
|
|
|
|
|
|
'BUSCAR MILITANTE
|
|
If UsuarioActual.TienePermisoPagina(1001) Then tdBuscarMilitante.Visible = True
|
|
|
|
'Orden Produccion'
|
|
If UsuarioActual.TienePermisoPagina(816) Then tdOP.Visible = True
|
|
|
|
'Produccion'
|
|
If UsuarioActual.TienePermisoPagina(823) Then tdP.Visible = True
|
|
|
|
'BUSCAR ACERCAMIENTO CRM'
|
|
If UsuarioActual.TienePermisoProceso(251) Then TdCRMAcercamientos.Visible = True
|
|
|
|
'Busca Activo Fijo
|
|
If UsuarioActual.TienePermisoPagina(62) Then TdBuscaActivoFijo.Visible = True
|
|
|
|
End Sub
|
|
|
|
Protected Sub CerrarSesion_Click(sender As Object, e As EventArgs) Handles BtnCerrarSesion.ServerClick
|
|
|
|
'If Request.ServerVariables("URL").ToUpper.Contiene("/PortalCliente/PortalCliente.aspx".ToUpper) Then
|
|
' UsuarioActual.CerrarSession(1)
|
|
'ElseIf Request.ServerVariables("URL").ToUpper.Contiene("/PortalProveedores/PortalProveedor.aspx".ToUpper) Then
|
|
' UsuarioActual.CerrarSession(2)
|
|
'Else
|
|
'MyHub.RemoveConexiones(UsuarioActual.CveUsuario)
|
|
Usuario.CerrarSession()
|
|
'End If
|
|
|
|
'UsuarioActual.Dispose()
|
|
End Sub
|
|
|
|
'Private Sub Configuracion()
|
|
' Dim dt As New DataTable
|
|
' dt.ReadXml(String.Format("{0}\Menu\ERP\{1}_Conf.xml", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveUsuario))
|
|
|
|
'End Sub
|
|
Private Function ArmarMenu(CveModulo As Integer, ByRef menuobj As MenuModal) As MenuModal
|
|
Dim listaModulos As EnumerableRowCollection(Of DataRow) = From i In menuobj.dt.AsEnumerable Where i!CvePadre.Equals(CveModulo) Order By i!Orden
|
|
Dim cveModuloActual As Integer
|
|
Dim liga As String
|
|
Dim modulo As String
|
|
Dim estilo As String
|
|
For Each drP As DataRow In listaModulos
|
|
cveModuloActual = drP("CveModulo").ToString().ToEntero()
|
|
|
|
liga = If(drP("PopUp").ToString() = "S", String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drP("LIGA"), drP("ANCHO"), drP("ALTO")), If(drP("IsAngular").ToString() = "1", String.Format("{1}:84{0}", drP("LIGA"), menuobj.strdomain), drP("LIGA").ToString()))
|
|
modulo = drP("Modulo").ToString()
|
|
estilo = If(drP("Estilo").ToString() <> "", String.Format("<i class='{0}'></i>", drP("Estilo")), "")
|
|
|
|
If menuobj.CveModuloSeleccionado = cveModuloActual Then
|
|
'menuobj.HeaderBar.AppendFormat("<li><i class='fa fa-angle-right'></i><a href='{0}'>{1}</a></li>", liga, modulo)
|
|
menuobj.headerstr.Add(String.Format("<li><i class='fa fa-angle-right'></i><a href='{0}'>{1}</a></li>", liga, modulo))
|
|
menuobj.CveModuloSeleccionadoPadre = CveModulo
|
|
menuobj.ScriptColorGrupoModulo = ColorPage(drP("CveGrupoModulo").ToString().ToEntero())
|
|
End If
|
|
|
|
menuobj.MenuHTML.AppendFormat("<li><a id='m{0}' href=""{1}"">{2}<span class='title'>{3}</span>", cveModuloActual, liga, estilo, modulo)
|
|
|
|
|
|
drP.Delete()
|
|
menuobj.dt.AcceptChanges()
|
|
If menuobj.dt.COUNT("CveModulo", String.Format("CvePadre ={0}", cveModuloActual)) > 0 Then
|
|
menuobj.MenuHTML.AppendFormat("<span id='j{0}'></span><span class='arrow '></span></a><ul class='sub-menu'>", cveModuloActual)
|
|
menuobj.modpadres.Add(modulo.RemoveDiacritics())
|
|
menuobj = ArmarMenu(cveModuloActual, menuobj)
|
|
menuobj.modpadres.RemoveAt(menuobj.modpadres.Count - 1)
|
|
|
|
If menuobj.CveModuloSeleccionadoPadre = cveModuloActual Then
|
|
|
|
|
|
menuobj.MenuHTML.Replace(String.Format("id='m{0}'", cveModuloActual), String.Format("id='m{0}' class='active open '", cveModuloActual))
|
|
menuobj.MenuHTML.Replace(String.Format("id='j{0}'", cveModuloActual), String.Format("id='j{0}' class='selected '", cveModuloActual))
|
|
|
|
'menuobj.MenuHTML = menuobj.MenuHTML.Replace(String.Format("id='m{0}'", cveModuloActual), String.Format("id='m{0}' class='active open'", cveModuloActual))
|
|
'menuobj.MenuHTML = menuobj.MenuHTML.Replace(String.Format("id='j{0}'", cveModuloActual), String.Format("id='j{0}' class='selected'", cveModuloActual))
|
|
menuobj.headerstr.Insert(0, String.Format("<li><i class='fa fa-angle-right'></i><a href='{0}'>{1}</a></li>", liga, modulo))
|
|
'menuobj.HeaderBar.AppendFormat("<li><i class='fa fa-angle-right'></i><a href='{0}'>{1}</a></li>", liga, modulo)
|
|
menuobj.CveModuloSeleccionadoPadre = CveModulo
|
|
End If
|
|
menuobj.MenuHTML.Append("</ul>")
|
|
Else
|
|
menuobj.MenuHTML.Append("</a>")
|
|
End If
|
|
|
|
menuobj.MenuHTML.AppendFormat("<a class='dnone'>{0}", modulo.RemoveDiacritics())
|
|
For Each items As String In menuobj.modpadres
|
|
menuobj.MenuHTML.Append("-")
|
|
menuobj.MenuHTML.AppendFormat("{0}", items)
|
|
|
|
Next
|
|
menuobj.MenuHTML.Append("</a>")
|
|
menuobj.MenuHTML.Append("</li>")
|
|
Next
|
|
Return menuobj
|
|
|
|
End Function
|
|
|
|
Private Sub CreaMenu()
|
|
Dim dt As New DataTable
|
|
|
|
If UsuarioActual.CveRol = 1200 Then
|
|
dt.ReadXml(String.Format("{0}\Menu\GPS\{1}.xml", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveUsuario))
|
|
Else
|
|
dt.ReadXml(String.Format("{0}\Menu\ERP\{1}.xml", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveUsuario))
|
|
End If
|
|
|
|
Dim menuobj = New MenuModal()
|
|
menuobj.dt = dt
|
|
menuobj.CveModuloSeleccionado = CveModulomasterpage.Text.ToEntero()
|
|
menuobj.strdomain = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, "").Replace("https://", "http://")
|
|
If Request.Url.Port <> 80 Then
|
|
menuobj.strdomain = menuobj.strdomain.Replace(String.Format(":{0}", Request.Url.Port), "")
|
|
End If
|
|
Dim newmenuobj As MenuModal = ArmarMenu(0, menuobj)
|
|
For Each stritem As String In menuobj.headerstr
|
|
menuobj.HeaderBar.Append(stritem)
|
|
Next
|
|
|
|
menuobj.HeaderBar.AppendFormat("{0}", menuobj.ScriptColorGrupoModulo)
|
|
BarraNavegacion.Text = menuobj.HeaderBar.ToString()
|
|
|
|
Menu.Text = menuobj.MenuHTML.ToString()
|
|
menuobj.MenuHTML.Clear()
|
|
menuobj.HeaderBar.Clear()
|
|
End Sub
|
|
|
|
Private Function ColorPage(value As Integer) As String
|
|
|
|
Select Case value
|
|
Case 1
|
|
Return "<script>$('body').addClass('ventasbody')</script>"
|
|
Case 2
|
|
Return "<script>$('body').addClass('comprasbody')</script>"
|
|
Case 3
|
|
Return "<script>$('body').addClass('bancosbody')</script>"
|
|
Case 4
|
|
Return "<script>$('body').addClass('ocomprabody')</script>"
|
|
Case 5
|
|
Return "<script>$('body').addClass('inventariosbody')</script>"
|
|
Case 6
|
|
Return "<script>$('body').addClass('oserviciobody')</script>"
|
|
Case 7
|
|
Return "<script>$('body').addClass('oibody')</script>"
|
|
Case 8
|
|
Return "<script>$('body').addClass('contabilidadbody')</script>"
|
|
Case 9
|
|
Return "<script>$('body').removeClass('rhumanosbody').addClass('rhumanosbody')</script>"
|
|
Case 10
|
|
Return "<script>$('body').addClass('afijosbody')</script>"
|
|
Case Else
|
|
Return ""
|
|
End Select
|
|
End Function
|
|
|
|
'Private Sub CargaMenu(Texto As StringBuilder)
|
|
' Menu.Text = Texto.ToString()
|
|
'End Sub
|
|
|
|
#Region "Notificaciones"
|
|
|
|
Private Sub CargarNotificaciones()
|
|
Dim Notificaciones As New StringBuilder
|
|
|
|
'Bienvenida
|
|
Notificaciones.Append(ItemNotificaciones("Bienvenido a SIG ", "Hoy", "fa fa-bullhorn"))
|
|
|
|
'Certificado
|
|
Dim fechacer As String = ConvertCER()
|
|
If fechacer = "" OrElse (((DateTime.Parse(fechacer).Month - Now.Month) < 2) AndAlso ((DateTime.Parse(fechacer).Year - Now.Year) < 1)) Then
|
|
Notificaciones.Append(ItemNotificaciones("Su certificado expira en: ", fechacer, Tipo:="warning"))
|
|
countNotificaciones = countNotificaciones + 1
|
|
Else
|
|
Notificaciones.Append(ItemNotificaciones("Su certificado expira en: ", fechacer))
|
|
End If
|
|
|
|
'C A R G A - A L E R T A S - O R D E N E S D E C O M P R A
|
|
If UsuarioActual.CveUsuario = 1459 Then
|
|
Dim OC As New ClsOC
|
|
If OC.GetOrdenesPendientes("-1", 0, UsuarioActual.CveEmpresa, -1, -1, -1, UsuarioActual.CveUsuario, -1) Then
|
|
If (OC.DtResultados.Rows.Count > 0) Then
|
|
Notificaciones.Append(ItemNotificaciones(String.Format("Orden de Compra por atender {0}", OC.DtResultados.Rows.Count), Ico:="fa fa-tags", Tipo:="warning", Link:="/OC/RepOC.aspx"))
|
|
countNotificaciones = countNotificaciones + 1
|
|
End If
|
|
End If
|
|
OC.Dispose()
|
|
End If
|
|
If UsuarioActual.TienePermisoProceso(303) Then
|
|
Using objgen As New ClsGenerales
|
|
pnlNotificacionSAT.Visible = True
|
|
objgen.SAT_DescargaSolicitudesAddNotificacionesCOUNT(UsuarioActual.CveEmpresa)
|
|
If objgen.DtResultados.Rows.Count > 0 Then
|
|
For Each dtrow As DataRow In objgen.DtResultados.Rows
|
|
If dtrow("Contador").ToString().ToEntero() > 0 Then
|
|
Notificaciones.Append(ItemNotificaciones(String.Format("Se registro una solicitud de descarga del SAT con {0} XML", dtrow("Contador")), Ico:="fa fa-tags", Tipo:="info", Link:=String.Format("javascript:$('#{0}').val({1});$('#{2}').click();", TxtCveNotisat.ClientID, dtrow("CveSolicitudSat").ToString().ToEntero(), btnoknotisat.ClientID), tonewpage:=False)) '
|
|
countNotificaciones = countNotificaciones + 1
|
|
|
|
End If
|
|
Next
|
|
End If
|
|
End Using
|
|
End If
|
|
|
|
''OC Pendientes por atender
|
|
'Dim OC As New ClsOC
|
|
'If OC.GetOrdenesPendientes("-1", 0, UsuarioActual.CveEmpresa, -1, -1, -1, UsuarioActual.CveUsuario, -1) Then
|
|
' Notificaciones.Append(ItemNotificaciones(String.Format("REQ/OC por atender: <b>{0}</b>", OC.DtResultados.Rows.Count), Tipo:=If(OC.DtResultados.Rows.Count > 3, "warning", "info"), Link:="/OC/RepOC.aspx"))
|
|
' If OC.DtResultados.Rows.Count > 0 Then
|
|
' countNotificaciones = countNotificaciones + 1
|
|
' End If
|
|
'End If
|
|
'OC.Dispose()
|
|
|
|
LtlMNotificaciones.Text = String.Format("{0}{1}", LtlMNotificaciones.Text, Notificaciones.ToString())
|
|
Notificaciones.Clear()
|
|
End Sub
|
|
|
|
|
|
Private Function ConvertCER() As String
|
|
Try
|
|
Dim Archivo As String = String.Format("{0}Certificados\{1}", UsuarioActual.Empresa.Ruta, UsuarioActual.Empresa.ArchivoCer)
|
|
If File.Exists(Archivo) Then
|
|
Dim CerFile As New FileStream(Archivo, FileMode.Open, FileAccess.Read)
|
|
Dim Size As Integer = CerFile.Length.ToString().ToEntero()
|
|
Dim Data As Byte() = New Byte(Size - 1) {}
|
|
Size = CerFile.Read(Data, 0, Size)
|
|
CerFile.Close()
|
|
CerFile.Dispose()
|
|
|
|
Dim x509 As New X509Certificate2()
|
|
x509.Import(Data)
|
|
Dim Retorno = x509.NotAfter.ToShortDateString()
|
|
x509 = Nothing
|
|
Data = Nothing
|
|
Return Retorno
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Return ""
|
|
End Try
|
|
Return ""
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "TIPO DE CAMBIO"
|
|
Private Sub CargaTipoCambio()
|
|
|
|
If Application("TipoCambioActual") Is Nothing Then
|
|
'sino existe el dato, lo carga por ser la primera vez
|
|
Application("TipoCambioActual") = GetTipoCambio()
|
|
Else
|
|
Dim TCA As TipoCambioActual = CType(Application("TipoCambioActual"), TipoCambioActual)
|
|
If TCA.Fecha <> DateTime.Today Then
|
|
Application("TipoCambioActual") = GetTipoCambio()
|
|
End If
|
|
End If
|
|
lblTipoCambio.Text = String.Format(" | TC {0:C4}", CType(Application("TipoCambioActual"), TipoCambioActual).TipoCambio)
|
|
|
|
End Sub
|
|
|
|
Private Function GetTipoCambio() As TipoCambioActual
|
|
'Dim Retorno As TipoCambioActual
|
|
|
|
Dim TCT As Decimal = 0
|
|
Dim ObjGenerales As ClsGenerales = New ClsGenerales
|
|
If ObjGenerales.GetTipoCambio(-1, DateTime.Today) Then
|
|
|
|
If ObjGenerales.DtResultados.Rows.Count > 0 Then
|
|
TCT = ObjGenerales.DtResultados(0)("TipoCambio").ToString().ToDecimal()
|
|
End If
|
|
|
|
End If
|
|
ObjGenerales.Dispose()
|
|
|
|
Return New TipoCambioActual With {.Fecha = DateTime.Today, .TipoCambio = TCT}
|
|
End Function
|
|
|
|
|
|
#End Region
|
|
Protected Sub btnoknotisat_Click(sender As Object, e As EventArgs)
|
|
|
|
GVnotiFoliosSAT.DataSource = New DataTable()
|
|
Using objgen As New ClsGenerales
|
|
objgen.SAT_DescargaSolicitudesAddNotificaciones(UsuarioActual.CveEmpresa, TxtCveNotisat.Text.ToEntero())
|
|
GVnotiFoliosSAT.DataSource = objgen.DtResultados
|
|
End Using
|
|
GVnotiFoliosSAT.DataBind()
|
|
UpNotificacionesFoliosSAT.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal();", pnlNotificacionSAT.ClientID))
|
|
End Sub
|
|
Protected Sub LnkDescargarManual_Click(sender As Object, e As EventArgs)
|
|
Dim ruta As String = $"{ModExtensiones.DirectorioEmpresas}Grales\ManualSIG.pdf"
|
|
|
|
Dim Archivo As New System.IO.FileInfo(ruta)
|
|
|
|
Try
|
|
If Archivo IsNot Nothing Then
|
|
If Archivo.Exists Then
|
|
|
|
HttpContext.Current.Response.Clear()
|
|
HttpContext.Current.Response.ClearContent()
|
|
HttpContext.Current.Response.ContentType = "application/octet-stream"
|
|
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", "Manual Plataforma SIG 2021.pdf"))
|
|
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
|
HttpContext.Current.Response.TransmitFile(ruta)
|
|
Response.Flush() ' send it to the client to download
|
|
HttpContext.Current.Response.SuppressContent = True
|
|
HttpContext.Current.ApplicationInstance.CompleteRequest()
|
|
Response.End()
|
|
|
|
Else
|
|
Alert("El archivo no existe", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
End Try
|
|
End Sub
|
|
End Class |