Files
2024-02-09 10:34:52 +01:00

114 lines
3.0 KiB
C#

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace SHERPA.BBM.CORE.DbModels
{
/// <summary>
/// Tabella Doc Contabili (Fatture) - dati esterni per validazione/import
/// </summary>
[Table("BillingExt")]
public partial class BillingExtModel
{
public BillingExtModel()
{
B2ONav = new HashSet<AccMovModel>();
}
[Key, Column("IdxBillExt"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxBillExt { get; set; }
[Column("YearRef")]
public int YearRef { get; set; } = DateTime.Today.Year;
[Column("Num")]
public int Num { get; set; } = 0;
[Column("CodExt")]
public string CodExt { get; set; } = "";
[Column("DateIns")]
public DateTime DateIns { get; set; } = DateTime.Now;
[Column("CodCli")]
public string CodCli { get; set; } = "";
[Column("CustExtId")]
public string CustExtId { get; set; } = "";
[Column("CustomerId")]
public int CustomerId { get; set; }
[Column("RagSoc")]
public string RagSoc { get; set; } = "";
[Column("Net"), Precision(18, 6)]
public decimal Net { get; set; } = 0;
[Column("Vat"), Precision(18, 6)]
public decimal Vat { get; set; } = 0;
[Column("Amount"), Precision(18, 6)]
public decimal Amount { get; set; } = 0;
[Column("DateClose")]
public DateTime? DateClose { get; set; }
[Column("Paid"), Precision(18, 6)]
public decimal Paid { get; set; } = 0;
[Column("PayDue"), Precision(18, 6)]
public decimal PayDue { get; set; } = 0;
[Column("Descript")]
public string Descript { get; set; } = "";
[Column("IsValidated")]
public bool IsValidated { get; set; } = false;
[NotMapped]
public bool HasBill
{
get
{
bool answ = false;
if (B2ONav != null && B2ONav.Count > 0)
{
// contro il num di righe di link...
int numFatt = B2ONav.Count;
answ = numFatt > 0;
}
return answ;
}
}
[NotMapped]
public decimal AccMovAmount
{
get
{
decimal answ = 0;
if (B2ONav != null && B2ONav.Count > 0)
{
answ = B2ONav.Sum(x => x.Amount);
}
return answ;
}
}
public virtual ICollection<AccMovModel> B2ONav { get; set; }
[ForeignKey("CustExtId")]
public virtual CustDecodModel CustExtNav { get; set; }
}
}