From c2dc285525615088d49e9706649334712434dc40 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 7 May 2024 23:09:07 -0700 Subject: [PATCH] Proyectos --- App_Code/ClsOIEventos.vb | 62 ++++++- App_Code/ClsPaginas.vb | 1 + OI/Proyecto.aspx | 23 +++ OI/Proyecto.aspx.cs | 67 +++++++- OI/RepIndicadoresEMD.aspx | 306 +++++++++++++++++++++++++++++++++++ OI/RepIndicadoresEMD.aspx.vb | 251 ++++++++++++++++++++++++++++ 6 files changed, 703 insertions(+), 7 deletions(-) create mode 100644 OI/RepIndicadoresEMD.aspx create mode 100644 OI/RepIndicadoresEMD.aspx.vb 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/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 2e23ed098..fec7d95dc 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10517,6 +10517,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/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..7cc797d2b 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..3cb62f323 --- /dev/null +++ b/OI/RepIndicadoresEMD.aspx @@ -0,0 +1,306 @@ +<%@ 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 Comisiones + + + + + Reporte de Comisiones + + + + + +
  • + +
  • +
  • + Excel +
  • +
    + + + +
    + +
    + + + + + +
    +
    +
    + + +
    +
    +
    + + +
    + Fecha Inicio: +
    +
    +
    + + + + +
    + + + + + + +
    +
    + Fecha Fin: + +
    +
    +
    + + + + +
    + + + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    +
    +
    + +
    +
    +
    + + + + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    +
    + +
    +
    + + + + + +
    +
    + " 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..366cd4397 --- /dev/null +++ b/OI/RepIndicadoresEMD.aspx.vb @@ -0,0 +1,251 @@ +Option Explicit On +Option Strict On + +Imports System.Data +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) + + txtFechaI.Text = Now.FirstDayOfMonth.ToString("dd/MM/yyyy") + txtFechaF.Text = Now.ToString("dd/MM/yyyy") + CargaCombos() + CargaDatos() + End If + + End Sub + + Private Sub CargaCombos() + + + 'If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then + ' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros(String.Format("VendedorTipo IN (1,4) AND (CveSubProyecto IS NULL OR CveSubProyecto = {0})", DdlSubProyectoDatos.SelectedValue)) + 'Else + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros("VendedorTipo = 1") + 'End If + DdlVendedor.DataBind() + DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1")) + + + DdlMedico.DataSource = GlobalDTMedicos(UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True' ") + DdlMedico.DataBind() + DdlMedico.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlUsuarioAtendio.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa) + DdlUsuarioAtendio.DataBind() + DdlUsuarioAtendio.Items.Insert(0, New ListItem("Todos", "-1")) + + + + End Sub + + Public Sub CargaDatos() + + + + LnkExportar.Visible = False + + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetComisionesMedicasRep(txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, UsuarioActual.CveEmpresa, -1, -1, DdlMedico.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuarioAtendio.SelectedValue.ToEntero, -1, 1) Then + GvDatos.DataSource = ObjVentas.DtResultados + + If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + LnkExportar.Visible = True + End If + Else + GvDatos.DataSource = Nothing + End If + + ObjVentas.Dispose() + + GvDatos.DataBind() + + UpDatos.Update() + + End Sub + + Public Sub CargaDatosEspeciales() + + + + LnkExportar.Visible = False + + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetComisionesMedicasRep(txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, UsuarioActual.CveEmpresa, -1, -1, DdlMedico.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuarioAtendio.SelectedValue.ToEntero, -1, 2) Then + GvDatosEspeciales.DataSource = ObjVentas.DtResultados + + If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + LnkExportar.Visible = True + End If + Else + GvDatosEspeciales.DataSource = Nothing + End If + + ObjVentas.Dispose() + + GvDatosEspeciales.DataBind() + + UpDatosEspeciales.Update() + + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + + If Tabs.ActiveTabIndex = 0 Then + CargaDatos() + Else + CargaDatosEspeciales() + End If + + End Sub + +#Region "EXCEL" + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + + + Dim SbFiltros As New StringBuilder() + SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|") + + + If Tabs.ActiveTabIndex = 0 Then + GvDatos.Columns(10).Visible = False + GvDatos.ExportToExcelGembox("Comisiones", UsuarioActual, "Comisiones", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) + GvDatos.Columns(10).Visible = True + Else + GvDatosEspeciales.ExportToExcelGembox("Comisiones", UsuarioActual, "Comisiones Especiales", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) + End If + + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub + +#End Region + + + Protected Sub LnkComisiones_Click(sender As Object, e As EventArgs) + CargaComisiones() + RegistraScript("$('#DvModalComisiones').modal('show');") + End Sub + + Private Sub CargaComisiones() + DTDatos = New DataTable + GvComisiones.DataSource = Nothing + + Dim objVentas As New ClsVentas + + If objVentas.GetComisionesMedicas(UsuarioActual.CveEmpresa) Then + GvComisiones.DataSource = objVentas.DtResultados + DTDatos = objVentas.DtResultados + End If + + objVentas.Dispose() + + GvComisiones.DataBind() + + UpDvModalComisiones.Update() + + End Sub + + + + Protected Sub BtnGuardarComisiones_Click(sender As Object, e As EventArgs) + + Dim objVentas As New ClsVentas + objVentas.IniciaTransacSQL() + + Dim TieneError As Boolean = False + + For Each GvRow As GridViewRow In GvComisiones.Rows + + Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero + Dim ComisionMedicoDT As Decimal = DTDatos.FiltroPrimeroValor("ComisionMedico", $"CvePS = {CvePS} ").ToDecimal + Dim ComisionVendedorDT As Decimal = DTDatos.FiltroPrimeroValor("ComisionVendedor", $"CvePS = {CvePS} ").ToDecimal + Dim ComisionTecnicoDT As Decimal = DTDatos.FiltroPrimeroValor("ComisionTecnico", $"CvePS = {CvePS} ").ToDecimal + Dim ComisionGerenteDT As Decimal = DTDatos.FiltroPrimeroValor("ComisionGerente", $"CvePS = {CvePS} ").ToDecimal + + Dim ComisionMedicoGV As Decimal = GvRow.FCTextBox("TxtComisionMedico").Text.ToDecimal + Dim ComisionGerenteGV As Decimal = (GvRow.FCTextBox("TxtComisionGerente").Text.ToDecimal / 100).RoundSQL(4) + Dim ComisionVendedorGV As Decimal = (GvRow.FCTextBox("TxtComisionVendedor").Text.ToDecimal / 100).RoundSQL(4) + Dim ComisionTecnicoGV As Decimal = (GvRow.FCTextBox("TxtComisionTecnico").Text.ToDecimal / 100).RoundSQL(4) + + + If ComisionMedicoDT <> ComisionMedicoGV Or ComisionVendedorDT <> ComisionVendedorGV Or ComisionTecnicoDT <> ComisionTecnicoGV Or ComisionGerenteDT <> ComisionGerenteGV Then + If Not objVentas.AddUpdateComisionesMedicas(GvRow.DataKey("CvePS").ToEntero, UsuarioActual.CveEmpresa, ComisionMedicoGV, ComisionVendedorGV, ComisionTecnicoGV, ComisionGerenteGV) Then + TieneError = True + End If + End If + + Next + + If TieneError Then + objVentas.RollBack() + Else + objVentas.Commit() + Alert("Comisiones Actualizadas correctamente") + End If + + objVentas.Dispose() + + End Sub + + Protected Sub GvComisiones_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + 'ComisionMedico,ComisionGerente,ComisionVendedor,ComisionTecnico" + + If e.Row.DataKey("ComisionMedico").ToDecimal = 0 Then + e.Row.FCTextBox("TxtComisionMedico").Text = "" + Else + e.Row.FCTextBox("TxtComisionMedico").Text = e.Row.DataKey("ComisionMedico").ToDecimal.ToString("###.00") + End If + + + If e.Row.DataKey("ComisionGerente").ToDecimal = 0 Then + e.Row.FCTextBox("TxtComisionGerente").Text = "" + Else + e.Row.FCTextBox("TxtComisionGerente").Text = (e.Row.DataKey("ComisionGerente").ToDecimal * 100).ToString("###.00") + End If + + + If e.Row.DataKey("ComisionVendedor").ToDecimal = 0 Then + e.Row.FCTextBox("TxtComisionVendedor").Text = "" + Else + e.Row.FCTextBox("TxtComisionVendedor").Text = (e.Row.DataKey("ComisionVendedor").ToDecimal * 100).ToString("###.00") + End If + + If e.Row.DataKey("ComisionTecnico").ToDecimal = 0 Then + e.Row.FCTextBox("TxtComisionTecnico").Text = "" + Else + e.Row.FCTextBox("TxtComisionTecnico").Text = (e.Row.DataKey("ComisionTecnico").ToDecimal * 100).ToString("###.00") + End If + + + + End If + + End Sub +End Class