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 2ada13980..0b524ae8f 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -10518,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/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/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