Files
SanchoToro/bdGrupoSanchoToro/extensiones/DesglosePorEmpresa.cs
2026-02-17 13:47:52 +01:00

47 lines
1.3 KiB
C#

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;
}
}
}
}