|
|
|
|
@@ -907,9 +907,11 @@ Partial Class Inventarios_TraspasoAlmacen
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
Dim Concepto As String = TxtObservaciones.Text
|
|
|
|
|
If Concepto = "" Then Concepto = "Traspaso"
|
|
|
|
|
'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO:
|
|
|
|
|
If Not ErrorMovInv Then
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservaciones.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
|
|
|
|
|
Dim resultado As DataTable = ObjInventario.DtResultados
|
|
|
|
|
@@ -920,11 +922,11 @@ Partial Class Inventarios_TraspasoAlmacen
|
|
|
|
|
|
|
|
|
|
If IdCtaContableSalida = IdCtaContableEntrada Then Contabilizable = False
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableSalida, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableSalida, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableEntrada, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableEntrada, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
@@ -932,18 +934,20 @@ Partial Class Inventarios_TraspasoAlmacen
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
If Not ErrorMovInv Then
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservaciones.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
Dim Concepto As String = TxtObservaciones.Text
|
|
|
|
|
If Concepto = "" Then Concepto = "Traspaso"
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
|
|
|
|
|
Dim resultado As DataTable = ObjInventario.DtResultados
|
|
|
|
|
Dim importe As Decimal = resultado.SUM("Total").ToDecimal
|
|
|
|
|
Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorio.SelectedValue.ToEntero)).ToEntero
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida) Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida) Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
@@ -1507,6 +1511,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim ObjInventario As New ClsInventarios
|
|
|
|
|
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
|
|
|
|
ObjInventario.IniciaTransacSQL()
|
|
|
|
|
Dim CveMovimientoEntrada As Integer = 0
|
|
|
|
|
Dim Folio = 0
|
|
|
|
|
@@ -1514,31 +1519,58 @@ Partial Class Inventarios_TraspasoAlmacen
|
|
|
|
|
Dim TextoError = ""
|
|
|
|
|
Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate
|
|
|
|
|
|
|
|
|
|
CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
|
|
|
|
|
Observaciones:=TxtObservacionesRecepcion.Text.Trim, Recibio:=TxtRecibio.Text, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G")
|
|
|
|
|
CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
|
|
|
|
|
Observaciones:=TxtObservacionesRecepcion.Text.Trim, Recibio:=TxtRecibio.Text, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero,
|
|
|
|
|
CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G")
|
|
|
|
|
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservacionesRecepcion.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
If CvePrePoliza <= 0 Then
|
|
|
|
|
TextoError = "No se pudo generar la Poliza para la cancelacion"
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Folio = ObjInventario.Folio
|
|
|
|
|
|
|
|
|
|
If CveMovimientoEntrada <= 0 Then
|
|
|
|
|
If CveMovimientoEntrada <= 0 And Not ErrorMovInv Then
|
|
|
|
|
TextoError = "No se pudo generar el movimiento de entrada correctamente"
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
Else
|
|
|
|
|
Dim CveMovimientoDetalleSalida As Integer = 0
|
|
|
|
|
Dim importe As Double = 0
|
|
|
|
|
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, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
If Not ErrorMovInv Then
|
|
|
|
|
Dim ImporteDecimal As Decimal = importe.ToDecimal
|
|
|
|
|
Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1,
|
|
|
|
|
CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1,
|
|
|
|
|
CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ErrorMovInv Then
|
|
|
|
|
@@ -1561,8 +1593,10 @@ Partial Class Inventarios_TraspasoAlmacen
|
|
|
|
|
UPDatosAlmacen.Update()
|
|
|
|
|
Else
|
|
|
|
|
ObjInventario.RollBack()
|
|
|
|
|
ObjConta.RollBack()
|
|
|
|
|
Alert(TextoError, TipoMensaje.MsgError)
|
|
|
|
|
End If
|
|
|
|
|
ObjConta.Dispose()
|
|
|
|
|
ObjInventario.Dispose()
|
|
|
|
|
CargaRecepcion()
|
|
|
|
|
End Sub
|
|
|
|
|
@@ -1668,18 +1702,20 @@ Partial Class Inventarios_TraspasoAlmacen
|
|
|
|
|
Cont += 1
|
|
|
|
|
Next
|
|
|
|
|
If Not ErrorMovInv Then
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservacionesRecepcion.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
Dim Concepto As String = TxtObservacionesRecepcion.Text
|
|
|
|
|
If Concepto = "" Then Concepto = "Recepción Traspaso"
|
|
|
|
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
|
|
|
|
|
Dim resultado As DataTable = ObjInventario.DtResultados
|
|
|
|
|
Dim importe As Decimal = resultado.SUM("Total").ToDecimal
|
|
|
|
|
Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida) Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida) Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then
|
|
|
|
|
ErrorMovInv = True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|