Autorizacion de traslados
This commit is contained in:
@@ -35,9 +35,24 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Set(value As Integer)
|
||||
ViewState("CveDireccionEnvio") = value
|
||||
End Set
|
||||
End Property
|
||||
End Property
|
||||
|
||||
'Private Property CveUsuarioAutoriza As Integer
|
||||
' Get
|
||||
' If ViewState("CveUsuarioAutoriza") Is Nothing Then
|
||||
' Return -1
|
||||
' Else
|
||||
' Return CType(ViewState("CveUsuarioAutoriza"), Integer)
|
||||
' End If
|
||||
|
||||
' End Get
|
||||
' Set(value As Integer)
|
||||
' ViewState("CveUsuarioAutoriza") = value
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
|
||||
@@ -132,7 +147,8 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
#Region " CARGA DATOS "
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
Dim ObjClientes As New ClsClientes
|
||||
Dim ObjClientes As New ClsClientes
|
||||
|
||||
If ObjInventarios.AddTrasladoSolicitudGet(CveTraspasoSolicitud, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventarios.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
@@ -213,6 +229,55 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
LbAgregarPS.Visible = False
|
||||
HLDesdeContrato.Visible = False
|
||||
|
||||
|
||||
Dim EstatusAlmacen As Integer = ObjInventarios.DtResultados.Rows(0)("EstatusAlmacen").ToString().ToEntero
|
||||
Dim CveUsuarioAutoriza As Integer = ObjInventarios.DtResultados.Rows(0)("CveUsuarioAutorizaDestino").ToString().ToEntero
|
||||
|
||||
If EstatusAlmacen > 0 Then
|
||||
|
||||
|
||||
If UsuarioActual.CveUsuario = CveUsuarioAutoriza Then
|
||||
|
||||
If EstatusAlmacen = 1 Then
|
||||
|
||||
|
||||
DivAutoriza.Visible = True
|
||||
DVAutorizarBotones.Visible = True
|
||||
DVAutorizaInformacion.Visible = False
|
||||
|
||||
ElseIf EstatusAlmacen.Contiene(2, 3) Then
|
||||
DivAutoriza.Visible = True
|
||||
|
||||
DVAutorizarBotones.Visible = False
|
||||
DVAutorizaInformacion.Visible = True
|
||||
|
||||
LblEstatusAutorizo.Text = If(EstatusAlmacen = 2, "Aceptado", "Rechazado")
|
||||
LblUsaurioAutorizo.Text = ObjInventarios.DtResultados.Rows(0)("NombreAutoriza").ToString()
|
||||
LblFechaAutoriza.Text = ObjInventarios.DtResultados.Rows(0)("FechaAutorizacion").ToString().ToDate().ToString("dd/MM/yyyy")
|
||||
Else
|
||||
|
||||
End If
|
||||
|
||||
ElseIf EstatusAlmacen.Contiene(2, 3) Then
|
||||
|
||||
DivAutoriza.Visible = True
|
||||
|
||||
DVAutorizarBotones.Visible = False
|
||||
DVAutorizaInformacion.Visible = True
|
||||
|
||||
LblEstatusAutorizo.Text = If(EstatusAlmacen = 2, "Aceptado", "Rechazado")
|
||||
LblUsaurioAutorizo.Text = ObjInventarios.DtResultados.Rows(0)("NombreAutoriza").ToString()
|
||||
LblFechaAutoriza.Text = ObjInventarios.DtResultados.Rows(0)("FechaAutorizacion").ToString().ToDate().ToString("dd/MM/yyyy")
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
DivAutoriza.Visible = False
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Else
|
||||
Alert("Ocurrió un error al obtener los datos del traspaso.", TipoMensaje.MsgError)
|
||||
End If
|
||||
@@ -469,15 +534,37 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
If Not GvDatos.Rows.Count > 0 Then
|
||||
Alert("No se ha seleccionado ningún Producto para trasladar.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'VERIFICA EXISTENCIAS
|
||||
End If
|
||||
|
||||
|
||||
Dim CveUsuarioAutoriza As Integer = -1
|
||||
Dim EstatusAlmacen As Integer = 2
|
||||
'VERIFICA EXISTENCIAS
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
Dim Existencia = 0.0
|
||||
Dim TieneErrorExistencia = False
|
||||
Dim MensajeExistencia As New StringBuilder
|
||||
MensajeExistencia.Append("No hay la existencia suficiente de los siguientes productos:<br/>")
|
||||
Dim CodigoPS As String = ""
|
||||
Dim CodigoPS As String = ""
|
||||
|
||||
|
||||
If ObjInventarios.GetAlmacenes(-1, -1, UsuarioActual.CveEmpresa, -1) Then
|
||||
|
||||
If ObjInventarios.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
CveUsuarioAutoriza = If(ObjInventarios.DtResultados.FiltraParametros($"CveAlmacen = {DdlAlmacenDestino.SelectedValue}")(0)("CveUsuarioAutoriza").ToString.ToEntero > 0, ObjInventarios.DtResultados.FiltraParametros($"CveAlmacen = {DdlAlmacenDestino.SelectedValue}")(0)("CveUsuarioAutoriza").ToString.ToEntero, -1)
|
||||
If CveUsuarioAutoriza > 0 Then
|
||||
EstatusAlmacen = 1
|
||||
End If
|
||||
|
||||
Else
|
||||
CveUsuarioAutoriza = -1
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
For Each row As GridViewRow In GvDatos.Rows
|
||||
CodigoPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=row.DataKey("CvePS").ToEntero).FiltroPrimeroValor("PSCodigo", "")
|
||||
Existencia = ObjInventarios.GetExistenciasPS(row.DataKey("CvePS").ToEntero, row.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"))
|
||||
@@ -509,7 +596,7 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Estatus = 3
|
||||
End If
|
||||
|
||||
Dim Folio = ObjInventarios.AddTrasladoSolicitud(TxtObservaciones.Text.Trim, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero, Estatus, -1, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato, Guia:=Guia, CvePaqueteria:=DdlPaqueteria.SelectedValue.ToEntero, CveDireccionEnvio:=CveDireccionEnvio)
|
||||
Dim Folio = ObjInventarios.AddTrasladoSolicitud(TxtObservaciones.Text.Trim, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero, Estatus, -1, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato, Guia:=Guia, CvePaqueteria:=DdlPaqueteria.SelectedValue.ToEntero, CveDireccionEnvio:=CveDireccionEnvio, EstatusAlmacen:=EstatusAlmacen)
|
||||
|
||||
If Folio > 0 Then
|
||||
CveTraspasoSolicitud = ObjInventarios.CveTraspasoSolicitud
|
||||
@@ -536,7 +623,12 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
|
||||
If TieneError = False Then
|
||||
ObjInventarios.Commit()
|
||||
Alert($"El Traspaso se guardó correctamente con el folio #: <b>{Folio}</b>.", TipoMensaje.MsgInformacion, $"document.location.href=""/Inventarios/TrasladoSolicitud.aspx?CveTraspasoSolicitud={CveTraspasoSolicitud}""")
|
||||
Alert($"El Traspaso se guardó correctamente con el folio #: <b>{Folio}</b>.", TipoMensaje.MsgInformacion, $"document.location.href=""/Inventarios/TrasladoSolicitud.aspx?CveTraspasoSolicitud={CveTraspasoSolicitud}""")
|
||||
|
||||
If CveUsuarioAutoriza > 0 Then
|
||||
MandaCorreoAutorizacion(Folio, CveTraspasoSolicitud, CveUsuarioAutoriza)
|
||||
End If
|
||||
|
||||
Else
|
||||
ObjInventarios.RollBack()
|
||||
Alert("Ocurrió un Error al guardar el traspaso.", TipoMensaje.MsgError)
|
||||
@@ -852,12 +944,12 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Response.TransmitFile(Archivo.FullName)
|
||||
Response.End()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub DdlProductoServicio_selectedindexchange(sender As Object, e As EventArgs)
|
||||
If DdlProductoServicio.SelectedValue.ToEntero > 0 Then
|
||||
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProductoServicio.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
@@ -874,6 +966,78 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
End If
|
||||
UpPS.Update()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub LnkAceptarTraslado_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ObjInven As New ClsInventarios
|
||||
If ObjInven.UpdateTrasladoAutorizar(CveTraspasoSolicitud, UsuarioActual.CveEmpresa, 2, UsuarioActual.CveUsuario, Now) Then
|
||||
Alert("Autorizado correctamente.")
|
||||
End If
|
||||
ObjInven.Dispose()
|
||||
|
||||
CargaDatos()
|
||||
|
||||
End Sub
|
||||
Protected Sub LnkRechazarTraslado_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ObjInven As New ClsInventarios
|
||||
If ObjInven.UpdateTrasladoAutorizar(CveTraspasoSolicitud, UsuarioActual.CveEmpresa, 3, UsuarioActual.CveUsuario, Now) Then
|
||||
Alert("Rechazado correctamente.")
|
||||
End If
|
||||
ObjInven.Dispose()
|
||||
|
||||
CargaDatos()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub MandaCorreoAutorizacion(Folio As Integer, CveTraspasoSolicitud As Integer, CveUsuarioAutoriza As Integer)
|
||||
|
||||
Dim SB As New StringBuilder
|
||||
|
||||
Dim CorreoDestino As String = GlobalDTUsuarios(CveUsuarioAutoriza)(0)("Correo").ToString.Trim
|
||||
|
||||
|
||||
If CorreoDestino.Length > 0 Then
|
||||
|
||||
|
||||
|
||||
SB.AppendLine($"<p>Se ha registrado una solicitud de traspaso de {DdlAlmacenOrigen.SelectedItem.Text} a {DdlAlmacenDestino.SelectedItem.Text}, con los siguientes productos.</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 para autorización</a></strong>")
|
||||
|
||||
|
||||
|
||||
Dim MandaCorre As New ClsSisMail
|
||||
MandaCorre.SendMail(ClsPaginas.EmpresaNotificaciones, CorreoDestino, $"Solicitud de Autorización de traspaso #{Folio}", SB.ToString, Displayname:="SIG Notificaciones: Solicitud de Traspaso")
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user