cambios 17/02/2026

This commit is contained in:
2026-02-17 13:47:52 +01:00
parent 79ae74ee26
commit 28e20494ae
51 changed files with 3199 additions and 691 deletions

View File

@@ -0,0 +1,58 @@
<dx:DXWindow x:Class="dxwRecogidaProductos"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:tsWPF="clr-namespace:tsWPFCore;assembly=tsWPFCore"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" ShowInTaskbar="True"
ShowIcon="False" Title="Seleccione y Pulse Aceptar" WindowStyle="ToolWindow" WindowState="Maximized" Topmost="True" WindowStartupLocation="CenterScreen" Width="1380" Height="700">
<dx:DXWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/tsWPFCore;component/Plantillas.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</dx:DXWindow.Resources>
<Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="45" />
</Grid.RowDefinitions>
<tsWPF:tsGridControl x:Name="gc" SeleccionMultiple="True" >
<tsWPF:tsGridControl.View>
<tsWPF:tsTableView x:Name="tv" ShowCheckBoxSelectorColumn="True" ShowSearchPanelMode="Always" AllowEditing="False" ShowGroupPanel="False" />
</tsWPF:tsGridControl.View>
<tsWPF:tsGridColumn FieldName="Producto" Header="Producto" Width="400" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="idArticuloNavigation.CodigoArticulo" Header="Artículo" Width="70" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="Cantidad" Header="Uds. Entregadas" IsSmart="True" Width="100" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="idAlbaranNavigation.NumeroAlbaran" Header="Nº Alb. Entrega" IsSmart="True" Width="110" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="idAlbaranNavigation.Fecha" Header="Fecha Entrega" IsSmart="True" Width="140" SoloLectura="True" >
<dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy HH:mm"/>
</dxg:GridColumn.EditSettings>
</tsWPF:tsGridColumn>
<tsWPF:tsGridColumn FieldName="Observaciones" IsSmart="True" Width="250" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="idAlbaranNavigation.Obra" Header="Obra" Width="300" SoloLectura="True" />
</tsWPF:tsGridControl>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="10" />
<RowDefinition Height="*" />
<RowDefinition Height="10" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Button Grid.Column="1" x:Name="btAceptar" Grid.Row="1" Width="100" IsDefault="True" Click="btAceptar_Click" TabIndex="0">Aceptar</Button>
<Button Grid.Column="3" x:Name="btCancelar" Grid.Row="1" Width="100" IsCancel="True" Click="btCancelar_Click" TabIndex="1">Cancelar</Button>
</Grid>
</Grid>
</dx:DXWindow>

View File

@@ -0,0 +1,85 @@
Imports bdGrupoSanchoToro
Imports bdGrupoSanchoToro.db
Imports DevExpress.Xpf.Core
Public Class dxwRecogidaProductos
Private _LDetalleActual As Integer()
Public LSeleccionados As List(Of detallesalbaranes)
Private _idEntidad As Integer
Private _bd As tscGrupoSanchoToro
Private Sub btAceptar_Click(sender As Object, e As RoutedEventArgs)
LSeleccionados = gc.ElementosSeleccionados.Cast(Of detallesalbaranes).ToList
Me.DialogResult = True
Me.Close()
End Sub
Private Sub btCancelar_Click(sender As Object, e As RoutedEventArgs)
Me.DialogResult = False
Me.Close()
End Sub
Private Sub dxwRecogidaProductos_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Try
Dim ld = _bd.detallesalbaranes.Include(Function(x) x.idAlbaranNavigation).Include(Function(x) x.idAlbaranRecogidaNavigation).Include(Function(x) x.idProductoNavigation) _
.Where(Function(x) x.idAlbaranNavigation.idEntidad.HasValue AndAlso x.idAlbaranNavigation.idEntidad.Value = _idEntidad AndAlso x.FechaCancelacion.HasValue = False AndAlso x.EsVenta = False AndAlso (x.idAlbaranRecogida.HasValue = False OrElse _LDetalleActual.Contains(x.idDetalle))).ToList()
Me.gc.ItemsSource = ld
'For i = 0 To ld.Count
Dim i As Integer
For Each d In ld
If _LDetalleActual.Any(Function(x) x = d.idDetalle) Then
Dim rowHandle As Integer = gc.GetRowHandleByListIndex(i)
gc.SelectItem(rowHandle)
End If
i += 1
Next
Me.gc.View.SearchControl.Focus()
Catch ex As Exception
DXMessageBox.Show(ex.Message, "Error")
Finally
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
End Try
End Sub
'Public Sub New(bd As m3alquileresEntities, Existentes As List(Of Integer?))
Public Sub New(bd As tscGrupoSanchoToro, ListaDetalleActuales As Integer(), idCliente As Integer)
' Llamada necesaria para el diseñador.
InitializeComponent()
Comun.EscalaVentana(Me, Me.grid.LayoutTransform)
'Me.Height = Math.Min(Comun.dwi.Height, Me.Height * UsuarioActual.Escala.Value)
'Me.Width = Math.Min(Comun.dwi.Width, Me.Width * UsuarioActual.Escala.Value)
'Dim scaler = TryCast(Me.grid.LayoutTransform, ScaleTransform)
'If scaler Is Nothing Then
' scaler = New ScaleTransform(1.0, 1.0)
' Me.grid.LayoutTransform = scaler
'End If
'scaler.ScaleX = UsuarioActual.Escala.Value
'scaler.ScaleY = UsuarioActual.Escala.Value
'scaler.BeginAnimation(ScaleTransform.ScaleXProperty, Nothing)
'scaler.BeginAnimation(ScaleTransform.ScaleYProperty, Nothing)
_LDetalleActual = ListaDetalleActuales
_idEntidad = idCliente
_bd = bd
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
End Sub
Private Sub dxw_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles Me.PreviewKeyDown
If e.Key = Key.Enter Then
btAceptar_Click(Nothing, Nothing)
End If
End Sub
Private Sub tv_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs) Handles tv.MouseDoubleClick
btAceptar_Click(Nothing, Nothing)
End Sub
End Class

View File

@@ -0,0 +1,47 @@
<dx:DXWindow x:Class="dxwTipoAlbaran"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:tsWPF="clr-namespace:tsWPFCore;assembly=tsWPFCore"
xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" ShowInTaskbar="True"
ShowIcon="False" Title="Seleccione y Pulse Aceptar" WindowStyle="ToolWindow" WindowState="Normal" Topmost="True" WindowStartupLocation="CenterScreen" Width="400" Height="200">
<dx:DXWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/tsWPFCore;component/Plantillas.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</dx:DXWindow.Resources>
<Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="45" />
</Grid.RowDefinitions>
<tsWPF:tsGridControl x:Name="gc" TabIndex="1" >
<tsWPF:tsGridControl.View>
<tsWPF:tsTableView x:Name="tv" ShowSearchPanelMode="Never" AllowEditing="False" ShowGroupPanel="False" />
</tsWPF:tsGridControl.View>
<dxg:GridColumn FieldName="Descripcion" Header="Tipo Albarán" IsSmart="True" Width="350" />
</tsWPF:tsGridControl>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="10" />
<RowDefinition Height="*" />
<RowDefinition Height="10" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Button Grid.Column="1" x:Name="btAceptar" Grid.Row="1" Width="100" IsDefault="True" Click="btAceptar_Click" TabIndex="2">Aceptar</Button>
<Button Grid.Column="3" x:Name="btCancelar" Grid.Row="1" Width="100" IsCancel="True" Click="btCancelar_Click" TabIndex="3">Cancelar</Button>
</Grid>
</Grid>
</dx:DXWindow>

View File

@@ -0,0 +1,59 @@
Imports System.Data.Entity
Imports bdGrupoSanchoToro.db
Imports DevExpress.Xpf.Core
Imports bdGrupoSanchoToro.db.Utilidades
Imports bdGrupoSanchoToro
Public Class dxwTipoAlbaran
Friend Tipo As albaranes.TipoAlbaranEnum
Private Sub btAceptar_Click(sender As Object, e As RoutedEventArgs)
If gc.CurrentItem IsNot Nothing Then
Tipo = DirectCast(gc.CurrentItem, albaranes.TipoAlbaranEnum)
Me.DialogResult = True
Me.Close()
End If
End Sub
Private Sub btCancelar_Click(sender As Object, e As RoutedEventArgs)
Me.DialogResult = False
Me.Close()
End Sub
Private Sub dxwproductos_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Try
gc.ItemsSource = tsUtilidades.DescripcionValor.EnumADescripcionValor(GetType(bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum))
Me.gc.View.Focus()
Catch ex As Exception
DXMessageBox.Show(ex.Message, "Error")
Finally
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
End Try
End Sub
'Public Sub New(bd As m3academiaEntities, Existentes As List(Of Integer?))
Public Sub New()
' Llamada necesaria para el diseñador.
InitializeComponent()
Comun.EscalaVentana(Me, Me.grid.LayoutTransform)
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
End Sub
Private Sub dxw_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles Me.PreviewKeyDown
If e.Key = Key.Enter Then
btAceptar_Click(Nothing, Nothing)
End If
End Sub
Private Sub tv_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs) Handles tv.MouseDoubleClick
btAceptar_Click(Nothing, Nothing)
End Sub
End Class

View File

@@ -120,6 +120,8 @@ Public Class ucAlbaran
_idAlbaran = Nothing
ra.Fecha = DateOnly.FromDateTime(Today)
ra.NumeroBultos = 1
ra.idEmpresa = EmpresaActual.idEmpresa
ra.Tipo = _Tipo
NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo
Else
ra = bd.albaranes.First(Function(x) x.idAlbaran = _idAlbaran)
@@ -182,8 +184,8 @@ Public Class ucAlbaran
' Return "idAlbaranEntrega"
' End Get
'End Property
Public Sub New(Optional idAlbaran As Integer? = Nothing)
Private _Tipo As TipoAlbaranEnum
Public Sub New(Tipo As albaranes.TipoAlbaranEnum, Optional idAlbaran As Integer? = Nothing)
' Llamada necesaria para el diseñador.
InitializeComponent()
@@ -584,7 +586,7 @@ Public Class ucAlbaran
' bCancelar = Me.Guardar(Nothing, Nothing,, True, 5)
' End If
' If Not bCancelar Then
' Dim dxnc = New dxwEnvioCorreo(ra.entidades.Email, ra.entidades.Email2, "", "Producciones Romian, S.L. - Adjunto le remitimos albarán de entrega nº " & ra.NumeroAlbaran, "Distinguidos Sres., " & vbCrLf & "Adjunto le remitimos albarán entrega nº " & ra.NumeroAlbaran, "AlbaranEntrega_" & ra.NumeroAlbaran.Replace("/", "-") & ".pdf")
' Dim dxnc = New dxwEnvioCorreo(ra.entidades.Email, ra.entidades.Email2, "", "Producciones SanchoToro, S.L. - Adjunto le remitimos albarán de entrega nº " & ra.NumeroAlbaran, "Distinguidos Sres., " & vbCrLf & "Adjunto le remitimos albarán entrega nº " & ra.NumeroAlbaran, "AlbaranEntrega_" & ra.NumeroAlbaran.Replace("/", "-") & ".pdf")
' If dxnc.ShowDialog Then
' Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "DEFECTO")
' Dim bAlbaran = GeneraPdfAlbaran(bd, ra)
@@ -742,22 +744,26 @@ Public Class ucAlbaran
Else
ra.idUsuario = bdGrupoSanchoToro.db.Utilidades.idUsuario
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
Select Case Estado
Case tsUtilidades.EstadosAplicacion.Nuevo
For Each d In ra.detallesalbaranesidAlbaranNavigation
d.idAlbaranNavigation = ra
d.ActualizaProducto(bdtmp, 1)
d.ActualizaProducto(bdtmp, ra.Tipo, 1, ra.idEmpresa)
Next
Case tsUtilidades.EstadosAplicacion.ModificandoRegistro
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList
For Each d In das
d.ActualizaProducto(bdtmp, -1)
If d.idAlbaranNavigation Is Nothing Then d.idAlbaranNavigation = ra
d.ActualizaProducto(bdtmp, d.idAlbaranNavigation.Tipo, -1, d.idAlbaranNavigation.idEmpresa)
If d.idAlbaranRecogida.HasValue Then d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, -1, ra.idEmpresa)
Next
For Each d In ra.detallesalbaranesidAlbaranNavigation
d.ActualizaProducto(bdtmp, 1)
If d.idAlbaranNavigation Is Nothing Then d.idAlbaranNavigation = ra
d.ActualizaProducto(bdtmp, d.idAlbaranNavigation.Tipo, 1, d.idAlbaranNavigation.idEmpresa)
If d.idAlbaranRecogida.HasValue Then d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, 1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next
End Select
bdtmp.GuardarCambios()
End If
End Sub
@@ -765,8 +771,10 @@ Public Class ucAlbaran
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList
For Each d In das
d.ActualizaProducto(bdtmp, -1)
d.ActualizaProducto(bdtmp, d.idAlbaranNavigation.Tipo, -1, d.idAlbaranNavigation.idEmpresa)
If d.idAlbaranRecogida.HasValue Then d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, -1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next
bdtmp.SaveChanges()
End Sub
Private Sub btIrAContrato_Click(sender As Object, e As RoutedEventArgs)

View File

@@ -7,7 +7,7 @@
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:tsWPF="clr-namespace:tsWPFCore;assembly=tsWPFCore" xmlns:Serialization="clr-namespace:DevExpress.Xpf.LayoutControl.Serialization;assembly=DevExpress.Xpf.LayoutControl.v23.2" x:Class="ucAlbaranE"
xmlns:tsWPF="clr-namespace:tsWPFCore;assembly=tsWPFCore" xmlns:Serialization="clr-namespace:DevExpress.Xpf.LayoutControl.Serialization;assembly=DevExpress.Xpf.LayoutControl.v23.2" x:Class="ucAlbaranR"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="1366">
<UserControl.Resources>
<ResourceDictionary>
@@ -30,8 +30,8 @@
</tsWPF:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit EditValue="{Binding NumeroAlbaran, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="100" NullText="« AUTOMÁTICO »" />
</tsWPF:tsLayoutItem>
<tsWPF:tsLayoutItem Label="Nº Pedido:">
<dxe:ButtonEdit x:Name="beContrato" EditValue="{Binding NumeroPedido, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="12" DefaultButtonClick="beContrato_DefaultButtonClick">
<tsWPF:tsLayoutItem Label="Nº Contrato:">
<dxe:ButtonEdit x:Name="beContrato" EditValue="{Binding NumeroContrato, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="12" DefaultButtonClick="beContrato_DefaultButtonClick">
<dxe:ButtonInfo GlyphKind="Search" x:Name="btIrAContrato" Click="btIrAContrato_Click" />
<dxe:ButtonInfo GlyphKind="Cancel" x:Name="btQuitarContrato" Click="btQuitarContrato_Click" />
</dxe:ButtonEdit>
@@ -55,12 +55,12 @@
<tsWPF:tsLayoutItem Label="Tipo:">
<tsWPF:tsLayoutItem.PropiedadesTS>
<tsWPF:PropiedadesTS />
<tsWPF:PropiedadesTS Modificable="NoModificable" />
</tsWPF:tsLayoutItem.PropiedadesTS>
<dxe:ComboBoxEdit x:Name="cbTipo" AutoComplete="True" DisplayMember="Descripcion" ValueMember="Valor" EditValue="{Binding Tipo, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="4" AllowNullInput="True" />
</tsWPF:tsLayoutItem>
</dxlc:LayoutGroup>
<tsWPF:tsLayoutItem Label="Cliente:">
<tsWPF:tsLayoutItem Label="Cliente/Proveedor:">
<tsWPF:tsLayoutItem.PropiedadesTS>
<tsWPF:PropiedadesTS />
</tsWPF:tsLayoutItem.PropiedadesTS>
@@ -96,6 +96,12 @@
</tsWPF:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit EditValue="{Binding Usuario, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="100" />
</tsWPF:tsLayoutItem>
<tsWPF:tsLayoutItem Label="Almacén Destino:">
<tsWPF:tsLayoutItem.PropiedadesTS>
<tsWPF:PropiedadesTS />
</tsWPF:tsLayoutItem.PropiedadesTS>
<dxe:ComboBoxEdit x:Name="cbAlmacenDestino" AutoComplete="True" DisplayMember="Descripcion" ValueMember="idAlmacen" EditValue="{Binding idAlmacenDestino, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="4" AllowNullInput="True" />
</tsWPF:tsLayoutItem>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
@@ -305,78 +311,27 @@
</dx:DXTabControl.View>
<dx:DXTabItem Header="Productos">
<dxlc:LayoutGroup Orientation="Vertical">
<tsWPF:tsGridControl x:Name="gcProductos" TabIndex="31">
<tsWPF:tsGridControl.PropiedadesTSGC>
<tsWPF:PropiedadesTSGC CamposObligatorios="Cantidad,idProducto" />
</tsWPF:tsGridControl.PropiedadesTSGC>
<tsWPF:tsGridControl x:Name="gcProductos" TabIndex="13">
<tsWPF:tsGridControl.PropiedadesTS>
<tsWPF:PropiedadesTS />
</tsWPF:tsGridControl.PropiedadesTS>
<tsWPF:tsGridControl.View>
<tsWPF:tsTableView x:Name="tvProductos" ShowGroupPanel="False" NewItemRowPosition="Bottom">
<tsWPF:tsTableView x:Name="tvProductos" ShowGroupPanel="False" TabIndex="13" AllowSorting="False">
</tsWPF:tsTableView>
</tsWPF:tsGridControl.View>
<dxg:GridColumn FieldName="idProducto" Header="Producto" Width="400">
<dxg:GridColumn.EditSettings>
<dxe:ComboBoxEditSettings x:Name="cbProducto" ValueMember="idProducto" DisplayMember="Descripcion" AllowDefaultButton="False" AutoComplete="True">
<dxe:ComboBoxEditSettings.Buttons>
<dxe:ButtonInfo x:Name="biBuscarProducto" GlyphKind="Search" IsDefaultButton="False" Click="BiBuscarProducto_Click" />
</dxe:ComboBoxEditSettings.Buttons>
</dxe:ComboBoxEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn FieldName="idArticulo" Header="Artículo" Width="100">
<dxg:GridColumn.EditSettings>
<dxe:ComboBoxEditSettings x:Name="cbArticulo" ValueMember="idArticulo" DisplayMember="CodigoArticulo" AllowDefaultButton="False" AutoComplete="False">
<dxe:ComboBoxEditSettings.Buttons>
<dxe:ButtonInfo x:Name="biBuscarArticulo" GlyphKind="Search" IsDefaultButton="False" Click="BiBuscarArticulo_Click" />
</dxe:ComboBoxEditSettings.Buttons>
</dxe:ComboBoxEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn FieldName="Cantidad" Header="Cantidad" IsSmart="True" Width="70">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn FieldName="EsVenta" IsSmart="True" Width="100" x:Name="gcEsVenta">
<dxg:GridColumn.EditSettings>
<dxe:CheckEditSettings IsThreeState="False">
</dxe:CheckEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<tsWPF:tsGridColumn FieldName="Producto" Header="Producto" Width="400" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="Articulo" Header="Artículo" Width="100" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="Observaciones" Header="Observaciones" IsSmart="True" Width="380" />
<tsWPF:tsGridColumn FieldName="idAlbaranRecogidaNavigation.NumeroAlbaran" Header="Nº Albaran Recogida" IsSmart="True" Width="130" CellTemplate="{DynamicResource VerDetalleTemplate}" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="id.Fecha" Header="Fecha Recogida" IsSmart="True" Width="140" SoloLectura="True">
<tsWPF:tsGridColumn FieldName="idAlbaranNavigation.NumeroAlbaran" Header="Nº Albarán Entrega" IsSmart="True" Width="120" CellTemplate="{DynamicResource VerDetalleTemplate}" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="idAlbaranNavigation.Fecha" Header="Fecha Entrega" IsSmart="True" Width="140" SoloLectura="True">
<dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy HH:mm" />
</dxg:GridColumn.EditSettings>
</tsWPF:tsGridColumn>
<tsWPF:tsGridColumn FieldName="facturas.NumeroFactura" Header="Nº Última Fra." IsSmart="True" Width="100" CellTemplate="{DynamicResource VerDetalleTemplate}" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="facturas.FechaCalculoDias" Header="Fecha Último Cálculo" IsSmart="True" Width="150" SoloLectura="True">
<dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy" />
</dxg:GridColumn.EditSettings>
</tsWPF:tsGridColumn>
<tsWPF:tsGridColumn FieldName="FechaCancelacion" Header="Fecha Cancelación" IsSmart="True" Width="150" SoloLectura="True">
<dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy" />
</dxg:GridColumn.EditSettings>
</tsWPF:tsGridColumn>
<tsWPF:tsGridColumn FieldName="MotivoCancelacion" Header="Motivo Cancelación" IsSmart="True" Width="200" />
<!--<dxg:GridColumn FieldName="PendienteFacturarHoy" Header="Pendiente Facturar Hoy" IsSmart="True" Width="160" >
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="c2" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<tsWPF:tsGridControl.GroupSummary>
<dxg:GridSummaryItem FieldName="PendienteFacturarHoy" SummaryType="Sum" ShowInGroupColumnFooter="PendienteFacturarHoy" DisplayFormat=" {0:c2}"/>
</tsWPF:tsGridControl.GroupSummary>
<tsWPF:tsGridControl.TotalSummary>
<dxg:GridSummaryItem FieldName="PendienteFacturarHoy" SummaryType="Sum" ShowInGroupColumnFooter="PendienteFacturarHoy" DisplayFormat=" {0:c2}"/>
</tsWPF:tsGridControl.TotalSummary>-->
<tsWPF:tsGridColumn FieldName="Cantidad" Header="Unidades Entregadas" IsSmart="True" Width="140" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="UnidadesRecogidasTmp" Header="Unidades Recogidas" IsSmart="True" Width="140" />
<tsWPF:tsGridColumn FieldName="idAlbaranNavigation.Obra" Header="Obra" Width="500" SoloLectura="True" />
</tsWPF:tsGridControl>
</dxlc:LayoutGroup>
</dx:DXTabItem>

View File

@@ -19,11 +19,11 @@ Imports bdGrupoSanchoToro.db.Utilidades
Imports System.Drawing
Imports bdGrupoSanchoToro.db.albaranes
Public Class ucAlbaranE
Public Class ucAlbaranR
Private bd As tscGrupoSanchoToro
Friend _idAlbaran As Nullable(Of Integer)
Private lProductos As List(Of productos)
Private lArticulos As List(Of articulos)
'Private lProductos As List(Of productos)
'Private lArticulos As List(Of articulos)
Friend idLog As Integer?
@@ -35,10 +35,10 @@ Public Class ucAlbaranE
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
Try
lProductos = bd.productos.OrderBy(Function(x) x.Descripcion).ToList
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
'lProductos = bd.productos.OrderBy(Function(x) x.Descripcion).ToList
'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
cbRazonSocial.ItemsSource = bd.entidades.Where(Function(X) X.FechaBaja.HasValue = False OrElse X.idEntidad = ra.idEntidad).ToList.Select(Function(x) New With {x.idEntidad, x.RazonSocial}).OrderBy(Function(x) x.RazonSocial).ToList
@@ -51,13 +51,8 @@ Public Class ucAlbaranE
Dim Acciones As New List(Of tsWPFCore.Accion)
Acciones.Add(New Accion With {
.idAccion = 1,
.Descripcion = "GENERA ALBARÁN DE RECOGIDA Y FACTURA RÁPIDA (F10)"})
Acciones.Add(New Accion With {
.idAccion = 3,
.Descripcion = "GENERA ALBARÁN DE RECOGIDA DE PRODUCTOS PENDIENTES (F11)"})
Acciones.Add(New Accion With {
.idAccion = 2,
.Descripcion = "ENVIAR ALBARÁN POR CORREO ELECTRÓNICO (F12)"})
.Descripcion = "AGREGA PRODUCTOS AL ALBARAN F9"})
Me.ContenedorAplicacion.cbAcciones.ItemsSource = Acciones
Me.ContenedorAplicacion.beAcciones.EditValue = Acciones.First.idAccion
@@ -118,6 +113,8 @@ Public Class ucAlbaranE
_idAlbaran = Nothing
ra.Fecha = DateOnly.FromDateTime(Today)
ra.NumeroBultos = 1
ra.idEmpresa = EmpresaActual.idEmpresa
ra.Tipo = _Tipo
NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo
Else
ra = bd.albaranes.First(Function(x) x.idAlbaran = _idAlbaran)
@@ -127,9 +124,10 @@ Public Class ucAlbaranE
If Me.cbTipo.ItemsSource Is Nothing Then
cbTipo.ItemsSource = tsUtilidades.DescripcionValor.EnumADescripcionValor(GetType(bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum))
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.detallesalbaranesidAlbaranNavigation
gcProductos.ItemsSource = ra.detallesalbaranesidAlbaranRecogidaNavigation
Me.DataContext = ra
Return NuevoEstado
Catch ex As Exception
@@ -179,11 +177,12 @@ Public Class ucAlbaranE
' Return "idAlbaranEntrega"
' End Get
'End Property
Public Sub New(Optional idAlbaran As Integer? = Nothing)
Private _Tipo As albaranes.TipoAlbaranEnum
Public Sub New(Tipo As albaranes.TipoAlbaranEnum, Optional idAlbaran As Integer? = Nothing)
' Llamada necesaria para el diseñador.
InitializeComponent()
_idAlbaran = idAlbaran
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
@@ -365,38 +364,19 @@ Public Class ucAlbaranE
Private Sub ap_EstadoCambiado(EstadoAnterior As tsUtilidades.EstadosAplicacion, EstadoNuevo As tsUtilidades.EstadosAplicacion) Handles Me.EstadoCambiado
If idLog.HasValue Then EstableceSoloLectura()
Select Case EstadoNuevo
Case tsUtilidades.EstadosAplicacion.ModificandoRegistro
If ra.Tipo = TipoAlbaranEnum.COMPRA Then
gcEsVenta.ReadOnly = True
Else
gcEsVenta.ReadOnly = False
End If
End Select
'Select Case EstadoNuevo
' Case tsUtilidades.EstadosAplicacion.ModificandoRegistro
' If ra.Tipo = TipoAlbaranEnum.COMPRA Then
' gcEsVenta.ReadOnly = True
' Else
' gcEsVenta.ReadOnly = False
' End If
'End Select
End Sub
Private Sub BiBuscarProducto_Click(sender As Object, e As RoutedEventArgs)
If tvProductos.ActiveEditor Is Nothing Then
Dispatcher.BeginInvoke(New Action(Sub() tvProductos.ShowEditor()), System.Windows.Threading.DispatcherPriority.Render)
End If
Dim dxw As New dxwProductos(lProductos)
If dxw.ShowDialog Then
Dim dea As detallesalbaranes = gcProductos.CurrentItem
Dim prod = lProductos.First(Function(x) x.idProducto = dxw.idProducto)
If tvProductos.ActiveEditor IsNot Nothing Then
tvProductos.ActiveEditor.EditValue = prod.idProducto
Else
Debug.Write("no")
End If
tvProductos.PostEditor()
tvProductos.CloseEditor()
gcProductos.RefreshRow(tvProductos.FocusedRowHandle)
End If
End Sub
Private Sub BiBuscarCliente_Click(sender As Object, e As RoutedEventArgs)
'If Me.Estado = EstadosAplicacion.Nuevo Then
Dim dxw As New dxwEntidades(bd, True, False)
@@ -410,16 +390,6 @@ Public Class ucAlbaranE
Private Sub RellenaDatosProducto(dea As detallesalbaranes)
If dea IsNot Nothing AndAlso dea.idProducto <> 0 Then
Dim ae As albaranes = Me.DataContext
Dim pr = lProductos.First(Function(x) x.idProducto = dea.idProducto)
If dea.Cantidad = 0 Then dea.Cantidad = 1
dea.EsVenta = False
End If
End Sub
@@ -537,6 +507,34 @@ Public Class ucAlbaranE
End Sub
Private Sub ucAlbaranEntrega_EjecutarAccion(sender As Object, e As ItemClickEventArgs, idAccion As Integer) Handles Me.EjecutarAccion
Select Case idAccion
Case 1 'AGREGA PRODUCTOS AL ALBARAN F9
Dim ldet = ra.detallesalbaranesidAlbaranRecogidaNavigation
Dim ld = ldet.Select(Function(x) x.idDetalle).ToArray
If ra.idEntidad.HasValue Then
Dim dxw As New dxwRecogidaProductos(bd, ld, ra.idEntidad)
If dxw.ShowDialog Then
For Each d In dxw.LSeleccionados
If Not ldet.Any(Function(x) x.idDetalle = d.idDetalle) Then
ldet.Add(d)
End If
Next
Dim ldq = ldet.Except(dxw.LSeleccionados).ToList
For Each d In ldq
ldet.Remove(ldet.First(Function(x) x.idDetalle = d.idDetalle))
Next
'Me.gcProductos.ItemsSource = ldet.OrderBy(Function(x) x.idDetalleAlbaran).ToList
' Me.gcProductos.ItemsSource = ldet.OrderBy(Function(x) x.idProductoNavigation.Descripcion).ThenBy(Function(x) x.idDetalle).ToList
'ra.detallealbaranentrega.OrderBy(Function(x) x.productos.Descripcion).ThenBy(Function(x) x.idDetalleAlbaran).ToList
gcProductos.RefreshData()
End If
Else
DXMessageBox.Show("Antes seleccione el cliente", "Atención")
End If
End Select
'Select Case idAccion
' Case 1 ' GENERA ALBARÁN DE RECOGIDA Y FACTURA RAPIDA
' Try
@@ -573,7 +571,7 @@ Public Class ucAlbaranE
' bCancelar = Me.Guardar(Nothing, Nothing,, True, 5)
' End If
' If Not bCancelar Then
' Dim dxnc = New dxwEnvioCorreo(ra.entidades.Email, ra.entidades.Email2, "", "Producciones Romian, S.L. - Adjunto le remitimos albarán de entrega nº " & ra.NumeroAlbaran, "Distinguidos Sres., " & vbCrLf & "Adjunto le remitimos albarán entrega nº " & ra.NumeroAlbaran, "AlbaranEntrega_" & ra.NumeroAlbaran.Replace("/", "-") & ".pdf")
' Dim dxnc = New dxwEnvioCorreo(ra.entidades.Email, ra.entidades.Email2, "", "Producciones SanchoToro, S.L. - Adjunto le remitimos albarán de entrega nº " & ra.NumeroAlbaran, "Distinguidos Sres., " & vbCrLf & "Adjunto le remitimos albarán entrega nº " & ra.NumeroAlbaran, "AlbaranEntrega_" & ra.NumeroAlbaran.Replace("/", "-") & ".pdf")
' If dxnc.ShowDialog Then
' Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "DEFECTO")
' Dim bAlbaran = GeneraPdfAlbaran(bd, ra)
@@ -633,42 +631,49 @@ Public Class ucAlbaranE
Private Sub ucAlbaranEntrega_CampoActualizado(sender As Object, e As DataTransferEventArgs) Handles Me.CampoActualizado
Dim pts As PropiedadesTS = sender.parent.propiedadests
If Not pts Is Nothing Then
'Private Sub ucAlbaranEntrega_CampoActualizado(sender As Object, e As DataTransferEventArgs) Handles Me.CampoActualizado
' Dim pts As PropiedadesTS = sender.parent.propiedadests
' If Not pts Is Nothing Then
Select Case pts.NombreCampo.ToLower
Case "tipo"
gcEsVenta.ReadOnly = False
Select Case DirectCast(ra.Tipo, bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.COMPRA
For Each d In ra.detallesalbaranesidAlbaranNavigation.Where(Function(x) x.EsVenta)
d.EsVenta = False
Next
gcEsVenta.ReadOnly = True
ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.CAMBIO_ALMACEN
EstableceSoloLectura(cbAlmacenOrigen, False)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.SUBALQUILER
ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER
EstableceSoloLectura(cbAlmacenOrigen, False)
ra.idAlmacenDestino = Nothing
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.ENTREGA
EstableceSoloLectura(cbAlmacenOrigen, False)
ra.idAlmacenDestino = Nothing
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.RECOGIDA
ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK
ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True)
End Select
End Select
End If
End Sub
' Select Case pts.NombreCampo.ToLower
' Case "tipo"
' gcEsVenta.ReadOnly = False
' Select Case DirectCast(ra.Tipo, bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum)
' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.COMPRA
' For Each d In ra.detallesalbaranesidAlbaranNavigation.Where(Function(x) x.EsVenta)
' d.EsVenta = False
' Next
' gcEsVenta.ReadOnly = True
' ra.idAlmacenOrigen = Nothing
' EstableceSoloLectura(cbAlmacenOrigen, True)
' EstableceSoloLectura(cbAlmacenDestino, False)
' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.CAMBIO_ALMACEN
' EstableceSoloLectura(cbAlmacenOrigen, False)
' EstableceSoloLectura(cbAlmacenDestino, False)
' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.SUBALQUILER
' ra.idAlmacenOrigen = Nothing
' EstableceSoloLectura(cbAlmacenOrigen, True)
' EstableceSoloLectura(cbAlmacenDestino, False)
' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER
' EstableceSoloLectura(cbAlmacenOrigen, False)
' ra.idAlmacenDestino = Nothing
' EstableceSoloLectura(cbAlmacenDestino, True)
' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.ENTREGA
' EstableceSoloLectura(cbAlmacenOrigen, False)
' ra.idAlmacenDestino = Nothing
' EstableceSoloLectura(cbAlmacenDestino, True)
' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.RECOGIDA
' ra.idAlmacenOrigen = Nothing
' EstableceSoloLectura(cbAlmacenOrigen, True)
' EstableceSoloLectura(cbAlmacenDestino, False)
' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK
' ra.idAlmacenOrigen = Nothing
' EstableceSoloLectura(cbAlmacenOrigen, True)
' EstableceSoloLectura(cbAlmacenDestino, False)
' End Select
' End Select
' End If
'End Sub
Private Sub hlVale_Click(sender As Object, e As RoutedEventArgs)
@@ -699,20 +704,6 @@ Public Class ucAlbaranE
Private Sub ucAlbaran_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, EliminacionManual As Integer) Handles Me.AntesGuardar
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.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")
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.CAMBIO_ALMACEN
If ra.idAlmacenOrigen.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_ORIGEN_OBLIGATORIO", "El almacén origen es obligatorio")
If ra.idAlmacenDestino.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_DESTINO_OBLIGATORIO", "El almacén destino es obligatorio")
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.SUBALQUILER
If ra.idAlmacenDestino.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_DESTINO_OBLIGATORIO", "El almacén destino es obligatorio")
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER
If ra.idAlmacenOrigen.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_ORIGEN_OBLIGATORIO", "El almacén origen es obligatorio")
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.ENTREGA
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.REGULARIZACION_STOCK
@@ -723,32 +714,52 @@ Public Class ucAlbaranE
Cancelar = True
Else
ra.idUsuario = bdGrupoSanchoToro.db.Utilidades.idUsuario
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
Dim lds As List(Of detallesalbaranes) = Me.gcProductos.ItemsSource
Dim dad = lds.Where(Function(x) x.UnidadesRecogidasTmp < x.Cantidad).ToList
For Each d In dad
Dim nd As New detallesalbaranes
With nd
.Cantidad = d.Cantidad - d.UnidadesRecogidasTmp
.idAlbaran = d.idAlbaran
.idArticulo = d.idArticulo
.idProducto = d.idProducto
.idUltimaFactura = d.idUltimaFactura
.Observaciones = d.Observaciones
.EsVenta = False
.idAlbaranRecogida = Nothing
End With
bd.detallesalbaranes.Add(nd)
d.Cantidad = d.UnidadesRecogidasTmp
Next
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
Select Case Estado
Case tsUtilidades.EstadosAplicacion.Nuevo
For Each d In ra.detallesalbaranesidAlbaranNavigation
d.idAlbaranNavigation = ra
d.ActualizaProducto(bdtmp, 1)
For Each d In ra.detallesalbaranesidAlbaranRecogidaNavigation
d.idAlbaranRecogidaNavigation = ra
d.ActualizaProducto(bdtmp, ra.Tipo, 1, ra.idEmpresa)
Next
Case tsUtilidades.EstadosAplicacion.ModificandoRegistro
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaranRecogida = ra.idAlbaran).ToList
For Each d In das
d.ActualizaProducto(bdtmp, -1)
d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, -1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next
For Each d In ra.detallesalbaranesidAlbaranNavigation
d.ActualizaProducto(bdtmp, 1)
For Each d In ra.detallesalbaranesidAlbaranRecogidaNavigation
If d.idAlbaranRecogidaNavigation Is Nothing Then d.idAlbaranRecogidaNavigation = ra
d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, 1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next
End Select
bdtmp.GuardarCambios()
End If
End Sub
Private Sub ucAlbaran_AntesEliminar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, ByRef OmitirPreguntaContinuar As Boolean) Handles Me.AntesEliminar
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaranRecogida = ra.idAlbaran).ToList
For Each d In das
d.ActualizaProducto(bdtmp, -1)
d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, -1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next
bdtmp.SaveChanges()
End Sub
Private Sub btIrAContrato_Click(sender As Object, e As RoutedEventArgs)
@@ -763,46 +774,32 @@ Public Class ucAlbaranE
ra.idPresupuestoNavigation = Nothing
End Sub
Private Sub tvProductos_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles tvProductos.PreviewKeyDown
If e.Key = Key.F6 Then
'Private Sub BiBuscarArticulo_Click(sender As Object, e As RoutedEventArgs)
If Not ra.detallesalbaranesidAlbaranNavigation.ToList.Any(Function(x) x.idAlbaranRecogida.HasValue OrElse (x.idUltimaFactura.HasValue AndAlso (x.idUltimaFacturaNavigation.FechaFactura > ra.Fecha))) Then
Select Case gcProductos.CurrentColumn.FieldName.ToLower
Case "idproducto"
BiBuscarProducto_Click(Nothing, Nothing)
Case "idarticulo"
BiBuscarArticulo_Click(Nothing, Nothing)
End Select
End If
End If
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
' 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

View File

@@ -67,20 +67,20 @@
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn FieldName="DescripcionEvento" Header="Evento" Width="400" IsSmart="True" />
<dxg:GridColumn FieldName="DescripcionObra" Header="Obra" Width="400" IsSmart="True" />
<dxg:GridColumn FieldName="Usuario" Header="Usuario" Width="250" IsSmart="True" />
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView x:Name="tv" ShowSearchPanelMode="Always" ShowGroupPanel="True" ShowTotalSummary="True">
<dxg:TableView.FormatConditions>
<dxg:FormatCondition Expression="[Tipo]==2" FieldName="{x:Null}">
<dxg:Format Foreground="Green" />
<dx:Format Foreground="Green" />
</dxg:FormatCondition>
<dxg:FormatCondition Expression="[Tipo]==3 OrElse [Tipo]==4" FieldName="{x:Null}">
<dxg:Format Foreground="DarkOrange" />
<dx:Format Foreground="DarkOrange" />
</dxg:FormatCondition>
<dxg:FormatCondition Expression="[Tipo]>99" FieldName="{x:Null}">
<dxg:Format Foreground="Blue" />
<dx:Format Foreground="Blue" />
</dxg:FormatCondition>
</dxg:TableView.FormatConditions>

View File

@@ -92,7 +92,15 @@ Public Class ucAlbaranes
End Function
Private Sub Nuevo() Handles Me.BotonNuevoPulsado
FuncionesDinamicas.AbrirAP(New ucAlbaran, OtrosParametros)
Dim dxwta As New dxwTipoAlbaran
If dxwta.ShowDialog Then
If dxwta.Tipo = db.albaranes.TipoAlbaranEnum.RECOGIDA Or dxwta.Tipo = db.albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER Then
FuncionesDinamicas.AbrirAP(New ucAlbaranR(dxwta.Tipo), OtrosParametros)
Else
FuncionesDinamicas.AbrirAP(New ucAlbaran(dxwta.Tipo), OtrosParametros)
End If
End If
End Sub
Private Sub ap_Enlazar(Celda As DevExpress.Xpf.Grid.EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
@@ -104,7 +112,13 @@ Public Class ucAlbaranes
Select Case Celda.Column.FieldName.ToLower
Case "numeroalbaran"
Dim id As Integer = ra.idAlbaran
FuncionesDinamicas.AbrirAP(New ucAlbaran(id), OtrosParametros)
Select Case DirectCast(ra.Tipo, albaranes.TipoAlbaranEnum)
Case db.albaranes.TipoAlbaranEnum.RECOGIDA, db.albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER
FuncionesDinamicas.AbrirAP(New ucAlbaranR(ra.Tipo, id), OtrosParametros)
Case Else
FuncionesDinamicas.AbrirAP(New ucAlbaran(ra.Tipo, id), OtrosParametros)
End Select
Case "razonsocial"
Dim id As Integer = ra.idEntidad
FuncionesDinamicas.AbrirAP(New ucEntidad(id), OtrosParametros)
@@ -114,7 +128,7 @@ Public Class ucAlbaranes
End Sub
Public Function ObtieneAlbaranes(TextoBusqueda As String, FechaInicio As DateOnly?, FechaFin As DateOnly?, Tipos As List(Of Integer)) As List(Of v_albaranesextendidos)
Dim rs As IQueryable(Of v_albaranesextendidos)
Dim rs As IQueryable(Of v_albaranesextendidos) = bd.v_albaranesextendidos.Where(Function(x) x.idEmpresa = EmpresaActual.idEmpresa)
Dim la As New List(Of v_albaranesextendidos)
Dim iNumExc As Integer = 0
Do
@@ -122,9 +136,9 @@ Public Class ucAlbaranes
If TextoBusqueda <> "" Then
Dim parametros(0) As Object
Dim ExpresionBusqueda = tsWPFCore.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, Me._CamposBusquedaNumericos, Me._CamposBusquedaAlfabeticos, Nothing)
rs = bd.v_albaranesextendidos.Where(ExpresionBusqueda)
rs = rs.Where(ExpresionBusqueda)
Else
rs = bd.v_albaranesextendidos.AsQueryable
rs = rs.AsQueryable
End If
If FechaInicio.HasValue Then