- traspasoalmacen

This commit is contained in:
rrene
2020-04-06 23:31:14 -07:00
8 changed files with 261 additions and 128 deletions

View File

@@ -1550,45 +1550,70 @@ Partial Class Inventarios_TraspasoAlmacen
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 Decimal = Dr("Cantidad").ToString.ToDecimal
Dim PrecioUnitario As Decimal = Dr("PU").ToString.ToDecimal
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
For Each GvRow As GridViewRow In GvDatosRecepcion.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
'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
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, 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
End If
importe += Cantidad * PrecioUnitario
Next
Else
End If
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 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 ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1,
CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al obtener los movimientos de salida"
TextoError = "Ocurrió un erro al cancelar el traspaso"
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 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
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"
End If
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"
End If
End If
End If
@@ -2876,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