From a0a820d94cdafee3709b2c79b15b952eb1116558 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 25 Jan 2024 17:52:41 -0700 Subject: [PATCH] SMS - 2024.01.25 Ventas agregar Medico y procedimiento en modal --- App_Code/ClsVentas.vb | 11 +- OS/RepServicioDomicilio.aspx | 124 +---------------- UserControl/AddMedico.ascx | 197 +++++++++++++++++++++++++++ UserControl/AddMedico.ascx.vb | 187 +++++++++++++++++++++++++ UserControl/AddProcedimiento.ascx | 42 ++++++ UserControl/AddProcedimiento.ascx.vb | 81 +++++++++++ Ventas/CatMedicos.aspx | 6 +- Ventas/CatMedicos.aspx.vb | 55 ++++++-- Ventas/Ventas.aspx | 88 ++++++++---- Ventas/Ventas.aspx.vb | 57 +++++++- 10 files changed, 677 insertions(+), 171 deletions(-) create mode 100644 UserControl/AddMedico.ascx create mode 100644 UserControl/AddMedico.ascx.vb create mode 100644 UserControl/AddProcedimiento.ascx create mode 100644 UserControl/AddProcedimiento.ascx.vb diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 85ebb2554..d84a4c789 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -59,7 +59,7 @@ Public Class ClsVentas Public Property Neto As Double Public Property PorNeto As Double Public Property CveClasificacionDetalle As Integer - + Public Property CveMedicoNuevo As Integer = -1 #End Region @@ -6096,9 +6096,10 @@ Public Class ClsVentas Public Function AddMedico(Medico As String, CedulaProfesional As String, FechaNacimiento As Date, Notas As String, DiasAtencion As String, Horario As String, Lugar As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer, Telefono As String, Mail As String, CveMedicoEspecialidad As Integer, Celular As String, Consultorio As String, Optional CveMedicoSubEspecialidad As Integer = -1, - Optional Torre As String = "-1") As Boolean + Optional Torre As String = "-1") As Integer Dim Retorno As Boolean = False + CveMedicoNuevo = -1 DataAdapter("PA_Vta_MedicosAdd") With SqlAdapter.SelectCommand.Parameters @@ -6119,16 +6120,20 @@ Public Class ClsVentas .Add("@Consultorio", SqlDbType.VarChar).Value = Consultorio .Add("@CveMedicoSubEspecialidad", SqlDbType.Int).Value = CveMedicoSubEspecialidad .Add("@Torre", SqlDbType.VarChar).Value = Torre + .Add("@CveMedicoNuevo", SqlDbType.Int).Direction = ParameterDirection.Output + End With Try SqlAdapter.Fill(Data) + CveMedicoNuevo = SqlAdapter.SelectCommand.Parameters("@CveMedicoNuevo").Value.ToString.ToEntero Retorno = True Catch ex As Exception OnError("Ocurrió un error al guardar el Medico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try - Return Retorno + + Return CveMedicoNuevo End Function diff --git a/OS/RepServicioDomicilio.aspx b/OS/RepServicioDomicilio.aspx index bc80be8ec..e63fc3c5e 100644 --- a/OS/RepServicioDomicilio.aspx +++ b/OS/RepServicioDomicilio.aspx @@ -842,50 +842,12 @@ function selectDate(start, end, allDay) { - <%-- $('#ModalAgenda').modal('show'); - $("#SpanTituloAgenda").html("Agregar Evento"); - - $("#HdnCveEvento").val(-1); - - $("#DdlAgedaTipo").val("-1"); - $("#DdlPrioridad").val("1"); - - $("#TxtAsuntoAgenda").val(""); - $("#TxtDescripcionAgenda").val(""); - $("#TxtFechaInicioAgenda").val("" + start.format("DD/MM/YYYY 08:00")); - $("#TxtFechaFinAgenda").val("" + start.format("DD/MM/YYYY 09:00")); - - $("#UpRecurrencia").hide(); - $("#CheckRecurrencia").prop('checked', false); - - $get("HdnDiasSemanaAgendar").value = -1; - - $('#<%=RBLRecurrencia.ClientID %>').find("input[value='1']").prop("checked", true); - $('#<%=TrDiasSemanaAdd.ClientID %>').css("display", "none"); - $("#DivDescripcionUpdate").css("display", "none"); - $("#<%=TxtDescripcionAgenda.ClientID%>").css("display", "block"); - $('#<%=LblTextoFrecuencia.ClientID%>').html("Hora(s)"); - - $("#TxtFrecuencia").val("1"); - $("#TxtNumeroOcurrencias").val(""); - $("#TxtFechaFinRecurrencia").val(""); - - $("#ChkGastoRecurrente").prop('checked', false); - $("#TxtImporteGastoRecurrente").val("");--%> + } function updateEvent(event, element) { - - - - //$('#ModalAgenda').modal('show'); - - - // $get("HdnDiasSemanaAgendar").value = - - $('#<%=HFCveOS.ClientID%>').val(event.CveOS); @@ -895,89 +857,7 @@ $('#<%=HFOCveOIEvento.ClientID%>').val(event.id); $('#<%=LnkCommando.ClientID%>').click(); - -<%-- $("#DivDescripcionUpdate").css("display", "block"); - $("#<%=TxtDescripcionAgenda.ClientID%>").css("display", "none"); - $("#HdnCveEvento").val(event.id); - - $("#TxtNumeroOcurrencias").val(''); - $("#TxtFechaFinRecurrencia").val(''); - $("#TxtFrecuencia").val(''); - - $("#TxtAsuntoAgenda").val(event.title); - //SE MUESTRA EL TEXTO HTML EN EL DIV DE LA DESCRIPCION SIN PERMITIR EDITAR, - //SE ASIGNA -1 EN EL TEXBOX PARA QUE NO REALICE CAMBIOS EN BD - $("#DivDescripcionUpdate").html(event.description); - $("#TxtDescripcionAgenda").val("-1"); - - $("#DdlAgedaTipo").val(event.cveagendatipo); - $("#DdlPrioridad").val(event.prioridad); - $('#LblSubProyecto').text(event.SubProyecto); - $('#LblDireccion').text(event.Direccion); - - - - $("#TxtFechaInicioAgenda").val("" + event.start.format("DD/MM/YYYY HH:mm")); - - $("#TxtFechaFinAgenda").val("" + event.end.format("DD/MM/YYYY HH:mm")); - - //Identifica el tipo de Fecha Termino de la Recurrencia - if (event.recurrenciafin == 0) { - $("#TxtFrecuencia").val('0'); - } else if (!isNaN(event.recurrenciafin)) { - $("#RBNumeroOcurrencias").prop('checked', true); - $("#TxtNumeroOcurrencias").val(event.recurrenciafin); - } else { - $("#RBFechaFin").prop('checked', true); - $("#TxtFechaFinRecurrencia").val("" + event.recurrenciafin); - } - - //GASTO RECURRENTE - //Si el evento es tipo 10 = Gasto Mes, activa gasto recurrente - if (event.CveTipoEvento == 10) { - $("#ChkGastoRecurrente").prop('checked', true); - $("#TxtImporteGastoRecurrente").val(event.Importe); - } else { - $("#ChkGastoRecurrente").prop('checked', false); - $("#TxtImporteGastoRecurrente").val(''); - } - - //Verifica que hay Recurrencia para activar los campos y poner sus valores respectivos - if (event.recurrenciatipo > 0) { - $("#CheckRecurrencia").prop('checked', true); - - // CHECKEA EL TIPO DE RECURRENCIA QUE TENGA EL EVENTO - var text = event.recurrenciatipo; - var radio = $("[id*=RBLRecurrencia] label:contains('" + text + "')").closest("td").find("input"); - radio.attr("checked", "checked"); - - // CHECKEA LOS DIAS SELECCIONADOS DE LA RECURRENCIA DE SEMANA - $get("HdnDiasSemanaAgendar").value = event.diassemana; - - //LLENA TEXTO DE FRECUENCIA DE RECURRENCIA - $("#TxtFrecuencia").val("" + event.frecuencia); - } else { - $("#CheckRecurrencia").prop('checked', false); - } - - - //ESCONDE O MUESTRA EL DIV DE LAS OPCIONES DE RECURRENCIA - if ($get('CheckRecurrencia').checked) { - $("#UpRecurrencia").show(); - } else { - $("#UpRecurrencia").hide(); - } - - //LLAMA EL INDEXCHANGED DEL RADIOBUTTONLIST DE LOS TIPOS DE RECURRENCIA - $("#BtnActualizaAdd").click(); - - //Muestra nombre de la empresa si esta tarea sea asigno desde EmpresaCRM - if (event.EmpresaCRM != "") { - $("#<%=LblEmpresaCRM.ClientID%>").css("display", "") - $("#<%=LblEmpresaCRM.ClientID%>").text(event.EmpresaCRM); - } else { - $("#<%=LblEmpresaCRM.ClientID%>").css("display", "none") - }--%> + } function RadionButtonSelectedValueSet(name, SelectdValue) { diff --git a/UserControl/AddMedico.ascx b/UserControl/AddMedico.ascx new file mode 100644 index 000000000..754c018de --- /dev/null +++ b/UserControl/AddMedico.ascx @@ -0,0 +1,197 @@ +<%@ Control Language="VB" AutoEventWireup="false" CodeFile="AddMedico.ascx.vb" Inherits="UserControl_AddMedico" %> + +
+ +
diff --git a/UserControl/AddMedico.ascx.vb b/UserControl/AddMedico.ascx.vb new file mode 100644 index 000000000..9cc57b4d1 --- /dev/null +++ b/UserControl/AddMedico.ascx.vb @@ -0,0 +1,187 @@ +Imports Extensiones + +Partial Class UserControl_AddMedico + Inherits System.Web.UI.UserControl + + Public ReadOnly Property UsuarioActual As Usuario + Get + If Context.Session("UsuarioSIG") Is Nothing Then + Return Nothing + Else + Return DirectCast(Context.Session("UsuarioSIG"), Usuario) + End If + End Get + End Property + + 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 + + Private Sub UserControl_AddMedico_Load(sender As Object, e As EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CargaEspecialidad() + CargaSubEspecialidad(-1) + End If + End Sub + + + Sub CargaEspecialidad() + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetMedicosEspecialidades(-1, UsuarioActual.CveEmpresa, -1) Then + DdlEspecialidad.DataSource = ObjVentas.DtResultados + Else + DdlEspecialidad.DataSource = Nothing + End If + + ObjVentas.Dispose() + + DdlEspecialidad.DataBind() + DdlEspecialidad.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpModal.Update() + + + End Sub + + + Sub CargaSubEspecialidad(CveMedicoEspecialidad As Integer) + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetMedicosSubEspecialidades(-1, UsuarioActual.CveEmpresa, -1) Then + If CveMedicoEspecialidad > 0 Then + DdlSubEspecialidad.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveMedicoEspecialidad = {CveMedicoEspecialidad}") + Else + DdlSubEspecialidad.DataSource = ObjVentas.DtResultados + End If + End If + + ObjVentas.Dispose() + + DdlSubEspecialidad.DataBind() + DdlSubEspecialidad.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + UpModal.Update() + + End Sub + + Protected Sub DdlEspecialidad_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaSubEspecialidad(DdlEspecialidad.SelectedValue.ToEntero) + End Sub + + + Public Sub LimpiarControles() + LbAgregar.Text = "Agregar" + LtlTituloModal.Text = "Agregar Médico" + + TxtMedico.Text = "" + TxtCedulaProfecional.Text = "" + TxtFechaNacimiento.Text = "" + TxtNotas.Text = "" + TxtDiasAtencion.Text = "" + TxtHorario.Text = "" + TxtLugar.Text = "" + TxtConsultorio.Text = "" + TxtMail.Text = "" + TxtTelefono.Text = "" + TxtCelular.Text = "" + DdlEspecialidad.SelectedValueExist(-1) + DdlSubEspecialidad.SelectedValueExist(-1) + TxtTorre.Text = "" + DVUsuarioFechaIng.Visible = False + TxtFechaIng.Text = "" + TxtUsuario.Text = "" + + + DVEstatus.Visible = False + ChkEstatus.Checked = True + + UpModal.Update() + CveMedico = -1 + End Sub + + Public Sub PreparaEdicion(CveMedicoEditar As Integer, Medico As String, CedulaProfecional As String, FechaNacimiento As Date, Notas As String, DiasAtencion As String, Horario As String, Lugar As String, Consultorio As String, Estatus As Boolean, + Mail As String, Telefono As String, Celular As String, CveMedicoEspecialidad As Integer, CveMedicoSubEspecialidad As Integer, Torre As String, FechaIng As DateTime, Usuario As String) + + + + CveMedico = CveMedicoEditar + + TxtMedico.Text = Medico + TxtCedulaProfecional.Text = CedulaProfecional + TxtFechaNacimiento.Text = FechaNacimiento.ToString("dd/MM/yyyy") + TxtNotas.Text = Notas + TxtDiasAtencion.Text = DiasAtencion + TxtHorario.Text = Horario + TxtLugar.Text = Lugar + TxtConsultorio.Text = Consultorio + ChkEstatus.Checked = Estatus + TxtMail.Text = Mail + TxtTelefono.Text = Telefono + TxtCelular.Text = Celular + DdlEspecialidad.SelectedValueExist(CveMedicoEspecialidad) + CargaSubEspecialidad(CveMedicoEspecialidad) + DdlSubEspecialidad.SelectedValueExist(CveMedicoSubEspecialidad) + TxtTorre.Text = Torre + + DVUsuarioFechaIng.Visible = True + TxtFechaIng.Text = FechaIng.ToString("dd/MM/yyyy hh:mm:ss tt") + TxtUsuario.Text = Usuario + + DVEstatus.Visible = True + LbAgregar.Text = "Actualizar" + LtlTituloModal.Text = $"Actualizar Médico {TxtCedulaProfecional.Text}" + + UpModal.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 CveMedicoNuevo As Integer = -1 + + + 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, DdlEspecialidad.SelectedValue.ToEntero, Celular, TxtConsultorio.Text.Trim, DdlSubEspecialidad.SelectedValue.ToEntero, TxtTorre.Text.Trim) Then + ProcesoOK = True + End If + Else + + CveMedicoNuevo = 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, DdlEspecialidad.SelectedValue.ToEntero, Celular, TxtConsultorio.Text.Trim, DdlSubEspecialidad.SelectedValue.ToEntero, TxtTorre.Text.Trim) + + If CveMedicoNuevo > 0 Then + ProcesoOK = True + End If + End If + + ObjVentas.Dispose() + + If ProcesoOK Then + ClsPaginas.Alert($"Medico {If(CveMedico > 0, "Actualizado", "Guardado")} Correctamente.") + Dim AppNombre As String = $"GlobalDTAgentes-{UsuarioActual.CveEmpresa}" + Application(AppNombre) = Nothing + RegistraScript($"fncRegargaMedicos({CveMedicoNuevo});") + RegistraScript("$('#BtnCancelarMedico').click();") + + End If + + + + End Sub + +End Class diff --git a/UserControl/AddProcedimiento.ascx b/UserControl/AddProcedimiento.ascx new file mode 100644 index 000000000..c828b5139 --- /dev/null +++ b/UserControl/AddProcedimiento.ascx @@ -0,0 +1,42 @@ +<%@ Control Language="VB" AutoEventWireup="false" CodeFile="AddProcedimiento.ascx.vb" Inherits="UserControl_AddProcedimiento" %> + +
+ +
diff --git a/UserControl/AddProcedimiento.ascx.vb b/UserControl/AddProcedimiento.ascx.vb new file mode 100644 index 000000000..37b84465f --- /dev/null +++ b/UserControl/AddProcedimiento.ascx.vb @@ -0,0 +1,81 @@ +Imports Extensiones +Partial Class UserControl_AddProcedimiento + Inherits System.Web.UI.UserControl + + Public ReadOnly Property UsuarioActual As Usuario + Get + If Context.Session("UsuarioSIG") Is Nothing Then + Return Nothing + Else + Return DirectCast(Context.Session("UsuarioSIG"), Usuario) + End If + End Get + End Property + + 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 + + + + Private Sub UserControl_AddProcedimiento_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + + End If + 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 CveProcedimientoNuevo As Integer = -1 + + If CveProcedimiento > 0 Then + If ObjVentas.UpdateProcedimiento(CveProcedimiento, TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + 'Alert($"Procedimiento Actualizado Correctamente.") + ProcesoOK = True + End If + Else + + CveProcedimientoNuevo = ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveProcedimientoNuevo > 0 Then + ProcesoOK = True + 'TabProductos.Visible = True + 'TabVentas.Visible = True + 'LnkAgregarProducto.Visible = True + 'UpDatos.Update() + 'Alert($"Procedimiento Guardado Correctamente.") + End If + + End If + + ObjVentas.Dispose() + + If ProcesoOK Then + ClsPaginas.Alert($"Procedimiento {If(CveProcedimiento > 0, "Actualizado", "Guardado")} Correctamente.") + Dim AppNombre As String = $"GlobalDTProcedimientos-{UsuarioActual.CveEmpresa}" + Application(AppNombre) = Nothing + RegistraScript($"fncRegargaProcedimientos({CveProcedimientoNuevo});") + RegistraScript("$('#BtnCancelarProcedimiento').click();") + + End If + + + + End Sub + + Public Sub LimpiarControles() + TxtProcedimiento.Text = "" + ChkEstatus.Checked = True + UpModal.Update() + End Sub + +End Class diff --git a/Ventas/CatMedicos.aspx b/Ventas/CatMedicos.aspx index 7d6d9c0c2..61bf3be6f 100644 --- a/Ventas/CatMedicos.aspx +++ b/Ventas/CatMedicos.aspx @@ -312,7 +312,7 @@ - + <%-- @@ -372,7 +372,7 @@ - + --%> @@ -383,7 +383,7 @@