247 lines
7.0 KiB
VB.net
247 lines
7.0 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Ventas_CatProcedimientos
|
|
Inherits ClsPaginas
|
|
|
|
|
|
Public Property CveProcedimiento As Integer
|
|
Get
|
|
If ViewState("CveProcedimiento") Is Nothing Then
|
|
ViewState("CveProcedimiento") = -1
|
|
End If
|
|
Return ViewState("CveProcedimiento").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProcedimiento") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
CargaCombos()
|
|
CargaDatos()
|
|
BtnConsultar_Click(Nothing, Nothing)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Public Sub CargaDatos()
|
|
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If ObjVentas.GetProcedimientos(-1, UsuarioActual.CveEmpresa, -1) Then
|
|
GvDatos.DataSource = ObjVentas.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
GvDatos.DataBind()
|
|
|
|
UpDatos.Update()
|
|
|
|
End Sub
|
|
|
|
Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click
|
|
Dim ProcesoOK = False
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
|
|
If CveProcedimiento > 0 Then
|
|
If ObjVentas.UpdateProcedimiento(CveProcedimiento, TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = True
|
|
End If
|
|
Else
|
|
If ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) > 0 Then
|
|
ProcesoOK = True
|
|
End If
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
If ProcesoOK Then
|
|
Alert($"Procedimiento {If(CveProcedimiento > 0, "Actualizado", "Guardado")} Correctamente.")
|
|
RegistraScript("$('#DVAgregarProcedimiento').modal('hide');")
|
|
CargaDatos()
|
|
CargaGlobal()
|
|
UpDatos.Update()
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
#Region "G V D A T O S"
|
|
|
|
|
|
Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
CveProcedimiento = GvRow.DataKey("CveProcedimiento").ToEntero
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
Dim ProcesoOK = False
|
|
|
|
If ObjVentas.RemoveProcedimiento(CveProcedimiento, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = True
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
|
|
If ProcesoOK Then
|
|
Alert("Procedimiento eliminando correctamente.")
|
|
|
|
CargaDatos()
|
|
CargaGlobal()
|
|
End If
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region "CARGA GLOBAL"
|
|
Private Sub CargaGlobal()
|
|
GlobalDTProcedimientos(UsuarioActual.CveEmpresa) = Nothing
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
Public Sub LnkAgregarProcedimiento_Click(sender As Object, e As EventArgs)
|
|
|
|
LbAgregar.Text = "Agregar"
|
|
LtlTituloModal.Text = "Agregar Procedimiento"
|
|
|
|
TxtProcedimiento.Text = ""
|
|
|
|
DVEstatus.Visible = False
|
|
ChkEstatus.Checked = True
|
|
|
|
UpModal.Update()
|
|
|
|
CveProcedimiento = -1
|
|
|
|
RegistraScript("$('#DVAgregarProcedimiento').modal();")
|
|
End Sub
|
|
|
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
CveProcedimiento = GvRow.DataKey("CveProcedimiento").ToEntero
|
|
|
|
TxtProcedimiento.Text = GvRow.DataKey("Procedimiento")
|
|
|
|
ChkEstatus.Checked = Boolean.Parse(GvRow.DataKey("Estatus"))
|
|
|
|
DVEstatus.Visible = True
|
|
LbAgregar.Text = "Actualizar"
|
|
LtlTituloModal.Text = $"Actualizar Procedimiento {TxtProcedimiento.Text}"
|
|
|
|
UpModal.Update()
|
|
RegistraScript("$('#DVAgregarProcedimiento').modal();")
|
|
|
|
End Sub
|
|
|
|
#Region "INDICADORES"
|
|
|
|
Private Sub CargaCombos()
|
|
|
|
|
|
Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
|
|
If EsWS Then
|
|
DdlClientes.setEsWebService(True)
|
|
Else
|
|
DdlClientes.setEsWebService(False)
|
|
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
|
|
DdlClientes.DataBind()
|
|
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
End If
|
|
|
|
|
|
|
|
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
|
|
txtFechaF.Text = NowADS().ToShortDateString
|
|
|
|
DdlMedico.DataSource = GlobalDTMedicos(UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True' ")
|
|
DdlMedico.DataBind()
|
|
|
|
DdlProcedimiento.DataSource = GlobalDTProcedimientos(UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True' ")
|
|
DdlProcedimiento.DataBind()
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
|
|
|
|
|
Dim objVentas As New ClsVentas
|
|
Dim CveCliente As Integer = If(DdlClientes.SelectedValue.ToEntero > 0, DdlClientes.SelectedValue.ToEntero, -1)
|
|
If objVentas.GetVentasMedicasIndicadoresRep(DdlGrupo.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, CveCliente, DdlMedico.SelectedValue.ToEntero, DdlProcedimiento.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1) Then
|
|
GvIndicadores.DataSource = objVentas.DtResultados
|
|
End If
|
|
|
|
objVentas.Dispose()
|
|
|
|
GvIndicadores.DataBind()
|
|
|
|
ValidaExcelTab()
|
|
|
|
UpIndicadores.Update()
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
#Region "EXCEL"
|
|
|
|
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
|
|
|
|
If Tabs.ActiveTabIndex = 0 Then
|
|
Dim SbFiltros As New StringBuilder()
|
|
SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|")
|
|
SbFiltros.Append($"Grupo:{DdlGrupo.SelectedItem.Text}, Médico: {DdlMedico.SelectedItem.Text}, Procedimiento: {DdlProcedimiento.SelectedItem.Text}")
|
|
GvIndicadores.ExportToExcelGembox("IndicadoresMedicos", UsuarioActual, "Indicadores Médicos", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
|
|
ElseIf Tabs.ActiveTabIndex = 1 Then
|
|
'GvDatos.Columns(10).Visible = False
|
|
Dim SbFiltros As New StringBuilder()
|
|
SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|")
|
|
GvDatos.ExportToExcelGembox("CatProcedimientos", UsuarioActual, "Catálogo de Procedimientos", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
|
|
'GvDatos.Columns(10).Visible = True
|
|
Else
|
|
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
|
End Sub
|
|
|
|
|
|
Sub ValidaExcelTab()
|
|
If Tabs.ActiveTabIndex = 0 Then
|
|
LnkExportar.Visible = GvDatos.Rows.Count > 0
|
|
Else
|
|
LnkExportar.Visible = GvIndicadores.Rows.Count > 0
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
End Class |