From 35f5d5cd30219ebc3f866f41ef847bd5d5c6d698 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 7 Apr 2020 10:38:27 -0700 Subject: [PATCH 1/3] -pu decimal --- OS/OrdenesServicios.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb index 9737cf675..647fd13a9 100644 --- a/OS/OrdenesServicios.aspx.vb +++ b/OS/OrdenesServicios.aspx.vb @@ -2362,7 +2362,7 @@ Partial Class OS_OrdenesServicios If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then 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.ToDouble, -1, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then TieneError = True TextoError = "Ocurrió un error al guardar los movimientos de entrada" Exit For @@ -2389,7 +2389,7 @@ Partial Class OS_OrdenesServicios If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada2, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, -1, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada2, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, -1) Then TieneError = True TextoError = "Ocurrió un error al guardar los movimientos de entrada" Exit For From b0286482068cc76f137a00904ecb93c97c69852b Mon Sep 17 00:00:00 2001 From: Raul Pimienta Date: Tue, 7 Apr 2020 13:48:20 -0700 Subject: [PATCH 2/3] Nueva funcionalidad de existencias en inventario --- App_Code/ClsInventarios.vb | 25 ++- Inventarios/RecepcionAlmacen.aspx | 63 +++++- Inventarios/RecepcionAlmacen.aspx.vb | 274 +++++++++++++++++++++----- Inventarios/RecepcionEntrega.aspx | 95 +++++++++ Inventarios/RecepcionEntrega.aspx.vb | 278 +++++++++++++++++++++++++-- 5 files changed, 657 insertions(+), 78 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 4cacc834a..1e43dbd34 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1817,7 +1817,7 @@ Public Class ClsInventarios CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional CveTipoAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional FechaMovto As String = "-1", Optional SerieLote As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, Optional Lote As String = "-1", Optional Batch As String = "-1", - Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1) As Boolean + Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1, Optional Caducidad As Date = MinFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_ExistenciasGet") @@ -1839,6 +1839,7 @@ Public Class ClsInventarios .Add("@PendientePorSurtir", SqlDbType.Int).Value = PendientePorSurtir .Add("@ExcluyeApartados", SqlDbType.Int).Value = ExcluyeApartados .Add("@RestringirAlmacenes", SqlDbType.Int).Value = RestringirAlmacenes + .Add("@Caducidad", SqlDbType.Date).Value = Caducidad .Add("@Existencia", SqlDbType.Money).Direction = ParameterDirection.Output End With Try @@ -4922,6 +4923,28 @@ Public Class ClsInventarios Return Retorno End Function + +#Region "SUGERENCIAS SALIDA DE ALMACEN" + + Public Function GetSugerenciasSalidaAlmacen(CveVenta As Integer, CveAlmacen As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Inv_SugerenciasSalidasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las sugerencias para la salida de almacen.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + +#End Region + #Region " IDisposable Support " ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/Inventarios/RecepcionAlmacen.aspx b/Inventarios/RecepcionAlmacen.aspx index 0c9fa6b71..8d742140e 100644 --- a/Inventarios/RecepcionAlmacen.aspx +++ b/Inventarios/RecepcionAlmacen.aspx @@ -167,7 +167,7 @@ Almacén:
- +
@@ -418,7 +418,7 @@ + DataKeyNames="EntregaDirecta,Consec,CodigoBarras,CvePS,CveUM,PU,CantidadC,CantidadF,UM,PS,CveCompraDetalle,CveOrdenCompraDetalle,PUExtranjero,AplicaSerieLote,CveClasificacion,Codigo,CveVentaDetalle,CostoIndirecto,CveTamaño,Lote" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None"> @@ -445,11 +445,30 @@ - + + + + + + + + +
+ + + + + + + + +
+
+
@@ -463,6 +482,13 @@ + + + + + +
@@ -568,7 +594,7 @@ - + @@ -685,13 +711,13 @@ - +
- + @@ -705,8 +731,8 @@
- @@ -1135,7 +1161,28 @@ $("#DivCantidadEspecial").show(200); } + function Dividir(t) { + $get("HdnCantidadMovimiento").value = $get(t).value; + } + function LimitaCantidad(C, textbox, button) { + + // var contenedor = $(textbox).parent().find("#" + buttonIdDiv); + + if (ToDouble(textbox.value) >= C) { + textbox.value = ""; + } + + if (parseFloat(textbox.value) > 0) { + $get(button).style.display = ""; + //$(contenedor).show(); + } + else { + $get(button).style.display = "none"; + //$(contenedor).hide(); + + } + } diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 161b1714c..74dcd9aed 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -476,7 +476,22 @@ Partial Class Inventarios_RecepcionAlmacen DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) UpGenerales.Update() + End Sub + + Protected Sub DdlAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs) + If DdlAlmacen.SelectedValue <> "-1" Then + For Each Gvr As GridViewRow In GvInv.Rows + If Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue = "-1" Then + Dim Dr As DataRow = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero($"CveAlmacen = {DdlAlmacen.SelectedValue}") + If Dr IsNot Nothing Then + Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValueExist(Dr("CveSeccion")) + End If + End If + Next + UPInv.Update() + End If End Sub + Private Sub ConfiguraTipoRecepcion() DdlTipo.Items.Insert(0, New ListItem("Compra", "1")) @@ -1095,9 +1110,29 @@ Partial Class Inventarios_RecepcionAlmacen TmDT.Columns.Add("CostoIndirectoExtranjero", GetType(Double)) TmDT.Columns.Add("Consec", GetType(Integer)) TmDT.Columns.Add("CantidadSurtidaPantalla", GetType(Double)) + TmDT.Columns.Add("AplicaSeccion", GetType(Boolean)) + TmDT.Columns.Add("AplicaSerie", GetType(Boolean)) + TmDT.Columns.Add("AplicaLote", GetType(Boolean)) + TmDT.Columns.Add("AplicaCaducidad", GetType(Boolean)) If Not TmDT.Columns.Contains("CostoIndirecto") Then TmDT.Columns.Add("CostoIndirecto", GetType(Double)) End If + If Not TmDT.Columns.Contains("Lote") Then + TmDT.Columns.Add("Lote", GetType(String)) + End If + If Not TmDT.Columns.Contains("CveSeccion") Then + TmDT.Columns.Add("CveSeccion", GetType(Integer)) + End If + If Not TmDT.Columns.Contains("Caducidad") Then + TmDT.Columns.Add("Caducidad", GetType(Date)) + End If + If Not TmDT.Columns.Contains("Seleccionado") Then + TmDT.Columns.Add("Seleccionado", GetType(Boolean)) + End If + If Not TmDT.Columns.Contains("CantidadSeleccionada") Then + TmDT.Columns.Add("CantidadSeleccionada", GetType(Double)) + End If + GvInv.Columns(2).Visible = False GvInv.Columns(3).Visible = False @@ -1116,6 +1151,7 @@ Partial Class Inventarios_RecepcionAlmacen If Dr(VariableCampo).ToString.ToDecimal <> Dr("CantidadC").ToString.ToDecimal Then GvInv.Columns(3).Visible = True End If + Dr("Caducidad") = Now Next DtInv = TmDT '.FiltraParametros("CantidadF > 0") @@ -1129,34 +1165,53 @@ Partial Class Inventarios_RecepcionAlmacen If UsuarioActual.CveEmpresa = 119 Then DtInv = DtInv.FiltraParametros("", "PS") End If + + For Each item As DataRow In DtInv.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 GvInv.Columns(10).Visible = True + item("AplicaSerie") = CBool(Dr("AplicaSerie")) + item("AplicaLote") = CBool(Dr("AplicaLote")) + If CBool(Dr("AplicaLote")) Then GvInv.Columns(11).Visible = True + item("AplicaCaducidad") = CBool(Dr("AplicaCaducidad")) + If CBool(Dr("AplicaCaducidad")) Then GvInv.Columns(12).Visible = True + If CBool(Dr("AplicaSeccion")) Or CBool(Dr("AplicaLote")) Or CBool(Dr("AplicaCaducidad")) Or CBool(Dr("AplicaSerie")) Then + GvInv.Columns(15).Visible = True + End If + End If + Next + GvInv.DataSource = DtInv GvInv.DataBind() UPInv.Update() End Sub Protected Sub GVINV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvInv.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DBCampo("CveMetodoInventario").ToString.Contiene("5", "6") Then - - If e.Row.DBCampo("CveMetodoInventario").ToString = "5" Then - e.Row.FCButton("BtnSerieLote").Visible = True - e.Row.FCButton("BtnSerieLote").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec")) - - e.Row.FCTextBox("TbCantidadF").Enabled = False - e.Row.FCCheckBox("cbInv").Enabled = False - Dim Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count - e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString - ElseIf e.Row.DBCampo("CveMetodoInventario").ToString = "6" Then - e.Row.FCButton("BtnLote").Visible = True - e.Row.FCButton("BtnLote").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec")) - - e.Row.FCTextBox("TbCantidadF").Enabled = False - e.Row.FCCheckBox("cbInv").Enabled = False - Dim Contador = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count - e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString - End If - + If e.Row.RowType = DataControlRowType.DataRow Then + + 'If e.Row.DBCampo("CveMetodoInventario").ToString.Contiene("5", "6") Then + + If CBool(e.Row.DBCampo("AplicaSerie")) Then + + 'If e.Row.DBCampo("CveMetodoInventario").ToString = "5" Then + e.Row.FCButton("BtnSerieLote").Visible = True + e.Row.FCButton("BtnSerieLote").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec")) + + e.Row.FCTextBox("TbCantidadF").Enabled = False + e.Row.FCCheckBox("cbInv").Enabled = False + Dim Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count + e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString + 'ElseIf e.Row.DBCampo("CveMetodoInventario").ToString = "6" Then + ' e.Row.FCButton("BtnLote").Visible = True + ' e.Row.FCButton("BtnLote").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec")) + + ' e.Row.FCTextBox("TbCantidadF").Enabled = False + ' e.Row.FCCheckBox("cbInv").Enabled = False + ' Dim Contador = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count + ' e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString + 'End If + Else e.Row.FCButton("BtnSerieLote").Visible = False e.Row.FCButton("BtnLote").Visible = False @@ -1171,8 +1226,33 @@ Partial Class Inventarios_RecepcionAlmacen e.Row.FCTextBox("TbCantidadF").Text = e.Row.DBCampo("CantidadF").FormatoNumero e.Row.FCTextBox("TbCantidadF").Enabled = False End If + 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 <> "" And Not UsuarioActual.TienePermisoProceso(174) Then @@ -1183,15 +1263,15 @@ Partial Class Inventarios_RecepcionAlmacen e.Row.FCTextBox("TbCantidadF").Visible = False e.Row.Cells(3).Text = "0" e.Row.FCCheckBox("cbInv").Visible = False - End If - - 'TotalGV += e.Row.DBCampo("PU").ToString.ToDecimal * e.Row.DBCampo("CantidadF").ToString.ToDecimal - - If UsuarioActual.Empresa.Funcionalidad(147) = "1" Then - e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) + End If + + 'TotalGV += e.Row.DBCampo("PU").ToString.ToDecimal * e.Row.DBCampo("CantidadF").ToString.ToDecimal + + 'If UsuarioActual.Empresa.Funcionalidad(147) = "1" Then + e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) - End If + 'End If e.Row.FCLabel("LbTotal").Text = ((e.Row.DBCampo("PU").ToDecimal + e.Row.DBCampo("CostoIndirecto").ToDecimal) * e.Row.DBCampo("CantidadF").ToDecimal).FormatoNumero @@ -1361,20 +1441,20 @@ Partial Class Inventarios_RecepcionAlmacen 'RegistraScript("document.getElementById(""TxtSerieLote"").focus();") RegistraScript("$('#DivSerie').modal();", "ModalLote") - Dim AplicaCaducidad = False - If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0) IsNot Nothing Then - AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) - End If + 'Dim AplicaCaducidad = False + 'If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0) IsNot Nothing Then + ' AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) + 'End If - If AplicaCaducidad Then - GvSerie.Columns(1).Visible = True - TdCaducidad1.Visible = True - TdCaducidad2.Visible = True - Else - GvSerie.Columns(1).Visible = False - TdCaducidad1.Visible = False - TdCaducidad2.Visible = False - End If + 'If AplicaCaducidad Then + ' GvSerie.Columns(1).Visible = True + ' TdCaducidad1.Visible = True + ' TdCaducidad2.Visible = True + 'Else + ' GvSerie.Columns(1).Visible = False + ' TdCaducidad1.Visible = False + ' TdCaducidad2.Visible = False + 'End If GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote), "Consec DESC") GvSerie.DataBind() @@ -1507,10 +1587,10 @@ Partial Class Inventarios_RecepcionAlmacen End If End If - Dim AplicaCaducidad = False - If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0) IsNot Nothing Then - AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) - End If + 'Dim AplicaCaducidad = False + 'If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0) IsNot Nothing Then + ' AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) + 'End If Row("ConsecId") = CveConsecSerieLote Row("Consec") = DtDatosDetalle.Rows.Count + 1 @@ -1518,7 +1598,7 @@ Partial Class Inventarios_RecepcionAlmacen Row("CveUM") = CveUMSerieLote Row("PU") = PUSerieLote Row("Serie") = Serie - Row("FechaCaducidad") = If(AplicaCaducidad, TxtFechaCaducidad.Text, MinFecha.ToShortDateString) + Row("FechaCaducidad") = MinFecha.ToShortDateString DtDatosDetalle.Rows.Add(Row) Next @@ -2092,7 +2172,7 @@ Partial Class Inventarios_RecepcionAlmacen PU = Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2).ToDecimal - (SumaTotal - (PU)) End If End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), SerieLote:=Dr("Serie").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), SerieLote:=Dr("Serie").ToString, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario, FechaCaducidad:=If(CBool(gvr.DataKey("AplicaCaducidad")), gvr.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha), Lote:=If(CBool(gvr.DataKey("AplicaLote")), gvr.FCTextBox("TxtLote").Text, ""), CveSeccionAlmacen:=If(CBool(gvr.DataKey("AplicaSeccion")), gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, -1)) Then ErrorMovInv = True Exit For End If @@ -2107,7 +2187,7 @@ Partial Class Inventarios_RecepcionAlmacen PU = (Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2).ToDecimal - (SumaTotal - (Dr("Cantidad").ToString.ToDecimal * (PU)))) / Dr("Cantidad").ToString.ToDecimal End If End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario, FechaCaducidad:=If(CBool(gvr.DataKey("AplicaCaducidad")), gvr.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(gvr.DataKey("AplicaSeccion")), gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, -1)) Then ErrorMovInv = True Exit For End If @@ -2122,7 +2202,7 @@ Partial Class Inventarios_RecepcionAlmacen PU = (Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2).ToDecimal - (SumaTotal - tTotal)) / gvr.FCTextBox("TbCantidadF").Text.ToDecimal End If End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, gvr.FCTextBox("TbCantidadF").Text.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, gvr.FCTextBox("TbCantidadF").Text.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario, FechaCaducidad:=If(CBool(gvr.DataKey("AplicaCaducidad")), gvr.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha), Lote:=If(CBool(gvr.DataKey("AplicaLote")), gvr.FCTextBox("TxtLote").Text, ""), CveSeccionAlmacen:=If(CBool(gvr.DataKey("AplicaSeccion")), gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, -1)) Then ErrorMovInv = True Exit For End If @@ -2856,20 +2936,20 @@ Partial Class Inventarios_RecepcionAlmacen DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero)) If DtDetalle.Rows.Count > 0 Then For Each Dr As DataRow In DtDetalle.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), SerieLote:=Dr("Serie").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), SerieLote:=Dr("Serie").ToString, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, FechaCaducidad:=If(CBool(gvr.DataKey("AplicaCaducidad")), gvr.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha), Lote:=If(CBool(gvr.DataKey("AplicaLote")), gvr.FCTextBox("TxtLote").Text, ""), CveSeccionAlmacen:=If(CBool(gvr.DataKey("AplicaSeccion")), gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, -1)) Then ErrorMovInv = True Exit For End If Next ElseIf DtDetalleLote.Rows.Count > 0 Then For Each Dr As DataRow In DtDetalleLote.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, FechaCaducidad:=If(CBool(gvr.DataKey("AplicaCaducidad")), gvr.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(gvr.DataKey("AplicaSeccion")), gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, -1)) Then ErrorMovInv = True Exit For End If Next Else - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, gvr.FCTextBox("TbCantidadF").Text.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, gvr.FCTextBox("TbCantidadF").Text.ToDouble, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, PU, -1, PUTC:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, PUExtranjero), CveCompraDetalle:=gvr.DataKey("CveCompraDetalle").ToEntero, CveOrdenCompraDetalle:=gvr.DataKey("CveOrdenCompraDetalle").ToEntero, CveVentaDetalle:=gvr.DataKey("CveVentaDetalle").ToEntero, CostoIndirecto:=CostoIndirecto, FechaCaducidad:=If(CBool(gvr.DataKey("AplicaCaducidad")), gvr.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha), Lote:=If(CBool(gvr.DataKey("AplicaLote")), gvr.FCTextBox("TxtLote").Text, ""), CveSeccionAlmacen:=If(CBool(gvr.DataKey("AplicaSeccion")), gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, -1)) Then ErrorMovInv = True Exit For End If @@ -3735,4 +3815,92 @@ Partial Class Inventarios_RecepcionAlmacen #End Region +#Region "DIVIDIR" + + Protected Sub Dividir(sender As Object, e As EventArgs) + Dim index2 As Integer = 0 + + For Each Row As DataRow In DtInv.Rows + Row("Seleccionado") = GvInv.Rows(index2).FCCheckBox("cbInv").Checked + If GvInv.Rows(index2).FCTextBox("TbCantidadF").Text <> "" Then + Row("CantidadSeleccionada") = GvInv.Rows(index2).FCTextBox("TbCantidadF").Text + End If + If GvInv.Rows(index2).FCTextBox("TxtLote").Text <> "" Then + Row("Lote") = GvInv.Rows(index2).FCTextBox("TxtLote").Text + End If + If GvInv.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue <> "-1" Then + Row("CveSeccion") = GvInv.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero + End If + If GvInv.Rows(index2).FCTextBox("TxtCaducidad").Text <> "" Then + Row("Caducidad") = GvInv.Rows(index2).FCTextBox("TxtCaducidad").Text.ToDate + End If + index2 += 1 + Next + DtInv.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 = DtInv.Rows(Index) + Dim dr As DataRow = DtInv.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 + + DtInv.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 + DtInv.Rows.InsertAt(dr, Index) + DtInv.AcceptChanges() + + index2 = 1 + For Each Row As DataRow In DtInv.Rows + Row("Consec") = index2 + index2 += 1 + Next + DtInv.AcceptChanges() + + CargaGVInv() + + index2 = 0 + For Each Row As DataRow In DtInv.Rows + GvInv.Rows(index2).FCCheckBox("cbInv").Checked = CBool(Row("Seleccionado")) + If Row("CantidadSeleccionada").ToString <> "" Then + GvInv.Rows(index2).FCTextBox("TbCantidadF").Text = Row("CantidadSeleccionada").ToString + End If + If Row("Lote").ToString <> "" Then + GvInv.Rows(index2).FCTextBox("TxtLote").Text = Row("Lote").ToString + End If + If Row("CveSeccion").ToString <> "" Then + GvInv.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue = Row("CveSeccion").ToString + End If + If Row("Caducidad").ToString <> "" Then + GvInv.Rows(index2).FCTextBox("TxtCaducidad").Text = Row("Caducidad").ToString.ToDate.ToShortDateString + End If + index2 += 1 + Next + + End Sub + + +#End Region + + End Class diff --git a/Inventarios/RecepcionEntrega.aspx b/Inventarios/RecepcionEntrega.aspx index a426c9852..91f95119b 100644 --- a/Inventarios/RecepcionEntrega.aspx +++ b/Inventarios/RecepcionEntrega.aspx @@ -416,6 +416,14 @@
+
+
+
+ +
+
+
+ <%--GV DATOS--%> @@ -484,11 +492,46 @@ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
+ + + + + +
+ @@ -879,6 +922,35 @@ + + @@ -931,6 +1003,29 @@ $('#TxtCantidadEspecialDiv').focus() } + function Dividir(t) { + $get("HdnCantidadMovimiento").value = $get(t).value; + } + + function LimitaCantidad(C, textbox, button) { + + // var contenedor = $(textbox).parent().find("#" + buttonIdDiv); + + if (ToDouble(textbox.value) >= C) { + textbox.value = ""; + } + + if (parseFloat(textbox.value) > 0) { + $get(button).style.display = ""; + //$(contenedor).show(); + } + else { + $get(button).style.display = "none"; + //$(contenedor).hide(); + + } + } + diff --git a/Inventarios/RecepcionEntrega.aspx.vb b/Inventarios/RecepcionEntrega.aspx.vb index afcd7d2e8..b63700ad8 100644 --- a/Inventarios/RecepcionEntrega.aspx.vb +++ b/Inventarios/RecepcionEntrega.aspx.vb @@ -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("") 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("", Dr1("CvePS"), Dr1("CveUM"), 1, Dr1("SerieLote")) + StrXML.AppendFormat("", 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("", Dr1("CvePS"), Dr1("CveUM"), DtDatosDetalleLote.SUM("Cantidad", $"Lote = '{Dr1("Lote").ToString}' AND Batch = '{Dr1("Batch").ToString}'"), Dr1("Lote")) Next Else - StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), "-1") + StrXML.AppendFormat("", 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 From 34da102d92a4830a8fd9fb458fe2d46c9c26605f Mon Sep 17 00:00:00 2001 From: Raul Pimienta Date: Tue, 7 Apr 2020 15:01:48 -0700 Subject: [PATCH 3/3] . --- Inventarios/RecepcionEntrega.aspx.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Inventarios/RecepcionEntrega.aspx.vb b/Inventarios/RecepcionEntrega.aspx.vb index b63700ad8..18d66033f 100644 --- a/Inventarios/RecepcionEntrega.aspx.vb +++ b/Inventarios/RecepcionEntrega.aspx.vb @@ -1925,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, 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 + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, 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 @@ -1959,7 +1959,7 @@ Partial Class Inventarios_RecepcionEntrega Dim CvePS = RowGarantia("CvePS").ToString().ToEntero() Dim CveTamaño As Integer = RowGarantia("CveTamaño").ToString().ToEntero() Dim CveUM As Integer = RowGarantia("CveUnidadMedida").ToString().ToEntero() - Dim PU As Double = RowGarantia("Importe").ToString().ToDouble() ' / RowGarantia("Cantidad").ToString().ToDouble() + Dim PU As Decimal = RowGarantia("Importe").ToString().ToDecimal() ' / RowGarantia("Cantidad").ToString().ToDouble() If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, -1) Then ErrorMovInv = True @@ -2023,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, 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 + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, 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 @@ -2114,7 +2114,7 @@ Partial Class Inventarios_RecepcionEntrega Else If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then 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.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) 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("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de entrada" Exit For @@ -2379,7 +2379,7 @@ Partial Class Inventarios_RecepcionEntrega For Each RowUsado As DataRow In DtPSVirtual.Rows Dim CvePS = RowUsado("CvePS").ToString().ToEntero() Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble() - Dim PU As Double = RowUsado("PU").ToString().ToDouble() + Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal() Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then