diff --git a/Acumuladores/RepRecolecciones.aspx.vb b/Acumuladores/RepRecolecciones.aspx.vb
index aa2843c47..116ce8b4f 100644
--- a/Acumuladores/RepRecolecciones.aspx.vb
+++ b/Acumuladores/RepRecolecciones.aspx.vb
@@ -41,11 +41,23 @@ Partial Class Acumuladores_RepRecolecciones
Set(value As Boolean)
ViewState("Actualizar") = value
End Set
- End Property
-
+ End Property
+ Private Property DTPSDefinidos As DataTable
+ Get
+ If ViewState("DTPSDefinidos") Is Nothing Then
+ ViewState("DTPSDefinidos") = New DataTable()
+ End If
+ Return CType(ViewState("DTPSDefinidos"), DataTable)
+ End Get
+ Set(ByVal value As DataTable)
+ ViewState("DTPSDefinidos") = CType(value, DataTable)
+ End Set
+ End Property
+
+
#End Region
-
-
+
+
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
@@ -128,14 +140,16 @@ Partial Class Acumuladores_RepRecolecciones
Dim Str As New StringBuilder
Str.Append("Productos Definidos
")
If ObjGenerales.GetEntregaAlmacenRutaDetalle(CveEntregaAlmacen) Then
- For Each dr As DataRow In ObjGenerales.DtResultados.Rows
- Str.AppendFormat(" {0} - {1}
", dr("Cantidad"), dr("CodigoPS"))
- HdnPSRecoleccion.Value = dr("CvePS").ToString
- HdnCantidadRecoleccion.Value = dr("Cantidad").ToString
- Next
- LblProductosCargados.Text = Str.ToString
+ DTPSDefinidos = ObjGenerales.DtResultados.Copy()
End If
- ObjGenerales.Dispose()
+ ObjGenerales.Dispose()
+
+ For Each dr As DataRow In DTPSDefinidos.Rows
+ Str.AppendFormat(" {0} - {1}
", dr("Cantidad"), dr("CodigoPS"))
+ 'HdnPSRecoleccion.Value = dr("CvePS").ToString
+ 'HdnCantidadRecoleccion.Value = dr("Cantidad").ToString
+ Next
+ LblProductosCargados.Text = Str.ToString
GvModalPSRecoleccion.DataSource = DTRecoleccion
GvModalPSRecoleccion.DataBind()
@@ -204,11 +218,12 @@ Partial Class Acumuladores_RepRecolecciones
Private Sub BtnModalRecoleccionGuardar_Click(sender As Object, e As EventArgs) Handles BtnModalRecoleccionGuardar.Click
- Dim Cantidad As Decimal = HdnCantidadRecoleccion.Value.ToDecimal
+ Dim Cantidad As Decimal = DTPSDefinidos.SUMD("Cantidad")
Dim CantidadDefinido As Decimal = 0
For Each gvr As GridViewRow In GvModalPSRecoleccion.Rows
CantidadDefinido += gvr.DataKey("Cantidad").ToDecimal
Next
+
If CantidadDefinido <> Cantidad Then
Alert("La cantidad definida no es la correcta", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -219,15 +234,21 @@ Partial Class Acumuladores_RepRecolecciones
Dim ObjGral As New ClsGenerales(ObjInventario.IniciaTransacSQL)
Dim ErrorMovInv As Boolean = False
Dim Fecha As DateTime = NowADS()
- Dim Concepto As String = "Traspaso Recolección"
+ Dim Concepto As String = "Traspaso Recolección"
+
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, 45, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveEntregaAlmacen:=CveEntregaAlmacen, Modulo:="clasifUsados")
- Dim FolioSalida As Integer = ObjInventario.Folio
- Dim CveMovimientoEntrada As Integer = ObjInventario.AddMovimiento(DdlAlmacenDestino.SelectedValue.ToEntero, 42, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalida, CveEntregaAlmacen:=CveEntregaAlmacen, Modulo:="clasifUsados")
- Dim CveUM As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=HdnPSRecoleccion.Value.ToEntero).FiltroPrimeroValor("CveUnidadMedida", "").ToEntero
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, HdnCantidadRecoleccion.Value.ToDecimal, CveUM, HdnPSRecoleccion.Value.ToEntero, 0) Then
- ErrorMovInv = True
- End If
- 'HdnPSRecoleccion
+ Dim FolioSalida As Integer = ObjInventario.Folio
+
+ For Each Row As DataRow In DTPSDefinidos.Rows
+ Dim CveUM As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=Row("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveUnidadMedida", "").ToEntero
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Row("Cantidad").ToString().ToDecimal, CveUM, Row("CvePS").ToString().ToEntero(), 0) Then
+ ErrorMovInv = True
+ End If
+ Next
+
+ Dim CveMovimientoEntrada As Integer = ObjInventario.AddMovimiento(DdlAlmacenDestino.SelectedValue.ToEntero, 42, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalida, CveEntregaAlmacen:=CveEntregaAlmacen, Modulo:="clasifUsados")
+
+ 'HdnPSRecoleccion
For Each gvr As GridViewRow In GvModalPSRecoleccion.Rows
Dim CveMovtoDetalle As Integer
If ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, gvr.DataKey("Cantidad").ToDecimal, gvr.DataKey("CveUnidadMedida").ToEntero, gvr.DataKey("CvePS").ToEntero, 0) Then
diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb
index 091ecb714..67ddada77 100644
--- a/Bancos/RepCortes.aspx.vb
+++ b/Bancos/RepCortes.aspx.vb
@@ -227,7 +227,7 @@ Partial Class Bancos_RepCortes
GvP.DataSource = DtCortesVentasResumen
'RESUMEN - IVA
- If UsuarioActual.CveEmpresa.Contiene(190, 192) Then
+ If UsuarioActual.CveEmpresa.Contiene(190, 192) AndAlso DsDatos.Tables.Count > 2 Then
DivIVA.Visible = True
GvPorIVA.DataSource = DsDatos.Tables(2)
Dim tsum As Decimal = DsDatos.Tables(2).SUMD("IVA16") + DsDatos.Tables(2).SUMD("IVA0")
diff --git a/Ventas/FacturacionGlobal.aspx.vb b/Ventas/FacturacionGlobal.aspx.vb
index 475f83d5b..39be6ba13 100644
--- a/Ventas/FacturacionGlobal.aspx.vb
+++ b/Ventas/FacturacionGlobal.aspx.vb
@@ -188,7 +188,8 @@ Partial Class Ventas_FacturacionGlobal
ObjClientes.Dispose()
If DtRemisionesPS Is Nothing OrElse DtRemisionesPS.Rows.Count = 0 Then
- Alert("No se pudieron cargar las remsiones para facturar", TipoMensaje.MsgError)
+ Alert("No se pudieron cargar las remisiones para facturar", TipoMensaje.MsgError)
+ GuardaLog("Remisiones: " + SbRemisiones.ToString())
Exit Sub
End If