diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 401a6bcf5..ca5e6f059 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -1557,8 +1557,8 @@ Partial Class Inventarios_TraspasoAlmacen 'DEBE CONSIDERAR SOLO LAS FILAS QUE TENGA PRODUCTOS, NO EL TOTALIZADOR If CvePS > 0 Then CveMovimientoDetalleSalida = GvRow.DataKey("CveMovimientoDetalle").ToString.ToEntero - Dim Cantidad As Double = GvRow.DataKey("Cantidad").ToString.ToDouble - Dim PrecioUnitario As Double = GvRow.DataKey("PU").ToString.ToDouble + Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToString.ToDecimal + Dim PrecioUnitario As Decimal = GvRow.DataKey("PU").ToString.ToDecimal If CveMovimientoDetalleSalida <= 0 Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de salida" @@ -1566,54 +1566,54 @@ Partial Class Inventarios_TraspasoAlmacen End If If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, GvRow.DataKey("CveUM").ToEntero, CvePS, PrecioUnitario, GvRow.DataKey("CveAF").ToEntero, -1, GvRow.DataKey("SerieLote").ToString, Lote:=GvRow.DataKey("Lote"), Batch:=GvRow.DataKey("Batch"), CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de entrada" + Exit For + End If + importe += Cantidad * PrecioUnitario End If - importe += Cantidad * PrecioUnitario - End If - End If - Next + End If + Next - 'If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - ' For Each Dr As DataRow In ObjInventario.DtResultados.Rows - ' CveMovimientoDetalleSalida = Dr("CveMovimientoDetalle").ToString.ToEntero - ' Dim Cantidad As Double = Dr("Cantidad").ToString.ToDouble - ' Dim PrecioUnitario As Double = Dr("PU").ToString.ToDouble - ' If CveMovimientoDetalleSalida <= 0 Then - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al guardar los movimientos de salida" - ' Exit For - ' End If + 'If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + ' For Each Dr As DataRow In ObjInventario.DtResultados.Rows + ' CveMovimientoDetalleSalida = Dr("CveMovimientoDetalle").ToString.ToEntero + ' Dim Cantidad As Double = Dr("Cantidad").ToString.ToDouble + ' Dim PrecioUnitario As Double = Dr("PU").ToString.ToDouble + ' If CveMovimientoDetalleSalida <= 0 Then + ' ErrorMovInv = True + ' TextoError = "Ocurrió un error al guardar los movimientos de salida" + ' Exit For + ' End If - ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al guardar los movimientos de entrada" - ' Exit For - ' End If - ' importe += Cantidad * PrecioUnitario - ' Next - 'Else - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al obtener los movimientos de salida" - 'End If + ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then + ' ErrorMovInv = True + ' TextoError = "Ocurrió un error al guardar los movimientos de entrada" + ' Exit For + ' End If + ' importe += Cantidad * PrecioUnitario + ' Next + 'Else + ' ErrorMovInv = True + ' TextoError = "Ocurrió un error al obtener los movimientos de salida" + 'End If - If Not ErrorMovInv Then - Dim ImporteDecimal As Decimal = importe.ToDecimal.RoundSQL - Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero + If Not ErrorMovInv Then + Dim ImporteDecimal As Decimal = importe.ToDecimal.RoundSQL + Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then - ErrorMovInv = True - TextoError = "Ocurrió un erro al cancelar el traspaso" - End If + ErrorMovInv = True + TextoError = "Ocurrió un erro al cancelar el traspaso" + End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then - ErrorMovInv = True - TextoError = "Ocurrió un erro al cancelar el traspaso" + ErrorMovInv = True + TextoError = "Ocurrió un erro al cancelar el traspaso" + End If End If - End If End If @@ -2901,7 +2901,7 @@ Partial Class Inventarios_TraspasoAlmacen Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) - Dim excelFile As ExcelFile = excelFile.Load(flatFilePath) + Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath) Dim unnamed As Integer = 0 Dim cols As Integer