Compare commits

...

5 Commits

63 changed files with 3491 additions and 692 deletions

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EPPlus" Version="7.5.2" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.14" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="tsUtilidades" Version="1.1.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SanchoToro\bdGrupoSanchoToro\bdGrupoSanchoToro.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,6 @@
@ApiExcelGuadex_HostAddress = http://localhost:5188
GET {{ApiExcelGuadex_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@@ -0,0 +1,88 @@
using ApiDatosGuadex.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Data.Common;
using bdGrupoSanchoToro.dbcontext;
using bdGrupoSanchoToro;
namespace ApiDatosGuadex.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class HomeController : Controller
{
//metodo
[HttpGet("lee")]
public IActionResult LeeSQL(string bd, string sqlh)
{
// bdGestionGuadex.Utilidades.AñadeLog(tsUtilidades.Enumeraciones.TipoLog.Otros, "Inicio Log",null);
Response.ContentType = "text/plain";
try
{
DbConnection? db = null;
switch (bd.ToLower())
{
case "sanchotoro":
{
db = tscGrupoSanchoToro.NuevoContexto().Database.GetDbConnection();
break;
}
//case "guadex":
// {
// db = tscGrupoSanchoToro.NuevoContexto().Database.GetDbConnection();
// break;
// }
}
// string res = tsUtilidades.bbdd.LeeMysql(db, sqlh);
string res = tsUtilidades.bbdd.LeeMysql(db, sqlh);
// termiancion en CRLF
res = res.Replace("\n", "\r\n");
return Content(res, "text/plain", System.Text.Encoding.UTF8);
}
catch (Exception ex)
{
bdGrupoSanchoToro.db.Utilidades.AñadeLog(tsUtilidades.Enumeraciones.TipoLog.Fallo, "Error en LeeSQL", ex.Message, ex);
return Content($"Error: {ex.Message}\r\n", "text/plain", System.Text.Encoding.UTF8);
}
}
public IActionResult EjeSQL(string bd, string sqlh)
{
Response.ContentType = "text/plain";
try
{
DbConnection? db = null;
switch (bd.ToLower())
{
case "sanchotoro":
{
db = tscGrupoSanchoToro.NuevoContexto().Database.GetDbConnection();
break;
}
//case "guadex":
// {
// db = bdGuadex.tscGuadex.NuevoContexto().Database.GetDbConnection();
// break;
// }
}
string res = tsUtilidades.bbdd.EjeMySqlHex(db, sqlh);
// terminacion en CRLF
res = res.Replace("\n", "\r\n");
return Content(res, "text/plain", System.Text.Encoding.UTF8);
}
catch (Exception ex)
{
bdGrupoSanchoToro.db.Utilidades.AñadeLog(tsUtilidades.Enumeraciones.TipoLog.Fallo, "Error en EjeSQL", ex.Message, ex);
return Content($"Error: {ex.Message}\r\n", "text/plain", System.Text.Encoding.UTF8);
}
}
}
}

View File

@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
namespace ApiDatosGuadex.Filtros
{
public class FiltroAutenticacionBasica : Attribute, IAuthorizationFilter
{
private readonly string _usuarioPermitido;
private readonly string _contrasenaPermitida;
public FiltroAutenticacionBasica(IConfiguration configuration)
{
var authSettings = configuration.GetSection("Authentication");
_usuarioPermitido = authSettings["Username"];
_contrasenaPermitida = authSettings["Password"];
}
public void OnAuthorization(AuthorizationFilterContext contexto)
{
var encabezadoAutorizacion = contexto.HttpContext.Request.Headers["Authorization"].ToString();
if (string.IsNullOrEmpty(encabezadoAutorizacion) || !encabezadoAutorizacion.StartsWith("Basic "))
{
contexto.Result = new UnauthorizedResult();
return;
}
var credencialesCodificadas = encabezadoAutorizacion.Substring("Basic ".Length).Trim();
var credencialesDecodificadas = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(credencialesCodificadas));
var partes = credencialesDecodificadas.Split(':');
if (partes.Length != 2 || partes[0] != _usuarioPermitido || partes[1] != _contrasenaPermitida)
{
contexto.Result = new UnauthorizedResult();
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace ApiDatosGuadex.Models
{
public class MensajeViewModel
{
public string Mensaje { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using ApiDatosGuadex.Filtros;
var builder = WebApplication.CreateBuilder(args);
// Agregar servicios al contenedor
builder.Services.AddControllersWithViews();
// Registrar el filtro de autenticaci<63>n como servicio
builder.Services.AddScoped<FiltroAutenticacionBasica>();
// Agregar Swagger
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configuraci<63>n del pipeline de solicitudes HTTP
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAuthorization();
app.MapControllers();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();

View File

@@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:12379",
"sslPort": 44309
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5188",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7029;http://localhost:5188",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,3 @@
@ViewData["Mensaje"]

View File

@@ -0,0 +1,4 @@
@ViewData["Mensaje"]

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -0,0 +1,13 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Authentication": {
"Username": "guadex",
"Password": "tsguadex..-"
}
}

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 _idAlbaran = Nothing
ra.Fecha = DateOnly.FromDateTime(Today) ra.Fecha = DateOnly.FromDateTime(Today)
ra.NumeroBultos = 1 ra.NumeroBultos = 1
ra.idEmpresa = EmpresaActual.idEmpresa
ra.Tipo = _Tipo
NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo
Else Else
ra = bd.albaranes.First(Function(x) x.idAlbaran = _idAlbaran) ra = bd.albaranes.First(Function(x) x.idAlbaran = _idAlbaran)
@@ -182,8 +184,8 @@ Public Class ucAlbaran
' Return "idAlbaranEntrega" ' Return "idAlbaranEntrega"
' End Get ' End Get
'End Property 'End Property
Private _Tipo As TipoAlbaranEnum
Public Sub New(Optional idAlbaran As Integer? = Nothing) Public Sub New(Tipo As albaranes.TipoAlbaranEnum, Optional idAlbaran As Integer? = Nothing)
' Llamada necesaria para el diseñador. ' Llamada necesaria para el diseñador.
InitializeComponent() InitializeComponent()
@@ -584,7 +586,7 @@ Public Class ucAlbaran
' bCancelar = Me.Guardar(Nothing, Nothing,, True, 5) ' bCancelar = Me.Guardar(Nothing, Nothing,, True, 5)
' End If ' End If
' If Not bCancelar Then ' 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 ' If dxnc.ShowDialog Then
' Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "DEFECTO") ' Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "DEFECTO")
' Dim bAlbaran = GeneraPdfAlbaran(bd, ra) ' Dim bAlbaran = GeneraPdfAlbaran(bd, ra)
@@ -742,22 +744,26 @@ Public Class ucAlbaran
Else Else
ra.idUsuario = bdGrupoSanchoToro.db.Utilidades.idUsuario ra.idUsuario = bdGrupoSanchoToro.db.Utilidades.idUsuario
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
Select Case Estado Select Case Estado
Case tsUtilidades.EstadosAplicacion.Nuevo Case tsUtilidades.EstadosAplicacion.Nuevo
For Each d In ra.detallesalbaranesidAlbaranNavigation For Each d In ra.detallesalbaranesidAlbaranNavigation
d.idAlbaranNavigation = ra d.idAlbaranNavigation = ra
d.ActualizaProducto(bdtmp, 1) d.ActualizaProducto(bdtmp, ra.Tipo, 1, ra.idEmpresa)
Next Next
Case tsUtilidades.EstadosAplicacion.ModificandoRegistro Case tsUtilidades.EstadosAplicacion.ModificandoRegistro
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList
For Each d In das 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 Next
For Each d In ra.detallesalbaranesidAlbaranNavigation 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 Next
End Select End Select
bdtmp.GuardarCambios()
End If End If
End Sub End Sub
@@ -765,8 +771,10 @@ Public Class ucAlbaran
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList Dim das = bdtmp.detallesalbaranes.Where(Function(x) x.idAlbaran = ra.idAlbaran).ToList
For Each d In das 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 Next
bdtmp.SaveChanges()
End Sub End Sub
Private Sub btIrAContrato_Click(sender As Object, e As RoutedEventArgs) 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:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" 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"> mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="1366">
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
@@ -30,8 +30,8 @@
</tsWPF:tsLayoutItem.PropiedadesTS> </tsWPF:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit EditValue="{Binding NumeroAlbaran, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="100" NullText="« AUTOMÁTICO »" /> <dxe:TextEdit EditValue="{Binding NumeroAlbaran, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="100" NullText="« AUTOMÁTICO »" />
</tsWPF:tsLayoutItem> </tsWPF:tsLayoutItem>
<tsWPF:tsLayoutItem Label="Nº Pedido:"> <tsWPF:tsLayoutItem Label="Nº Contrato:">
<dxe:ButtonEdit x:Name="beContrato" EditValue="{Binding NumeroPedido, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="12" DefaultButtonClick="beContrato_DefaultButtonClick"> <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="Search" x:Name="btIrAContrato" Click="btIrAContrato_Click" />
<dxe:ButtonInfo GlyphKind="Cancel" x:Name="btQuitarContrato" Click="btQuitarContrato_Click" /> <dxe:ButtonInfo GlyphKind="Cancel" x:Name="btQuitarContrato" Click="btQuitarContrato_Click" />
</dxe:ButtonEdit> </dxe:ButtonEdit>
@@ -55,12 +55,12 @@
<tsWPF:tsLayoutItem Label="Tipo:"> <tsWPF:tsLayoutItem Label="Tipo:">
<tsWPF:tsLayoutItem.PropiedadesTS> <tsWPF:tsLayoutItem.PropiedadesTS>
<tsWPF:PropiedadesTS /> <tsWPF:PropiedadesTS Modificable="NoModificable" />
</tsWPF:tsLayoutItem.PropiedadesTS> </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" /> <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> </tsWPF:tsLayoutItem>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
<tsWPF:tsLayoutItem Label="Cliente:"> <tsWPF:tsLayoutItem Label="Cliente/Proveedor:">
<tsWPF:tsLayoutItem.PropiedadesTS> <tsWPF:tsLayoutItem.PropiedadesTS>
<tsWPF:PropiedadesTS /> <tsWPF:PropiedadesTS />
</tsWPF:tsLayoutItem.PropiedadesTS> </tsWPF:tsLayoutItem.PropiedadesTS>
@@ -96,6 +96,12 @@
</tsWPF:tsLayoutItem.PropiedadesTS> </tsWPF:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit EditValue="{Binding Usuario, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="100" /> <dxe:TextEdit EditValue="{Binding Usuario, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="100" />
</tsWPF:tsLayoutItem> </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>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
@@ -305,78 +311,27 @@
</dx:DXTabControl.View> </dx:DXTabControl.View>
<dx:DXTabItem Header="Productos"> <dx:DXTabItem Header="Productos">
<dxlc:LayoutGroup Orientation="Vertical"> <dxlc:LayoutGroup Orientation="Vertical">
<tsWPF:tsGridControl x:Name="gcProductos" TabIndex="31"> <tsWPF:tsGridControl x:Name="gcProductos" TabIndex="13">
<tsWPF:tsGridControl.PropiedadesTSGC>
<tsWPF:PropiedadesTSGC CamposObligatorios="Cantidad,idProducto" />
</tsWPF:tsGridControl.PropiedadesTSGC>
<tsWPF:tsGridControl.PropiedadesTS> <tsWPF:tsGridControl.PropiedadesTS>
<tsWPF:PropiedadesTS /> <tsWPF:PropiedadesTS />
</tsWPF:tsGridControl.PropiedadesTS> </tsWPF:tsGridControl.PropiedadesTS>
<tsWPF:tsGridControl.View> <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:tsTableView>
</tsWPF:tsGridControl.View> </tsWPF:tsGridControl.View>
<dxg:GridColumn FieldName="idProducto" Header="Producto" Width="400"> <tsWPF:tsGridColumn FieldName="Producto" Header="Producto" Width="400" SoloLectura="True" />
<dxg:GridColumn.EditSettings> <tsWPF:tsGridColumn FieldName="Articulo" Header="Artículo" Width="100" SoloLectura="True" />
<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="Observaciones" Header="Observaciones" IsSmart="True" Width="380" /> <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="idAlbaranNavigation.NumeroAlbaran" Header="Nº Albarán Entrega" IsSmart="True" Width="120" CellTemplate="{DynamicResource VerDetalleTemplate}" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="id.Fecha" Header="Fecha Recogida" IsSmart="True" Width="140" SoloLectura="True"> <tsWPF:tsGridColumn FieldName="idAlbaranNavigation.Fecha" Header="Fecha Entrega" IsSmart="True" Width="140" SoloLectura="True">
<dxg:GridColumn.EditSettings> <dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy HH:mm" /> <dxe:DateEditSettings DisplayFormat="dd/MM/yyyy HH:mm" />
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</tsWPF:tsGridColumn> </tsWPF:tsGridColumn>
<tsWPF:tsGridColumn FieldName="facturas.NumeroFactura" Header="Nº Última Fra." IsSmart="True" Width="100" CellTemplate="{DynamicResource VerDetalleTemplate}" SoloLectura="True" /> <tsWPF:tsGridColumn FieldName="Cantidad" Header="Unidades Entregadas" IsSmart="True" Width="140" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="facturas.FechaCalculoDias" Header="Fecha Último Cálculo" IsSmart="True" Width="150" SoloLectura="True"> <tsWPF:tsGridColumn FieldName="UnidadesRecogidasTmp" Header="Unidades Recogidas" IsSmart="True" Width="140" />
<dxg:GridColumn.EditSettings> <tsWPF:tsGridColumn FieldName="idAlbaranNavigation.Obra" Header="Obra" Width="500" SoloLectura="True" />
<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:tsGridControl> </tsWPF:tsGridControl>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
</dx:DXTabItem> </dx:DXTabItem>

View File

@@ -19,11 +19,11 @@ Imports bdGrupoSanchoToro.db.Utilidades
Imports System.Drawing Imports System.Drawing
Imports bdGrupoSanchoToro.db.albaranes Imports bdGrupoSanchoToro.db.albaranes
Public Class ucAlbaranE Public Class ucAlbaranR
Private bd As tscGrupoSanchoToro Private bd As tscGrupoSanchoToro
Friend _idAlbaran As Nullable(Of Integer) Friend _idAlbaran As Nullable(Of Integer)
Private lProductos As List(Of productos) 'Private lProductos As List(Of productos)
Private lArticulos As List(Of articulos) 'Private lArticulos As List(Of articulos)
Friend idLog As Integer? Friend idLog As Integer?
@@ -35,10 +35,10 @@ Public Class ucAlbaranE
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False) Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
Try Try
lProductos = bd.productos.OrderBy(Function(x) x.Descripcion).ToList 'lProductos = bd.productos.OrderBy(Function(x) x.Descripcion).ToList
Dim lProductosAlb = ra.detallesalbaranesidAlbaranNavigation.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 'lProductos = lProductos.Where(Function(x) x.FechaBaja Is Nothing OrElse lProductosAlb.Contains(x.idProducto)).ToList
cbProducto.ItemsSource = lProductos '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 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) Dim Acciones As New List(Of tsWPFCore.Accion)
Acciones.Add(New Accion With { Acciones.Add(New Accion With {
.idAccion = 1, .idAccion = 1,
.Descripcion = "GENERA ALBARÁN DE RECOGIDA Y FACTURA RÁPIDA (F10)"}) .Descripcion = "AGREGA PRODUCTOS AL ALBARAN F9"})
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)"})
Me.ContenedorAplicacion.cbAcciones.ItemsSource = Acciones Me.ContenedorAplicacion.cbAcciones.ItemsSource = Acciones
Me.ContenedorAplicacion.beAcciones.EditValue = Acciones.First.idAccion Me.ContenedorAplicacion.beAcciones.EditValue = Acciones.First.idAccion
@@ -118,6 +113,8 @@ Public Class ucAlbaranE
_idAlbaran = Nothing _idAlbaran = Nothing
ra.Fecha = DateOnly.FromDateTime(Today) ra.Fecha = DateOnly.FromDateTime(Today)
ra.NumeroBultos = 1 ra.NumeroBultos = 1
ra.idEmpresa = EmpresaActual.idEmpresa
ra.Tipo = _Tipo
NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo
Else Else
ra = bd.albaranes.First(Function(x) x.idAlbaran = _idAlbaran) ra = bd.albaranes.First(Function(x) x.idAlbaran = _idAlbaran)
@@ -127,9 +124,10 @@ Public Class ucAlbaranE
If Me.cbTipo.ItemsSource Is Nothing Then If Me.cbTipo.ItemsSource Is Nothing Then
cbTipo.ItemsSource = tsUtilidades.DescripcionValor.EnumADescripcionValor(GetType(bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum)) cbTipo.ItemsSource = tsUtilidades.DescripcionValor.EnumADescripcionValor(GetType(bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum))
cbAlmacenOrigen.ItemsSource = Comun.ObtieneListaAlmacenes(bd) cbAlmacenOrigen.ItemsSource = Comun.ObtieneListaAlmacenes(bd)
cbAlmacenDestino.ItemsSource = Comun.ObtieneListaAlmacenes(bd)
End If End If
'Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ra.idAlbaran AndAlso x.Aplicacion = "albaranes").ToList '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 Me.DataContext = ra
Return NuevoEstado Return NuevoEstado
Catch ex As Exception Catch ex As Exception
@@ -179,11 +177,12 @@ Public Class ucAlbaranE
' Return "idAlbaranEntrega" ' Return "idAlbaranEntrega"
' End Get ' End Get
'End Property 'End Property
Private _Tipo As albaranes.TipoAlbaranEnum
Public Sub New(Optional idAlbaran As Integer? = Nothing) Public Sub New(Tipo As albaranes.TipoAlbaranEnum, Optional idAlbaran As Integer? = Nothing)
' Llamada necesaria para el diseñador. ' Llamada necesaria para el diseñador.
InitializeComponent() InitializeComponent()
_idAlbaran = idAlbaran _idAlbaran = idAlbaran
' Agregue cualquier inicialización después de la llamada a InitializeComponent(). ' 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 Private Sub ap_EstadoCambiado(EstadoAnterior As tsUtilidades.EstadosAplicacion, EstadoNuevo As tsUtilidades.EstadosAplicacion) Handles Me.EstadoCambiado
If idLog.HasValue Then EstableceSoloLectura() If idLog.HasValue Then EstableceSoloLectura()
Select Case EstadoNuevo 'Select Case EstadoNuevo
Case tsUtilidades.EstadosAplicacion.ModificandoRegistro ' Case tsUtilidades.EstadosAplicacion.ModificandoRegistro
If ra.Tipo = TipoAlbaranEnum.COMPRA Then ' If ra.Tipo = TipoAlbaranEnum.COMPRA Then
gcEsVenta.ReadOnly = True ' gcEsVenta.ReadOnly = True
Else ' Else
gcEsVenta.ReadOnly = False ' gcEsVenta.ReadOnly = False
End If ' End If
End Select 'End Select
End Sub 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) Private Sub BiBuscarCliente_Click(sender As Object, e As RoutedEventArgs)
'If Me.Estado = EstadosAplicacion.Nuevo Then 'If Me.Estado = EstadosAplicacion.Nuevo Then
Dim dxw As New dxwEntidades(bd, True, False) 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 End Sub
Private Sub ucAlbaranEntrega_EjecutarAccion(sender As Object, e As ItemClickEventArgs, idAccion As Integer) Handles Me.EjecutarAccion 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 'Select Case idAccion
' Case 1 ' GENERA ALBARÁN DE RECOGIDA Y FACTURA RAPIDA ' Case 1 ' GENERA ALBARÁN DE RECOGIDA Y FACTURA RAPIDA
' Try ' Try
@@ -573,7 +571,7 @@ Public Class ucAlbaranE
' bCancelar = Me.Guardar(Nothing, Nothing,, True, 5) ' bCancelar = Me.Guardar(Nothing, Nothing,, True, 5)
' End If ' End If
' If Not bCancelar Then ' 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 ' If dxnc.ShowDialog Then
' Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "DEFECTO") ' Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "DEFECTO")
' Dim bAlbaran = GeneraPdfAlbaran(bd, ra) ' 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 'Private Sub ucAlbaranEntrega_CampoActualizado(sender As Object, e As DataTransferEventArgs) Handles Me.CampoActualizado
Dim pts As PropiedadesTS = sender.parent.propiedadests ' Dim pts As PropiedadesTS = sender.parent.propiedadests
If Not pts Is Nothing Then ' If Not pts Is Nothing Then
Select Case pts.NombreCampo.ToLower ' Select Case pts.NombreCampo.ToLower
Case "tipo" ' Case "tipo"
gcEsVenta.ReadOnly = False ' gcEsVenta.ReadOnly = False
Select Case DirectCast(ra.Tipo, bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum) ' Select Case DirectCast(ra.Tipo, bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.COMPRA ' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.COMPRA
For Each d In ra.detallesalbaranesidAlbaranNavigation.Where(Function(x) x.EsVenta) ' For Each d In ra.detallesalbaranesidAlbaranNavigation.Where(Function(x) x.EsVenta)
d.EsVenta = False ' d.EsVenta = False
Next ' Next
gcEsVenta.ReadOnly = True ' gcEsVenta.ReadOnly = True
ra.idAlmacenOrigen = Nothing ' ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, True) ' EstableceSoloLectura(cbAlmacenOrigen, True)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.CAMBIO_ALMACEN ' EstableceSoloLectura(cbAlmacenDestino, False)
EstableceSoloLectura(cbAlmacenOrigen, False) ' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.CAMBIO_ALMACEN
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.SUBALQUILER ' EstableceSoloLectura(cbAlmacenOrigen, False)
ra.idAlmacenOrigen = Nothing ' EstableceSoloLectura(cbAlmacenDestino, False)
EstableceSoloLectura(cbAlmacenOrigen, True) ' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.SUBALQUILER
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER ' ra.idAlmacenOrigen = Nothing
EstableceSoloLectura(cbAlmacenOrigen, False) ' EstableceSoloLectura(cbAlmacenOrigen, True)
ra.idAlmacenDestino = Nothing ' EstableceSoloLectura(cbAlmacenDestino, False)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.ENTREGA ' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER
EstableceSoloLectura(cbAlmacenOrigen, False) ' EstableceSoloLectura(cbAlmacenOrigen, False)
ra.idAlmacenDestino = Nothing ' ra.idAlmacenDestino = Nothing
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.RECOGIDA ' EstableceSoloLectura(cbAlmacenDestino, True)
ra.idAlmacenOrigen = Nothing ' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.ENTREGA
EstableceSoloLectura(cbAlmacenOrigen, True) ' EstableceSoloLectura(cbAlmacenOrigen, False)
Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK ' ra.idAlmacenDestino = Nothing
ra.idAlmacenOrigen = Nothing ' EstableceSoloLectura(cbAlmacenDestino, True)
EstableceSoloLectura(cbAlmacenOrigen, True) ' Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.RECOGIDA
End Select ' ra.idAlmacenOrigen = Nothing
End Select ' EstableceSoloLectura(cbAlmacenOrigen, True)
End If ' EstableceSoloLectura(cbAlmacenDestino, False)
End Sub ' 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) 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 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 Dim hte As New Hashtable
Select Case DirectCast(ra.Tipo, bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum) 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 Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.RECOGIDA
If ra.idAlmacenDestino.HasValue = False Then hte.Add("ALMACENAR-ALMACEN_DESTINO_OBLIGATORIO", "El almacén destino 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.REGULARIZACION_STOCK Case bdGrupoSanchoToro.db.albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK
@@ -723,32 +714,52 @@ Public Class ucAlbaranE
Cancelar = True Cancelar = True
Else Else
ra.idUsuario = bdGrupoSanchoToro.db.Utilidades.idUsuario 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 Select Case Estado
Case tsUtilidades.EstadosAplicacion.Nuevo Case tsUtilidades.EstadosAplicacion.Nuevo
For Each d In ra.detallesalbaranesidAlbaranNavigation For Each d In ra.detallesalbaranesidAlbaranRecogidaNavigation
d.idAlbaranNavigation = ra d.idAlbaranRecogidaNavigation = ra
d.ActualizaProducto(bdtmp, 1) d.ActualizaProducto(bdtmp, ra.Tipo, 1, ra.idEmpresa)
Next Next
Case tsUtilidades.EstadosAplicacion.ModificandoRegistro 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 For Each d In das
d.ActualizaProducto(bdtmp, -1) d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, -1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next Next
For Each d In ra.detallesalbaranesidAlbaranNavigation For Each d In ra.detallesalbaranesidAlbaranRecogidaNavigation
d.ActualizaProducto(bdtmp, 1) If d.idAlbaranRecogidaNavigation Is Nothing Then d.idAlbaranRecogidaNavigation = ra
d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, 1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next Next
End Select End Select
bdtmp.GuardarCambios()
End If End If
End Sub 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 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 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 For Each d In das
d.ActualizaProducto(bdtmp, -1) d.ActualizaProducto(bdtmp, d.idAlbaranRecogidaNavigation.Tipo, -1, d.idAlbaranRecogidaNavigation.idEmpresa)
Next Next
bdtmp.SaveChanges()
End Sub End Sub
Private Sub btIrAContrato_Click(sender As Object, e As RoutedEventArgs) Private Sub btIrAContrato_Click(sender As Object, e As RoutedEventArgs)
@@ -763,46 +774,32 @@ Public Class ucAlbaranE
ra.idPresupuestoNavigation = Nothing ra.idPresupuestoNavigation = Nothing
End Sub End Sub
Private Sub tvProductos_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles tvProductos.PreviewKeyDown 'Private Sub BiBuscarArticulo_Click(sender As Object, e As RoutedEventArgs)
If e.Key = Key.F6 Then
If Not ra.detallesalbaranesidAlbaranNavigation.ToList.Any(Function(x) x.idAlbaranRecogida.HasValue OrElse (x.idUltimaFactura.HasValue AndAlso (x.idUltimaFacturaNavigation.FechaFactura > ra.Fecha))) Then ' Try
Select Case gcProductos.CurrentColumn.FieldName.ToLower ' If gcProductos.CurrentItem IsNot Nothing Then
Case "idproducto" ' Dim dea As detallesalbaranes = gcProductos.CurrentItem
BiBuscarProducto_Click(Nothing, Nothing) ' If dea.idProducto > 0 Then
Case "idarticulo" ' If tvProductos.ActiveEditor Is Nothing Then
BiBuscarArticulo_Click(Nothing, Nothing) ' Dispatcher.BeginInvoke(New Action(Sub() tvProductos.ShowEditor()), System.Windows.Threading.DispatcherPriority.Render)
End Select ' End If
' Dim dxw As New dxwArticulos(lArticulos, dea.idProducto)
End If ' If dxw.ShowDialog Then
End If ' Dim art = lArticulos.First(Function(x) x.idArticulo = dxw.idArticulo)
End Sub ' dea.idArticulo = art.idArticulo
Private Sub BiBuscarArticulo_Click(sender As Object, e As RoutedEventArgs) ' dea.Cantidad = 1
' If tvProductos.ActiveEditor IsNot Nothing Then tvProductos.ActiveEditor.EditValue = art.idArticulo
Try ' tvProductos.PostEditor()
If gcProductos.CurrentItem IsNot Nothing Then ' tvProductos.CloseEditor()
Dim dea As detallesalbaranes = gcProductos.CurrentItem ' gcProductos.RefreshRow(tvProductos.FocusedRowHandle)
If dea.idProducto > 0 Then ' End If
If tvProductos.ActiveEditor Is Nothing Then ' End If
Dispatcher.BeginInvoke(New Action(Sub() tvProductos.ShowEditor()), System.Windows.Threading.DispatcherPriority.Render) ' End If
End If ' Catch ex As Exception
Dim dxw As New dxwArticulos(lArticulos, dea.idProducto) ' FuncionesDinamicas.ErrorNoControladoAp(Me, ex)
If dxw.ShowDialog Then ' DXMessageBox.Show(ex.Message, "Error")
Dim art = lArticulos.First(Function(x) x.idArticulo = dxw.idArticulo) ' End Try
dea.idArticulo = art.idArticulo 'End Sub
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 End Class

View File

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

View File

@@ -92,7 +92,15 @@ Public Class ucAlbaranes
End Function End Function
Private Sub Nuevo() Handles Me.BotonNuevoPulsado 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 End Sub
Private Sub ap_Enlazar(Celda As DevExpress.Xpf.Grid.EditGridCellData, Defecto As Boolean) Handles Me.Enlazar 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 Select Case Celda.Column.FieldName.ToLower
Case "numeroalbaran" Case "numeroalbaran"
Dim id As Integer = ra.idAlbaran 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" Case "razonsocial"
Dim id As Integer = ra.idEntidad Dim id As Integer = ra.idEntidad
FuncionesDinamicas.AbrirAP(New ucEntidad(id), OtrosParametros) FuncionesDinamicas.AbrirAP(New ucEntidad(id), OtrosParametros)
@@ -114,7 +128,7 @@ Public Class ucAlbaranes
End Sub End Sub
Public Function ObtieneAlbaranes(TextoBusqueda As String, FechaInicio As DateOnly?, FechaFin As DateOnly?, Tipos As List(Of Integer)) As List(Of v_albaranesextendidos) 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 la As New List(Of v_albaranesextendidos)
Dim iNumExc As Integer = 0 Dim iNumExc As Integer = 0
Do Do
@@ -122,9 +136,9 @@ Public Class ucAlbaranes
If TextoBusqueda <> "" Then If TextoBusqueda <> "" Then
Dim parametros(0) As Object Dim parametros(0) As Object
Dim ExpresionBusqueda = tsWPFCore.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, Me._CamposBusquedaNumericos, Me._CamposBusquedaAlfabeticos, Nothing) Dim ExpresionBusqueda = tsWPFCore.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, Me._CamposBusquedaNumericos, Me._CamposBusquedaAlfabeticos, Nothing)
rs = bd.v_albaranesextendidos.Where(ExpresionBusqueda) rs = rs.Where(ExpresionBusqueda)
Else Else
rs = bd.v_albaranesextendidos.AsQueryable rs = rs.AsQueryable
End If End If
If FechaInicio.HasValue Then If FechaInicio.HasValue Then

View File

@@ -1,4 +1,4 @@
<tsWPF:tsUserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <tsWPFCore:tsUserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -7,10 +7,10 @@
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" 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="ucProducto" xmlns:tsWPFCore="clr-namespace:tsWPFCore;assembly=tsWPFCore" xmlns:Serialization="clr-namespace:DevExpress.Xpf.LayoutControl.Serialization;assembly=DevExpress.Xpf.LayoutControl.v23.2" x:Class="ucProducto"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="1366"> mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="1366">
<tsWPF:tsUserControl.Resources> <tsWPFCore:tsUserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/tsWPFCore;component/Plantillas.xaml" /> <ResourceDictionary Source="pack://application:,,,/tsWPFCore;component/Plantillas.xaml" />
@@ -25,53 +25,77 @@
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
</tsWPF:tsUserControl.Resources> </tsWPFCore:tsUserControl.Resources>
<Grid x:Name="contenido" HorizontalAlignment="Stretch" Width="Auto"> <Grid x:Name="contenido" HorizontalAlignment="Stretch" Width="Auto">
<dxlc:LayoutControl x:Name="LayoutControl1" Orientation="Vertical"> <dxlc:LayoutControl x:Name="LayoutControl1" Orientation="Vertical">
<dxlc:LayoutGroup Header="Datos Producto" x:Name="lgDetalle" View="GroupBox" IsLocked="True" Width="Auto" HorizontalAlignment="Stretch"> <dxlc:LayoutGroup Header="Datos Producto" x:Name="lgDetalle" View="GroupBox" IsLocked="True" Width="Auto" HorizontalAlignment="Stretch" ItemLabelsAlignment="Local" IsCollapsible="True">
<dxlc:LayoutGroup Orientation="Vertical" Width="1250" HorizontalAlignment="Left"> <dxlc:LayoutGroup Orientation="Vertical">
<dxlc:LayoutGroup Orientation="Vertical"> <dxlc:LayoutGroup HorizontalAlignment="Left" Width="1280">
<dxlc:LayoutGroup Orientation="Horizontal"> <dxlc:LayoutGroup Orientation="Vertical">
<tsWPF:tsLayoutItem Label="Código:" Width="240"> <dxlc:LayoutGroup >
<tsWPF:tsLayoutItem.PropiedadesTS> <dxlc:LayoutGroup Orientation="Vertical" Width="240" ItemLabelsAlignment="Local">
<tsWPF:PropiedadesTS /> <tsWPFCore:tsLayoutItem Label="Nº Producto:">
</tsWPF:tsLayoutItem.PropiedadesTS> <tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="2" EditValue="{Binding Codigo, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" /> <tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPF:tsLayoutItem> </tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPF:tsLayoutItem Label="Descripción:"> <dxe:TextEdit TabIndex="99" EditValue="{Binding NumeroProductoTMP, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
<tsWPF:tsLayoutItem.PropiedadesTS> </tsWPFCore:tsLayoutItem>
<tsWPF:PropiedadesTS Obligatorio="True" Unico="True" /> <tsWPFCore:tsLayoutItem Label="Fecha Baja:">
</tsWPF:tsLayoutItem.PropiedadesTS> <tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit EditValue="{Binding Descripcion, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="3" x:Name="teNIF" /> <tsWPFCore:PropiedadesTS UsualCorreccion="False" />
</tsWPF:tsLayoutItem> </tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPF:tsLayoutItem Label="Tipo:"> <dxe:DateEdit EditValue="{Binding FechaBaja, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="4" />
<tsWPF:tsLayoutItem.PropiedadesTS> </tsWPFCore:tsLayoutItem>
<tsWPF:PropiedadesTS UsualCorreccion="False" /> </dxlc:LayoutGroup>
</tsWPF:tsLayoutItem.PropiedadesTS> <dxlc:LayoutGroup Orientation="Vertical" Width="380">
<dxe:ComboBoxEdit x:Name="cbTipo" ValueMember="Valor" DisplayMember="Descripcion" EditValue="{Binding Tipo, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="14" AutoComplete="True" /> <tsWPFCore:tsLayoutItem Label="Código:" >
</tsWPF:tsLayoutItem> <tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPF:tsLayoutItem Label="Fecha Baja:" Width="200"> <tsWPFCore:PropiedadesTS Unico="True" />
<tsWPF:tsLayoutItem.PropiedadesTS> </tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPF:PropiedadesTS UsualCorreccion="False" /> <dxe:TextEdit TabIndex="2" EditValue="{Binding Codigo, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPF:tsLayoutItem.PropiedadesTS> </tsWPFCore:tsLayoutItem>
<dxe:DateEdit EditValue="{Binding FechaBaja, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="4" /> <tsWPFCore:tsLayoutItem Label="Facturar como venta/servicio por defecto.:">
</tsWPF:tsLayoutItem> <tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:CheckEdit EditValue="{Binding FacturarComoVentaPorDefecto, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="9" />
</tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup>
<dxlc:LayoutGroup Orientation="Vertical">
<tsWPFCore:tsLayoutItem Label="Descripción:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Obligatorio="True" Unico="True" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit EditValue="{Binding Descripcion, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="3" x:Name="teNIF" />
</tsWPFCore:tsLayoutItem>
<tsWPFCore:tsLayoutItem Label="Tipo:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Obligatorio="True" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:ComboBoxEdit x:Name="cbTipo" ValueMember="Valor" DisplayMember="Descripcion" EditValue="{Binding Tipo, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="14" AutoComplete="True" />
</tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
<tsWPFCore:tsLayoutItem Label="Observaciones:" >
<dxe:TextEdit EditValue="{Binding Observaciones, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="10" />
</tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
<tsWPF:tsLayoutItem Label="Observaciones:">
<dxe:TextEdit EditValue="{Binding Observaciones, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" TabIndex="10" />
</tsWPF:tsLayoutItem>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
<dxlc:LayoutGroup Header="Tarifas" View="GroupBox" IsLocked="True" Width="Auto" HorizontalAlignment="Stretch" ItemLabelsAlignment="Local"> <dxlc:LayoutGroup Header="Precios" View="GroupBox" IsLocked="True" Width="Auto" HorizontalAlignment="Stretch" ItemLabelsAlignment="Local">
<dxlc:LayoutGroup Width="400"> <dxlc:LayoutGroup Width="900">
<tsWPF:tsLayoutItem Label="Precio:"> <tsWPFCore:tsLayoutItem Label="Precio Venta:">
<dxe:TextEdit TabIndex="11" Mask="c4" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding PrecioVenta, Converter={StaticResource DoubleToDecimalConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" /> <dxe:TextEdit TabIndex="11" Mask="c4" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding PrecioVenta, Converter={StaticResource DoubleToDecimalConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPF:tsLayoutItem> </tsWPFCore:tsLayoutItem>
<tsWPF:tsLayoutItem Label="Precio Costo:"> <tsWPFCore:tsLayoutItem Label="Precio Alquiler Mensual:">
<dxe:TextEdit TabIndex="12" Mask="c4" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding PrecioAlquilerMensual, Converter={StaticResource DoubleToDecimalConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
<tsWPFCore:tsLayoutItem Label="Ultimo Precio Compra:">
<dxe:TextEdit TabIndex="13" Mask="c4" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UltimoPrecioCompra, Converter={StaticResource DoubleToDecimalConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" /> <dxe:TextEdit TabIndex="13" Mask="c4" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UltimoPrecioCompra, Converter={StaticResource DoubleToDecimalConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPF:tsLayoutItem> </tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
@@ -82,39 +106,285 @@
</dx:DXTabControl.View> </dx:DXTabControl.View>
<dx:DXTabItem Header="Stocks"> <dx:DXTabItem Header="Stocks">
<dxlc:LayoutGroup Orientation="Vertical"> <dxlc:LayoutGroup Orientation="Vertical">
<dxlc:LayoutGroup Header="Descglose por almacenes" View="GroupBox"> <dxlc:LayoutGroup Header="Desglose por almacenes" View="GroupBox">
<tsWPF:tsGridControl x:Name="gcStocksAlmacenes" NombreTablaBase="desgloseproductos" TabIndex="41"> <tsWPFCore:tsGridControl x:Name="gcStocksAlmacenes" NombreTablaBase="desgloseproductos" TabIndex="41">
<tsWPF:tsGridControl.PropiedadesTS> <tsWPFCore:tsGridControl.PropiedadesTS>
<tsWPF:PropiedadesTS Modificable="NoModificable" /> <tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPF:tsGridControl.PropiedadesTS> </tsWPFCore:tsGridControl.PropiedadesTS>
<tsWPF:tsGridControl.View> <tsWPFCore:tsGridControl.View>
<tsWPF:tsTableView ShowGroupPanel="false" x:Name="tvStocksAlmacenes" IsDetailButtonVisibleBinding="{Binding Row.ContieneHijos}"> <tsWPFCore:tsTableView ShowGroupPanel="false" x:Name="tvStocksAlmacenes" IsDetailButtonVisibleBinding="{Binding Row.ContieneHijos}">
</tsWPF:tsTableView> </tsWPFCore:tsTableView>
</tsWPF:tsGridControl.View> </tsWPFCore:tsGridControl.View>
<dxg:GridControl.Columns> <dxg:GridControl.Columns>
<tsWPF:tsGridColumn FieldName="Almacen" Header="Almacén" IsSmart="True" Width="450" SoloLectura="True" CellTemplate="{DynamicResource VerDetalleTemplate}" /> <tsWPFCore:tsGridColumn FieldName="Almacen" Header="Almacén" IsSmart="True" Width="450" SoloLectura="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<tsWPF:tsGridColumn FieldName="TipoAlmacen" Header="Tipo Almacén" IsSmart="True" Width="200" SoloLectura="True" /> <tsWPFCore:tsGridColumn FieldName="TipoAlmacen" Header="Tipo Almacén" IsSmart="True" Width="200" SoloLectura="True" />
<tsWPF:tsGridColumn FieldName="Unidades" IsSmart="True" Width="100"> <tsWPFCore:tsGridColumn FieldName="Unidades" IsSmart="True" Width="100">
<dxg:GridColumn.EditSettings> <dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" /> <dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</tsWPF:tsGridColumn> </tsWPFCore:tsGridColumn>
</dxg:GridControl.Columns> </dxg:GridControl.Columns>
</tsWPF:tsGridControl> </tsWPFCore:tsGridControl>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
<dxlc:LayoutGroup Header="Unidades" View="GroupBox" IsLocked="True" Width="Auto" HorizontalAlignment="Stretch" ItemLabelsAlignment="Local" IsCollapsible="True" >
<dxlc:LayoutGroup Orientation="Vertical">
<dxlc:LayoutGroup Orientation="Vertical" ItemLabelsAlignment="Local">
<dxlc:LayoutGroup Orientation="Horizontal" Width="1000" Height="120">
<dxlc:LayoutGroup Orientation="Vertical" Width="250" HorizontalAlignment="Left">
<tsWPFCore:tsLayoutItem Label="Uds. Iniciales/Fabricadas:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="14" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesInicialesOFabricadas, Converter={StaticResource DoubleToDecimalConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
<tsWPFCore:tsLayoutItem Label="Unidades Desechadas:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="29" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesDesechadas, Converter={StaticResource DoubleToDecimalConverter}, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
<tsWPFCore:tsLayoutItem Label="Total Unidades:" FontWeight="Bold">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="39" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding TotalUnidades, Converter={StaticResource DoubleToDecimalConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
<tsWPFCore:tsLayoutItem Label="Unidades Disponibles:" FontWeight="Bold">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="39" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesDisponibles, Converter={StaticResource DoubleToDecimalConverter}, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup>
<dxlc:LayoutGroup Orientation="Vertical" Width="700">
<dxlc:LayoutGroup>
<dxlc:LayoutGroup Orientation="Vertical" Width="200">
<tsWPFCore:tsLayoutItem Label="Unidades Compradas:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="19" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesCompradas, Converter={StaticResource DoubleToDecimalConverter}, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
<tsWPFCore:tsLayoutItem Label="Unidades Vendidas:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="24" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesVendidas, Converter={StaticResource DoubleToDecimalConverter}, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup>
<dxlc:LayoutGroup Orientation="Vertical" Width="250">
<tsWPFCore:tsLayoutItem Label="Unidades Subarrendadas:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="24" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesSubAlquiladas, Converter={StaticResource DoubleToDecimalConverter}, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
<tsWPFCore:tsLayoutItem Label="Unidades Alquiladas:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="29" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesAlquiladas, Converter={StaticResource DoubleToDecimalConverter}, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup>
<dxlc:LayoutGroup Orientation="Vertical" VerticalAlignment="Bottom" >
<tsWPFCore:tsLayoutItem Label="Unidades En Reparación:">
<tsWPFCore:tsLayoutItem.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsLayoutItem.PropiedadesTS>
<dxe:TextEdit TabIndex="29" Mask="N0" MaskType="Numeric" MaskUseAsDisplayFormat="True" EditValue="{Binding UnidadesAveriadas, Converter={StaticResource DoubleToDecimalConverter}, Mode=OneWay, NotifyOnSourceUpdated=True, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
</tsWPFCore:tsLayoutItem>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
<dxlc:LayoutGroup Header="LayoutGroup" Orientation="Vertical">
<TextBlock Margin="5,2,0,0" Text="(Stock Inicial + Unidades Compradas + Unidades Subarrendadas - Unidades Desechadas - Unidades Vendidas)" FontWeight="Bold" Height="22"></TextBlock>
<TextBlock Margin="5,0,0,0" Text="(Total Unidades - Unidades Alquiladas - Unidades En Reparacion)" FontWeight="Bold"></TextBlock>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup>
</dxlc:LayoutGroup> </dxlc:LayoutGroup>
</dx:DXTabItem> </dx:DXTabItem>
<dx:DXTabItem Header="Stocks Por Empresas">
<tsWPFCore:tsGridControl x:Name="gcStocksEmpresas" TabIndex="41">
<tsWPFCore:tsGridControl.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsGridControl.PropiedadesTS>
<tsWPFCore:tsGridControl.View>
<tsWPFCore:tsTableView ShowGroupPanel="false" x:Name="tvStocksEmpresas" >
</tsWPFCore:tsTableView>
</tsWPFCore:tsGridControl.View>
<dxg:GridControl.Columns>
<tsWPFCore:tsGridColumn FieldName="NombreEmpresa" Header="Empresa" IsSmart="True" Width="300" SoloLectura="True" />
<tsWPFCore:tsGridColumn FieldName="TotalUnidades" IsSmart="True" Width="95">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesCompradas" IsSmart="True" Width="130">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesAlquiladas" IsSmart="True" Width="130">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesAveriadas" IsSmart="True" Width="130">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesVendidas" IsSmart="True" Width="130">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesSubAlquiladas" IsSmart="True" Width="150">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesDesechadas" IsSmart="True" Width="130">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesDisponibles" IsSmart="True" Width="130">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
</dxg:GridControl.Columns>
</tsWPFCore:tsGridControl>
</dx:DXTabItem>
<dx:DXTabItem Header="Desglose de Material">
<tsWPFCore:tsGridControl x:Name="gcDesglose" NombreTablaBase="desgloseproductos" TabIndex="41">
<tsWPFCore:tsGridControl.PropiedadesTSGC>
<tsWPFCore:PropiedadesTSGC CamposUnicos="idProducto" />
</tsWPFCore:tsGridControl.PropiedadesTSGC>
<tsWPFCore:tsGridControl.View>
<tsWPFCore:tsTableView ShowGroupPanel="false" x:Name="tvdesglose" IsDetailButtonVisibleBinding="{Binding Row.ContieneHijos}">
<dxg:TableView.FormatConditions>
<dxg:FormatCondition Expression="[ContieneHijos]" FieldName="{x:Null}">
<dx:Format Foreground="Blue" FontWeight="Bold" />
</dxg:FormatCondition>
</dxg:TableView.FormatConditions>
</tsWPFCore:tsTableView>
</tsWPFCore:tsGridControl.View>
<dxg:GridControl.Columns>
<tsWPFCore:tsGridColumn FieldName="productos1.idProducto" Header="Código" IsSmart="True" Width="90" SoloLectura="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<tsWPFCore:tsGridColumn FieldName="productos1.Descripcion" Header="Descripcion" IsSmart="True" Width="250" SoloLectura="True" />
<tsWPFCore:tsGridColumn FieldName="Unidades" Header="Unidades" IsSmart="True" Width="70">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesMinimas" Header="Unidades Mínimas" IsSmart="True" Width="140">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesMaximas" Header="Unidades Máximas" IsSmart="True" Width="140">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.DetailDescriptor>
<dxg:TabViewDetailDescriptor>
<dxg:TabViewDetailDescriptor.DetailDescriptors>
<dxg:DataControlDetailDescriptor ItemsSourcePath="productos1.desgloseproductos">
<dxg:DataControlDetailDescriptor.DataControl>
<tsWPFCore:tsGridControl x:Name="gcDesgloseHijos">
<dxg:GridControl.View>
<dxg:TableView x:Name="tvDesgloseHijos" DetailHeaderContent="Desglose Producto" ShowGroupPanel="False" RowStyle="{StaticResource RejillaAnidadaStyle}" IsDetailButtonVisibleBinding="{Binding Row.ContieneHijos}" />
</dxg:GridControl.View>
<dxg:GridControl.Columns>
<tsWPFCore:tsGridColumn FieldName="productos1.idProducto" Header="Código" IsSmart="True" Width="90" SoloLectura="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<tsWPFCore:tsGridColumn FieldName="productos1.Descripcion" Header="Descripcion" IsSmart="True" Width="250" SoloLectura="True" />
<tsWPFCore:tsGridColumn FieldName="Unidades" Header="Unidades" IsSmart="True" Width="70">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesMinimas" Header="Unidades Mínimas" IsSmart="True" Width="140">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesMaximas" Header="Unidades Máximas" IsSmart="True" Width="140">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
</dxg:GridControl.Columns>
<!--<dx:DXTabItem Header="Albaranes en los que aparece">
<tsWPF:tsGridControl x:Name="gcAlbaranes" TabIndex="43"> <dxg:GridControl.DetailDescriptor>
<tsWPF:tsGridControl.PropiedadesTS> <dxg:TabViewDetailDescriptor>
<tsWPF:PropiedadesTS Modificable="NoModificable" /> <dxg:TabViewDetailDescriptor.DetailDescriptors>
</tsWPF:tsGridControl.PropiedadesTS> <dxg:DataControlDetailDescriptor ItemsSourcePath="productos1.desgloseproductos">
<tsWPF:tsGridControl.View> <dxg:DataControlDetailDescriptor.DataControl>
<tsWPF:tsTableView ShowSearchPanelMode="Always" ShowTotalSummary="True" x:Name="tvProductosAoV" ShowGroupFooters="True" /> <tsWPFCore:tsGridControl x:Name="gcDesgloseNietos">
</tsWPF:tsGridControl.View> <dxg:GridControl.View>
<dxg:TableView x:Name="tvDesgloseNietos" DetailHeaderContent="Desglose Producto" ShowGroupPanel="False" RowStyle="{StaticResource RejillaAnidadaNietaStyle}" IsDetailButtonVisibleBinding="{Binding Row.ContieneHijos}" />
</dxg:GridControl.View>
<dxg:GridControl.Columns>
<tsWPFCore:tsGridColumn FieldName="productos1.idProducto" Header="Código" IsSmart="True" Width="90" SoloLectura="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<tsWPFCore:tsGridColumn FieldName="productos1.Descripcion" Header="Descripcion" IsSmart="True" Width="250" SoloLectura="True" />
<tsWPFCore:tsGridColumn FieldName="Unidades" Header="Unidades" IsSmart="True" Width="70">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesMinimas" Header="Unidades Mínimas" IsSmart="True" Width="140">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
<tsWPFCore:tsGridColumn FieldName="UnidadesMaximas" Header="Unidades Máximas" IsSmart="True" Width="140">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="n0" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
</dxg:GridColumn.EditSettings>
</tsWPFCore:tsGridColumn>
</dxg:GridControl.Columns>
</tsWPFCore:tsGridControl>
</dxg:DataControlDetailDescriptor.DataControl>
</dxg:DataControlDetailDescriptor>
</dxg:TabViewDetailDescriptor.DetailDescriptors>
</dxg:TabViewDetailDescriptor>
</dxg:GridControl.DetailDescriptor>
</tsWPFCore:tsGridControl>
</dxg:DataControlDetailDescriptor.DataControl>
</dxg:DataControlDetailDescriptor>
</dxg:TabViewDetailDescriptor.DetailDescriptors>
</dxg:TabViewDetailDescriptor>
</dxg:GridControl.DetailDescriptor>
</tsWPFCore:tsGridControl>
</dx:DXTabItem>
<dx:DXTabItem Header="Albaranes en los que aparece">
<tsWPFCore:tsGridControl x:Name="gcAlbaranes" TabIndex="43">
<tsWPFCore:tsGridControl.PropiedadesTS>
<tsWPFCore:PropiedadesTS Modificable="NoModificable" />
</tsWPFCore:tsGridControl.PropiedadesTS>
<tsWPFCore:tsGridControl.View>
<tsWPFCore:tsTableView ShowSearchPanelMode="Always" ShowTotalSummary="True" x:Name="tvProductosAoV" ShowGroupFooters="True" />
</tsWPFCore:tsGridControl.View>
<dxg:GridColumn FieldName="NumeroAlbaran" Header="Nº Albarán" IsSmart="True" Width="120" CellTemplate="{DynamicResource VerDetalleTemplate}" /> <dxg:GridColumn FieldName="NumeroAlbaran" Header="Nº Albarán" IsSmart="True" Width="120" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<dxg:GridColumn FieldName="albaranes.Fecha" Header="Fecha" IsSmart="True" Width="150"> <dxg:GridColumn FieldName="albaranes.Fecha" Header="Fecha" IsSmart="True" Width="150">
<dxg:GridColumn.EditSettings> <dxg:GridColumn.EditSettings>
@@ -129,71 +399,18 @@
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</dxg:GridColumn> </dxg:GridColumn>
<dxg:GridColumn FieldName="Entidad" Header="Cliente/Proveedor" Width="300" IsSmart="True" CellTemplate="{DynamicResource VerDetalleTemplate}" /> <dxg:GridColumn FieldName="Entidad" Header="Cliente/Proveedor" Width="300" IsSmart="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<dxg:GridColumn FieldName="albaranes.DescripcionEvento" Header="Evento" Width="300" /> <dxg:GridColumn FieldName="albaranes.DescripcionObra" Header="Obra" Width="300" />
<dxg:GridColumn FieldName="EsVenta" IsSmart="True" Width="60"> <dxg:GridColumn FieldName="EsVenta" IsSmart="True" Width="60">
<dxg:GridColumn.EditSettings> <dxg:GridColumn.EditSettings>
<dxe:CheckEditSettings IsThreeState="False"> <dxe:CheckEditSettings IsThreeState="False">
</dxe:CheckEditSettings> </dxe:CheckEditSettings>
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</dxg:GridColumn> </dxg:GridColumn>
</tsWPF:tsGridControl> </tsWPFCore:tsGridControl>
</dx:DXTabItem> </dx:DXTabItem>
<dx:DXTabItem Header="Facturas en las que aparece">
<tsWPF:tsGridControl x:Name="gcFacturas" TabIndex="43">
<tsWPF:tsGridControl.PropiedadesTS>
<tsWPF:PropiedadesTS Modificable="NoModificable" />
</tsWPF:tsGridControl.PropiedadesTS>
<tsWPF:tsGridControl.View>
<tsWPF:tsTableView ShowSearchPanelMode="Always" ShowTotalSummary="True" x:Name="tvFacturas" ShowGroupFooters="True" />
</tsWPF:tsGridControl.View>
<dxg:GridColumn FieldName="NumeroFactura" Header="Nº Factura" IsSmart="True" Width="120" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<dxg:GridColumn FieldName="idFacturaNavigation.Fecha" Header="Fecha" IsSmart="True" Width="150">
<dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn FieldName="AlmacenOrigen" Header="Almacén Origen" IsSmart="True" Width="300" />
<dxg:GridColumn FieldName="AlmacenDestino" Header="Almacén Destino" IsSmart="True" Width="300" />
<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="Entidad" Header="Cliente/Proveedor" Width="300" IsSmart="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<dxg:GridColumn FieldName="albaranes.DescripcionEvento" Header="Evento" Width="300" />
<dxg:GridColumn FieldName="EsVenta" IsSmart="True" Width="60">
<dxg:GridColumn.EditSettings>
<dxe:CheckEditSettings IsThreeState="False">
</dxe:CheckEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
</tsWPF:tsGridControl>
</dx:DXTabItem>
<dx:DXTabItem Header="Registro de cambios">
<dxlc:LayoutGroup Orientation="Vertical">
<tsWPF:tsGridControl x:Name="gcLogs" TabIndex="45">
<tsWPF:tsGridControl.PropiedadesTS>
<tsWPF:PropiedadesTS Modificable="NoModificable" />
</tsWPF:tsGridControl.PropiedadesTS>
<dxg:GridControl.View>
<tsWPF:tsTableView x:Name="tvLogs" ShowSearchPanelMode="Default" ShowGroupPanel="False" />
</dxg:GridControl.View>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="idLog" Header="Nº Cambio" IsSmart="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<dxg:GridColumn FieldName="FechaHora" Header="Fecha Hora Cambio">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="DateTime" MaskUseAsDisplayFormat="True" Mask="dd/MM/yyyy HH:mm" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn FieldName="Usuario" Header="Usuario" Width="250" IsSmart="True" />
<dxg:GridColumn FieldName="ip" Header="Dirección IP" IsSmart="True" Width="150" />
</dxg:GridControl.Columns>
</tsWPF:tsGridControl>
</dxlc:LayoutGroup>
</dx:DXTabItem>-->
</dx:DXTabControl> </dx:DXTabControl>
</dxlc:LayoutControl> </dxlc:LayoutControl>
</Grid> </Grid>
</tsWPF:tsUserControl> </tsWPFCore:tsUserControl>

View File

@@ -1,14 +1,13 @@
Imports bdGrupoSanchoToro.db Imports System.Collections
Imports DevExpress.Xpf.Bars Imports bdGrupoSanchoToro.db
Imports bdGrupoSanchoToro.db.tscGrupoSanchoToro
Imports bdGrupoSanchoToro.db.Utilidades
Imports DevExpress.Xpf.Grid
Imports System.Collections
Imports tsWPFCore
Imports DevExpress.Xpf.Core
Imports DevExpress.XtraSplashScreen
Imports bdGrupoSanchoToro.db.productos Imports bdGrupoSanchoToro.db.productos
Imports bdGrupoSanchoToro.db.Utilidades
Imports DevExpress.Xpf.Bars
Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.Grid
Imports DevExpress.XtraSplashScreen
Imports Microsoft.EntityFrameworkCore Imports Microsoft.EntityFrameworkCore
Imports tsWPFCore
Public Class ucProducto Public Class ucProducto
@@ -20,31 +19,31 @@ Public Class ucProducto
Public Overrides Function EstablecedcPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion Public Overrides Function EstablecedcPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion
Dim NuevoEstado As tsUtilidades.EstadosAplicacion Dim NuevoEstado As tsUtilidades.EstadosAplicacion
If idLog.HasValue Then If idLog.HasValue Then
Try 'Try
Dim log = bd.logs.First(Function(x) x.idLog = idLog) ' Dim log = bd.logs.First(Function(x) x.idLog = idLog)
ra = tsUtilidades.Utilidades.DeserializarSinErrores(log.Log, GetType(productos)) ' ra = tsUtilidades.Utilidades.DeserializarSinErrores(log.LogXML, GetType(productos))
If ra.idUsuarioCreador.HasValue Then ra.idUsuarioCreadorNavigation = bd.usuarios.FirstOrDefault(Function(x) x.idUsuario = ra.idUsuarioCreador.Value) ' If ra.idUsuarioCreador.HasValue Then ra.idUsuarioCreadorNavigation = bd.usuarios.FirstOrDefault(Function(x) x.idUsuario = ra.idUsuarioCreador.Value)
If ra.idUsuarioModificador.HasValue Then ra.idUsuarioModificadorNavigation = bd.usuarios.FirstOrDefault(Function(x) x.idUsuario = ra.idUsuarioModificador.Value) ' If ra.idUsuarioModificador.HasValue Then ra.idUsuarioModificadorNavigation = bd.usuarios.FirstOrDefault(Function(x) x.idUsuario = ra.idUsuarioModificador.Value)
If bd.logs.Any(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "ARTICULOS") Then ' If bd.logs.Any(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "ARTICULOS") Then
Dim entspol = bd.logs.First(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "ARTICULOS") ' Dim entspol = bd.logs.First(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "ARTICULOS")
Dim ld = tsUtilidades.Utilidades.DeserializarSinErrores(entspol.Log, GetType(List(Of articulos))) ' Dim ld = tsUtilidades.Utilidades.DeserializarSinErrores(entspol.LogXML, GetType(List(Of articulos)))
For Each d In ld ' For Each d In ld
ra.articulos.Add(d) ' ra.articulos.Add(d)
Next ' Next
End If ' End If
NuevoEstado = tsUtilidades.EstadosAplicacion.ModificandoRegistro ' NuevoEstado = tsUtilidades.EstadosAplicacion.ModificandoRegistro
Catch EX As Exception 'Catch EX As Exception
Throw New Exception("No ha sido posible mostrar el registro del cambio (id " & idLog.Value.ToString & ").", EX) ' Throw New Exception("No ha sido posible mostrar el registro del cambio (id " & idLog.Value.ToString & ").", EX)
End Try 'End Try
Else Else
If Estado = tsUtilidades.EstadosAplicacion.Nuevo OrElse _idproducto Is Nothing OrElse FuerzaNuevo Then If Estado = tsUtilidades.EstadosAplicacion.Nuevo OrElse _idproducto Is Nothing OrElse FuerzaNuevo Then
ra = New productos ra = New productos
'ra.TotalUnidades = 0 ra.TotalUnidades = 0
'ra.UnidadesVendidas = 0 ra.UnidadesVendidas = 0
'ra.UnidadesAlquiladas = 0 ra.UnidadesAlquiladas = 0
'ra.UnidadesAveriadas = 0 ra.UnidadesAveriadas = 0
'ra.UnidadesDesechadas = 0 ra.UnidadesDesechadas = 0
'ra.FacturarComoVentaPorDefecto = False ra.FacturarComoVentaPorDefecto = False
Me.DataContext = ra Me.DataContext = ra
_idproducto = Nothing _idproducto = Nothing
NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo NuevoEstado = tsUtilidades.EstadosAplicacion.Nuevo
@@ -53,14 +52,17 @@ Public Class ucProducto
NuevoEstado = tsUtilidades.EstadosAplicacion.ModificandoRegistro NuevoEstado = tsUtilidades.EstadosAplicacion.ModificandoRegistro
End If End If
End If End If
' Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ra.idProducto AndAlso x.Aplicacion = "PRODUCTOS").ToList ' Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ra.idProducto AndAlso x.Aplicacion = "PRODUCTOS").ToList
Me.gcDesglose.ItemsSource = ra.DesgloseMaterial
'Me.gcServicios.ItemsSource = ra.DesgloseServicios 'Me.gcServicios.ItemsSource = ra.DesgloseServicios
If ra.Servicio Then If ra.Tipo <> TipoProductoEnum.SERVICIO Then
Me.gcStocksAlmacenes.ItemsSource = ObtieneISAlmacenes() Me.gcStocksAlmacenes.ItemsSource = ObtieneISAlmacenes()
Me.gcStocksEmpresas.ItemsSource = ra.DesgloseUnidades
Else Else
Me.gcStocksAlmacenes.ItemsSource = Nothing Me.gcStocksAlmacenes.ItemsSource = Nothing
Me.gcStocksEmpresas.ItemsSource = Nothing
End If End If
Me.gcAlbaranes.ItemsSource = bd.detallesalbaranes.Include(Function(x) x.idAlbaranNavigation.idEntidadNavigation).Where(Function(x) x.idProducto = ra.idProducto).OrderByDescending(Function(x) x.idAlbaranNavigation.Fecha).ToList
Me.DataContext = ra Me.DataContext = ra
' gcArticulos.ItemsSource = ra.articulos ' gcArticulos.ItemsSource = ra.articulos
@@ -165,7 +167,8 @@ Public Class ucProducto
Try Try
Dim idprs = ra.articulos.Where(Function(x) x.idProveedor.HasValue).Select(Function(x) x.idProveedor.Value).ToArray Dim idprs = ra.articulos.Where(Function(x) x.idProveedor.HasValue).Select(Function(x) x.idProveedor.Value).ToArray
Me.cbTipo.ItemsSource = tsUtilidades.DescripcionValor.EnumADescripcionValor(GetType(bdGrupoSanchoToro.db.productos.TipoProductoEnum)).ToList Me.cbTipo.ItemsSource = tsUtilidades.DescripcionValor.EnumADescripcionValor(GetType(bdGrupoSanchoToro.db.productos.TipoProductoEnum)) _
.OrderBy(Function(x) x.Valor).ToList
Catch ex As Exception Catch ex As Exception
Throw New Exception(ex.Message, ex) Throw New Exception(ex.Message, ex)
End Try End Try
@@ -201,11 +204,34 @@ Public Class ucProducto
Private Sub ucProducto_DespuesGuardar(sender As Object, e As ItemClickEventArgs, OpcionGuardado As Integer) Handles Me.DespuesGuardar
Try
_idproducto = ra.idProducto
ra.RefrescaCamposTemporales()
If RecalcularStocks Then
RecalcularStocks = False
DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
DXSplashScreen.SetState("Recalculando Stocks ...")
Dim lp As New List(Of productos)
lp.Add(ra)
bdGrupoSanchoToro.db.productos.RecalculaStocks(bd, lp)
DXSplashScreen.Close()
End If
RefrescaUC()
Catch ex As Exception
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
Throw New Exception(ex.Message, ex)
End Try
End Sub
Private Sub ucProducto_Enlazar(Celda As EditGridCellData, Defecto As Boolean) Handles Me.Enlazar Private Sub ucProducto_Enlazar(Celda As EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
Select Case Celda.Column.FieldName.ToLower Select Case Celda.Column.FieldName.ToLower
Case "productos1.idproducto"
Dim dp As desgloseproductos = Celda.Row
Dim id As Integer = dp.idProducto
Dim uc As New ucProducto(id)
FuncionesDinamicas.AbrirAP(uc, OtrosParametros)
'Case "idlog" 'Case "idlog"
' Dim log As logs = gcLogs.CurrentItem ' Dim log As logs = gcLogs.CurrentItem
' Dim id As Integer = log.idLog ' Dim id As Integer = log.idLog
@@ -215,9 +241,9 @@ Public Class ucProducto
Case "almacen" Case "almacen"
Dim st As stocks = Celda.Row Dim st As stocks = Celda.Row
FuncionesDinamicas.AbrirAP(New ucAlmacen(st.idAlmacen), OtrosParametros) FuncionesDinamicas.AbrirAP(New ucAlmacen(st.idAlmacen), OtrosParametros)
'Case "numeroalbaran" Case "numeroalbaran"
' Dim al As detallesalbaranes = Celda.Row Dim al As detallesalbaranes = Celda.Row
' FuncionesDinamicas.AbrirAP(New ucAlbaran(al.idAlbaran), OtrosParametros) FuncionesDinamicas.AbrirAP(New ucAlbaran(al.idAlbaran), OtrosParametros)
Case "entidad" Case "entidad"
Dim da As detallesalbaranes = Celda.Row Dim da As detallesalbaranes = Celda.Row
If da.idAlbaranNavigation.idEntidad.HasValue Then FuncionesDinamicas.AbrirAP(New ucEntidad(da.idAlbaranNavigation.idEntidad.Value), OtrosParametros) If da.idAlbaranNavigation.idEntidad.HasValue Then FuncionesDinamicas.AbrirAP(New ucEntidad(da.idAlbaranNavigation.idEntidad.Value), OtrosParametros)
@@ -237,46 +263,42 @@ Public Class ucProducto
Private RecalcularStocks As Boolean Private RecalcularStocks As Boolean
'Private Sub ucProducto_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, EliminacionManual As Integer) Handles Me.AntesGuardar Private Sub ucProducto_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, EliminacionManual As Integer) Handles Me.AntesGuardar
' ' '
' ' Esto se hace para evitar error duplicate entry en el intercambio de numero de series ' Esto se hace para evitar error duplicate entry en el intercambio de numero de series
' ' '
' Try Try
' Dim bdtmp = tscGrupoSanchoToro.NuevoContexto() Dim bdtmp = tscGrupoSanchoToro.NuevoContexto()
' Dim arts = bdtmp.articulos.Where(Function(x) x.idProducto = ra.idProducto).ToList Dim arts = bdtmp.articulos.Where(Function(x) x.idProducto = ra.idProducto).ToList
' For Each art In arts For Each art In arts
' If ra.articulos.Any(Function(x) x.idArticulo <> art.idArticulo AndAlso art.CodigoArticulo = x.CodigoArticulo) Then If ra.articulos.Any(Function(x) x.idArticulo <> art.idArticulo AndAlso art.CodigoArticulo = x.CodigoArticulo) Then
' art.CodigoArticulo = Nothing art.CodigoArticulo = Nothing
' End If End If
' Next Next
' 'If Estado = tsUtilidades.EstadosAplicacion.ModificandoRegistro Then If Estado = tsUtilidades.EstadosAplicacion.ModificandoRegistro Then
' ' Dim raant = bdtmp.productos.First(Function(x) x.idProducto = ra.idProducto) Dim raant = bdtmp.productos.First(Function(x) x.idProducto = ra.idProducto)
' ' If (ra.Tipo = TipoProductoEnum.ELEMENTO_FINAL_TRIBUNA OrElse ra.Tipo = TipoProductoEnum.ELEMENTO_FINAL_CARPA OrElse ra.Tipo <= TipoProductoEnum.OTROS) AndAlso If ra.Tipo <> TipoProductoEnum.SERVICIO Then
' ' Not (raant.Tipo = TipoProductoEnum.ELEMENTO_FINAL_TRIBUNA OrElse raant.Tipo = TipoProductoEnum.ELEMENTO_FINAL_CARPA OrElse raant.Tipo <= TipoProductoEnum.OTROS) Then RecalcularStocks = True
' ' RecalcularStocks = True Else
' ' Else For i = ra.stocks.Count - 1 To 0
' ' If Not (ra.Tipo = TipoProductoEnum.ELEMENTO_FINAL_TRIBUNA OrElse ra.Tipo = TipoProductoEnum.ELEMENTO_FINAL_CARPA OrElse ra.Tipo <= TipoProductoEnum.OTROS) AndAlso bd.stocks.Remove(ra.stocks(i))
' ' (raant.Tipo = TipoProductoEnum.ELEMENTO_FINAL_TRIBUNA OrElse raant.Tipo = TipoProductoEnum.ELEMENTO_FINAL_CARPA OrElse raant.Tipo <= TipoProductoEnum.OTROS) Then Next
' ' For i = ra.stocks.Count - 1 To 0 ra.TotalUnidades = 0
' ' bd.stocks.Remove(ra.stocks(i)) ra.UnidadesInicialesOFabricadas = 0
' ' Next ra.UnidadesCompradas = 0
' ' ra.TotalUnidades = 0 ra.UnidadesVendidas = 0
' ' ra.UnidadesInicialesOFabricadas = 0 ra.UnidadesAlquiladas = 0
' ' ra.UnidadesCompradas = 0 ra.UnidadesAveriadas = 0
' ' ra.UnidadesVendidas = 0 ra.UnidadesDesechadas = 0
' ' ra.UnidadesAlquiladas = 0 ra.UnidadesSubAlquiladas = 0
' ' ra.UnidadesAveriadas = 0 End If
' ' ra.UnidadesDesechadas = 0 End If
' ' ra.UnidadesSubAlquiladas = 0
' ' End If
' ' End If
' 'End If
' bdtmp.GuardarCambios() bdtmp.GuardarCambios()
' Catch ex As Exception Catch ex As Exception
' Throw New Exception(ex.Message, ex) Throw New Exception(ex.Message, ex)
' End Try End Try
'End Sub End Sub
Private Sub ucProducto_EstadoCambiado(EstadoAnterior As tsUtilidades.EstadosAplicacion, EstadoNuevo As tsUtilidades.EstadosAplicacion) Handles Me.EstadoCambiado Private Sub ucProducto_EstadoCambiado(EstadoAnterior As tsUtilidades.EstadosAplicacion, EstadoNuevo As tsUtilidades.EstadosAplicacion) Handles Me.EstadoCambiado
If idLog.HasValue Then If idLog.HasValue Then
@@ -288,22 +310,22 @@ Public Class ucProducto
Private Sub ucProducto_EjecutarAccion(sender As Object, e As ItemClickEventArgs, idAccion As Integer) Handles Me.EjecutarAccion Private Sub ucProducto_EjecutarAccion(sender As Object, e As ItemClickEventArgs, idAccion As Integer) Handles Me.EjecutarAccion
'Select Case idAccion 'Select Case idAccion
' Case 1 ' AÑADIR PRODUCTOS AL DESGLOSE ' Case 1 ' AÑADIR PRODUCTOS AL DESGLOSE
' Dim prsact = ra.DesgloseMaterial.Select(Function(x) x.idProducto).ToList
' Dim maxasc = ra.NivelMaximoAscendientes
' Dim lproductos = bd.productos.ToList.Where(Function(x) (maxasc + x.NivelMaximoDescendientes) < 3 AndAlso ra.ContieneAscendiente(x.idProducto) = False AndAlso prsact.Contains(x.idProducto) = False).ToList
' Dim dxw As New dxwProductos(lproductos)
' If dxw.ShowDialog Then
' Dim prod = lproductos.First(Function(x) x.idProducto = dxw.idProducto)
' Dim nd As New desgloseproductos
' With nd
' .idProductoNavigation = prod
' .Unidades = 1
' .UnidadesMaximas = 1
' .UnidadesMinimas = 1
' End With
' ra.desgloseproductosidProductoNavigation.Add(nd)
' ra.RefrescaCamposTemporales()
' End If
'End Select 'End Select
End Sub End Sub
Private Sub ucProducto_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, EliminacionManual As Integer) Handles Me.AntesGuardar
ra.idEmpresa = EmpresaActual.idEmpresa
Dim hte As New Hashtable
ra.idEmpresa = EmpresaActual.idEmpresa
Dim almexi = bd.productos.FirstOrDefault(Function(x) x.idProducto <> ra.idProducto AndAlso x.Descripcion = ra.Descripcion AndAlso x.idEmpresa = EmpresaActual.idEmpresa)
If almexi IsNot Nothing Then
hte.Add("ALMACENAR-PRODUCTO_DUPLIADO", "Producto Duplicado")
End If
If hte.Count > 0 Then
MensajesError = hte
Cancelar = True
End If
End Sub
End Class End Class

View File

@@ -60,14 +60,14 @@ Public Class ucProductos
Public Overrides Function EstableceDCPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion Public Overrides Function EstableceDCPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion
If Refrescar OrElse Background Then ObtieneproductosAsync(bd, Background) If Refrescar OrElse Background Then ObtieneproductosAsync(bd, Background)
'If Me.ContenedorAplicacion.cbAcciones.ItemsSource Is Nothing Then If Me.ContenedorAplicacion.cbAcciones.ItemsSource Is Nothing Then
' Dim Acciones As New List(Of tsWPFCore.Accion) Dim Acciones As New List(Of tsWPFCore.Accion)
' Acciones.Add(New Accion With { Acciones.Add(New Accion With {
' .idAccion = 1, .idAccion = 1,
' .Descripcion = "CORREGIR STOCK"}) .Descripcion = "CORREGIR STOCK"})
' Me.ContenedorAplicacion.cbAcciones.ItemsSource = Acciones Me.ContenedorAplicacion.cbAcciones.ItemsSource = Acciones
' Me.ContenedorAplicacion.beAcciones.EditValue = Acciones.First.idAccion Me.ContenedorAplicacion.beAcciones.EditValue = Acciones.First.idAccion
'End If End If
Return tsUtilidades.EstadosAplicacion.AplicacionSinIndice Return tsUtilidades.EstadosAplicacion.AplicacionSinIndice
@@ -128,7 +128,7 @@ Public Class ucProductos
End Sub End Sub
Public Function Obtieneproductos(TextoBusqueda As String, IncluirBajas As Boolean) As List(Of productos) Public Function Obtieneproductos(TextoBusqueda As String, IncluirBajas As Boolean) As List(Of productos)
Dim iqPr = bd.productos.Where(Function(x) x.idEmpresa = EmpresaActual.idEmpresa) Dim iqPr = bd.productos.AsQueryable
If IncluirBajas Then iqPr = iqPr.Where(Function(x) x.FechaBaja Is Nothing).OrderBy(Function(x) x.Descripcion) If IncluirBajas Then iqPr = iqPr.Where(Function(x) x.FechaBaja Is Nothing).OrderBy(Function(x) x.Descripcion)
Dim rs As List(Of productos) Dim rs As List(Of productos)
Do Do
@@ -187,6 +187,19 @@ Public Class ucProductos
teBusqueda.SelectAll() teBusqueda.SelectAll()
End Sub End Sub
Private Sub ucProductos_EjecutarAccion(sender As Object, e As ItemClickEventArgs, idAccion As Integer) Handles Me.EjecutarAccion
Try
Select Case idAccion
Case 1 ' RECALCULA STOCKS DE TODOS LOS PRODUCTOS
If DXSplashScreen.IsActive = False Then DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
DXSplashScreen.SetState("Recalculando stocks ...")
Dim lp = bd.detallesalbaranes.Where(Function(x) x.idAlbaranRecogida.HasValue = False).Select(Function(x) x.idProductoNavigation).Distinct().ToList()
bdGrupoSanchoToro.db.productos.RecalculaStocks(bd, lp)
DXSplashScreen.Close()
End Select
Catch ex As Exception
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
FuncionesDinamicas.ErrorNoControladoAp(Me, ex)
End Try
End Sub
End Class End Class

View File

@@ -124,7 +124,7 @@ Public Class ucFacturasEmitidas
Dim iNumExc As Integer = 0 Dim iNumExc As Integer = 0
Do Do
Try Try
rs = bd.facturas.Where(Function(x) x.idClienteNavigation.idEmpresa = EmpresaActual.idEmpresa).Include(Function(x) x.idSerieFacturaNavigation).Include(Function(x) x.movimientoscaja).Include(Function(x) x.idClienteNavigation).Include(Function(x) x.idEventoNavigation.CodigoMunicipioNavigation.CodigoProvinciaNavigation).Include(Function(x) x.idUsuarioNavigation).AsQueryable rs = bd.facturas.Where(Function(x) x.idClienteNavigation.idEmpresa = EmpresaActual.idEmpresa).Include(Function(x) x.idSerieFacturaNavigation).Include(Function(x) x.movimientoscaja).Include(Function(x) x.idClienteNavigation).Include(Function(x) x.idObraNavigation.CodigoMunicipioNavigation.CodigoProvinciaNavigation).Include(Function(x) x.idUsuarioNavigation).AsQueryable
If FechaInicio.HasValue Then If FechaInicio.HasValue Then
rs = rs.Where(Function(x) x.FechaFactura >= FechaInicio.Value) rs = rs.Where(Function(x) x.FechaFactura >= FechaInicio.Value)

View File

@@ -35,7 +35,7 @@ Public Class dxwInicio
Comun.dg = Me.grupodoc Comun.dg = Me.grupodoc
tsWPFCore.Configuracion.ModoBusquedaAND = True tsWPFCore.Configuracion.ModoBusquedaAND = True
tsWPFCore.Configuracion.ComportamientoValidacion = DevExpress.Xpf.Editors.Validation.InvalidValueBehavior.AllowLeaveEditor tsWPFCore.Configuracion.ComportamientoValidacion = DevExpress.Xpf.Editors.Validation.InvalidValueBehavior.AllowLeaveEditor
' tsWPFCore.Configuracion.ModoEventosContextoSavingChanges = ModoContextoSavingChangesEnum.SoloDespuesGuardar ' tsWPFCore.Configuracion.ModoObrasContextoSavingChanges = ModoContextoSavingChangesEnum.SoloDespuesGuardar
tsWPFCore.Configuracion.MostrarBotonCerrarEnPestaña = True tsWPFCore.Configuracion.MostrarBotonCerrarEnPestaña = True
bdGrupoSanchoToro.db.Utilidades.DirectorioLogs = "c:\m3soft\logs\" bdGrupoSanchoToro.db.Utilidades.DirectorioLogs = "c:\m3soft\logs\"
Catch ex As Exception Catch ex As Exception

View File

@@ -205,7 +205,7 @@
</tsWPF:tsGridColumn.EditSettings> </tsWPF:tsGridColumn.EditSettings>
</tsWPF:tsGridColumn> </tsWPF:tsGridColumn>
<tsWPF:tsGridControl.GroupSummary> <tsWPF:tsGridControl.GroupSummary>
<dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="eventos.Direccion" /> <dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="Obras.Direccion" />
<dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="TotalIVA" SummaryType="Sum" ShowInGroupColumnFooter="IVA" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalIVA" SummaryType="Sum" ShowInGroupColumnFooter="IVA" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" />
@@ -213,7 +213,7 @@
<dxg:GridSummaryItem FieldName="ImportePendiente" SummaryType="Sum" ShowInGroupColumnFooter="ImportePendiente" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="ImportePendiente" SummaryType="Sum" ShowInGroupColumnFooter="ImportePendiente" DisplayFormat=" {0:c2}" />
</tsWPF:tsGridControl.GroupSummary> </tsWPF:tsGridControl.GroupSummary>
<tsWPF:tsGridControl.TotalSummary> <tsWPF:tsGridControl.TotalSummary>
<dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="eventos.Direccion" /> <dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="Obras.Direccion" />
<dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="TotalIVA" SummaryType="Sum" ShowInGroupColumnFooter="TotalIVA" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalIVA" SummaryType="Sum" ShowInGroupColumnFooter="TotalIVA" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" />

View File

@@ -174,9 +174,9 @@
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy" /> <dxe:DateEditSettings DisplayFormat="dd/MM/yyyy" />
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</dxg:GridColumn> </dxg:GridColumn>
<dxg:GridColumn FieldName="DireccionEvento" Header="Dirección Obra" Width="350" /> <dxg:GridColumn FieldName="DireccionObra" Header="Dirección Obra" Width="350" />
<dxg:GridColumn FieldName="PoblacionEvento" Header="Población Obra" IsSmart="True" Width="300" /> <dxg:GridColumn FieldName="PoblacionObra" Header="Población Obra" IsSmart="True" Width="300" />
<dxg:GridColumn FieldName="ProvinciaEvento" Header="Provincia Obra" IsSmart="True" Width="150" /> <dxg:GridColumn FieldName="ProvinciaObra" Header="Provincia Obra" IsSmart="True" Width="150" />
<dxg:GridColumn FieldName="TotalBaseImponible" IsSmart="True" Width="100" Header="Base Imponible"> <dxg:GridColumn FieldName="TotalBaseImponible" IsSmart="True" Width="100" Header="Base Imponible">
<dxg:GridColumn.EditSettings> <dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" Mask="c2" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" /> <dxe:TextEditSettings MaskType="Numeric" Mask="c2" MaskUseAsDisplayFormat="True" HorizontalContentAlignment="Right" />
@@ -208,7 +208,7 @@
</dxg:GridColumn.EditSettings> </dxg:GridColumn.EditSettings>
</dxg:GridColumn> </dxg:GridColumn>
<tsWPF:tsGridControl.GroupSummary> <tsWPF:tsGridControl.GroupSummary>
<dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="eventos.Direccion" /> <dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="Obras.Direccion" />
<dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="IVA" SummaryType="Sum" ShowInGroupColumnFooter="IVA" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="IVA" SummaryType="Sum" ShowInGroupColumnFooter="IVA" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" />
@@ -216,7 +216,7 @@
<dxg:GridSummaryItem FieldName="ImportePendiente" SummaryType="Sum" ShowInGroupColumnFooter="ImportePendiente" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="ImportePendiente" SummaryType="Sum" ShowInGroupColumnFooter="ImportePendiente" DisplayFormat=" {0:c2}" />
</tsWPF:tsGridControl.GroupSummary> </tsWPF:tsGridControl.GroupSummary>
<tsWPF:tsGridControl.TotalSummary> <tsWPF:tsGridControl.TotalSummary>
<dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="eventos.Direccion" /> <dxg:GridSummaryItem SummaryType="Count" DisplayFormat="Nº Facturas: {0:n0}" ShowInGroupColumnFooter="Obras.Direccion" />
<dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalBaseImponible" SummaryType="Sum" ShowInGroupColumnFooter="TotalBaseImponible" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="IVA" SummaryType="Sum" ShowInGroupColumnFooter="IVA" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="IVA" SummaryType="Sum" ShowInGroupColumnFooter="IVA" DisplayFormat=" {0:c2}" />
<dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" /> <dxg:GridSummaryItem FieldName="TotalFactura" SummaryType="Sum" ShowInGroupColumnFooter="TotalFactura" DisplayFormat=" {0:c2}" />
@@ -268,7 +268,7 @@
</tsWPF:tsGridControl> </tsWPF:tsGridControl>
</dx:DXTabItem> </dx:DXTabItem>
<dx:DXTabItem Header="Obras"> <dx:DXTabItem Header="Obras">
<tsWPF:tsGridControl x:Name="gcObras" NombreTablaBase="eventos" TabIndex="23"> <tsWPF:tsGridControl x:Name="gcObras" NombreTablaBase="Obras" TabIndex="23">
<tsWPF:tsGridControl.PropiedadesTSGC> <tsWPF:tsGridControl.PropiedadesTSGC>
<tsWPF:PropiedadesTSGC /> <tsWPF:PropiedadesTSGC />
</tsWPF:tsGridControl.PropiedadesTSGC> </tsWPF:tsGridControl.PropiedadesTSGC>

View File

@@ -49,9 +49,9 @@ Public Class ucEntidad
If ra.idUsuarioModificador.HasValue Then ra.idUsuarioModificadorNavigation = bd.usuarios.FirstOrDefault(Function(x) x.idUsuario = ra.idUsuarioModificador.Value) If ra.idUsuarioModificador.HasValue Then ra.idUsuarioModificadorNavigation = bd.usuarios.FirstOrDefault(Function(x) x.idUsuario = ra.idUsuarioModificador.Value)
If bd.logs.Any(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "OBRAS") Then If bd.logs.Any(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "OBRAS") Then
Dim entspol = bd.logs.First(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "OBRAS") Dim entspol = bd.logs.First(Function(x) x.idRelacionado = log.idLog AndAlso x.Aplicacion = "OBRAS")
Dim ld = tsUtilidades.Utilidades.deserializarsinerrores(entspol.Log, GetType(List(Of eventos))) Dim ld = tsUtilidades.Utilidades.deserializarsinerrores(entspol.Log, GetType(List(Of obras)))
For Each d In ld For Each d In ld
ra.eventos.Add(d) ra.Obras.Add(d)
Next Next
End If End If
NuevoEstado = tsUtilidades.EstadosAplicacion.ModificandoRegistro NuevoEstado = tsUtilidades.EstadosAplicacion.ModificandoRegistro
@@ -72,7 +72,7 @@ Public Class ucEntidad
End If End If
End If End If
gcFacturasEmitidas.ItemsSource = bd.facturas.Include(Function(x) x.idEventoNavigation.CodigoMunicipioNavigation.CodigoProvinciaNavigation).Include(Function(x) x.movimientoscaja).Where(Function(x) x.idCliente = ra.idEntidad).OrderByDescending(Function(x) x.FechaFactura).ThenByDescending(Function(x) x.NumeroFactura).ToList gcFacturasEmitidas.ItemsSource = bd.facturas.Include(Function(x) x.idObraNavigation.CodigoMunicipioNavigation.CodigoProvinciaNavigation).Include(Function(x) x.movimientoscaja).Where(Function(x) x.idCliente = ra.idEntidad).OrderByDescending(Function(x) x.FechaFactura).ThenByDescending(Function(x) x.NumeroFactura).ToList
gcFacturasRecibidas.ItemsSource = bd.facturasrecibidas.Where(Function(x) x.idProveedor = ra.idEntidad).OrderByDescending(Function(x) x.FechaFactura).ToList gcFacturasRecibidas.ItemsSource = bd.facturasrecibidas.Where(Function(x) x.idProveedor = ra.idEntidad).OrderByDescending(Function(x) x.FechaFactura).ToList
gcExpediente.ItemsSource = ra.expedientesentidades gcExpediente.ItemsSource = ra.expedientesentidades
Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ra.idEntidad AndAlso x.Aplicacion = "ENTIDADES" AndAlso x.idRelacionado Is Nothing).OrderByDescending(Function(x) x.idLog).ToList Me.gcLogs.ItemsSource = bd.logs.Where(Function(x) x.id = ra.idEntidad AndAlso x.Aplicacion = "ENTIDADES" AndAlso x.idRelacionado Is Nothing).OrderByDescending(Function(x) x.idLog).ToList

View File

@@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18 # Visual Studio Version 18
VisualStudioVersion = 18.2.11415.280 d18.0 VisualStudioVersion = 18.2.11415.280
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bdGrupoSanchoToro", "bdGrupoSanchoToro\bdGrupoSanchoToro.csproj", "{747EDA0C-CF88-4F3A-88C2-9CE2F23B5D56}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bdGrupoSanchoToro", "bdGrupoSanchoToro\bdGrupoSanchoToro.csproj", "{747EDA0C-CF88-4F3A-88C2-9CE2F23B5D56}"
EndProject EndProject
@@ -9,6 +9,10 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "GestionGrupoSanchoToro", "G
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicioGrupoSanchoToro", "ServicioGrupoSanchoToro\ServicioGrupoSanchoToro.csproj", "{B5C14166-BE3A-4F61-BD9A-11894BC45C1F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicioGrupoSanchoToro", "ServicioGrupoSanchoToro\ServicioGrupoSanchoToro.csproj", "{B5C14166-BE3A-4F61-BD9A-11894BC45C1F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InterconexionHP", "..\Guadex\InterconexionHP\InterconexionHP.csproj", "{43932962-58FE-A2E7-8695-ADFDB60EC1E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiDatosSanchoToro", "..\Guadex\ApiDatosGuadex\ApiDatosSanchoToro.csproj", "{B399F33C-87E1-6AA2-D9E0-6044133F45F8}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Any CPU = All|Any CPU All|Any CPU = All|Any CPU
@@ -34,6 +38,18 @@ Global
{B5C14166-BE3A-4F61-BD9A-11894BC45C1F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5C14166-BE3A-4F61-BD9A-11894BC45C1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5C14166-BE3A-4F61-BD9A-11894BC45C1F}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5C14166-BE3A-4F61-BD9A-11894BC45C1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5C14166-BE3A-4F61-BD9A-11894BC45C1F}.Release|Any CPU.Build.0 = Release|Any CPU {B5C14166-BE3A-4F61-BD9A-11894BC45C1F}.Release|Any CPU.Build.0 = Release|Any CPU
{43932962-58FE-A2E7-8695-ADFDB60EC1E2}.All|Any CPU.ActiveCfg = Debug|Any CPU
{43932962-58FE-A2E7-8695-ADFDB60EC1E2}.All|Any CPU.Build.0 = Debug|Any CPU
{43932962-58FE-A2E7-8695-ADFDB60EC1E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43932962-58FE-A2E7-8695-ADFDB60EC1E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43932962-58FE-A2E7-8695-ADFDB60EC1E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43932962-58FE-A2E7-8695-ADFDB60EC1E2}.Release|Any CPU.Build.0 = Release|Any CPU
{B399F33C-87E1-6AA2-D9E0-6044133F45F8}.All|Any CPU.ActiveCfg = Debug|Any CPU
{B399F33C-87E1-6AA2-D9E0-6044133F45F8}.All|Any CPU.Build.0 = Debug|Any CPU
{B399F33C-87E1-6AA2-D9E0-6044133F45F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B399F33C-87E1-6AA2-D9E0-6044133F45F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B399F33C-87E1-6AA2-D9E0-6044133F45F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B399F33C-87E1-6AA2-D9E0-6044133F45F8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -0,0 +1,80 @@
using Castle.Core.Configuration;
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using tsUtilidades.Extensiones;
namespace bdGrupoSanchoToro.Importaciones
{
public class ImportaARTICULOS
{
public static void Importar(byte[] Fichero)
{
try
{
var bd = tscGrupoSanchoToro.NuevoContexto();
var lp = bd.productos.Where(x=> x.Tipo!=(int)db.productos.TipoProductoEnum.GRUA).ToList();
var la = bd.articulos.ToList();
var ds = new XSD.ARTICULOS();
ds.ReadXml(new System.IO.MemoryStream(Fichero));
int i = 1;
int Ultimalinea = ds.Tables["Datos"].Rows.Count;
foreach (XSD.ARTICULOS.DatosRow ar in ds.Tables["Datos"].Rows)
{
try
{
var pr = lp.FirstOrDefault(x => x.Codigo == ar.ARCPR || x.Descripcion == ar.ARDES.Trim());
if (pr == null)
{
string sDes = ImportaPRODUCTOS.pros.FirstOrDefault(x=>x.PRCOD == ar.ARCPR )?.PRDES;
pr = lp.FirstOrDefault(x => x.Descripcion == sDes);
}
if (pr != null)
{
var art = la.FirstOrDefault(x => x.idProducto == pr.idProducto && x.CodigoArticulo == ar.ARNSE.Trim()) ;
if (art == null)
{
art = new bdGrupoSanchoToro.db.articulos();
bd.articulos.Add(art);
la.Add(art);
}
art.idProductoNavigation = pr;
art.CodigoArticulo = ar.ARNSE.Trim();
art.NumeroSerie = ar.ARNSE.Trim();
art.FechaBaja = ar.ARFEN.FechaStringADateOnly();
//art.FechaBaja = ar.CPFBA.FechaStringADateOnly();
// art.Matricula = ar.CPMAT;
i = i + 1;
if (i > 1000)
{
bd.SaveChanges();
i = 0;
}
}
else
{
Debug.Write("aqui");
}
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
bd.SaveChanges();
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
}
}

View File

@@ -16,12 +16,12 @@ namespace bdGrupoSanchoToro.Importaciones
var bd = tscGrupoSanchoToro.NuevoContexto(); var bd = tscGrupoSanchoToro.NuevoContexto();
var le = bd.enumeraciones.ToList(); var le = bd.enumeraciones.ToList();
var grs = bd.gruposenumeraciones.ToList(); var grs = bd.gruposenumeraciones.ToList();
var dsprueba = new XSD.CTESGESL(); var ds = new XSD.CTESGESL();
dsprueba.ReadXml(new System.IO.MemoryStream(Fichero)); ds.ReadXml(new System.IO.MemoryStream(Fichero));
int i = 1; int i = 1;
int Ultimalinea = dsprueba.Tables["Datos"].Rows.Count; int Ultimalinea = ds.Tables["Datos"].Rows.Count;
foreach (XSD.CTESGESL.DatosRow Proant in dsprueba.Tables["Datos"].Rows) foreach (XSD.CTESGESL.DatosRow Proant in ds.Tables["Datos"].Rows)
{ {
try try
{ {

View File

@@ -1,5 +1,7 @@
using bdGrupoSanchoToro.db; using bdGrupoSanchoToro.db;
using System.Diagnostics;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using tsUtilidades.Extensiones;
namespace bdGrupoSanchoToro.Importaciones namespace bdGrupoSanchoToro.Importaciones
{ {
public class ImportaGRUASGC public class ImportaGRUASGC
@@ -9,34 +11,38 @@ namespace bdGrupoSanchoToro.Importaciones
try try
{ {
var bd = tscGrupoSanchoToro.NuevoContexto(); var bd = tscGrupoSanchoToro.NuevoContexto();
var dsprueba = new XSD.GRUASGC(); var ds = new XSD.GRUASGC();
dsprueba.ReadXml(new System.IO.MemoryStream(Fichero)); ds.ReadXml(new System.IO.MemoryStream(Fichero));
int Ultimalinea = dsprueba.Tables["Datos"].Rows.Count; int Ultimalinea = ds.Tables["Datos"].Rows.Count;
var lp = bd.productos.ToList(); var lp = bd.productos.ToList();
var lm = bd.marcas.ToList(); var lm = bd.marcas.ToList();
var lv = bd.versionesgruas.ToList(); var lv = bd.versionesgruas.ToList();
var grs = dsprueba.Tables["Datos"].Rows.Cast<XSD.GRUASGC.DatosRow>().ToList().OrderBy(x=> OrdenGRUASGC(x)).ToList(); var grs = ds.Tables["Datos"].Rows.Cast<XSD.GRUASGC.DatosRow>().ToList().OrderBy(x=> OrdenGRUASGC(x)).ToList();
foreach (XSD.GRUASGC.DatosRow gr in grs) foreach (XSD.GRUASGC.DatosRow gr in grs)
{ {
try try
{ {
if (gr.CGMAR=="SAE") gr.CGMAR = "SAEZ";
if (gr.CGMAR == "COMANSA LINDE LC8552") gr.CGMAR = "COMANSA";
var mar = lm.First(x => x.Marca == gr.CGMAR); var mar = lm.First(x => x.Marca == gr.CGMAR);
string sDescripcion = "GRÚA " + mar.Marca + " " + gr.CGMDL; string sDescripcion = "GRÚA " + mar.Marca + " " + gr.CGMDL;
bdGrupoSanchoToro.db.productos pr = lp.FirstOrDefault(x => x.Descripcion== sDescripcion); bdGrupoSanchoToro.db.productos pr = lp.FirstOrDefault(x => x.Descripcion== sDescripcion);
if (pr == null) if (pr == null)
{ {
pr = new productos() pr = new productos()
{ {
idEmpresa = 1,
Codigo = "GR-" + gr.CGCOD, Codigo = "GR-" + gr.CGCOD,
Descripcion = sDescripcion, Descripcion = sDescripcion,
DescripcionAbreviada = (mar.Marca + " " + gr.CGMDL).Acortar(45),
idMarcaNavigation = mar, idMarcaNavigation = mar,
FechaAlta = DateOnly.FromDateTime(DateTime.Now), FechaAlta = DateOnly.FromDateTime(DateTime.Now),
Modelo = gr.CGMDL, Modelo = gr.CGMDL,
Tipo = (int)productos.TipoProductoEnum.GRUA Tipo = (int)productos.TipoProductoEnum.GRUA,
idFamilia=42
}; };
bd.Add(pr);
lp.Add(pr); lp.Add(pr);
bd.SaveChanges(); bd.SaveChanges();

View File

@@ -0,0 +1,67 @@
using Castle.Core.Configuration;
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using tsUtilidades.Extensiones;
namespace bdGrupoSanchoToro.Importaciones
{
public class ImportaGRUASPC
{
public static void Importar(byte[] Fichero)
{
try
{
var bd = tscGrupoSanchoToro.NuevoContexto();
var lp = bd.productos.Where(x=> x.Tipo==(int)db.productos.TipoProductoEnum.GRUA).ToList();
var la = bd.articulos.ToList();
var ds = new XSD.GRUASPC();
ds.ReadXml(new System.IO.MemoryStream(Fichero));
int i = 1;
int Ultimalinea = ds.Tables["Datos"].Rows.Count;
foreach (XSD.GRUASPC.DatosRow grua in ds.Tables["Datos"].Rows)
{
try
{
string codp = "GR-" + grua.CPCGG;
if (grua.CPMAR == "SAE") grua.CPMAR = "SAEZ";
if (grua.CPMAR == "COMANSA LINDE LC8552") grua.CPMAR = "COMANSA";
var gr = lp.First(x => x.Codigo == codp || (x.idMarcaNavigation.Marca == grua.CPMAR && x.Modelo == grua.CPMDL));
var art = la.FirstOrDefault(x =>x.idProducto==gr.idProducto && x.CodigoArticulo == grua.CPCOD.Trim());
if (art == null)
{
art = new bdGrupoSanchoToro.db.articulos();
bd.articulos.Add(art);
la.Add(art);
}
art.idProductoNavigation = gr;
art.CodigoArticulo = grua.CPCOD.Trim();
art.FechaAlta= grua.CPFAL.FechaStringADateOnly();
art.FechaBaja = grua.CPFBA.FechaStringADateOnly();
art.Matricula = grua.CPMAT;
i = i + 1;
if (i > 1000)
{
bd.SaveChanges();
i = 0;
}
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
bd.SaveChanges();
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
}
}

View File

@@ -11,6 +11,7 @@ namespace bdGrupoSanchoToro.Importaciones
{ {
public class ImportaPRODUCTOS public class ImportaPRODUCTOS
{ {
public static List<XSD.PRODUCTOS.DatosRow> pros;
public static void Importar(byte[] Fichero) public static void Importar(byte[] Fichero)
{ {
try try
@@ -23,14 +24,14 @@ namespace bdGrupoSanchoToro.Importaciones
var lp = bd.productos.ToList(); var lp = bd.productos.ToList();
var lf = bd.familias.ToList(); var lf = bd.familias.ToList();
var lm = bd.marcas.ToList(); var lm = bd.marcas.ToList();
var lfh = bd.enumeraciones.Where(x=> x.idGrupoEnumeracionNavigation.Grupo=="FAMH").ToList(); var lfh = bd.enumeraciones.Where(x => x.idGrupoEnumeracionNavigation.Grupo == "FAMH").ToList();
var pros = ds.Tables["Datos"].Rows.Cast<XSD.PRODUCTOS.DatosRow>().ToList(); pros = ds.Tables["Datos"].Rows.Cast<XSD.PRODUCTOS.DatosRow>().ToList();
foreach (XSD.PRODUCTOS.DatosRow pro in pros) foreach (XSD.PRODUCTOS.DatosRow pro in pros)
{ {
try try
{ {
bdGrupoSanchoToro.db.productos p = lp.FirstOrDefault(x => x.Codigo == pro.PRCOD || x.DescripcionAbreviada.RemoveDiacritics() ==pro.PRDES.Trim().RemoveDiacritics().ToUpper() || x.Descripcion.RemoveDiacritics().ToUpper()==pro.PRDESL.Trim().RemoveDiacritics().ToUpper() ); bdGrupoSanchoToro.db.productos p = lp.FirstOrDefault(x => x.Codigo == pro.PRCOD || x.DescripcionAbreviada.RemoveDiacritics() == pro.PRDES.Trim().RemoveDiacritics().ToUpper() || x.Descripcion.RemoveDiacritics().ToUpper() == pro.PRDESL.Trim().RemoveDiacritics().ToUpper());
if (p == null) if (p == null)
{ {
p = new productos() p = new productos()
@@ -45,7 +46,7 @@ namespace bdGrupoSanchoToro.Importaciones
p.DescripcionAbreviada = pro.PRDES.Trim().RemoveDiacritics().ToUpper(); p.DescripcionAbreviada = pro.PRDES.Trim().RemoveDiacritics().ToUpper();
p.FechaAlta = DateOnly.FromDateTime(DateTime.Now); p.FechaAlta = DateOnly.FromDateTime(DateTime.Now);
familias? fam = bd.familias.FirstOrDefault(x => x.Codigo == pro.PRFAM); familias? fam = bd.familias.FirstOrDefault(x => x.Codigo == pro.PRFAM);
p.idFamilia = fam == null ? null : fam.idFamilia; p.idFamilia = fam == null ? 42 : fam.idFamilia;
if (pro.PRMAR.NothingAVacio() != "") if (pro.PRMAR.NothingAVacio() != "")
{ {
var mar = lm.FirstOrDefault(x => x.Marca == pro.PRMAR); var mar = lm.FirstOrDefault(x => x.Marca == pro.PRMAR);
@@ -65,11 +66,11 @@ namespace bdGrupoSanchoToro.Importaciones
p.idMarca = null; p.idMarca = null;
} }
p.Modelo = pro.PRMDL; p.Modelo = pro.PRMDL;
p.Servicio = (pro.PRCFP=="AL" ? true : false); // p.Servicio = (pro.PRCFP == "AL" ? true : false);
p.idFamiliaHomologacion = null; p.idFamiliaHomologacion = null;
if (pro.PRFAMH!="") if (pro.PRFAMH != "")
{ {
var fh=lfh.FirstOrDefault(x=> x.Codigo==("FAMH." + pro.PRFAMH)); var fh = lfh.FirstOrDefault(x => x.Codigo == ("FAMH." + pro.PRFAMH));
if (fh != null) if (fh != null)
{ {
p.idFamiliaHomologacion = fh.idEnumeracion; p.idFamiliaHomologacion = fh.idEnumeracion;
@@ -85,7 +86,7 @@ namespace bdGrupoSanchoToro.Importaciones
p.Tipo = (int)productos.TipoProductoEnum.CONSUMIBLES; p.Tipo = (int)productos.TipoProductoEnum.CONSUMIBLES;
break; break;
} }
case "CG": case "CG":
{ {
p.Tipo = (int)productos.TipoProductoEnum.ELEMENTO_GRUA; p.Tipo = (int)productos.TipoProductoEnum.ELEMENTO_GRUA;
break; break;
@@ -105,12 +106,18 @@ namespace bdGrupoSanchoToro.Importaciones
p.Tipo = (int)productos.TipoProductoEnum.REPUESTO; p.Tipo = (int)productos.TipoProductoEnum.REPUESTO;
break; break;
} }
default:
{
p.Tipo = (int)productos.TipoProductoEnum.ELEMENTO_GRUA;
break;
}
} }
} }
} }
p.PrecioVenta = double.Parse(pro.PRPVP, CultureInfo.InvariantCulture); p.PrecioVenta = double.Parse(pro.PRPVP, CultureInfo.InvariantCulture);
p.ReferenciaFabrica = pro.PRRFA; p.ReferenciaFabrica = pro.PRRFA;
p.PrefijoNumeroSerie = pro.PRPNS; p.PrefijoNumeroSerie = pro.PRPNS;
bd.SaveChanges(); bd.SaveChanges();
} }

View File

@@ -16,11 +16,13 @@ namespace bdGrupoSanchoToro.Importaciones
tscGrupoSanchoToro bd = tscGrupoSanchoToro.NuevoContexto(); tscGrupoSanchoToro bd = tscGrupoSanchoToro.NuevoContexto();
//00 //00
//Importa("GRUASGC", bdGrupoSanchoToro.Importaciones.ImportaGRUASGC.Importar, de); //00 Importa("GRUASGC", bdGrupoSanchoToro.Importaciones.ImportaGRUASGC.Importar, de); //00
//Importa("FAMILIAS", bdGrupoSanchoToro.Importaciones.ImportaFAMILIAS.Importar, de); //00 //Importa("FAMILIAS", bdGrupoSanchoToro.Importaciones.ImportaFAMILIAS.Importar, de); //00
//Importa("FAMILIAS", bdGrupoSanchoToro.Importaciones.ImportaFAMILIAS.Importar, de); //00 //Importa("FAMILIAS", bdGrupoSanchoToro.Importaciones.ImportaFAMILIAS.Importar, de); //00
//Importa("CTESGESL", bdGrupoSanchoToro.Importaciones.ImportaCTESGESL.Importar, de); //00 //Importa("CTESGESL", bdGrupoSanchoToro.Importaciones.ImportaCTESGESL.Importar, de); //00
Importa("PRODUCTOS", bdGrupoSanchoToro.Importaciones.ImportaPRODUCTOS.Importar, de); //00 Importa("PRODUCTOS", bdGrupoSanchoToro.Importaciones.ImportaPRODUCTOS.Importar, de); //00
Importa("GRUASPC", bdGrupoSanchoToro.Importaciones.ImportaGRUASPC.Importar, de); //00
Importa("ARTICULOS", bdGrupoSanchoToro.Importaciones.ImportaARTICULOS.Importar, de); //00
//Importa("GRUPRO", bdGrupoSanchoToro.Importaciones.ImportaGrupoProductos.Importar, de); //01 //Importa("GRUPRO", bdGrupoSanchoToro.Importaciones.ImportaGrupoProductos.Importar, de); //01
//Importa("CAMPAÑAS", bdGrupoSanchoToro.Importaciones.ImportaCampañas.Importar, de); //02 //Importa("CAMPAÑAS", bdGrupoSanchoToro.Importaciones.ImportaCampañas.Importar, de); //02

View File

@@ -71,6 +71,8 @@ public partial class albaranes
public DateOnly? FechaPrevistaFinSubalquiler { get; set; } public DateOnly? FechaPrevistaFinSubalquiler { get; set; }
public int idEmpresa { get; set; }
public virtual municipios? CodigoMunicipioCargaNavigation { get; set; } public virtual municipios? CodigoMunicipioCargaNavigation { get; set; }
public virtual municipios? CodigoMunicipioDescargaNavigation { get; set; } public virtual municipios? CodigoMunicipioDescargaNavigation { get; set; }
@@ -83,6 +85,8 @@ public partial class albaranes
public virtual almacenes? idAlmacenOrigenNavigation { get; set; } public virtual almacenes? idAlmacenOrigenNavigation { get; set; }
public virtual empresas idEmpresaNavigation { get; set; } = null!;
public virtual entidades? idEntidadNavigation { get; set; } public virtual entidades? idEntidadNavigation { get; set; }
public virtual presupuestos? idPresupuestoNavigation { get; set; } public virtual presupuestos? idPresupuestoNavigation { get; set; }

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using PropertyChanged;
namespace bdGrupoSanchoToro.db;
[AddINotifyPropertyChangedInterface]
public partial class desgloseproductos
{
public int idDesglose { get; set; }
public int idProductoPadre { get; set; }
public int idProducto { get; set; }
public int Unidades { get; set; }
public int UnidadesMinimas { get; set; }
public int UnidadesMaximas { get; set; }
public string? DescripcionAdicional { get; set; }
public int? Version { get; set; }
public virtual ICollection<detallepresupuesto> detallepresupuesto { get; set; } = new List<detallepresupuesto>();
public virtual productos idProductoNavigation { get; set; } = null!;
public virtual productos idProductoPadreNavigation { get; set; } = null!;
}

View File

@@ -15,6 +15,8 @@ public partial class detallepresupuesto
public double Cantidad { get; set; } public double Cantidad { get; set; }
public double GastosPorUnidad { get; set; }
public double Precio { get; set; } public double Precio { get; set; }
public int idPresupuesto { get; set; } public int idPresupuesto { get; set; }
@@ -23,10 +25,24 @@ public partial class detallepresupuesto
public string? Observaciones { get; set; } public string? Observaciones { get; set; }
public int? idDetallePresupuestoPadre { get; set; }
public int? idDesgloseProducto { get; set; }
public string? Parametros { get; set; }
public int? NumeroAsientos { get; set; }
public virtual ICollection<detallepresupuesto> InverseidDetallePresupuestoPadreNavigation { get; set; } = new List<detallepresupuesto>();
public virtual ICollection<detallesfacturas> detallesfacturas { get; set; } = new List<detallesfacturas>(); public virtual ICollection<detallesfacturas> detallesfacturas { get; set; } = new List<detallesfacturas>();
public virtual articulos? idArticuloNavigation { get; set; } public virtual articulos? idArticuloNavigation { get; set; }
public virtual desgloseproductos? idDesgloseProductoNavigation { get; set; }
public virtual detallepresupuesto? idDetallePresupuestoPadreNavigation { get; set; }
public virtual presupuestos idPresupuestoNavigation { get; set; } = null!; public virtual presupuestos idPresupuestoNavigation { get; set; } = null!;
public virtual productos idProductoNavigation { get; set; } = null!; public virtual productos idProductoNavigation { get; set; } = null!;

View File

@@ -17,10 +17,6 @@ public partial class detallesalbaranes
public double Cantidad { get; set; } public double Cantidad { get; set; }
public double Peso { get; set; }
public double Volumen { get; set; }
public bool EsVenta { get; set; } public bool EsVenta { get; set; }
public bool IncluidoEnPresupuesto { get; set; } public bool IncluidoEnPresupuesto { get; set; }
@@ -29,6 +25,14 @@ public partial class detallesalbaranes
public int? idUltimaFactura { get; set; } public int? idUltimaFactura { get; set; }
public DateTime? FechaCancelacion { get; set; }
public int? idUsuarioQueCancela { get; set; }
public string? MotivoCancelacion { get; set; }
public string? Observaciones { get; set; }
public virtual albaranes idAlbaranNavigation { get; set; } = null!; public virtual albaranes idAlbaranNavigation { get; set; } = null!;
public virtual albaranes? idAlbaranRecogidaNavigation { get; set; } public virtual albaranes? idAlbaranRecogidaNavigation { get; set; }
@@ -38,4 +42,6 @@ public partial class detallesalbaranes
public virtual productos idProductoNavigation { get; set; } = null!; public virtual productos idProductoNavigation { get; set; } = null!;
public virtual facturas? idUltimaFacturaNavigation { get; set; } public virtual facturas? idUltimaFacturaNavigation { get; set; }
public virtual usuarios? idUsuarioQueCancelaNavigation { get; set; }
} }

View File

@@ -27,6 +27,8 @@ public partial class empresas
public string Codigo { get; set; } = null!; public string Codigo { get; set; } = null!;
public virtual ICollection<albaranes> albaranes { get; set; } = new List<albaranes>();
public virtual ICollection<almacenes> almacenes { get; set; } = new List<almacenes>(); public virtual ICollection<almacenes> almacenes { get; set; } = new List<almacenes>();
public virtual ICollection<cajas> cajas { get; set; } = new List<cajas>(); public virtual ICollection<cajas> cajas { get; set; } = new List<cajas>();
@@ -43,7 +45,5 @@ public partial class empresas
public virtual ICollection<plantillas> plantillas { get; set; } = new List<plantillas>(); public virtual ICollection<plantillas> plantillas { get; set; } = new List<plantillas>();
public virtual ICollection<productos> productos { get; set; } = new List<productos>();
public virtual ICollection<seriesfacturas> seriesfacturas { get; set; } = new List<seriesfacturas>(); public virtual ICollection<seriesfacturas> seriesfacturas { get; set; } = new List<seriesfacturas>();
} }

View File

@@ -71,8 +71,6 @@ public partial class entidades
public virtual ICollection<correos> correos { get; set; } = new List<correos>(); public virtual ICollection<correos> correos { get; set; } = new List<correos>();
public virtual ICollection<eventos> eventos { get; set; } = new List<eventos>();
public virtual ICollection<expedientesentidades> expedientesentidades { get; set; } = new List<expedientesentidades>(); public virtual ICollection<expedientesentidades> expedientesentidades { get; set; } = new List<expedientesentidades>();
public virtual ICollection<facturas> facturas { get; set; } = new List<facturas>(); public virtual ICollection<facturas> facturas { get; set; } = new List<facturas>();
@@ -87,5 +85,7 @@ public partial class entidades
public virtual usuarios? idUsuarioModificadorNavigation { get; set; } public virtual usuarios? idUsuarioModificadorNavigation { get; set; }
public virtual ICollection<obras> obras { get; set; } = new List<obras>();
public virtual ICollection<presupuestos> presupuestos { get; set; } = new List<presupuestos>(); public virtual ICollection<presupuestos> presupuestos { get; set; } = new List<presupuestos>();
} }

View File

@@ -57,7 +57,7 @@ public partial class facturas
public string? ObservacionesAImprimir { get; set; } public string? ObservacionesAImprimir { get; set; }
public int? idEvento { get; set; } public int? idObra { get; set; }
public double ImportePagado { get; set; } public double ImportePagado { get; set; }
@@ -87,7 +87,7 @@ public partial class facturas
public virtual ficheros? idDatosClienteOriginalNavigation { get; set; } public virtual ficheros? idDatosClienteOriginalNavigation { get; set; }
public virtual eventos? idEventoNavigation { get; set; } public virtual obras? idObraNavigation { get; set; }
public virtual seriesfacturas idSerieFacturaNavigation { get; set; } = null!; public virtual seriesfacturas idSerieFacturaNavigation { get; set; } = null!;

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using PropertyChanged;
namespace bdGrupoSanchoToro.db;
[AddINotifyPropertyChangedInterface]
public partial class modelospermitidos
{
public int idModeloPermitido { get; set; }
public int idProducto { get; set; }
public int idModeloGrua { get; set; }
public bool Version_Apoyada { get; set; }
public bool Version_Automontante { get; set; }
public bool Version_Bicolumna { get; set; }
public bool Version_Empotrada { get; set; }
public bool Version_ConTraslacion { get; set; }
public virtual productos idModeloGruaNavigation { get; set; } = null!;
public virtual productos idProductoNavigation { get; set; } = null!;
}

View File

@@ -27,7 +27,7 @@ public partial class municipios
public virtual ICollection<entidades> entidades { get; set; } = new List<entidades>(); public virtual ICollection<entidades> entidades { get; set; } = new List<entidades>();
public virtual ICollection<eventos> eventos { get; set; } = new List<eventos>();
public virtual ICollection<facturas> facturas { get; set; } = new List<facturas>(); public virtual ICollection<facturas> facturas { get; set; } = new List<facturas>();
public virtual ICollection<obras> obras { get; set; } = new List<obras>();
} }

View File

@@ -5,9 +5,9 @@ using PropertyChanged;
namespace bdGrupoSanchoToro.db; namespace bdGrupoSanchoToro.db;
[AddINotifyPropertyChangedInterface] [AddINotifyPropertyChangedInterface]
public partial class eventos public partial class obras
{ {
public int idEvento { get; set; } public int idObra { get; set; }
public string Descripcion { get; set; } = null!; public string Descripcion { get; set; } = null!;

View File

@@ -15,7 +15,7 @@ public partial class presupuestos
public int idCliente { get; set; } public int idCliente { get; set; }
public int? idEvento { get; set; } public int? idObra { get; set; }
public double ImporteBruto { get; set; } public double ImporteBruto { get; set; }
@@ -37,14 +37,6 @@ public partial class presupuestos
public double Kilometros { get; set; } public double Kilometros { get; set; }
public DateOnly? FechaInicioEvento { get; set; }
public DateOnly? FechaFinEvento { get; set; }
public DateOnly? FechaMontaje { get; set; }
public DateOnly? FechaDesmontaje { get; set; }
public virtual ICollection<albaranes> albaranes { get; set; } = new List<albaranes>(); public virtual ICollection<albaranes> albaranes { get; set; } = new List<albaranes>();
public virtual ICollection<detallepresupuesto> detallepresupuesto { get; set; } = new List<detallepresupuesto>(); public virtual ICollection<detallepresupuesto> detallepresupuesto { get; set; } = new List<detallepresupuesto>();
@@ -55,7 +47,7 @@ public partial class presupuestos
public virtual ficheros? idDatosClienteOriginalNavigation { get; set; } public virtual ficheros? idDatosClienteOriginalNavigation { get; set; }
public virtual eventos? idEventoNavigation { get; set; } public virtual obras? idObraNavigation { get; set; }
public virtual usuarios? idUsuarioNavigation { get; set; } public virtual usuarios? idUsuarioNavigation { get; set; }
} }

View File

@@ -15,15 +15,13 @@ public partial class productos
public string Descripcion { get; set; } = null!; public string Descripcion { get; set; } = null!;
public int? idFamilia { get; set; } public int idFamilia { get; set; }
public int? idTipoHomologacion { get; set; } public int? idTipoHomologacion { get; set; }
public bool? Servicio { get; set; }
public string? ReferenciaFabrica { get; set; } public string? ReferenciaFabrica { get; set; }
public int? Tipo { get; set; } public int Tipo { get; set; }
public string? CodigoBarras { get; set; } public string? CodigoBarras { get; set; }
@@ -51,8 +49,6 @@ public partial class productos
public string? Observaciones { get; set; } public string? Observaciones { get; set; }
public int? idEmpresa { get; set; }
public double? UltimoPrecioCoste { get; set; } public double? UltimoPrecioCoste { get; set; }
public double? UltimoPrecioCompra { get; set; } public double? UltimoPrecioCompra { get; set; }
@@ -77,8 +73,16 @@ public partial class productos
public double? PrecioVenta { get; set; } public double? PrecioVenta { get; set; }
public string? UnidadesPorEmpresa { get; set; }
public bool? FacturarComoVentaPorDefecto { get; set; }
public virtual ICollection<articulos> articulos { get; set; } = new List<articulos>(); public virtual ICollection<articulos> articulos { get; set; } = new List<articulos>();
public virtual ICollection<desgloseproductos> desgloseproductosidProductoNavigation { get; set; } = new List<desgloseproductos>();
public virtual ICollection<desgloseproductos> desgloseproductosidProductoPadreNavigation { get; set; } = new List<desgloseproductos>();
public virtual ICollection<desglosetiposofertas> desglosetiposofertas { get; set; } = new List<desglosetiposofertas>(); public virtual ICollection<desglosetiposofertas> desglosetiposofertas { get; set; } = new List<desglosetiposofertas>();
public virtual ICollection<detallepresupuesto> detallepresupuesto { get; set; } = new List<detallepresupuesto>(); public virtual ICollection<detallepresupuesto> detallepresupuesto { get; set; } = new List<detallepresupuesto>();
@@ -89,9 +93,7 @@ public partial class productos
public virtual ICollection<detallesfacturasrecibidas> detallesfacturasrecibidas { get; set; } = new List<detallesfacturasrecibidas>(); public virtual ICollection<detallesfacturasrecibidas> detallesfacturasrecibidas { get; set; } = new List<detallesfacturasrecibidas>();
public virtual empresas? idEmpresaNavigation { get; set; } public virtual familias idFamiliaNavigation { get; set; } = null!;
public virtual familias? idFamiliaNavigation { get; set; }
public virtual marcas? idMarcaNavigation { get; set; } public virtual marcas? idMarcaNavigation { get; set; }
@@ -99,6 +101,10 @@ public partial class productos
public virtual usuarios? idUsuarioModificadorNavigation { get; set; } public virtual usuarios? idUsuarioModificadorNavigation { get; set; }
public virtual ICollection<modelospermitidos> modelospermitidosidModeloGruaNavigation { get; set; } = new List<modelospermitidos>();
public virtual ICollection<modelospermitidos> modelospermitidosidProductoNavigation { get; set; } = new List<modelospermitidos>();
public virtual ICollection<stocks> stocks { get; set; } = new List<stocks>(); public virtual ICollection<stocks> stocks { get; set; } = new List<stocks>();
public virtual ICollection<tablaalturas> tablaalturas { get; set; } = new List<tablaalturas>(); public virtual ICollection<tablaalturas> tablaalturas { get; set; } = new List<tablaalturas>();

View File

@@ -35,6 +35,8 @@ public partial class usuarios
public virtual ICollection<correos> correos { get; set; } = new List<correos>(); public virtual ICollection<correos> correos { get; set; } = new List<correos>();
public virtual ICollection<detallesalbaranes> detallesalbaranes { get; set; } = new List<detallesalbaranes>();
public virtual ICollection<documentosfacturas> documentosfacturas { get; set; } = new List<documentosfacturas>(); public virtual ICollection<documentosfacturas> documentosfacturas { get; set; } = new List<documentosfacturas>();
public virtual ICollection<documentosfacturasrecibidas> documentosfacturasrecibidas { get; set; } = new List<documentosfacturasrecibidas>(); public virtual ICollection<documentosfacturasrecibidas> documentosfacturasrecibidas { get; set; } = new List<documentosfacturasrecibidas>();
@@ -45,8 +47,6 @@ public partial class usuarios
public virtual ICollection<entidades> entidadesidUsuarioModificadorNavigation { get; set; } = new List<entidades>(); public virtual ICollection<entidades> entidadesidUsuarioModificadorNavigation { get; set; } = new List<entidades>();
public virtual ICollection<eventos> eventos { get; set; } = new List<eventos>();
public virtual ICollection<expedientesarticulos> expedientesarticulos { get; set; } = new List<expedientesarticulos>(); public virtual ICollection<expedientesarticulos> expedientesarticulos { get; set; } = new List<expedientesarticulos>();
public virtual ICollection<expedientesentidades> expedientesentidades { get; set; } = new List<expedientesentidades>(); public virtual ICollection<expedientesentidades> expedientesentidades { get; set; } = new List<expedientesentidades>();
@@ -67,6 +67,8 @@ public partial class usuarios
public virtual ICollection<movimientoscaja> movimientoscajaidUsuarioSupervisaNavigation { get; set; } = new List<movimientoscaja>(); public virtual ICollection<movimientoscaja> movimientoscajaidUsuarioSupervisaNavigation { get; set; } = new List<movimientoscaja>();
public virtual ICollection<obras> obras { get; set; } = new List<obras>();
public virtual ICollection<presupuestos> presupuestos { get; set; } = new List<presupuestos>(); public virtual ICollection<presupuestos> presupuestos { get; set; } = new List<presupuestos>();
public virtual ICollection<productos> productosidUsuarioCreadorNavigation { get; set; } = new List<productos>(); public virtual ICollection<productos> productosidUsuarioCreadorNavigation { get; set; } = new List<productos>();

View File

@@ -65,23 +65,25 @@ public partial class v_albaranesextendidos
public int? idEntidad { get; set; } public int? idEntidad { get; set; }
public int? idEvento { get; set; } public int idEmpresa { get; set; }
public string? DescripcionEvento { get; set; } public int? idObra { get; set; }
public string? Telefono1Evento { get; set; } public string? DescripcionObra { get; set; }
public string? Telefono2Evento { get; set; } public string? Telefono1Obra { get; set; }
public string? PersonaContactoEvento { get; set; } public string? Telefono2Obra { get; set; }
public string? DireccionEvento { get; set; } public string? PersonaContactoObra { get; set; }
public string? CodigoPostalEvento { get; set; } public string? DireccionObra { get; set; }
public string? CodigoMunicipioEvento { get; set; } public string? CodigoPostalObra { get; set; }
public string? ObservacionesEvento { get; set; } public string? CodigoMunicipioObra { get; set; }
public string? ObservacionesObra { get; set; }
public string? NIF { get; set; } public string? NIF { get; set; }

View File

@@ -52,6 +52,8 @@ public partial class GrupoSanchoToroContext : DbContext
public virtual DbSet<cuentascorreo> cuentascorreo { get; set; } public virtual DbSet<cuentascorreo> cuentascorreo { get; set; }
public virtual DbSet<desgloseproductos> desgloseproductos { get; set; }
public virtual DbSet<desglosetiposofertas> desglosetiposofertas { get; set; } public virtual DbSet<desglosetiposofertas> desglosetiposofertas { get; set; }
public virtual DbSet<detallepresupuesto> detallepresupuesto { get; set; } public virtual DbSet<detallepresupuesto> detallepresupuesto { get; set; }
@@ -76,8 +78,6 @@ public partial class GrupoSanchoToroContext : DbContext
public virtual DbSet<enumeraciones> enumeraciones { get; set; } public virtual DbSet<enumeraciones> enumeraciones { get; set; }
public virtual DbSet<eventos> eventos { get; set; }
public virtual DbSet<expedientesarticulos> expedientesarticulos { get; set; } public virtual DbSet<expedientesarticulos> expedientesarticulos { get; set; }
public virtual DbSet<expedientesentidades> expedientesentidades { get; set; } public virtual DbSet<expedientesentidades> expedientesentidades { get; set; }
@@ -112,12 +112,16 @@ public partial class GrupoSanchoToroContext : DbContext
public virtual DbSet<menus> menus { get; set; } public virtual DbSet<menus> menus { get; set; }
public virtual DbSet<modelospermitidos> modelospermitidos { get; set; }
public virtual DbSet<movimientosbancarios> movimientosbancarios { get; set; } public virtual DbSet<movimientosbancarios> movimientosbancarios { get; set; }
public virtual DbSet<movimientoscaja> movimientoscaja { get; set; } public virtual DbSet<movimientoscaja> movimientoscaja { get; set; }
public virtual DbSet<municipios> municipios { get; set; } public virtual DbSet<municipios> municipios { get; set; }
public virtual DbSet<obras> obras { get; set; }
public virtual DbSet<permisos> permisos { get; set; } public virtual DbSet<permisos> permisos { get; set; }
public virtual DbSet<plantillas> plantillas { get; set; } public virtual DbSet<plantillas> plantillas { get; set; }
@@ -170,6 +174,8 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.idAlmacenDestino, "albaranes_almacenes02_idx"); entity.HasIndex(e => e.idAlmacenDestino, "albaranes_almacenes02_idx");
entity.HasIndex(e => e.idEmpresa, "albaranes_empresas_idx");
entity.HasIndex(e => e.idEntidad, "albaranes_entidades_idx"); entity.HasIndex(e => e.idEntidad, "albaranes_entidades_idx");
entity.HasIndex(e => e.CodigoMunicipioCarga, "albaranes_municipios01_idx"); entity.HasIndex(e => e.CodigoMunicipioCarga, "albaranes_municipios01_idx");
@@ -255,6 +261,10 @@ public partial class GrupoSanchoToroContext : DbContext
.HasForeignKey(d => d.idAlmacenOrigen) .HasForeignKey(d => d.idAlmacenOrigen)
.HasConstraintName("albaranes_almacenes01"); .HasConstraintName("albaranes_almacenes01");
entity.HasOne(d => d.idEmpresaNavigation).WithMany(p => p.albaranes)
.HasForeignKey(d => d.idEmpresa)
.HasConstraintName("albaranes_empresas");
entity.HasOne(d => d.idEntidadNavigation).WithMany(p => p.albaranes) entity.HasOne(d => d.idEntidadNavigation).WithMany(p => p.albaranes)
.HasForeignKey(d => d.idEntidad) .HasForeignKey(d => d.idEntidad)
.HasConstraintName("albaranes_entidades"); .HasConstraintName("albaranes_entidades");
@@ -400,10 +410,7 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.idProveedor, "articulos_proveedores_idx"); entity.HasIndex(e => e.idProveedor, "articulos_proveedores_idx");
entity.Property(e => e.CodigoArticulo) entity.Property(e => e.CodigoArticulo).HasMaxLength(20);
.HasMaxLength(10)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Matricula).HasMaxLength(20); entity.Property(e => e.Matricula).HasMaxLength(20);
entity.Property(e => e.NumeroSerie) entity.Property(e => e.NumeroSerie)
.HasMaxLength(40) .HasMaxLength(40)
@@ -809,6 +816,27 @@ public partial class GrupoSanchoToroContext : DbContext
.HasConstraintName("cuentascorreos_empresas"); .HasConstraintName("cuentascorreos_empresas");
}); });
modelBuilder.Entity<desgloseproductos>(entity =>
{
entity.HasKey(e => e.idDesglose).HasName("PRIMARY");
entity.HasIndex(e => e.idProducto, "productos01_hijo_idx");
entity.HasIndex(e => e.idProductoPadre, "productosPadre_01_idx");
entity.Property(e => e.DescripcionAdicional)
.HasMaxLength(60)
.UseCollation("utf8mb4_0900_as_ci");
entity.HasOne(d => d.idProductoNavigation).WithMany(p => p.desgloseproductosidProductoNavigation)
.HasForeignKey(d => d.idProducto)
.HasConstraintName("productos01_hijo");
entity.HasOne(d => d.idProductoPadreNavigation).WithMany(p => p.desgloseproductosidProductoPadreNavigation)
.HasForeignKey(d => d.idProductoPadre)
.HasConstraintName("productos00_padre");
});
modelBuilder.Entity<desglosetiposofertas>(entity => modelBuilder.Entity<desglosetiposofertas>(entity =>
{ {
entity.HasKey(e => e.idDesglose).HasName("PRIMARY"); entity.HasKey(e => e.idDesglose).HasName("PRIMARY");
@@ -836,17 +864,33 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.idProducto, "detallepresupuesto_productos_idx"); entity.HasIndex(e => e.idProducto, "detallepresupuesto_productos_idx");
entity.HasIndex(e => e.idDesgloseProducto, "detallespresupuesto_desgloseproductos_idx");
entity.HasIndex(e => e.idDetallePresupuestoPadre, "detallespresupuesto_detallespresupuestos_idx");
entity.Property(e => e.Cantidad).HasDefaultValueSql("'1'"); entity.Property(e => e.Cantidad).HasDefaultValueSql("'1'");
entity.Property(e => e.Observaciones) entity.Property(e => e.Observaciones)
.HasMaxLength(255) .HasMaxLength(255)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb4_0900_as_ci");
.HasCharSet("utf8mb3"); entity.Property(e => e.Parametros)
.HasMaxLength(100)
.UseCollation("utf8mb4_0900_as_ci");
entity.HasOne(d => d.idArticuloNavigation).WithMany(p => p.detallepresupuesto) entity.HasOne(d => d.idArticuloNavigation).WithMany(p => p.detallepresupuesto)
.HasForeignKey(d => d.idArticulo) .HasForeignKey(d => d.idArticulo)
.OnDelete(DeleteBehavior.SetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("detallepresupuesto_articulos"); .HasConstraintName("detallepresupuesto_articulos");
entity.HasOne(d => d.idDesgloseProductoNavigation).WithMany(p => p.detallepresupuesto)
.HasForeignKey(d => d.idDesgloseProducto)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("detallespresupuesto_desgloseproductos");
entity.HasOne(d => d.idDetallePresupuestoPadreNavigation).WithMany(p => p.InverseidDetallePresupuestoPadreNavigation)
.HasForeignKey(d => d.idDetallePresupuestoPadre)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("detallespresupuesto_detallespresupuestos");
entity.HasOne(d => d.idPresupuestoNavigation).WithMany(p => p.detallepresupuesto) entity.HasOne(d => d.idPresupuestoNavigation).WithMany(p => p.detallepresupuesto)
.HasForeignKey(d => d.idPresupuesto) .HasForeignKey(d => d.idPresupuesto)
.HasConstraintName("detallespresupuesto_presupuestos"); .HasConstraintName("detallespresupuesto_presupuestos");
@@ -871,6 +915,12 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.idProducto, "detallesalbaranes_productos_idx"); entity.HasIndex(e => e.idProducto, "detallesalbaranes_productos_idx");
entity.HasIndex(e => e.idUsuarioQueCancela, "detallesalbaranes_usuarios_idx");
entity.Property(e => e.FechaCancelacion).HasColumnType("datetime");
entity.Property(e => e.MotivoCancelacion).HasMaxLength(100);
entity.Property(e => e.Observaciones).HasMaxLength(100);
entity.HasOne(d => d.idAlbaranNavigation).WithMany(p => p.detallesalbaranesidAlbaranNavigation) entity.HasOne(d => d.idAlbaranNavigation).WithMany(p => p.detallesalbaranesidAlbaranNavigation)
.HasForeignKey(d => d.idAlbaran) .HasForeignKey(d => d.idAlbaran)
.HasConstraintName("detallesalbaranes_albaranes"); .HasConstraintName("detallesalbaranes_albaranes");
@@ -894,13 +944,18 @@ public partial class GrupoSanchoToroContext : DbContext
.HasForeignKey(d => d.idUltimaFactura) .HasForeignKey(d => d.idUltimaFactura)
.OnDelete(DeleteBehavior.SetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("detallesalbaranes_facturas"); .HasConstraintName("detallesalbaranes_facturas");
entity.HasOne(d => d.idUsuarioQueCancelaNavigation).WithMany(p => p.detallesalbaranes)
.HasForeignKey(d => d.idUsuarioQueCancela)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("detallesalbaranes_usuarios");
}); });
modelBuilder.Entity<detallesfacturas>(entity => modelBuilder.Entity<detallesfacturas>(entity =>
{ {
entity.HasKey(e => e.idDetalle).HasName("PRIMARY"); entity.HasKey(e => e.idDetalle).HasName("PRIMARY");
entity.HasIndex(e => e.idDetallePresupuesto, "detallesfacturas_detallespresupuestos_idx"); entity.HasIndex(e => e.idDetallePresupuesto, "detallesfacturas_detallepresupuestos_idx");
entity.HasIndex(e => e.idFactura, "detallesfacturas_facturas_idx"); entity.HasIndex(e => e.idFactura, "detallesfacturas_facturas_idx");
@@ -918,7 +973,7 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasOne(d => d.idDetallePresupuestoNavigation).WithMany(p => p.detallesfacturas) entity.HasOne(d => d.idDetallePresupuestoNavigation).WithMany(p => p.detallesfacturas)
.HasForeignKey(d => d.idDetallePresupuesto) .HasForeignKey(d => d.idDetallePresupuesto)
.OnDelete(DeleteBehavior.SetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("detallesfacturas_detallespresupuestos"); .HasConstraintName("detallesfacturas_detallepresupuestos");
entity.HasOne(d => d.idDetalleRTFNavigation).WithMany(p => p.detallesfacturas) entity.HasOne(d => d.idDetalleRTFNavigation).WithMany(p => p.detallesfacturas)
.HasForeignKey(d => d.idDetalleRTF) .HasForeignKey(d => d.idDetalleRTF)
@@ -1078,14 +1133,14 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.Descripcion, "Descripcion_UNIQUE").IsUnique(); entity.HasIndex(e => e.Descripcion, "Descripcion_UNIQUE").IsUnique();
entity.HasIndex(e => e.idEmpresa, "ejercicioscontables_empresas_idx"); entity.HasIndex(e => e.idEmpresa, "ejercicioscontables_empresascontables_idx");
entity.Property(e => e.Descripcion).HasMaxLength(40); entity.Property(e => e.Descripcion).HasMaxLength(40);
entity.Property(e => e.NivelesCuentas).HasMaxLength(20); entity.Property(e => e.NivelesCuentas).HasMaxLength(20);
entity.HasOne(d => d.idEmpresaNavigation).WithMany(p => p.ejercicioscontables) entity.HasOne(d => d.idEmpresaNavigation).WithMany(p => p.ejercicioscontables)
.HasForeignKey(d => d.idEmpresa) .HasForeignKey(d => d.idEmpresa)
.HasConstraintName("ejercicioscontables_empresas"); .HasConstraintName("ejercicioscontables_empresascontables");
}); });
modelBuilder.Entity<empresas>(entity => modelBuilder.Entity<empresas>(entity =>
@@ -1280,70 +1335,6 @@ public partial class GrupoSanchoToroContext : DbContext
.HasConstraintName("enumeraciones_gruposenumeraciones"); .HasConstraintName("enumeraciones_gruposenumeraciones");
}); });
modelBuilder.Entity<eventos>(entity =>
{
entity.HasKey(e => e.idEvento).HasName("PRIMARY");
entity.HasIndex(e => new { e.idEntidad, e.Descripcion }, "eventos_descripcion_unique").IsUnique();
entity.HasIndex(e => e.idEntidad, "obras_entidades_idx");
entity.HasIndex(e => e.CodigoMunicipio, "obras_municipios_idx");
entity.HasIndex(e => e.idUsuario, "obras_usuarios_idx");
entity.Property(e => e.CodigoMunicipio)
.HasMaxLength(10)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.CodigoPostal)
.HasMaxLength(10)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Descripcion)
.HasMaxLength(200)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Direccion)
.HasMaxLength(200)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Email)
.HasMaxLength(100)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Observaciones)
.HasMaxLength(200)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.PersonaContacto)
.HasMaxLength(80)
.UseCollation("latin1_swedish_ci")
.HasCharSet("latin1");
entity.Property(e => e.Telefono1)
.HasMaxLength(20)
.UseCollation("latin1_swedish_ci")
.HasCharSet("latin1");
entity.Property(e => e.Telefono2)
.HasMaxLength(20)
.UseCollation("latin1_swedish_ci")
.HasCharSet("latin1");
entity.HasOne(d => d.CodigoMunicipioNavigation).WithMany(p => p.eventos)
.HasForeignKey(d => d.CodigoMunicipio)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("destinosmontajes_municipios");
entity.HasOne(d => d.idEntidadNavigation).WithMany(p => p.eventos)
.HasForeignKey(d => d.idEntidad)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("destinosmontajes_entidades");
entity.HasOne(d => d.idUsuarioNavigation).WithMany(p => p.eventos)
.HasForeignKey(d => d.idUsuario)
.HasConstraintName("destinosmontajes_usuarios");
});
modelBuilder.Entity<expedientesarticulos>(entity => modelBuilder.Entity<expedientesarticulos>(entity =>
{ {
entity.HasKey(e => e.idExpediente).HasName("PRIMARY"); entity.HasKey(e => e.idExpediente).HasName("PRIMARY");
@@ -1436,7 +1427,7 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.idCliente, "facturas_clientes_idx"); entity.HasIndex(e => e.idCliente, "facturas_clientes_idx");
entity.HasIndex(e => e.idEvento, "facturas_eventos_idx"); entity.HasIndex(e => e.idObra, "facturas_eventos_idx");
entity.HasIndex(e => e.FechaEnvioAsesoria, "facturas_fechaenvioasesoria"); entity.HasIndex(e => e.FechaEnvioAsesoria, "facturas_fechaenvioasesoria");
@@ -1501,10 +1492,10 @@ public partial class GrupoSanchoToroContext : DbContext
.OnDelete(DeleteBehavior.SetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("facturas_DatosOriginales"); .HasConstraintName("facturas_DatosOriginales");
entity.HasOne(d => d.idEventoNavigation).WithMany(p => p.facturas) entity.HasOne(d => d.idObraNavigation).WithMany(p => p.facturas)
.HasForeignKey(d => d.idEvento) .HasForeignKey(d => d.idObra)
.OnDelete(DeleteBehavior.SetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("facturas_eventos"); .HasConstraintName("facturas_obras");
entity.HasOne(d => d.idSerieFacturaNavigation).WithMany(p => p.facturas) entity.HasOne(d => d.idSerieFacturaNavigation).WithMany(p => p.facturas)
.HasForeignKey(d => d.idSerieFactura) .HasForeignKey(d => d.idSerieFactura)
@@ -1827,6 +1818,23 @@ public partial class GrupoSanchoToroContext : DbContext
.HasConstraintName("menus_permisos"); .HasConstraintName("menus_permisos");
}); });
modelBuilder.Entity<modelospermitidos>(entity =>
{
entity.HasKey(e => e.idModeloPermitido).HasName("PRIMARY");
entity.HasIndex(e => e.idModeloGrua, "modelospermiticos__idx");
entity.HasIndex(e => e.idProducto, "modelospermitidos_productos_idx");
entity.HasOne(d => d.idModeloGruaNavigation).WithMany(p => p.modelospermitidosidModeloGruaNavigation)
.HasForeignKey(d => d.idModeloGrua)
.HasConstraintName("modelospermiticos_modelosgruas");
entity.HasOne(d => d.idProductoNavigation).WithMany(p => p.modelospermitidosidProductoNavigation)
.HasForeignKey(d => d.idProducto)
.HasConstraintName("modelospermitidos_productos");
});
modelBuilder.Entity<movimientosbancarios>(entity => modelBuilder.Entity<movimientosbancarios>(entity =>
{ {
entity.HasKey(e => e.idMovimientoBancario).HasName("PRIMARY"); entity.HasKey(e => e.idMovimientoBancario).HasName("PRIMARY");
@@ -1972,6 +1980,70 @@ public partial class GrupoSanchoToroContext : DbContext
.HasConstraintName("municipios_provincias"); .HasConstraintName("municipios_provincias");
}); });
modelBuilder.Entity<obras>(entity =>
{
entity.HasKey(e => e.idObra).HasName("PRIMARY");
entity.HasIndex(e => new { e.idEntidad, e.Descripcion }, "eventos_descripcion_unique").IsUnique();
entity.HasIndex(e => e.idEntidad, "obras_entidades_idx");
entity.HasIndex(e => e.CodigoMunicipio, "obras_municipios_idx");
entity.HasIndex(e => e.idUsuario, "obras_usuarios_idx");
entity.Property(e => e.CodigoMunicipio)
.HasMaxLength(10)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.CodigoPostal)
.HasMaxLength(10)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Descripcion)
.HasMaxLength(200)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Direccion)
.HasMaxLength(200)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Email)
.HasMaxLength(100)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.Observaciones)
.HasMaxLength(200)
.UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3");
entity.Property(e => e.PersonaContacto)
.HasMaxLength(80)
.UseCollation("latin1_swedish_ci")
.HasCharSet("latin1");
entity.Property(e => e.Telefono1)
.HasMaxLength(20)
.UseCollation("latin1_swedish_ci")
.HasCharSet("latin1");
entity.Property(e => e.Telefono2)
.HasMaxLength(20)
.UseCollation("latin1_swedish_ci")
.HasCharSet("latin1");
entity.HasOne(d => d.CodigoMunicipioNavigation).WithMany(p => p.obras)
.HasForeignKey(d => d.CodigoMunicipio)
.HasConstraintName("obra_municipios");
entity.HasOne(d => d.idEntidadNavigation).WithMany(p => p.obras)
.HasForeignKey(d => d.idEntidad)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("obras_entidades");
entity.HasOne(d => d.idUsuarioNavigation).WithMany(p => p.obras)
.HasForeignKey(d => d.idUsuario)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("obra_usuarios");
});
modelBuilder.Entity<permisos>(entity => modelBuilder.Entity<permisos>(entity =>
{ {
entity.HasKey(e => e.idPermiso).HasName("PRIMARY"); entity.HasKey(e => e.idPermiso).HasName("PRIMARY");
@@ -2047,7 +2119,7 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.idCliente, "presupuestos_clientes_idx"); entity.HasIndex(e => e.idCliente, "presupuestos_clientes_idx");
entity.HasIndex(e => e.idEvento, "presupuestos_obras_idx"); entity.HasIndex(e => e.idObra, "presupuestos_obras_idx");
entity.HasIndex(e => e.idUsuario, "presupuestos_usuarios_idx"); entity.HasIndex(e => e.idUsuario, "presupuestos_usuarios_idx");
@@ -2066,10 +2138,10 @@ public partial class GrupoSanchoToroContext : DbContext
.OnDelete(DeleteBehavior.SetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("presupuestos_DatosOriginales"); .HasConstraintName("presupuestos_DatosOriginales");
entity.HasOne(d => d.idEventoNavigation).WithMany(p => p.presupuestos) entity.HasOne(d => d.idObraNavigation).WithMany(p => p.presupuestos)
.HasForeignKey(d => d.idEvento) .HasForeignKey(d => d.idObra)
.OnDelete(DeleteBehavior.SetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("presupuestos_eventos"); .HasConstraintName("presupuestos_obras");
entity.HasOne(d => d.idUsuarioNavigation).WithMany(p => p.presupuestos) entity.HasOne(d => d.idUsuarioNavigation).WithMany(p => p.presupuestos)
.HasForeignKey(d => d.idUsuario) .HasForeignKey(d => d.idUsuario)
@@ -2137,8 +2209,6 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.idUsuarioModificador, "productos_02_usuarios_idx"); entity.HasIndex(e => e.idUsuarioModificador, "productos_02_usuarios_idx");
entity.HasIndex(e => e.idEmpresa, "productos_empresas_idx");
entity.HasIndex(e => e.idFamilia, "productos_familias_idx"); entity.HasIndex(e => e.idFamilia, "productos_familias_idx");
entity.HasIndex(e => e.idMarca, "productos_marcas_idx"); entity.HasIndex(e => e.idMarca, "productos_marcas_idx");
@@ -2150,6 +2220,7 @@ public partial class GrupoSanchoToroContext : DbContext
.UseCollation("latin1_swedish_ci") .UseCollation("latin1_swedish_ci")
.HasCharSet("latin1"); .HasCharSet("latin1");
entity.Property(e => e.DescripcionAbreviada).HasMaxLength(45); entity.Property(e => e.DescripcionAbreviada).HasMaxLength(45);
entity.Property(e => e.FacturarComoVentaPorDefecto).HasDefaultValueSql("b'0'");
entity.Property(e => e.FechaBaja).HasColumnType("datetime"); entity.Property(e => e.FechaBaja).HasColumnType("datetime");
entity.Property(e => e.Modelo).HasMaxLength(50); entity.Property(e => e.Modelo).HasMaxLength(50);
entity.Property(e => e.Observaciones) entity.Property(e => e.Observaciones)
@@ -2159,14 +2230,11 @@ public partial class GrupoSanchoToroContext : DbContext
entity.Property(e => e.PrecioVenta).HasDefaultValueSql("'0'"); entity.Property(e => e.PrecioVenta).HasDefaultValueSql("'0'");
entity.Property(e => e.PrefijoNumeroSerie).HasMaxLength(8); entity.Property(e => e.PrefijoNumeroSerie).HasMaxLength(8);
entity.Property(e => e.ReferenciaFabrica).HasMaxLength(45); entity.Property(e => e.ReferenciaFabrica).HasMaxLength(45);
entity.Property(e => e.UnidadesPorEmpresa).HasColumnType("json");
entity.HasOne(d => d.idEmpresaNavigation).WithMany(p => p.productos)
.HasForeignKey(d => d.idEmpresa)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("productos_empresas");
entity.HasOne(d => d.idFamiliaNavigation).WithMany(p => p.productos) entity.HasOne(d => d.idFamiliaNavigation).WithMany(p => p.productos)
.HasForeignKey(d => d.idFamilia) .HasForeignKey(d => d.idFamilia)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("productos_familias"); .HasConstraintName("productos_familias");
entity.HasOne(d => d.idMarcaNavigation).WithMany(p => p.productos) entity.HasOne(d => d.idMarcaNavigation).WithMany(p => p.productos)
@@ -2398,7 +2466,7 @@ public partial class GrupoSanchoToroContext : DbContext
.HasMaxLength(10) .HasMaxLength(10)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.CodigoMunicipioEvento) entity.Property(e => e.CodigoMunicipioObra)
.HasMaxLength(10) .HasMaxLength(10)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
@@ -2410,7 +2478,7 @@ public partial class GrupoSanchoToroContext : DbContext
.HasMaxLength(10) .HasMaxLength(10)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.CodigoPostalEvento) entity.Property(e => e.CodigoPostalObra)
.HasMaxLength(10) .HasMaxLength(10)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
@@ -2422,11 +2490,11 @@ public partial class GrupoSanchoToroContext : DbContext
.HasMaxLength(100) .HasMaxLength(100)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.DescripcionEvento) entity.Property(e => e.DescripcionObra)
.HasMaxLength(200) .HasMaxLength(200)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.DireccionEvento) entity.Property(e => e.DireccionObra)
.HasMaxLength(200) .HasMaxLength(200)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
@@ -2456,11 +2524,11 @@ public partial class GrupoSanchoToroContext : DbContext
.HasMaxLength(20) .HasMaxLength(20)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.ObservacionesEvento) entity.Property(e => e.ObservacionesObra)
.HasMaxLength(200) .HasMaxLength(200)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.PersonaContactoEvento) entity.Property(e => e.PersonaContactoObra)
.HasMaxLength(80) .HasMaxLength(80)
.UseCollation("latin1_swedish_ci") .UseCollation("latin1_swedish_ci")
.HasCharSet("latin1"); .HasCharSet("latin1");
@@ -2480,7 +2548,7 @@ public partial class GrupoSanchoToroContext : DbContext
.HasMaxLength(30) .HasMaxLength(30)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.Telefono1Evento) entity.Property(e => e.Telefono1Obra)
.HasMaxLength(20) .HasMaxLength(20)
.UseCollation("latin1_swedish_ci") .UseCollation("latin1_swedish_ci")
.HasCharSet("latin1"); .HasCharSet("latin1");
@@ -2496,7 +2564,7 @@ public partial class GrupoSanchoToroContext : DbContext
.HasMaxLength(30) .HasMaxLength(30)
.UseCollation("utf8mb3_general_ci") .UseCollation("utf8mb3_general_ci")
.HasCharSet("utf8mb3"); .HasCharSet("utf8mb3");
entity.Property(e => e.Telefono2Evento) entity.Property(e => e.Telefono2Obra)
.HasMaxLength(20) .HasMaxLength(20)
.UseCollation("latin1_swedish_ci") .UseCollation("latin1_swedish_ci")
.HasCharSet("latin1"); .HasCharSet("latin1");
@@ -2504,7 +2572,7 @@ public partial class GrupoSanchoToroContext : DbContext
.HasMaxLength(100) .HasMaxLength(100)
.UseCollation("latin1_swedish_ci") .UseCollation("latin1_swedish_ci")
.HasCharSet("latin1"); .HasCharSet("latin1");
entity.Property(e => e.idEvento).HasDefaultValueSql("'0'"); entity.Property(e => e.idObra).HasDefaultValueSql("'0'");
}); });
modelBuilder.Entity<v_apuntesagrupados>(entity => modelBuilder.Entity<v_apuntesagrupados>(entity =>

View File

@@ -60,7 +60,7 @@ namespace bdGrupoSanchoToro.dbcontext
{ {
try try
{ {
// optionsBuilder.UseMySql("server=GrupoSanchoToro;database=GrupoSanchoToro;port=13306;uid=m3soft;pwd=Romian2023--;persistsecurityinfo=True;TreatTinyAsBoolean=True;allowuservariables=True", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.2.0-mysql")); // optionsBuilder.UseMySql("server=GrupoSanchoToro;database=GrupoSanchoToro;port=13306;uid=m3soft;pwd=SanchoToro2023--;persistsecurityinfo=True;TreatTinyAsBoolean=True;allowuservariables=True", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.2.0-mysql"));
string cs = @";persistsecurityinfo=True;TreatTinyAsBoolean=False;allowuservariables=True"; string cs = @";persistsecurityinfo=True;TreatTinyAsBoolean=False;allowuservariables=True";
var lc = ListaConexiones(); var lc = ListaConexiones();

View File

@@ -46,7 +46,7 @@ namespace bdGrupoSanchoToro
}); });
private static string? ConexionPorDefecto=null; private static string? ConexionPorDefecto=null;
public static tscGrupoSanchoToro NuevoContexto(string NombreConexion = "" ,bool Lazy = true, bool SoloLectura = false, bool ConEventoSavingChanges = false, string aplicaciones = "") public static tscGrupoSanchoToro NuevoContexto(string NombreConexion = "" ,bool Lazy = true, bool SoloLectura = false, bool ConObraSavingChanges = false, string aplicaciones = "")
{ {
@@ -71,7 +71,7 @@ namespace bdGrupoSanchoToro
var Opciones = ob.Options; var Opciones = ob.Options;
tscGrupoSanchoToro bd = new tscGrupoSanchoToro(Opciones); tscGrupoSanchoToro bd = new tscGrupoSanchoToro(Opciones);
bd.Aplicaciones = aplicaciones; bd.Aplicaciones = aplicaciones;
if (ConEventoSavingChanges) bd.SavingChanges += GuardandoCambios; if (ConObraSavingChanges) bd.SavingChanges += GuardandoCambios;
return bd; return bd;
} }

View File

@@ -95,6 +95,10 @@
"Name": "cuentascorreo", "Name": "cuentascorreo",
"ObjectType": 0 "ObjectType": 0
}, },
{
"Name": "desgloseproductos",
"ObjectType": 0
},
{ {
"Name": "desglosetiposofertas", "Name": "desglosetiposofertas",
"ObjectType": 0 "ObjectType": 0
@@ -143,10 +147,6 @@
"Name": "enumeraciones", "Name": "enumeraciones",
"ObjectType": 0 "ObjectType": 0
}, },
{
"Name": "eventos",
"ObjectType": 0
},
{ {
"Name": "expedientesarticulos", "Name": "expedientesarticulos",
"ObjectType": 0 "ObjectType": 0
@@ -215,6 +215,10 @@
"Name": "menus", "Name": "menus",
"ObjectType": 0 "ObjectType": 0
}, },
{
"Name": "modelospermitidos",
"ObjectType": 0
},
{ {
"Name": "movimientosbancarios", "Name": "movimientosbancarios",
"ObjectType": 0 "ObjectType": 0
@@ -227,6 +231,10 @@
"Name": "municipios", "Name": "municipios",
"ObjectType": 0 "ObjectType": 0
}, },
{
"Name": "obras",
"ObjectType": 0
},
{ {
"Name": "permisos", "Name": "permisos",
"ObjectType": 0 "ObjectType": 0

View File

@@ -0,0 +1,46 @@
using bdGrupoSanchoToro.db;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace bdGrupoSanchoToro.extensiones
{
public class DesglosePorEmpresa
{
public int Empresa { get; set; }
public double TotalUnidades { get; set; }
public double UnidadesInicialesOFabricadas { get; set; }
public double UnidadesCompradas { get; set; }
public double UnidadesAlquiladas { get; set; }
public double UnidadesAveriadas { get; set; }
public double UnidadesVendidas { get; set; }
public double UnidadesSubAlquiladas { get; set; }
public double UnidadesDesechadas { get; set; }
[NotMapped]
[JsonIgnore]
public double UnidadesDisponibles
{
get
{
return this.TotalUnidades - this.UnidadesAlquiladas - this.UnidadesAveriadas;
}
}
[NotMapped]
[JsonIgnore]
public string NombreEmpresa
{
get
{
var emp = empresas.ListadoEmpresas().FirstOrDefault(x => x.idEmpresa == Empresa);
return emp == null ? "" : emp.RazonSocial;
}
}
}
}

View File

@@ -0,0 +1,70 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace bdGrupoSanchoToro.db
{
public partial class desgloseproductos
{
[NotMapped]
public bool ContieneHijos
{
get
{
if (this.idProductoNavigation is not null && this.idProductoNavigation.desgloseproductosidProductoPadreNavigation is not null)
{
return this.idProductoNavigation.desgloseproductosidProductoPadreNavigation.Any();
}
else
{
return false;
}
}
}
[NotMapped]
public ICollection<desgloseproductos> Hijos
{
get
{
return this.idProductoNavigation.desgloseproductosidProductoPadreNavigation;
}
}
[NotMapped]
public productos ProductoPadre
{
get
{
return this.idProductoPadreNavigation;
}
set
{
this.idProductoPadreNavigation = value;
}
}
[NotMapped]
public productos Producto
{
get
{
return this.idProductoNavigation;
}
set
{
this.idProductoNavigation = value;
}
}
[NotMapped]
public bool Descatalogado
{
get
{
return idProductoNavigation.Descatalogado;
}
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
using System.Runtime.CompilerServices;
namespace bdGrupoSanchoToro.db
{
public partial class detallepresupuesto:INotifyPropertyChanged
{
[NotMapped]
public productos? productos
{
get
{
return this.idProductoNavigation;
}
}
[NotMapped]
public virtual string DescripcionEspecial
{
get
{
string Des = this.idProductoNavigation.Descripcion ;
if (Des.Contains("("))
{
Des = Des.Split('(')[0];
}
return Des;
}
}
[NotMapped]
public virtual ICollection<detallepresupuesto>? detallepresupuesto1
{
get
{
return this.InverseidDetallePresupuestoPadreNavigation;
}
}
public double Importe
{
get
{
// If EsVenta Then
return Math.Round(this.Cantidad * this.Precio, 2, MidpointRounding.AwayFromZero);
// Else
// Return Math.Round(Cantidad * Precio * presupuestos.DiasAlquiler, 2, MidpointRounding.AwayFromZero)
// End If
}
}
[NotMapped]
public bool ContieneHijos
{
get
{
return this.detallepresupuesto1 is not null && this.detallepresupuesto1.Count > 0;
}
}
[NotMapped]
public virtual List<detallepresupuesto> DesgloseServicios
{
get
{
return this.detallepresupuesto1.Where(x => x.productos.Tipo == (int)productos.TipoProductoEnum.SERVICIO).ToList();
}
}
[NotMapped]
public virtual List<detallepresupuesto> DesgloseMaterial
{
get
{
return this.detallepresupuesto1.Where(x => x.productos.Tipo < (int)productos.TipoProductoEnum.SERVICIO).ToList();
}
}
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public void RefrescaCamposTemporales()
{
this.OnPropertyChanged("Importe");
this.OnPropertyChanged("ImporteGastos");
// OnPropertyChanged("NumeroAsientosTotal")
this.OnPropertyChanged("DesgloseServicios");
this.OnPropertyChanged("DesgloseMaterial");
}
}
}

View File

@@ -1,4 +1,6 @@
using System; using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using static bdGrupoSanchoToro.db.productos; using static bdGrupoSanchoToro.db.productos;
@@ -7,13 +9,32 @@ namespace bdGrupoSanchoToro.db
public partial class detallesalbaranes public partial class detallesalbaranes
{ {
//public albaranes albaranes
//{ private double? _UnidadesRecogidasTmp;
// get
// { [NotMapped]
// return this.idAlbaranNavigation; public double? UnidadesRecogidasTmp
// } {
//} get
{
if (_UnidadesRecogidasTmp.HasValue == false)
_UnidadesRecogidasTmp = Cantidad;
return _UnidadesRecogidasTmp;
}
set
{
_UnidadesRecogidasTmp = value;
}
}
[NotMapped]
public string Producto
{
get
{
return this.idProductoNavigation.Descripcion;
}
}
public string NumeroAlbaran public string NumeroAlbaran
{ {
get get
@@ -63,45 +84,68 @@ namespace bdGrupoSanchoToro.db
return this.idAlbaranNavigation.Entidad; return this.idAlbaranNavigation.Entidad;
} }
} }
public void ActualizaProducto(bdGrupoSanchoToro.dbcontext.GrupoSanchoToroContext bd, int Factor) public void ActualizaProducto(bdGrupoSanchoToro.tscGrupoSanchoToro bd, albaranes.TipoAlbaranEnum Tipo, int Factor,int Empresa)
{ {
try try
{ {
var pr = bd.productos.First(x => x.idProducto == this.idProducto); var pr = bd.productos.First(x => x.idProducto == this.idProducto);
if (pr.Tipo != (int)TipoProductoEnum.SERVICIO ) if (pr.Tipo < (int)TipoProductoEnum.SERVICIO )
{ {
var almo = this.idAlbaranNavigation.idAlmacenOrigen.HasValue ? bd.almacenes.First(x => x.idAlmacen== idAlbaranNavigation.idAlmacenOrigen) : (almacenes)null; almacenes almo;
var almd = this.idAlbaranNavigation.idAlmacenDestino.HasValue ? bd.almacenes.First(x => x.idAlmacen == this.idAlbaranNavigation.idAlmacenDestino) : (almacenes)null; almacenes almd;
switch ((albaranes.TipoAlbaranEnum)this.idAlbaranNavigation.Tipo) if (Tipo==albaranes.TipoAlbaranEnum.RECOGIDA || Tipo==albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER)
{
almo = this.idAlbaranRecogidaNavigation.idAlmacenOrigen.HasValue ? bd.almacenes.First(x => x.idAlmacen == idAlbaranRecogidaNavigation.idAlmacenOrigen) : (almacenes)null;
almd = this.idAlbaranRecogidaNavigation.idAlmacenDestino.HasValue ? bd.almacenes.First(x => x.idAlmacen == this.idAlbaranRecogidaNavigation.idAlmacenDestino) : (almacenes)null;
// Tipo = (albaranes.TipoAlbaranEnum)this.idAlbaranRecogidaNavigation.Tipo;
}
else
{
almo = this.idAlbaranNavigation.idAlmacenOrigen.HasValue ? bd.almacenes.First(x => x.idAlmacen == idAlbaranNavigation.idAlmacenOrigen) : (almacenes)null;
almd = this.idAlbaranNavigation.idAlmacenDestino.HasValue ? bd.almacenes.First(x => x.idAlmacen == this.idAlbaranNavigation.idAlmacenDestino) : (almacenes)null;
// Tipo = (albaranes.TipoAlbaranEnum)this.idAlbaranNavigation.Tipo;
}
switch (Tipo)
{ {
case albaranes.TipoAlbaranEnum.COMPRA: case albaranes.TipoAlbaranEnum.COMPRA:
{
this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto);
pr.UnidadesCompradas += this.Cantidad * (double)Factor;
pr.ActualizaUnidades(TipoUnidadesEnum.COMPRADAS, Empresa, this.Cantidad * (double)Factor);
this.ActStockGlobal(bd, pr, (almacenes.TipoAlmacenEnum)almd.Tipo, true, Factor, Empresa);
break;
}
case albaranes.TipoAlbaranEnum.FABRICACION:
case albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK: case albaranes.TipoAlbaranEnum.REGULARIZACION_STOCK:
{ {
this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto); this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto);
pr.UnidadesInicialesOFabricadas += this.Cantidad * (double)Factor; pr.UnidadesInicialesOFabricadas += this.Cantidad * (double)Factor;
this.ActStockGlobal(pr, (almacenes.TipoAlmacenEnum)almd.Tipo, true, Factor); pr.ActualizaUnidades(TipoUnidadesEnum.INICIALES_O_FABRICADAS, Empresa, this.Cantidad * (double)Factor);
this.ActStockGlobal(bd, pr, (almacenes.TipoAlmacenEnum)almd.Tipo, true, Factor, Empresa);
break; break;
} }
case albaranes.TipoAlbaranEnum.CAMBIO_ALMACEN: case albaranes.TipoAlbaranEnum.CAMBIO_ALMACEN:
{ {
this.ActStockPorAlmacen(bd, Factor * -1, almo.idAlmacen, pr.idProducto); this.ActStockPorAlmacen(bd, Factor * -1, almo.idAlmacen, pr.idProducto);
this.ActStockGlobal(pr, (almacenes.TipoAlmacenEnum)almo.Tipo, false, Factor * -1); this.ActStockGlobal(bd, pr, (almacenes.TipoAlmacenEnum)almo.Tipo, false, Factor * -1, Empresa);
this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto); this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto);
this.ActStockGlobal(pr, (almacenes.TipoAlmacenEnum)almd.Tipo, false, Factor); this.ActStockGlobal(bd, pr, (almacenes.TipoAlmacenEnum)almd.Tipo, false, Factor, Empresa);
break; break;
} }
case albaranes.TipoAlbaranEnum.ENTREGA: case albaranes.TipoAlbaranEnum.ENTREGA:
{ {
this.ActStockPorAlmacen(bd, Factor * -1, almo.idAlmacen, pr.idProducto); this.ActStockPorAlmacen(bd, Factor * -1, almo.idAlmacen, pr.idProducto);
this.ActStockGlobal(pr, (almacenes.TipoAlmacenEnum)almo.Tipo, this.EsVenta, Factor * -1); this.ActStockGlobal(bd,pr, (almacenes.TipoAlmacenEnum)almo.Tipo, this.EsVenta, Factor * -1, Empresa);
if (this.EsVenta == false) if (this.EsVenta == false)
{ {
pr.UnidadesAlquiladas += this.Cantidad * (double)Factor; pr.UnidadesAlquiladas += this.Cantidad * (double)Factor;
pr.ActualizaUnidades(TipoUnidadesEnum.ALQUILADAS, Empresa, this.Cantidad * (double)Factor);
} }
else else
{ {
pr.UnidadesVendidas += this.Cantidad * (double)Factor; pr.UnidadesVendidas += this.Cantidad * (double)Factor;
pr.ActualizaUnidades(TipoUnidadesEnum.VENDIDAS, Empresa, this.Cantidad * (double)Factor);
} }
break; break;
@@ -109,27 +153,29 @@ namespace bdGrupoSanchoToro.db
case albaranes.TipoAlbaranEnum.RECOGIDA: case albaranes.TipoAlbaranEnum.RECOGIDA:
{ {
this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto); this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto);
this.ActStockGlobal(pr, (almacenes.TipoAlmacenEnum)almd.Tipo, false, Factor); this.ActStockGlobal(bd,pr, (almacenes.TipoAlmacenEnum)almd.Tipo, false, Factor, Empresa);
pr.UnidadesAlquiladas += this.Cantidad * (double)Factor * (double)-1; pr.UnidadesAlquiladas += this.Cantidad * (double)Factor * (double)-1;
pr.ActualizaUnidades(TipoUnidadesEnum.ALQUILADAS, Empresa, this.Cantidad * (double)Factor * (double)-1);
break; break;
} }
case albaranes.TipoAlbaranEnum.SUBALQUILER: case albaranes.TipoAlbaranEnum.SUBALQUILER:
{ {
this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto); this.ActStockPorAlmacen(bd, Factor, almd.idAlmacen, pr.idProducto);
this.ActStockGlobal(pr, (almacenes.TipoAlmacenEnum)almd.Tipo, true, Factor); this.ActStockGlobal(bd,pr, (almacenes.TipoAlmacenEnum)almd.Tipo, true, Factor, Empresa);
pr.UnidadesSubAlquiladas += this.Cantidad * (double)Factor; pr.UnidadesSubAlquiladas += this.Cantidad * (double)Factor;
pr.ActualizaUnidades(TipoUnidadesEnum.SUBALQUILADAS, Empresa, this.Cantidad * (double)Factor);
break; break;
} }
case albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER: case albaranes.TipoAlbaranEnum.DEVOLUCION_SUBALQUILER:
{ {
this.ActStockPorAlmacen(bd, Factor * -1, almo.idAlmacen, pr.idProducto); this.ActStockPorAlmacen(bd, Factor * -1, almo.idAlmacen, pr.idProducto);
this.ActStockGlobal(pr, (almacenes.TipoAlmacenEnum)almo.Tipo, true, Factor * -1); this.ActStockGlobal(bd,pr, (almacenes.TipoAlmacenEnum)almo.Tipo, true, Factor * -1, Empresa);
pr.UnidadesSubAlquiladas += this.Cantidad * (double)Factor * (double)-1; pr.UnidadesSubAlquiladas += this.Cantidad * (double)Factor * (double)-1;
pr.ActualizaUnidades(TipoUnidadesEnum.SUBALQUILADAS, Empresa, this.Cantidad * (double)Factor * (double)-1);
break; break;
} }
} }
bd.GuardarCambios();
// bd.SaveChanges()
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -137,7 +183,7 @@ namespace bdGrupoSanchoToro.db
throw new Exception(ex.Message, ex); throw new Exception(ex.Message, ex);
} }
} }
private void ActStockPorAlmacen(bdGrupoSanchoToro.dbcontext.GrupoSanchoToroContext bd, int Factor, int idAlmacen, int idProducto) private void ActStockPorAlmacen(bdGrupoSanchoToro.tscGrupoSanchoToro bd, int Factor, int idAlmacen, int idProducto)
{ {
try try
{ {
@@ -151,13 +197,14 @@ namespace bdGrupoSanchoToro.db
bd.stocks.Add(st); bd.stocks.Add(st);
} }
st.Unidades += this.Cantidad * (double)Factor; st.Unidades += this.Cantidad * (double)Factor;
bd.GuardarCambios();
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception(ex.Message, ex); throw new Exception(ex.Message, ex);
} }
} }
private void ActStockGlobal(productos pr, almacenes.TipoAlmacenEnum TipoAlmacen, bool ActTotalUnidades, int Factor) private void ActStockGlobal(bdGrupoSanchoToro.tscGrupoSanchoToro bd, productos pr, almacenes.TipoAlmacenEnum TipoAlmacen, bool ActTotalUnidades, int Factor,int Empresa)
{ {
try try
{ {
@@ -176,7 +223,11 @@ namespace bdGrupoSanchoToro.db
} }
} }
if (ActTotalUnidades) if (ActTotalUnidades)
{
pr.TotalUnidades += this.Cantidad * (double)Factor; pr.TotalUnidades += this.Cantidad * (double)Factor;
pr.ActualizaUnidades(TipoUnidadesEnum.TOTAL, Empresa, this.Cantidad * (double)Factor);
}
bd.GuardarCambios();
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -0,0 +1,23 @@
using PropertyChanged;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.CompilerServices;
using tsUtilidades.Extensiones;
namespace bdGrupoSanchoToro.db
{
public partial class empresas
{
private static List<empresas>? _ListadoEmpresas;
public static List<empresas> ListadoEmpresas()
{
if (_ListadoEmpresas == null)
{
var bd= bdGrupoSanchoToro.tscGrupoSanchoToro.NuevoContexto();
_ListadoEmpresas = bd.empresas.ToList();
}
return _ListadoEmpresas;
}
}
}

View File

@@ -251,35 +251,35 @@ namespace bdGrupoSanchoToro.db
[NotMapped] public virtual string? Email2_TMP { get; set; } [NotMapped] public virtual string? Email2_TMP { get; set; }
[NotMapped] public virtual bool EnviarEmail_TMP { get; set; } [NotMapped] public virtual bool EnviarEmail_TMP { get; set; }
#region Eventos #region Obras
[NotMapped] [NotMapped]
public string ProvinciaEvento public string ProvinciaObra
{ {
get get
{ {
if (this.idEvento == null || this.idEventoNavigation.CodigoMunicipioNavigation == null) return ""; if (this.idObra == null || this.idObraNavigation.CodigoMunicipioNavigation == null) return "";
else else
return this.idEventoNavigation.CodigoMunicipioNavigation.CodigoProvinciaNavigation.Nombre; return this.idObraNavigation.CodigoMunicipioNavigation.CodigoProvinciaNavigation.Nombre;
} }
} }
[NotMapped] [NotMapped]
public string PoblacionEvento public string PoblacionObra
{ {
get get
{ {
if (this.idEvento == null || this.idEventoNavigation.CodigoMunicipioNavigation == null) return ""; if (this.idObra == null || this.idObraNavigation.CodigoMunicipioNavigation == null) return "";
else else
return this.idEventoNavigation.CodigoMunicipioNavigation.Nombre; return this.idObraNavigation.CodigoMunicipioNavigation.Nombre;
} }
} }
[NotMapped] [NotMapped]
public string DireccionEvento public string DireccionObra
{ {
get get
{ {
if (this.idEvento == null) return ""; if (this.idObra == null) return "";
else else
return this.idEventoNavigation.DireccionCompleta; return this.idObraNavigation.DireccionCompleta;
} }
} }
#endregion #endregion

View File

@@ -3,7 +3,7 @@
namespace bdGrupoSanchoToro.db namespace bdGrupoSanchoToro.db
{ {
public partial class eventos public partial class obras
{ {
public string DireccionCompleta public string DireccionCompleta
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,43 @@
using System; using bdGrupoSanchoToro.db;
using bdGrupoSanchoToro.extensiones;
using Google.Protobuf.WellKnownTypes;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text.Json;
namespace bdGrupoSanchoToro.db namespace bdGrupoSanchoToro.db
{ {
public partial class productos public partial class productos : INotifyPropertyChanged
{ {
private List<DesglosePorEmpresa>? _DesgloseUnidades;
[NotMapped]
public List<DesglosePorEmpresa>? DesgloseUnidades
{
get
{
if (_DesgloseUnidades == null)
{
if (string.IsNullOrEmpty(UnidadesPorEmpresa))
{
_DesgloseUnidades = new List<DesglosePorEmpresa>();
}
else
{
_DesgloseUnidades = JsonSerializer.Deserialize<List<DesglosePorEmpresa>>(UnidadesPorEmpresa);
}
}
return _DesgloseUnidades;
}
set => _DesgloseUnidades=value;
}
[NotMapped] [NotMapped]
public bool Descatalogado public bool Descatalogado
{ {
@@ -32,24 +58,307 @@ namespace bdGrupoSanchoToro.db
} }
} }
} }
// [NotMapped]
//public string DescripcionTipo [NotMapped]
//{ public virtual List<desgloseproductos> DesgloseMaterial
// get {
// { get
// return ((TipoProductoEnum)this.Tipo).ToString().Replace("_", " "); {
// } try
//} {
return this.desgloseproductosidProductoPadreNavigation.Where(x => x.Producto.Tipo < (int)TipoProductoEnum.SERVICIO).OrderBy(x => x.idProductoNavigation.Descripcion).ToList();
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
}
public event PropertyChangedEventHandler? PropertyChanged;
public void RefrescaCamposTemporales()
{
// this.OnPropertyChanged("DesgloseServicios");
this.OnPropertyChanged("DesgloseMaterial");
this.OnPropertyChanged("NumeroProductoTMP");
}
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
[NotMapped]
public string NumeroProductoTMP
{
get
{
if (this.idProducto == 0)
{
return "« AUTOMÁTICO »";
}
else
{
return this.idProducto.ToString();
}
}
}
[NotMapped]
public string DescripcionTipo
{
get
{
return ((TipoProductoEnum)this.Tipo).ToString().Replace("_", " ");
}
}
[NotMapped]
public double UnidadesDisponibles
{
get
{
return this.TotalUnidades - this.UnidadesAlquiladas - this.UnidadesAveriadas;
}
}
[NotMapped]
public int NumeroDescendientes
{
get
{
return this.desgloseproductosidProductoPadreNavigation.Count;
}
}
[NotMapped]
public virtual ICollection<desgloseproductos> Padres
{
get
{
return this.desgloseproductosidProductoNavigation;
}
}
[NotMapped]
public int NivelMaximoAscendientes
{
get
{
int NivelMaximo = 0;
int NivelActual = 0;
ObtieneNivelMaximoAscendiente(this, NivelActual, ref NivelMaximo);
return NivelMaximo - 1;
}
}
[NotMapped]
public int NivelMaximoDescendientes
{
get
{
int NivelMaximo = 0;
int NivelActual = 0;
ObtieneNivelMaximoDescendientes(this, NivelActual, ref NivelMaximo);
return NivelMaximo - 1;
}
}
[NotMapped]
public virtual List<string> ListaAscendientes
{
get
{
var Lista = new List<string>();
ObtieneListaAscendientes(this, "", ref Lista);
return Lista;
}
}
private void ObtieneListaAscendientes(productos p, string NombrePadre, ref List<string> Lista)
{
string NombreActual = (NombrePadre + "/" + p.Descripcion).TrimStart('/');
Lista.Add(NombreActual);
foreach (var d in p.Padres)
ObtieneListaAscendientes(d.ProductoPadre, NombreActual, ref Lista);
}
private void ObtieneNivelMaximoAscendiente(productos p, int NivelActual, ref int NivelMaximo)
{
NivelActual += 1;
NivelMaximo = Math.Max(NivelActual, NivelMaximo);
foreach (var d in p.Padres)
ObtieneNivelMaximoAscendiente(d.ProductoPadre, NivelActual, ref NivelMaximo);
}
public bool ContieneAscendiente(int idProducto)
{
bool bContiene = this.idProducto == idProducto;
if (!bContiene)
{
foreach (var d in Padres)
{
bContiene = d.ProductoPadre.ContieneAscendiente(idProducto);
if (bContiene)
break;
}
}
return bContiene;
}
// Public Function ContieneDescendiente(idProducto As Integer) As Boolean
// Dim bContiene As Boolean = (Me.idProducto = idProducto)
// If Not bContiene Then
// For Each d In Me.desgloseproductos
// bContiene = d.Producto.ContieneDescendiente(idProducto)
// If bContiene Then Exit For
// Next
// End If
// Return bContiene
// End Function
[NotMapped]
public bool ContieneDescendientes
{
get
{
return this.desgloseproductosidProductoPadreNavigation.Any();
}
}
private void ObtieneNivelMaximoDescendientes(productos p, int NivelActual, ref int NivelMaximo)
{
NivelActual += 1;
NivelMaximo = Math.Max(NivelActual, NivelMaximo);
foreach (var d in p.desgloseproductosidProductoPadreNavigation)
this.ObtieneNivelMaximoDescendientes(d.Producto, NivelActual, ref NivelMaximo);
}
[NotMapped] public int CantidadTMP { get; set; }
[NotMapped] public int UnidadesPropiasAIntervaloFechasTMP { get; set; }
[NotMapped] public int UnidadesSubarrendadasAIntervaloFechasTMP { get; set; }
[NotMapped] public int TotalUnidadesAIntervaloFechasTMP { get; set; }
[NotMapped] public int UnidadesPresupuestadasTMP { get; set; }
[NotMapped] public int UnidadesPresupuestadasYAceptadasTMP { get; set; }
[NotMapped] public int UnidadesDisponiblesNoPresupestadasTMP { get; set; }
[NotMapped] public int UnidadesDisponiblesNoContratadasTMP { get; set; }
[NotMapped] public int DisponibilidadTMP { get; set; }
public static void RecalculaStocks(tscGrupoSanchoToro bd, List<productos> lp = null)
{
try
{
var prds = lp is null ? bd.productos.Where(x => x.Tipo < (int)TipoProductoEnum.SERVICIO ).ToList() : lp;
foreach (var pr in prds)
{
pr.TotalUnidades = 0d;
pr.UnidadesInicialesOFabricadas = 0d;
pr.UnidadesCompradas = 0d;
pr.UnidadesVendidas = 0d;
pr.UnidadesAlquiladas = 0d;
pr.UnidadesAveriadas = 0d;
pr.UnidadesDesechadas = 0d;
pr.UnidadesSubAlquiladas = 0d;
pr.DesgloseUnidades?.Clear();
foreach (var st in pr.stocks)
st.Unidades = 0d;
bd.SaveChanges();
List<detallesalbaranes> dets = pr.detallesalbaranes.Where(x=>x.idAlbaranRecogida.HasValue==false).ToList();
foreach (var d in dets)
{
d.ActualizaProducto(bd, (albaranes.TipoAlbaranEnum)d.idAlbaranNavigation.Tipo, 1,d.idAlbaranNavigation.idEmpresa);
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
internal void ActualizaUnidades(TipoUnidadesEnum Tipo, int Empresa, double Cantidad)
{
if (DesgloseUnidades == null) DesgloseUnidades = new List<DesglosePorEmpresa>();
DesglosePorEmpresa du = DesgloseUnidades.FirstOrDefault(x => x.Empresa == Empresa);
if (du == null)
{
du = new DesglosePorEmpresa();
du.Empresa = Empresa;
du.TotalUnidades = 0d;
du.UnidadesInicialesOFabricadas = 0d;
du.UnidadesCompradas = 0d;
du.UnidadesVendidas = 0d;
du.UnidadesAlquiladas = 0d;
du.UnidadesAveriadas = 0d;
du.UnidadesDesechadas = 0d;
du.UnidadesSubAlquiladas = 0d;
DesgloseUnidades.Add(du);
}
switch (Tipo)
{
case TipoUnidadesEnum.TOTAL:
{
du.TotalUnidades += Cantidad;
break;
}
case TipoUnidadesEnum.INICIALES_O_FABRICADAS:
{
du.UnidadesInicialesOFabricadas += Cantidad;
break;
}
case TipoUnidadesEnum.COMPRADAS:
{
du.UnidadesCompradas += Cantidad;
break;
}
case TipoUnidadesEnum.ALQUILADAS:
{
du.UnidadesAlquiladas += Cantidad;
break;
}
case TipoUnidadesEnum.VENDIDAS:
{
du.UnidadesVendidas += Cantidad;
break;
}
case TipoUnidadesEnum.AVERIADAS:
{
du.UnidadesAveriadas += Cantidad;
break;
}
case TipoUnidadesEnum.DESECHADAS:
{
du.UnidadesDesechadas += Cantidad;
break;
}
case TipoUnidadesEnum.SUBALQUILADAS:
{
du.UnidadesSubAlquiladas += Cantidad;
break;
}
}
UnidadesPorEmpresa = JsonSerializer.Serialize(DesgloseUnidades);
}
public enum TipoUnidadesEnum
{
TOTAL=0,
INICIALES_O_FABRICADAS=1,
COMPRADAS = 2,
VENDIDAS=3,
ALQUILADAS=4,
AVERIADAS=5,
DESECHADAS=6,
SUBALQUILADAS=7
}
public enum TipoProductoEnum public enum TipoProductoEnum
{ {
GRUA = 0, GRUA = 0,
ELEMENTO_GRUA = 1, ELEMENTO_GRUA = 1,
REPUESTO =10, PIES_GRUA = 2,
REPUESTO = 10,
OTROS_PRODUCTOS = 11, OTROS_PRODUCTOS = 11,
CONSUMIBLES =12, CONSUMIBLES = 12,
MATERIAL_OFICINA = 13, MATERIAL_OFICINA = 13,
SERVICIO = 99, HERRAMIENTAS = 99,
SERVICIO = 100,
SOLO_OFERTAS = 200
} }
} }
} }

View File

@@ -0,0 +1,39 @@
using static bdGrupoSanchoToro.db.albaranes;
using Microsoft.VisualBasic.CompilerServices;
namespace bdGrupoSanchoToro.db
{
public partial class v_albaranesextendidos
{
public string PoblacionCarga
{
get
{
return Conversions.ToString(municipios.ObtienePoblacion(this.CodigoMunicipioCarga));
}
}
public string PoblacionDescargarga
{
get
{
return Conversions.ToString(municipios.ObtienePoblacion(this.CodigoMunicipioDescarga));
}
}
public string NumeroAlbaran
{
get
{
return albaranes.ObtieneNumeroAlbaran(this.idAlbaran, (PrefijoAlbaranEnum)this.Tipo);
}
}
public string DescripcionTipoAlbaran
{
get
{
return ((TipoAlbaranEnum)this.Tipo).ToString().Replace("_", " ");
}
}
}
}