-- mejora en manejo de OS
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports APP_Code_CSharp
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Web.Services
|
||||
|
||||
Partial Class OS_RepServiciosMedicos
|
||||
Inherits ClsPaginas
|
||||
|
||||
@@ -267,11 +268,13 @@ Partial Class OS_RepServiciosMedicos
|
||||
GetCargaTiposOrden()
|
||||
cargaDropsModal()
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaUsuariosTecnicos()
|
||||
|
||||
If not UsuarioActual.TienePermisoProceso(171) Then Exit Sub
|
||||
|
||||
Dim DTTecnicosresultado As DataTable = Nothing
|
||||
DTTecnicos = New DataTable
|
||||
Dim ObjOS As New ClsOS
|
||||
@@ -292,6 +295,11 @@ Partial Class OS_RepServiciosMedicos
|
||||
End If
|
||||
ObjOS.Dispose()
|
||||
|
||||
DdlTecnicoAsignar.DataSource = DTTecnicos
|
||||
DdlTecnicoAsignar.DataBind()
|
||||
DdlTecnicoAsignar.Visible = True
|
||||
DdlTecnicoAsignar.Items.Insert(0, New ListItem("-", "-1"))
|
||||
|
||||
'Dim ObjUsuarios As New ClsSisUsuarios
|
||||
'If ObjUsuarios.GetPermisosPorUsuarioProcesos(-1, -1, -1, -1, 351, UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) Then
|
||||
' If UsuarioActual.CveRol = 1 Then
|
||||
@@ -318,7 +326,6 @@ Partial Class OS_RepServiciosMedicos
|
||||
|
||||
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
|
||||
CargaTiposAgenda()
|
||||
CheckRecurrencia.Attributes.Add("onclick", "CheckAdd(this);")
|
||||
End Sub
|
||||
Private Sub CargaTiposAgenda()
|
||||
Dim ObjEventos As New ClsOIEventos
|
||||
@@ -378,47 +385,10 @@ Partial Class OS_RepServiciosMedicos
|
||||
RegistraScript("GetView();")
|
||||
|
||||
Dim RecurrenciaTipo = 0, Frecuencia = -1, DiasSemana = "-1", Dias = -1, Mes = -1, RecurrenciaFin = "-1"
|
||||
If CheckRecurrencia.Checked Then
|
||||
RecurrenciaTipo = RBLRecurrencia.SelectedValue.ToEntero
|
||||
Frecuencia = TxtFrecuencia.Text.ToEntero
|
||||
|
||||
'OBTENEMOS LOS DIAS SELECCIONADOS EN LA OPCION DE RECURRENCIA POR SEMANA
|
||||
Select Case RecurrenciaTipo
|
||||
Case 3
|
||||
Dim StringDias = ""
|
||||
For Each item As ListItem In CheckDiasSemana.Items
|
||||
If item.Selected Then
|
||||
If StringDias.Length > 0 Then
|
||||
StringDias += ","
|
||||
End If
|
||||
StringDias += item.Value
|
||||
End If
|
||||
Next
|
||||
If StringDias.Length > 0 Then
|
||||
DiasSemana = StringDias
|
||||
End If
|
||||
End Select
|
||||
|
||||
|
||||
'If RBSinFechaFinAdd.Checked Then
|
||||
' RecurrenciaFin = "-1"
|
||||
'Else
|
||||
If RBNumeroOcurrencias.Checked Then
|
||||
RecurrenciaFin = TxtNumeroOcurrencias.Text
|
||||
ElseIf RBFechaFin.Checked Then
|
||||
RecurrenciaFin = TxtFechaFinRecurrencia.Text
|
||||
Else
|
||||
RecurrenciaFin = "-1"
|
||||
End If
|
||||
Else
|
||||
If HdnCveEvento.Value.ToEntero > 0 Then
|
||||
Frecuencia = -2 : DiasSemana = "-2" : Dias = -2 : Mes = -2 : RecurrenciaFin = "-2"
|
||||
End If
|
||||
End If
|
||||
|
||||
'11/05/2018 - GASTO RECURRENTE
|
||||
Dim CveTipoEvento As Integer = IIf(ChkGastoRecurrente.Checked, 10, 2).ToString().ToEntero()
|
||||
Dim Importe As Double = Convert.ToDouble(IIf(ChkGastoRecurrente.Checked, TxtImporteGastoRecurrente.Text, "-1"))
|
||||
Dim CveTipoEvento As Integer = 2
|
||||
Dim Importe As Double = -1
|
||||
|
||||
If HdnCveEvento.Value.ToEntero > 0 Then
|
||||
If ObjEventos.UpdateEvento(TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridad.SelectedValue.ToEntero, DdlAgedaTipo.SelectedValue.ToEntero, -1, FechaInicio, FechaFin, -1, "-1", HdnCveEvento.Value.ToEntero, "-1",
|
||||
@@ -446,15 +416,10 @@ Partial Class OS_RepServiciosMedicos
|
||||
TxtDescripcionAgenda.Text = ""
|
||||
TxtAsuntoAgenda.Text = ""
|
||||
DdlPrioridad.SelectedValue = "1"
|
||||
TxtNumeroOcurrencias.Text = ""
|
||||
TxtFechaFinRecurrencia.Text = ""
|
||||
RBFechaFin.Checked = False
|
||||
RBNumeroOcurrencias.Checked = False
|
||||
RBLRecurrencia.SelectedValue = "1"
|
||||
CheckDiasSemana.ClearSelection()
|
||||
RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty)
|
||||
TxtFrecuencia.Text = "1"
|
||||
LblEmpresaCRM.Text = ""
|
||||
|
||||
'RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty)
|
||||
'TxtFrecuencia.Text = "1"
|
||||
'LblEmpresaCRM.Text = ""
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs)
|
||||
@@ -495,38 +460,9 @@ Partial Class OS_RepServiciosMedicos
|
||||
ObjEventos.Dispose()
|
||||
Return "a"
|
||||
End Function
|
||||
Protected Sub RBLRecurrencia_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
Select Case RBLRecurrencia.SelectedValue.ToEntero
|
||||
Case 1
|
||||
LblTextoFrecuencia.Text = "Hora(s)"
|
||||
TrDiasSemanaAdd.Style("display") = "none"
|
||||
Case 2
|
||||
LblTextoFrecuencia.Text = "Dia(s)"
|
||||
TrDiasSemanaAdd.Style("display") = "none"
|
||||
Case 3
|
||||
LblTextoFrecuencia.Text = "Semana(s)"
|
||||
TrDiasSemanaAdd.Style("display") = "block"
|
||||
|
||||
'Chequea los dias seleccionados en la recurrencia
|
||||
For Each item As ListItem In CheckDiasSemana.Items
|
||||
If HdnDiasSemanaAgendar.Value.Contains(item.Value) Then
|
||||
item.Selected = True
|
||||
Else
|
||||
item.Selected = False
|
||||
End If
|
||||
Next
|
||||
Case 4
|
||||
LblTextoFrecuencia.Text = "Mes(es)"
|
||||
TrDiasSemanaAdd.Style("display") = "none"
|
||||
Case 5
|
||||
LblTextoFrecuencia.Text = "Año(s)"
|
||||
TrDiasSemanaAdd.Style("display") = "none"
|
||||
Case Else
|
||||
End Select
|
||||
UpRecurrencia.Update()
|
||||
End Sub
|
||||
Protected Sub BtnActualizaAdd_Click(sender As Object, e As EventArgs)
|
||||
RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty)
|
||||
'RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty)
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
@@ -618,7 +554,6 @@ Partial Class OS_RepServiciosMedicos
|
||||
LipiaModalOS()
|
||||
If TipoAccion = OSModalTipoAccion.Agregar Then
|
||||
|
||||
|
||||
TxtFechaOS.Text = NowADS().ToString("dd/MM/yyyy")
|
||||
RegistraScript("$('#DVModalOS').modal('show');")
|
||||
LblModalOStitulo.Text = "Agregar Orden de Servicio"
|
||||
@@ -648,6 +583,7 @@ Partial Class OS_RepServiciosMedicos
|
||||
|
||||
HFCveOS.Value = ObjOS.CveOS.ToString
|
||||
HFCveOsDetalle.Value = ObjOS.CveOSDetalle.ToString
|
||||
HdnFechaCita.Value = ObjOS.FechaCita.ToString
|
||||
TxtDescripcion.Text = ObjOS.Descripcion
|
||||
TxtFechaOS.Text = ObjOS.FechaCita.ToString("dd/MM/yyyy HH:mm")
|
||||
TxtProcedimiento.Text = GlobalDTProcedimientos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Procedimiento", "CveProcedimiento =" & ObjOS.CveProcedimiento)
|
||||
@@ -655,6 +591,12 @@ Partial Class OS_RepServiciosMedicos
|
||||
TxtCliente.Text = thospital
|
||||
TxtTipoVenta.Text = GlobalDTTipoVenta(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoVenta", $"CveTipoVenta ={ObjOS.CveTipoVenta}")
|
||||
TxtTecnico.Text = ObjOS.UsuarioAtendio
|
||||
divPedido.Visible = ObjOS.CveCotizacion > 0
|
||||
HplPedido.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={ObjOS.CveCotizacion}"
|
||||
HplPedido.Text = ObjOS.SerieFolioCotizacion
|
||||
divRemision.Visible = ObjOS.CveVenta > 0
|
||||
HplRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={ObjOS.CveVenta}"
|
||||
HplRemision.Text = ObjOS.SerieFolioVenta
|
||||
|
||||
Dim tCve As Integer = ObjOS.CveVenta 'busca la remisión
|
||||
If tCve <= 0 Then tCve = ObjOS.CveCotizacion 'sino hay remisión toma el pedido
|
||||
@@ -675,8 +617,17 @@ Partial Class OS_RepServiciosMedicos
|
||||
LblModalOStitulo.Text = "Orden Cancelada"
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DVModalOS').modal('show');")
|
||||
If ObjOS.CveUsuarioAtendio = 0 Then
|
||||
TxtTecnico.Visible = False
|
||||
DdlTecnicoAsignar.Visible = True
|
||||
BtnAsignar.Visible = True
|
||||
Else
|
||||
TxtTecnico.Visible = True
|
||||
DdlTecnicoAsignar.Visible = False
|
||||
BtnAsignar.Visible = False
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DVModalOS').modal('show');")
|
||||
End If
|
||||
ObjOS.Dispose()
|
||||
|
||||
@@ -736,4 +687,32 @@ Partial Class OS_RepServiciosMedicos
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Protected Sub BtnAsignar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
Dim ObjOS As New ClsOS
|
||||
ObjOS.IniciaTransacSQL()
|
||||
Dim CveOsDetalle As Integer = HFCveOsDetalle.Value.ToEntero
|
||||
Dim CveOS As Integer = HFCveOS.Value.ToEntero
|
||||
Dim CveEstatusAsignada = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 2", "CveEstatusOrdenServicio ASC").ToEntero
|
||||
|
||||
If Not ObjOS.UpdateOrdenesServiciosAsignadas(CveOsDetalle, DdlTecnicoAsignar.SelectedValue.ToEntero, HdnFechaCita.Value.ToDate, HdnFechaCita.Value.ToDateTime(), UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError AndAlso Not ObjOS.UpdateOrdenesServiciosEstatus(CveEstatusAsignada, UsuarioActual.CveUsuario, CveOS) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
ObjOS.Commit()
|
||||
Alert("La Orden ha sido asignada")
|
||||
Else
|
||||
ObjOS.RollBack()
|
||||
End If
|
||||
|
||||
ObjOS.Dispose()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user