Nueva funcionalidad de existencias en inventario
This commit is contained in:
@@ -34,6 +34,14 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
ViewState("DtDatosDetalle") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtDatosSugerencias As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtDatosSugerencias"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatosSugerencias") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtDatosDetalleLote As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtDatosDetalleLote"), DataTable)
|
||||
@@ -287,6 +295,9 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
CveVendedor = -1
|
||||
CveCliente = -1
|
||||
CveSubProyecto = -1
|
||||
|
||||
DtDatosSugerencias = New DataTable
|
||||
|
||||
Dim StrAlmacenes As String = "CveTipoAlmacen IN (1,2)"
|
||||
|
||||
If (UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1") Then
|
||||
@@ -621,6 +632,30 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen)
|
||||
End If
|
||||
|
||||
DtDatos.Columns.Add("AplicaSeccion", GetType(Boolean))
|
||||
DtDatos.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
DtDatos.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
DtDatos.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
If Not DtDatos.Columns.Contains("Lote") Then
|
||||
DtDatos.Columns.Add("Lote", GetType(String))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("CveSeccion") Then
|
||||
DtDatos.Columns.Add("CveSeccion", GetType(Integer))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("Caducidad") Then
|
||||
DtDatos.Columns.Add("Caducidad", GetType(Date))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("Seleccionado") Then
|
||||
DtDatos.Columns.Add("Seleccionado", GetType(Boolean))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("CantidadSeleccionada") Then
|
||||
DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double))
|
||||
End If
|
||||
|
||||
For Each Dr As DataRow In DtDatos.Rows
|
||||
Dr("Caducidad") = Now
|
||||
Next
|
||||
|
||||
'TxtFecha.Text = If(EsDevolucionVenta = 1, Now.ToShortDateString, DtDatos.Rows(0)("Fecha").ToString)
|
||||
End If
|
||||
|
||||
@@ -775,6 +810,23 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Private Sub CargaGvDatos()
|
||||
|
||||
If DtDatos IsNot Nothing Then
|
||||
|
||||
For Each item As DataRow In DtDatos.Rows
|
||||
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, item("CvePS").ToString.ToEntero).FiltroPrimero("")
|
||||
If Dr IsNot Nothing Then
|
||||
item("AplicaSeccion") = CBool(Dr("AplicaSeccion"))
|
||||
If CBool(Dr("AplicaSeccion")) Then GvDatos.Columns(9).Visible = True
|
||||
item("AplicaSerie") = CBool(Dr("AplicaSerie"))
|
||||
item("AplicaLote") = CBool(Dr("AplicaLote"))
|
||||
If CBool(Dr("AplicaLote")) Then GvDatos.Columns(10).Visible = True
|
||||
item("AplicaCaducidad") = CBool(Dr("AplicaCaducidad"))
|
||||
If CBool(Dr("AplicaCaducidad")) Then GvDatos.Columns(11).Visible = True
|
||||
If CBool(Dr("AplicaSeccion")) Or CBool(Dr("AplicaLote")) Or CBool(Dr("AplicaCaducidad")) Or CBool(Dr("AplicaSerie")) Then
|
||||
GvDatos.Columns(12).Visible = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
GvDatos.DataSource = DtDatos
|
||||
End If
|
||||
|
||||
@@ -802,7 +854,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DBCampo("Inv_CveMetodoInventario").Contiene("5", "6") Then
|
||||
If CBool(e.Row.DBCampo("AplicaSerie")) Then
|
||||
e.Row.FCButton("BtnSerieLote").Visible = True
|
||||
e.Row.FCButton("BtnSerieLote").Text = If(e.Row.DBCampo("Inv_CveMetodoInventario").ToString = "5", "SerieLote", "Lote-Batch")
|
||||
e.Row.FCButton("BtnSerieLote").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"), e.Row.DBCampo("Inv_CveMetodoInventario"))
|
||||
@@ -829,6 +881,32 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
|
||||
|
||||
If CBool(e.Row.DBCampo("AplicaSeccion")) Then
|
||||
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True
|
||||
Else
|
||||
e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False
|
||||
End If
|
||||
|
||||
If CBool(e.Row.DBCampo("AplicaCaducidad")) Then
|
||||
e.Row.FCTextBox("TxtCaducidad").Visible = True
|
||||
e.Row.FCLinkButton("LnkCaducidad").Visible = True
|
||||
e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString
|
||||
Else
|
||||
e.Row.FCTextBox("TxtCaducidad").Visible = False
|
||||
e.Row.FCLinkButton("LnkCaducidad").Visible = False
|
||||
End If
|
||||
|
||||
If CBool(e.Row.DBCampo("AplicaLote")) Then
|
||||
e.Row.FCTextBox("TxtLote").Visible = True
|
||||
Else
|
||||
e.Row.FCTextBox("TxtLote").Visible = False
|
||||
End If
|
||||
|
||||
e.Row.FCButton("BtnDividir").Attributes.Add("onclick", String.Format("Dividir('{0}');", e.Row.FCTextBox("TxtDividir").ClientID))
|
||||
e.Row.FCButton("BtnDividir").CommandArgument = e.Row.RowIndex.ToString
|
||||
e.Row.FCTextBox("TxtDividir").Attributes.Add("onkeyup", String.Format("LimitaCantidad({0},this,'{1}');", e.Row.DBCampo("CantidadF"), e.Row.FCButton("BtnDividir").ClientID))
|
||||
|
||||
|
||||
'FUNCIONALIDAD PISTOLA DE CODIGOS
|
||||
If UsuarioActual.Empresa.Funcionalidad(132) = "1" And e.Row.DBCampo("CodigoBarras").Trim <> "" Then
|
||||
'NO BLOQUEA PARA ROL AD
|
||||
@@ -1562,6 +1640,9 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
For Each gvr As GridViewRow In GvDatos.Rows
|
||||
If gvr.FCCheckBox("cbInv").Checked AndAlso gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then
|
||||
DtDatos.Rows(Index)("CantidadGV") = gvr.FCTextBox("TbCantidadF").Text.ToDecimal
|
||||
DtDatos.Rows(Index)("CveSeccion") = gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero
|
||||
DtDatos.Rows(Index)("Caducidad") = gvr.FCTextBox("TxtCaducidad").Text.ToDate
|
||||
DtDatos.Rows(Index)("Lote") = gvr.FCTextBox("TxtLote").Text
|
||||
End If
|
||||
Index += 1
|
||||
Next
|
||||
@@ -1610,10 +1691,10 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
StrXML.Append("<conceptos>")
|
||||
For Each Dr As DataRow In DtDatos.Rows
|
||||
If Dr("CantidadGV").ToString.ToDecimal > 0 Then
|
||||
If Dr("Inv_CveMetodoInventario").ToString = "5" Then
|
||||
If CBool(Dr("AplicaSeccion")) Then
|
||||
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" Serie=""{3}"" ></concepto>", Dr1("CvePS"), Dr1("CveUM"), 1, Dr1("SerieLote"))
|
||||
StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" Serie=""{3}"" Lote=""{4}"" CveSeccion=""{5}"" Caducidad=""{6}"" ></concepto>", Dr1("CvePS"), Dr1("CveUM"), 1, Dr1("SerieLote"), If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1), If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha))
|
||||
Next
|
||||
ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then
|
||||
DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
@@ -1621,7 +1702,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" Serie=""{3}"" ></concepto>", Dr1("CvePS"), Dr1("CveUM"), DtDatosDetalleLote.SUM("Cantidad", $"Lote = '{Dr1("Lote").ToString}' AND Batch = '{Dr1("Batch").ToString}'"), Dr1("Lote"))
|
||||
Next
|
||||
Else
|
||||
StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" Serie=""{3}"" ></concepto>", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), "-1")
|
||||
StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" Serie=""{3}"" Lote=""{4}"" CveSeccion=""{5}"" Caducidad=""{6}"" ></concepto>", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), "-1", If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1), If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
@@ -1668,11 +1749,11 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
For Each Dr As DataRow In DtDatos.Rows
|
||||
If Dr("CantidadGV").ToString.ToDecimal > 0 Then
|
||||
|
||||
If Dr("Inv_CveMetodoInventario").ToString = "5" Then
|
||||
If CBool(Dr("AplicaSeccion")) Then
|
||||
|
||||
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=Dr1("SerieLote").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1) Then
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=Dr1("SerieLote").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
For Each Dr2 As DataRow In ObjInventario.DtResultados.FiltraParametros("CveAlmacen > 0 AND ExistenciaFinal > 0").Rows
|
||||
|
||||
'BUSCA SI EXISTE YA UN TRASPASO DEL ALMACEN DE APARTADO
|
||||
@@ -1701,7 +1782,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
CantidadPendiente = 1
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1720,7 +1801,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1) Then
|
||||
If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
|
||||
CantidadSaldo = Dr("CantidadGV").ToString.ToDecimal
|
||||
|
||||
@@ -1751,7 +1832,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
CantidadPendiente = If(Dr1("Cantidad").ToString.ToDecimal > CantidadSaldo, CantidadSaldo, Dr1("Cantidad").ToString.ToDecimal)
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1769,7 +1850,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
Else
|
||||
|
||||
If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1) Then
|
||||
If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
|
||||
CantidadSaldo = Dr("CantidadGV").ToString.ToDecimal
|
||||
|
||||
@@ -1801,7 +1882,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
CantidadPendiente = If(Dr1("ExistenciaFinal").ToString.ToDecimal > CantidadSaldo, CantidadSaldo, Dr1("ExistenciaFinal").ToString.ToDecimal)
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1844,7 +1925,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, SerieLote:=Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1942,7 +2023,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, SerieLote:=Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1972,7 +2053,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1984,7 +2065,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1995,7 +2076,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -2806,7 +2887,92 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "DIVIDIR"
|
||||
|
||||
Protected Sub Dividir(sender As Object, e As EventArgs)
|
||||
Dim index2 As Integer = 0
|
||||
|
||||
For Each Row As DataRow In DtDatos.Rows
|
||||
Row("Seleccionado") = GvDatos.Rows(index2).FCCheckBox("cbInv").Checked
|
||||
If GvDatos.Rows(index2).FCTextBox("TbCantidadF").Text <> "" Then
|
||||
Row("CantidadSeleccionada") = GvDatos.Rows(index2).FCTextBox("TbCantidadF").Text
|
||||
End If
|
||||
If GvDatos.Rows(index2).FCTextBox("TxtLote").Text <> "" Then
|
||||
Row("Lote") = GvDatos.Rows(index2).FCTextBox("TxtLote").Text
|
||||
End If
|
||||
If GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue <> "-1" Then
|
||||
Row("CveSeccion") = GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero
|
||||
End If
|
||||
If GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text <> "" Then
|
||||
Row("Caducidad") = GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text.ToDate
|
||||
End If
|
||||
index2 += 1
|
||||
Next
|
||||
DtDatos.AcceptChanges()
|
||||
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, Button)).NamingContainer, GridViewRow)
|
||||
Dim Index As Integer = gvRow.RowIndex
|
||||
Dim Cantidad As String = HdnCantidadMovimiento.Value
|
||||
Dim dr1 As DataRow = DtDatos.Rows(Index)
|
||||
Dim dr As DataRow = DtDatos.NewRow
|
||||
dr.ItemArray = dr1.ItemArray
|
||||
dr1("CantidadC") = (dr1("CantidadC").ToString.ToDouble - Cantidad.ToDouble)
|
||||
Dim CantidadFOriginal As Double = dr1("CantidadF").ToString.ToDouble
|
||||
dr1("CantidadF") = (dr1("CantidadF").ToString.ToDouble - Cantidad.ToDouble)
|
||||
Dim CantidadSOriginal As Double = dr1("CantidadS").ToString.ToDouble
|
||||
dr1("CantidadS") = (CantidadSOriginal * dr1("CantidadF").ToString.ToDouble) / CantidadFOriginal
|
||||
Dim CantidadSeleccionadaOriginal As Double = dr1("CantidadSeleccionada").ToString.ToDouble
|
||||
dr1("CantidadSeleccionada") = If(CantidadSeleccionadaOriginal > dr1("CantidadF").ToString.ToDouble, dr1("CantidadF").ToString.ToDouble, CantidadSeleccionadaOriginal)
|
||||
CantidadSeleccionadaOriginal = CantidadSeleccionadaOriginal - dr1("CantidadF").ToString.ToDouble
|
||||
|
||||
'Dim CostoIndirectoOriginal As Double = dr1("CostoIndirecto").ToString.ToDouble
|
||||
'dr1("CostoIndirecto") = (CostoIndirectoOriginal * dr1("CantidadF").ToString.ToDouble) / CantidadFOriginal
|
||||
'Dim CostoIndirectoExtranjeroOriginal As Double = dr1("CostoIndirectoExtranjero").ToString.ToDouble
|
||||
'dr1("CostoIndirectoExtranjero") = (CostoIndirectoExtranjeroOriginal * dr1("CantidadF").ToString.ToDouble) / CantidadFOriginal
|
||||
|
||||
DtDatos.AcceptChanges()
|
||||
|
||||
dr("CantidadC") = Cantidad.ToDouble
|
||||
dr("CantidadF") = Cantidad.ToDouble
|
||||
dr("CantidadS") = (CantidadSOriginal * dr("CantidadF").ToString.ToDouble) / CantidadFOriginal
|
||||
dr("CantidadSeleccionada") = If(CantidadSeleccionadaOriginal > 0, CantidadSeleccionadaOriginal, 0)
|
||||
dr("Seleccionado") = If(CantidadSeleccionadaOriginal > 0, True, False)
|
||||
'dr("CostoIndirecto") = (CostoIndirectoOriginal * dr("CantidadF").ToString.ToDouble) / CantidadFOriginal
|
||||
'dr("CostoIndirectoExtranjero") = (CostoIndirectoExtranjeroOriginal * dr("CantidadF").ToString.ToDouble) / CantidadFOriginal
|
||||
DtDatos.Rows.InsertAt(dr, Index)
|
||||
DtDatos.AcceptChanges()
|
||||
|
||||
index2 = 1
|
||||
For Each Row As DataRow In DtDatos.Rows
|
||||
Row("Consec") = index2
|
||||
index2 += 1
|
||||
Next
|
||||
DtDatos.AcceptChanges()
|
||||
|
||||
CargaGvDatos()
|
||||
|
||||
index2 = 0
|
||||
For Each Row As DataRow In DtDatos.Rows
|
||||
GvDatos.Rows(index2).FCCheckBox("cbInv").Checked = CBool(Row("Seleccionado"))
|
||||
If Row("CantidadSeleccionada").ToString <> "" Then
|
||||
GvDatos.Rows(index2).FCTextBox("TbCantidadF").Text = Row("CantidadSeleccionada").ToString
|
||||
End If
|
||||
If Row("Lote").ToString <> "" Then
|
||||
GvDatos.Rows(index2).FCTextBox("TxtLote").Text = Row("Lote").ToString
|
||||
End If
|
||||
If Row("CveSeccion").ToString <> "" Then
|
||||
GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue = Row("CveSeccion").ToString
|
||||
End If
|
||||
If Row("Caducidad").ToString <> "" Then
|
||||
GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text = Row("Caducidad").ToString.ToDate.ToShortDateString
|
||||
End If
|
||||
index2 += 1
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " GUIAS - SABE QUE ES PORQUE NO VEO QUE SE UTILIZE EN ALGUNA PARTE - EN MIRAS DE ELIMINAR - IPP 24 AGOSTO 2017 "
|
||||
Private Sub BtnNumeroGuia_Click(sender As Object, e As EventArgs) Handles BtnNumeroGuia.Click
|
||||
@@ -2844,6 +3010,86 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "SUGERENCIAS"
|
||||
|
||||
Protected Sub BtnVerSugerencias_Click(sender As Object, e As EventArgs)
|
||||
If Not CveVentaSurtir > 0 Then
|
||||
Alert("Tiene que seleccionar la venta a surtir", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not DdlAlmacen.SelectedValue.ToEntero > 0 Then
|
||||
Alert("Tiene que seleccionar el almacen", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim ObjInv As New ClsInventarios
|
||||
If ObjInv.GetSugerenciasSalidaAlmacen(CveVentaSurtir, DdlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
GvSugerencias.DataSource = ObjInv.DtResultados
|
||||
|
||||
|
||||
DtDatosSugerencias = ObjInv.DtResultados
|
||||
|
||||
DtDatos.Columns.Add("Consec", GetType(Integer))
|
||||
DtDatos.Columns.Add("CantidadGV", GetType(Double))
|
||||
DtDatos.Columns.Add("CantidadTraspaso", GetType(Double))
|
||||
DtDatos.Columns.Add("AplicaSeccion", GetType(Boolean))
|
||||
DtDatos.Columns.Add("AplicaSerie", GetType(Boolean))
|
||||
DtDatos.Columns.Add("AplicaLote", GetType(Boolean))
|
||||
DtDatos.Columns.Add("AplicaCaducidad", GetType(Boolean))
|
||||
If Not DtDatos.Columns.Contains("Lote") Then
|
||||
DtDatos.Columns.Add("Lote", GetType(String))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("CveSeccion") Then
|
||||
DtDatos.Columns.Add("CveSeccion", GetType(Integer))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("Caducidad") Then
|
||||
DtDatos.Columns.Add("Caducidad", GetType(Date))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("Seleccionado") Then
|
||||
DtDatos.Columns.Add("Seleccionado", GetType(Boolean))
|
||||
End If
|
||||
If Not DtDatos.Columns.Contains("CantidadSeleccionada") Then
|
||||
DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double))
|
||||
End If
|
||||
|
||||
Dim Index = 1
|
||||
For Each Dr As DataRow In DtDatosSugerencias.Rows
|
||||
Dr("Consec") = Index
|
||||
Dr("Caducidad") = Now
|
||||
Index += 1
|
||||
Next
|
||||
|
||||
DtDatosSugerencias.AcceptChanges()
|
||||
|
||||
|
||||
End If
|
||||
ObjInv.Dispose()
|
||||
GvSugerencias.DataBind()
|
||||
|
||||
UpVerSugerencias.Update()
|
||||
|
||||
RegistraScript("$('#ModalVerSugerencias').modal()")
|
||||
End Sub
|
||||
Protected Sub BtnAplicarSugerencias_Click(sender As Object, e As EventArgs)
|
||||
|
||||
DtDatos = Nothing
|
||||
DtDatos = New DataTable
|
||||
DtDatos = DtDatosSugerencias
|
||||
|
||||
DtDatosDetalle = Nothing
|
||||
CreaDtDetalle()
|
||||
|
||||
DtDatosDetalleLote = Nothing
|
||||
CreaDtDetalleLote()
|
||||
|
||||
CargaGvDatos()
|
||||
|
||||
RegistraScript("$('#ModalVerSugerencias').modal('hide')")
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user