Kardex siguiente siguiente PS con movimientos
This commit is contained in:
@@ -1625,6 +1625,44 @@ Public Class ClsInventarios
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function GetKardexPSNavegacion(Entrada As Boolean, Salida As Boolean, CvePS As Integer, FechaI As String, FechaF As String, CveAlmacen As Integer, CveTiposAlmacen As String, CveUnidadMedida As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CveAlmacenes As String = "-1", Optional Siguiente As Boolean = True) As Boolean
|
||||||
|
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Inv_KardexPSNavegacionGet")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@Entrada", SqlDbType.Bit).Value = Entrada
|
||||||
|
.Add("@Salida", SqlDbType.Bit).Value = Salida
|
||||||
|
.Add("@FechaI", SqlDbType.VarChar).Value = FechaI
|
||||||
|
.Add("@FechaF", SqlDbType.VarChar).Value = FechaF
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||||
|
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
|
||||||
|
.Add("@CveTiposAlmacen", SqlDbType.VarChar).Value = CveTiposAlmacen
|
||||||
|
.Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida
|
||||||
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
|
|
||||||
|
.Add("@CveAlmacenes", SqlDbType.VarChar).Value = CveAlmacenes
|
||||||
|
.Add("@Siguiente", SqlDbType.Bit).Value = Siguiente
|
||||||
|
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch Ex1 As SqlException
|
||||||
|
|
||||||
|
Me.OnError("Ocurrió un error al obtener el kardex.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener el kardex.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function GetExistenciasProductoSerie(CvePS As Integer, CveUsuario As Integer, CveEmpresa As Integer, Fecha As DateTime, Optional CveAlmacenes As String = "-1") As Boolean
|
Public Function GetExistenciasProductoSerie(CvePS As Integer, CveUsuario As Integer, CveEmpresa As Integer, Fecha As DateTime, Optional CveAlmacenes As String = "-1") As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
Option Explicit On
|
Option Explicit On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
|
Imports ADSNetLibrary.SIGAPI.Models.CGame
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Imports Microsoft.Reporting.WebForms
|
Imports Microsoft.Reporting.WebForms
|
||||||
|
|
||||||
@@ -26,56 +27,12 @@ Partial Class Inventarios_Kardex
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|
||||||
Private Property IndiceNavegacionActual As Integer
|
|
||||||
Get
|
|
||||||
|
|
||||||
If ViewState("IndiceNavegacionActual") Is Nothing Then
|
|
||||||
ViewState("IndiceNavegacionActual") = 0
|
|
||||||
End If
|
|
||||||
Return ViewState("IndiceNavegacionActual").ToString.ToEntero
|
|
||||||
End Get
|
|
||||||
Set
|
|
||||||
ViewState("IndiceNavegacionActual") = Value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private Property DTPSNavegacion As DataTable
|
|
||||||
Get
|
|
||||||
If ViewState("DTPSNavegacion") Is Nothing Then
|
|
||||||
ViewState("DTPSNavegacion") = New DataTable
|
|
||||||
End If
|
|
||||||
|
|
||||||
Return DirectCast(ViewState("DTPSNavegacion"), DataTable)
|
|
||||||
|
|
||||||
End Get
|
|
||||||
Set(value As DataTable)
|
|
||||||
ViewState("DTPSNavegacion") = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private Property NavegacionTieneDatos As Boolean
|
|
||||||
Get
|
|
||||||
|
|
||||||
If ViewState("NavegacionTieneDatos") Is Nothing Then
|
|
||||||
ViewState("NavegacionTieneDatos") = False
|
|
||||||
End If
|
|
||||||
Return Boolean.Parse(ViewState("NavegacionTieneDatos").ToString)
|
|
||||||
End Get
|
|
||||||
Set(value As Boolean)
|
|
||||||
ViewState("NavegacionTieneDatos") = value
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
|
|
||||||
If UsuarioActual.CveRol = 1 Then
|
If UsuarioActual.CveRol = 1 Then
|
||||||
CreaDTPSNavegacion()
|
|
||||||
DVNavegar.Visible = True
|
DVNavegar.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -250,7 +207,7 @@ Partial Class Inventarios_Kardex
|
|||||||
|
|
||||||
#Region " CARGA DATOS "
|
#Region " CARGA DATOS "
|
||||||
Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click
|
Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click
|
||||||
CargaDatos(True)
|
CargaDatos()
|
||||||
Dim almacenes As String = ddlAlmacen.GetSelectedValues()
|
Dim almacenes As String = ddlAlmacen.GetSelectedValues()
|
||||||
If almacenes = "" Then
|
If almacenes = "" Then
|
||||||
almacenes = "-1"
|
almacenes = "-1"
|
||||||
@@ -258,22 +215,15 @@ Partial Class Inventarios_Kardex
|
|||||||
ImprimirQR.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=Etiqueta2&CvePS={0}&PS={1}&CveAlmacen={2}&Modalidad={3}", ddlProducto2.SelectedValue.ToEntero, ddlProducto2.SelectedText.ToString, almacenes, "Individual")))
|
ImprimirQR.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=Etiqueta2&CvePS={0}&PS={1}&CveAlmacen={2}&Modalidad={3}", ddlProducto2.SelectedValue.ToEntero, ddlProducto2.SelectedText.ToString, almacenes, "Individual")))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaDatos(Optional validaInidiceActual As Boolean = False)
|
Private Sub CargaDatos()
|
||||||
|
|
||||||
|
|
||||||
NavegacionTieneDatos = False
|
|
||||||
Dim CveProducto As Integer = ddlProducto2.SelectedValue.ToEntero
|
Dim CveProducto As Integer = ddlProducto2.SelectedValue.ToEntero
|
||||||
|
|
||||||
If validaInidiceActual Then
|
|
||||||
EstablecerIndiceActaual(CveProducto)
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
If CveProducto > 0 Then
|
If CveProducto > 0 Then
|
||||||
Dim DtTemp = CargarKardex(CveProducto)
|
Dim DtTemp = CargarKardex(CveProducto)
|
||||||
|
|
||||||
If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 1 Then
|
|
||||||
NavegacionTieneDatos = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 0 Then
|
If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 0 Then
|
||||||
|
|
||||||
@@ -598,81 +548,66 @@ Partial Class Inventarios_Kardex
|
|||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Private Sub EstablecerIndiceActaual(CveProducto As Integer)
|
|
||||||
|
|
||||||
IndiceNavegacionActual = 0
|
|
||||||
For Each drow As DataRow In DTPSNavegacion.Rows
|
|
||||||
If drow("CvePS").ToString.ToEntero = CveProducto Then
|
|
||||||
Exit Sub
|
|
||||||
End If
|
|
||||||
IndiceNavegacionActual = IndiceNavegacionActual + 1
|
|
||||||
Next
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub CreaDTPSNavegacion()
|
|
||||||
DTPSNavegacion = GlobalDTPS(UsuarioActual.CveEmpresa).FiltraParametros("", "Codigo", {"CvePS", "CodigoPS", "Codigo"})
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Protected Sub LnkPSAntyerior_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkPSAntyerior_Click(sender As Object, e As EventArgs)
|
||||||
|
NavegacionPS(Siguiente:=False)
|
||||||
NavegacionTieneDatos = False
|
|
||||||
|
|
||||||
For x As Integer = IndiceNavegacionActual - 1 To 0 Step -1
|
|
||||||
|
|
||||||
|
|
||||||
If x <= 0 Or NavegacionTieneDatos Then
|
|
||||||
IndiceNavegacionActual = x
|
|
||||||
UPFiltros.Update()
|
|
||||||
End If
|
|
||||||
|
|
||||||
ddlProducto2.SelectedValue = DTPSNavegacion.Rows(x)("CvePS").ToString
|
|
||||||
ddlProducto2.SelectedText = DTPSNavegacion.Rows(x)("CodigoPS").ToString
|
|
||||||
ddlProducto2.txtValue.Value = DTPSNavegacion.Rows(x)("CvePS").ToString
|
|
||||||
ddlProducto2.txtText.Value = DTPSNavegacion.Rows(x)("CodigoPS").ToString
|
|
||||||
CargaDatos()
|
|
||||||
|
|
||||||
If x <= 0 Or NavegacionTieneDatos Then
|
|
||||||
IndiceNavegacionActual = x
|
|
||||||
UPFiltros.Update()
|
|
||||||
UPDatos.Update()
|
|
||||||
Exit Sub
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Next
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub LnkPSSiguiente_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkPSSiguiente_Click(sender As Object, e As EventArgs)
|
||||||
|
NavegacionPS(Siguiente:=True)
|
||||||
|
End Sub
|
||||||
|
Private Sub NavegacionPS(Siguiente As Boolean)
|
||||||
|
Dim CvePS As Integer = ddlProducto2.SelectedValue.ToEntero
|
||||||
|
|
||||||
NavegacionTieneDatos = False
|
If Not CvePS > 0 Then
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
For x As Integer = IndiceNavegacionActual + 1 To DTPSNavegacion.Rows.Count - 1 Step 1
|
Dim dt As DataTable = New DataTable
|
||||||
|
|
||||||
|
Dim Entrada As Boolean = cbEntrada.Checked
|
||||||
|
Dim Salida As Boolean = cbSalida.Checked
|
||||||
|
|
||||||
If x >= DTPSNavegacion.Rows.Count - 1 Or NavegacionTieneDatos Then
|
Dim FechaI As String = If(TxtFechaI.Text <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text, "-1")
|
||||||
IndiceNavegacionActual = x
|
Dim FechaF As String = If(TxtFechaF.Text <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text, "-1")
|
||||||
UPFiltros.Update()
|
Dim CveAlmacen As Integer = If(ddlAlmacen.SelectedValue.ToEntero = 0, -1, ddlAlmacen.SelectedValue.ToEntero)
|
||||||
End If
|
Dim CveAlmacenes As String = ddlAlmacen.GetSelectedValues()
|
||||||
|
If CveAlmacenes.Contains(",") Then
|
||||||
ddlProducto2.SelectedValue = DTPSNavegacion.Rows(x)("CvePS").ToString
|
CveAlmacen = -1
|
||||||
ddlProducto2.SelectedText = DTPSNavegacion.Rows(x)("CodigoPS").ToString
|
End If
|
||||||
ddlProducto2.txtValue.Value = DTPSNavegacion.Rows(x)("CvePS").ToString
|
If CvePS > 0 Then
|
||||||
ddlProducto2.txtText.Value = DTPSNavegacion.Rows(x)("CodigoPS").ToString
|
Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||||
CargaDatos()
|
If dr IsNot Nothing Then
|
||||||
|
ddlProducto2.SelectedText = dr("PSCodigo").ToString
|
||||||
If x >= DTPSNavegacion.Rows.Count - 1 Or NavegacionTieneDatos Then
|
ddlProducto2.SelectedValue = CvePS.ToString
|
||||||
IndiceNavegacionActual = x
|
|
||||||
UPFiltros.Update()
|
|
||||||
UPDatos.Update()
|
|
||||||
Exit Sub
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim CveTiposAlmacen As String = ""
|
||||||
|
For Each item As ListItem In CBLTiposAlmacen.Items
|
||||||
|
CveTiposAlmacen += If(item.Selected, $"{item.Value},", "")
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
Dim ObjInventarios As New ClsInventarios
|
||||||
|
If ObjInventarios.GetKardexPSNavegacion(Entrada, Salida, CvePS, FechaI, FechaF, CveAlmacen, CveTiposAlmacen.Substring(0, CveTiposAlmacen.Length - 1), DdlUnidadMedida.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAlmacenes, Siguiente:=Siguiente) Then
|
||||||
|
dt = ObjInventarios.DtResultados.Copy
|
||||||
|
End If
|
||||||
|
ObjInventarios.Dispose()
|
||||||
|
|
||||||
|
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
|
ddlProducto2.SelectedValue = dt.Rows(0)("CvePS").ToString
|
||||||
|
ddlProducto2.SelectedText = dt.Rows(0)("CodigoPS").ToString
|
||||||
|
ddlProducto2.txtValue.Value = dt.Rows(0)("CvePS").ToString
|
||||||
|
ddlProducto2.txtText.Value = dt.Rows(0)("CodigoPS").ToString
|
||||||
|
CargaDatos()
|
||||||
|
UPFiltros.Update()
|
||||||
|
UPDatos.Update()
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user