2026-01-30 01

This commit is contained in:
2026-01-30 08:33:45 +01:00
parent e043d4bdee
commit 9e0f4bb6fe
11 changed files with 1503 additions and 247 deletions

View File

@@ -38,7 +38,7 @@ Public Class ucAlbaran
Try
lProductos = bd.productos.OrderBy(Function(x) x.Descripcion).ToList
Dim lProductosAlb = ra.detallesalbaranes.Select(Function(x) x.idProducto).ToArray
Dim lProductosAlb = ra.detallesalbaranesidAlbaranNavigation.Select(Function(x) x.idProducto).ToArray
lProductos = lProductos.Where(Function(x) x.FechaBaja Is Nothing OrElse lProductosAlb.Contains(x.idProducto)).ToList
cbProducto.ItemsSource = lProductos
@@ -131,8 +131,8 @@ Public Class ucAlbaran
cbAlmacenOrigen.ItemsSource = Comun.ObtieneListaAlmacenes(bd)
cbAlmacenDestino.ItemsSource = Comun.ObtieneListaAlmacenes(bd)
End If
Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ra.idAlbaran AndAlso x.Aplicacion = "albaranes").ToList
gcProductos.ItemsSource = ra.detallesalbaranes
'Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ra.idAlbaran AndAlso x.Aplicacion = "albaranes").ToList
gcProductos.ItemsSource = ra.detallesalbaranesidAlbaranNavigation
Me.DataContext = ra
Return NuevoEstado
Catch ex As Exception
@@ -349,20 +349,20 @@ Public Class ucAlbaran
Private Sub ap_DespuesGuardar(sender As Object, e As ItemClickEventArgs, OpcionGuardado As Integer) Handles Me.DespuesGuardar
Dim ae As albaranes = Me.DataContext
_idAlbaran = DirectCast(Me.DataContext, albaranes).idAlbaran
Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ae.idAlbaran AndAlso x.Aplicacion = "albaranes").ToList
'Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ae.idAlbaran AndAlso x.Aplicacion = "albaranes").ToList
End Sub
Private Sub ap_Enlazar(Celda As EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
Select Case Celda.Column.FieldName.ToLower
Case "idlog"
Dim log As logs = gcLogs.CurrentItem
Dim id As Integer = log.idLog
Dim uc As New ucAlbaran
uc.idLog = log.idLog
FuncionesDinamicas.AbrirAP(uc, OtrosParametros)
End Select
'Select Case Celda.Column.FieldName.ToLower
' Case "idlog"
' Dim log As logs = gcLogs.CurrentItem
' Dim id As Integer = log.idLog
' Dim uc As New ucAlbaran
' uc.idLog = log.idLog
' FuncionesDinamicas.AbrirAP(uc, OtrosParametros)
'End Select
End Sub
@@ -610,8 +610,8 @@ Public Class ucAlbaran
Friend Shared Function GeneraPdfAlbaran(bd As tscGrupoSanchoToro, Albaran As albaranes) As Byte()
Dim albes As New List(Of albaranes)
albes.Add(Albaran)
Dim idplae = bd.plantillas.First(Function(x) x.Codigo = "ALBENTV").idPlantilla
If Albaran.entidades.TipoImpresionAlbaranEntrega = db.albaranes.TipoImpresionAlbaranEntregaEnum.IMPRIMIR_CONTRATO Then idplae = bd.plantillas.First(Function(x) x.Codigo = "CONTAE").idPlantilla
Dim tipo As String = "ALB_" & Albaran.Tipo.ToString
Dim idplae = bd.plantillas.First(Function(x) x.Codigo = tipo).idPlantilla
Dim bAes = Informes.GuardaInformeEnPdf(bd, idplae, albes)
Return bAes
End Function
@@ -653,10 +653,10 @@ Public Class ucAlbaran
gcEsventa.ReadOnly = False
Select Case DirectCast(ra.Tipo, bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.COMPRA
For Each d In ra.detallesalbaranes.Where(Function(x) x.EsVenta)
For Each d In ra.detallesalbaranesidAlbaranNavigation.Where(Function(x) x.EsVenta)
d.EsVenta = False
Next
gcEsventa.ReadOnly = True
gcEsVenta.ReadOnly = True
ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True)
EstableceSoloLectura(cbAlmacenDestino, False)
@@ -679,7 +679,7 @@ Public Class ucAlbaran
ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True)
EstableceSoloLectura(cbAlmacenDestino, False)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.STOCK_INICIAL_O_FABRICACION
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK
ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True)
EstableceSoloLectura(cbAlmacenDestino, False)
@@ -718,7 +718,7 @@ Public Class ucAlbaran
Dim hte As New Hashtable
Select Case DirectCast(ra.Tipo, bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.COMPRA
For Each d In ra.detallesalbaranes.Where(Function(x) x.EsVenta)
For Each d In ra.detallesalbaranesidAlbaranNavigation.Where(Function(x) x.EsVenta)
d.EsVenta = False
Next
If ra.idAlmacenDestino.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_DESTINO_OBLIGATORIO", "El almacén destino es obligatorio")
@@ -733,7 +733,7 @@ Public Class ucAlbaran
If ra.idAlmacenOrigen.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_ORIGEN_OBLIGATORIO", "El almacén origen es obligatorio")
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.RECOGIDA
If ra.idAlmacenDestino.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_DESTINO_OBLIGATORIO", "El almacén destino es obligatorio")
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.STOCK_INICIAL_O_FABRICACION
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK
If ra.idAlmacenDestino.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_DESTINO_OBLIGATORIO", "El almacén destino es obligatorio")
End Select
If hte.Count > 0 Then
@@ -745,7 +745,7 @@ Public Class ucAlbaran
Select Case Estado
Case tsUtilidades.EstadosAplicacion.Nuevo
For Each d In ra.detallesalbaranes
For Each d In ra.detallesalbaranesidAlbaranNavigation
d.idAlbaranNavigation = ra
d.ActualizaProducto(bdtmp, 1)
Next
@@ -754,7 +754,7 @@ Public Class ucAlbaran
For Each d In das
d.ActualizaProducto(bdtmp, -1)
Next
For Each d In ra.detallesalbaranes
For Each d In ra.detallesalbaranesidAlbaranNavigation
d.ActualizaProducto(bdtmp, 1)
Next
End Select
@@ -781,5 +781,32 @@ Public Class ucAlbaran
ra.idPresupuestoNavigation = Nothing
End Sub
Private Sub BiBuscarArticulo_Click(sender As Object, e As RoutedEventArgs)
Try
If gcProductos.CurrentItem IsNot Nothing Then
Dim dea As detallesalbaranes = gcProductos.CurrentItem
If dea.idProducto > 0 Then
If tvProductos.ActiveEditor Is Nothing Then
Dispatcher.BeginInvoke(New Action(Sub() tvProductos.ShowEditor()), System.Windows.Threading.DispatcherPriority.Render)
End If
Dim dxw As New dxwArticulos(lArticulos, dea.idProducto)
If dxw.ShowDialog Then
Dim art = lArticulos.First(Function(x) x.idArticulo = dxw.idArticulo)
dea.idArticulo = art.idArticulo
dea.Cantidad = 1
If tvProductos.ActiveEditor IsNot Nothing Then tvProductos.ActiveEditor.EditValue = art.idArticulo
tvProductos.PostEditor()
tvProductos.CloseEditor()
gcProductos.RefreshRow(tvProductos.FocusedRowHandle)
End If
End If
End If
Catch ex As Exception
FuncionesDinamicas.ErrorNoControladoAp(Me, ex)
DXMessageBox.Show(ex.Message, "Error")
End Try
End Sub
End Class