154.Solicitudes de traspaso correcto notificación rechazo

This commit is contained in:
Rakcsle Supertramp
2020-09-22 18:38:55 -07:00
parent 320b241925
commit 52c1f890d4
3 changed files with 137 additions and 20 deletions

View File

@@ -36,19 +36,19 @@ Partial Class Inventarios_TrasladoSolicitud
ViewState("CveDireccionEnvio") = value
End Set
End Property
'Private Property CveUsuarioAutoriza As Integer
' Get
' If ViewState("CveUsuarioAutoriza") Is Nothing Then
' Return -1
' Else
' Return CType(ViewState("CveUsuarioAutoriza"), Integer)
' End If
Private Property CveUsuarioSolicita As Integer
Get
If ViewState("CveUsuarioSolicita") Is Nothing Then
Return -1
Else
Return CType(ViewState("CveUsuarioSolicita"), Integer)
End If
' End Get
' Set(value As Integer)
' ViewState("CveUsuarioAutoriza") = value
' End Set
'End Property
End Get
Set(value As Integer)
ViewState("CveUsuarioSolicita") = value
End Set
End Property
#End Region
@@ -178,6 +178,8 @@ Partial Class Inventarios_TrasladoSolicitud
HplContrato.Text = ObjInventarios.DtResultados.Rows(0)("DescripcionContrato").ToString
HplContrato.NavigateUrl = $"/Contratos/Contrato.aspx?CveContrato={ObjInventarios.DtResultados.Rows(0)("CveContrato").ToString.ToEntero}"
CveUsuarioSolicita = ObjInventarios.DtResultados.Rows(0)("CveUsuario").ToString.ToEntero
'25/04/2018
CveDireccionEnvio = ObjInventarios.DtResultados.Rows(0)("CveDireccionEnvio").ToString.ToEntero
If CveDireccionEnvio > 0 And ObjClientes.DireccionEnvioGet(CveDireccionEnvio, -1, -1) Then
@@ -994,15 +996,85 @@ Partial Class Inventarios_TrasladoSolicitud
CargaDatos()
End Sub
Protected Sub LnkRechazarTraslado_Click(sender As Object, e As EventArgs)
TxtMotivoRechazo.Text = ""
UpModalRechazo.Update()
RegistraScript("$('#ModalRechazarTraslado').modal();")
End Sub
Protected Sub BtnModalRechazo_Click(sender As Object, e As EventArgs)
RechazarTraslado()
End Sub
Private Sub RechazarTraslado()
Dim ErrorProceso As Boolean = False
If TxtMotivoRechazo.Text.Trim.Length.ToEntero = 0 Then
Alert("El motivo de rechazo es necesario", TipoMensaje.MsgAdvertencia)
End If
Dim ObjInven As New ClsInventarios
If ObjInven.UpdateTrasladoAutorizar(CveTraspasoSolicitud, UsuarioActual.CveEmpresa, 3, UsuarioActual.CveUsuario, Now) Then
Alert("Rechazado correctamente.")
ErrorProceso = False
Else
ErrorProceso = True
End If
ObjInven.Dispose()
CargaDatos()
If Not ErrorProceso Then
MandaCorreoRechazo(LbFolio.Text.ToEntero, CveTraspasoSolicitud, CveUsuarioSolicita, TxtMotivoRechazo.Text)
CargaDatos()
RegistraScript("$('#ModalRechazarTraslado').modal('hide');")
End If
End Sub
Private Sub MandaCorreoRechazo(Folio As Integer, CveTraspasoSolicitud As Integer, CveUsuarioSolicita As Integer, MotivoRechazo As String)
Dim SB As New StringBuilder
Dim CorreoDestino As String = GlobalDTUsuarios(CveUsuarioSolicita)(0)("Correo").ToString.Trim
If CorreoDestino.Length > 0 Then
SB.AppendLine($"<p>Se ha rechazado la solicitud de traspaso con folio {Folio}, el traspaso fue rechazado por el usuario {UsuarioActual.Nombre }, el traspaso fue rechazado por el motivo: {MotivoRechazo} </p>")
SB.AppendLine("<br>")
SB.AppendLine("<table border = '0'>")
SB.AppendLine("<tr style='color:white;background-color:#808080;' ><th>Cantidad</th> <th>U.M.</th> <th>Producto</th> <th>Observaciones</th> </tr>")
For Each GvRow As GridViewRow In GvDatos.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
SB.AppendLine($"<tr style='background-color:#F2F2F0;'> <td>{GvRow.DataKey("Cantidad")}</td> <td>{GvRow.DataKey("UnidadMedida")}</td> <td>{GvRow.DataKey("CodigoPS")}</td> <td>{GvRow.DataKey("Observaciones")}</td> </tr>")
End If
Next
SB.AppendLine("</table>")
SB.AppendLine("<br>")
SB.AppendLine($"<strong> <a href='{Request.Url.GetLeftPart(UriPartial.Authority)}/Inventarios/TrasladoSolicitud.aspx?CveTraspasoSolicitud={CveTraspasoSolicitud}'>Ir a solicitud de traspaso folio {Folio}</a></strong>")
Dim MandaCorre As New ClsSisMail
MandaCorre.SendMail(ClsPaginas.EmpresaNotificaciones, CorreoDestino, $"Rechazo de Autorización de traspaso #{Folio}", SB.ToString, Displayname:="SIG Notificaciones: Rechazo de Traspaso")
End If
End Sub
@@ -1057,5 +1129,6 @@ Partial Class Inventarios_TrasladoSolicitud
Next
GvDatos.Columns(5).Visible = Mostrar
End Sub
End Class