-- cambios Series,Lote,Caducidad

This commit is contained in:
rrene
2020-05-15 10:53:15 -07:00
parent cc9cb88c98
commit 1820877bc6
16 changed files with 293 additions and 255 deletions

View File

@@ -54,20 +54,20 @@ Partial Class Inventarios_TraspasoAlmacen
ViewState("CveUsuarioResponsable") = 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 CargadoDeMov As Boolean
@@ -246,7 +246,11 @@ Partial Class Inventarios_TraspasoAlmacen
dt.Columns.Add("CveAF", Type.GetType("System.Int32"))
dt.Columns.Add("PS")
dt.Columns.Add("Observaciones")
dt.Columns.Add("SerieLote")
dt.Columns.Add("CveSeccionAlmacen", Type.GetType("System.Int32"))
dt.Columns.Add("SeccionAlmacen")
dt.Columns.Add("CveSeccionAlmacenDestino", Type.GetType("System.Int32"))
dt.Columns.Add("SeccionAlmacenDestino")
dt.Columns.Add("Serie")
dt.Columns.Add("Lote")
dt.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime"))
@@ -313,7 +317,7 @@ Partial Class Inventarios_TraspasoAlmacen
'End If
If Mov.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
DtMovimientos = Mov.DtResultados.DefaultView.ToTable("Cantidad, CveUM, CvePS, CveAF, PS, SerieLote, CveClasificacion, EstatusExistencia")
DtMovimientos = Mov.DtResultados.DefaultView.ToTable("Cantidad, CveUM, CvePS, CveAF, PS, Serie, CveClasificacion, EstatusExistencia")
CargaGvDatos()
End If
@@ -454,19 +458,7 @@ Partial Class Inventarios_TraspasoAlmacen
End If
End Sub
Protected Sub DdlAlmacenOrigen_SelectedIndexChanged(sender As Object, e As EventArgs)
If UsuarioActual.Empresa.Funcionalidad(141) = "1" Then
CargaExistenciasSucursal()
End If
End Sub
Protected Sub DdlAlmacenDestino_SelectedIndexChanged(sender As Object, e As EventArgs)
If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {DdlAlmacenDestino.SelectedValue.ToEntero}").ToString.ToEntero = 21 Then
ChkTransitorio.Checked = False
ChkTransitorio.Enabled = False
Else
ChkTransitorio.Enabled = True
End If
End Sub
Private Sub CargaExistenciasSucursal()
DdlProducto2.Attributes.Remove("Data-cvesubproyecto")
DdlProducto2.Attributes.Add("Data-cvesubproyecto", GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen = {DdlAlmacenOrigen.SelectedValue}"))
@@ -492,10 +484,10 @@ Partial Class Inventarios_TraspasoAlmacen
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
@@ -515,22 +507,22 @@ Partial Class Inventarios_TraspasoAlmacen
End If
End If
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, -1, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1"), If(TxtnLote.Visible, TxtnLote.Text, "-1"), MinFecha)
Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, DdlSeccionAlmacen.SelectedValue.ToEntero, If(TxtnSerie.Visible, TxtnSerie.Text, "-1"), If(TxtnLote.Visible, TxtnLote.Text, "-1"), If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha))
If Valido Then
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, TxtnObservaciones.Text, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, ""), If(TxtnLote.Visible, TxtnLote.Text, ""), If(TxtnBatch.Visible, TxtnBatch.Text, ""), FuncionalidadSinSerie)
AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, TxtnObservaciones.Text, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(TxtnSerie.Visible, TxtnSerie.Text, ""), Lote:=If(TxtnLote.Visible, TxtnLote.Text, ""), FechaCaducidad:=If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha), Limpia:=FuncionalidadSinSerie)
End If
End If
End Sub
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, SerieLote As String, Lote As String, Fechacaducidad As Date) As Boolean
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, Serie As String, Lote As String, Fechacaducidad As Date) 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"), SerieLote:=SerieLote, Lote:=Lote, FechaCaducidad:=Fechacaducidad, PendientePorSurtir:=1)
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, Lote:=Lote, FechaCaducidad:=Fechacaducidad, PendientePorSurtir:=1)
Inv.Dispose()
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(SerieLote <> "-1", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(Serie <> "-1", $" AND Serie = '{Serie}'", "")}") < 0 Then
If Existencia < 0 Then
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
@@ -543,7 +535,7 @@ Partial Class Inventarios_TraspasoAlmacen
Return Retorno
End Function
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Observaciones As String = "", Optional SerieLote As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True)
Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Observaciones As String = "", Optional CveSeccionAlmacen As Integer = -1, Optional SeccionAlmacen As String = "", Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True)
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')")
@@ -564,7 +556,7 @@ Partial Class Inventarios_TraspasoAlmacen
registro.Item("CvePS") = CvePS
registro.Item("PS") = DrPS("PSCodigo")
registro.Item("Observaciones") = Observaciones
registro.Item("SerieLote") = SerieLote
registro.Item("Serie") = Serie
registro.Item("Lote") = Lote
registro.Item("FechaCaducidad") = FechaCaducidad
registro.Item("CveClasificacion") = CveClasificacion
@@ -591,8 +583,8 @@ Partial Class Inventarios_TraspasoAlmacen
LimpiaAgregar()
Else
txtCantidad.Text = (txtCantidad.Text.ToDouble - 1.0).ToString
TxtnSerieLote.Text = ""
TxtnSerieLote.Focus()
TxtnSerie.Text = ""
TxtnSerie.Focus()
End If
End Sub
@@ -601,10 +593,10 @@ Partial Class Inventarios_TraspasoAlmacen
DdlClasificacion_SelectedIndexChanged(DdlClasificacion, EventArgs.Empty)
txtCantidad.Text = ""
TxtnObservaciones.Text = ""
TxtnSerieLote.Text = ""
TxtnSerieLote.Visible = False
TxtnSerie.Text = ""
TxtnSerie.Visible = False
TxtnLote.Text = ""
TxtnBatch.Text = ""
TxtnFechaCaducidad.Text = ""
txtCantidad.Focus()
If TxtCodigoPS.Visible Then
@@ -692,8 +684,8 @@ Partial Class Inventarios_TraspasoAlmacen
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"), SerieLote:=If(dr("SerieLote").ToString = "", "-1", dr("SerieLote").ToString), PendientePorSurtir:=1)
Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("SerieLote").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"), Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString), PendientePorSurtir:=1)
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
@@ -709,7 +701,7 @@ Partial Class Inventarios_TraspasoAlmacen
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"), SerieLote:=If(gvr.DataKey("SerieLote").ToString = "", "-1", gvr.DataKey("SerieLote").ToString), PendientePorSurtir:=1)
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), PendientePorSurtir:=1)
Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero
If Existencia < 0 Then
ErrorExistencia = True
@@ -772,7 +764,7 @@ Partial Class Inventarios_TraspasoAlmacen
Else
Dim Cont As Integer = 0
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, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
@@ -827,7 +819,7 @@ Partial Class Inventarios_TraspasoAlmacen
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim Cont 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("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then
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, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
@@ -1004,7 +996,7 @@ Partial Class Inventarios_TraspasoAlmacen
Else
For Each Dr As DataRow In DtMovimientos.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
@@ -1123,30 +1115,41 @@ Partial Class Inventarios_TraspasoAlmacen
ElProductoChange()
End Sub
Private Sub ElProductoChange()
TxtnSerieLote.Visible = False
TxtnSerie.Visible = False
TxtnLote.Visible = False
TxtnBatch.Visible = False
TxtnFechaCaducidad.Visible = False
EscondeColumnasGVM(DtMovimientos)
If DdlProducto2.SelectedValue.ToEntero > 0 Then
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltraParametros("Inv_CveMetodoInventario = 5 ", "PS").Rows.Count > 0 Then
ThSerieLote.Visible = True
TdSerieLote.Visible = True
TxtnSerieLote.Visible = True
GvDatos.Columns(5).Visible = True
Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("", "PS")
If drP IsNot Nothing Then
If CBool(drP("AplicaSeccion")) Then
ThSeccionAlmacen.Visible = True
TdSeccionAlmacen.Visible = True
DdlSeccionAlmacen.Visible = True
GvDatos.Columns(5).Visible = True
End If
If CBool(drP("AplicaSerie")) Then
ThSerie.Visible = True
TdSerie.Visible = True
TxtnSerie.Visible = True
GvDatos.Columns(6).Visible = True
End If
If CBool(drP("AplicaLote")) Then
TxtnLote.Visible = True
ThLote.Visible = True
TdLote.Visible = True
GvDatos.Columns(7).Visible = True
End If
If CBool(drP("AplicaCaducidad")) Then
TxtnFechaCaducidad.Visible = True
ThFechaCaducidad.Visible = True
TdFechaCaducidad.Visible = True
GvDatos.Columns(8).Visible = True
End If
End If
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltraParametros("Inv_CveMetodoInventario = 6", "PS").Rows.Count > 0 Then
TxtnLote.Visible = True
ThLote.Visible = True
TdLote.Visible = True
GvDatos.Columns(6).Visible = True
TxtnBatch.Visible = True
ThBatch.Visible = True
TdBatch.Visible = True
GvDatos.Columns(7).Visible = True
End If
End If
DdlUnidad.Items.Clear()
@@ -1190,9 +1193,9 @@ Partial Class Inventarios_TraspasoAlmacen
End Sub
Private Sub EscondeColumnasGVM(DtTemp As DataTable)
TxtnSerieLote.Visible = False
ThSerieLote.Visible = False
TdSerieLote.Visible = False
TxtnSerie.Visible = False
ThSerie.Visible = False
TdSerie.Visible = False
GvDatos.Columns(5).Visible = False
TxtnLote.Visible = False
@@ -1200,15 +1203,15 @@ Partial Class Inventarios_TraspasoAlmacen
TdLote.Visible = False
GvDatos.Columns(6).Visible = False
TxtnBatch.Visible = False
ThBatch.Visible = False
TdBatch.Visible = False
TxtnFechaCaducidad.Visible = False
ThFechaCaducidad.Visible = False
TdFechaCaducidad.Visible = False
GvDatos.Columns(7).Visible = False
If DtTemp.MAX("SerieLote").ToString <> "" Then
TxtnSerieLote.Visible = True
ThSerieLote.Visible = True
TdSerieLote.Visible = True
If DtTemp.MAX("Serie").ToString <> "" Then
TxtnSerie.Visible = True
ThSerie.Visible = True
TdSerie.Visible = True
GvDatos.Columns(5).Visible = True
End If
If DtTemp.MAX("Lote").ToString <> "" Then
@@ -1217,9 +1220,9 @@ Partial Class Inventarios_TraspasoAlmacen
TdLote.Visible = True
GvDatos.Columns(6).Visible = True
TxtnBatch.Visible = True
ThBatch.Visible = True
TdBatch.Visible = True
TxtnFechaCaducidad.Visible = True
ThFechaCaducidad.Visible = True
TdFechaCaducidad.Visible = True
GvDatos.Columns(7).Visible = True
End If
End Sub
@@ -1237,12 +1240,12 @@ Partial Class Inventarios_TraspasoAlmacen
e.Row.FCTextBox("TxtCantidad2").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad")))
End If
'If If(e.Row.DBCampo("SerieLote").ToString = "", "-1", e.Row.DBCampo("SerieLote").ToString) <> "-1" Then
' TxtnSerieLote.Visible = True
' ThSerieLote.Visible = True
' TdSerieLote.Visible = True
'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("SerieLote").ToString
' e.Row.Cells(4).Text = e.Row.DBCampo("Serie").ToString
'Else
' e.Row.Cells(4).Text = ""
'End If
@@ -1301,12 +1304,12 @@ Partial Class Inventarios_TraspasoAlmacen
' Dim CveClasificacion = dr.FCDropDownList("DdlClasificacion").SelectedValue.ToEntero
' Dim CvePS = dr.FCDropDownList("DdlProducto").SelectedValue.ToEntero
' Dim No = dr.DataKey("No").ToEntero
' Dim SerieLote As String = dr.FCTextBox("TxtSerieLote").Text
' Dim Serie As String = dr.FCTextBox("TxtSerie").Text
' 'VALIDA EXISTENCIA
' Dim Valido = True
' Dim Inv As New ClsInventarios
' Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, -1, TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), If(SerieLote = "", "-1", SerieLote))
' Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, -1, TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), If(Serie = "", "-1", Serie))
' Inv.Dispose()
' If Existencia - txtCantidad.Text.ToDouble < 0 Then
@@ -1515,7 +1518,7 @@ Partial Class Inventarios_TraspasoAlmacen
Exit For
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, GvRow.DataKey("CveUM").ToEntero, CvePS, PrecioUnitario, GvRow.DataKey("CveAF").ToEntero, -1, SerieLote:=GvRow.DataKey("SerieLote").ToString, Lote:=GvRow.DataKey("Lote"), FechaCaducidad:=GvRow.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, GvRow.DataKey("CveUM").ToEntero, CvePS, PrecioUnitario, GvRow.DataKey("CveAF").ToEntero, -1, Serie:=GvRow.DataKey("Serie").ToString, Lote:=GvRow.DataKey("Lote"), FechaCaducidad:=GvRow.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For
@@ -1692,7 +1695,7 @@ Partial Class Inventarios_TraspasoAlmacen
Exit For
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("PU").ToString.ToDecimal, gvr.DataKey("CveAF").ToString.ToEntero, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada, SerieLote:=gvr.DataKey("SerieLote").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("PU").ToString.ToDecimal, gvr.DataKey("CveAF").ToString.ToEntero, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For
@@ -1787,7 +1790,7 @@ Partial Class Inventarios_TraspasoAlmacen
' CostoIndirecto = ((Dr("Total").ToString.ToDouble * GastoIndirectoTotal) / Importe) / Dr("Cantidad").ToString.ToDouble
' End If
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CostoIndirecto:=CostoIndirecto) Then
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("Serie").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CostoIndirecto:=CostoIndirecto) Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al guardar los movimientos de entrada"
' Exit For
@@ -1910,8 +1913,8 @@ Partial Class Inventarios_TraspasoAlmacen
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
@@ -1927,10 +1930,10 @@ Partial Class Inventarios_TraspasoAlmacen
txtCantidad.Text = "1"
Dim Valido = ValidaExistencia(1, CvePSSerieLote, CveUMSerieLote, -1, TxtSeriePS.Text.Trim, "-1", MinFecha)
Dim Valido = ValidaExistencia(1, CvePSSerie, CveUMSerie, -1, TxtSeriePS.Text.Trim, "-1", MinFecha)
If Valido Then
AgregarPS(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim)
AgregarPS(1, CvePSSerie, CveUMSerie, TxtSeriePS.Text.Trim)
Else
TxtSeriePS.Text = ""
TxtSeriePS.Focus()
@@ -1960,7 +1963,7 @@ Partial Class Inventarios_TraspasoAlmacen
Dim TxtCantidad = GvDatosRecepcion.Rows(Gvr.RowIndex).FCTextBox("TxtCantidad")
If Gvr.DataKey("Cantidad").ToDecimal - TxtCantidad.Text.ToDecimal - 1 >= 0 Then
If Gvr.DataKey("AplicaSerieLote") = "True" Then
If Gvr.DataKey("AplicaSerie") = "True" Then
TdSeriePSRecepcion.Visible = True
TxtSeriePSRecepcion.Focus()
Exit Sub
@@ -1996,7 +1999,7 @@ Partial Class Inventarios_TraspasoAlmacen
End If
For Each Gvr As GridViewRow In GvDatosRecepcion.Rows
If Gvr.DataKey("CodigoBarras") = TxtCodigoPSRecepcion.Text.Trim And Gvr.DataKey("SerieLote") = TxtSeriePSRecepcion.Text.Trim Then
If Gvr.DataKey("CodigoBarras") = TxtCodigoPSRecepcion.Text.Trim And Gvr.DataKey("Serie") = TxtSeriePSRecepcion.Text.Trim Then
Dim TxtCantidad = GvDatosRecepcion.Rows(Gvr.RowIndex).FCTextBox("TxtCantidad")
If Gvr.DataKey("Cantidad").ToDecimal - TxtCantidad.Text.ToDecimal - 1 >= 0 Then
@@ -2489,7 +2492,7 @@ Partial Class Inventarios_TraspasoAlmacen
DtExcel.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
DtExcel.Columns.Add(New DataColumn("Codigo", GetType(String)))
DtExcel.Columns.Add(New DataColumn("Producto", GetType(String)))
DtExcel.Columns.Add(New DataColumn("SerieLote", GetType(String)))
DtExcel.Columns.Add(New DataColumn("Serie", GetType(String)))
DtExcel.Columns.Add(New DataColumn("Observaciones", GetType(String)))
DtExcel.TableName = "Traspaso"
@@ -2544,8 +2547,8 @@ Partial Class Inventarios_TraspasoAlmacen
Alert("El nombre de la tercera columna debe ser 'Producto'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(3).ColumnName = "SerieLote" Then
Alert("El nombre de la cuarta columna debe ser 'SerieLote'. Favor de corregirlo", TipoMensaje.MsgError)
If Not dt.Columns(3).ColumnName = "Serie" Then
Alert("El nombre de la cuarta columna debe ser 'Serie'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(4).ColumnName = "Observaciones" Then
@@ -2557,7 +2560,7 @@ Partial Class Inventarios_TraspasoAlmacen
Dim ProductosNoCargados As New StringBuilder()
Dim RowsCargados As Integer = 0
Dim RowsNoCargados As Integer = 0
Dim NoPSConSerieLote As Integer = 0
Dim NoPSConSerie As Integer = 0
Try
Dim DtPS As DataTable = GlobalDTPS(UsuarioActual.CveEmpresa)
For Each RowExcel As DataRow In dt.Rows
@@ -2570,7 +2573,7 @@ Partial Class Inventarios_TraspasoAlmacen
Dim CveUnidadMedida As Integer = RowPS("CveUnidadMedida").ToString().ToEntero()
Dim Cantidad As Double = RowExcel("Cantidad").ToString().ToDecimal()
Dim SerieLote As String = RowExcel("SerieLote").ToString()
Dim Serie As String = RowExcel("Serie").ToString()
Dim Observaciones As String = RowExcel("Observaciones").ToString()
Dim FechaCaducidad As Date = MinFecha
Dim Lote As String = "-1"
@@ -2581,14 +2584,14 @@ Partial Class Inventarios_TraspasoAlmacen
Dim CveMetodoInventario As Integer = RowPS("Inv_CveMetodoInventario").ToString().ToEntero()
If CveMetodoInventario = 5 And (String.IsNullOrEmpty(SerieLote.Trim()) OrElse SerieLote = "-1") Then
If CveMetodoInventario = 5 And (String.IsNullOrEmpty(Serie.Trim()) OrElse Serie = "-1") Then
Valido = False
Alert($"El producto '{RowPS("PS")}' requiere 'SerieLote'", TipoMensaje.MsgAdvertencia)
Alert($"El producto '{RowPS("PS")}' requiere 'Serie'", TipoMensaje.MsgAdvertencia)
ProductosNoCargados.AppendFormat("{0},", RowPS("PS").ToString())
End If
If CveMetodoInventario = 5 AndAlso Not String.IsNullOrEmpty(SerieLote.Trim()) Then
NoPSConSerieLote = NoPSConSerieLote + 1
If CveMetodoInventario = 5 AndAlso Not String.IsNullOrEmpty(Serie.Trim()) Then
NoPSConSerie = NoPSConSerie + 1
End If
If Valido AndAlso (Cantidad > 0 AndAlso RowPS("VentaMinima").ToString.ToDecimal > 0) Then
@@ -2599,11 +2602,11 @@ Partial Class Inventarios_TraspasoAlmacen
End If
If Valido Then
Valido = ValidaExistencia(Cantidad, CveProducto, CveUnidadMedida, -1, If(Not String.IsNullOrEmpty(SerieLote), SerieLote, "-1"), Lote, FechaCaducidad)
Valido = ValidaExistencia(Cantidad, CveProducto, CveUnidadMedida, -1, If(Not String.IsNullOrEmpty(Serie), Serie, "-1"), Lote, FechaCaducidad)
End If
If Valido Then
AgregarPS(Cantidad, CveProducto, CveUnidadMedida, Observaciones, If(Not String.IsNullOrEmpty(SerieLote), SerieLote, ""), "", "", False)
AgregarPS(Cantidad, CveProducto, CveUnidadMedida, Observaciones, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(Not String.IsNullOrEmpty(Serie), Serie, ""), Limpia:=False)
RowsCargados = RowsCargados + 1
Else
RowsNoCargados = RowsNoCargados + 1
@@ -2620,10 +2623,10 @@ Partial Class Inventarios_TraspasoAlmacen
OnError("Ocurrió un error al cargar los productos." & ProductosNoCargados.ToString(), ex)
Finally
If NoPSConSerieLote > 0 Then
ThSerieLote.Visible = True
TdSerieLote.Visible = True
TxtnSerieLote.Visible = True
If NoPSConSerie > 0 Then
ThSerie.Visible = True
TdSerie.Visible = True
TxtnSerie.Visible = True
GvDatos.Columns(5).Visible = True
End If
@@ -2726,4 +2729,32 @@ Partial Class Inventarios_TraspasoAlmacen
TxtEspecifUnidad.Text = DtCamiones.FiltroPrimeroValor("Especificacion", String.Format("CveCamion = {0}", DdlUnidadCamion.SelectedValue))
End If
End Sub
Protected Sub DdlAlmacenOrigen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacenOrigen.SelectedIndexChanged
If UsuarioActual.Empresa.Funcionalidad(141) = "1" Then
CargaExistenciasSucursal()
End If
If DdlAlmacenOrigen.SelectedValue.ToEntero > 0 Then
DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero)
DdlSeccionAlmacen.DataBind()
DdlSeccionAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpDatos.Update()
End If
End Sub
Protected Sub DdlAlmacenDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacenDestino.SelectedIndexChanged
If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {DdlAlmacenDestino.SelectedValue.ToEntero}").ToString.ToEntero = 21 Then
ChkTransitorio.Checked = False
ChkTransitorio.Enabled = False
Else
ChkTransitorio.Enabled = True
End If
If DdlAlmacenDestino.SelectedValue.ToEntero > 0 Then
DdlSeccionAlmacenDestino.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestino.SelectedValue.ToEntero)
DdlSeccionAlmacenDestino.DataBind()
DdlSeccionAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpDatos.Update()
End If
End Sub
End Class