--SMS 2024.04.23
This commit is contained in:
@@ -189,7 +189,7 @@
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<asp:GridView ID="GvNA" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron Órdenes de Servicio No Asignadas" ClientIDMode="Static"
|
||||
DataKeyNames="CveOSDetalle, CveOS,CveUsuarioAtendio,TipoEstatus,EstatusOrdenServicio,CveSubProyecto,Folio,FechaCita,FechaCitaOS"
|
||||
DataKeyNames="CveOSDetalle, CveOS,CveUsuarioAtendio,TipoEstatus,EstatusOrdenServicio,CveSubProyecto,Folio,FechaCita,FechaCitaOS,Medico,Procedimiento,Nombre"
|
||||
data-sort="true"
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None">
|
||||
<Columns>
|
||||
|
||||
@@ -42,7 +42,7 @@ Partial Class OS_Asignaciones
|
||||
If Not IsPostBack Then
|
||||
GvNA_ConfiguraColumnas()
|
||||
CargaEstatusOS()
|
||||
'CargaUsuarios()
|
||||
CargaUsuarios()
|
||||
CargaClientes()
|
||||
CargaSubProyecto()
|
||||
|
||||
@@ -225,75 +225,84 @@ Partial Class OS_Asignaciones
|
||||
DdlTecnico.DataBind()
|
||||
DdlTecnico.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
ObjOS.Dispose()
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "BTN'S"
|
||||
Protected Sub BtnAsignar_Click(sender As Object, e As EventArgs) Handles BtnAsignar.Click
|
||||
Dim ObjOS As New ClsOS
|
||||
Protected Sub BtnAsignar_Click(sender As Object, e As EventArgs) Handles BtnAsignar.Click
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
Dim CveEstatusOS As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 2", "CveEstatusOrdenServicio ASC").ToEntero
|
||||
Dim time As DateTime
|
||||
Dim contadorOrdenesAsignadas As Integer = 0
|
||||
|
||||
ObjOS.IniciaTransacSQL()
|
||||
|
||||
For Each row As GridViewRow In GvNA.Rows
|
||||
If row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
Dim picker As MKB.TimePicker.TimeSelector = DirectCast(row.FindControl("TimeSelector"), MKB.TimePicker.TimeSelector)
|
||||
|
||||
If row.FCCheckBox("ChbxAsignar").Checked Then
|
||||
time = DateTime.Parse(String.Format("{0} {1}:{2} {3}", row.FCTextBox("FechaOS").Text, picker.Hour, picker.Minute, picker.AmPm))
|
||||
contadorOrdenesAsignadas += 1
|
||||
|
||||
If ObjOS.GetSubProyectosEstatusInicial(DdlTecnico.SelectedValue.ToEntero, 3, UsuarioActual.CveEmpresa) Then
|
||||
Dim subProyectoDelTecnico As DataTable
|
||||
subProyectoDelTecnico = ObjOS.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0}", row.DataKey("CveSubProyecto")))
|
||||
If subProyectoDelTecnico.Rows.Count > 0 Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosAsignadas(row.DataKey("CveOSDetalle").ToEntero, DdlTecnico.SelectedValue.ToEntero, row.FCTextBox("FechaOS").Text.ToDate, time, UsuarioActual.CveEmpresa) Then
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
Alert("El técnico y la Orden de Servicio deben pertenecer al mismo subProyecto", TipoMensaje.MsgAdvertencia)
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If Not TieneError Then
|
||||
|
||||
If Not ObjOS.UpdateOrdenesServiciosEstatus(CveEstatusOS.ToEntero, UsuarioActual.CveUsuario, row.DataKey("CveOS").ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
Dim RecurrenciaTipo As Integer = 0, Frecuencia As Integer = -1, DiasSemana As String = "-1", Dias As Integer = -1, Mes As Integer = -1, RecurrenciaFin As String = "-1"
|
||||
Dim Fecha As DateTime = time
|
||||
Dim OIDescripcion As String = $"{DdlTecnico.SelectedItem.Text} <b><a href='/OS/OrdenesServicios.aspx?CveOS={row.DataKey("CveOS")}' target='_blank' class='Texto' >Orden de servicio {row.DataKey("Folio")} </a></b>"
|
||||
|
||||
Dim ObjEventos As New ClsOIEventos(ObjOS.IniciaTransacSQL())
|
||||
If Not ObjEventos.AddEventoAgenda(2, DdlTecnico.SelectedItem.Text, OIDescripcion, 2, time, time.AddHours(1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
||||
RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=2,
|
||||
Importe:=0, CveOS:=row.DataKey("CveOS").ToEntero, CveSubProyecto:=row.DataKey("CveSubProyecto").ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim CorreoAsignado As String = GlobalDTUsuarios(DdlTecnico.SelectedValue.ToEntero).Rows(0)("Correo").ToString
|
||||
|
||||
If Not TieneError Then
|
||||
MandaCorreOS(row.DataKey("CveOS").ToEntero, CorreoAsignado, TrasaccionSql:=ObjOS.IniciaTransacSQL)
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim contadorOrdenesAsignadas As Integer = 0
|
||||
|
||||
Dim ObjOS As New ClsOS
|
||||
Dim ObjEventos As New ClsOIEventos(ObjOS.IniciaTransacSQL())
|
||||
|
||||
Try
|
||||
For Each row As GridViewRow In GvNA.Rows
|
||||
If row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
Dim picker As MKB.TimePicker.TimeSelector = DirectCast(row.FindControl("TimeSelector"), MKB.TimePicker.TimeSelector)
|
||||
|
||||
If row.FCCheckBox("ChbxAsignar").Checked Then
|
||||
time = DateTime.Parse(String.Format("{0} {1}:{2} {3}", row.FCTextBox("FechaOS").Text, picker.Hour, picker.Minute, picker.AmPm))
|
||||
contadorOrdenesAsignadas += 1
|
||||
|
||||
If ObjOS.GetSubProyectosEstatusInicial(DdlTecnico.SelectedValue.ToEntero, 3, UsuarioActual.CveEmpresa) Then
|
||||
Dim subProyectoDelTecnico As DataTable
|
||||
subProyectoDelTecnico = ObjOS.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0}", row.DataKey("CveSubProyecto")))
|
||||
If subProyectoDelTecnico.Rows.Count > 0 Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosAsignadas(row.DataKey("CveOSDetalle").ToEntero, DdlTecnico.SelectedValue.ToEntero, row.FCTextBox("FechaOS").Text.ToDate, time, UsuarioActual.CveEmpresa) Then
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
Alert("El técnico y la Orden de Servicio deben pertenecer al mismo subProyecto", TipoMensaje.MsgAdvertencia)
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
|
||||
If Not ObjOS.UpdateOrdenesServiciosEstatus(CveEstatusOS.ToEntero, UsuarioActual.CveUsuario, row.DataKey("CveOS").ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
Dim RecurrenciaTipo As Integer = 0, Frecuencia As Integer = -1, DiasSemana As String = "-1", Dias As Integer = -1, Mes As Integer = -1, RecurrenciaFin As String = "-1"
|
||||
Dim Fecha As DateTime = time
|
||||
Dim OIDescripcion As String = $"{DdlTecnico.SelectedItem.Text} <b><a href='/OS/OrdenesServicios.aspx?CveOS={row.DataKey("CveOS")}' target='_blank' class='Texto' >Orden de servicio {row.DataKey("Folio")} </a></b>"
|
||||
|
||||
|
||||
If Not ObjEventos.AddEventoAgenda(2, DdlTecnico.SelectedItem.Text, OIDescripcion, 2, time, time.AddHours(1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
||||
RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=2,
|
||||
Importe:=0, CveOS:=row.DataKey("CveOS").ToEntero, CveSubProyecto:=row.DataKey("CveSubProyecto").ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
If Not AgendarCirugia(ObjEventos, row.DataKey("CveOS").ToEntero, time, DdlTecnico.SelectedValue.ToEntero(), row.DataKey("Medico"), row.DataKey("Procedimiento"), row.DataKey("Nombre")) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim CorreoAsignado As String = GlobalDTUsuarios(DdlTecnico.SelectedValue.ToEntero).Rows(0)("Correo").ToString
|
||||
|
||||
If Not TieneError Then
|
||||
MandaCorreOS(row.DataKey("CveOS").ToEntero, CorreoAsignado, TrasaccionSql:=ObjOS.IniciaTransacSQL)
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al asignar", ex)
|
||||
End Try
|
||||
|
||||
If contadorOrdenesAsignadas > 0 Then
|
||||
|
||||
@@ -301,7 +310,10 @@ Partial Class OS_Asignaciones
|
||||
ObjOS.Commit()
|
||||
Alert("Se asignaron las ordenes de servicio correctamente", TipoMensaje.MsgInformacion)
|
||||
CargaOrdenesServiciosAsignadasXPersona()
|
||||
CargaOrdenesServiciosNoAsignadas()
|
||||
CargaOrdenesServiciosNoAsignadas()
|
||||
Else
|
||||
ObjOS.RollBack()
|
||||
Alert("Ocurrió un error al asignar", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
ObjOS.RollBack()
|
||||
@@ -312,7 +324,40 @@ Partial Class OS_Asignaciones
|
||||
ObjOS.Dispose()
|
||||
UpAsignacionPersona.Update()
|
||||
UpOS.Update()
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Protected Function AgendarCirugia(ByRef ObjEventos As ClsOIEventos, CveOS As Integer, FechaCirugia As DateTime, CveUsuarioAgendar As Integer, Medico As String, Procedimiento As String, Hospital As String) As Boolean
|
||||
Dim TieneError As Boolean = False
|
||||
Try
|
||||
If FechaCirugia > MinFecha Then
|
||||
|
||||
If CveUsuarioAgendar > 0 Then
|
||||
|
||||
Dim Asunto As String = "Cirugía"
|
||||
Dim Descripcion As New StringBuilder
|
||||
|
||||
Descripcion.AppendFormat("Dr {0} {1}", Hospital, "<br/>")
|
||||
|
||||
Descripcion.AppendFormat("Cirugía {0} {1}", Procedimiento, "<br/>")
|
||||
|
||||
Descripcion.AppendFormat("Fecha de Cirugía {0} {1}", FechaCirugia.ToString("dd/MM/yyyy HH:mm"), "<br/>")
|
||||
|
||||
Descripcion.AppendFormat("{0} {1}", Hospital, "<br/>")
|
||||
|
||||
If Not ObjEventos.AddEventoAgenda(4, Asunto, Descripcion.ToString(), 3, FechaCirugia, FechaCirugia, CveUsuarioAgendar, UsuarioActual.CveEmpresa, RecurrenciaTipo:=0, CveTipoEvento:=2, CveOS:=CveOS) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al generar la agenda", ex)
|
||||
End Try
|
||||
|
||||
Return Not TieneError
|
||||
End Function
|
||||
|
||||
Private Sub MandaCorreOS(CveOS As Integer, CorreoUsuarioAsignado As String, ByRef TrasaccionSql As SqlClient.SqlTransaction)
|
||||
|
||||
|
||||
@@ -603,7 +603,7 @@
|
||||
<asp:CheckBox ID="ChkRequiereTecnico" runat="server" CssClass="chksino" OnCheckedChanged="ChkRequiereTecnico_CheckedChanged" AutoPostBack="true" Text="Requiere Técnico:" Checked="false" />
|
||||
</td>
|
||||
<td runat="server" id="TdFechaOS1" visible="true">
|
||||
<b>Fecha de Cirugia:</b>
|
||||
<b>Fecha de Cirugía:</b>
|
||||
</td>
|
||||
<td runat="server" id="TdFechaOS2" visible="true">
|
||||
<asp:TextBox ID="TxtFechaOS" type="datetime-local" runat="server" CausesValidation="true" CssClass="fechahora" Style="width: 130px; line-height: 22px;"></asp:TextBox>
|
||||
@@ -8801,7 +8801,7 @@
|
||||
<asp:CheckBox ID="ChkRequiereTecnicoModal" CssClass="chksino" runat="server" OnCheckedChanged="ChkRequiereTecnicoModal_CheckedChanged" AutoPostBack="true" Text="Requiere Técnico" />
|
||||
</div>
|
||||
<div class="form-group col-md-6 form-md-line-input input-iconright " runat="server" id="DvModalRequiereOSFecha" visible="false">
|
||||
<asp:Label runat="server" Style="width: 90%; color: #888888;" AssociatedControlID="TxtFechaModal">Fecha de Cirugia:</asp:Label>
|
||||
<asp:Label runat="server" Style="width: 90%; color: #888888;" AssociatedControlID="TxtFechaModal">Fecha de Cirugía:</asp:Label>
|
||||
<asp:TextBox ID="TxtFechaModal" type="datetime-local" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 100%"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -996,7 +996,7 @@ Partial Class Ventas
|
||||
|
||||
Private Property CveOSVentaMedica As Integer
|
||||
Get
|
||||
Return ViewState("CveOSVentaMedica").ToString().ToEntero()
|
||||
Return IfNull(ViewState("CveOSVentaMedica"), "-1").ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveOSVentaMedica") = value
|
||||
@@ -2650,6 +2650,20 @@ Partial Class Ventas
|
||||
'CargarCamiones()
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
'SI ES COTIZACION CARGAR CLIENTE PUBLICO GENERAL
|
||||
If Opcion = "Cot" Then
|
||||
Dim CveClientePG As Integer = -1
|
||||
If UsuarioActual.CveEmpresa = 186 Then
|
||||
CveClientePG = 1151377
|
||||
ViewState("CveCliente") = CveClientePG
|
||||
HdnCveCliente.Value = CveClientePG.ToString()
|
||||
CargaCliente(CveCliente)
|
||||
|
||||
TrVentasMedicas2.Visible = False
|
||||
TrVentasMedicas3.Visible = False
|
||||
End If
|
||||
End If
|
||||
|
||||
CargaMedicos()
|
||||
CargaProcedimientos()
|
||||
CargaDdlClientesSucursal()
|
||||
@@ -14159,6 +14173,17 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If EsVentaMedica AndAlso ErrorList.Count = 0 AndAlso ObjEventos IsNot Nothing Then
|
||||
Dim CveOSAgenda As Integer = -1
|
||||
If Me.CveOSVentaMedica > 0 Then
|
||||
CveOSAgenda = Me.CveOSVentaMedica
|
||||
End If
|
||||
|
||||
If Not AgendarCirugia(ObjEventos, CveOSAgenda) Then
|
||||
ErrorList.Add("Ocurrió un error al guardar la agenda")
|
||||
End If
|
||||
End If
|
||||
|
||||
'Contratos
|
||||
If factura.CveContrato > 0 AndAlso Me.CveContratoTipo <> 33 Then
|
||||
If factura.CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") Then
|
||||
@@ -37192,7 +37217,13 @@ Partial Class Ventas
|
||||
item.Text = $"  {item.Text}"
|
||||
Next
|
||||
|
||||
RegistraScript("$('#DvModalTipoVenta').modal({ backdrop: 'static', keyboard: false });")
|
||||
If Opcion <> "Cot" Then
|
||||
RegistraScript("$('#DvModalTipoVenta').modal({ backdrop: 'static', keyboard: false });")
|
||||
Else
|
||||
TrVentasMedicas2.Visible = False
|
||||
TrVentasMedicas3.Visible = False
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaProcedimientos(Optional CveProcedimientSeleccion As Integer = -1)
|
||||
@@ -38119,7 +38150,66 @@ Partial Class Ventas
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Function AgendarCirugia(ByRef ObjEventos As ClsOIEventos, CveOS As Integer) As Boolean
|
||||
Dim TieneError As Boolean = False
|
||||
Try
|
||||
If DdlMedico.SelectedValue.ToEntero() > 0 AndAlso TrVentasMedicas2.Visible AndAlso TdFechaOS1.Visible AndAlso TdFechaOS2.Visible Then
|
||||
Dim FechaCirugia As DateTime = MinFecha
|
||||
If TxtFechaOS.Text.Replace(",", "").ToDateTime() > MinFecha Then
|
||||
FechaCirugia = TxtFechaOS.Text.Replace(",", "").ToDateTime()
|
||||
|
||||
If FechaCirugia > MinFecha Then
|
||||
|
||||
Dim CveUsuarioAgendar = -1
|
||||
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
|
||||
|
||||
If CveVendedor > 0 Then
|
||||
Dim strVendedores = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvesUsuariosAsignados", $"CveVendedor = {CveVendedor}")
|
||||
If strVendedores.Split(","c).Length > 0 Then
|
||||
CveUsuarioAgendar = strVendedores.Split(","c)(0).ToEntero()
|
||||
End If
|
||||
End If
|
||||
|
||||
If CveUsuarioAgendar > 0 Then
|
||||
|
||||
Dim Asunto As String = "Cirugía"
|
||||
Dim Descripcion As New StringBuilder
|
||||
|
||||
If DdlMedico.SelectedValue.ToEntero() > 0 Then
|
||||
Descripcion.AppendFormat("Dr {0} {1}", DdlMedico.SelectedItem.Text, "<br/>")
|
||||
End If
|
||||
|
||||
If DdlProcedimiento.SelectedValue.ToEntero() > 0 Then
|
||||
Descripcion.AppendFormat("Cirugía {0} {1}", DdlProcedimiento.SelectedItem.Text, "<br/>")
|
||||
End If
|
||||
|
||||
Descripcion.AppendFormat("Fecha de Cirugía {0} {1}", FechaCirugia.ToString("dd/MM/yyyy HH:mm"), "<br/>")
|
||||
|
||||
If DdlClienteSucursal.SelectedValue.ToEntero() > 0 Then
|
||||
Descripcion.AppendFormat("{0} {1}", DdlClienteSucursal.SelectedItem.Text, "<br/>")
|
||||
ElseIf DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then
|
||||
Descripcion.AppendFormat("{0} {1}", DdlSucursalCliente.SelectedItem.Text, "<br/>")
|
||||
Else
|
||||
Descripcion.AppendFormat("{0} {1}", Me.NombreCliente, vbCrLf)
|
||||
End If
|
||||
|
||||
If Not ObjEventos.AddEventoAgenda(4, Asunto, Descripcion.ToString(), 3, FechaCirugia, FechaCirugia.AddHours(1), CveUsuarioAgendar, UsuarioActual.CveEmpresa, RecurrenciaTipo:=0, CveTipoEvento:=2, CveOS:=CveOS) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al generar la agenda", ex)
|
||||
End Try
|
||||
|
||||
Return Not TieneError
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user