311 lines
9.2 KiB
VB.net
311 lines
9.2 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports Extensiones
|
|
Imports Microsoft.Extensions.Primitives
|
|
|
|
Partial Class Ventas_CatMedicos
|
|
Inherits ClsPaginas
|
|
|
|
Public Property CveMedico As Integer
|
|
Get
|
|
If ViewState("CveMedico") Is Nothing Then
|
|
ViewState("CveMedico") = -1
|
|
End If
|
|
Return ViewState("CveMedico").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMedico") = 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.GetMedicos(-1, UsuarioActual.CveEmpresa, -1) Then
|
|
GvDatos.DataSource = ObjVentas.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
GvDatos.DataBind()
|
|
|
|
ValidaExcelTab()
|
|
|
|
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
|
|
|
|
|
|
Dim Telefono As String = If(TxtTelefono.Text = "(___) ___-____", "", TxtTelefono.Text)
|
|
Dim Celular As String = If(TxtCelular.Text = "(___) ___-____", "", TxtCelular.Text)
|
|
|
|
If CveMedico > 0 Then
|
|
If ObjVentas.UpdateMedico(CveMedico, TxtMedico.Text.Trim, TxtCedulaProfecional.Text.Trim, TxtFechaNacimiento.Text.ToDate, TxtNotas.Text.Trim, TxtDiasAtencion.Text.Trim, TxtHorario.Text.Trim, TxtLugar.Text.Trim, ChkEstatus.Checked,
|
|
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Telefono, TxtMail.Text, TxtEspecialidad.Text, Celular, TxtConsultorio.Text.Trim) Then
|
|
ProcesoOK = True
|
|
End If
|
|
Else
|
|
If ObjVentas.AddMedico(TxtMedico.Text.Trim, TxtCedulaProfecional.Text.Trim, TxtFechaNacimiento.Text.ToDate, TxtNotas.Text.Trim, TxtDiasAtencion.Text.Trim, TxtHorario.Text.Trim, TxtLugar.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario,
|
|
UsuarioActual.CveEmpresa, Telefono, TxtMail.Text, TxtEspecialidad.Text, Celular, TxtConsultorio.Text.Trim) Then
|
|
ProcesoOK = True
|
|
End If
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
If ProcesoOK Then
|
|
Alert($"Medico {If(CveMedico > 0, "Actualizado", "Guardado")} Correctamente.")
|
|
RegistraScript("$('#DVAgregarMedico').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)
|
|
|
|
CveMedico = GvRow.DataKey("CveMedico").ToEntero
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
Dim ProcesoOK = False
|
|
|
|
If ObjVentas.RemoveMedico(CveMedico, UsuarioActual.CveEmpresa) Then
|
|
ProcesoOK = True
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
|
|
If ProcesoOK Then
|
|
Alert("Medico eliminando correctamente.")
|
|
|
|
CargaDatos()
|
|
CargaGlobal()
|
|
End If
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region "CARGA GLOBAL"
|
|
Private Sub CargaGlobal()
|
|
GlobalDTMedicos(UsuarioActual.CveEmpresa) = Nothing
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
Public Sub LnkAgregarMedico_Click(sender As Object, e As EventArgs)
|
|
|
|
LbAgregar.Text = "Agregar"
|
|
LtlTituloModal.Text = "Agregar Medico"
|
|
|
|
TxtMedico.Text = ""
|
|
TxtCedulaProfecional.Text = ""
|
|
TxtFechaNacimiento.Text = ""
|
|
TxtNotas.Text = ""
|
|
TxtDiasAtencion.Text = ""
|
|
TxtHorario.Text = ""
|
|
TxtLugar.Text = ""
|
|
TxtConsultorio.Text = ""
|
|
TxtMail.Text = ""
|
|
TxtTelefono.Text = ""
|
|
TxtCelular.Text = ""
|
|
TxtEspecialidad.Text = ""
|
|
|
|
DVEstatus.Visible = False
|
|
ChkEstatus.Checked = True
|
|
|
|
UpModal.Update()
|
|
|
|
CveMedico = -1
|
|
|
|
RegistraScript("$('#DVAgregarMedico').modal();")
|
|
End Sub
|
|
|
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
CveMedico = GvRow.DataKey("CveMedico").ToEntero
|
|
|
|
TxtMedico.Text = GvRow.DataKey("Medico")
|
|
TxtCedulaProfecional.Text = GvRow.DataKey("CedulaProfesional")
|
|
TxtFechaNacimiento.Text = GvRow.DataKey("FechaNacimiento").ToDate().ToString("dd/MM/yyyy")
|
|
TxtNotas.Text = GvRow.DataKey("Notas")
|
|
TxtDiasAtencion.Text = GvRow.DataKey("DiasAtencion")
|
|
TxtHorario.Text = GvRow.DataKey("Horario")
|
|
TxtLugar.Text = GvRow.DataKey("Lugar")
|
|
TxtConsultorio.Text = GvRow.DataKey("Consultorio")
|
|
ChkEstatus.Checked = Boolean.Parse(GvRow.DataKey("Estatus"))
|
|
TxtMail.Text = GvRow.DataKey("Mail")
|
|
TxtTelefono.Text = GvRow.DataKey("Telefono")
|
|
TxtCelular.Text = GvRow.DataKey("Celular")
|
|
TxtEspecialidad.Text = GvRow.DataKey("Especialidad")
|
|
|
|
DVEstatus.Visible = True
|
|
LbAgregar.Text = "Actualizar"
|
|
LtlTituloModal.Text = $"Actualizar Medico {TxtCedulaProfecional.Text}"
|
|
|
|
UpModal.Update()
|
|
RegistraScript("$('#DVAgregarMedico').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) 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())
|
|
Else
|
|
GvDatos.Columns(10).Visible = False
|
|
Dim SbFiltros As New StringBuilder()
|
|
SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|")
|
|
GvDatos.ExportToExcelGembox("CatMedicos", UsuarioActual, "Catálogo de Médicos", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
|
|
GvDatos.Columns(10).Visible = True
|
|
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
|
|
|
|
#Region "CUMPLEAÑOS"
|
|
|
|
Private Sub CargaCyumpleAnios()
|
|
|
|
Dim ObjVentas As New ClsVentas
|
|
|
|
If ObjVentas.GetMedicos(-1, UsuarioActual.CveEmpresa, -1, DdlmesCumple.SelectedValue.ToEntero()) Then
|
|
GvCumple.DataSource = ObjVentas.DtResultados
|
|
Else
|
|
GvCumple.DataSource = Nothing
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
GvCumple.DataBind()
|
|
|
|
UpDVModalCumple.Update()
|
|
|
|
End Sub
|
|
|
|
|
|
Protected Sub LnkCumpleanios_Click(sender As Object, e As EventArgs)
|
|
|
|
DdlmesCumple.SelectedValueExist(NowADS.Month)
|
|
CargaCyumpleAnios()
|
|
RegistraScript("$('#DVModalCumple').modal();")
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
Protected Sub btnConsultarcumpleAnios_Click(sender As Object, e As EventArgs)
|
|
CargaCyumpleAnios()
|
|
End Sub
|
|
End Class
|