diff --git a/AF/AF.aspx b/AF/AF.aspx index 9c9d4f745..f80e7a164 100644 --- a/AF/AF.aspx +++ b/AF/AF.aspx @@ -1,11 +1,17 @@ <%@ Page Title="AF - Activo Fijo" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="AF.aspx.vb" Inherits="AF_AF" ValidateRequest="false" EnableEventValidation="false" %> + +   + + + +
  • @@ -932,6 +938,101 @@ + + <%-- Documentos --%> +
    +
    +
    +
    + Documentos +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + @@ -1496,9 +1597,8 @@ - -
    IMAGEN
    -
    <%# Container.ItemIndex + 1 %>
    + +
    <%# Container.ItemIndex + 1 %> - <%# CType(Eval("FechaIng"), DateTime).ToString("dd/MM/yyyy") %>
    @@ -3658,7 +3758,108 @@ - + <%--modal parametros documentos--%> + + + <%--modalupluad doc--%> + + <%-- --%> @@ -4074,6 +4275,7 @@ setTimeout(function () { startTimer(request); }, 30000); // callback } + @@ -4088,6 +4290,9 @@ .cbp-popup-lightbox-figure { background-color: #FFF; } + .orange { + background-color: orangered; + } diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index 608f2bbdf..32714e22c 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -7,8 +7,7 @@ Imports System.Data Imports Microsoft.Reporting.WebForms Imports ZXing Imports Newtonsoft.Json.Linq - -Partial Class AF_AF +Partial Class AF_AF Inherits ClsPaginas 'Configuración @@ -376,8 +375,8 @@ Partial Class AF_AF InicializaValores() - CargaCombos() - + + If Request("CveActivoFijo") IsNot Nothing AndAlso IsNumeric(Request("CveActivoFijo")) AndAlso Request("CveActivoFijo").ToEntero > 0 Then ViewState("CveActivoFijo") = Request("CveActivoFijo") CargaDatos() @@ -388,6 +387,9 @@ Partial Class AF_AF CargaPlagaEnfermedad() ModalidadesPaginaAF() + CargaDocumentacion() + + 'Configuración de Modalidad Update BtnGuardar.Text = "Guardar Cambios" LtlTitulo.Text = "Consulta del Activo Fijo:" @@ -396,7 +398,8 @@ 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;") LtlTareaNueva.Text = String.Format(" Tarea", CveActivoFijo) - Else + Else + CargaCombos() ViewState("CveActivoFijo") = -1 @@ -939,7 +942,7 @@ Partial Class AF_AF TxtValorCompra.Text = ObjActivoFijo.ValorCompra.ToString.FormatoNumero TxtFechaCompra.Text = ObjActivoFijo.FechaCompra.ToShortDateString TxtValorCompraMN.Text = ObjActivoFijo.ValorCompraMN.ToString.FormatoNumero - If ObjActivoFijo.ValorCompra <> ObjActivoFijo.ValorCompraMN Then DivValorCompraMN.visible = True + If ObjActivoFijo.ValorCompra <> ObjActivoFijo.ValorCompraMN Then DivValorCompraMN.Visible = True TxtFechaBaja.Text = If(ObjActivoFijo.FechaBaja = New Date(1900, 1, 1), "", ObjActivoFijo.FechaBaja.ToString("dd/MM/yyyy")) @@ -4946,4 +4949,531 @@ Partial Class AF_AF RegistraScript("$('#ModalContaCuenta').modal('show');") End Sub +#Region "D O C U M E N T O S" + + Private Property DTDocumentacion As DataTable + Get + If ViewState("DTDocumentacion") Is Nothing Then + ViewState("DTDocumentacion") = New DataTable + End If + Return DirectCast(ViewState("DTDocumentacion"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTDocumentacion") = value + End Set + End Property + + Private Property DocumentoParametros As String + Get + If ViewState("DocumentoParametros") Is Nothing Then + Return "" + Else + Return ViewState("DocumentoParametros").ToString + End If + End Get + Set(value As String) + ViewState("DocumentoParametros") = value + End Set + End Property + + + Property CveDocumentacion As Integer + Get + If ViewState("CveDocumentacion") Is Nothing Then + Return -1 + Else + Return DirectCast(ViewState("CveDocumentacion"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CveDocumentacion") = value + End Set + End Property + Property CveDocumentacionElectronica As Integer + Get + If ViewState("CvePersonalClienteDocumentacion") Is Nothing Then + Return -1 + Else + Return DirectCast(ViewState("CvePersonalClienteDocumentacion"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CvePersonalClienteDocumentacion") = value + End Set + End Property + Property ActualizarDocumentacion As Boolean + Get + If ViewState("ActualizarDocumentacion") Is Nothing Then + Return True + Else + Return DirectCast(ViewState("ActualizarDocumentacion"), Boolean) + End If + End Get + Set(value As Boolean) + ViewState("ActualizarDocumentacion") = value + End Set + End Property + + Property Documentacion As String + Get + If ViewState("Documentacion") Is Nothing Then + Return "-1" + Else + Return ViewState("Documentacion").ToString() + End If + End Get + Set(value As String) + ViewState("Documentacion") = value + End Set + End Property + Property AdjuntoDocumentacion As String + Get + If ViewState("AdjuntoDocumentacion") Is Nothing Then + Return "" + Else + Return ViewState("AdjuntoDocumentacion").ToString() + End If + End Get + Set(value As String) + ViewState("AdjuntoDocumentacion") = value + End Set + End Property + + Private Property FechaLimite As Date + Get + If ViewState("FechaLimite") Is Nothing Then + Return NowADS().AddDays(15) + Else + Return ViewState("FechaLimite").ToString().ToDate + End If + End Get + Set(value As Date) + ViewState("FechaLimite") = value + End Set + + End Property + + Property ObservacionDocumentacion As String + Get + If ViewState("ObservacionDocumentacion") Is Nothing Then + Return "" + Else + Return ViewState("ObservacionDocumentacion").ToString() + End If + End Get + Set(value As String) + ViewState("ObservacionDocumentacion") = value + End Set + End Property + + Private Sub CargaDocumentacion() + + If CveActivoFijo > 0 Then + Dim objRH As New ClsEdocumentacion() + + If objRH.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.Empresa.CveEmpresa, -1, CveActivoFijo:=CveActivoFijo, Modulo:=9) Then + DTDocumentacion = objRH.DtResultados + End If + + If DTDocumentacion.Rows.Count > 0 Then + GvDocumentos.DataSource = DTDocumentacion + Else + GvDocumentos.DataSource = Nothing + End If + + objRH.Dispose() + + GvDocumentos.DataBind() + + UpGvDocumentos.Update() + + End If + + End Sub + + Protected Sub GvDocumentos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentos.RowDataBound + + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString() + Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato") + + Dim ImgDownLoad As LinkButton = e.Row.FCLinkButton("ImgDownLoad") + Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired") + Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite") + Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False) + Dim chkEstatus As CheckBox = e.Row.FCCheckBox("chkEstatus") + Dim documentacionFormato As String = e.Row.DBCampo("DocumentacionFormato").ToString() + Dim Documentacion As String = e.Row.DBCampo("Documentacion").ToString() + Dim _CveDocumentacion As Integer = e.Row.DBCampo("CveDocumentacion").ToString().ToEntero() + Dim separado As Char() = ".".ToString().ToCharArray + Dim array() As String = Adjunto.Split(separado) + Dim extencion As String = "" + Dim existeAdjunto As Boolean = False + Dim TxtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia") + ' FechaVigencia + + Dim DiasLimite As Integer = e.Row.DataKey("DiasLimite").ToString().ToEntero() + Dim AplicaDiasLimite As Boolean = If(e.Row.DataKey("AplicaDiasLimite").ToString() = "1", True, False) + Dim AplicaFechaVencimiento As Boolean = If(e.Row.DataKey("AplicaFechaVencimiento").ToString() = "1", True, False) + + txtFechaLimite.Visible = If(AplicaDiasLimite, True, False) + TxtFechaVigencia.Visible = If(AplicaFechaVencimiento, True, False) + + + + Dim scripMascara As String = " $('#" & TxtFechaVigencia.ClientID & "').mask('00/00/0000');" + RegistraScript(scripMascara) + If array.Length > 0 Then + extencion = array(array.Length - 1) + End If + + If e.Row.DBCampo("Estatus").ToString().ToEntero() = 1 Then + chkEstatus.Checked = True + Else + chkEstatus.Checked = False + End If + + If documentacionFormato = "" Then + ImgDownLoadFormato.Visible = False + Else + Dim linkDescarga As String = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato + ImgDownLoadFormato.Visible = True + ScriptManager.GetCurrent(Me.Page).RegisterPostBackControl(ImgDownLoadFormato) + End If + + txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString().ToDate.ToString("dd/MM/yyyy") + + If Adjunto.Trim.Length > 0 Then + + Dim linkDescarga As String = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/AF/" & CveActivoFijo & "/" & Adjunto + Dim linkDescargaArchivo As String = UsuarioActual.Empresa.Ruta & "AF/" & CveActivoFijo & "/" & Adjunto + + If File.Exists(linkDescargaArchivo) Then + + ImgDownLoad.Visible = True + ScriptManager.GetCurrent(Me).RegisterPostBackControl(ImgDownLoad) + + Else + ImgDownLoad.Visible = False + End If + + Else + ImgDownLoad.Visible = False + End If + + If requerido Then + ImgRequired.Text = " " + Else + ' ImgRequired.Text = " " + End If + + End If + + End Sub + + + + + Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString().ToEntero() + Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato") + + + DescarFormato(DocumentacionFormato) + + 'Dim ObjEdoc As New ClsEdocumentacion + + 'If ObjEdoc.GetDocumentacionParametros(-1, CveDocumentacion, UsuarioActual.CveEmpresa) Then + ' If ObjEdoc.DtResultados.Rows.Count > 0 Then + + ' GvParametros.DataSource = ObjEdoc.DtResultados + ' ObjEdoc.Dispose() + + ' GvParametros.DataBind() + ' UpGvParametros.Update() + + ' DocumentoParametros = DocumentacionFormato + ' RegistraScript("$('#DVDescargaDocumentoParametrosModal').modal('show')") + + ' Else + ' ObjEdoc.Dispose() + ' DescarFormato(DocumentacionFormato) + ' End If + 'Else + ' ObjEdoc.Dispose() + 'End If + + End Sub + + Public Sub DescarFormato(documento As String) + + Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory + Dim PathSource As String + Dim pathDesti As String + + PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento + pathDesti = PathRoot & "Temp\" & CveActivoFijo & documento + + If File.Exists(pathDesti) Then + File.Delete(pathDesti) + End If + + File.Copy(PathSource, pathDesti) + + 'Dim objDoc As New clsGemBoxDocument(pathDesti) + 'Dim objRH As New ClsRH + 'objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa)) + 'objRH.Dispose() + + 'objDoc.Guardar(pathDesti) + + Dim fileinfo As New FileInfo(pathDesti) + + Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) + DescargarArchivo(fileinfo.FullName) + 'baseUrl = baseUrl & "/temp/" & fileinfo.Name + 'RegistraScript("Download('" & baseUrl & "')") + + End Sub + + Public Sub UploadModal_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim chkEstatus As CheckBox + CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString().ToEntero() + CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString().ToEntero() + Documentacion = GvRow.DataKey("Documentacion") + AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString() + + chkEstatus = GvRow.FCCheckBox("chkEstatus") + + + + ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper + FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + AdjuntoDocumentacion = GvRow.DataKey("Adjunto") + + LtlTitulofirmaContrato.Text = "Subir " & Documentacion + + UpTituloFirma.Update() + + RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal({ backdrop: 'static', keyboard: false});") + End Sub + Protected Sub ImgDownLoad_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim Adjunto As String = GvRow.DataKey("Adjunto").ToString() + Dim ArchivoPath As String = UsuarioActual.Empresa.Ruta & "AF/" & CveActivoFijo & "/" & Adjunto + + DescargarArchivo(ArchivoPath) + + End Sub + + Protected Sub DescargarArchivo(rutaArchivo As String) + + If System.IO.File.Exists(rutaArchivo) Then + + Dim nombreArchivo As String = System.IO.Path.GetFileName(rutaArchivo) + Response.Clear() + Response.ContentType = "application/octet-stream" + Response.AddHeader("Content-Disposition", "attachment; filename=" & nombreArchivo) + Response.AddHeader("Content-Length", New System.IO.FileInfo(rutaArchivo).Length.ToString()) + Response.WriteFile(rutaArchivo) + Response.End() + + Else + + End If + End Sub + + Protected Sub LnkDescargaFormatoParametros_Click(sender As Object, e As EventArgs) + + 'Dim ListaTagsDocumentost As New List(Of TagsDocumentos) + 'Dim ObjRH As New ClsRH + 'ListaTagsDocumentost = ObjRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa) + 'ObjRH.Dispose() + + 'For Each GvRow As GridViewRow In GvParametros.Rows + + ' If GvRow.FCTextBox("TxtParametro").Text.Trim.Length > 0 Then + ' ListaTagsDocumentost.Add(New TagsDocumentos(GvRow.DataKey("Parametro"), GvRow.FCTextBox("TxtParametro").Text)) + ' End If + 'Next + 'Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory + 'Dim PathSource As String + 'Dim pathDesti As String + + 'PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & DocumentoParametros + 'pathDesti = PathRoot & "Temp\" & CveActivoFijo & DocumentoParametros + + 'If File.Exists(pathDesti) Then + ' File.Delete(pathDesti) + 'End If + + 'File.Copy(PathSource, pathDesti) + + 'Dim objDoc As New clsGemBoxDocument(pathDesti) + 'objDoc.SustituirTags(ListaTagsDocumentost) + 'objDoc.Guardar(pathDesti) + + 'Dim fileinfo As New FileInfo(pathDesti) + + 'Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) + 'baseUrl = baseUrl & "/temp/" & fileinfo.Name + + 'RegistraScript("$('#DVDescargaDocumentoParametrosModal').modal('hide')", "500") + 'RegistraScript("Download('" & baseUrl & "')") + + + End Sub + + + Protected Sub BtnModalFirmaContratoDocumentoUpload_Click(sender As Object, e As EventArgs) Handles BtnModalFirmaContratoDocumentoUpload.Click + + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = TxtFileFirmaContrato.getfiles().Archivos + Dim Filename As String = "" + + + For Each fileItem As Archivo In Filesgral + Try + + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\" & Documentacion & "." & FileExtension + Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\" & AdjuntoDocumentacion + + If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\") Then + System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\") + End If + + If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then + File.Delete(rutaAdjuntoAnterior) + End If + + If System.IO.File.Exists(rutaDestino) Then + System.IO.File.Delete(rutaDestino) + End If + + System.IO.File.Move(fileItem.FileUrl, rutaDestino) + + Dim objRH As New ClsEdocumentacion + + + If CveDocumentacionElectronica = -1 Then + If objRH.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, CveActivoFijo:=CveActivoFijo) > 0 Then + + End If + Else + If objRH.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, CveActivoFijo:=CveActivoFijo) Then + + End If + End If + + objRH.Dispose() + + GuardarDocumentosFirmaContrato(CveDocumentacion) + 'CargaDocumentacion() + + + TxtFileFirmaContrato.Text = "" + UpModalFirmaContratoDocumento.Update() + + Catch ex As Exception + OnError("Error al cargar archivo", ex) + End Try + + Next + RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal('hide')", "hidemodal7") + + End Sub + + Private Sub GuardarDocumentosFirmaContrato(Optional _CveDocumentacionExcluir As Integer = -1) + + Dim hasError As Boolean = True + Dim objDocumentos As New ClsEdocumentacion + + For Each dRow As GridViewRow In GvDocumentos.Rows + + + Dim _CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToString().ToEntero() + Dim _Adjunto As String = dRow.DataKey("Adjunto") + 'Dim _Documentacion As String = dRow.DataKey("Documentacion") + Dim _CveDocumentacionElectronica As Integer = dRow.DataKey("CveDocumentacionElectronica").ToString().ToEntero() + Dim _txtObservaciones As TextBox = dRow.FCTextBox("TxtObservaciones") + Dim _TxtFechaLimite As TextBox = dRow.FCTextBox("TxtFechaLimite") + Dim _TxtFechaVigencia As TextBox = dRow.FCTextBox("TxtFechaVigencia") + Dim chkEstatus As CheckBox = dRow.FCCheckBox("chkEstatus") + Dim _estatus As Integer + + _estatus = If(dRow.DataKey("Estatus").ToString().ToUpper = "TRUE", 1, 0) + + Dim _FechaVigencia As Date + Dim _FechaLimite As Date + + Dim DiasLimite As Integer = dRow.DataKey("DiasLimite").ToString().ToEntero() + Dim AplicaDiasLimite As Boolean = If(dRow.DataKey("AplicaDiasLimite").ToString() = "1", True, False) + Dim AplicaFechaVencimiento As Boolean = If(dRow.DataKey("AplicaFechaVencimiento").ToString() = "1", True, False) + + If _TxtFechaVigencia.Text.Length = 10 Then + _FechaVigencia = _TxtFechaVigencia.Text.ToDate + Else + _FechaVigencia = Nothing + End If + + If Not AplicaDiasLimite Then + _FechaLimite = MinFecha + Else + _FechaLimite = _TxtFechaLimite.Text.ToDate + End If + + If Not AplicaFechaVencimiento Then + _FechaVigencia = MinFecha + End If + + + If Not _CveDocumentacionExcluir = _CveDocumentacion Then + Try + If _CveDocumentacionElectronica = -1 Then + + If objDocumentos.DocumentacionElectronicaAdd(_CveDocumentacion, -1, -1, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia, CveActivoFijo:=CveActivoFijo) > 0 Then + Else + hasError = True + Exit For + End If + + Else + If objDocumentos.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, -1, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia, CveActivoFijo:=CveActivoFijo) Then + Else + hasError = True + Exit For + End If + End If + + + hasError = False + Catch ex As Exception + hasError = True + Exit For + End Try + End If + Next + + 'refrescar grid datos investigacion + CargaDocumentacion() + End Sub +#End Region + + + + End Class \ No newline at end of file diff --git a/AF/CatAF.aspx b/AF/CatAF.aspx index 2477b9e6d..5feeabdb5 100644 --- a/AF/CatAF.aspx +++ b/AF/CatAF.aspx @@ -203,12 +203,38 @@ +
    +
    Tipo Grupo:
    +
    + + + + + +
    +
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    + + + Encontrados: + + +
    +
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    + +
    @@ -251,10 +277,10 @@ -
    - Encontrados: -
    - + + <%-- 0 --%> @@ -432,10 +458,15 @@
    - --%> + + <%-- - <%----%> + onclick="abrirModal(this.src)">--%> +
    @@ -447,6 +478,7 @@
    + @@ -573,7 +605,7 @@ - <%-- + <%-- --%> - <%-- - lazyImages.forEach(function (img) { - observer.observe(img); - }); - }); - --%> - PTU + Reparto de Utilidades - Reparto de Utilidades diff --git a/Nomina/ReportedeAcumulados.aspx.cs b/Nomina/ReportedeAcumulados.aspx.cs index 46c7eaf91..76d441dfe 100644 --- a/Nomina/ReportedeAcumulados.aspx.cs +++ b/Nomina/ReportedeAcumulados.aspx.cs @@ -96,6 +96,8 @@ public partial class Nomina_ReportedeAcumulados : ClsPaginas CargaTiposPeriodo(); CargarCentrosDeCosto(DdlProyecto, null, LblProyecto, LblSubProyeccto, "");//DdlSubProyecto divddlproyeto.Visible = DdlProyecto.Visible; + DdlTurno.DataSource = get_GlobalDTTurno(UsuarioActual.CveEmpresa); + DdlTurno.DataBind(); //CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListBox = Nothing) } } diff --git a/RH/CatPersonal.aspx b/RH/CatPersonal.aspx index cdb0add16..166750fe0 100644 --- a/RH/CatPersonal.aspx +++ b/RH/CatPersonal.aspx @@ -673,7 +673,12 @@ - + + Fecha Baja + + + + @@ -868,7 +873,9 @@
    - +
    + +
  • + Mostrar Campos Valores +
  • @@ -1689,7 +1692,87 @@
    + + + + diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index 6cc73ef11..bd787ed99 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -6,10 +6,6 @@ Imports System.IO Imports System.Data Imports Microsoft.Reporting.WebForms Imports System.Globalization - - - - Partial Class RH_Personal Inherits ClsPaginas @@ -975,7 +971,7 @@ Partial Class RH_Personal CargaPaises() CargaRegistroPatronal() CargaOutSourcing() - + CargaDDlPersonalRefsReference() If Request("CvePersonal") IsNot Nothing AndAlso IsNumeric(Request("CvePersonal")) AndAlso Request("CvePersonal").ToEntero() > 0 Then ViewState("CvePersonal") = Request("CvePersonal") DdlFormapagovacaciones_SelectedIndexChanged(Nothing, Nothing) @@ -1011,6 +1007,7 @@ Partial Class RH_Personal CargaGvBitacora() CarcaConceptosNomina() CargaFonacot() + CargaPersonalRefs() End If ValidaDeudorAcreedor() @@ -2137,7 +2134,7 @@ Partial Class RH_Personal If Not ObjCuentasDeposito.AddCuentasDepositos(row("BancoNombre").ToString(), row("Plaza").ToString(), row("Sucursal").ToString(), row("Cuenta").ToString(), row("CLABE").ToString(), row("CIE").ToString(), row("SWIFT").ToString(), row("Referencia").ToString(), row("RefCrediProveedor").ToString(), UsuarioActual.CveUsuario, row("CveMoneda").ToString().ToEntero(), UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario, - BBVAAlias:=row("BBVAAlias").ToString(), EstatusPagoElectronico:=Boolean.Parse(row("EstatusPagoElectronico").ToString), + CveSATBanco:=row("CveSATBanco").ToString.ToEntero, BBVAAlias:=row("BBVAAlias").ToString(), EstatusPagoElectronico:=Boolean.Parse(row("EstatusPagoElectronico").ToString), EstatusPagoElectronicoGrupos:=Boolean.Parse(row("EstatusPagoElectronicoGrupos").ToString), Correo:=row("Correo").ToString(), ConceptoCIE:=row("ConceptoCIE").ToString(), Estatus:=If(row("EstatusTexto").ToString = "Activo", True, False)) Then TieneError = True @@ -2197,41 +2194,41 @@ Partial Class RH_Personal Fiscalizable:=If(chkNoFiscalizar.Checked, 0, 1), CveTipoTrabajador:=DdlTipoTrabajador.SelectedValue.ToEntero(), NetoPeriodo:=TxtNetoPeriodo.Text.ToDecimal, TipoSangre:=DdlTipoSangre.SelectedValue, CveSubTipoPeriodo:=CveSubTipoPeriodo, AreaGeografica:=DdlAreageografica.SelectedValue, CodigoDispersionVale:=TxtCodigoDispersionVale.Text.Trim) Then - 'Funcion usa RH Familiares - If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then - ProcesaDTFamiliares(ObjPersonal) - End If - - ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), CvePersonal, If(ChkCharolaForanea.Checked, 1, 0)) - - If Archivo.Exists Then - - If Not Directory.Exists(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta)) Then Directory.CreateDirectory(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta)) - - If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then - File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) + 'Funcion usa RH Familiares + If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then + ProcesaDTFamiliares(ObjPersonal) End If - System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) - End If + ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), CvePersonal, If(ChkCharolaForanea.Checked, 1, 0)) - Mensaje = "Los cambios se guardaron correctamente." - 'If ViewState("CveEstatusOriginal").ToString() <> DdlEstatusPersonal.SelectedValue Then - ' 'Manda Mail con bajas - 'End If - Else - TieneError = True - End If - 'GUARDA ORGANIGRAMA - If Not TieneError Then - If Not ObjPersonal.AddUpdatePersonalOrganigrama(CvePersonal, If(DdlSupervisorOrganigrama.SelectedValue.ToEntero() = 0, CvePersonal, DdlSupervisorOrganigrama.SelectedValue.ToEntero())) Then + If Archivo.Exists Then + + If Not Directory.Exists(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta)) Then Directory.CreateDirectory(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta)) + + If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then + File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) + End If + System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) + + End If + + Mensaje = "Los cambios se guardaron correctamente." + 'If ViewState("CveEstatusOriginal").ToString() <> DdlEstatusPersonal.SelectedValue Then + ' 'Manda Mail con bajas + 'End If + Else TieneError = True End If + 'GUARDA ORGANIGRAMA + If Not TieneError Then + If Not ObjPersonal.AddUpdatePersonalOrganigrama(CvePersonal, If(DdlSupervisorOrganigrama.SelectedValue.ToEntero() = 0, CvePersonal, DdlSupervisorOrganigrama.SelectedValue.ToEntero())) Then + TieneError = True + End If + End If + End If - End If - - If TieneError Then + If TieneError Then ObjPersonal.RollBack() Alert("Ocurrio un error guardar el Personal. Por favor vuelva a intentar.", TipoMensaje.ToastAdventencia) Else @@ -3095,8 +3092,6 @@ Partial Class RH_Personal End If End Sub #End Region - - Protected Sub DdlEstatusPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEstatusPersonal.SelectedIndexChanged MostrarOcultarFechasEstatus() @@ -3133,8 +3128,6 @@ Partial Class RH_Personal End If - - e.Row.FCLinkButton("LBCancelar").Visible = True e.Row.FCLinkButton("LBCancelar").CommandArgument = e.Row.DBCampo("FolioFiscal") @@ -3153,7 +3146,6 @@ Partial Class RH_Personal e.Row.FCLinkButton("LBCancelar").Visible = True e.Row.FCLinkButton("LBCancelar").CommandArgument = e.Row.DBCampo("FolioFiscal") End If - End If End Sub @@ -3354,11 +3346,8 @@ Partial Class RH_Personal e.Row.FCLabel("LtlC").CssClass = "label label-sm label-warning" e.Row.FCLabel("LtlC").ForeColor = Drawing.Color.White End If - End If - End Sub - Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click If DtCuentasContables Is Nothing Then CargaCuentasContables() @@ -3377,10 +3366,6 @@ Partial Class RH_Personal DdlPrestamos.DataSource = DtCuentasContables : DdlPrestamos.DataBind() : DdlPrestamos.SelectedValueExist(SeleccionadoContPrestamos) DdlPrestamos.AutoPostBack = False : DdlPrestamos.Attributes.Remove("onclick") : DdlPrestamos.CssClass &= " select2me" End Select - - - - End Sub #Region "TAB BANCOS" Private Sub CargaMonedas() @@ -3417,10 +3402,6 @@ Partial Class RH_Personal TxtCorreoCuenta.Text = "" TxtBBVAAlias.Text = "" ChkPagoElectronicoGrupos.Checked = False - - - - UpAddBancos.Update() End Sub @@ -3441,6 +3422,7 @@ Partial Class RH_Personal Else If IndexCuentaDepostito > -1 Then Dim Row As DataRow = TempDTCuentasBancos.Rows(IndexCuentaDepostito) + Row("CveSATBanco") = DdlBancoSat.SelectedValue.ToEntero() Row("BancoNombre") = nombrebanco Row("Cuenta") = TxtNumeroCuenta.Text.Trim Row("Sucursal") = TxtNumeroSucursal.Text @@ -3460,7 +3442,6 @@ Partial Class RH_Personal Row("Correo") = TxtCorreoCuenta.Text.Trim Row("ConceptoCIE") = TxtConceptoCIE.Text Row("EstatusTexto") = If(ChkEstatuscuenta.Checked, "Activo", "Inactivo") - End If End If @@ -3504,7 +3485,6 @@ Partial Class RH_Personal Exit Sub End If - If ChkPagoElectronicoGrupos.Checked Then If TxtConvenioCIE.Text.Trim.Length > 0 Then @@ -3518,15 +3498,8 @@ Partial Class RH_Personal Alert("Se debe de especificar el banco.") Exit Sub End If - - - End If - End If - - - ''CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA" 'If EsBancomer AndAlso Not (TxtNumeroCuenta.Text.Trim.Length = 10 Or TxtConvenioCIE.Text.Trim.Length = 6) Then ' Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia) @@ -3562,8 +3535,6 @@ Partial Class RH_Personal Private Sub AgregarCuentaBanco(NombreBanco As String, NumeroSucursal As String, CLABE As String, SWIFT As String, Plaza As String, NumeroCuenta As String, ConvenioCIE As String, Referencia As String, RefCrediProveedor As String, CveMoneda As Integer, Moneda As String, Estatus As Boolean, Correo As String, BBVAAlias As String, CveSATBanco As Integer, EstatusPagoElectronico As Boolean, EstatusPagoElectronicoGrupos As Boolean, ConceptoCIE As String) - - If CvePersonal > 0 Then Using ObjCuentasBancos As New ClsGenerales() @@ -3582,6 +3553,7 @@ Partial Class RH_Personal If IndexCuentaDepostito > -1 Then Dim Row As DataRow = TempDTCuentasBancos.Rows(IndexCuentaDepostito) + Row("CveSATBanco") = CveSATBanco Row("BancoNombre") = NombreBanco Row("Sucursal") = NumeroSucursal Row("CLABE") = CLABE @@ -3594,7 +3566,6 @@ Partial Class RH_Personal Row("CveMoneda") = CveMoneda Row("Moneda") = Moneda Row("BBVAAlias") = BBVAAlias - Row("CveSATBanco") = CveSATBanco Row("EstatusPagoElectronico") = EstatusPagoElectronico Row("EstatusPagoElectronicoGrupos") = EstatusPagoElectronicoGrupos Row("Correo") = Correo @@ -3603,6 +3574,7 @@ Partial Class RH_Personal Else Dim Row As DataRow = TempDTCuentasBancos.NewRow + Row("CveSATBanco") = CveSATBanco Row("BancoNombre") = NombreBanco Row("Sucursal") = NumeroSucursal Row("CLABE") = CLABE @@ -3615,18 +3587,13 @@ Partial Class RH_Personal Row("CveMoneda") = CveMoneda Row("Moneda") = Moneda Row("BBVAAlias") = BBVAAlias - Row("CveSATBanco") = CveSATBanco Row("EstatusPagoElectronico") = EstatusPagoElectronico Row("EstatusPagoElectronicoGrupos") = EstatusPagoElectronicoGrupos Row("Correo") = Correo Row("ConceptoCIE") = ConceptoCIE TempDTCuentasBancos.Rows.Add(Row) Row("EstatusTexto") = If(ChkEstatuscuenta.Checked, "Activo", "Inactivo") - End If - - - End If LimpiaCuentasBancarias() @@ -3712,9 +3679,7 @@ Partial Class RH_Personal TxtCLABECB.Text = gvrow.DataKey("CLABE") ChkEstatusPagoE.Checked = gvrow.DataKey("EstatusPagoElectronico").ToUpper().Contiene("TRUE", "1") ChkEstatuscuenta.Checked = gvrow.DataKey("EstatusTexto").ToUpper().Contiene("TRUE", "1", "ACTIVO") - 'CveCuentaDeposito,BancoNombre,Sucursal,Cuenta,CLABE,SWIFT,Plaza,CIE,Referencia,RefCrediProveedor,CveMoneda,Estatus,Correo,BBVAAlias,EstatusPagoElectronico,EstatusPagoElectronicoGrupos,CveSATBanco,ConceptoCIE - 'DdlBancoSat TxtNombreBanco.Text = gvrow.DataKey("BancoNombre") TxtNumeroSucursal.Text = gvrow.DataKey("Sucursal") TxtSWIFT.Text = gvrow.DataKey("SWIFT") @@ -3728,18 +3693,10 @@ Partial Class RH_Personal ChkPagoElectronicoGrupos.Checked = Boolean.Parse(gvrow.DataKey("EstatusPagoElectronicoGrupos").ToString) ChkEstatuscuenta.Checked = If(gvrow.DataKey("EstatusTexto").ToString = "Activo", True, False) - - - 'CveCuentaDeposito,BancoNombre,Sucursal,Cuenta,CLABE,SWIFT,Plaza,CIE,Referencia,RefCrediProveedor,CveMoneda,Estatus,Correo,BBVAAlias,EstatusPagoElectronico,EstatusPagoElectronicoGrupos,CveSATBanco,ConceptoCIE,EstatusTexto - - 'asdasd - UpAddBancos.Update() RegistraScript("$('#DivAddCuentasBancarias').modal();") End Sub Protected Sub GvBancosCuentas_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvBancosCuentas.RowEditing - - GvBancosCuentas.EditIndex = e.NewEditIndex CargaGridCuentasBancos("") End Sub @@ -3747,97 +3704,7 @@ Partial Class RH_Personal GvBancosCuentas.EditIndex = -1 CargaGridCuentasBancos("") End Sub - Protected Sub GvBancosCuentas_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvBancosCuentas.RowUpdating - Dim NombreBanco As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNombreBanco").Text.Trim - Dim NumeroSucursal As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNumeroSucursal").Text.Trim - Dim CLABE As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtCLABE").Text.Trim - Dim SWIFT As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtSWIFT").Text.Trim - Dim Plaza As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtPlaza").Text.Trim - Dim NumeroCuenta As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNumeroCuenta").Text.Trim - Dim ConvenioCIE As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtConvenioCIE").Text.Trim - Dim Referencia As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtReferencia").Text.Trim - Dim CveMoneda As Integer = GvBancosCuentas.Rows(e.RowIndex).FCDropDownList("DdlMoneda").SelectedValue.ToString().ToEntero() - Dim Estatus As Boolean = GvBancosCuentas.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked - Dim EstatusPagoElectronico As Boolean = GvBancosCuentas.Rows(e.RowIndex).FCCheckBox("ChkEstatusPagoE").Checked - Dim Moneda As String = GvBancosCuentas.Rows(e.RowIndex).FCDropDownList("DdlMoneda").SelectedItem.Text - Dim BBVAAlias As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtBBVAAlias").Text - Dim RefCrediProveedor As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtRefCrediProveedor").Text.Trim - Dim EsBancomer As Boolean = False - - If NombreBanco.ToUpper.Contains("BBVA") Or NombreBanco.ToUpper.Contains("BANCOMER") Or (CLABE.Length = 18 AndAlso CLABE.Substring(0, 3) = "012") Then - EsBancomer = True - End If - - If EsBancomer AndAlso (CLABE.Length = 18 AndAlso Not CLABE.Substring(0, 3) = "012") Then - Alert("La CLABE ingresada no pertenece a BANCOMER.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - ''CLABE SIEMPRE OBLIGATORIA CUANDO NO ES BANCOMER CON CIE - 'If (CLABE.Trim.Length <> 18 And Not EsBancomer) Or (EsBancomer And ConvenioCIE.Trim.Length <> 6 And CLABE.Trim.Length <> 18) Then - ' Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If - - 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER - If CLABE.Trim.Length <> 18 And CLABE.Trim.Length = 0 And Not EsBancomer Then - Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10 - If NumeroCuenta.Trim.Length <> 0 AndAlso NumeroCuenta.Trim.Length <> 10 AndAlso EsBancomer Then - Alert("El número de cuenta debe tener una longitud de 10 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18 - If CLABE.Trim.Length <> 0 AndAlso CLABE.Trim.Length <> 18 Then - Alert("La CLABE debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'SI CIE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 6 Y REFERENCIA OBLIGATORIA - If (ConvenioCIE.Trim.Length <> 0 And ConvenioCIE.Trim.Length <> 6) Or (ConvenioCIE.Trim.Length = 6 And Referencia.Trim.Length < 3) Then - Alert("El Convenio CIE debe tener una longitud de 6 dígitos y se debe especificar una referencia. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA" - If EsBancomer AndAlso Not (NumeroCuenta.Trim.Length = 10 Or ConvenioCIE.Trim.Length = 6) Then - Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - Dim ObjCuentasBancos As New ClsGenerales - If CvePersonal > 0 Then - If ObjCuentasBancos.UpdateCuentasDepositos(GvBancosCuentas.DataKeys(e.RowIndex)("CveCuentaDeposito").ToString().ToEntero(), NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, RefCrediProveedor, False, Estatus, CveMoneda, UsuarioActual.CveEmpresa, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=BBVAAlias, EstatusPagoElectronico:=EstatusPagoElectronico) Then - DTCuentasBancos.Clear() - DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CvePersonal = {0}", CvePersonal))) - Alert("Cuenta actualizada con exito.", TipoMensaje.MsgInformacion) - - End If - Else - Dim index As Integer = GvBancosCuentas.Rows(e.RowIndex).DataKey("CveCuentaDeposito").ToString().ToEntero() - 1 - Dim Row As DataRow = TempDTCuentasBancos.Rows(index) - Row("BancoNombre") = NombreBanco - Row("Sucursal") = NumeroSucursal - Row("CLABE") = CLABE - Row("SWIFT") = SWIFT - Row("Plaza") = Plaza - Row("Cuenta") = NumeroCuenta - Row("CIE") = ConvenioCIE - Row("Referencia") = Referencia - Row("CveMoneda") = CveMoneda - Row("Moneda") = Moneda - TempDTCuentasBancos.AcceptChanges() - End If - ObjCuentasBancos.Dispose() - - GvBancosCuentas.EditIndex = -1 - CargaGridCuentasBancos("") - CargaGvBitacora() - End Sub Protected Sub GvBancosCuentas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvBancosCuentas.RowDeleting Dim ObjCuentasBancos As New ClsGenerales @@ -7454,8 +7321,14 @@ Partial Class RH_Personal strfin = String.Format(",[FechaFin]='{0:yyyy-MM-dd}'", fechafin) End If + Dim finicio As String = TxtFechaInicioUA.Text.ToDateTime().ToString("yyyy-MM-dd") + Dim ffin As String = TxtFechaFinUA.Text.ToDateTime().ToString("yyyy-MM-dd") Using objrh As New ClsRH() - If (objrh.PersonalAltasUpFechas(CvePersonalAltas, TxtFechaInicioUA.Text.ToDateTime().ToString("yyyy-MM-dd"), TxtFechaFinUA.Text.ToDateTime().ToString("yyyy-MM-dd"), CvePersonal, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then + If Not (objrh.ValidaFechaIngresoVSNominas(CvePersonal, CvePersonalAltas, 0, finicio, ffin)) Then + Alert("La fecha de ingreso o de fin no puede ser modificada, ya que existen registros de nómina autorizados que se encuentran dentro del periodo definido.", TipoMensaje.MsgAdvertencia) + + End If + If (objrh.PersonalAltasUpFechas(CvePersonalAltas, finicio, ffin, CvePersonal, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then If objrh.GetPersonalAltas(CvePersonal) Then GvPersonalAltas.DataSource = objrh.DtResultados GvPersonalAltas.DataBind() @@ -8441,7 +8314,70 @@ Partial Class RH_Personal End Sub + Protected Sub CargaPersonalRefs() + Dim ObjPers As New ClsNominas() + ObjPers.PersonalCamposValoresGet(-1, CvePersonal) + GVPersonalRefs.DataSource = ObjPers.DtResultados + ObjPers.Dispose() + GVPersonalRefs.DataBind() + UPModalPers.Update() + End Sub + Protected Sub CargaDDlPersonalRefsReference() + Dim ObjPers As New ClsNominas() + ObjPers.PersonalCamposGET() + DdlPersreferencia.DataSource = ObjPers.DtResultados + ObjPers.Dispose() + DdlPersreferencia.DataBind() + UPModalPers.Update() + End Sub + Protected Sub LimpiaPersonalRefs() + DdlPersreferencia.SelectedIndex = 0 + TxtPersvalor.Text = "" + UPModalPers.Update() + End Sub + Protected Sub LnkMostrarCamposValor_Click(sender As Object, e As EventArgs) + ltlPerstitulo.Text = "Campos valores" + LimpiaPersonalRefs() + RegistraScript("$('#DModalPersonalRefs').modal()") + BtnPersADD.Visible = False + PanelMostrarpersonalcampos.Visible = True + PanelADDpersonalcampos.Visible = False + UPModalPers.Update() + End Sub + Protected Sub LnkAgregarPers_Click(sender As Object, e As EventArgs) + 'RegistraScript("$('#DModalPersonalRefs').modal()") + ltlPerstitulo.Text = "Agregar Campos Valores" + LimpiaPersonalRefs() + BtnPersADD.Visible = True + PanelADDpersonalcampos.Visible = True + PanelMostrarpersonalcampos.Visible = False + UPModalPers.Update() + End Sub + Protected Sub BtnPersADD_Click(sender As Object, e As EventArgs) + + Dim cveReferencia As Int32 = DdlPersreferencia.SelectedValue.ToEntero() + Dim valor As Decimal = TxtPersvalor.Text.ToDecimal() + Dim ObjPers As New ClsNominas() + Dim Continuar As Boolean = ObjPers.PersonalCamposValoresAddUp(cveReferencia, CvePersonal, valor) + ObjPers.Dispose() + If (Continuar) Then + LimpiaPersonalRefs() + UPModalPers.Update() + Alert("El campo valor se ha agregado") + End If + End Sub + Protected Sub LnkEliminarPers_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + Dim CcveReferencia As Integer = gvRow.DataKey("CveReferencia").ToEntero() + Dim ObjPers As New ClsNominas() + Dim Continuar As Boolean = ObjPers.PersonalCamposValoresRemove(CcveReferencia, CvePersonal) + ObjPers.Dispose() + If (Continuar) Then + CargaPersonalRefs() + Alert("El campo valor se ha eliminado") + End If + End Sub 'Protected Sub ChkPagoElectronicoGrupos_CheckedChanged(sender As Object, e As EventArgs) ' If ChkPagoElectronicoGrupos.Checked Then diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index ad0243b62..0c058efca 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -667,9 +667,7 @@ Partial Class RepContratosCalendario resp = ObjFacturaCancelacion.CancelarFactura(0, CancelacionPagos:=CancelacionPagos, ValidarSAT:=False) If resp.HuboError Then TieneError = True - Else - RegistraScript("$('#ModalActualizar').modal('hide');") - Alert("Actualizado Correctamente.") + Alert("Se presento un error al Actualizar el contrato (Cancelación de factura).") End If End If End If @@ -679,9 +677,13 @@ Partial Class RepContratosCalendario If TieneError Then ObjContratos.RollBack() + Alert("Se Presento un Error al Actualizar el Contrato.", TipoMensaje.MsgError) Else ObjContratos.Commit() + RegistraScript("$('#ModalActualizar').modal('hide');") + Alert("Contrato Actualizado Correctamente.") End If + ObjContratos.Dispose() objGenerales.Dispose() ObjVentas.Dispose() diff --git a/Ventas/ActualizarPrecios.aspx b/Ventas/ActualizarPrecios.aspx index 0053c508e..6e96c7a44 100644 --- a/Ventas/ActualizarPrecios.aspx +++ b/Ventas/ActualizarPrecios.aspx @@ -42,58 +42,60 @@ outline: 0; } - table.adssigscroll { - min-width: 100%; - background-color:#fff; - } - - table.adssigscroll tbody,table.adssigscroll thead{ - background-color:#fff; - } - table.adssigscroll tr{ - background-color:inherit; - } - - - .divContainerads { - width: 100%; - max-height: calc(100vh - 260px); - overflow-y: auto; - } - - table.adssigscroll tr:nth-child(1) { - position: sticky; - top: 0; /* Se mantiene pegado en la parte superior */ - background-color: inherit; /* Para que no se superponga con otros elementos */ - z-index: 4; /* Asegura que esté sobre otros elementos */ - } - table.adssigscroll tr:nth-child(1) th:nth-child(1),table.adssigscroll tr:nth-child(1) th:nth-child(2) { - z-index: 5; - } - - table.adssigscroll tr:nth-child(2) { - top: 26.14px; - } - - table.adssigscroll tr td:nth-child(1),table.adssigscroll tr th:nth-child(1), - table.adssigscroll tr td:nth-child(2),table.adssigscroll tr th:nth-child(2) { - position: sticky; - left: 0; - z-index: 3; - } - - table.adssigscroll tr td:nth-child(1), table.adssigscroll tr td:nth-child(2) { - background-color: inherit; - } - - table.adssigscroll tr td:nth-child(1),table.adssigscroll tr th:nth-child(1) { - width: 21px; - max-width: 21px; - } - - table.adssigscroll tr td:nth-child(2),table.adssigscroll tr th:nth-child(2) { - left: 21px; + table.adssigscroll { + min-width: 100%; + background-color: #fff; + } + + table.adssigscroll tbody, table.adssigscroll thead { + background-color: #fff; } + + table.adssigscroll tr { + background-color: inherit; + } + + + .divContainerads { + width: 100%; + max-height: calc(100vh - 260px); + overflow-y: auto; + } + + table.adssigscroll tr:nth-child(1) { + position: sticky; + top: 0; /* Se mantiene pegado en la parte superior */ + background-color: inherit; /* Para que no se superponga con otros elementos */ + z-index: 4; /* Asegura que esté sobre otros elementos */ + } + + table.adssigscroll tr:nth-child(1) th:nth-child(1), table.adssigscroll tr:nth-child(1) th:nth-child(2) { + z-index: 5; + } + + table.adssigscroll tr:nth-child(2) { + top: 26.14px; + } + + table.adssigscroll tr td:nth-child(1), table.adssigscroll tr th:nth-child(1), + table.adssigscroll tr td:nth-child(2), table.adssigscroll tr th:nth-child(2) { + position: sticky; + left: 0; + z-index: 3; + } + + table.adssigscroll tr td:nth-child(1), table.adssigscroll tr td:nth-child(2) { + background-color: inherit; + } + + table.adssigscroll tr td:nth-child(1), table.adssigscroll tr th:nth-child(1) { + width: 21px; + max-width: 21px; + } + + table.adssigscroll tr td:nth-child(2), table.adssigscroll tr th:nth-child(2) { + left: 21px; + } @@ -105,18 +107,18 @@
  • Importar Listado
  • - - - -
  • + + + +
  • Exportar Excel -
  • -
    - - - -
    - + +
    + + + +
    + @@ -182,19 +184,19 @@
    -
    -
    +
    +
    -
    +
    - +
    Código Fin:
    -
    +
    @@ -220,27 +222,38 @@
    -
    +
    +
    -
    -
    -
    - - - - $ -
    +
    +
    + + + + + +
    +
    + + + + + + +
    -
    +
    @@ -281,7 +287,7 @@
    + OnRowDataBound="GVPrecios_RowDataBound"> @@ -289,7 +295,7 @@ - + @@ -299,13 +305,13 @@ - + - +
    - +
    -
    +
    @@ -316,14 +322,22 @@ --%> - - + + + + + + + + + + - - + + - + @@ -351,347 +365,349 @@
    - - - - - - - - - - Producto/Servicio - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + Producto/Servicio + + +
    + +
    +
    +
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -891,20 +907,73 @@ } function CambiaImporte() { - var topLevelElem = document.getElementById("form1"); - var checks = topLevelElem.getElementsByTagName("input"); - var idd = ''; + let topLevelElem = document.getElementById("form1"); + let checks = topLevelElem.getElementsByTagName("input"); + let idd = ''; - var valor = $('#<%= TxtImporte.ClientID %>').val(); + let valor = ToDouble($('#<%= TxtImporte.ClientID %>').val()); for (var i = 0; i < checks.length; i++) { if (checks[i].type == "checkbox") { - debugger; - if (checks[i].checked) { - idd = checks[i].id.replace('C_GVPrecios_chkPS_', '') + idd = checks[i].id.replace('C_GVPrecios_chkPS_', ''); if ($get('C_GVPrecios_TxtPrecio_' + idd) != null) { - $get('C_GVPrecios_TxtPrecio_' + idd).value = FormatoNumero(ToDouble(valor), 2); + let tipo = $get('HdnTipo').value; + + //ASIGNAR PRECIO NUEVO + if (tipo == '1') { + $get('C_GVPrecios_TxtPrecio_' + idd).value = FormatoNumero(valor, 2); + } + + //AUMENTAR PRECIO POR PORCENTAJE + if (tipo == '2') { + let precioRef = 0; + + let precioActual = 0; + let ultimoCosto = 0; + let costoPromedio = 0; + + if ($get('C_GVPrecios_LtlPrecio_' + idd)) { + precioActual = ToDouble($get('C_GVPrecios_LtlPrecio_' + idd).innerText.replace(" ", "").replace("$", "").replace(",", "")); + } + if ($get('C_GVPrecios_LtlUltimoCosto_' + idd)) { + ultimoCosto = ToDouble($get('C_GVPrecios_LtlUltimoCosto_' + idd).innerText.replace(" ", "").replace("$", "").replace(",", "")); + } + if ($get('C_GVPrecios_LtlCostoPromedio_' + idd)) { + costoPromedio = ToDouble($get('C_GVPrecios_LtlCostoPromedio_' + idd).innerText.replace(" ", "").replace("$", "").replace(",", "")); + } + + let Referencia = $get('C_DdlTipoPorcentaje').value; + + //PRECIO ACTUAL + if (Referencia == '1') { + precioRef = precioActual; + } + + //ULTIMO COSTO + if (Referencia == '2') { + if (ultimoCosto > 0 && ultimoCosto != 'NaN') { + precioRef = ultimoCosto; + } else { + precioRef = precioActual; + } + } + + //COSTO PROMEDIO + if (Referencia == '3') { + if (costoPromedio > 0 && costoPromedio != 'NaN') { + precioRef = costoPromedio; + } else { + precioRef = precioActual; + } + } + + + let precioNuevo = ToDouble(((valor / 100) * precioRef) + precioRef); + $get('C_GVPrecios_TxtPrecio_' + idd).value = FormatoNumero(precioNuevo, 2); + } + + } } diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index 3aaa0ed3a..9893d756c 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -333,21 +333,27 @@ Partial Class Ventas_ActualizarPrecios End Sub Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) If RblTipo.SelectedValue = "Imp" Then - ImporteFijo.Visible = True + LtlImporte.Text = "Precio nuevo:" + LtlSimbolo.Text = "$" + HdnTipo.Value = "1" + DivTipoPorcentaje.Visible = False Else - ImporteFijo.Visible = False + LtlImporte.Text = "Porcentaje a incrementar:" + LtlSimbolo.Text = "%" + HdnTipo.Value = "2" + DivTipoPorcentaje.Visible = True End If UPPrecioLista.Update() End Sub Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click - If RblTipo.SelectedIndex = 1 And TxtPorcentaje.Text.ToDecimal = 0 Then - Alert("Se debe de especificar un porcentaje.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + 'If RblTipo.SelectedIndex = 1 And TxtPorcentaje.Text.ToDecimal = 0 Then + ' Alert("Se debe de especificar un porcentaje.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If Dim TieneError As Boolean = False 'Dim Importe As Decimal = If(TxtImporte.Text = "", -1, TxtImporte.Text.ToDecimal) - Dim Porcentaje As Decimal = If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) + Dim Porcentaje As Decimal = -1 ' If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) Dim MensajeAlert As New StringBuilder Dim sbProductos As New StringBuilder @@ -356,7 +362,7 @@ Partial Class Ventas_ActualizarPrecios Try For Each row As GridViewRow In GVPrecios.Rows If row.FCCheckBox("chkPS").Checked Then - TieneError = Not ObjPS.UpdatePSPreciosLista(row.FCTextBox("TxtPrecio").Text.ToDecimal, DdlPrecioLista.SelectedValue.ToEntero, Porcentaje, row.DataKey("CvePS").ToEntero, UsuarioActual.CveUsuario, NowADS(), If(RblTipo.SelectedValue = "Imp", True, False), PrecioMinimo:=row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal) + TieneError = Not ObjPS.UpdatePSPreciosLista(row.FCTextBox("TxtPrecio").Text.ToDecimal, DdlPrecioLista.SelectedValue.ToEntero, Porcentaje, row.DataKey("CvePS").ToEntero, UsuarioActual.CveUsuario, NowADS(), True, PrecioMinimo:=row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal) If CBool(row.DataKey("ProductoExhibicion")) Then sbProductos.AppendFormat("{0},", row.DataKey("CvePS").ToEntero) End If @@ -396,7 +402,7 @@ Partial Class Ventas_ActualizarPrecios RegistraScript("$('#divAgregar').modal('hide')") TxtImporte.Text = "" TxtPrecio.Text = "" - TxtPorcentaje.Text = "" + 'TxtPorcentaje.Text = "" End Sub #Region "MODAL PRECIOS MINIMOS" @@ -679,8 +685,8 @@ Partial Class Ventas_ActualizarPrecios Dim StrMsgError As New StringBuilder If FranquiciasStr <> "" Then Dim Franquicias As String() = FranquiciasStr.Split(","c) - Dim Porcentaje As Decimal = If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) - + Dim Porcentaje As Decimal = -1 ' If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) + For Each Franquicia As String In Franquicias Dim CveFranquicia As Integer = Franquicia.ToEntero Dim CvePS As Integer = GlobalDTPSSimplificado(CveFranquicia, Codigo:=Codigo).FiltroPrimeroValor("CvePS", "").ToEntero diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx index bae240e5f..86a826897 100644 --- a/Ventas/ClientesAbonar.aspx +++ b/Ventas/ClientesAbonar.aspx @@ -42,7 +42,7 @@ Banco   Ingresos x Comprobar - <%-- Pago Intermediario--%> + <%-- Pago Intermediario--%>
    @@ -208,10 +208,10 @@
    -
    Sucursal:
    -
    +
    Sucursal:
    +
    - +
    @@ -257,9 +257,9 @@
    -
    +
    -
    +
    @@ -312,7 +312,7 @@ - <%--
    + <%--
    @@ -333,54 +333,54 @@
    --%> - +
    - +
    - -
    - + +
    +
    + -
    +
    - - - - +
    Fecha Emisión: -
    - - - - -
    + + + -
    Fecha Emisión: +
    + + + + +
    - - - - + + + + - <%----%> - - - - <%----%> -
    - - + <%----%> - - -
    + + + <%----%> +
    + + + +
    + +
    - " style="display: inline-block; margin-right: -20px; width: 125px;" /> - " style="margin-top: -3px; margin-right: 20px" class="btn btn-circle btn-sm label-info"> + " style="display: inline-block; margin-right: -20px; width: 125px;" /> + " style="margin-top: -3px; margin-right: 20px" class="btn btn-circle btn-sm label-info">
    @@ -716,7 +716,7 @@ - +
    @@ -738,6 +738,41 @@
    + + <%-- FIN MODAL SALDAR INCOBRABLE--%> <%-- + + +
    - +
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 63f021a8f..cff95b633 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3487,7 +3487,7 @@ Partial Class Ventas DivContadoOtros.Visible = True End If - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then DivMesesSinIntereses.Visible = True DivDdlCuentaTarjetaCredito.Attributes.Add("class", "col-md-4") @@ -3591,10 +3591,6 @@ Partial Class Ventas 'End If If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - trRotacion.Visible = True - trRotacionlbl.Visible = True - trAlineacion.Visible = True - trAlineacionlbl.Visible = True Dim FechaRotaAlinea As Date = TxtFecha.Text.ToDate LblRotacion.Text = FechaRotaAlinea.AddMonths(6).ToShortDateString @@ -3667,11 +3663,22 @@ Partial Class Ventas InicializaDevolucionAlmacen() + HabilitarDescuentoGlobal() + End If + + End Sub + + Private Sub HabilitarDescuentoGlobal() + If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.CveEmpresa.Contiene(181, 182, 183) AndAlso (CveVenta <= 0 OrElse EsCreaApartirDe) Then + ImgDescTotal.Visible = True + ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuentoGlobal').modal();") + End If End Sub #Region "Bloqueo Pantalla" + Private Sub ValidaUsuarioAcceso() 'VERIFICAR SI LA SESION SE ENCUENTRA BLOQUEADA If UsuarioActual.Empresa.Funcionalidad(599) = "1" Then @@ -6032,7 +6039,11 @@ Partial Class Ventas 'ACTIVA EDITAR 'SOLO LA PUEDE EDITAR CON PROCESO | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR - If (UsuarioActual.TienePermisoProceso(202) OrElse UsuarioActual.TienePermisoProceso(302)) And TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then + If DbRowVenta("TipoDocto").ToString = "Rem" AndAlso (UsuarioActual.TienePermisoProceso(202) OrElse UsuarioActual.TienePermisoProceso(302)) AndAlso TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then + BtnPermisoEditarRemision.Visible = True + End If + + If DbRowVenta("TipoDocto").ToString = "Rem" AndAlso (UsuarioActual.TienePermisoProceso(302)) Then BtnPermisoEditarRemision.Visible = True End If @@ -8846,7 +8857,7 @@ Partial Class Ventas If Not EsCreaApartirDe Then 'Si es una devolucion - If NuevaFactura = 0 Then + If NuevaFactura <= 0 Then e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False e.Row.FCDropDownList("DdlClasificacion").Enabled = False e.Row.FCDropDownLost("DdlPS").Enabled = False @@ -8958,10 +8969,14 @@ Partial Class Ventas End If 'cuando ya tiene una salida, no se puede cambiar el producto - If e.Row.DBCampo("CantidadInventario").ToDouble > 0 Then + If e.Row.DBCampo("CantidadInventario").ToDouble > 0 OrElse e.Row.DBCampo("CantidadFacturadaRem").ToDecimal > 0 Then e.Row.FCDropDownList("DdlClasificacion").Enabled = False e.Row.FCDropDownLost("DdlPS").Enabled = False e.Row.FCDropDownLost("DdlPS").ddlWS.Attributes.Add("disabled", "disabled") + If e.Row.DBCampo("CantidadFacturadaRem").ToDecimal > 0 AndAlso SaldoVenta = 0 Then + e.Row.FCTextBox("TxtPrecio").Enabled = False + e.Row.FCTextBox("TxtDescuento").Enabled = False + End If End If e.Row.FCTextBox("TxtTiempoEntrega").Enabled = False @@ -9064,6 +9079,16 @@ Partial Class Ventas e.Row.FCLinkButton("imgD").Visible = False End If End If + 'EN SMS NO DEBE PODER EDITAR LOS PS + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + If ModalidadEdicion Then + e.Row.FCLinkButton("imgE").Visible = True + e.Row.FCLinkButton("imgD").Visible = False + Else + e.Row.FCLinkButton("imgE").Visible = False + e.Row.FCLinkButton("imgD").Visible = False + End If + End If End If If (UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1") AndAlso e.Row.DBCampo("CvePrecioLista").ToEntero() > 0 Then @@ -10009,9 +10034,9 @@ Partial Class Ventas End If End If - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then - If TxtKilometraje.Text.Length < 6 Then - Alert("El kilometraje debe tener 6 digitos.", TipoMensaje.MsgAdvertencia) + If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso TrKilometraje.Visible Then + If TxtKilometraje.Text.Length < 4 OrElse TxtKilometraje.Text.Length > 6 Then + Alert("El kilometraje debe tener de 4 a 6 dígitos.", TipoMensaje.MsgAdvertencia) Exit Sub End If End If @@ -13318,7 +13343,7 @@ Partial Class Ventas ObjFactura.EsGarantia = Me.EsGarantia ObjFactura.Bloqueada = Me.Bloqueada - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then + If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso TrKilometraje.Visible Then ObjFactura.Kilometraje = TxtKilometraje.Text.Trim.ToDecimal() End If @@ -17539,9 +17564,9 @@ Partial Class Ventas saldo = (e.Row.DataKey("Saldo").ToString().ToDecimal * tipoCambio).TruncateDecimal Else saldo = e.Row.DataKey("Saldo").ToDecimal - End If - Else - saldo = e.Row.DataKey("Saldo").ToString().ToDecimal + End If + Else + saldo = e.Row.DataKey("Saldo").ToString().ToDecimal If CveVenta <= 0 Then If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("2") Then 'cuando es por NC, debe de tomar el total de su saldo respectivo @@ -18592,6 +18617,25 @@ Partial Class Ventas RegistraScript("$('#ModalDescuento').modal('hide')", "hidemodal") UpPS.Update() End Sub + + Protected Sub BtnAplicarDescGlobal_Click(sender As Object, e As System.EventArgs) Handles BtnAplicarDescGlobal.Click + Dim DescuentoManual As Decimal = TxtMontoDescGlobal.Text.ToDecimal() + Dim PorcentajeDescuento As Decimal = TxtPorDescGlobal.Text.ToDecimal() + + If DescuentoManual <> 0 AndAlso PorcentajeDescuento <> 0 Then + Alert("Debe elegir un solo tipo de descuento", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If PorcentajeDescuento > 100 Then + Alert("El porcentaje no puede ser mayor a 100", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + RecalculaPrecios(False, False, AplicarDescuentoGlobal:=True) + RegistraScript("$('#ModalDescuentoGlobal').modal('hide')", "hidemodal") + UpPS.Update() + End Sub Private Sub BtnAplicarOtrosConceptos_Click(sender As Object, e As EventArgs) Handles BtnAplicarOtrosConceptos.Click TotalOtrosConceptos = 0 @@ -18749,7 +18793,7 @@ Partial Class Ventas End If Else If drPS("CveTipoPS").ToString() = "1" Then 'Si es servicio - If UsuarioActual.Empresa.Funcionalidad(558).ToString() = "1" Then 'Si es Empresa llantera + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then 'Si es Empresa llantera TxtPrecio.Enabled = True Else 'TxtPrecio.Enabled = False @@ -25192,7 +25236,7 @@ Partial Class Ventas End If Case 2 'CONTADO - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") OrElse (UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And DdlTipoComprobante.SelectedValue = "Cot") OrElse (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") OrElse (UsuarioActual.Empresa.Funcionalidad(558) = "1" And DdlTipoComprobante.SelectedValue = "Cot") OrElse (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then DivContado.Visible = True If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then DivTransferencia.Visible = False @@ -25466,7 +25510,7 @@ Partial Class Ventas DrCredito("Tipo") = "Tarjeta de Crédito" DrCredito("CveMetodoPago") = 4 - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then DrCredito("MesesSinIntereses") = DDlMesesSinIntereses.SelectedValue.ToEntero() Else DrCredito("MesesSinIntereses") = -1 @@ -25562,7 +25606,7 @@ Partial Class Ventas DrCredito("Observaciones") = "" DrCredito("Tipo") = "Tarjeta de Crédito" DrCredito("CveMetodoPago") = 4 - If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then DrCredito("MesesSinIntereses") = DdlMesesSinIntereses2.SelectedValue.ToEntero() Else DrCredito("MesesSinIntereses") = -1 @@ -26294,10 +26338,10 @@ Partial Class Ventas Exit Sub End If - If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then - Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + 'If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then + ' Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If 'If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then ' Alert("El uso cfdi del cliente no puede ser 'S01 - Sin efectos fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) @@ -35969,7 +36013,7 @@ Partial Class Ventas SeEstaFActurandoVentaMedica = True End If - If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And RBLPago.SelectedValue.ToEntero() = 2 Then + If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558) = "1" And RBLPago.SelectedValue.ToEntero() = 2 Then Alert("No se puede facturar hasta que se haya especificado detalladamente la forma de pago", TipoMensaje.MsgAdvertencia) Else Dim FolioFijo As Integer = 0 @@ -39537,10 +39581,9 @@ Partial Class Ventas TxtFechaPago.Enabled = False imgCalendario.Visible = False - - TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString() End If + TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString() Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal() @@ -39663,25 +39706,15 @@ Partial Class Ventas End If End If - - Dim OrdenCompra As String = "-1" - - If UsuarioActual.CveEmpresa = 119 Then - Dim arrayStr As String() = DdlLineaAdicional.SelectedItem.Text.Split(":"c) - If arrayStr.Length > 0 Then - Dim OrdenCompraTmp As String = arrayStr(0).Replace("IMP", "").Trim - If TxtOrdenCompra.Text.Trim.Length > 0 Then - If OrdenCompraTmp.ToUpper <> TxtOrdenCompra.Text.Trim.ToUpper Then - OrdenCompra = $"{TxtOrdenCompra.Text}, {OrdenCompraTmp}" - End If - Else - OrdenCompra = $"{OrdenCompraTmp}" - End If - End If - End If + Dim OrdenCompra As String = TxtOrdenCompra.Text Using ObjVentas As New ClsVentas If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), CveVenta, "", 1, UsuarioActual.CveEmpresa, OrdenCompra:=OrdenCompra) Then + Try + GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False) + Catch ex As Exception + + End Try Alert("Se actualizó la linea adicional de crédito de la venta") End If End Using @@ -40796,9 +40829,16 @@ Partial Class Ventas RegistraScript("MuestraAnticipos();", "AE") End Sub - Private Sub RecalculaPrecios(ByRef RecalculoPromociones As Boolean, Optional AplicarPromociones As Boolean = False) + Private Sub RecalculaPrecios(ByRef RecalculoPromociones As Boolean, Optional AplicarPromociones As Boolean = False, Optional AplicarDescuentoGlobal As Boolean = False) Dim PuedeRecalcular As Boolean = False + Dim DescuentoManual As Decimal = 0, DescuentoPorcentaje As Decimal = 0 + + If AplicarDescuentoGlobal Then + DescuentoManual = TxtMontoDescGlobal.Text.ToDecimal() + DescuentoPorcentaje = TxtPorDescGlobal.Text.ToDecimal() + End If + If CveVenta <= 0 OrElse EsCreaApartirDe OrElse (ModalidadEdicion AndAlso Not DdlTipoComprobante.SelectedValue = "Cot") Then PuedeRecalcular = True End If @@ -40812,19 +40852,25 @@ Partial Class Ventas PuedeRecalcular = True End If + If AplicarDescuentoGlobal Then + PuedeRecalcular = True + End If + If TmpDT IsNot Nothing AndAlso PuedeRecalcular Then For Each Row As DataRow In TmpDT.Rows Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() Dim CveClasificacion As Integer = Row("CveClasificacion").ToString().ToEntero Dim CvePS As Integer = Row("CvePS").ToString().ToEntero + Dim CodigoPS As String = Row("CodigoPS").ToString() + Dim PUOriginal As Decimal = Row("PU").ToString().ToDecimal() Dim CvePrecioListaSugerido As Integer = -1 Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = Nothing - If AplicarPromociones Then + If AplicarPromociones OrElse AplicarDescuentoGlobal Then ObjPrecioSugerido = New Modelos.MPrecioSugerido() - ObjPrecioSugerido.PrecioSugerido = Row("PU").ToString().ToDecimal() + ObjPrecioSugerido.PrecioSugerido = PUOriginal ObjPrecioSugerido.CvePrecioLista = Row("CvePrecioLista").ToString().ToEntero() Else ObjPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion) @@ -40834,8 +40880,30 @@ Partial Class Ventas Dim PU As Decimal = ObjPrecioSugerido.PrecioSugerido.RoundSQL(6) Dim ObjDescuento As Modelos.VentaDescuentos = CalcularDescuentos(CvePS, Cantidad, PU) - If ObjDescuento.EsPUModificado Then - PU = ObjDescuento.PU + If AplicarDescuentoGlobal Then + + If DescuentoManual > 0 Then + ObjDescuento.EsPUModificado = False + ObjDescuento.ImporteDescuento = DescuentoManual + ObjDescuento.ImporteProntoPago = 0 + + If ObjDescuento.ImporteDescuento > (Cantidad * PU) Then + Alert($"El producto y/o servicio '{CodigoPS}' no puede tener un descuento mayor al total", TipoMensaje.MsgAdvertencia) + Continue For + End If + + End If + + If DescuentoPorcentaje > 0 Then + ObjDescuento.EsPUModificado = False + ObjDescuento.ImporteDescuento = (Cantidad * PU) * (DescuentoPorcentaje / 100D) + ObjDescuento.ImporteProntoPago = 0 + End If + + Else + If ObjDescuento.EsPUModificado Then + PU = ObjDescuento.PU + End If End If 'SI NO TIENE PROMOCION, NO MODIFICAR NADA