Nuevo Módulo de recolecciones

This commit is contained in:
2024-02-07 05:10:36 -07:00
parent f7d6e38835
commit 79b31ec16d
2 changed files with 489 additions and 0 deletions

View File

@@ -0,0 +1,212 @@
Imports System.Data
Imports CrystalDecisions.Shared.Json
Imports Extensiones
Partial Class Acumuladores_RepRecolecciones
Inherits ClsPaginas
#Region "Propiedades"
Private Property CveEntregaAlmacen As Integer
Get
If Not ViewState("CveEntregaAlmacen") Is Nothing Then
Return ViewState("CveEntregaAlmacen").ToString.ToEntero
Else
Return -1
End If
End Get
Set(value As Integer)
ViewState("CveEntregaAlmacen") = value
End Set
End Property
Private Property DTRecoleccion As DataTable
Get
If ViewState("DTRecoleccion") Is Nothing Then
ViewState("DTRecoleccion") = InitDTRecoleccion()
End If
Return CType(ViewState("DTRecoleccion"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DTRecoleccion") = CType(value, DataTable)
End Set
End Property
Private Property Actualizar As Boolean
Get
If Not ViewState("Actualizar") Is Nothing Then
Return DirectCast(ViewState("Actualizar"), Boolean)
Else
Return False
End If
End Get
Set(value As Boolean)
ViewState("Actualizar") = value
End Set
End Property
#End Region
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
InicializaCombos()
CargaDatos()
End If
End Sub
Private Sub InicializaCombos()
CargaPS()
TxtFechaI.Text = NowADS().AddDays(-1).ToShortDateString
TxtFechaF.Text = NowADS().AddDays(3).ToShortDateString
CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto)
End Sub
Private Sub CargaDatos()
Dim ObjGeneral As New ClsGenerales
If (ObjGeneral.GetInvEntregaAlmacenRuta(-1, Now.AddMonths(-1), Now.AddMonths(1), UsuarioActual.CveEmpresa, 2, -1)) Then
GvR.DataSource = ObjGeneral.DtResultados
End If
ObjGeneral.Dispose()
UPGv.DataBind()
UpGral.Update()
End Sub
Protected Sub gvR_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim LnkEditar As LinkButton = e.Row.FCLinkButton("LnkGvDatosRecoleccionEditar")
If e.Row.DataKey("Estatus") = "0" OrElse e.Row.DataKey("Estatus") = "" Then
LnkEditar.Visible = True
End If
' If e.Row.DataKey("Estatus") = "1" Then
e.Row.FCHyperLink("HplR").Visible = True
e.Row.FCHyperLink("HplR").NavigateUrl = "/Inventarios/EntradasSalidas.aspx?CveEntregaAlmacen=" & e.Row.DBCampo("CveEntregaAlmacen")
'End If
If e.Row.DataKey("CveTimbre") <> "" Then
e.Row.FCCheckBox("Chk").Visible = False
End If
End If
End Sub
Protected Sub LnkGvDatosRecoleccionEditar_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim LnkEliminar As LinkButton = CType(sender, LinkButton)
Dim GvRow As GridViewRow = CType(LnkEliminar.NamingContainer, GridViewRow)
CveEntregaAlmacen = GvRow.DataKey("CveEntregaAlmacen").ToEntero()
Dim CveDireccionOrigen As Integer = GvRow.DataKey("CveDireccionOrigen").ToEntero()
CargaDatosRecoleccionDetallePS()
LtlModalRecoleccionTitulo.Text = "Definición de tamaños"
BtnModalRecoleccionGuardar.Text = "Guardar"
UpModalRecoleccion.Update()
RegistraScript("$('#DivModalRecoleccion').modal('show');")
End Sub
Protected Sub DdlProducto_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
ElProductoChange()
End Sub
Private Sub ElProductoChange()
DdlModalRecoleccionUnidad.Items.Clear()
DdlModalRecoleccionUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero(), -1, UsuarioActual.CveEmpresa)
DdlModalRecoleccionUnidad.DataBind()
UpModalRecoleccion.Update()
End Sub
Private Sub CargaDatosRecoleccionDetallePS()
Dim ObjGenerales As New ClsGenerales()
Dim Str As New StringBuilder
Str.Append("Productos Definidos <br/>")
If ObjGenerales.GetEntregaAlmacenRutaDetalle(CveEntregaAlmacen) Then
For Each dr As DataRow In ObjGenerales.DtResultados.Rows
Str.AppendFormat(" {0} - {1}<br/>", dr("Cantidad"), dr("CodigoPS"))
Next
LblProductosCargados.Text = Str.ToString
End If
ObjGenerales.Dispose()
GvModalPSRecoleccion.DataSource = DTRecoleccion
GvModalPSRecoleccion.DataBind()
UpModalRecoleccion.Update()
End Sub
Private Function InitDTRecoleccion() As DataTable
Dim DT As DataTable = New DataTable()
DT.Columns.Add("CveEntregaAlmacenDetalle", System.Type.[GetType]("System.Int32"))
DT.Columns.Add("CveEntregaAlmacen", System.Type.[GetType]("System.Int32"))
DT.Columns.Add("CvePS", System.Type.[GetType]("System.Int32"))
DT.Columns.Add("Cantidad", System.Type.[GetType]("System.Double"))
DT.Columns.Add("CveUnidadMedida", System.Type.[GetType]("System.Int32"))
DT.Columns.Add("CveUsuario", System.Type.[GetType]("System.Int32"))
DT.Columns.Add("FechaIng", System.Type.[GetType]("System.DateTime"))
DT.Columns.Add("CodigoPS", System.Type.[GetType]("System.String"))
DT.Columns.Add("Abreviatura", System.Type.[GetType]("System.String"))
Return DT
End Function
Private Sub CargaPS()
Dim ObjAcum As New ClsAcumuladores
Dim lista As New List(Of String)
Dim Filtro As String = ""
For Each drow As DataRow In GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).Rows
If drow("CvePSCargo").ToString.ToEntero > 0 Then
lista.Add(drow("CvePSCargo").ToString)
End If
Next
If lista.Count > 0 Then
Filtro = "CvePS in(" & String.Join(",", lista) & ")"
DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros(Filtro)
DdlProducto2.DataBind()
DdlProducto2.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
ObjAcum.Dispose()
End Sub
Protected Sub LnkModalAgregarPS_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim dRow As DataRow = DTRecoleccion.NewRow()
dRow("CveEntregaAlmacenDetalle") = -1
dRow("CveEntregaAlmacen") = CveEntregaAlmacen
dRow("CvePS") = DdlProducto2.SelectedValue.ToEntero()
dRow("Cantidad") = TxtModalRecoleccionCantidad.Text.ToEntero()
dRow("CveUnidadMedida") = DdlModalRecoleccionUnidad.SelectedValue.ToEntero()
dRow("CveUsuario") = UsuarioActual.CveUsuario
dRow("FechaIng") = NowADS()
dRow("CodigoPS") = DdlProducto2.SelectedItem.Text
dRow("Abreviatura") = DdlModalRecoleccionUnidad.SelectedItem.Text
DTRecoleccion.Rows.Add(dRow)
LimpiarControlesPS()
CargaDatosRecoleccionDetallePS()
End Sub
Private Sub LimpiarControlesPS()
TxtModalRecoleccionCantidad.Text = ""
DdlModalRecoleccionUnidad.Items.Clear()
'DdlProducto2.txtText.Value = ""
'DdlProducto2.txtValue.Value = ""
UpModalRecoleccion.Update()
End Sub
End Class