diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index 0a47fc29f..db77a2884 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -7,6 +7,7 @@ Public Class CalendarEvent Public Property description As String Public Property start As String Public Property [end] As String + Public Property FechaFinal As String Public Property allDay As Boolean Public Property CveEventoEstatus As Integer Public Property cveagendatipo As String diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index fa47212e6..cb986fc36 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -4469,6 +4469,25 @@ Public Class ClsInventarios Return Retorno End Function + Public Function UpdateOSEstatusInventario(CveOS As Integer, Estatus As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OS_OSEstatusInventarioUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOS", SqlDbType.Int).Value = CveOS + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus de OS.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function #End Region #Region " INVENTARIOS - SOLICITUD DE TRASPASOS " diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 9e64639a3..43dadaa3d 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -87,6 +87,7 @@ Public Class ClsOIEventos End Property #Region "Propiedades de la tabla OI_Eventos" Public Property CveEvento As Integer + Public Property CveIndicador As Integer Public Property CveTipoEvento As Integer Public Property Folio As Integer Public Property TipoEvento As String @@ -965,7 +966,7 @@ Public Class ClsOIEventos Optional CveOS As Integer = -1, Optional CveOC As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCompra As Integer = -1, Optional CveVenta As Integer = -1, Optional CveContrato As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional CveMovimientoAlmacen As Integer = -1, Optional CorreoExterno As String = "", Optional CveTableroLista As Integer = -1, Optional Lugar As String = "", - Optional Asistencia As String = "", Optional Duracion As String = "", Optional CveAcercamiento As Integer = -1) As Boolean + Optional Asistencia As String = "", Optional Duracion As String = "", Optional CveAcercamiento As Integer = -1, Optional CveIndicador As Integer = -1) As Boolean Dim retorno As Boolean = False Dim xmlMiembros As System.Xml.Linq.XDocument = Nothing @@ -1028,6 +1029,7 @@ Public Class ClsOIEventos .Add("@Lugar", SqlDbType.VarChar).Value = Lugar .Add("@CveTableroLista", SqlDbType.VarChar).Value = CveTableroLista .Add("@CveAcercamiento", SqlDbType.VarChar).Value = CveAcercamiento + .Add("@CveIndicador", SqlDbType.VarChar).Value = CveIndicador '.Add("@mailPara", SqlDbType.VarChar).Direction = ParameterDirection.Output @@ -3216,8 +3218,66 @@ Public Class ClsOIEventos Return Retorno End Function + #End Region + + +#Region "I N D I C A D O R E S " + +#End Region + + Public Function AddIndicador(Indicador As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + CveIndicador = -1 + + DataAdapter("PA_Dir_IndicadorAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Indicador", SqlDbType.Int).Value = Indicador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveIndicador", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + CveIndicador = SqlAdapter.SelectCommand.Parameters("@CveIndicador").Value.ToString().ToEntero() + If CveIndicador > 0 Then + Retorno = True + End If + + Catch ex As Exception + OnError("Ocurrió un error al agregar el indicador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateIndicador(CveIndicador As Integer, Valor As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Dir_IndicadorUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIndicador", SqlDbType.Int).Value = CveIndicador + .Add("@Valor", SqlDbType.Int).Value = Valor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el indicador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + #End Region ' IDisposable diff --git a/App_Code/ClsOS.vb b/App_Code/ClsOS.vb index b2f8c1d29..376513ad8 100644 --- a/App_Code/ClsOS.vb +++ b/App_Code/ClsOS.vb @@ -458,12 +458,12 @@ Public Class ClsOS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "ClsOSOrdenesServicios" - 'Reporte de Ventas + 'Reporte de Ventas Public Function GetRepOrdenesServicio(FechaI As Date, FechaF As Date, FechaTerminado As String, CveCliente As Integer, CveSubProyecto As Integer, CveUsuarioRecibio As Integer, CveTecnico As Integer, CveEstatusOrdenServicio As Integer, CveEmpresa As Integer, Optional Opcion As Integer = -1, Optional CveUsuarioAsignado As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -492,6 +492,26 @@ Public Class ClsOS OnError("Ocurrió un error al obtener el Reporte de Ordenes de Servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try + Return Retorno + End Function + + Public Function GetRepOSEstatus(CveOS As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OS_OSEstatusRepGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOS", SqlDbType.Int).Value = CveOS + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de estatus de OS.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno End Function diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 2e23ed098..0b524ae8f 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10463,6 +10463,7 @@ Public Class ClsPaginas PaginaDict.Add("/OS/Asignaciones.aspx".ToUpper(), 125) PaginaDict.Add("/OS/RepServicioDomicilio.aspx".ToUpper(), 1330) PaginaDict.Add("/OS/RepOSMedicas.aspx".ToUpper(), 1345) + PaginaDict.Add("/OS/RepOSEstatus.aspx".ToUpper(), 1349) #End Region #Region "OC" PaginaDict.Add("/OC/OC.aspx".ToUpper(), 155) @@ -10517,6 +10518,7 @@ Public Class ClsPaginas PaginaDict.Add("/OI/CatDocumentoSubCategoria.aspx".ToUpper(), -1) PaginaDict.Add("/OI/Documentos.aspx".ToUpper(), -1) PaginaDict.Add("/OI/DocumentoDetalle.aspx".ToUpper(), -1) + PaginaDict.Add("/OI/RepIndicadoresEMD.aspx".ToUpper(), 1348) #End Region #Region "Planeacion" PaginaDict.Add("/Planeacion/CatSucursales.aspx".ToUpper(), 17) diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index f87a5a85d..9777b70b6 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -461,6 +461,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.title = dr("DescripcionContrato").ToString cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) + cevent.FechaFinal = String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime) cevent.allDay = False cevent.NombreAcercamiento = dr("Ubicacion").ToString cevent.CveCliente = dr("CveCliente").ToString.ToEntero diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index 2908f46f6..ae28bb9d7 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1021,7 +1021,7 @@ Partial Class ContabilidadC_RegPrePolizaS End If 'Registra movimieno bancario - If gvr.DataKey("CveConceptoContable") = "30" AndAlso Importe <> 0 Then + If gvr.DataKey("CveConceptoContable") = "30" AndAlso (Importe <> 0 OrElse DdlPlantilla.SelectedValue = "53") Then Dim tFolio As String = gvr.DataKey("ContadoNumeroFolio").ToString If tFolio.ToEntero = 0 Then tFolio = SiguienteFolioBancos(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero) diff --git a/OI/Proyecto.aspx b/OI/Proyecto.aspx index 42b64e86c..a0ce32782 100644 --- a/OI/Proyecto.aspx +++ b/OI/Proyecto.aspx @@ -246,6 +246,29 @@ + +
+
+
+ + + Programación de bolsa aprobada en tiempo + + Indicador: +
+
+
+
+ + + + + : + +
+
+ +
diff --git a/OI/Proyecto.aspx.cs b/OI/Proyecto.aspx.cs index 2c4d1eaba..cfb70ae41 100644 --- a/OI/Proyecto.aspx.cs +++ b/OI/Proyecto.aspx.cs @@ -48,7 +48,22 @@ public partial class OI_Proyecto : ClsPaginas DdlTema.DataBind(); DdlTema.Items.Insert(0, new ListItem("Seleccione", "-1")); - + CargarCentrosDeCosto(null, DdlSubProyecto, null, LblSubProyecto, ""); + + if (DdlSubProyecto.Items.Count > 0) + { + DdlSubProyecto.Items.RemoveAt(0); + DdlSubProyecto.Items.Insert(0, new ListItem("Seleccione","-1")); + } + + + if (UsuarioActual.CveEmpresa == 13 ) + { + DvIndicador.Visible = true; + } + + + } } @@ -184,6 +199,7 @@ public partial class OI_Proyecto : ClsPaginas bool Continuar = false; int Folio = -1; int CveEvento = -1; + int CveIndicador = -1; if (cveUsuarioDe <= 0) { @@ -193,24 +209,59 @@ public partial class OI_Proyecto : ClsPaginas if (cveUsuarioPara <= 0) { errorMessage = "No se selecciono el miembro 'Para'"; - } + + if(DdlIndicador.SelectedValue.ToEntero() > 0 && DdlSubProyecto.SelectedValue.ToEntero() <0) + { + errorMessage = "Si agrega un indicador debe de agregar el sub proyecto."; + } + if (errorMessage.Length == 0) { List chkList = new List(); - + using (ClsOIEventos objOI = new ClsOIEventos()) { objOI.IniciaTransacSQL(); - Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, RCveEventoB); + + + if (DdlIndicador.SelectedValue.ToEntero() > 0) + { + + if (objOI.AddIndicador(DdlIndicador.SelectedValue.ToEntero(), DdlSubProyecto.SelectedValue.ToEntero(), UsuarioActual.CveUsuario,UsuarioActual.CveEmpresa) && objOI.CveIndicador > 0) + { + CveIndicador = objOI.CveIndicador; + Continuar = true; + } + else + { + Continuar = false; + } + } + else + { + Continuar = true; + } + + + if (Continuar) + { + Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, RCveEventoB, CveIndicador: CveIndicador); + } CveEvento = objOI.CveEvento; Folio = objOI.Folio; - if (CveEvento == 0) + + if (CveEvento > 0) + { + Continuar = true; + } + else { Continuar = false; } + if (Continuar) { objOI.Commit(); @@ -249,13 +300,17 @@ public partial class OI_Proyecto : ClsPaginas txtFechaI.Text = ""; } } + else + { + Alert(errorMessage,ModExtensiones.TipoMensaje.MsgAdvertencia); + } } protected void BtnopenmodalClickGant_Click(object sender, EventArgs e) { - + SetUsuarios(); RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarProyecto)); RCveEventoB = txtCveEvento.Text.ToEntero(); } diff --git a/OI/RepIndicadoresEMD.aspx b/OI/RepIndicadoresEMD.aspx new file mode 100644 index 000000000..df9eba8c3 --- /dev/null +++ b/OI/RepIndicadoresEMD.aspx @@ -0,0 +1,169 @@ +<%@ Page Title="Reporte de Indicadores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepIndicadoresEMD.aspx.vb" Inherits="OI_RepIndicadoresEMD" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> +<%@ Register Src="~/UserControl/AddMedico.ascx" TagPrefix="UserControl" TagName="AddMedico" %> + + + + + + Reporte de Indicadores + + + + + Reporte de Indicadores + + + + + + +
  • + Excel +
  • +
    + + + +
    + +
    + + + + + +
    +
    +
    + + +
    +
    +
    + + +
    + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + +
    + + : +
    + + +
    + + + + +
    +
    +
    + +
    +
    +
    + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    +
    + + + + + + + + +
    + + + + + diff --git a/OI/RepIndicadoresEMD.aspx.vb b/OI/RepIndicadoresEMD.aspx.vb new file mode 100644 index 000000000..3113521fc --- /dev/null +++ b/OI/RepIndicadoresEMD.aspx.vb @@ -0,0 +1,260 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports CrystalDecisions.Shared.Json +Imports DocumentFormat.OpenXml.Vml.Office +Imports Extensiones + + +Partial Class OI_RepIndicadoresEMD + Inherits ClsPaginas + + Property DTDatos As DataTable + Get + If ViewState("DTDatos") Is Nothing Then + ViewState("DTDatos") = New DataTable + End If + Return DirectCast(ViewState("DTDatos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTDatos") = value + End Set + End Property + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + + Dim FechaInicial As Date = New Date(10) + CargaCombos() + CargaDatos() + End If + + End Sub + Private Sub CargaCombos() + + + CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto, AplicaTodos:="Todos") + + + End Sub + + + Private Function CrearTablaDatos() As DataTable + Dim DTDatos As New DataTable + + DTDatos.Columns.Add("Numero", GetType(Integer)) + DTDatos.Columns.Add("Indicador", GetType(String)) + DTDatos.Columns.Add("Comentarios", GetType(String)) + DTDatos.Columns.Add("ACARREO SAN JOSE A QUILA", GetType(String)) + DTDatos.Columns.Add("PIPER MERIDIAN M500", GetType(String)) + DTDatos.Columns.Add("PRESA JALES PEÑA COLORADA", GetType(String)) + DTDatos.Columns.Add("MINA LA CRUZ", GetType(String)) + DTDatos.Columns.Add("TOGUI -UBER", GetType(String)) + DTDatos.Columns.Add("SAN IGNACIO", GetType(String)) + DTDatos.Columns.Add("Porcentaje", GetType(String)) + 'DTDatos.Columns.Add("", GetType(String)) + DTDatos.AcceptChanges() + + Dim nRow1 As DataRow = DTDatos.NewRow + Dim nRow2 As DataRow = DTDatos.NewRow + Dim nRow3 As DataRow = DTDatos.NewRow + Dim nRow4 As DataRow = DTDatos.NewRow + Dim nRow5 As DataRow = DTDatos.NewRow + Dim nRow6 As DataRow = DTDatos.NewRow + Dim nRow7 As DataRow = DTDatos.NewRow + Dim nRow8 As DataRow = DTDatos.NewRow + Dim nRow9 As DataRow = DTDatos.NewRow + Dim nRow10 As DataRow = DTDatos.NewRow + + + + 'ACARREO SAN JOSE A QUILA + 'PIPER MERIDIAN M500 + 'PRESA JALES PEÑA COLORADA + 'MINA LA CRUZ + 'TOGUI -UBER + 'SAN IGNACIO + + nRow1("Numero") = "1" + nRow1("Indicador") = "Programación de bolsa aprobada en tiempo" + nRow1("Comentarios") = "Si programaron en tiempo según la tarea" + nRow1("ACARREO SAN JOSE A QUILA") = "1" + nRow1("PIPER MERIDIAN M500") = "1" + nRow1("PRESA JALES PEÑA COLORADA") = "1" + nRow1("MINA LA CRUZ") = "0" + nRow1("TOGUI -UBER") = "1" + nRow1("SAN IGNACIO") = "1" + nRow1("Porcentaje") = "67%" + + nRow2("Numero") = "2" + nRow2("Indicador") = "Solicitudes fuera de presupuesto" + nRow2("Comentarios") = "Hacer cambios a presupuestos" + nRow2("ACARREO SAN JOSE A QUILA") = "1" + nRow2("PIPER MERIDIAN M500") = "0" + nRow2("PRESA JALES PEÑA COLORADA") = "0" + nRow2("MINA LA CRUZ") = "0" + nRow2("TOGUI -UBER") = "1" + nRow2("SAN IGNACIO") = "1" + nRow2("Porcentaje") = "67%" + + nRow3("Numero") = "3" + nRow3("Indicador") = "Viáticos dentro de presupuesto" + nRow3("Comentarios") = "Si se salió de lo gastado en el rubro de viáticos" + nRow3("ACARREO SAN JOSE A QUILA") = "" + nRow3("PIPER MERIDIAN M500") = "" + nRow3("PRESA JALES PEÑA COLORADA") = "" + nRow3("MINA LA CRUZ") = "" + nRow3("TOGUI -UBER") = "" + nRow3("SAN IGNACIO") = "" + nRow3("Porcentaje") = "" + + nRow4("Numero") = "4" + nRow4("Indicador") = "Viáticos no deducibles" + nRow4("Comentarios") = "Viáticos no deducibles" + nRow4("ACARREO SAN JOSE A QUILA") = "" + nRow4("PIPER MERIDIAN M500") = "" + nRow4("PRESA JALES PEÑA COLORADA") = "" + nRow4("MINA LA CRUZ") = "" + nRow4("TOGUI -UBER") = "" + nRow4("SAN IGNACIO") = "" + nRow4("Porcentaje") = "" + + nRow5("Numero") = "5" + nRow5("Indicador") = "Utilidad operativa" + nRow5("Comentarios") = "Ing-Egs" + nRow5("ACARREO SAN JOSE A QUILA") = "" + nRow5("PIPER MERIDIAN M500") = "" + nRow5("PRESA JALES PEÑA COLORADA") = "" + nRow5("MINA LA CRUZ") = "" + nRow5("TOGUI -UBER") = "" + nRow5("SAN IGNACIO") = "" + nRow5("Porcentaje") = "" + + nRow6("Numero") = "11" + nRow6("Indicador") = "Factura ligada a orden de compra en SIG" + nRow6("Comentarios") = "Relación" + nRow6("ACARREO SAN JOSE A QUILA") = "" + nRow6("PIPER MERIDIAN M500") = "" + nRow6("PRESA JALES PEÑA COLORADA") = "" + nRow6("MINA LA CRUZ") = "" + nRow6("TOGUI -UBER") = "" + nRow6("SAN IGNACIO") = "" + nRow6("Porcentaje") = "" + + nRow7("Numero") = "12" + nRow7("Indicador") = "Cumplimiento del programa de mantenimientos preventivos" + nRow7("Comentarios") = "" + nRow7("ACARREO SAN JOSE A QUILA") = "ND" + nRow7("PIPER MERIDIAN M500") = "ND" + nRow7("PRESA JALES PEÑA COLORADA") = "ND" + nRow7("MINA LA CRUZ") = "ND" + nRow7("TOGUI -UBER") = "ND" + nRow7("SAN IGNACIO") = "ND" + nRow7("Porcentaje") = "50%" + + nRow8("Numero") = "13" + nRow8("Indicador") = "Relación entre mantenimiento preventivo y correctivo" + nRow8("Comentarios") = "" + nRow8("ACARREO SAN JOSE A QUILA") = "ND" + nRow8("PIPER MERIDIAN M500") = "ND" + nRow8("PRESA JALES PEÑA COLORADA") = "ND" + nRow8("MINA LA CRUZ") = "ND" + nRow8("TOGUI -UBER") = "ND" + nRow8("SAN IGNACIO") = "ND" + nRow8("Porcentaje") = "50%" + + nRow9("Numero") = "14" + nRow9("Indicador") = "Consumo de combustible" + nRow9("Comentarios") = "" + nRow9("ACARREO SAN JOSE A QUILA") = "ND" + nRow9("PIPER MERIDIAN M500") = "ND" + nRow9("PRESA JALES PEÑA COLORADA") = "ND" + nRow9("MINA LA CRUZ") = "ND" + nRow9("TOGUI -UBER") = "ND" + nRow9("SAN IGNACIO") = "ND" + nRow9("Porcentaje") = "50%" + + nRow10("Numero") = "15" + nRow10("Indicador") = "Relación de entradas de almacén contra órdenes de compra" + nRow10("Comentarios") = "Relación" + nRow10("ACARREO SAN JOSE A QUILA") = "" + nRow10("PIPER MERIDIAN M500") = "" + nRow10("PRESA JALES PEÑA COLORADA") = "" + nRow10("MINA LA CRUZ") = "" + nRow10("TOGUI -UBER") = "" + nRow10("SAN IGNACIO") = "" + nRow10("Porcentaje") = "" + + + DTDatos.Rows.Add(nRow1) + DTDatos.Rows.Add(nRow2) + DTDatos.Rows.Add(nRow3) + DTDatos.Rows.Add(nRow4) + DTDatos.Rows.Add(nRow5) + DTDatos.Rows.Add(nRow6) + DTDatos.Rows.Add(nRow7) + DTDatos.Rows.Add(nRow8) + DTDatos.Rows.Add(nRow9) + DTDatos.Rows.Add(nRow10) + + DTDatos.AcceptChanges() + Return DTDatos + + End Function + + Public Sub CargaDatos() + + + + LnkExportar.Visible = False + + GvDatos.DataSource = CrearTablaDatos() + GvDatos.DataBind() + 'LnkExportar.Visible = True + 'GvDatos.DataBind() + + If GvDatos.Rows.Count > 0 Then + LnkExportar.Visible = True + End If + + UpDatos.Update() + + End Sub + + + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + +#Region "EXCEL" + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + + + Dim SbFiltros As New StringBuilder() + SbFiltros.AppendFormat($"Ejercicio: {DdlEjercicio.SelectedItem.Text} Periodo: {DdlPeriodo.SelectedItem.Text}|") + + + ' GvDatos.Columns(10).Visible = False + GvDatos.ExportToExcelGembox("IndicadoresEMD", UsuarioActual, "Indicadores EMD", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) + ' GvDatos.Columns(10).Visible = True + + + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub + +#End Region + + + + + + + + +End Class diff --git a/OI/TareaDetalle.aspx.cs b/OI/TareaDetalle.aspx.cs index 277819ec0..52732abc1 100644 --- a/OI/TareaDetalle.aspx.cs +++ b/OI/TareaDetalle.aspx.cs @@ -51,6 +51,12 @@ public partial class OI_TareaDetalle : ClsPaginas public System.Data.DataTable CheckListNew { get { return ViewState["CheckListNew"] != null ? (System.Data.DataTable)ViewState["CheckListNew"] : null; } set { ViewState["CheckListNew"] = value; } } public int chklistitemindex { get { return ViewState["chklistitemindex"] != null ? ViewState["chklistitemindex"].ToString().ToEntero() : 0; } set { ViewState["chklistitemindex"] = value; } } + + public int CveIndicador { get { return ViewState["CveIndicador"].ToString().ToEntero(); } set { ViewState["CveIndicador"] = value; } } + public int Indicador { get { return ViewState["Indicador"].ToString().ToEntero(); } set { ViewState["Indicador"] = value; } } + public int ValorIndicador { get { return ViewState["ValorIndicador"].ToString().ToEntero(); } set { ViewState["ValorIndicador"] = value; } } + public int CveSubProyectoIndicador { get { return ViewState["CveSubProyectoIndicador"].ToString().ToEntero(); } set { ViewState["CveSubProyectoIndicador"] = value; } } + #endregion protected void Page_Load(object sender, EventArgs e) { @@ -72,6 +78,12 @@ public partial class OI_TareaDetalle : ClsPaginas EsNuevo = true; CveUsuarioPara = 0; CveUsuarioDe = 0; + + CveIndicador = -1; + Indicador = -1; + ValorIndicador = -1; + CveSubProyectoIndicador = -1; + if (Request["Archivo"] != null) { string strArchivo = string.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ModExtensiones.Decripta(Request["Archivo"].ToString())); @@ -458,6 +470,11 @@ public partial class OI_TareaDetalle : ClsPaginas //OIE.[CveEventoEstatus], OIE.[FechaInicio], OIE.[FechaFin], OIE.[FechaRealTermino], OIE.[CveRevision], OIE.[Archivo], OIE.[FechaIng], //OIE.[CveUsuarioIng], OIE.[CveEmpresa], OIE.[CveUsuarioModifico], OIE.[Avance] + CveIndicador = drow["CveIndicador"].ToString().ToEntero(); + Indicador = drow["Indicador"].ToString().ToEntero(); + ValorIndicador = drow["ValorIndicador"].ToString().ToEntero(); + CveSubProyectoIndicador = drow["CveSubProyectoIndicador"].ToString().ToEntero(); + LtlVinculo.Text = ""; LtlVinculoLink.Text = ""; CveEventoPadre = drow["CveEventoPadre"].ToString().ToEntero(); @@ -1021,8 +1038,15 @@ public partial class OI_TareaDetalle : ClsPaginas using (ClsOIEventos objOI = new ClsOIEventos()) { + objOI.IniciaTransacSQL(); + bool ProcesoOK = false; if (objOI.UpdateEstatusEvento2(CveEstatus, -1, RCveEvento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtComentarioTerminarpadre.Text)) + { + ProcesoOK = true; + } + + if (ProcesoOK) { ObjEventosCorreo o = objOI.objCorreo; if (CveEstatus >= 3) @@ -1033,31 +1057,22 @@ public partial class OI_TareaDetalle : ClsPaginas { pnlfecharealtermino.Visible = false; } - //CargaEstatusEventos(DdlEventoEstatus.SelectedValue.ToEntero); - //if (DdlEventoEstatus.SelectedValue.ToEntero == 3 | DdlEventoEstatus.SelectedValue.ToEntero == 1) - // EnviarCorreoCambioEstatus(false); - //CargaDatos(); if (CveEstatus == 4) { TxtAvance.Text = "100"; LblPorcentaje.Text = string.Format("{0:##0.##}", "100".ToDecimal()); - } - string mensaje = string.Format("Se cambió el Estatus de \"{0}\" a \"{1}\"", DdlEventoEstatus.SelectedItem.Text, DDlEstatus.SelectedItem.Text); - DdlEventoEstatus.SelectedValueExist(DDlEstatus.SelectedValue); - lblEstatus.Text = DdlEventoEstatus.SelectedItem.Text; - UpEstatus.Update(); - RegistraScript(string.Format("$('#{0}').modal('hide')", iddivCambiarEstatus)); - Alert(mensaje, ModExtensiones.TipoMensaje.ToastInformacion); - cargaActividades(objOI); + } string Nombrede = ""; string Nombrepara = ""; + System.Data.DataTable dt = get_GlobalDTUsuarios(CveUsuario: CveUsuarioDe, CveEmpresa: UsuarioActual.CveEmpresa); if (dt.Rows.Count > 0) { Nombrede = dt.Rows[0]["Nombre"].ToString(); } + dt = get_GlobalDTUsuarios(CveUsuario: CveUsuarioDe, CveEmpresa: UsuarioActual.CveEmpresa); if (dt.Rows.Count > 0) { @@ -1068,10 +1083,46 @@ public partial class OI_TareaDetalle : ClsPaginas DateTime FFin = txtFechaF.Text.ToDateTimeExcat(); if (o != null) { - string mailbody = MailgetBodyNuevatarea(o.Folio, o.Link, o.Asunto, o.Descripcion, fInicio,FFin, o.Prioridad, o.Tema, Nombrede, Nombrepara, string.Format("Tarea Estatus Actualizado ({0})", o.Estatus)); + string mailbody = MailgetBodyNuevatarea(o.Folio, o.Link, o.Asunto, o.Descripcion, fInicio, FFin, o.Prioridad, o.Tema, Nombrede, Nombrepara, string.Format("Tarea Estatus Actualizado ({0})", o.Estatus)); EnviarCorreo(UsuarioActual.Empresa, o.AsuntoCorreo, mailbody, o.mailPara, ""); } + } + if (ProcesoOK && CveIndicador > 0 && (DDlEstatus.SelectedValue.ToEntero() == 3 || DDlEstatus.SelectedValue.ToEntero() == 4)){ + if(Indicador == 1) + { + int Valor = 0; + int dias = (int) (txtFechaF.Text.ToDate() - NowADS()).TotalDays; + if (dias >= -2) + { + Valor = 1; + } + + if (!objOI.UpdateIndicador(CveIndicador, Valor, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + ProcesoOK = false; + } + } + } + + if (ProcesoOK){ + + cargaActividades(objOI); + + objOI.Commit(); + + string mensaje = string.Format("Se cambió el Estatus de \"{0}\" a \"{1}\"", DdlEventoEstatus.SelectedItem.Text, DDlEstatus.SelectedItem.Text); + DdlEventoEstatus.SelectedValueExist(DDlEstatus.SelectedValue); + lblEstatus.Text = DdlEventoEstatus.SelectedItem.Text; + UpEstatus.Update(); + RegistraScript(string.Format("$('#{0}').modal('hide')", iddivCambiarEstatus)); + + Alert(mensaje, ModExtensiones.TipoMensaje.ToastInformacion); + + + } + else{ + objOI.RollBack(); } } diff --git a/OS/RepOSEstatus.aspx b/OS/RepOSEstatus.aspx new file mode 100644 index 000000000..a04d48792 --- /dev/null +++ b/OS/RepOSEstatus.aspx @@ -0,0 +1,19 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepOSEstatus.aspx.vb" Inherits="OS_RepOSEstatus" %> + + + + + + + + + + + + + + + + + + diff --git a/OS/RepOSEstatus.aspx.vb b/OS/RepOSEstatus.aspx.vb new file mode 100644 index 000000000..80b2766b1 --- /dev/null +++ b/OS/RepOSEstatus.aspx.vb @@ -0,0 +1,5 @@ + +Partial Class OS_RepOSEstatus + Inherits System.Web.UI.Page + +End Class diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 2d01f9a80..86deadc43 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -269,7 +269,7 @@
    - Observaciones
    -
    diff --git a/Transportes/RepContratosCalendario.aspx b/Transportes/RepContratosCalendario.aspx index aa7504d5c..38edd3696 100644 --- a/Transportes/RepContratosCalendario.aspx +++ b/Transportes/RepContratosCalendario.aspx @@ -21,7 +21,7 @@ #chartdiv { width: 100%; - height: 700px; + height: 600px; } @@ -280,36 +280,33 @@ - - -
    -
    -
    - -
    -
    -
    - - -
    - - - - + +
    +
    +
    + +
    +
    +
    + +
    + + + + +
    +
    -
    -
    - - + +
    -
    +
    - @@ -526,7 +523,6 @@ "February": "Febrero", "March": "Marzo", "April": "Abril", - "May": "Mayo", "June": "Junio", "July": "Julio", "August": "Agosto", @@ -537,7 +533,7 @@ }; - function cargaDiagramaGrant(data, categorias) { + function cargaDiagramaGrant(data, categorias, TipoVista) { am5.ready(function () { //SI YA HAY GRAFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA @@ -566,7 +562,7 @@ layout: root.verticalLayout, paddingLeft: 0 })); - + // Add legend // https://www.amcharts.com/docs/v5/charts/xy-chart/legend-xy-series/ var legend = chart.children.push(am5.Legend.new(root, { @@ -650,23 +646,24 @@ chart.set("scrollbarY", scrollbarY); - /// evento para ajustar el alto del row - var cellSize = 30; - chart.events.on("datavalidated", function (ev) { + + series.events.on("datavalidated", function (ev) { + let cellSize = 45; - // Get objects of interest - var chart = ev.target; - var categoryAxis = chart.yAxes.getIndex(0); + if (TipoVista == 1) { + cellSize = 60; + } + //let series = ev.target; + //let chart = series.chart; + let xAxis = chart.xAxes.getIndex(0); // Calculate how we need to adjust chart height - var adjustHeight = chart.data.length * cellSize - categoryAxis.pixelHeight; - - // get current chart height - var targetHeight = chart.pixelHeight + adjustHeight; + let chartHeight = categorias.length * cellSize + xAxis.height() + chart.get("paddingTop", 0) + chart.get("paddingBottom", 0); // Set it on chart's container - chart.svgContainer.htmlElement.style.height = targetHeight + "px"; + chart.root.dom.style.height = chartHeight + "px"; }); + //root.language.setTranslationAny("May", "Mayo"); // Make stuff animate on load // https://www.amcharts.com/docs/v5/concepts/animations/ @@ -699,8 +696,13 @@ $('#<%=TxtObservaciones.ClientID%>').val(event.title); $('#<%=TxtDescripcion.ClientID%>').val(event.title); $('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento); - $('#<%=TxtFechaSalida.ClientID%>').val(event.start._i); - $('#<%=TxtFechaRegreso.ClientID%>').val(event.end._i); + + <%--$('#<%=TxtFechaSalida.ClientID%>').val(event.start._i); + $('#<%=TxtFechaRegreso.ClientID%>').val(event.end._i);--%> + + $('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start._i)); + $('#<%=TxtFechaRegreso.ClientID%>').val(formatearFechaISO(event.FechaFinal)); + $('#<%=DdlClientes.ClientID%>').val(event.CveCliente); $('#<%=DdlAF.ClientID%>').val(event.CveActivoFijo); $('#<%=DdlChofer.ClientID%>').val(event.CvePersonal); @@ -713,16 +715,40 @@ if (event.NombreComercial !== null) { - $('#HidModClienteNombre').val(''); + $('#HidModClienteNombre').val(''); } else { $('#HidModClienteNombre').val(event.NombreComercial); - } + } - $('#HidModCveCliente').val(event.CveCliente); + $('#HidModCveCliente').val(event.CveCliente); $('#<%=BtnModal.ClientID%>').click(); } + + function formatearFechaISO(fechaISO) { + let fecha = new Date(fechaISO); + + // Formatear la fecha en DD/MM/YYYY + let dia = fecha.getDate().toString().padStart(2, '0'); + let mes = (fecha.getMonth() + 1).toString().padStart(2, '0'); // getMonth() devuelve mes de 0-11 + let año = fecha.getFullYear(); + + // Formatear la hora en formato 12 horas con AM/PM + let horas = fecha.getHours(); + let minutos = fecha.getMinutes().toString().padStart(2, '0'); + let periodo = 'a. m.'; + if (horas >= 12) { + periodo = 'p. m.'; + horas = horas > 12 ? horas - 12 : horas; // Convertir hora de formato 24 a 12 horas + } + if (horas === 0) horas = 12; // Medianoche se muestra como 12 a.m. + horas = horas.toString().padStart(2, '0'); + + // Combinar la fecha y la hora + return `${dia}/${mes}/${año} ${horas}:${minutos}:00 ${periodo}`; + } + function RadionButtonSelectedValueSet(name, SelectdValue) { $('input[name="' + name + '"][value="' + SelectdValue + '"]').prop('checked', true); } @@ -827,6 +853,8 @@ }); } + + diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index 81f09aa7f..bff2a01e6 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -103,7 +103,7 @@ Partial Class RepContratosCalendario jsonCategorias.Add(obj) Next - RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()});", "A1") + RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()},{TipoVista});", "A1") UPPGantt.Update() End If End Sub diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index e55054346..53090e7fb 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -9619,10 +9619,11 @@ TxtImporte.value = FormatoNumero(ImporteRestante, 2); $get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) + ToDouble(TxtImporte.value), 2); }else { - $get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) + Importe, 2); + $get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) + Importe, 2); + TxtImporte.value = FormatoNumero(Importe, 2); } - if (ToDouble(TxtImporte.value) <= 0) { + if (ToDouble(TxtImporte.value.replace(",", "")) <= 0) { Chk.checked = false; } diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9a3383d0a..e387c6444 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2286,6 +2286,15 @@ Partial Class Ventas End Set End Property + Private Property TieneBloqueoPorCreditoVencimiento As Integer + Get + Return IfNull(ViewState("TieneBloqueoPorCreditoVencimiento"), "0", ViewState("TieneBloqueoPorCreditoVencimiento")).ToString().ToEntero() + End Get + Set(value As Integer) + ViewState("TieneBloqueoPorCreditoVencimiento") = value + End Set + End Property + Private Property EsNCDevolucionEfectivo As Boolean Get Return If(IsNothing(ViewState("EsNCDevolucionEfectivo")), False, CType(ViewState("EsNCDevolucionEfectivo"), Boolean)) @@ -2439,6 +2448,8 @@ Partial Class Ventas Me.CveVendedorContrato = -1 Me.CveVendedorEmpresaCRM = -1 Me.EsGarantia = False + Me.TieneBloqueoPorCreditoVencimiento = 0 + Me.ClienteEsDistribuidor = False CveEmpresaCRM = 0 CveAcercamientoCRM = 0 EstatusCliente = False @@ -5905,7 +5916,7 @@ Partial Class Ventas End If 'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR - If TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then + If (TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad")) AndAlso TieneBloqueoPorCreditoVencimiento = 0 Then BtnsFacturar.Visible = True 'E119, bloquear la facturación de remisiones que no estén surtidas @@ -5935,48 +5946,51 @@ Partial Class Ventas 'Si es Empresa de Acumuladores If CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DbRowVenta("TipoDocto").ToString() = "Rem" AndAlso (GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() <> 5) Then - BtnsFacturar.Visible = False - - Dim DtUsadosPendientes As DataTable = Nothing - Dim DtGarantiasPendientes As DataTable = Nothing - - Dim ObjUsados As New ClsVentas - - If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then - DtUsadosPendientes = ObjUsados.DtResultados.Copy() - End If - - If ObjUsados.GetVentasGarantiaPendiente(CveVenta, NowADS(), UsuarioActual.CveEmpresa) Then - DtGarantiasPendientes = ObjUsados.DtResultados.Copy() - End If - - 'If ObjUsados.GetVentasGarantiaPendiente(CveVenta, -1, NowADS(), UsuarioActual.CveEmpresa) Then - ' DtGarantiasPendientes = ObjUsados.DtResultados.Copy() - 'End If - - ObjUsados.Dispose() - - BtnsFacturar.Visible = True - - 'VERIFICA SI YA SE FACTURO COMPLETAMENTE - If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then + If TieneBloqueoPorCreditoVencimiento = 0 Then BtnsFacturar.Visible = False - End If - 'VERIFICA SI TIENE USADOS O GARANTIAS PENDIENTES - If BtnsFacturar.Visible Then - If (Not EsGarantia AndAlso (DtUsadosPendientes IsNot Nothing AndAlso DtUsadosPendientes.Rows.Count > 0)) Then - BtnsFacturar.Visible = False - Alert("Tiene usados pendiente de recibir", TipoMensaje.MsgAdvertencia) + Dim DtUsadosPendientes As DataTable = Nothing + Dim DtGarantiasPendientes As DataTable = Nothing + + Dim ObjUsados As New ClsVentas + + If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then + DtUsadosPendientes = ObjUsados.DtResultados.Copy() End If - If (EsGarantia AndAlso (DtGarantiasPendientes IsNot Nothing AndAlso DtGarantiasPendientes.Rows.Count > 0)) Then - Alert("Tiene garantías pendientes de recibir", TipoMensaje.MsgAdvertencia) + If ObjUsados.GetVentasGarantiaPendiente(CveVenta, NowADS(), UsuarioActual.CveEmpresa) Then + DtGarantiasPendientes = ObjUsados.DtResultados.Copy() + End If + + 'If ObjUsados.GetVentasGarantiaPendiente(CveVenta, -1, NowADS(), UsuarioActual.CveEmpresa) Then + ' DtGarantiasPendientes = ObjUsados.DtResultados.Copy() + 'End If + + ObjUsados.Dispose() + + BtnsFacturar.Visible = True + + 'VERIFICA SI YA SE FACTURO COMPLETAMENTE + If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then BtnsFacturar.Visible = False End If + + 'VERIFICA SI TIENE USADOS O GARANTIAS PENDIENTES + If BtnsFacturar.Visible Then + If (Not EsGarantia AndAlso (DtUsadosPendientes IsNot Nothing AndAlso DtUsadosPendientes.Rows.Count > 0)) Then + BtnsFacturar.Visible = False + Alert("Tiene usados pendiente de recibir", TipoMensaje.MsgAdvertencia) + End If + + If (EsGarantia AndAlso (DtGarantiasPendientes IsNot Nothing AndAlso DtGarantiasPendientes.Rows.Count > 0)) Then + Alert("Tiene garantías pendientes de recibir", TipoMensaje.MsgAdvertencia) + BtnsFacturar.Visible = False + End If + End If + + LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) End If - LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) End If 'SI ES COMPLEMENTARIA, NO DEBE PERMITIR FACTURAR @@ -6071,7 +6085,7 @@ Partial Class Ventas CargaPS(-1, DdlPS) 'Verifico si tiene la funcionalidad (135) - If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") AndAlso TieneBloqueoPorCreditoVencimiento = 0 Then Select Case UsuarioActual.Empresa.Funcionalidad(135) Case "1" ' POR SUPERVISOR @@ -6182,14 +6196,13 @@ Partial Class Ventas End Function Private Sub VerificarBtnFacturarCotizacion(CveVendedor As Integer, Optional MostrarGenerarRemision As Boolean = True) - If TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") Then + If TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso TieneBloqueoPorCreditoVencimiento = 0 Then If UsuarioActual.TienePermisoProceso(199) Then BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) Else BtnGenerarRemision.Visible = False End If - If UsuarioActual.TienePermisoProceso(60) Then BtnsFacturar.Visible = True 'puede facturar If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.TienePermisoProceso(60) Then @@ -7590,7 +7603,7 @@ Partial Class Ventas If Not EsCreaApartirDe AndAlso (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValueExist("Cot") Else - If UsuarioActual.Empresa.Funcionalidad(531) <> "1" Then + If UsuarioActual.Empresa.Funcionalidad(595) = "1" Then DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") DdlTipoComprobante.SelectedValue = "PA" @@ -7611,9 +7624,19 @@ Partial Class Ventas DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) End If + Dim Bloqueo As Boolean = False + + If Not DdlTipoComprobante.SelectedValue.Contiene("PA") AndAlso UsuarioActual.Empresa.Funcionalidad(531) <> "1" Then + Bloqueo = True + End If + + 'SI EL CLIENTE ES DISTRIBUIDOR Y TIENE FACTURAS VENCIDAS, DEBE BLOQUEAR + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then + Bloqueo = True + End If 'SI ES AUTORIZACION DEBE PERMITIR GENERARLA - If (Not DdlTipoComprobante.SelectedValue.Contiene("PA")) AndAlso UsuarioActual.Empresa.Funcionalidad(531) <> "1" Then + If Bloqueo Then BtnEmitirImprimir.Visible = False BtnsFacturar.Visible = False LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) @@ -7621,6 +7644,11 @@ Partial Class Ventas LnkPedido2SinFacturar.Visible = False LnkCotizaciones.Visible = False LnkOCs.Visible = False + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + TieneBloqueoPorCreditoVencimiento = 1 + End If + End If If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then @@ -7645,6 +7673,7 @@ Partial Class Ventas 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO If Autorizacion > 0 Then BtnsFacturar.Visible = True + TieneBloqueoPorCreditoVencimiento = 0 End If End If @@ -7688,6 +7717,7 @@ Partial Class Ventas 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO If Autorizacion > 0 Then BtnsFacturar.Visible = True + TieneBloqueoPorCreditoVencimiento = 0 End If End If @@ -7758,6 +7788,10 @@ Partial Class Ventas BtnsFacturar.Visible = False BtnGenerarRemision.Visible = False Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then + TieneBloqueoPorCreditoVencimiento = 1 + End If End If End If End If @@ -7773,45 +7807,62 @@ Partial Class Ventas End If ObjVentas.Dispose() Case Else 'SI NO TIENE NINGUN TIPO DE AUTORIZACION CONFIGURADO - 'RMF. codigo temporal para pruebas - If Alertas AndAlso UsuarioActual.CveEmpresa = 140 Then + 'VERIFICAR CANDADOS DE VENTA + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) Vta.Dispose() If Opcion > 0 Then - LnkSolicitarCredito.Visible = True + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then + TieneBloqueoPorCreditoVencimiento = 1 + End If End If + End If + + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + RBLPago.SelectedValue = "2" + RBLPago.Items(0).Enabled = False + RBLPago_SelectedIndexChanged(Nothing, Nothing) + UPCondicionesPago.Update() Else - 'VERIFICAR CANDADOS DE VENTA - If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 Then - Dim Vta As New ClsVentas - Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) - Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) - Vta.Dispose() - If Opcion > 0 Then - BtnsFacturar.Visible = False - BtnGenerarRemision.Visible = False - Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + 'este codigo no es temporal + If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + LnkSolicitarCredito.Visible = True + DdlTipoAutorizacion.SelectedValueExist("1") + + If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then + Dim Autorizacion As Integer = 0 + + Dim ObjVentas As New ClsVentas + If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then + Dim RowAutorizacion As DataRow = Nothing + 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO + If TieneDiasVencidos Then + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + Else + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + End If + + If RowAutorizacion IsNot Nothing Then + Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero() + End If + End If + ObjVentas.Dispose() + + 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO + If Autorizacion <= 0 Then + BtnEmitirImprimir.Visible = False + TieneBloqueoPorCreditoVencimiento = 1 + End If + End If End If - - If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - RBLPago.SelectedValue = "2" - RBLPago.Items(0).Enabled = False - RBLPago_SelectedIndexChanged(Nothing, Nothing) - UPCondicionesPago.Update() - Else - 'este codigo no es temporal - If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) - If UsuarioActual.CveEmpresa = 140 Then - LnkSolicitarCredito.Visible = True - DdlTipoAutorizacion.SelectedValueExist("1") - End If - End If - - End If End Select @@ -7822,13 +7873,32 @@ Partial Class Ventas 'VERIFICAR RESTRICCIONES DEL CLIENTE If Not UsuarioActual.Empresa.Funcionalidad(702).ToEntero() > 0 Then - If (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "2") Then - Dim Valida As Boolean = True - If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (Me.CveCliente = UsuarioActual.Empresa.Funcionalidad(714).ToEntero() OrElse Me.PermiteCredito) Then - Valida = False + + Dim ValidaRemision As Boolean = False + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + ValidaRemision = True + End If + + Dim ValidaCondicionesCredito As Boolean = False + + 'SI ES UNA VENTA EXISTENTE + If CveVenta > 0 Then + If (DdlTipoComprobante.SelectedValue = "Cot") AndAlso RBLPago.SelectedValue = "2" Then + ValidaCondicionesCredito = True End If - If Valida Then + If (ValidaRemision AndAlso DdlTipoComprobante.SelectedValue = "Rem") AndAlso RBLPago.SelectedValue = "1" Then + ValidaCondicionesCredito = True + End If + End If + + If ValidaCondicionesCredito Then + Dim ValidaCliente As Boolean = True + If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (Me.CveCliente = UsuarioActual.Empresa.Funcionalidad(714).ToEntero() OrElse Me.PermiteCredito) Then + ValidaCliente = False + End If + + If ValidaCliente Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) @@ -7858,6 +7928,10 @@ Partial Class Ventas Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) BtnsFacturar.Visible = False BtnGenerarRemision.Visible = False + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then + TieneBloqueoPorCreditoVencimiento = 1 + End If End If Else @@ -7865,6 +7939,10 @@ Partial Class Ventas Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) BtnsFacturar.Visible = False BtnGenerarRemision.Visible = False + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then + TieneBloqueoPorCreditoVencimiento = 1 + End If End If End If End If @@ -17932,7 +18010,7 @@ Partial Class Ventas TrAlmacenOrigen.Visible = False If DdlTipoComprobante.SelectedValue = "Cot" And UsuarioActual.Empresa.Funcionalidad(135).Contiene("1", "2") Then - Alert("Se ocupa una autorización.", TipoMensaje.MsgAdvertencia) + Alert("Se requiere una autorización.", TipoMensaje.MsgAdvertencia) TrDireccion.Visible = False TrCiudad.Visible = False TrRFC.Visible = False @@ -18327,14 +18405,14 @@ Partial Class Ventas If Not CveEmpresaCRM > 0 Then 'SI ES UNA REMISION EXISTENTE, NO MOSTRAR LOS BOTONES If Not (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Rem") Then - BtnCrearApartirDe.Enabled = EstatusCliente - BtnEmitirImprimir.Visible = EstatusCliente + BtnCrearApartirDe.Enabled = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 + BtnEmitirImprimir.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 TrVistaPrevia.Visible = EstatusCliente End If Else If TipoDoctoConsulta.Contiene("Ing", "Egs", "Ant", "Dev") Then - BtnCrearApartirDe.Enabled = EstatusCliente - BtnEmitirImprimir.Visible = EstatusCliente + BtnCrearApartirDe.Enabled = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 + BtnEmitirImprimir.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 TrVistaPrevia.Visible = EstatusCliente Else BtnCrearApartirDe.Enabled = True @@ -23383,8 +23461,11 @@ Partial Class Ventas ' DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND (CveTipoCuenta <> 1 OR TieneTerminal = 1)", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) 'End If - DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) - + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0}", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) + Else + DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) + End If DtCC.Dispose() DdlCuentaEfectivo.DataBind()