yavsc/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs

108 lines
2.8 KiB
C#

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Billing
{
8 years ago
using Newtonsoft.Json;
using Workflow;
using Yavsc.Models.Payment;
using Yavsc;
using Yavsc.Billing;
7 years ago
using Yavsc.Abstract.Workflow;
7 years ago
using Yavsc.Services;
6 years ago
public abstract class NominativeServiceCommand : IBaseTrackedEntity, IDecidableQuery, IIdentified<long>
{
7 years ago
public string GetInvoiceId() { return GetType().Name + "/" + Id; }
public abstract long Id { get; set; }
public abstract string Description { get; set; }
7 years ago
[Required()]
public bool Consent { get; set; }
8 years ago
public DateTime DateCreated
{
get; set;
}
public DateTime DateModified
{
get; set;
}
public string UserCreated
{
get; set;
}
public string UserModified
{
get; set;
}
8 years ago
[DisplayAttribute(Name="Status de la requête")]
8 years ago
public QueryStatus Status { get; set; }
[Required]
public string ClientId { get; set; }
/// <summary>
/// The client
/// </summary>
8 years ago
[ForeignKey("ClientId"),Display(Name="Client")]
public ApplicationUser Client { get; set; }
[Required]
public string PerformerId { get; set; }
/// <summary>
/// The performer identifier
/// </summary>
8 years ago
[ForeignKey("PerformerId"),Display(Name="Préstataire")]
public PerformerProfile PerformerProfile { get; set; }
public DateTime? ValidationDate {get; set;}
[Display(Name="Previsional")]
public decimal? Previsional { get; set; }
/// <summary>
/// The bill
/// </summary>
/// <returns></returns>
8 years ago
[Required]
public string ActivityCode { get; set; }
8 years ago
[ForeignKey("ActivityCode"),JsonIgnore,Display(Name="Domaine d'activité")]
8 years ago
public virtual Activity Context  { get; set ; }
7 years ago
public bool Rejected { get; set; }
public DateTime RejectedAt { get; set; }
7 years ago
public abstract System.Collections.Generic.List<IBillItem> GetBillItems();
public bool GetIsAcquitted()
{
return Regularisation?.IsOk() ?? false;
}
public string GetFileBaseName(IBillingService billingService)
{
string type = GetType().Name;
string ack = GetIsAcquitted() ? "-ack" : null;
var bcode = billingService.BillingMap[type];
return $"facture-{bcode}-{Id}{ack}";
}
7 years ago
[Display(Name = "PaymentId")]
public string PaymentId { get; set; }
[ForeignKey("PaymentId"), Display(Name = "Acquittement de la facture")]
public virtual PayPalPayment Regularisation { get; set; }
7 years ago
}
8 years ago
}