- Serie, Lote Caducidad, SeccionAlmacen
This commit is contained in:
@@ -32,20 +32,20 @@ Partial Class Inventarios_Apartados
|
||||
ViewState("CargadoDeMov") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CvePSSerieLote As Integer
|
||||
Private Property CvePSSerie As Integer
|
||||
Get
|
||||
Return CType(ViewState("CvePSSerieLote"), Integer)
|
||||
Return CType(ViewState("CvePSSerie"), Integer)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CvePSSerieLote") = value
|
||||
ViewState("CvePSSerie") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveUMSerieLote As Integer
|
||||
Private Property CveUMSerie As Integer
|
||||
Get
|
||||
Return CType(ViewState("CveUMSerieLote"), Integer)
|
||||
Return CType(ViewState("CveUMSerie"), Integer)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveUMSerieLote") = value
|
||||
ViewState("CveUMSerie") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveCliente As Integer
|
||||
@@ -64,14 +64,7 @@ Partial Class Inventarios_Apartados
|
||||
ViewState("CveVendedor") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtSeccionAlmacen As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtSeccionAlmacen"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtSeccionAlmacen") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property IndexSeccionAlmacen As Integer
|
||||
Get
|
||||
Return CType(ViewState("IndexSeccionAlmacen"), Integer)
|
||||
@@ -147,7 +140,7 @@ Partial Class Inventarios_Apartados
|
||||
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem(" Seleccione ", "-1"))
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione ", "-1"))
|
||||
|
||||
DdlSubProyectoDesapartado.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
DdlSubProyectoDesapartado.DataBind()
|
||||
@@ -168,11 +161,16 @@ Partial Class Inventarios_Apartados
|
||||
Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
|
||||
If EsWS Then
|
||||
DdlClientes.setEsWebService(True)
|
||||
DdlClienteDesapartado.setEsWebService(True)
|
||||
Else
|
||||
DdlClientes.setEsWebService(False)
|
||||
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
|
||||
DdlClientes.DataBind()
|
||||
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlClienteDesapartado.setEsWebService(False)
|
||||
DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
|
||||
DdlClienteDesapartado.DataBind()
|
||||
DdlClienteDesapartado.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End If
|
||||
|
||||
|
||||
@@ -180,9 +178,9 @@ Partial Class Inventarios_Apartados
|
||||
'DdlCliente.DataBind()
|
||||
'DdlCliente.Items.Insert(0, New ListItem(" Seleccione ", "-1"))
|
||||
|
||||
DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
|
||||
DdlClienteDesapartado.DataBind()
|
||||
DdlClienteDesapartado.Items.Insert(0, New ListItem(" Todos ", "-1"))
|
||||
'DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
|
||||
'DdlClienteDesapartado.DataBind()
|
||||
'DdlClienteDesapartado.Items.Insert(0, New ListItem(" Todos ", "-1"))
|
||||
|
||||
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedor.DataBind()
|
||||
@@ -230,7 +228,11 @@ Partial Class Inventarios_Apartados
|
||||
dt.Columns.Add("CvePS", Type.GetType("System.Int32"))
|
||||
dt.Columns.Add("CveAF", Type.GetType("System.Int32"))
|
||||
dt.Columns.Add("PS")
|
||||
dt.Columns.Add("SerieLote")
|
||||
dt.Columns.Add("CveSeccionAlmacen", Type.GetType("System.Int32"))
|
||||
dt.Columns.Add("SeccionAlmacen")
|
||||
dt.Columns.Add("Serie")
|
||||
dt.Columns.Add("Lote")
|
||||
dt.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime"))
|
||||
|
||||
dt.Columns.Add("CveClasificacion", Type.GetType("System.Int32"))
|
||||
dt.Columns.Add("EstatusExistencia")
|
||||
@@ -262,17 +264,40 @@ Partial Class Inventarios_Apartados
|
||||
ElProductoChange()
|
||||
End Sub
|
||||
Private Sub ElProductoChange()
|
||||
TxtnSerieLote.Visible = False
|
||||
TxtnSerie.Visible = False
|
||||
|
||||
If DdlProducto2.SelectedValue.ToEntero > 0 Then
|
||||
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltraParametros("Inv_CveMetodoInventario = 5 OR AplicaSerie = 1 ", "PSCodigo").Rows.Count > 0 Then
|
||||
ThSerieLote.Visible = True
|
||||
TdSerieLote.Visible = True
|
||||
TxtnSerieLote.Visible = True
|
||||
GvDatos.Columns(4).Visible = True
|
||||
Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
If drP IsNot Nothing Then
|
||||
If CBool(drP("AplicaSerie")) Then
|
||||
ThSerie.Visible = True
|
||||
TdSerie.Visible = True
|
||||
TxtnSerie.Visible = True
|
||||
GvDatos.Columns(4).Visible = True
|
||||
End If
|
||||
If CBool(drP("AplicaLote")) Then
|
||||
ThLote.Visible = True
|
||||
TdLote.Visible = True
|
||||
GvDatos.Columns(5).Visible = True
|
||||
End If
|
||||
If CBool(drP("AplicaCaducidad")) Then
|
||||
ThCaducidad.Visible = True
|
||||
TdCaducidad.Visible = True
|
||||
GvDatos.Columns(6).Visible = True
|
||||
End If
|
||||
If CBool(drP("AplicaSeccion")) Then
|
||||
ThSeccion.Visible = True
|
||||
TdSeccionAlmacen.Visible = True
|
||||
DdlSeccionAlmacen.DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlProducto2.SelectedValue.ToEntero)
|
||||
DdlSeccionAlmacen.DataBind()
|
||||
GvDatos.Columns(7).Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
DdlUnidad.Items.Clear()
|
||||
DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa)
|
||||
DdlUnidad.DataBind()
|
||||
@@ -380,8 +405,8 @@ Partial Class Inventarios_Apartados
|
||||
If DrPS("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then
|
||||
TdSeriePS.Visible = True
|
||||
TxtSeriePS.Focus()
|
||||
CvePSSerieLote = DrPS("CvePS").ToString.ToEntero
|
||||
CveUMSerieLote = DrPS("CveUnidadMedida").ToString.ToEntero
|
||||
CvePSSerie = DrPS("CvePS").ToString.ToEntero
|
||||
CveUMSerie = DrPS("CveUnidadMedida").ToString.ToEntero
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -397,10 +422,10 @@ Partial Class Inventarios_Apartados
|
||||
|
||||
txtCantidad.Text = "1"
|
||||
|
||||
Dim Valido = ValidaExistencia(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim)
|
||||
Dim Valido = ValidaExistencia(1, CvePSSerie, CveUMSerie, TxtSeriePS.Text.Trim)
|
||||
|
||||
If Valido Then
|
||||
AgregarPS(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim)
|
||||
AgregarPS(1, CvePSSerie, CveUMSerie, Serie:=TxtSeriePS.Text.Trim)
|
||||
Else
|
||||
TxtSeriePS.Text = ""
|
||||
TxtSeriePS.Focus()
|
||||
@@ -426,10 +451,10 @@ Partial Class Inventarios_Apartados
|
||||
Dim FuncionalidadSinSerie = True
|
||||
|
||||
If CveProducto > 0 Then
|
||||
If TxtnSerieLote.Visible Then
|
||||
If TxtnSerie.Visible Then
|
||||
Cantidad = 1
|
||||
If TxtnSerieLote.Text = "" Then
|
||||
Alert("Serie-Lote es necesario", TipoMensaje.MsgAdvertencia)
|
||||
If TxtnSerie.Text = "" Then
|
||||
Alert("Serie es necesario", TipoMensaje.MsgAdvertencia)
|
||||
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -438,19 +463,20 @@ Partial Class Inventarios_Apartados
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1"))
|
||||
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, Serie:=If(TxtnSerie.Visible, TxtnSerie.Text, "-1"))
|
||||
|
||||
If Valido Then
|
||||
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1"), FuncionalidadSinSerie)
|
||||
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(TxtnSerie.Text <> "", TxtnSerie.Text, ""), Limpia:=FuncionalidadSinSerie)
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Boolean
|
||||
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Serie As String = "-1",
|
||||
Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha, Optional CveSeccionAlmacen As Integer = -1) As Boolean
|
||||
Dim Retorno = True
|
||||
|
||||
Dim Inv As New ClsInventarios
|
||||
Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Serie:=Serie)
|
||||
Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad)
|
||||
Inv.Dispose()
|
||||
|
||||
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(Serie <> "-1", $" AND Serie = '{Serie}'", "")}") < 0 Then
|
||||
@@ -466,7 +492,8 @@ Partial Class Inventarios_Apartados
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional SerieLote As String = "-1", Optional Limpia As Boolean = True)
|
||||
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer,
|
||||
Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True, Optional SeccionAlmacen As String = "")
|
||||
If Cantidad <= 0 Then
|
||||
Alert("La cantidad debe ser mayor a cero (0). Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||
@@ -485,10 +512,14 @@ Partial Class Inventarios_Apartados
|
||||
registro.Item("UnidadMedida") = DrUM("UnidadMedida")
|
||||
registro.Item("CvePS") = CvePS
|
||||
registro.Item("PS") = DrPS("PSCodigo")
|
||||
registro.Item("SerieLote") = SerieLote
|
||||
registro.Item("Serie") = Serie
|
||||
registro.Item("Lote") = Lote
|
||||
registro.Item("FechaCaducidad") = FechaCaducidad
|
||||
registro.Item("CveClasificacion") = CveClasificacion
|
||||
registro.Item("CveAF") = -1
|
||||
registro.Item("EstatusExistencia") = "1"
|
||||
registro.Item("CveSeccionAlmacen") = CveSeccionAlmacen
|
||||
registro.Item("SeccionAlmacen") = If(CveSeccionAlmacen > 0, SeccionAlmacen, "")
|
||||
|
||||
DtMovimientos.Rows.Add(registro)
|
||||
RegistraScript("playsonidito('beep-07.wav')")
|
||||
@@ -498,16 +529,16 @@ Partial Class Inventarios_Apartados
|
||||
LimpiaAgregar()
|
||||
Else
|
||||
txtCantidad.Text = (txtCantidad.Text.ToDouble - 1.0).ToString
|
||||
TxtnSerieLote.Text = ""
|
||||
TxtnSerieLote.Focus()
|
||||
TxtnSerie.Text = ""
|
||||
TxtnSerie.Focus()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub LimpiaAgregar()
|
||||
DdlClasificacion.SelectedValue = "-1"
|
||||
DdlClasificacion_SelectedIndexChanged(DdlClasificacion, EventArgs.Empty)
|
||||
txtCantidad.Text = ""
|
||||
TxtnSerieLote.Text = ""
|
||||
TxtnSerieLote.Visible = False
|
||||
TxtnSerie.Text = ""
|
||||
TxtnSerie.Visible = False
|
||||
txtCantidad.Focus()
|
||||
If TxtCodigoPS.Visible Then
|
||||
TxtCodigoPS.Focus()
|
||||
@@ -517,12 +548,18 @@ Partial Class Inventarios_Apartados
|
||||
|
||||
#Region " GV DATOS "
|
||||
Private Sub CargaGvDatos(Optional EscondeSerie As Boolean = True)
|
||||
If EscondeSerie Then
|
||||
TxtnSerieLote.Visible = False
|
||||
ThSerieLote.Visible = False
|
||||
TdSerieLote.Visible = False
|
||||
GvDatos.Columns(4).Visible = False
|
||||
End If
|
||||
'If EscondeSerie Then
|
||||
' TxtnSerie.Visible = False
|
||||
' ThSerie.Visible = False
|
||||
' TdSerie.Visible = False
|
||||
' GvDatos.Columns(4).Visible = False
|
||||
'End If
|
||||
|
||||
GvDatos.Columns(4).Visible = DtMovimientos.MAX("Serie").ToString <> ""
|
||||
GvDatos.Columns(5).Visible = DtMovimientos.MAX("Lote").ToString <> ""
|
||||
GvDatos.Columns(6).Visible = DtMovimientos.MAX("FechaCaducidad").ToString.ToDate > MinFecha
|
||||
GvDatos.Columns(7).Visible = DtMovimientos.MAX("CveSeccionAlmacen").ToString.ToEntero > 0
|
||||
|
||||
|
||||
GvDatos.DataSource = DtMovimientos
|
||||
GvDatos.DataBind()
|
||||
@@ -541,20 +578,20 @@ Partial Class Inventarios_Apartados
|
||||
e.Row.FCTextBox("TxtCantidad2").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad")))
|
||||
End If
|
||||
|
||||
If If(e.Row.DBCampo("Serie").ToString = "", "-1", e.Row.DBCampo("Serie").ToString) <> "-1" Then
|
||||
TxtnSerieLote.Visible = True
|
||||
ThSerieLote.Visible = True
|
||||
TdSerieLote.Visible = True
|
||||
GvDatos.Columns(4).Visible = True
|
||||
e.Row.Cells(4).Text = e.Row.DBCampo("Serie").ToString
|
||||
Else
|
||||
e.Row.Cells(4).Text = ""
|
||||
End If
|
||||
'If If(e.Row.DBCampo("Serie").ToString = "", "-1", e.Row.DBCampo("Serie").ToString) <> "-1" Then
|
||||
' TxtnSerie.Visible = True
|
||||
' ThSerie.Visible = True
|
||||
' TdSerie.Visible = True
|
||||
' GvDatos.Columns(4).Visible = True
|
||||
' e.Row.Cells(4).Text = e.Row.DBCampo("Serie").ToString
|
||||
'Else
|
||||
' e.Row.Cells(4).Text = ""
|
||||
'End If
|
||||
|
||||
If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then
|
||||
e.Row.FCLinkButton("lnkRemove").Visible = False
|
||||
e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen"
|
||||
End If
|
||||
'If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then
|
||||
' e.Row.FCLinkButton("lnkRemove").Visible = False
|
||||
' e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen"
|
||||
'End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
@@ -593,12 +630,12 @@ Partial Class Inventarios_Apartados
|
||||
Next
|
||||
|
||||
Dim TotalCantidad As Double = DtMovimientos.SUMD("Cantidad")
|
||||
If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
|
||||
If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 1").SUMD("CantidadSeccionAlmacen") Then
|
||||
Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
'If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
|
||||
' If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 1").SUMD("CantidadSeccionAlmacen") Then
|
||||
' Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
'End If
|
||||
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
|
||||
@@ -610,8 +647,8 @@ Partial Class Inventarios_Apartados
|
||||
If Not CargadoDeMov Then
|
||||
|
||||
For Each dr As DataRow In DtMovimientos.Rows
|
||||
Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString))
|
||||
Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND SerieLote = '{dr("SerieLote").ToString}'", "")}")
|
||||
Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString))
|
||||
Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND Serie = '{dr("Serie").ToString}'", "")}")
|
||||
'DtMovimientos.SUM("Cantidad", String.Format("CvePS = {0}", dr("CvePS").ToString.ToEntero))
|
||||
|
||||
If Existencia < 0 Then
|
||||
@@ -623,7 +660,7 @@ Partial Class Inventarios_Apartados
|
||||
Next
|
||||
Else
|
||||
For Each gvr As GridViewRow In GvDatos.Rows
|
||||
Existencia = ObjInventario.GetExistenciasPS(gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Serie:=If(gvr.DataKey("Serie").ToString = "", "-1", gvr.DataKey("Serie").ToString))
|
||||
Existencia = ObjInventario.GetExistenciasPS(gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=gvr.DataKey("CveSeccionAlmacen").ToString.ToEntero, Serie:=If(gvr.DataKey("Serie").ToString = "", "-1", gvr.DataKey("Serie").ToString))
|
||||
Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero
|
||||
If Existencia < 0 Then
|
||||
ErrorExistencia = True
|
||||
@@ -666,7 +703,7 @@ Partial Class Inventarios_Apartados
|
||||
ErrorMovInv = True
|
||||
Else
|
||||
For Each Dr As DataRow In DtMovimientos.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de salida"
|
||||
Exit For
|
||||
@@ -689,8 +726,12 @@ Partial Class Inventarios_Apartados
|
||||
ErrorMovInv = True
|
||||
Else
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
Dim CveSec As Integer = 0
|
||||
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
|
||||
CveSec = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestino.SelectedValue.ToEntero, Dr("CvePS").ToString.ToEntero).FiltroPrimeroValor("CveSeccionAlmacen", "").ToEntero
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSec, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
|
||||
Exit For
|
||||
@@ -771,6 +812,13 @@ Partial Class Inventarios_Apartados
|
||||
Protected Sub GvDatosDesapartado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosDesapartado.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCTextBox("TxtCantidad").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad")))
|
||||
If CBool(e.Row.DBCampo("AplicaSeccion")) AndAlso DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero > 0 Then
|
||||
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True
|
||||
e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero)
|
||||
e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind()
|
||||
e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub BtnVerificarExistenciasDesarmado_Click(sender As Object, e As EventArgs)
|
||||
@@ -789,11 +837,15 @@ Partial Class Inventarios_Apartados
|
||||
Dim DtTemp = GetExistenciasDT()
|
||||
|
||||
If DtTemp IsNot Nothing Then
|
||||
GvDatosDesapartado.Columns(5).Visible = DtTemp.MAX("Serie").ToString <> ""
|
||||
GvDatosDesapartado.Columns(6).Visible = DtTemp.MAX("Lote").ToString <> ""
|
||||
GvDatosDesapartado.Columns(7).Visible = DtTemp.MAX("FechaCaducidad").ToString.ToDate > MinFecha
|
||||
GvDatosDesapartado.Columns(8).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString.ToEntero > 0
|
||||
|
||||
GvDatosDesapartado.DataSource = DtTemp
|
||||
GvDatosDesapartado.DataBind()
|
||||
UpDatosDesapartado.Update()
|
||||
|
||||
DtSeccionAlmacen.Rows.Clear()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -856,12 +908,12 @@ Partial Class Inventarios_Apartados
|
||||
End If
|
||||
Next
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
|
||||
If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 2").SUMD("CantidadSeccionAlmacen") Then
|
||||
Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
'If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then
|
||||
' If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 2").SUMD("CantidadSeccionAlmacen") Then
|
||||
' Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'VALIDA SI HUBO CAMBIOS EN LA EXISTENCIA
|
||||
Dim CantidadGV = GvDatosDesapartado.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("Cantidad").ToDouble)
|
||||
@@ -889,6 +941,7 @@ Partial Class Inventarios_Apartados
|
||||
Observaciones:=TxtObservacionesDesapartado.Text.Trim, Recibio:="", CveAlmacenDestino:=DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero,
|
||||
CveCliente:=CveCliente, CveVendedor:=CveVendedor)
|
||||
FolioSalida = ObjInventario.Folio
|
||||
Dim Diccionario As New HybridDictionary
|
||||
Dim Cont As Integer = 0
|
||||
If CveMovimientoSalida <= 0 Then
|
||||
ErrorMovInv = True
|
||||
@@ -896,10 +949,12 @@ Partial Class Inventarios_Apartados
|
||||
Else
|
||||
For Each Gvr As GridViewRow In GvDatosDesapartado.Rows
|
||||
If Gvr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, -1, Gvr.DataKey("Serie").ToString, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, CveSeccionAlmacen:=Gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Gvr.DataKey("Serie").ToString, Lote:=Gvr.DataKey("Lote").ToString, FechaCaducidad:=Gvr.DataKey("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de salida"
|
||||
Exit For
|
||||
Else
|
||||
Diccionario.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue)
|
||||
End If
|
||||
End If
|
||||
Cont += 1
|
||||
@@ -917,8 +972,11 @@ Partial Class Inventarios_Apartados
|
||||
ErrorMovInv = True
|
||||
Else
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
Dim i As Integer = 0
|
||||
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
|
||||
Dim CveSeccionAlmacen As Integer = Diccionario(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
|
||||
Exit For
|
||||
@@ -955,6 +1013,12 @@ Partial Class Inventarios_Apartados
|
||||
|
||||
ObjInventario.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub DdlAlmacenDestinoDesapartado_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacenDestinoDesapartado.SelectedIndexChanged
|
||||
|
||||
CargaExistencias()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#End Region
|
||||
|
||||
Reference in New Issue
Block a user